Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
drawing and setting the starts attributes
function drawTable(rows) { var i, j; for (row of rows) { var tr = document.createElement('tr'); i = rows.indexOf(row); j = 0; for (item of row) { var td = document.createElement('td'); var span_valor = document.createElement('span'); span_valor.setAttribute('class', 'invisible'); span_valor.textContent = item; td.appendChild(span_valor); td.addEventListener('click', clicou); td.addEventListener('mousedown', longclicou); td.setAttribute('id', `${i},${j}`); j++; tr.appendChild(td); } table.appendChild(tr); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "begin() {\n this.ctx.beginPath();\n this.ctx.moveTo(this.position[0], this.position[1]);\n }", "start () {\n // Draw the starting point for the view with no elements\n }", "start () {\n // Draw the starting point for the view with no elements\n }", "configureStartingData() {\n // We don't use a singleton because defaults could change between calls.\n new DrawingDefaultsConfig(this, this._last_tool).render(true);\n }", "function drawStart(){\n graphics.font = \"60px Arial\";\n graphics.fillStyle = \"red\";\n graphics.fillText(\"Press y to start\",100,300);\n }", "function start_drawing() {\n $('#normal_ear').lazylinepainter( \n {\n \"svgData\": pathObj,\n \"strokeWidth\": 2,\n \"strokeColor\": \"#7f857f\"\n }).lazylinepainter('paint'); \n }", "function startDrawing(x,y){\n // console.log(e);\n isDrawing = true;\n startX = x;\n startY = y;\n}", "function startPosition(){\n painting = true;\n }", "function startLine() {\n picking_photo = false;\n line_started = true;\n updateLabels();\n}", "startDraw(){\n if(!this.drawing) {\n this.drawing = true;\n this.then = Date.now();\n this.draw();\n }\n }", "start() {\n this.preDragFill = this.attr(\"fill\");\n this.ox = this.attr(\"cx\");\n this.oy = this.attr(\"cy\");\n this.attr({ fill: config.draggingCircleColor });\n }", "function drawStart(e)\n\t{\n\t\tcurves = createCurves()\n\t\taddPoint(e)\n\t}", "start() {\n\t\tthis.run = true;\n\t\tthis.startDrawCycle();\n\t}", "function startDrawing(event) {\n isDrawing = true;\n [lastX, lastY] = [event.offsetX, event.offsetY];\n}", "function renderStart() {\n generateStart();\n }", "startDraw() {\n\t\tif (this.cursorVisible != false) {\n\t\t\tthis.write(\"\\x1B[?25l\");\n\t\t\tthis.cursorVisible = false;\n\t\t}\n\t\tthis.write(\"\\x1B7\"); //save cursor pos\n\t}", "function setUpStartState() {\n startState.x = width / 2;\n startState.y = 200;\n startState.vx = 5;\n startState.vy = 1;\n startState.size = 45;\n}", "startOver() {\n //x cordinates\n this.x = this.beginX;\n //y cordinates\n this.y = this.beginY;\n }", "function startLine(e){\n\t\t\tcontext.beginPath();\n\t\t\tcontext.strokeStyle = \"black\";\n\t\t\tcontext.lineCap = \"round\";\n\t\t\tcontext.lineWidth = 5;\n\t\t\tcontext.moveTo(e.clientX - theCanvas.offsetLeft, e.clientY - theCanvas.offsetTop);\n\t\t}", "function startScreen() {\n\tdraw();\n\tstartBtn.draw();\n}", "function startingPoint(e) {\n painting = true;\n paint(e);\n }", "show() {\n strokeWeight(3);\n stroke(this.clr);\n line(this.posx, this.posy, this.endx, this.endy);\n this.posx = this.endx;\n this.posy = this.endy;\n }", "function start(){\r\n\t\t// for now, start() will call _draw(), which draws all the objects on the stage\r\n\t\t// but in the next lesson, we'll add an animation loop that calls _draw()\r\n\t\t_draw(ctx);\r\n\t}", "function showStart() {\n layout.RemoveChild(loading);\n layout.AddChild(text);\n layout.AddChild(startButton);\n clearInterval(loadTime);\n\n // Setup arrows\n res.arrowTL_png.SetPosition(0, 0);\n res.arrowTR_png.SetPosition(0.9, 0);\n res.arrowBL_png.SetPosition(0, 0.85);\n res.arrowBR_png.SetPosition(0.9, 0.85);\n}", "function startDrawing(e) {\n\tcontext.moveTo(e.clientX, e.clientY);\n\tlastDrawing.push(new Array(e.clientX, e.clientY));\n\tdraw = true;\n\tmouseDraw(e);\n}", "function startScreen() {\n draw();\n startBtn.draw();\n}", "function instructionButton(){\n ctx.beginPath();\n ctx.fillStyle = \"#FFFFFF\";\n startPointX.lineWidth = 1;\n ctx.rect(10, 10, 150, 80);\n ctx.fill();\n ctx.textAlign = \"center\";\n ctx.fillStyle = \"#000000\";\n ctx.fillText(\"הוראות\", 85, 40);\n ctx.fillText(\"המשחק\", 85, 72);\n}", "function startDrawingPath() {\n length = 0;\n orig.style.stroke = \"#ffffff\";\n timer = setInterval(increaseLength, 1000 / drawFPS);\n}", "function start() {\n var path = new Pathway();\n wall = new Wall();\n pathway = path;\n click = 0;\n\n drawBackground();\n}", "display() {\n line(this.start.x, this.start.y, this.end.x, this.end.y);\n }", "function init() {\n clearCanvas()\n drawBackgroundColor()\n drawOrigin()\n }", "function dragStart() {\n this.ox = this.attr(\"x\");\n this.oy = this.attr(\"y\");\n }", "setStart(x, y){\n if (this.alive == false){\n this.x = x + 130;\n this.y = y + 17;\n }\n }", "function start(){ frameID = window.requestAnimationFrame(draw); }", "initializeState() {\n super.initializeState();\n const defaultWidth = 30;\n const defaultHeight = 50;\n const attrs = this.state.attributes;\n attrs.x1 = -defaultWidth / 2;\n attrs.y1 = -defaultHeight / 2;\n attrs.x2 = +defaultWidth / 2;\n attrs.y2 = +defaultHeight / 2;\n attrs.cx = 0;\n attrs.cy = 0;\n attrs.width = defaultWidth;\n attrs.height = defaultHeight;\n attrs.stroke = null;\n attrs.fill = { r: 200, g: 200, b: 200 };\n attrs.strokeWidth = 1;\n attrs.opacity = 1;\n attrs.visible = true;\n }", "function startPainting(event){ \n paint = true; \n getPosition(event); \n}", "initBeforeStroke(param) {\n\t\tsuper.initBeforeStroke(param);\n\t\t//LOGGING&&console.log(this.brush);\n\t\t// pre-render the brushtip data\n\t\tthis.lastCircleFromPrevStroke=null;\n\t}", "function startDraw(e) {\n ctx.beginPath();\n draw(e);\n}", "start(file, canvas, x, y) {\n this.startPos = {x,y};\n }", "startDrawing() {\n var canvas = this.context.getContext(\"2d\");\n canvas.save();\n this.updateAnimation = true;\n var infographic = this;\n window.requestAnimationFrame(function () { infographic.drawLoading(); });\n }", "setStart() {\n this.start = this.setPos();\n this.locationX = this.start.x;\n this.locationY = this.start.y;\n this.field[this.start.y][this.start.x] = pathCharacter;\n }", "draw() {\n\t\tlet width = 30;\n\n\t\tinfo.context.beginPath();\n\t\tinfo.context.rect(this.position.x - width/2, this.position.y - width/2, width, width);\n\t\tinfo.context.fillStyle = this.color;\n\t\tinfo.context.fill();\n\t}", "start() {\n this._enableAnimation = true;\n this._numberOfAnimationCycles = 0;\n }", "function start(x, y, evt) {\n\n\t\tevt.preventDefault();\n\n\t\tcurId = Tools.generateUID(\"r\"); //\"r\" for rectangle\n\n\t\tTools.drawAndSend({\n\t\t\t'type': 'rect',\n\t\t\t'id': curId,\n\t\t\t'color': Tools.getColor(),\n\t\t\t'size': Tools.getSize(),\n\t\t\t'opacity': Tools.getOpacity(),\n\t\t\t'x': x,\n\t\t\t'y': y,\n\t\t\t'x2': x,\n\t\t\t'y2': y\n\t\t});\n\n\t\tcurUpdate.id = curId;\n\t\tcurUpdate.x = x;\n\t\tcurUpdate.y = y;\n\t}", "function runAnimation() {\n\t // Draw a straight line\n\t bsBackground.draw({\n\t points: [0, height / 2 - 40, width, height / 3]\n\t });\n\n\t // Draw a straight line\n\t bsBackground.draw({\n\t points: [50, height / 3 - 40, width, height / 3]\n\t });\n\n\n\t // Draw another straight line\n\t bsBackground.draw({\n\t points: [width, height / 2, 0, height / 1.5 - 40]\n\t });\n\n\t // Draw a curve generated using 20 random points\n\t bsBackground.draw({\n\t inkAmount: 3,\n\t frames: 100,\n\t size: 200,\n\t splashing: true,\n\t points: 20\n\t });\n\t}", "draw(){\n this.ctx.strokeStyle = this.getStrokeColor();\n this.ctx.lineWidth = 2;\n this.ctx.beginPath()\n this.ctx.moveTo(this.prevx, this.prevy);\n this.ctx.lineTo(this.x, this.y)\n this.ctx.stroke()\n this.ctx.fill();\n }", "start() {\n if (this.mode !== mode.move) return;\n\n this.ox = this.box.attr(\"x\");\n this.oy = this.box.attr(\"y\");\n }", "function SetupStyleBegin() {\n // Setup properties of normal Style\n StyleBegin();\n // Setup properties of transform CSS\n TransformBegin();\n }", "display(){\n noStroke();\n fill(this.color);\n this.shape(this.x, this.y, this.size, this.size);\n for(var i=0; i<this.history.length; i++){\n var pos = this.history[i];\n this.shape(pos.x, pos.y, 8, 8);\n }\n }", "function drawLine() {\n\t\t// Si début du dessin : initialisation\n\t\tif(!started) {\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.lineWidth = width_brush;\n\t\t\tcontext.stroke();\n\t\t}\n\t}", "function draw(){\n\t\t// Needed to comply with Tool Delegate design pattern\n\t}", "startDrawing() {\n this.draw();\n this.drawingId = setTimeout(() => this.startDrawing(), 100);\n }", "draw() {\n\t\tlet width = 30;\n\n\t\tinfo.context.beginPath();\n\t\tinfo.context.moveTo(this.position.x - width/2, this.position.y + width/2);\n\t\tinfo.context.lineTo(this.position.x + width/2, this.position.y + width/2);\n\t\tinfo.context.lineTo(this.position.x, this.position.y - width/2);\n\t\tinfo.context.closePath();\n\t\tinfo.context.fillStyle = this.color;\n\t\tinfo.context.fill();\n\t}", "function renderStartScreen(ctx){\n ctx.fillStyle = \"black\";\n ctx.fillRect(0, 0, g_canvas.width, g_canvas.height);\n ctx.fillStyle = \"white\";\n ctx.font = \"bold 80px Arial\";\n ctx.fillText(\"BREAKOUT\", 110, 300);\n ctx.font = \"bold 25px Arial\";\n ctx.fillText(\"Use A and D to move\", 220, 330);\n ctx.fillText(\"Press space to start\", 225, 360);\n}", "function draw(){\n\tctx.clearRect(0,0,width,height); //清空工作区重画,不然所有的轨迹都有\n\tvar now = new Date();\n\tvar hour = now.getHours();\n\tvar min = now.getMinutes();\n\tvar sec = now.getSeconds();\n\tdrawBackground();\n\tdrawHour(hour,min);\n\tdrawMin(min);\n\tdrawSec(sec);\n\tdrawDot();\n\tctx.restore();//恢复原来环境,坐标原点左上角.因为中间调用了一次原点是设置,所以需要还原\n}", "function start()\n{\n\tvar body = $(\"body\");\n\tvar width = body.width();\n\tvar heigth = body.height();\n\t//console.log(width+\"-\"+heigth);\n\tvar hr=$(\"<hr />\");\n\thr.appendTo(body);\n\thr.css({\"position\":'relative', \"top\": 0});\n\tx = 10;\n\ty = heigth/2;\n}", "beginPath() {\n this.justBegun = true;\n this.context.beginPath();\n }", "function draw() {\n Gravity();\n Animation();\n FrameBorder(); \n FrameBorderCleaner();\n Controls();\n Interaction();\n}", "function draw() {\n\tstrokeWeight(5);\n\tstroke(0);\n\tline(0,0,cw,0);\n\tline(cw,0,cw,ch);\n\tline(0,ch,cw,ch);\n\tline(0,ch,0,0);\n\tif(mouseIsPressed){\n\t\tif(mouseButton == LEFT){\n\t\tlastX = mouseX;\n\t\tlastY = mouseY;\n\t\tdrawLine(startX,startY,lastX,lastY, clr, drawThickness);\n\t\tstartX = mouseX;\n\t\tstartY = mouseY;\n\t\t}else if(mouseButton == RIGHT){\n\t\t\tlastX = mouseX;\n\t\t\tlastY = mouseY;\n\t\t\tdrawLine(startX,startY,lastX,lastY, bgcolour, rubThickness);\n\t\t\tstartX = mouseX;\n\t\t\tstartY = mouseY;\t\n\t\t}\n\t}else{\n\t\tstartX = mouseX;\n\t\tstartY = mouseY;\n\t}\n}", "show () {\n stroke(255);\n line(this.initial.x, this.initial.y, this.final.x, this.final.y)\n }", "function startPressPen(event) {\n isDrawning = true\n\n // start draw here, go make some dots\n draw(event)\n }", "show() {\n\t\tstroke(255, 0, 0);\n\t\tstrokeWeight(3);\n\t\tfill(255, 128, 0);\n\t\trect(this.x, this.y, this.width, this.height);\n\t}", "paint() {\r\n graphics.fillStyle = \"#ff1a1a\";\r\n graphics.beginPath();\r\n graphics.moveTo(this.x, this.y + this.h / 2);\r\n graphics.lineTo(this.x + this.w / 2, this.y - this.h / 2);\r\n graphics.lineTo(this.x - this.w / 2, this.y - this.h / 2);\r\n graphics.closePath();\r\n graphics.fill();\r\n }", "function dragStart(){\n colorBeingDraged = this.style.backgroundImage\n squareIdBeingDragged = parseInt(this.id)\n console.log(colorBeingDraged)\n console.log(this.id, 'dragstart') // this.id is used here to call the id of each drag feature which we have created using set-attribute \n }", "startDrawingShapeMode() {\n if (this.getCurrentState() !== states.SHAPE) {\n this._state = states.SHAPE;\n this._getModule(modules.SHAPE).startDrawingMode();\n }\n }", "function preRoundStart() {\r\n\tlockSkip = true;\r\n\tlockBackspace = true;\r\n\tlockPoints = true;\r\n\tstopDrawing();\r\n\t//gratiiMultiplier = 1;\r\n\tcounter = 0;\r\n\t// pointUsage = 0;\r\n\ttransparency = 1;\r\n\tctxAnimation.globalAlpha = transparency;\r\n\tstartDrawingThreeSec();\r\n\tdrawPoints();\r\n}", "function animate(){\n console.log(\"Initializing\");\n context.save();\n context.clearRect(0, 0, 800, 500); \n context.font = \"60px Arial\";\n context.textAlign = \"center\";\n context.strokeStyle = \"white\";\n context.strokeText(\"Click to Start or Hit Enter\", canvas.width/2, canvas.height/2);\n context.font = \"40px Arial\";\n context.textAlign = \"center\";\n context.fillStyle = \"red\";\n context.fillText(\"Use LEFT and RIGHT Arrows\", canvas.width/2, canvas.height/2 + 75);\n context.restore();\n }", "display(){\n noStroke();\n fill(this.color);\n if(this.shape === rect){\n rotation += rotFactor;\n translate(windowWidth/2, windowHeight/2);\n rotate(rotation);\n this.shape(0, 0, this.size, this.size);\n }\n else{this.shape(this.x, this.y, this.size, this.size);}\n }", "draw() {\n rect(this.x1, this.y1, this.Width, this.Height);\n }", "draw() {\n rect(this.x1, this.y1, this.Width, this.Height);\n }", "set_drawing_position() {\n push()\n translate(this.module_x, this.module_y)\n }", "function start() {\n var canvas = document.getElementById('can');\n var context = canvas.getContext(\"2d\");\n $('#can').css('width', '100');\n $('#can').css('height', '100');\n $('#can').css('top', '0');\n $('#can').css('left', '0');\n $('#can').css('z-index', '-1');\n canvas.width = 100;\n canvas.height = 100;\n var draw = false;\n}", "function startDrawing(event) {\n\tdrawingMode = true;\n\tmouseUpDownLabel.innerHTML = \"Mouse Button Down (drawing mode)\";\n}", "function start(){\r\n\tmouse = new Mouse();\r\n\tplayer = new Player();\r\n\tscreen \t= new Screen();\r\n\tobjects = new GDI();\r\n\tenvironment = new Environment();\r\n\tmap = new Map(1);\r\n\tstarterButtonCopy = d.getElementById(\"starter\");\r\n\td.body.removeChild(starterButtonCopy);\r\n\tdocument.getElementById(\"canvas\").setAttribute(\"width\",screen['width']);\r\n\tdocument.getElementById(\"canvas\").setAttribute(\"height\",screen['height']);\r\n\tplayer.cash = 10000;\r\n\tflashes = setInterval(function(){update();},1);\r\n\tblinks = setInterval(function(){fixedUpdate();},32);\r\n}", "render() {\n noFill()\n stroke(this.layerColor)\n strokeWeight(this.randomWeight)\n push()\n translate(width / 2, height / 2)\n\n for (let i = 0; i < this.linesNumShapes; i++) {\n line(this.start * this.step, 0, (this.stop + 1) * this.step, 0)\n rotate(this.linesAngle)\n }\n\n pop()\n }", "function updateStartPlace(idNum, startHr, startMin, width) {\n var newX = (startHr*100) + (startMin/15*25) - 4;\n $(\"#rect_\" + idNum).attr(\"x\", newX);\n $(\"#rt_rect_\" + idNum).attr(\"x\", newX + width);\n $(\"#lt_rect_\" + idNum).attr(\"x\", newX);\n $(\"#title_text_\" + idNum).attr(\"x\", newX + 10);\n $(\"#time_text_\" + idNum).attr(\"x\", newX + 10);\n $(\"#handoff_btn_\" + idNum).attr(\"x\", newX + width - 18);\n $(\"#collab_btn_\" + idNum).attr(\"x\", newX + width - 38);\n\n var indexOfJSON = getEventJSONIndex(idNum);\n for (i = 1; i <= flashTeamsJSON[\"events\"][indexOfJSON].members.length; i++) {\n $(\"#event_\" + idNum + \"_eventMemLine_\" + i).attr(\"x\", newX+8);\n }\n}", "function draw_first_line(){\n points.push(start);\n points.push(end);\n}", "function init_xy(){\n\n\t\t\tg.append(\"line\")\n\t\t\t\t.attr(\"class\", \"xy\")\n\t\t\t\t.attr(\"x1\", 0)\n\t\t\t\t.attr(\"x2\", inner_w )\n\t\t\t\t.attr(\"y1\", h + 20)\n\t\t\t\t.attr(\"y2\", h + 20)\n\t\t\t\t.style(\"stroke\", \"#CCC\")\n\t\t\t\t.style(\"stroke-width\", \"1px\")\n\t\t\t\t.style(\"stroke-dasharray\", \"5 3\");\n\n\t\t}", "function started() {\r\n d3.selectAll(\".mouse-line\").classed(\"aleph-hide\", true);\r\n d3.selectAll(\".mouse-per-line\").classed(\"aleph-hide\", true);\r\n d3.selectAll(\".aleph-toolTip-Div\").classed(\"aleph-hide\", true);\r\n\r\n var p = d3.mouse(aleph.mouseoverRectangle);\r\n\r\n aleph.selectionRectangle.rectElement = d3\r\n .select(\"#aleph-line-chart\")\r\n .append(\"rect\")\r\n .attr(\"class\", \"selection\")\r\n .attr(\"rx\", 0)\r\n .attr(\"ry\", 0)\r\n .attr(\"x\", 0)\r\n .attr(\"y\", 0)\r\n .attr(\"width\", 0)\r\n .attr(\"height\", 0);\r\n\r\n aleph.selectionRectangle.originX = p[0];\r\n aleph.selectionRectangle.originY = p[1];\r\n\r\n aleph.selectionRectangle.currentX = p[0];\r\n aleph.selectionRectangle.currentY = p[1];\r\n\r\n getNewAttributes();\r\n\r\n aleph.chartStartDragX = aleph.xMain.invert(\r\n p[0] - aleph.margin.line[aleph.windowSize].left\r\n );\r\n\r\n aleph.chartStartDragY = aleph.yMain.invert(\r\n p[1] - aleph.margin.line[aleph.windowSize].top\r\n );\r\n\r\n aleph.chartDraggedCoordinates = [\r\n [aleph.chartStartDragX, aleph.chartStartDragY],\r\n [0, 0],\r\n ];\r\n\r\n // var chartWidth = aleph.xMain.range()[1] - aleph.xMain.range()[0];\r\n // var chartHeight = aleph.yMain.range()[0] - aleph.yMain.range()[1];\r\n\r\n // d3.selectAll(\".aleph-line-chart\")\r\n // .append(\"svg:image\")\r\n // .attr(\"class\", \"aleph-wasteBin\")\r\n // .attr(\"id\", \"aleph-wasteBin\")\r\n // .attr(\"xlink:href\", \"image/wasteBin.svg\")\r\n // .attr(\"width\", 50)\r\n // .attr(\"height\", 50)\r\n // .attr(\"x\", aleph.margin.line[aleph.windowSize].left + 10)\r\n // .attr(\"y\", aleph.margin.line[aleph.windowSize].top + chartHeight - 55);\r\n\r\n // document.getElementById(\"line-reset-axes\").disabled = false;\r\n\r\n return;\r\n}", "set start(value) {}", "startDrawing() {\n\n this.clearCanvas();\n //use because funtions was lost in methods\n var that = this;\n //event of mous click\n this.canvas.addEventListener(\"mousedown\", function(e) {\n //show confirmation button after first click\n document.getElementById(\"station-confirmer-btn\").style.display = \"initial\";\n document.getElementById(\"canvas\").style.borderColor = \"#5CB85C\";\n //switch on\n that.test = true;\n //begin of drawing\n that.context.beginPath();\n that.context.moveTo(e.offsetX, e.offsetY);\n //get the movement of mouse\n that.canvas.addEventListener(\"mousemove\", function(event) {\n //condition to check switch\n if (that.test === true) {\n var x = event.offsetX;\n var y = event.offsetY;\n //draw line to every next point od movement\n that.context.lineTo(x, y);\n that.context.stroke();\n }\n });\n });\n //mouse up event\n this.canvas.addEventListener(\"mouseup\", function() {\n //switch of\n that.test = false;\n });\n }", "function start() {\n startSeconds = new Date().getTime() / 1000;\n animating = true;\n }", "function renderStart(){\r\n\tvar y = document.createElement(\"div\");\r\n\ty.style.left=leftAmt + \"px\";\r\n\ty.style.top=topAmt + \"px\";\r\n\ty.style.width=parseInt(leftAmt/75)+7.5*75 + \"px\";\r\n\ty.style.borderColor=\"white\";\r\n\ty.style.opacity=0;\r\n\ty.style.backgroundColor=\"black\";\r\n\ty.style.zIndex=2;\r\n\ty.className=\"block\";\r\n\ty.id=\"startBlock\";\r\n\tvar blocks = document.getElementById(\"blocks\");\r\n\tblocks.appendChild(y);\r\n}", "start() {\n super.start();\n this.selected = 0;\n this.game.display.drawText(36, 1, 'ROTBASE');\n this.game.display.drawText(1, 4, '➧Start');\n this.game.display.drawText(2, 6, 'Help');\n this.game.display.drawText(2, 8, 'Credits');\n }", "setStartPosition() {\n this.x = DrunkenSailor.canvas.width - 20;\n this.y = 560;\n }", "startMiddle() {\n this._x = Scene_Width / 2;\n this._y = Scene_Height / 2;\n this._dx = 1;\n this._dy = 1.5;\n }", "function redrawStart(x, y){\n if(arrMatrix[y][x] === 0){\n clearRect(start.x, start.y)\n fillRect(x, y)\n arrMatrix[start.y][start.x] = 0;\n arrMatrix[y][x] = 2;\n start.x = x;\n start.y = y;\n }\n }", "startup()\n\t{\n\t\tthis.angle = 1;\n\t\tthis.rows(5, 11, 1);\n\t\tthis.action(0);\n\t}", "function start (e){\n\t\t\t\t// Determine the mouse position in the canvas (X,Y)\n\t\t\t\tvar mouseX = e.pageX - this.offsetParent.offsetLeft; // we use the offsetParent because the canvas has a parent different from body\n\t\t\t\tvar mouseY = e.pageY - this.offsetParent.offsetTop;\n\n\t\t\t\t// Switch the paint status to true\n\t\t\t\tpaint = true;\n\t\t\t\t// Save the click\n\t\t\t\taddClick(mouseX, mouseY);\n\t\t\t\t// Draw all the clicks from the beginning\n\t\t\t\tredraw();\n\t\t\t}", "function beginPath() {\n this._.beginPath();\n setcurrent(this, undefined, undefined);\n this.startSubpathX = this.startSubpathY = undefined;\n this._pathIsEmpty = true;\n return this;\n }", "draw() {\n\t\tthis.newPosition()\n\t\tthis.hoverCalc()\n\n\n\t\t// this.drawWaves()\n\n\t\tthis.applyCircleStyle()\n\n\n\t\tthis.ly.circle( this.x, this.y, 2 * this.r * this.scale )\n\n\t\tthis.applyTextStyle()\n\t\tthis.ly.text( this.label, this.x, this.y )\n\n\n\n\t}", "update(x, y, point) {\n\t \tlet constructor = this;\n\t\tmoveAt(x, y, point); \t\n\t\tfunction moveAt(x, y, point) {\n\t\t\tif (point == \"start\") {\n\t\t\t constructor.x1 = x;\n\t\t\t constructor.y1 = y;\n\t\t\t constructor.line.setAttribute('x1', x);\n\t\t\t constructor.line.setAttribute('y1', y);\n\t\t\t}\n\t\t\telse {\n\t\t\t constructor.x2 = x;\n\t\t\t constructor.y2 = y;\n\t\t\t\tconstructor.line.setAttribute('x2', x);\n\t\t\t constructor.line.setAttribute('y2', y);\n\t\t\t}\n\t\t}\n\t}", "constructor(ctx, xcoord, ycoord, startAngle, boundaries, color, name){\n super(name, xcoord, ycoord, color);\n this.ctx = ctx;\n // this.xcoord = xcoord;\n // this.ycoord = ycoord;\n this.startAngle = startAngle;\n\n }", "display(){\r\n \r\n rectMode(CENTER);\r\n fill(\"cyan\");\r\n rect (this.body.position.x, this.body.position.y, this.width, this.height);\r\n \r\n }", "function Drawing(){\n\n\tthis.header={\n\t\t$INSBASE:{x:0,y:0,z:0},\n\t\t$EXTMIN:{x:0,y:0,z:0},\n\t\t$EXTMAX:{x:10,y:10,z:0}\n\t};\n\tthis.tables={\n\t\tlinetype:{\n\t\t\tContinuous:{\n name: \"Continuous\",\n description: \"Solid line\",\n patternLength: 0\n },\n HIDDEN2: {\n name: \"HIDDEN2\",\n description: \"Hidden (.5x) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\",\n pattern:[0.125, -0.0625],\n patternLength: 0.1875\n }\n\t\t},\n\t\tlayer:{\n\t\t\thandle: \"2\",\n\t\t\townerHandle: \"0\",\n\t\t\tlayers: {\n\t\t\t\t\"0\":{Name:\"0\", Visible:true, color:16711680},\n\t\t\t\t\"A-WALL\":{Name:\"0\", Visible:true, color:16711680}\n\t\t\t}\t\t\n\t\t}\n\t};\n\tthis.blocks={};\n\tthis.entities=[\n\t\tline.create(this)\n\t\t//new line.Line(this)\n\t];\t\n}", "constructor() {\n super();\n this.draw();\n }", "function display() {\n //wrapEdges();\n background(225,200,255);\n textSize(12);\n textStyle(NORMAL);\n\n if (showarrows) {\n textSize(20);\n strokeWeight(0);\n fill(255,255,255);\n text(\"\",0.8*width,0.8*height+75);\n/*\n fill(0,0,255);\n text(\"Force\",0.8*width,0.8*height+50);\n fill(204,0,204);\n text(\"Acceleration\",0.8*width,0.8*height+75);\n*/\n }\n\n strokeWeight(10);\n var tri_width=7;\n if (showarrows) {\n var x_line=5;\n var y_line=5;\n var line_len=100;\n drawLine(x_line,y_line,x_line,y_line+line_len);\n drawLine(x_line,y_line,x_line+line_len,y_line);\n fill(0);\n drawTriangle(x_line-tri_width/2,y_line+line_len,x_line+tri_width/2,y_line+line_len,x_line,y_line+line_len+10);\n drawTriangle(x_line+line_len,y_line-tri_width/2,x_line+line_len,y_line+tri_width/2,x_line+line_len+10,y_line);\n strokeWeight(0);\n drawText(\"+x\",x_line+line_len+15,y_line);\n drawText(\"+y\",x_line,y_line+line_len+15);\n }\n\n drawLine(0,0,0,height); \n drawLine(0,height,width,height);\n drawLine(width,height,width,0);\n \n \n \n if (iterations%2 == 1) { \n append(xhistory,x);\n append(yhistory,y);\n }\n\n iterations += 1; \n \n if (keyIsPressed) {\n isrunning = true; \n }\n \n MaxLength = 0;\n \tif (xhistory.length > MaxLength) {\n xhistory = subset(xhistory,xhistory.length-MaxLength,xhistory.length);\n yhistory = subset(yhistory,yhistory.length-MaxLength,yhistory.length); \n } \n \n noFill(0); //If more text is written elsewhere make sure the default is black\n stroke(0); // If more lines are drawn elsewhere make sure the default is black\n strokeWeight();\n\t /*\n\t\ttextSize(20);\n\t strokeWeight(1);\n\t\tdrawText(\"Click this screen first!\",0.35*width,0.8*height);\n\t\tdrawText(\"then move the arrow keys!\",0.32*width,0.75*height);\n */\n}", "constructor( x, y, size, time ) {\n\n super();\n this.position.x = x;\n this.position.y = y;\n\n this.time = time;\n\n this.lineStyle( 1, 0x5C74C0, 1 );\n this.drawCircle( 0, 0, size * 2);\n }", "function startAnimation () {\r\n on = true; // Animation angeschaltet\r\n timer = setInterval(paint,40); // Timer mit Intervall 0,040 s aktivieren\r\n t0 = new Date(); // Neuer Bezugszeitpunkt \r\n }", "function startScreen() {\n fill(255, 56, 115, opacity);\n rect(0,0,width,height);\n textSize(12);\n if (frameCount%2 == 0){\n fill(255,opacity);\n textAlign(CENTER);\n textSize(12);\n text(\"CLICK TO PLAY\", width/2, height/2);\n }\n}", "draw() {\n noStroke();\n if (this.color) {\n fill(this.color.x, this.color.y, this.color.z);\n } else {\n fill(0);\n }\n rect(this.pos.x, this.pos.y, this.w, this.h);\n }" ]
[ "0.6773693", "0.6693239", "0.6693239", "0.6650837", "0.6639593", "0.66166884", "0.65992504", "0.65295535", "0.6513398", "0.64907867", "0.64627415", "0.6457839", "0.6443526", "0.6440928", "0.64351976", "0.6381266", "0.6329864", "0.6328915", "0.6312639", "0.6294597", "0.6244867", "0.622067", "0.6213153", "0.6173601", "0.6157908", "0.61565363", "0.6140661", "0.61382467", "0.6137408", "0.61205643", "0.61123157", "0.60901284", "0.60818774", "0.60643125", "0.60622996", "0.6058917", "0.60497606", "0.60442924", "0.6003754", "0.59847087", "0.598206", "0.5980507", "0.5970271", "0.59434485", "0.59425545", "0.59364206", "0.5926498", "0.5912453", "0.58958894", "0.5888939", "0.58837825", "0.58798045", "0.58726716", "0.5870047", "0.5863939", "0.5862727", "0.58623713", "0.5855061", "0.58376", "0.5824944", "0.58228076", "0.5821148", "0.58082193", "0.58067816", "0.5801965", "0.57997906", "0.5786691", "0.57859546", "0.5770443", "0.5770443", "0.5762042", "0.5761511", "0.57564557", "0.5756416", "0.5751006", "0.5742064", "0.57311434", "0.57300633", "0.5728777", "0.572505", "0.57246065", "0.57239354", "0.57226235", "0.5708791", "0.57075906", "0.5705134", "0.5696109", "0.568959", "0.56876755", "0.5684896", "0.56772465", "0.56764275", "0.5672842", "0.56723666", "0.567132", "0.56633675", "0.56625485", "0.56611544", "0.56597316", "0.5654518", "0.5649054" ]
0.0
-1
making the box the same old status whitout auto clicking it
function reatribute() { event.target.removeEventListener('mouseup', reatribute); setTimeout(() => { event.target.addEventListener('click', clicou) }, 500); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_updateStateOnClick() {\n const that = this;\n\n that._changeCheckState();\n that.focus();\n }", "function resetClickedBox() {\n\t\tif (clickedBox) {\n\t\t\tclickedBox.removeClass('clicked');\n\t\t\tclickedBox = null;\n\t\t}\n\t}", "clicked() {\r\n if (this.life === 0) {\r\n this.status = 1;\r\n this.life = 1;\r\n }else if (this.life === 1) {\r\n this.status = 0;\r\n this.life = 0;\r\n }\r\n }", "function handleBoxClick() {\n increasePoints();\n increaseSpeed();\n resetPosition();\n }", "function OnMouseDown () {\n\t\t\tif (TextBoxOnCheck == 0) {\n\n\t\t\t\tTextBoxOnCheck = 1; //Sets the variable to turn the box off\n\t\t\t\tMessageBox.SetActive(true); //Re-enables the box\n\t\t\t\tTextBox.GetComponent.<Text>().text = \"Villager: Thank you\"; //changes the message\n\t\t\t\tQuestText.GetComponent.<Text>().text = \"Active Quest: 'None'\"; // input the quest name\n\t\t\t}\n\t\t\t\t\n\t\t\telse {\n\t\t\t\tTextBoxOnCheck = 0;\n\t\t\t\tMessageBox.SetActive(false);\n\t\t\t\t//TextMessage = \"Sayonara\";\n\t\t\t}\n}", "function setBox(v) {\n\t\tstatus.find('.box span').html(v);\n\t}", "function boxClicked() {\r\n let clickedBox = this.className;\r\n let mark = this;\r\n let player = \"User\";\r\n mark.style.background = \"url(img/x-brush.png) no-repeat\";\r\n mark.style.backgroundSize = \"contain\";\r\n mark.style.backgroundPosition = \"center\";\r\n mark.style.pointerEvents = \"none\";\r\n checkClass(clickedBox, player);\r\n computerRandomizer(boxRow, mark);\r\n console.log(updateList.length);\r\n\r\n state();\r\n}", "function clickbox() {\n switch (state) {\n //When in 'idle' state\n case 0:\n sortear();\n break;\n //When showing the result of the previous game\n case 2:\n restablecer()\n break;\n }\n}", "function clickBox(event) {\n\tif (event.target.innerText === \"\" ) {\t\n\tevent.target.innerHTML = turn;\n\tswitchTurn();\n }\n}", "function boxClick() {\n let parentUl = $(this.parentElement);\n let textArea = $('.text-area', parentUl);\n let comment = $('.comment', parentUl);\n $(this).hide();\n $(textArea).show();\n $(comment).show();\n $(textArea).focus();\n let text = $('p', this)[0].innerHTML;\n textArea.val(text);\n $(textArea).focus();\n\n initialContent = textArea.val();\n initialComment = comment.val();\n }", "clickBox(){\n if(this.state.status == 0){\n this.setState({\n status: 1\n })\n }\n else{\n this.fetchJoke();\n }\n }", "function boxClickHandler (){\n if(!this.innerHTML){\n this.innerHTML = currentPlayer.image;\n // switchTurns();\n\n }\n if(checkWinnerTtt ()) {\n lockBoard()\n }\n if(checkWinnerTtt2()) {\n lockBoard2()\n }\n\n switchTurns()\n\n }", "toggleBoxStatus(x, y) {\n this.clearSelectedClues();\n\n // toggle the status of the box\n var box = this.board.get(x,y);\n\n let deletes = ClueHelper.determineDeletedClues(this.board, box);\n\n box.toggleBlackBoxState();\n\n let state = this.board.generateStateFromBoard();\n let creates = ClueHelper.determineCreatedClues(this.board, box);\n\n this.puzzle = state.puzzle;\n this.clues = ClueHelper.updateClues(this.clues, state.clues, creates, deletes);\n }", "function changeCell() {\n var clicked = document.getElementById(\"box\").click;\n if (clicked == true) {\n alert(\"box clicked\")\n document.getElementById(\"box\").background = colorSelected;\n }\n // mouse clicks on cell change to colorSelecetd value\n}", "function checkClicked() {\n \n}", "function handleClick() {\n setHam((old) => !old);\n }", "function _toggleBox(toggle){\n placeholder.each(function(){\n $(this).find('.indicator_background').toggle(toggle);\n });\n }", "function mouseUp(){\r\n isDown = false;\r\n box.style.border = 'none';\r\n }", "function toggleBox() {\n var sw = document.getElementById('switchview');\n var xtext = document.getElementById('toggler');\n if ( sw.checked == null || !sw.checked ) {\n xtext.setAttribute('checked', 'false');\n xtext.style.color = 'gray';\n formatPath = '/scripts/raw/';\n }\n else {\n xtext.style.color = 'black';\n formatPath = '/scripts/formatted/';\n }\n}", "function selectBox(e) {\n selectedBox = this\n\n setSelectedAppear(selectedBox, {\n 'stroke': 'black',\n 'stroke-width': '3'\n })\n}", "function setCheckButtonToActive() {\n\t\t_myDispatcher.dispatch(\"iteration.checkbutton\", {\"state\":\"active\"});\t\n\t}", "function undoBox() {\n\tif ((boxes.length > 0) && selected) {\n deselectBox();\n removeMiniBox();\n\t\tboxes[boxes.length - 1].remove();\n var button = document.getElementById(boxes[boxes.length-1]._leaflet_id);\n button.parentNode.removeChild(button);\n\t\tboxes.pop();\n\t}\n}", "function approve() {\n\tannehmen = true;\n\tchanged = true;\n\ttogglePopup('offer_approve', false);\n\tdocument.getElementById(\"state\").innerHTML = \"Angenommen (ungespeichert)\";\n\n}", "function mouseClicked(){\n if (value == false){\n value = true;\n console.log(\"change to true\");\n }\n else if (value == true) {\n value = false;\n console.log(\"change to false\")\n }\n }", "function boxClickedForHuman(e){\n const id = e.target.id; \n if(!spaces[id] && flag == true ){\n spaces[id] = currentPlayer;\n e.target.innerText = currentPlayer;\n if(currentPlayer == \"X\"){\n var element = document.querySelectorAll(\".box\");\n element[id].classList.add(\"color-red\")\n }else{\n var element = document.querySelectorAll(\".box\");\n element[id].classList.add(\"color-blueviolet\")\n }\n currentPlayer = currentPlayer == O_TEXT? X_TEXT:O_TEXT;\n setText('turn' , currentPlayer+\"'s turn\");\n count++;\n winX();\n winO();\n }\n}", "function scribblePoser() {\n\tvar $elt = $(\"#poser_chooser\");\n\t$elt.click();\n}", "function moveToNextBox (oldTag, newTag) {\n\n $(\".finished[tag=\" + oldTag + \"]\").attr('src', \"/smart-images/check-mark-green.png\");\n\n if (boxes[newTag] != \"selected\")\n {\n if (newTag == 9)\n {\n $(\".finished[tag=\" + newTag + \"]\").attr('src', \"/smart-images/check-required.png\"); \n }\n else\n {\n $(\".finished[tag=\" + newTag + \"]\").attr('src', \"/smart-images/check-current.png\"); \n }\n } \n \n $(\".finished[tag=\" + oldTag + \"]\").attr('height', 15);\n $(\".finished[tag=\" + oldTag + \"]\").attr('width', 15);\n\n boxes[oldTag] = \"selected\";\n }", "function newEntry(){\n if (eq === 'o'){\n $('#box').val('');\n eq = 'x'\n }\n }", "function toggleBox(e, otherId) {\n if (e.target.checked && document.activeElement == e.target) {\n e.stopPropagation();\n document.getElementById(otherId).checked = \"\";\n }\n }", "toggleStatus(value){\n LayoutAnimation.spring();\n this.setState({status: value, switchOnOff: value});\n if (value === false){\n this.deleteAlert();\n }else{\n this.currentPos();\n this.updateLocations();\n }\n }", "function markBox(id) {\r\n let boxClicked = id;\r\n if(player === 1) {\r\n $('#'+id).css('background-color', 'red');\r\n $('#'+id).prop('disabled', true);\r\n } else if(player === 2){\r\n $('#'+id).css('background-color', 'black');\r\n $('#'+id).prop('disabled', true);\r\n }\r\n numOfButtons += 1;\r\n setTimeout(checkWinner, 50, boxClicked);\r\n}", "function getIdFromBox() {\r\n\t\tconsole.log(\"clicked\");\r\n\t\tdisplayEvents(this.id);\r\n\t}", "function boxmode() {\n mode = \"box\"\n}", "function boxEvent(e) {\n changeHighlightClass(e.type);\n preventDefaults(e);\n }", "function clickPrefect() {\n if (student.prefect === true) {\n student.prefect = false;\n } else {\n tryToMakePrefect(student);\n }\n buildList();\n }", "function boxClickedForComp(e){\n \n currentPlayer = O_TEXT?O_TEXT:X_TEXT;\n const id = e.target.id;\n if(!spaces[id] && flag == true && currentPlayer == O_TEXT && check == 1){\n setText('turn' , \"Computer's turn\");\n spaces[id] = currentPlayer;\n e.target.innerText = currentPlayer;\n var element = document.querySelectorAll(\".box\");\n element[id].classList.add(\"color-blueviolet\")\n count++;\n winX();\n winO();\n check = 0;\n } \n if(check == 0){\n setTimeout(function(){\n setText('turn' , \"Your's turn\");\n while(moves!=1 && flag == true){\n let position = Math.round((Math.random()*8));\n if(boxes[position].textContent === \"\"){\n boxes[position].textContent = X_TEXT;\n var element = document.querySelectorAll(\".box\");\n element[position].classList.add(\"color-red\")\n count++;\n spaces[position] = X_TEXT;\n moves = 1;\n check = 1;\n winX();\n winO();\n }\n }\n }, 1000);\n moves = 0;\n }\n}", "function mouseDoubleClickBox(){\n box.style.backgroundColor = \"green\"\n}", "function refr() {\n $.each(box, function() {\n $(this).html('');\n });\n selectionMade = false;\n o.removeClass('red');\n x.removeClass('red');\n x.one('click', xselect);\n o.one('click', oselect);\n avail = [0, 1, 2, 3, 4, 5, 6, 7, 8];\n moveCount = 0;\n aiMove = false;\n }", "_menubuttonTap(e) {\n this.shadowRoot.querySelector(\"#listbox\").style.display = \"inherit\";\n if (this.resetOnSelect) {\n this.selected = \"\";\n }\n }", "function trapstatus(ident, status) {\n document.getElementById(ident).disabled= false;\n $(document).ready(function(){\n $('input[type=checkbox][id=' + ident + ']').switchButton({ checked: status});\n });\n document.getElementById(ident).disabled= true;\n\n }", "function openBox(box) {\r\n // Adds the class that refers to this box as revealed\r\n $(box).addClass('-is-revelead');\r\n\r\n // Hides the default content\r\n $(box).find('.panel__default').addClass('-is-hidden');\r\n\r\n // And shows the hover content\r\n $(box).find('.panel__hover').removeClass('-is-hidden');\r\n }", "function boxChecked(event) {\n\t\tconst element = event.target;\n\t\tif (element.type === \"checkbox\") {\n\t\t\ttodoList = JSON.parse(localStorage.getItem(\"todoList\"));\n\t\t\ttodoList[element.id.split('-')[1] - 1].checked = element.checked.toString();\n\t\t\tlocalStorage.setItem(\"todoList\", JSON.stringify(todoList));\n\t\t\tlet id = element.id;\n\t\t\tChangeClassStrike(todoList[element.id.split('-')[1] - 1].checked, id);\n\t\t}\n\t}", "function showrandomBox(objBox) {\r\n\t\tvar randomNum = randomNumber(objBox.memoryCount);\r\n\t\tvar randomColor = randomNumber(5)+1\r\n\r\n\t\tobjBox.resultBox[objBox.insertCount] = objBox.backupBox[randomNum];\r\n\t\tobjBox.backupBox.splice(randomNum, 1);\r\n\t\t$(objBox.resultBox[objchoice.insertCount]).css(\"background-image\", \"url('../images/DecisionChoice_Button\"+randomColor+\".png')\").show();\r\n\t\tobjBox.insertCount++;\r\n\t\tobjBox.memoryCount--;\r\n\t} //end function", "function noweKonto(){\r\n clicked = true;\r\n}", "function statusON() {\n\tshowStatus = true;\n\t// Setup Einstellungen Anzeigen\n\tstatusPart.style.display = \"block\";\n // Setup Botton umbenennen\n statusBtn.innerText = \"Hidde status option\";\n}", "goToRecipeBox() {\n if (this.recipeBox.waitForExist()) {\n this.recipeBox.click();\n }\n }", "function letsCheck() {\n\t\t// add delay to 1 sec so you can see what color you clicked.\n\t\tsetTimeout(function(){\n\t\t\n\t\tvar marked1 = $(\".marked1\");\n\t\tvar marked2 = $(\".marked2\");\n\t\tif (marked1.attr(\"value\") === marked2.attr(\"value\")) {\n\t\t\tmarked1.addClass(\"finnished\");\n\t\t\tmarked2.addClass(\"finnished\");\n\t\t\tmarked1.removeClass(\"marked1\");\n\t\t\tmarked2.removeClass(\"marked2\");\n\t\t}\n\t\telse {\n\t\t\tmarked1.attr(\"src\", \"cards/memory_front.jpg\");\n\t\t\tmarked2.attr(\"src\", \"cards/memory_front.jpg\");\n\t\t\tmarked1.removeClass(\"marked1\");\n\t\t\tmarked2.removeClass(\"marked2\");\n\t\t}\n\t\tclassesCheck = 0;\n\t\tisAllDone();\n\t\t\n\t\t}, 1000);\n\t}", "function qll_utility_boxchecked()\r\n{\r\n\t$(\"#remember\").attr('checked','checked');\r\n}", "function zoto_set_menu_box_edit(){\n\tthis.$uber({label_text:_('edit'), open_event:'onclick'});\n//\tthis.zoto_menu_box({label_text:_('edit'), open_event:'onclick'});\n}", "function openboxbl(box){\n\tAnimate(box, 0, 50, 1, 1000, changewidth, null);\n\tAnimate(box, 0, 50, 1, 1000, changeheight,null);\n\tAnimate(box, parseInt(box.style.top), parseInt(box.style.top)-50, 1, 1000, changetop, null);\n}", "function prevEditing() {\n //$(svgRoot).find('.prev-editing').removeClass('prev-editing').click();\n var prev = $(svgRoot).find('.prev-editing');\n if ( prev.length > 0 )\n prev.removeClass('prev-editing').click();\n else\n $(svgRoot).find('.editable').first().click();\n }", "handleNewToy(e) {\n\t\tlet item_id = e.target.getAttribute('data-key');\n\t\tlet user_id = this.props.user.id;\n\t\t\n\t\tthis.props.actions.addBox('/api/boxes', {active: true, item_id: item_id, user_id: user_id}).then(\n\t\t\t()=>{\n\t\t\t\tthis.props.actions.fetchUsers('/api/users').then(()=>{ this.setState({addToy: false});\n\t\t\t\t});\n\t\t\t});\t\n\t}", "function clickActiveLink() {\r\n var splitID = this.id.split(\"_\");\r\n replaceContent(splitID[1] + \"/\" + splitID[2], this.title);\r\n if (boxStatus == 0) {\r\n showBox();\r\n } \r\n}", "relocation_tickCheckBox() {\n return relocationCheckBox.click();\n }", "function setInactiveOnRing(xAlarmID)\n{\n if (xAlarmID == -1){\n return;\n }\n checkboxID = \"check\" + xAlarmID;\n for(var count=0; count< alarmList.length; count++)\n {\n if(alarmList[count].aId == xAlarmID)\n {\n break;\n }\n }\n // alarmList[count].activeFlag = false;\n console.log (\"The flag was changed after ring to\" + alarmList[count].activeFlag.toString() );\n document.getElementById(checkboxID).click();\n}", "function setCheckButtonToInactive() {\n\t\t_myDispatcher.dispatch(\"iteration.checkbutton\", {\"state\":\"inactive\"});\n\t}", "function setStatus() {\n const parent = $(this).parent();\n parent.addClass('loading');\n $.getJSON(this.href + '?format=json&jsoncallback=?', function (data) {\n $('.mqueue_status_links_' + data.id).each(function () {\n $(this).replaceWith(data.status);\n });\n\n parent.removeClass('loading');\n $('.mqueue_status_links_' + data.id + ' .mqueue_status').click(setStatus);\n });\n return false;\n }", "function changesym(){\n \n if (checkmark2.checked){\n autolo = false;\n localStorage.setItem(\"systemType\" , \"Two\");\n clearInterval(loopsym);\n} else if (checkmark.checked) {\nlocalStorage.setItem(\"systemType\" , \"One\");\nautolo = true;\nloopsym = setInterval(Incrementposition, LoopSpeed);\n\n}\nletters[0].focus();\ncounter = 0;\n}", "function clickHandler(){\n\tctr++;\n\tclearTimeout(timeoutID);\n\n /*---------------------\n Resets the boxes when a match\n has not been made\n ---------------------*/\n\tif(ctr % 2 !== 0 && his.length > 0){\n\t\this.pop().setAttributeNS(null, \"fill\", \"lightgrey\");\n\t\this.pop().setAttributeNS(null, \"fill\", \"lightgrey\");\n\t}\n\tvar currentBox = this;\n\tcurrentBox.setAttributeNS(null, \"fill\", colors[currentBox.getAttributeNS(null,\"idx\")]);\n\n /*---------------------\n Sets selection equal to\n the box that has been selected first\n ---------------------*/\n\tif(ctr % 2 !== 0){\n\t\tselection = this;\n\t}\n\n /*---------------------\n Handles the second click\n\n First, checks if the same box as selection\n is clicked, does nothing in this case.\n ---------------------*/\n\tif(ctr % 2 === 0){\n\t\tif(selection.getAttributeNS(null,\"idx\") === currentBox.getAttributeNS(null,\"idx\")){\n\t\t\tctr--;\n\t\t}\n\t\telse{\n\t\t\tif(colors[selection.getAttributeNS(null, \"idx\")] === colors[currentBox.getAttributeNS(null, \"idx\")]){\n\t\t\t\tselection.removeEventListener('click', clickHandler, false);\n\t\t\t\tcurrentBox.removeEventListener('click', clickHandler, false);\n\t\t\t\tmatches++; //if a match has been made, removes the listeners for those boxes\n\t\t\t\tif(matches===50){ //Checks the win condition\n\t\t\t\t\talert(\"Congratulations, you've won!\");\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\this.push(currentBox);\n\t\t\t\this.push(selection);\n\t\t\t\ttimeoutID = setTimeout(function(){\n\t\t\t\t\tcurrentBox.setAttributeNS(null, \"fill\", \"lightgrey\");\n\t\t\t\t\tselection.setAttributeNS(null, \"fill\", \"lightgrey\");\n\t\t\t\t},500);\n\t\t\t}\n\t\t}\n\t}\n}", "function putNotifBtnOn() {\n $('#notifYes').addClass('focus active');\n $('#notifNo').removeClass('focus active');\n}", "function toggleLine(event) {\r\n var valueToAdd = 0;\r\n\r\n if ($(\"#\" + event.data.divName).attr(\"activated\") === \"1\") {\r\n $(\"#\" + event.data.divName).attr(\"activated\", \"0\");\r\n ///deactivate => addvalue\r\n valueToAdd = parseInt($(\"#\" + event.data.divName).attr(\"value\"));\r\n $(\"#\" + event.data.divName).css(\"color\", \"grey\");\r\n $($(\"#\" + event.data.divName).find(\"span\")[0]).css(\"color\", \"grey\");\r\n $($(\"#\" + event.data.divName).find(\"span\")[0]).attr(\"class\", \"\");\r\n localStorage[event.data.divName] = 0;\r\n }\r\n else {\r\n $(\"#\" + event.data.divName).attr(\"activated\", \"1\");\r\n ///activate => remove value => add minus\r\n valueToAdd = parseInt(\"-\" + $(\"#\" + event.data.divName).attr(\"value\"));\r\n $(\"#\" + event.data.divName).css(\"color\", \"black\");\r\n colorSpan(event.data.divName, -100);\r\n localStorage[event.data.divName] = 1;\r\n }\r\n //alert(\"set loyerDiv : \" + localStorage[event.data.divName]);\r\n\r\n var currentSolde = parseInt($(\"#newSoldeDiv\").attr(\"value\"));\r\n var newSolde = currentSolde + valueToAdd;\r\n $(\"#newSoldeDiv\").attr(\"value\", newSolde);\r\n $(\"#newSoldeDiv\").html(\"<b> Solde fin du mois : <span style='float:right'>\" + newSolde + \" \\u20AC</span></b>\");\r\n colorSpan(\"newSoldeDiv\", newSolde);\r\n\r\n }", "function changeStatus() {\n\t\n\tvar hiddenStatus = document.getElementById('hiddenstatus');\n\tvar statusBtn = document.getElementById('statusbtn');\n\tif(selectedRadio() != false)\n\t{\n\t//choice exist\n\tif(hiddenStatus.value == \"yellow\")\n\t\t{\n\t\t\t//marking on dobut\n\t\t\thiddenStatus.value = \"green\";\n\t\t\tstatusBtn.style.backgroundColor = \"#228B22\";\n\t\t\tstatusBtn.innerHTML = \"Flag\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\thiddenStatus.value =\"yellow\";\n\t\t\tstatusBtn.style.backgroundColor = \"orange\";\n\t\t\tstatusBtn.innerHTML = \"Unflag\";\n\t\t}\n\t}\n\telse\n\t{\n\t\t//no choice exist\n\t\tif(hiddenStatus.value == \"yellow\")\n\t\t{\n\t\t\thiddenStatus.value = \"red\";\n\t\t\tstatusBtn.style.backgroundColor = \"red\";\n\t\t\tstatusBtn.innerHTML = \"Flag\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\thiddenStatus.value = \"yellow\";\n\t\t\tstatusBtn.style.backgroundColor = \"orange\";\n\t\t\tstatusBtn.innerHTML = \"Unflag\";\n\t\t}\n\n\t}\n\tconsole.log(hiddenStatus.value + \" hidden\")\n}", "function updateStatus() {\nconst defaultStatus = \"Click on Palette to Start\";\n\t//\tse non è attiva nessuna modalità, mostro il testo predefinito\n\tif (mode == \"\")\n\t\td3.select('#statusline').text(defaultStatus);\n\t//\taltrimenti stampo la modalità e il tipo di shape correnti\n\telse if (mode == \"draw\")\n\t\td3.select('#statusline').text(\"draw \" + shapeType);\n\telse\n\t\td3.select('#statusline').text(mode + \" \" + active.shape);\n}", "function boxclick(box, i)\n{ \n\t\n\tif (box.checked)\n\t{\n\t\t\n\t\tfor (var a = 0; a <tabCoord[i].length; a++)//var a = 0; a <= stockMarker.length-1; a++)\n\t\t{\n\t\t\t\n\t\t\ttabCoord[i][a].setVisible(true);\n\t\t\t\n\t\t}\n\t\t\n\t} \n\t\telse\n\t{\n\t\tfor (var a = 0; a < tabCoord[i].length; a++)//(var a = 0; a <= stockMarker.length-1; a++)\n\t\t{\n\t\t\ttabCoord[i][a].setVisible(false);\n\t\t\t\n\t\t}\n\t}\n\n}", "function handleClick() {\n setInspecting(task);\n }", "function click() {\n\t// If clicking on a cell with your piece in it, highlight the cell\n\tif (!selectedBox) { // 1st click\n\t\tif ((!blueTurn && this.hasClassName(\"red\")) || (blueTurn && this.hasClassName(\"blue\"))) {\n\t\t\tthis.addClassName(\"selected\");\n\t\t\tselectedBox = this;\n\t\t}\n\t}\n\t\n\t// Player is trying to move a piece\n\telse { // 2nd click\n\t\tselectedBox.removeClassName(\"selected\");\n\t\tthis.onmouseout();\n\t\t\n\t\t// If there are forced jumps and player is not jumping, highlight forced jumps\n\t\tif (forcedJumps != false) {\n\t\t\tif (!jump(this)) {\n\t\t\t\thighlightForcedJumps(forcedJumps);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Try moving, then try jumping\n\t\telse if (!move(this))\n\t\t\tjump(this);\n\t\t\t\n\t\tselectedBox = null;\n\t\tcheckVictory();\n\t}\n}", "function popup_click(state)\r\n{\r\n\tif (state)\r\n\t{\r\n\t\tpopup_keep_x = popup_mouse_x - popup_left;\r\n\t\tpopup_keep_y = popup_mouse_y - popup_top;\r\n\t}\r\n\tpopup_is_clicked = state;\r\n}", "onClick() {\n if (globalMode === 'edit') {\n\n // increment state and change color\n this.state++;\n if (this.state >= buttonStates.length) this.state = 0;\n\n this.changeColor();\n\n } else if (globalMode === 'strike') {\n\n // generate a random number as a unique strike ID, \n // so cells won't keep triggering eachother\n this.strike(Math.floor(Math.random()*100));\n\n }\n }", "function startSelection(){\n\t\t\tselectedTile = document.getElementById('idnum_' + 0);\n\t\t\tselectedTileNum = 0;\n\t\t\tdocument.getElementById('idnum_0').className += ' squareTextBoxActive';\n\n\t\t}", "clickCheckOutGreenTea() {\n this.clickElem(this.btnCheckOutGreenTea);\n }", "function showHideTrayEvent() {\r\n\t\r\n\t$(\"#btn-lock\").click(function() \r\n\t{\r\n\t\tif( $(\"#btn-lock\").hasClass(\"btn-danger\"))\r\n\t\t{\r\n\t\t\t$(\"#btn-lock\").text(\"SHOW\").removeClass(\"btn-danger\").addClass(\"btn-info\");\r\n\t\t\t$(\"#bottom-tray\").css(\"height\", \"0px\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$(\"#btn-lock\").text(\"HIDE\").removeClass(\"btn-info\").addClass(\"btn-danger\");\r\n\t\t\t$(\"#bottom-tray\").css(\"height\", \"auto\");\r\n\t\t}\r\n\t});\r\n}", "function totop_button(a) {\n var b = $(\"#totop\");\n b.removeClass(\"off on\");\n if (a == \"on\") { b.addClass(\"on\") } else { b.addClass(\"off\") }\n }", "function setStatusStart() {\n $('#btn_start').addClass('mousedown');\n \n $('#btn_start').on('click',function(){\n \n if(status_onoff == true) {\n status_start = true;\n $('#count_number').html('<p>Start</p>');\n \n \n $('#btn_start').css('background-color','red');\n // alert('start:'+status_start)\n $('#btn_start').off();\n $('#btn_start').removeClass('mousedown');\n setStatusStrict();\n \n }else {\n status_start = false;\n alert('start:'+status_start)\n }\n \n // \n \n \n })\n \n \n }", "function cross(id) {\n let box = document.getElementById(id);\n let num = box.innerHTML\n box.onclick = null;\n crossedBox.push(box.id);\n box.classList.add('boxRed');\n // console.log(crossedBox);\n bingo(box.id);\n box.innerHTML = `${num}<i style=\"font-size:16px\" class=\"fas fa-times\"></i>`;\n\n}", "function click() {\n if(seleccionado==this) {\n this.style.backgroundColor=\"transparent\";\n seleccionado=null;\n }\n else {\n if(seleccionado!=null) \n seleccionado.style.backgroundColor=\"transparent\";\n this.style.backgroundColor=\"#e0b\";\n seleccionado=this;\n }\n \n}", "function indicateChecked() {\r\n\t\t\t\tcheckbox.checked = true;\r\n\t\t\t\ttaskElement.classList.add(\"checked\");\r\n\t\t\t\ttaskElement.classList.add(\"crossout\");\r\n\t\t\t}", "function cb_beforeClick(cb, pos) { }", "function toggleGuessBox(state) {\n guessBox.style.visibility = state;\n}", "function setCheckButtonToCorrect() {\n\t\t_myDispatcher.dispatch(\"iteration.checkbutton\", {\"state\":\"correct\"});\t\n\t}", "action() {\n\t\tthis.toggle();\n\t}", "action() {\n\t\tthis.toggle();\n\t}", "action() {\n\t\tthis.toggle();\n\t}", "function ceClicked(){\n\t$display.val('');\n\tneedNewNum = true;\n\tnumEntered = false;\n}", "function setStatus(status) {\n\t\t\t state = status;\n\t\t\t \n\t\t\t\t$(\"div.left a.select\").removeClass('selected');\n\t\t\t\t$(\"div.left a.add\").removeClass('selected');\n\t\t\t\t$(\"div.left a.remove\").removeClass('selected');\n\t\t\t\t$(\"div.left a.selection\").removeClass('selected');\n\t\t\t\t$(\"div.left a.\"+status).addClass('selected');\n \n // Remove double click zoom when app is in 'add' status\n if (status != \"add\") {\n\t\t\t\t map.setOptions({disableDoubleClickZoom:false});\n\t\t\t\t} else {\n\t\t\t\t map.setOptions({disableDoubleClickZoom:true});\n\t\t\t\t}\n\t\t\t\n if (status == \"selection\") {\n map.setOptions({draggable:false});\n } else {\n map.setOptions({draggable:true});\n }\n\n\t\t\t\t//Remove selection tool addons\n\t\t\t\tgoogle.maps.event.clearListeners(map, 'mousemove');\n\t\t\t\tremoveSelectionPolygon();\n\t\t\t\t\n\t\t\t\tactiveMarkersProperties();\n\t\t\t}", "function openScreen () {\n document.getElementById(\"box\").value = \"\";\n document.getElementById(\"box\").style.visibility = \"visible\";\n}", "function save_menu_status(ind, old_status){ \n\tfor(var i = 0; i < active_menu_count; i++){\n\t\tif(i == ind){\n\t\t\tif(old_status == \"none\"){\n\t\t\t\tappSetCookie(\"side_box_content_\"+i,\"maximized\",14);\n\t\t\t}else{\n\t\t\t\tappSetCookie(\"side_box_content_\"+i,\"minimized\",14);\n\t\t\t}\t\t\t\t\t\n\t\t}else{\n\t\t\tvar status = document.getElementById(\"side_box_content_\"+i).style.display;\n\t\t\tif(status == \"none\"){\n\t\t\t\tappSetCookie(\"side_box_content_\"+i,\"minimized\",14);\n\t\t\t}else{\n\t\t\t\tappSetCookie(\"side_box_content_\"+i,\"maximized\",14);\n\t\t\t}\t\t\n\t\t}\n\t}\n}", "function putNotifBtnOff() {\n $('#notifNo').addClass('focus active');\n $('#notifYes').removeClass('focus active');\n}", "function lightning_clicked() {\n settings.lightning_enabled = !settings.lightning_enabled;\n wkof.Settings.save('doublecheck');\n $('#lightning-mode').toggleClass('doublecheck-active', settings.lightning_enabled);\n return false;\n }", "function changeGreenClick() {\n $(this).unbind(\"mouseleave\");\n $(this).css('background-color', 'green');\n\n //check if all boxes are green check #zone-[index]\n if ($('#zone-1')[0].style.background === 'green' && $('#zone-2')[1].style.background === 'green' && $('#zone-3')[2].style.background === 'green' && $('#zone-4')[3].style.background === 'green') {\n //console.log(\"congratulations!!!\"); //AND this does NOT work\n }\n when\n console.log(\"congratulations!!!\");\n //display congratulations everytime a box is clicked\n }", "function syncronizeCheckboxes(clicked, pri, pub) {\n pri.checked = false;\n pub.checked = false;\n clicked.checked = true;\n }", "function mouseDownBox(){\n box.style.backgroundColor = \"red\"\n}", "function singleStatus() {\n ira_RemoveNodes();\n var boxIRA = document.getElementById(\"IRA\");\n var b19 = document.createElement(\"br\");\n var b20 = document.createElement(\"br\");\n var b21 = document.createElement(\"br\");\n var singleAgeOptions = document.createTextNode(\"are you 50 years old or older?\");\n var singleUnder50 = document.createElement(\"button\");\n var singleAtLeast50 = document.createElement(\"button\");\n var singleStatusBoolean = true;\n\n singleUnder50.innerHTML = \"Yes\";\n singleUnder50.id = \"single_At_Least_50\";\n singleUnder50.onclick = function() {\n agiIncomeLimitDeterminator(singleStatusBoolean, 0, true);\n }\n\n singleAtLeast50.innerHTML = \"No\";\n singleAtLeast50.id = \"single_Under_50\";\n singleAtLeast50.onclick = function() {\n agiIncomeLimitDeterminator(singleStatusBoolean, 0, false)\n }\n\n boxIRA.appendChild(singleAgeOptions);\n boxIRA.appendChild(b19);\n boxIRA.appendChild(singleUnder50);\n boxIRA.appendChild(singleAtLeast50);\n boxIRA.appendChild(b20);\n boxIRA.appendChild(b21);\n\n}", "click() {\n this.reset();\n this.draw();\n }", "function onMouseDown(e) {\n\tclickStart = e;\n\tbox = L.rectangle(L.latLngBounds(e.latlng, e.latlng), {fill: false, color: SELECTED_BOX_COLOR}).addTo(map);\n\tclick = true;\n deselectBox();\n removeMiniBox();\n}", "function demo_lime_widgets_view_active (obj)\n{\n this.propagate ('back');\n}", "function standardBtnActivate (e) {\n var el = $(e.currentTarget),\n initHeight = el.outerHeight(),\n initWidth = el.find('span:visible').outerWidth();\n\n el.blur();\n\n if (el.hasClass('activated')) {\n el.prop('disabled', false)\n .css({\n 'width': '',\n 'height': ''\n });\n }\n else {\n el.prop('disabled', true)\n .css({\n 'width': initWidth,\n 'height': initHeight\n });\n }\n\n el.toggleClass('activated');\n }", "function autoEditAppear() {\n flickAppear('reveal',0);\n flickAppear('reveal',5);\n flickAppear('reveal',1);\n disableButton('myonoffswitch',false);\n disableDiv('onOffSwitchContainer','auto');\n visibleAutoEdit = true;\n}", "function toggleCurrent() {\n toggleAndShow(getCurEntry());\n}", "function changeActive() {\n var pkmn = $(\".pkmn\");\n \n pkmn.click(function(){\n pkmn.removeClass(\"active\");\n $(this).addClass(\"active\");\n });\n }", "function indicateChecked() {\r\n\t\t\tcheckbox.checked = true;\r\n\t\t\ttaskElement.classList.add(\"checked\");\r\n\t\t\ttaskElement.classList.add(\"crossout\");\r\n\t\t}", "function mouseUpBox(){\n box.style.backgroundColor = \"yellow\"\n}" ]
[ "0.6895292", "0.67485005", "0.6596161", "0.64501727", "0.63847864", "0.6307598", "0.6294617", "0.6265165", "0.6245124", "0.6189561", "0.61882764", "0.6082168", "0.60537165", "0.59791845", "0.59374577", "0.59264165", "0.59050095", "0.5904123", "0.58664095", "0.5853585", "0.5846616", "0.58263636", "0.5824472", "0.5785094", "0.577872", "0.5763357", "0.5755936", "0.5748019", "0.5743673", "0.57424855", "0.5738925", "0.57342386", "0.57330287", "0.57281005", "0.57152796", "0.5713793", "0.5713039", "0.5705451", "0.57028556", "0.5697918", "0.56960833", "0.56937444", "0.5692368", "0.5660245", "0.5651825", "0.56496644", "0.5648318", "0.5647676", "0.56471175", "0.56433094", "0.56389135", "0.5624762", "0.56175834", "0.55963326", "0.55958307", "0.5580969", "0.5580967", "0.55800515", "0.557916", "0.5569618", "0.55555767", "0.55526835", "0.5551244", "0.55507225", "0.5543954", "0.5537313", "0.55371964", "0.552706", "0.55242777", "0.5524097", "0.5523672", "0.5519424", "0.55150723", "0.5510125", "0.550939", "0.55090445", "0.55080867", "0.55017126", "0.5500384", "0.5499956", "0.5499956", "0.5499956", "0.5495941", "0.54955775", "0.5494864", "0.54879814", "0.5486742", "0.54855394", "0.54845035", "0.54824275", "0.54820263", "0.5481634", "0.5476287", "0.5474565", "0.54710585", "0.547081", "0.5466494", "0.54620296", "0.5454075", "0.5452378", "0.54523736" ]
0.0
-1
pushing bombs positions to array of bombs
function creatMine() { while (mines.length != (quantidade_bombs)) { let i = Math.floor(Math.random() * field_size); let j = Math.floor(Math.random() * field_size); //not repeating same spot if (!mines.map(x => JSON.stringify(x)).includes("[" + i + "," + j + "]")) { mines.push([i, j]); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function placeBombs(board, bombCount) {\n for (let i = 0; i < bombCount; i++) {\n var rand = getRandomIntInclusive(0, (gRands.length - 1));\n board[gRands[rand].i][gRands[rand].j].value = BOMB;\n board[gRands[rand].i][gRands[rand].j].isBomb = true;\n gRands.splice(rand, 1);\n }\n}", "putBomb() {\n if (this.bombs.length < this.maxBombs) {\n this.bombs.push(new Bomb(this.ctx, this.tileCoord.col, this.tileCoord.row, this.tileSize))\n }\n }", "placeBombs(numberOfBombs){\n let tileCount = this.rows*this.cols;\n let bombIndices = [];\n while(bombIndices.length < numberOfBombs){\n let randomIndex = Math.floor(Math.random()*tileCount);\n if(bombIndices.indexOf(randomIndex) > -1) continue;\n bombIndices[bombIndices.length] = randomIndex;\n }\n\n for(let bombIndex of bombIndices){\n let j = Math.floor(bombIndex/this.rows);\n let i = bombIndex % this.rows;\n this.grid[i][j].isBomb = true;\n }\n }", "function mineGeneration () {\n bombs = new Array(size * size).fill(0); // create an array with same amount of cells\n bombs = bombs.map((a, index) => {\n return a = index;\n });\n\n // randomized the placement of the new array of numbers (in this case it is 100)\n bombs.sort((a, b) => {\n return 0.5 - Math.random()\n });\n\n // set a new array of the first set of numbers to set the bomb placements based on ratio\n bombs.splice(ratio);\n\n // mapped through the array to change attribute of the cell to contain the bomb\n bombs.map((a) => {\n HTMLboard.children[a].setAttribute(\"data-ismine\", true);\n });\n return bombs;\n}", "function initbombpos() {\n for (let i =0; i < numberofbombs; i++) {\n bombacceleration[i] = random(0.02, 0.03);\n bombvelocity[i] = random(5, 10);\n bombposX[i] = random(0.5, width);\n bombposY[i] = random(-20, -0.5);\n }\n}", "addBombs(numberBombs)\n {\n let bombLoop = 0;\n\n while(bombLoop < numberBombs)\n {\n let bombX = Math.floor(Math.random() * this.xSize);\n let bombY = Math.floor(Math.random() * this.ySize);\n if (!this.isBomb(bombX, bombY))\n {\n this.gameState[bombX][bombY].bomb = true;\n\n bombLoop++;\n }\n } \n }", "function positionBombs(quadratini) {\n const bombs = []\n console.log(quadratini);\n\n\n while (bombs.length < 16) {\n const bomb = genRandomNumber(1, quadratini);\n\n /* se la bomba è inclusa nell'array decrementa l'indice per generare un altro numero */\n if (!bombs.includes(bomb)) {\n console.log('Add a bomb');\n bombs.push(bomb)\n }\n }\n console.log(bombs);\n return bombs;\n}", "function bishops (positions, w) {\n\n}", "function updateBombCounts(board) {\n for (let i = 0; i < board.length; i++) {\n for (let j = 0; j < board.length; j++) {\n var location = { i: i, j: j };\n board[i][j].neighBombs = countNeighBombs(board, location);\n if (board[i][j].neighBombs === 0) board[i][j].neighBombs = EMPTY;\n }\n }\n}", "function setCellsNumOfBombsAround() {\n for (var i = 0; i < gBoard.length; i++) {\n for (var j = 0; j < gBoard[0].length; j++) {\n var cell = gBoard[i][j];\n cell.numOfBombsAround = getNumOfBombsAround(cell.coord);\n }\n }\n}", "function _generateBomgsArray(x,y,nrOfMines){\r\n\t\t\r\n\t\tvar bombs = [];\r\n\t\tfor (i=0;i<nrOfMines;i++){\r\n\r\n\t\t\t//generating bomb and checking if already exists\r\n\t\t\tdo{ \r\n\t\t\t\tvar temp = {\r\n\t\t\t\t\tx : Math.floor(Math.random()*x),\r\n\t\t\t\t\ty : Math.floor(Math.random()*y)\r\n\t\t\t\t};\r\n\t\t\t\tbombPositionGood=true;\r\n\t\t\t\tfor (t=0;t<i;t++) if ((bombs[t].x === temp.x) && (bombs[t].y === temp.y)) { bombPositionGood=false;} //checking if bombs position already generated\r\n\t\t\t} while (bombPositionGood === false);\r\n\r\n\t\t\t\tbombs.push(temp);\r\n\t\t}\r\n\r\n\t\treturn bombs;\r\n\t}", "function setRandBombs(numOfBombs) {\n gEmptyCells = createCoordsArray();\n for (var i = 0; i < numOfBombs; i++) {\n var randCoord = drawRandCoord(gEmptyCells);\n //model\n var cell = gBoard[randCoord.i][randCoord.j];\n cell.isBomb = true;\n }\n}", "function generate_bomb() \n{\n for (var i = 0; i < rows; i++) \n {\n for (var j = 0; j < cols; j++) \n {\n var ratio = bombCount / (rows * cols);\n if (rdm(0, 1) < ratio) \n {\n $cell[(i * cols) + j].classList.add('cell-bomb');\n $cell[(i * cols) + j].classList.add('x' + j);\n $cell[(i * cols) + j].classList.add('y' + i);\n bombs.posX[(i * cols) + j] = j;\n bombs.posY[(i * cols) + j] = i;\n }\n }\n }\n}", "function genBomb(totCells,totBombs) {\n const bombs = [];\n // continuo finche la lunghezza di bombs non è minore al totale\n while(bombs.length <totBombs){\n //genero numero random con la mia funzione\n const bomb = randNum(1,totCells)\n\n //Controllo che il numero sia univoco\n if(!bombs.includes(bomb)){\n bombs.push(bomb);\n }\n }\n return bombs;\n }", "function addBombs(){\n numBombs.innerHTML = bombAmount\n suffledArray = gameArray.sort(()=>Math.random()-0.5);\n //you can see where are the bombs in the console\n console.log(suffledArray)\n squares.forEach(square =>{\n square.classList.add('hidden');\n })\n}", "function placeBomb(x,y) {\n with (cellArray[arrayIndexOf(x,y)]) {\n if ((! isBomb) && (! isExposed)) {\n isBomb = true;\n for (i=x-1; i<=x+1; i++) {\n for (j=y-1; j<=y+1; j++) {\n addNeighbor(i,j); } } \n return true;} \n else\n return false; } }", "function updateBombPos() {\n for(let r = 0; r < numberofbombs; r++) {\n bombvelocity[r] += bombacceleration[r];\n bombposY[r] += bombvelocity[r]\n \n hit = collidePointCircle(mouseX, mouseY - duck.height * duckScalar / 2, bombposX[r], bombposY[r], bombSize);\n}\n \n if (hit) {\n endGame();\n }\n \n //Resetting bombs to top of screen\n if (time > fallTime) {\n initbombpos();\n time = 0;\n }\n}", "function loadboid(numboid){\r\n\r\n for(i=50; i < numboid; i++){\r\n var loc = createVector(random(width), random(height));\r\n var vel = createVector(random(-3,3), random(-3,3));\r\n var radius=random(10,10);\r\n var col= color(random(1, 255), random(1, 255), random(1, 255));\r\n boids.push(new boid(loc, vel, radius, col));\r\n }\r\n console.log(boids);\r\n}", "function plantBombs(rows, cols) {\n let totalCells = Number(rows) * Number(cols);\n console.log(\"There are \" + totalCells + \" total cells\");\n let totalBombs = Math.floor(totalCells * 0.15625);\n console.log(\"There are \" + totalBombs + \" total bombs\");\n \n // Build an array of values from 1 to totalCells\n let bombIndices = buildIndexArray(totalCells);\n // call a shuffle function on bombIndices, then grab the first totalBombs values and slice the array down to that size\n shuffleArray(bombIndices);\n bombIndices = bombIndices.slice(0, totalBombs);\n bombIndices.sort();\n // DEBUG START\n console.log(\"Bombs are at indices: \" );\n let bombIndicesString = \"\";\n for (let i = 0; i < bombIndices.length; i++) {\n bombIndicesString += (String(bombIndices[i]) + \" \");\n }\n console.log(bombIndicesString);\n// renderAllCells(\"bomb-cell\");\n // DEBUG END\n \n addBombClassToCells(bombIndices);\n incrementNeighborTally(bombIndices, rows, cols);\n return totalBombs;\n}", "appendBid(){\r\n //(boardNbr, roundIx, bidderIx, tricks, suit, alert_by, alert_to)\r\n var bIx = this.bidderIx(this.nbrBids); //bidder\r\n var rIx = bIx % 4; //round\r\n //Arguments are (boardNbr, roundIx, bidderIx, tricks, suit, alert_by, alert_to)\r\n this.bids[this.nbrBids] = new Bid(this.boardNbr, rIx, bIx, 0, \"none\", \"\", \"\");\r\n this.nbrBids++;\r\n }", "function createBomb(){\n document.getElementById('root').appendChild(stringToNode(`<bomb id=\"bomb${bombCount}\" class=\"explosives\" style=\"width:50px; height:50px; position:absolute; right:${randomLocation(50, 1600)}px;bottom:${randomLocation(0, 800)}px; background-image:url(bomb.jpg);background-size: 50px 50px\"></bomb>`))\n //bombsCollection.push(document.getElementsByTagName(\"bomb\").namedItem(`bomb${bombCount}`))//returns HTMLCollections\n bombsCollection.push(document.getElementsByClassName(\"explosives\")[`${bombCount}`])\n bombCount++; \n //bombsArray = Array.from(bombsCollection) \n //bombsArray = [...bombsCollection]\n bombsArray = bombsCollection;\n console.log(bombsArray)\n console.log(`bomb${bombCount}`)//returns string bomb123etc\n //console.log(document.getElementById(`bomb${bombCount}`))//null\n //console.log(document.getElementById(\"bomb1\"))//returns bomb1\n console.log(document.getElementsByClassName(\"explosives\"))\n console.log(bombsArray[0].getBoundingClientRect().top)\n}", "plantBomb() {\n\n // if there's enough bombs left\n if (this.amountBombs > 0) {\n\n // place bomb inside your game\n this.game.bombs.push(new Bomb({x: this.position.x, y: this.position.y}, 1500, 2, this.assets, this.gridSize, this.game));\n\n this.updateBombCount(-1);\n\n this.game.playMusic(SETBOMBMUSIC);\n\n // send position of your bomb to all enemies\n let bombDetails = {id: this.id, x: this.position.x, y: this.position.y, amountBombs: this.amountBombs};\n let playerDetails = {id: this.id, amountWalls: this.amountWalls, amountBombs: this.amountBombs, health: this.health};\n\n this.game.broadcastBomb(bombDetails);\n this.game.broadcastInventory(playerDetails);\n }\n }", "addBouts(size=0){\r\n if (!size){\r\n size = this.numFencers;\r\n }\r\n\r\n for (var i = 0; i < size; i++){\r\n let temp = this.getCurrentFencers();\r\n let left = temp[0];\r\n let right = temp[1];\r\n\r\n this.bouts.push(new Bout(left, right));\r\n this.nextBout();\r\n }\r\n }", "static generateBombBoard(numberOfRows, numberOfColumns, numberOfBombs){\n let board = [];\n for (let rowIndex = 0; rowIndex < numberOfRows; rowIndex++){\n let row = [];\n for (let colIndex = 0; colIndex < numberOfColumns; colIndex++){\n row.push(null);\n }\n board.push(row);\n }\n\n //place bombs on the board by generating a location from a random coloumn and random row\n let numberOfBombsPlaced = 0;\n while (numberOfBombsPlaced < numberOfBombs) {\n let randomRowIndex = Math.floor(Math.random() * numberOfRows);\n let randomColIndex = Math.floor(Math.random() * numberOfColumns);\n if (board[randomRowIndex][randomColIndex] !== 'B'){\n board[randomRowIndex][randomColIndex] = 'B';\n numberOfBombsPlaced++;\n }\n }\n return board;\n }", "static generateBombBoard(numberofRows, numberofColumns, numberOfBombs) {\n const board = [];\n for (let i = 0; i < numberofRows; i++) {\n let row = [];\n for (let c = 0; c < numberofColumns; c++) {\n row.push(null);\n };\n board.push(row);\n };\n\n let numberOfBombsPlaced = 0;\n while (numberOfBombsPlaced < numberOfBombs) {\n let randomRowIndex = Math.floor(Math.random() * numberofRows);\n let randomColumnIndex = Math.floor(Math.random() * numberofColumns);\n if (board[randomRowIndex][randomColumnIndex] !== 'B') {\n board[randomRowIndex][randomColumnIndex] = 'B';\n numberOfBombsPlaced++;\n }\n\n /*Currently this code could produce Bombs on top of existing bombs\n - This will be fixed in later code*/\n };\n return board;\n }", "static generateBombBoard(numberOfRows, numberOfColumns, numberOfBombs) {\n let board = [];\n for (let rowIndex = 0; rowIndex < numberOfRows; rowIndex++) {\n let row = [];\n for (let columnIndex = 0; columnIndex <numberOfColumns; columnIndex++) {\n row.push(null);\n }\n board.push(row);\n }\n\n let numberOfBombsPlaced = 0;\n while (numberOfBombsPlaced < numberOfBombs) {\n // The code in your while loop has the potential to place bombs on top of\n // already existing bombs. This will be fixed when you learn about control flow.\n let randomRowIndex = Math.floor(Math.random() * numberOfRows);\n let randomColumnIndex = Math.floor(Math.random() * numberOfColumns);\n if (board[randomRowIndex][randomColumnIndex] !== 'B') {\n board[randomRowIndex][randomColumnIndex] = 'B';\n numberOfBombsPlaced++;\n }\n }\n return board;\n }", "function plantBombs() {\n console.log('---------------[ PLANTING BOMBS ]---------------');\n var cells = document.getElementsByClassName('cell');\n while (game.bombsOnBoard < game.flagsAvaliable) {\n var cell = cells[[Math.floor(Math.random()*cells.length)]];\n if (cell.getAttribute('isBomb') !== \"true\") {\n cell.setAttribute('isBomb', 'true');\n game.bombsOnBoard++;\n\n console.log('Planted Bomb at ' + cell.id);\n }\n }\n console.log('---------------[ PLANTED BOMBS ]---------------');\n\n}", "function bomberMan(n, grid) {\n const r = grid.length,\n c = grid[0].length;\n let full = '';\n for(let i=0; i<c; i++) full += 'O';\n\n function detoantion(){\n const dy = [0,1,-1,0,0],\n dx = [0,0,0,1,-1];\n // detonation\n // for(let y=0; y<r; y++){\n for(let b of bombs){\n let y = b[0], x = b[1];\n // console.log('y : '+ y + 'x : ' + x + 'bomb : ', bombs[[y,x]])\n if(bombs[[y,x]] != 1){\n for(let d=0; d<5; d++){\n let ny = y + dy[d], nx = x + dx[d];\n if(ny < 0 || ny >= r || nx < 0 || nx >= c) continue;\n grid[ny] = grid[ny].substr(0,nx) + '.' + grid[ny].substr(nx+1);\n }\n }\n }\n // }\n bombs = [];\n }\n function fill(){\n for(let i=0; i<r; i++){\n for(let j =0; j<c; j++){\n if(grid[i][j] == 'O') bombs.push([i,j]);\n }\n grid[i] = full;\n }\n }\n let bombs = [];\n \n \n if(n <= 1) return grid // 0~1\n fill(); if(n % 2 == 0) return grid; // 2\n detoantion(); if(n==3) return grid; // 3\n let v2 = [].concat(grid);\n fill();\n detoantion();\n let v1 = [].concat(grid);\n if(n >5){ // 3~n\n if( (n+1) % 4 == 0 ) return v2;\n if( (n-1) % 4 == 0 ) return v1;\n }\n\n return grid;\n}", "updateSpawnedCowboys() {\n for (const cowboy of this.spawnedCowboys) {\n this.game.cowboys.push(cowboy);\n cowboy.owner.cowboys.push(cowboy);\n }\n this.spawnedCowboys.length = 0;\n }", "getNeighborBombs(rowIndex, colIndex){\n const neighborOffsets = [\n [-1, -1],\n [-1, 0],\n [-1, 1],\n [0, -1],\n [0, 1],\n [1, -1],\n [1, 0],\n [1, 1]\n ];\n const numberOfRows = this._bombBoard.length;\n const numberOfColumns = this._bombBoard[0].length;\n let numberOfBombs = 0;\n\n neighborOffsets.forEach(offset => {\n //so in this iterator, each \"offset\" is a little mini array from the big array\n //called neighborOffsets. Each mini array contains just two items, the row number\n //and then the column number.\n //so if we're going through the loop the first time, offset = [-1, -1], the next\n //time through it's [-1, 0]. Very clever.\n const neighborRowIndex = rowIndex + offset[0];\n //^this takes rowIndex, which was passed to this function, and looks at the row\n //either above, below or on the same line, depending where we're at in the loop.\n //might execute as 1 + -1, 1 + 0, or 1 + 1, depending where we're at\n const neighborColumnIndex = colIndex + offset[1];\n //^this takes colIndex, which was passed to this function, and looks at the column\n //either left, right or on the same column, depending where we're at in the loop\n //might execute as 1 + -1, 1 + 0, or 1 + 1, depending where we're at\n if (neighborRowIndex >= 0\n && neighborRowIndex < numberOfRows\n && neighborColumnIndex >=0\n && neighborColumnIndex < numberOfColumns){\n if (this._bombBoard[neighborRowIndex][neighborColumnIndex] == \"B\"){\n numberOfBombs++;\n }\n }\n });\n return numberOfBombs;\n }", "function generateMinesLocations(quadricSize, numOfBombs) {\r\n var mineCells = [];\r\n var mineCellId;\r\n //This while loop will promise to make sure all bombs are set to different availbale cells\r\n while (mineCells.length < numOfBombs) {\r\n mineCellId = generateRandomCellId(quadricSize);\r\n //If the generated cell is not in the array, push it\r\n if (mineCells.indexOf(mineCellId) === -1) {\r\n mineCells.push(mineCellId);\r\n }\r\n\r\n }\r\n return mineCells;\r\n}", "updateBombsData() {\n\n GameElements.bombs.forEach(bomb => {\n if (bomb.state == Bomb.STATE.KICKED) {\n bomb.updatePositionWhenKicked(bomb.speed);\n }\n if (bomb.state == Bomb.STATE.CARRIED) {\n bomb.updatePositionWhenCarried();\n }\n if (bomb.state == Bomb.STATE.THROWN) {\n bomb.updatePositionWhenThrown();\n }\n //Comprueba si algun jugador que estuviera dentro de la posicion\n //de la bomba en el momento de crearse ha salido de la posicion\n //para impedirlo volver a entrar.\n GameElements.players.forEach(p => {\n if (!bomb.playerIsStillOn(p)) {\n bomb.setPlayerOut(p.id);\n }\n });\n\n bomb.time -= 1;//Cuenta atras para explotar\n\n if (bomb.time <= 0) {\n bomb.explodes();\n //El jugador que dejo la bomba, recupera una bomba\n let playerId = bomb.ownerId;\n let player = GameElements.players.find(player =>\n player.id === playerId);\n player.recoverBomb();\n //La bomba desaparece\n let index = GameElements.bombs.indexOf(bomb);\n GameElements.bombs.splice(index, 1);\n }\n });\n\n }", "function bomb(midx,midy) {\n\t\tfor (i=0; i<=0; i++) {\n\t\t\t//bombObj = paper.circle(midx,midy,box.x/4);\n\t\t\tbombList[i] = paper.circle(midx,midy,box.x/4);\n\t\t\t//bombObj.attr ({\n\t\t\tbombList[i].attr({\n\t\t\t'fill':'orange'\n\t\t\t});\n\t\t\t//console.log(bomb);\n\t\t}\t\n\t}", "function makeBoard() {\n clearBoard();\n bombsFlagged = 0;\n cellsOpen = 0;\n updateNumBombs();\n // Now place the bombs on the board\n bombsToPlace = maxNumBombs;\n while (bombsToPlace != 0) {\n placeBombRandomLoc();\n bombsToPlace--; } }", "function createbones(){\n let randomNumber = Math.floor(Math.random() * counter)+1;\n //check if bones array already contained that random number or not\n //if not then add\n if(jQuery.inArray(randomNumber, bones) === -1)\n {\n bones.push(randomNumber);\n }\n else{\n createbones();\n } \n}", "function pushIndices(quote,index){\n quoteBasket.push(index);\n}", "function seed_oobs(num){\n\tvar posse = new Array(num);\n\tfor(iter = 0; iter < num; iter++){\n\t\tposse[iter] = new oob();\n\t}//end for array\n\treturn posse;\n}", "function numGen(bombs) {\n bombs.map(a => {\n let area;\n\n // defining how to look at each cell and determine whether to add a number\n\n // specific for right side of the grid to not add numbers to cells on next line\n \n if ((a + 1) % size === 0) {\n area = [a - 1, a + size, a - size, a + size - 1, a - size - 1];\n } \n \n // specific for left side of the grid to not add numbers to cells on next line\n\n else if (a % size === 0) {\n area = [a + 1, a + size, a - size, a + size + 1, a - size + 1];\n } \n\n // gets all the cells in the middle that arent on the edges\n\n else {\n area = [a + 1, a - 1, a + size, a - size, a + size - 1, a - size - 1, a + size + 1, a - size + 1];\n }\n\n // iterates through the area within the board and the non-mine cells and increments each number\n // in the cell based on the number of mines it is touching.\n area.map(b => {\n if ((b < (size * size) && b >= 0) && (HTMLboard.children[b].getAttribute(\"data-ismine\") == \"false\")) {\n let num = HTMLboard.children[b].getAttribute(\"data-touching\");\n HTMLboard.children[b].setAttribute(\"data-touching\", parseInt(num) + 1);\n }\n });\n\n });\n}", "function moveBombs()\n{\n //for each bomb\n balloonAmmo.forEach(oneBomb =>\n {\n //if bomb has been fired\n if (oneBomb.fired)\n {\n //move bomb down according to gravity\n oneBomb.y += 0.98 * oneBomb.speed;\n oneBomb.speed++;\n //console.log(bombIndex);\n }\n //if bomb hasn't been fired\n else\n {\n if (keys !== null)\n {\n //move bomb up with balloon when \"w\" or \"arrow up\" pressed\n if (keys[38] || keys[87])\n {\n oneBomb.velY -= 1.5;\n }\n //move bomb up with balloon when \"s\" or \"arrow down\" pressed\n if (keys[40] || keys[83])\n {\n oneBomb.velY += 3;\n }\n //move bomb up with balloon when \"a\" or \"arrow left\" pressed\n if (keys[37] || keys[65])\n {\n oneBomb.velX -= 2;\n }\n //move bomb up with balloon when \"d\" or \"arrow right\" pressed\n if (keys[39] || keys[68])\n {\n oneBomb.velX += 1.5;\n }\n }\n\n //decceleration based on drag coefficient\n oneBomb.velX *= oneBomb.drag;\n oneBomb.velY *= oneBomb.drag;\n\n //position change based on velocity change\n oneBomb.x += oneBomb.velX;\n oneBomb.y += oneBomb.velY;\n\n player.yPos + (player.ySize - 25)\n\n //in bounds x axis\n if (oneBomb.x > WIDTH - player.xSize / 2 - 15)\n {\n oneBomb.x = WIDTH - player.xSize / 2 - 15;\n }\n else if (oneBomb.x < (player.xSize / 2 - 15))\n {\n oneBomb.x = player.xSize / 2 - 15;\n }\n\n //in bounds y axis\n if (oneBomb.y > HEIGHT - balloonGround - player.ySize + 95)\n {\n oneBomb.y = HEIGHT - balloonGround - player.ySize + 95;\n }\n else if (oneBomb.y < (player.ySize - 25))\n {\n oneBomb.y = (player.ySize - 25);\n }\n }\n })\n}", "function openBombCells(board){\n var openedBombCells=[];\n for(var i=0;i<board.length;i++){\n for(var x=0;x<board[0].length;x++)\n if(board[i][x].value==='x') {\n openedBombCells.push([i, x]);\n board[i][x].open=1;\n }\n }\n return openedBombCells;\n}", "function rearrangeBalls() {\n ballsRearranged = true;\n words = phrase.split(\" \");\n var containerHeight = document.getElementById(\"container\").offsetHeight;\n var containerWidth = document.getElementById(\"container\").offsetWidth;\n var lineHeight = containerHeight / words.length;\n var ballId = 0;\n var xs = []\n var ys = []\n for (i in words) {\n for (j in words[i]) {\n var x = j * 150 + (containerWidth - 8 * 150)/2;\n var y = i * lineHeight + (lineHeight - 120)/2;\n moveBall(ballId, x, y);\n ballId++;\n }\n }\n\n }", "function pushNewBalls(){\n\tvar randomPoint = randomFromArray(randPoints),\n\t\t randomColor = randomFromArray(colors)\n\tballs.push(\n\t\tnew Ball(\n\t\t\tcanvas, ctx,\n\t\t\trandomPoint.x, randomPoint.y,\n\t\t\tglobalRadius, randomColor, particles, 0, velocityOfBall, false\n\t\t)\n\t)\n}", "function getPositionsForBishop({ block, isWhite, board }) {\n const { position } = block;\n const x = position[0];\n const y = position[1];\n let positions = [\n ...bishopB1Positions({ board, isWhite, x, y }),\n ...bishopB2Positions({ board, isWhite, x, y }),\n ...bishopB3Positions({ board, isWhite, x, y }),\n ...bishopB4Positions({ board, isWhite, x, y }),\n ];\n return positions;\n}", "function aiBoats() {\n for (var b = 0; b < 5; b++){\n var index1 = Math.floor(Math.random() *9);\n var index2 = Math.floor(Math.random() *9);\n var boat = boardArray[index1][index2]\n if (boat === 2){\n boat = boardArray[Math.floor(Math.random() *9)][Math.floor(Math.random() *9)]\n } // end if statement\n else {\n boardArray[index1][index2] = 2;\n console.log(boardArray[index1],boat);\n $(\"#\" + index1 + index2).addClass(\"boat\");\n }\n } // end for loop\n} // end Function", "assignNeighbours(){\n\n for (let i = 0; i < this.rows; i++) {\n for (let j = 0; j < this.cols; j++) {\n\n if(this.grid[i][j].isBomb){\n this.grid[i][j].surroundingBombs = -1;\n continue;\n }\n let neighbours = MineSweeper.getNeighbours((i == 0), (i == this.rows-1), (j == 0), (j == this.cols-1));\n\n let counter = 0;\n for(let neighbour of neighbours){\n let dr = neighbour[0];\n let dc = neighbour[1];\n if(this.grid[i+dr][j+dc].isBomb){\n counter++;\n }\n }\n this.grid[i][j].surroundingBombs = counter;\n }\n }\n }", "function bombJuggler(numBombs) {\n\n}", "neighbours(i) {\r\n // This doesn't even do anything in particular. I don't know why this works.\r\n let cell = [this.boids[i].cell[0] - 1, this.boids[i].cell[1] - 1];\r\n \r\n let n = [];\r\n \r\n // Using r, c here as i is already being used.\r\n // If r and c are changed to different numbers, there are different behaviours. I don't know how this works...\r\n for (let r = 0; r < 3; r++) {\r\n for (let c = 0; c < 3; c++) {\r\n let append = this.grid.cells[int((this.grid.rows + cell[0] + r) % this.grid.rows)][int((this.grid.cols + cell[1] + c) % this.grid.cols)]\r\n \r\n n = n.concat(append);\r\n }\r\n }\r\n \r\n return n;\r\n }", "update() {\r\n for (let i = 0; i < this.boids.length; i++) {\r\n let neighbours = this.neighbours(i).slice();\r\n \r\n this.cohesion(i, neighbours);\r\n this.alignment(i, neighbours);\r\n this.separation(i, neighbours);\r\n this.boids[i].update();\r\n }\r\n }", "breed (chromosome) {\n const pivot = Math.round(this.code.length / 2) - 1;\n\n const child1 = this.code.substr(0, pivot) + chromosome.code.substr(pivot);\n const child2 = chromosome.code.substr(0, pivot) + this.code.substr(pivot);\n\n return [new Chromosome(child1), new Chromosome(child2)];\n }", "createMine() {\n // Use 2d array mine to store the location of bombs.\n // Add additional margins to mine array for further convenience.\n // Initialize a (height + 2)* (width + 2) mine with no bomb, margin size 1.\n // Add margin because in this way it's easier to count bombsb in the following steps.\n\n for(let i = 0; i < this.height + 2; i++){\n this.mine[i] = [];\n for (let j = 0; j < this.width + 2; j++){\n this.mine[i][j] = 0;\n }\n }\n\n // Scatter bombs randomly to the 2d array. 1 stands for bomb, 0 - no bomb.\n for (let i = 0; i < this.total_bomb; i++) {\n let location = this.generateRandomLocation();\n let x = location[0];\n let y = location[1];\n\n this.mine[x][y] = 1;\n }\n\n return this.mine;\n }", "function renderBombs()\n{\n //for each bomb\n balloonAmmo.forEach(oneBomb =>\n {\n //if bomb has exploded\n if (oneBomb.exploded)\n {\n ctx.drawImage(explodedBombImage, oneBomb.x, oneBomb.y, bombSize, bombSize); \n }\n //if bomb has been fired\n else if (oneBomb.fired)\n {\n //draw the bomb\n ctx.drawImage(bombImage, oneBomb.x, oneBomb.y, bombSize, bombSize);\n \n //help determine hitbox for bombs\n //insert painted hitboxes here if needed\n }\n });\n}", "function increment_column(column, instance, squares_pos) {\r\n\tnew_column = new Array();\r\n\tfor(let i in column) {\r\n\t\tlet v = column[i];\r\n\t\tfor(let j in instance.get_neighbours(v)) {\r\n\t\t\tlet n = instance.get_neighbours(v)[j];\r\n\t\t\tif(n == v+1) {\r\n\t\t\t\tnew_column.push(n);\r\n\t\t\t\tsquares_pos[n].x = squares_pos[v].x + 1;\r\n\t\t\t\tsquares_pos[n].y = squares_pos[v].y;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t//console.log(\"Incrementin column \" + column + \", result: \" + new_column);\r\n\treturn new_column;\r\n}", "makesBombsExplode() {\n\n GameElements.bombs.forEach(bomb => {\n if (bomb.isInsideElement(bomb.xPos, bomb.yPos, this)) {\n bomb.time = 1;//Deja la bomba a punto de explotar\n }\n this.flames.forEach(flame => {\n if (bomb.isInsideElement(bomb.xPos, bomb.yPos, flame)) {\n bomb.time = 1;//Deja la bomba a punto de explotar\n }\n });\n });\n\n }", "putBomb() {\n\n // search position of player\n let left = this.x * widthCase;\n let top = this.y * widthCase;\n\n //create bomb\n let id = \"bomb\" + this.bombs.length;\n const bomb = document.createElement('div');\n bomb.style.position = \"absolute\";\n bomb.className = 'bomb';\n bomb.setAttribute(\"id\", id);\n bomb.style.width = widthCase + \"px\"; // A changer si changment dans scss\n bomb.style.height = widthCase + \"px\";\n bomb.style.left = left + \"px\";\n bomb.style.top = top + \"px\";\n bomb.style.backgroundImage = 'url(\"../pictures/bomb.png\")';\n bomb.style.backgroundSize = \"cover\";\n\n const caseBomb = document.querySelector(`[row=\"${top/widthCase}\"][column=\"${left/widthCase}\"]`);\n caseBomb.appendChild(bomb);\n this.attributes.attribut.actuelBomb++;\n this.sizeArray++\n\n //update map.grounds and coordinate\n let x = this.x;\n let y = this.y;\n let b = {\n x: x,\n y: y,\n bomb: bomb,\n id: id\n }\n map.grounds[y][x].bomb = b;\n\n this.bombs.push(b);\n //trigger detonate\n this.triggerDetonate(b);\n \n this.escapeDetonate(x, y)\n \n }", "pushCoordinates(positionX, positionY) {\n for (let x = this.body.length; x !== 0; --x) {\n for (let y = 0; y !== 2; ++y) {\n if (x === 1 && y === 0) {\n this.body[x - 1][y] = positionX;\n }\n else if (x === 1 && y === 1) {\n this.body[x - 1][y] = positionY;\n }\n else\n this.body[x - 1][y] = this.body[x - 2][y];\n }\n }\n }", "function notBombCells(cellsNumber, nBombCells, ) {\n //ciclo che nserisce tutti i numeri nell'array\n arrayCells = [];\n\n for (let i = 1; i <= cellsNumber; i++) { //metti cellsNumber al posto del numero\n arrayCells.push(i);\n }\n //ciclo ripetuto per n volte, in cui n sta per il numero di bombe che voglio\n //per ogni bomba che voglio creare, genero un numero random per posizionarla casualmente\n for (let i = 0; i < nBombCells; i++) { \n const nChoosenRandomly = randomNumber(1, cellsNumber)\n arrayCells.splice(nChoosenRandomly - 1, 1);\n cellsNumber--;\n }\n console.log(arrayCells);\n}", "function update_ball_positions(){\r\n for (let b = 0; b < balls.length; b++){\r\n let ball = balls[b];\r\n ball.x += time_delta_s * ball.vx;\r\n ball.y += time_delta_s * ball.vy;\r\n }\r\n}", "function update_boids_birds(boids, birds, enemy_boids, enemy_bullets) {\n for ( var i = 0, il = birds.length; i < il; i++ ) {\n boid = boids[ i ];\n if (boid == selectBoid && inFirstPerson) {\n boid.forcedMove(firstPersonControls.getDirection(), sd_boid);\n }\n else\n boid.run( boids, enemy_boids, enemy_bullets, sd_boid);\n\n if (boid.collided) {\n var collide_vel = boid.velocity.clone().multiplyScalar(-1);\n var collide_pos = boid.position.clone().sub(collide_vel);\n removeBoidBird(i, boids, birds);\n // console.log('count: ' + boids.length);\n var explosion = create_explosion(collide_pos, collide_vel);\n explosions.push(explosion);\n i--;\n il--;\n continue;\n }\n\n bird = birds[ i ];\n bird.position.copy( boids[ i ].position );\n color = bird.material.color;\n color.r = color.g = color.b = Math.max((current_camera.position.clone().sub(bird.position)).length() / diagonal, 0.2);\n\n // if (boid.pursue) {\n // color.r = 1;\n // color.g = 0;\n // color.b = 0;\n // }\n // else {\n // color.r = 0;\n // color.g = 1;\n // color.b = 0;\n // }\n\n //color.r = color.g = color.b = ( 500 - bird.position.z ) / 1000;\n bird.rotation.y = Math.atan2( - boid.velocity.z, boid.velocity.x );\n bird.rotation.z = Math.asin( boid.velocity.y / boid.velocity.length() );\n // bird.phase = ( bird.phase + ( Math.max( 0, bird.rotation.z ) + 0.1 ) ) % 62.83;\n // bird.geometry.vertices[ 5 ].y = bird.geometry.vertices[ 4 ].y = Math.sin( bird.phase ) * 5;\n\n if (boid.pursue && !boid.fired && boid != selectBoid) {\n if (boid.type == 'xwing') {\n init_bullet_obj(boid, bullets_xwing, bullet_meshs_xwing, bullet_xwing_color);\n } else {\n init_bullet_obj(boid, bullets_tie, bullet_meshs_tie, bullet_tie_color);\n }\n }\n }\n}", "function bombField(bomb) {\r\n // Utilizzo il ciclo while per generare 16 numeri da includere successivamente in bomb.array\r\n while (bomb.length < 16) {\r\n var numberBomb = randomNumber(1, maxNumber)\r\n // Ora devo evitare che il numero venga duplicato due volte utilizzando la funzione includes\r\n // Utilizzando il not controllo se il numero non è incluso\r\n if (!bomb.includes(numberBomb)) {\r\n // Utilizzando il push lo metto nell'array\r\n bomb.push(numberBomb)\r\n }\r\n }\r\n return bomb;\r\n}", "function moveBalls() {\r\n for (var i = 0; i < balls.length; i++) {\r\n balls[i].set(\"Y\", balls[i].get(\"Y\") - ball_speed);\r\n if (balls[i].get(\"Y\") < 0) {\r\n balls.splice(i, 1);\r\n }\r\n }\r\n}", "function Baddies() {\r\n\r\n\tthis.baddiePosition = [];\r\n\r\n\tthis.initiate = Initiate;\r\n\tfunction Initiate() {\r\n\t\t// reindex the baddies in the config by name\r\n\t\tvar baddies = gameConfig.graphics.baddies;\r\n\t\tfor (var i = 0; i < baddies.length; i++) {\r\n\t\t\tvar name = gameConfig.graphics.baddies[i].name;\r\n\t\t\tgameConfig.graphics.baddies[name] = i;\r\n\t\t}\r\n\t\tthis.initiateAllBaddiePositions();\r\n\t}\r\n\r\n\t// initiate all positions for baddies in this level\r\n\tthis.initiateAllBaddiePositions = \r\n\tfunction () {\r\n\t\tthis.baddiePosition = [];\r\n\t\tvar baddieInstance = gameConfig.graphics.levels[gameConfig.world.currentLevel].baddieInstance;\r\n\t\tfor (var i = 0; i < baddieInstance.length; i++) {\r\n\t\t\tthis.baddiePositionInitiate(i);\r\n\t\t}\r\n\t}\t\r\n\r\n\t/*\r\n\t// Initiate a baddie position element\r\n\t*/\r\n\tthis.baddiePositionInitiate = \r\n\tfunction (i) {\r\n\t\tvar baddieInstance = gameConfig.graphics.levels[gameConfig.world.currentLevel].baddieInstance;\r\n\t\t// recalculate the x and y's into game pixels\r\n\t\tfor (var j = 0; j < baddieInstance[i].moveArray.length; j++) {\r\n\t\t\t\tbaddieInstance[i].moveArray[j][\"xPix\"] = baddieInstance[i].moveArray[j].x * gameConfig.world.tileWidth;\r\n\t\t\t\tbaddieInstance[i].moveArray[j][\"yPix\"] = baddieInstance[i].moveArray[j].y * gameConfig.world.tileHeight;\r\n\t\t}\r\n\t\t// create baddie position entries for every baddie on the current level\r\n\t\t// to keep track of where they are at\r\n\t\t// we can add framing information to this when we need to later\r\n\t\tthis.baddiePosition[i] = {\r\n\t\t\tx: baddieInstance[i].moveArray[0].xPix, // the baddies current x coordinate in game pixels\r\n\t\t\ty: baddieInstance[i].moveArray[0].yPix, // the baddies current y coordinate in game pixels\r\n\t\t\tname: baddieInstance[i].name, // index into both game config arrays\r\n\t\t\tinstanceIndex: i, // index into the baddie instance array, cant use name here because there are duplicates\r\n\t\t\ttimesPlayed: 0, // number of times the current sprite set has been played (used for sprite codas) \r\n\t\t\tcurrentFrame: 0, // current frame rendered in the current sprite set\r\n\t\t\tcurrentFrameInterval: 0, // The current frame inerval number, i.e. a frame may only want to be rendered 1 in 3 frame intervals\r\n\t\t\tcodaCompleted: false, // if we have finished rendering the sprite coda\r\n\t\t\tcurrentFrameShowPoints: 0, // a count of how many frames has passed since we started showing the points.\r\n\t\t\tcurrentAction: vv(baddieInstance[i].facing, \"default\"), // what direction should the animal be facing, this is relevant to sprite rendering and movement \r\n\t\t\tcurrentCoordinateSetIndex: 0, // what coordinate set we are up to, only applies to a pointChaser\r\n\t\t\tcurrentCoordinateSetDirection:1,\r\n\t\t\tspawnCount:0, // number of children spawned\r\n\t\t\tspawnFrameDelay:vv(baddieInstance[i].spawn.frameDelay, 0), // the delay (in frames between spawns)\r\n\t\t\tspawnMax: vv(baddieInstance[i].spawn.maxInPlay, 0), // the maximum number of spawns available at a time\r\n\t\t\tspawnHealthDecrement: vv(baddieInstance[i].spawn.healthDecrement, 0),\r\n\t\t\tisDead:false,\r\n\t\t\tnotKill:vv(baddieInstance[i].notKill, false),\r\n\t\t\tnotDie:vv(baddieInstance[i].notDie, false),\r\n\t\t\tlastMoveHitPlayer:false,\r\n\t\t\tpoints:vv(baddieInstance[i].points, 0),\r\n\t\t\tpointsRising:null,\r\n\t\t\tlastAction:\"\",\r\n\t\t\tturningSprite:\"\",\r\n\t\t\tisTurning:false\r\n\t\t};\r\n\t}\r\n\r\n\r\n\tthis.draw = Draw;\r\n\tfunction Draw(ctx) {\r\n\r\n\t\t// for every baddie instance\r\n\t\tfor (var i = 0; i < this.baddiePosition.length; i++) {\r\n\t\t\t// show points rising\r\n\t\t\tif (this.baddiePosition[i].pointsRising) {\r\n\t\t\t\tthis.baddiePosition[i].pointsRising.draw(ctx);\r\n\t\t\t\tif (this.baddiePosition[i].pointsRising.finished)\r\n\t\t\t\t\tthis.baddiePosition[i].pointsRising = null;\r\n\t\t\t}\r\n\r\n\t\t\t// if we are not completely expired\r\n\t\t\tif (!this.baddiePosition[i].codaCompleted) {\r\n\t\t\t\t// whats its species?\r\n\t\t\t\tvar name = this.baddiePosition[i].name;\r\n\t\t\t\t// dig out the artwork for this species\r\n\t\t\t\tvar baddieArtIndex = gameConfig.graphics.baddies[name];\r\n\t\t\t\tvar baddieArt = gameConfig.graphics.baddies[baddieArtIndex];\r\n\t\t\t\t// What must we avoid\r\n\t\t\t\tvar avoid = utils.validateVariable(baddieArt.avoidTerrain, \"\");\r\n\t\t\t\t// dig out the instance index into the game config array\r\n\t\t\t\tvar idex = this.baddiePosition[i].instanceIndex;\r\n\t\t\t\t// dig out the game physics for this species\r\n\t\t\t\tvar baddieInstance = gameConfig.graphics.levels[gameConfig.world.currentLevel].baddieInstance[idex];\r\n\t\t\t\t// index into the basic sprite information\r\n\t\t\t\tvar artIndex = gameConfig.graphics.baddies[name];\r\n\r\n\t\t\t\t// now apply the game movement\r\n\t\t\t\tvar x = this.baddiePosition[i].x;\r\n\t\t\t\tvar y = this.baddiePosition[i].y;\r\n\t\t\t\tvar direction = this.baddiePosition[i].currentAction;\r\n\r\n\t\t\t\t// convert our coordinates into world grid coordinates\r\n\t\t\t\tvar c = parseInt(x / gameConfig.world.tileWidth);\r\n\t\t\t\tvar r = parseInt(y / gameConfig.world.tileHeight);\r\n\r\n\t\t\t\t//checking if you hand on the wall should only take place when we reach a new game cell\r\n\t\t\t\tvar isEvenCell = false;\r\n\t\t\t\tif (x % gameConfig.world.tileWidth == 0 && y % gameConfig.world.tileHeight == 0) {\r\n\t\t\t\t\tisEvenCell = true;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (!this.baddiePosition[i].isTurning) {\r\n\r\n\t\t\t\t\t// depending on the species of baddie, move it\r\n\t\t\t\t\tswitch(baddieInstance.moveType) {\r\n\t\t\t\t\t\tcase \"pointChaser\":\r\n\t\t\t\t\t\t\tvar coordIndex = this.baddiePosition[i].currentCoordinateSetIndex;\r\n\t\t\t\t\t\t\t// in edit mode these may not be set, so initialize it\r\n\t\t\t\t\t\t\tif (baddieInstance.moveArray[coordIndex][\"xPix\"] == null) {\r\n\t\t\t\t\t\t\t\tbaddieInstance.moveArray[coordIndex][\"xPix\"] = baddieInstance.moveArray[coordIndex].x * gameConfig.world.tileWidth;\r\n\t\t\t\t\t\t\t\tbaddieInstance.moveArray[coordIndex][\"yPix\"] = baddieInstance.moveArray[coordIndex].y * gameConfig.world.tileHeight;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// if we have arrived at our destination coordinate set (1st time run of cause we have because we have not moved from it)\r\n\t\t\t\t\t\t\tif (x == baddieInstance.moveArray[coordIndex].xPix && \r\n\t\t\t\t\t\t\t\ty == baddieInstance.moveArray[coordIndex].yPix &&\r\n\t\t\t\t\t\t\t\tbaddieInstance.moveArray.length > 1) {\r\n\t\t\t\t\t\t\t\t// move our target to the next set of coordinates\r\n\t\t\t\t\t\t\t\tcoordIndex += this.baddiePosition[i].currentCoordinateSetDirection;\r\n\t\t\t\t\t\t\t\t// have we reached the end of the corrdinates list?\r\n\t\t\t\t\t\t\t\tvar nextIndex = coordIndex + this.baddiePosition[i].currentCoordinateSetDirection;\r\n\t\t\t\t\t\t\t\tif (nextIndex >= baddieInstance.moveArray.length || nextIndex < 0) {\r\n\t\t\t\t\t\t\t\t\t// reset, go back to the origin\r\n\t\t\t\t\t\t\t\t\tthis.baddiePosition[i].currentCoordinateSetDirection = -this.baddiePosition[i].currentCoordinateSetDirection;\r\n\t\t\t\t\t\t\t\t\t// todo if not looped then pop this baddie from the list\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tthis.baddiePosition[i].currentCoordinateSetIndex = coordIndex;\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// determine direction of travel\r\n\t\t\t\t\t\t\t\t// a point chaser does not even care about walls\r\n\r\n\t\t\t\t\t\t\t\tif (y < baddieInstance.moveArray[coordIndex].yPix ) {\r\n\t\t\t\t\t\t\t\t\ty += baddieInstance.speed;\r\n\t\t\t\t\t\t\t\t\tdirection = \"down\";\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tif (y > baddieInstance.moveArray[coordIndex].yPix ) {\r\n\t\t\t\t\t\t\t\t\ty -= baddieInstance.speed;\r\n\t\t\t\t\t\t\t\t\tdirection = \"up\";\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tif (x < baddieInstance.moveArray[coordIndex].xPix ) {\r\n\t\t\t\t\t\t\t\t\tx += baddieInstance.speed;\r\n\t\t\t\t\t\t\t\t\tdirection = \"right\";\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tif (x > baddieInstance.moveArray[coordIndex].xPix ) {\r\n\t\t\t\t\t\t\t\t\tx -= baddieInstance.speed;\r\n\t\t\t\t\t\t\t\t\tdirection = \"left\";\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase \"roamingRight\":\r\n\t\t\t\t\t\t\t// keep your right hand on the wall and follow the walls around.\r\n\r\n\t\t\t\t\t\t\tif (isEvenCell) {\r\n\t\t\t\t\t\t\t\t// right hand on the wall\r\n\t\t\t\t\t\t\t\tswitch(direction) {\r\n\t\t\t\t\t\t\t\t\tcase \"right\":\r\n\t\t\t\t\t\t\t\t\t\t//if down is not blocked d = \"down\"\r\n\t\t\t\t\t\t\t\t\t\tif (!this.blockedCell(c, r + 1, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"down\";\r\n\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t//if right is blocked then d = \"up\"\r\n\t\t\t\t\t\t\t\t\t\tif (this.blockedCell(c + 1, r, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"up\";\r\n\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t\t\tcase \"left\":\r\n\t\t\t\t\t\t\t\t\t\t//if up is not blocked d = \"up\"\r\n\t\t\t\t\t\t\t\t\t\tif (!this.blockedCell(c, r - 1, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"up\";\r\n\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t//if left is blocked then d = \"down\"\r\n\t\t\t\t\t\t\t\t\t\tif (this.blockedCell(c - 1, r, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"down\";\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t\t\tcase \"up\":\r\n\t\t\t\t\t\t\t\t\t\t//if right is not blocked d = \"right\"\r\n\t\t\t\t\t\t\t\t\t\tif (!this.blockedCell(c + 1, r, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"right\";\r\n\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t//if up is blocked then d = \"left\"\r\n\t\t\t\t\t\t\t\t\t\tif (this.blockedCell(c, r - 1, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"left\";\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\tbreak;\t\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t\t\tcase \"down\":\r\n\t\t\t\t\t\t\t\t\t\t//if left is not blocked d = \"left\"\r\n\t\t\t\t\t\t\t\t\t\tif (!this.blockedCell(c - 1, r, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"left\";\r\n\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t//if down is blocked then d = \"right\"\r\n\t\t\t\t\t\t\t\t\t\tif (this.blockedCell(c, r + 1, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"right\";\r\n\r\n\t\t\t\t\t\t\t\t\t\tbreak;\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\t// determine the x and y directions implied by the action string\r\n\t\t\t\t\t\t\tvar xd = 0;\r\n\t\t\t\t\t\t\tvar yd = 0;\r\n\t\t\t\t\t\t\tswitch(direction) {\r\n\t\t\t\t\t\t\t\tcase \"left\":\r\n\t\t\t\t\t\t\t\t\txd = -1;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t\tcase \"right\":\r\n\t\t\t\t\t\t\t\t\txd = 1;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t\tcase \"up\":\r\n\t\t\t\t\t\t\t\t\tyd = -1;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t\tcase \"down\":\r\n\t\t\t\t\t\t\t\t\tyd = 1;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t// if direction of movement is not blocked then move d\r\n\t\t\t\t\t\t\tif (!isEvenCell || !this.blockedCell(c + xd, r + yd, avoid)) {\r\n\t\t\t\t\t\t\t\tx += (baddieInstance.speed * xd);\r\n\t\t\t\t\t\t\t\ty += (baddieInstance.speed * yd);\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\tcase \"roamingLeft\":\r\n\r\n\t\t\t\t\t\t\t// keep your left hand on the wall and follow the walls around.\r\n\t\t\t\t\t\t\tif (isEvenCell) {\r\n\t\t\t\t\t\t\t\tswitch(direction) {\r\n\t\t\t\t\t\t\t\t\tcase \"right\":\r\n\t\t\t\t\t\t\t\t\t\t//if up is not blocked d = \"up\"\r\n\t\t\t\t\t\t\t\t\t\tif (!this.blockedCell(c, r - 1, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"up\";\r\n\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t//if right is blocked then d = \"down\"\r\n\t\t\t\t\t\t\t\t\t\tif (this.blockedCell(c + 1, r, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"down\";\r\n\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t\t\tcase \"left\":\r\n\t\t\t\t\t\t\t\t\t\t//if down is not blocked d = \"down\"\r\n\t\t\t\t\t\t\t\t\t\tif (!this.blockedCell(c, r + 1, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"down\";\r\n\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t//if left is blocked then d = \"up\"\r\n\t\t\t\t\t\t\t\t\t\tif (this.blockedCell(c - 1, r, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"up\";\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t\t\tcase \"up\":\r\n\t\t\t\t\t\t\t\t\t\t//if left is not blocked d = \"left\"\r\n\t\t\t\t\t\t\t\t\t\tif (!this.blockedCell(c - 1, r, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"left\";\r\n\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t//if up is blocked then d = \"right\"\r\n\t\t\t\t\t\t\t\t\t\tif (this.blockedCell(c, r - 1, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"right\";\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\tbreak;\t\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t\t\tcase \"down\":\r\n\t\t\t\t\t\t\t\t\t\t//if right is not blocked d = \"right\"\r\n\t\t\t\t\t\t\t\t\t\tif (!this.blockedCell(c + 1, r, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"right\";\r\n\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t//if down is blocked then d = \"left\"\r\n\t\t\t\t\t\t\t\t\t\tif (this.blockedCell(c, r + 1, avoid))\r\n\t\t\t\t\t\t\t\t\t\t\tdirection = \"left\";\r\n\r\n\t\t\t\t\t\t\t\t\t\tbreak;\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\t// determine the x and y directions implied by the action string\r\n\t\t\t\t\t\t\tvar xd = 0;\r\n\t\t\t\t\t\t\tvar yd = 0;\r\n\t\t\t\t\t\t\tswitch(direction) {\r\n\t\t\t\t\t\t\t\tcase \"left\":\r\n\t\t\t\t\t\t\t\t\txd = -1;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t\tcase \"right\":\r\n\t\t\t\t\t\t\t\t\txd = 1;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t\tcase \"up\":\r\n\t\t\t\t\t\t\t\t\tyd = -1;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t\tcase \"down\":\r\n\t\t\t\t\t\t\t\t\tyd = 1;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t// if direction of movement is not blocked then move d\r\n\t\t\t\t\t\t\tif (!isEvenCell || !this.blockedCell(c + xd, r + yd, avoid)) {\r\n\t\t\t\t\t\t\t\tx += (baddieInstance.speed * xd);\r\n\t\t\t\t\t\t\t\ty += (baddieInstance.speed * yd);\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t\t\t// update the coordinates\r\n\t\t\t\t\tthis.baddiePosition[i].lastAction = this.baddiePosition[i].currentAction;\r\n\t\t\t\t\tthis.baddiePosition[i].currentAction = direction;\r\n\r\n\t\t\t\t\t// do we need to be turning\r\n\t\t\t\t\tif (this.baddiePosition[i].lastAction == \"right\" && direction == \"left\" && !this.baddiePosition[i].isDead) {\r\n\t\t\t\t\t\tthis.baddiePosition[i].turningSprite = \"rightTurn\";\r\n\t\t\t\t\t\tthis.baddiePosition[i].isTurning = true;\r\n\t\t\t\t\t\tthis.baddiePosition[i].currentFrame = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\tif (this.baddiePosition[i].lastAction == \"left\" && direction == \"right\" && !this.baddiePosition[i].isDead) {\r\n\t\t\t\t\t\tthis.baddiePosition[i].turningSprite = \"leftTurn\";\r\n\t\t\t\t\t\tthis.baddiePosition[i].isTurning = true;\r\n\t\t\t\t\t\tthis.baddiePosition[i].currentFrame = 0;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.baddiePosition[i].x = x;\r\n\t\t\t\t\tthis.baddiePosition[i].y = y;\r\n\t\t\t\t} // end if not turning\r\n\r\n\r\n\t\t\t\t// grab the spritesheet name\r\n\t\t\t\tvar spriteSheet = \"\"\r\n\t\t\t\tif (this.baddiePosition[i].isDead) {\r\n\t\t\t\t\tspriteSheet = baddieArt.spriteCoda\r\n\t\t\t\t\tbaddieInstance.spawns = null;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tspriteSheet = baddieArt.sprites[\r\n\t\t\t\t\t\t(this.baddiePosition[i].isTurning)?this.baddiePosition[i].turningSprite:this.baddiePosition[i].currentAction\r\n\t\t\t\t\t\t];\r\n\t\t\t\t}\r\n\t\t\t\t// couldnt find a spritesheet? try for the default\r\n\t\t\t\tif (!spriteSheet) {\r\n\t\t\t\t\tspriteSheet = baddieArt.sprites.default;\r\n\t\t\t\t\t// couldnt find the truning sprite, so dont apply turning\r\n\t\t\t\t\tthis.baddiePosition[i].isTurning = false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// manage the frame movement\r\n\t\t\t\t// todo - copy from objects perhaps create a frame movement class\r\n\t\t\t\t// increment the objects frame interval\r\n\r\n\t\t\t\tthis.baddiePosition[i].currentFrameInterval++;\r\n\t\t\t\t// are we ready to show a new sprite?\r\n\t\t\t\tif (this.baddiePosition[i].currentFrameInterval >= baddieArt.frameInterval) {\r\n\t\t\t\t\t// yep so reset the current frame interval ( this controlls the speed that new frames are presented)\r\n\t\t\t\t\tthis.baddiePosition[i].currentFrameInterval = 0;\r\n\t\t\t\t\t// increment the frame number\r\n\t\t\t\t\tthis.baddiePosition[i].currentFrame++;\r\n\t\t\t\t\t// have we reached the final sprite frame?\r\n\t\t\t\t\tif (this.baddiePosition[i].currentFrame >= assetManager.imageArray[spriteSheet].maxFrames) {\r\n\t\t\t\t\t\t// yep\r\n\t\t\t\t\t\tthis.baddiePosition[i].currentFrame = 0;\r\n\t\t\t\t\t\t// are we in the sprite coda?\r\n\t\t\t\t\t\tif (this.baddiePosition[i].isDead) {\r\n\t\t\t\t\t\t\t// yep\r\n\t\t\t\t\t\t\tthis.baddiePosition[i].timesPlayed++;\r\n\t\t\t\t\t\t\t// have we played the sprite coda the required amount of times?\r\n\t\t\t\t\t\t\tif (this.baddiePosition[i].timesPlayed >= utils.validateVariable(baddieArt.playTimes, 1)) {\r\n\t\t\t\t\t\t\t\t// tell the system not to display any more sprites for this object instance\r\n\t\t\t\t\t\t\t\tthis.baddiePosition[i].codaCompleted = true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (this.baddiePosition[i].isTurning) {\r\n\t\t\t\t\t\t\tthis.baddiePosition[i].isTurning = false;\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\t// draw the baddie\r\n\t\t\t\tthis.baddiePosition[i][\"collisionArea\"] = assetManager.drawToXYScaled(\r\n\t\t\t\t\t\t\tctx, \r\n\t\t\t\t\t\t\tspriteSheet,\r\n\t\t\t\t\t\t\tthis.baddiePosition[i].currentFrame,\r\n\t\t\t\t\t\t\tx + utils.validateVariable(baddieArt.xOffset, 0), \r\n\t\t\t\t\t\t\ty + utils.validateVariable(baddieArt.yOffset, 0), \r\n\t\t\t\t\t\t\tutils.validateVariable(baddieArt.displaySizePercent, 100));\r\n\r\n\t\t\t\tif (!this.baddiePosition[i].notKill && !this.baddiePosition[i].isDead && !gameConfig.world.dontDie) {\r\n\t\t\t\t\t// quick test to see if this baddie collides with the player\r\n\t\t\t\t\tif (playerObj.rectCollisionRectangle != null && this.baddiePosition[i][\"collisionArea\"].collidesWith(playerObj.rectCollisionRectangle)) {\t\t\t\t\r\n\t\t\t\t\t\t// only deduct the health points if we are newly colliding\r\n\t\t\t\t\t\tif (!this.baddiePosition[i].lastMoveHitPlayer)\r\n\t\t\t\t\t\t\tplayerObj.deductHealth(baddieInstance.healthDecrement);\r\n\r\n\t\t\t\t\t\tthis.baddiePosition[i].lastMoveHitPlayer = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tthis.baddiePosition[i].lastMoveHitPlayer = false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//spawn if necessary\r\n\t\t\t\tif (baddieInstance.spawn.name && !baddieInstance.isDead && !this.baddiePosition[i].codaCompleted && baddieInstance.spawn.condition) { \r\n\t\t\t\t\t// check the spawn condition in the config\r\n\t\t\t\t\tvar fnc = eval(\"(\" + gameConfig.getSpawnConditionByName(baddieInstance.spawn.condition) + \")\");\r\n\t\t\t\t\t//if (baddieInstance.spawn.condition( {x:this.baddiePosition[i].x, y:this.baddiePosition[i].y} )) {\r\n\t\t\t\t\tif (fnc( {x:this.baddiePosition[i].x, y:this.baddiePosition[i].y} )) {\r\n\t\t\t\t\t\t// make sure we are allowed to spawn now\r\n\t\t\t\t\t\tif (this.baddiePosition[i].spawnCount < this.baddiePosition[i].spawnMax) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// increment the number of spawns sent out\r\n\t\t\t\t\t\t\tthis.baddiePosition[i].spawnCount++;\r\n\t\t\t\t\t\t\t// spawn and provide a callback to let us know the spawn has finished its life\r\n\t\t\t\t\t\t\tvar d = \"\";\r\n\t\t\t\t\t\t\tif (this.baddiePosition[i].x > playerObj.x && this.baddiePosition[i].y == playerObj.y) \r\n\t\t\t\t\t\t\t\td = \"left\";\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tif (this.baddiePosition[i].x < playerObj.x && this.baddiePosition[i].y == playerObj.y) \r\n\t\t\t\t\t\t\t\td = \"right\";\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tif (this.baddiePosition[i].y > playerObj.y && this.baddiePosition[i].x == playerObj.x) \r\n\t\t\t\t\t\t\t\td = \"up\";\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tif (this.baddiePosition[i].y < playerObj.y && this.baddiePosition[i].x == playerObj.x) \r\n\t\t\t\t\t\t\t\td = \"down\";\r\n\r\n\t\t\t\t\t\t\t_this = this;\r\n\t\t\t\t \t\t\tgameSpawn.createNewSpawn(\r\n\t\t\t\t \t\t\t\t\t\t\t\"player\",\r\n\t\t\t\t\t\t\t \t\t\t\td,\r\n\t\t\t\t\t\t\t \t\t\t\tbaddieInstance.spawn.name, \r\n\t\t\t\t\t\t\t \t\t\t\tthis.baddiePosition[i].x + baddieInstance.spawn.relativeX, // todo: + utils.validateVariable(thisOverlay.spawnX, 0),\r\n\t\t\t\t\t\t\t \t\t\t\tthis.baddiePosition[i].y + baddieInstance.spawn.relativeY, // todo: + utils.validateVariable(thisOverlay.spawnY, 0));\r\n\t\t\t\t\t\t\t\t\t\t\ti, // the reference to the object that spawned \r\n\t\t\t\t\t\t\t\t\t\t\tfunction(index) { \r\n\t\t\t\t\t\t\t\t\t\t\t\t_this.baddiePosition[index].spawnCount--; \r\n\t\t\t\t\t\t\t\t\t\t\t\t// this prevents a glitch in designer mode, if the spawn count\r\n\t\t\t\t\t\t\t\t\t\t\t\t// drops below zero, an unexpected number of spawn can take place\r\n\t\t\t\t\t\t\t\t\t\t\t\tif (_this.baddiePosition[index].spawnCount < 0) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t_this.baddiePosition[index].spawnCount = 0;\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}, // callback funtion when spawn dies\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tthis.baddiePosition[i].spawnHealthDecrement, // how many player health points this spawn is worth\r\n\t\t\t\t\t\t\t\t\t\t\tthis.baddiePosition[i].spawnMax); // how many is allowed to spawn\r\n\t\t\t\t \t\t\t// if the spawn removes the baddie, finish it off\r\n\t\t\t\t \t\t\tif (utils.validateVariable(baddieInstance.spawn.killsBaddieInstance, false)) {\r\n\t\t\t\t \t\t\t\tthis.baddiePosition[i].codaCompleted = true;\r\n\t\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}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tthis.blockedCell = \r\n\tfunction(c, r, avoidTerrain) {\r\n\r\n\t\tvar ret = false;\r\n\t\tif (r < 0 || c < 0) {\r\n\t\t\tret = true;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tvar cellIndex = r * gameConfig.world.gridColumns + c;\r\n\t\t\tvar index = gameEngine.gameTile(cellIndex);\r\n\t\t\t// its only blocked if a cell has a tile and the tile is solid\r\n\t\t\tif (index != -1) {\r\n\t\t\t\tvar tileObj = gameConfig.graphics.tiles[index];\r\n\t\t\t\t// if its a solid, then 100% blocked\r\n\t\t\t\tif (tileObj.isSolid)\r\n\t\t\t\t\tret = true;\r\n\t\t\t\telse\r\n\t\t\t\t\t// if its not solid and we avoid it then its also blocked\r\n\t\t\t\t\tif (utils.validateVariable(tileObj.terrain, \"\") == avoidTerrain && avoidTerrain != \"\")\r\n\t\t\t\t\t\tret = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn ret;\r\n\t}\r\n\r\n\t// Check collisions with the collision rectangle (see spawn class)\r\n\tthis.checkCollision = \r\n\tfunction (collisionRectangle) {\r\n\t\tvar retVal = false;\r\n\t\tfor (var i = 0; i < this.baddiePosition.length; i++) {\r\n\t\t\tif (!this.baddiePosition[i].notDie && !this.baddiePosition[i].isDead) {\r\n\t\t\t\tif (collisionRectangle.collidesWith(this.baddiePosition[i][\"collisionArea\"])) {\r\n\t\t\t\t\t// remove the baddie from the array\r\n\t\t\t\t\tplayerObj.addPoints(this.baddiePosition[i].points);\r\n\t\t\t\t\tthis.baddiePosition[i].isDead = true;\r\n\t\t\t\t\t// create a points rising object\r\n\t\t\t\t\tthis.baddiePosition[i].pointsRising = new \r\n\t\t\t\t\t\tRisingText(\r\n\t\t\t\t\t\t\tthis.baddiePosition[i].x, \r\n\t\t\t\t\t\t\tthis.baddiePosition[i].y,\r\n\t\t\t\t\t\t\tthis.baddiePosition[i].points);\r\n\t\t\t\t\tretVal = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\treturn retVal;\r\n\t}\r\n\r\n\r\n\tthis.initiate();\r\n}", "add (aabbs) {\n aabbs.push(this.aabb);\n }", "function updateBottles(elem, index, arr) {\n if(elem.y < 0)\n bottles.removeChild(elem);\n elem.y += -3;\n}", "function pre_detect()\n{\n for (var i = 0; i < $cell.length; i++)\n {\n \tvar bombAround = 0;\n // There's nothing around\n if (i + 1 <= $cell.length-1) \t\tif ($cell[i + 1].classList.contains('cell-bomb')) bombAround++;\n if (i - 1 >= 0 ) \t\t\t \t\tif ($cell[i - 1].classList.contains('cell-bomb')) bombAround++;\n\tif (i - cols>= 0 ) \t\t\t \t\tif ($cell[(i - cols)].classList.contains('cell-bomb')) bombAround++;\n \tif (i - cols + 1 >= 0) \t\t \t\tif ($cell[(i - cols) + 1].classList.contains('cell-bomb')) bombAround++;\n if (i - cols - 1 >= 0) \t\t\t\tif ($cell[(i - cols) - 1].classList.contains('cell-bomb')) bombAround++;\n if (i + cols <= $cell.length-1)\t\tif ($cell[(i + cols)].classList.contains('cell-bomb')) bombAround++;\n if (i + cols + 1 <= $cell.length-1) if ($cell[(i + cols) + 1].classList.contains('cell-bomb')) bombAround++;\n if (i + cols - 1 <= $cell.length-1) if ($cell[(i + cols) - 1].classList.contains('cell-bomb')) bombAround++;\n bombArounds[i] = bombAround;\n }\n}", "function addNewBee() {\r\n beeArr.push({ x: 250, y: 620, color: \"\", direction: 0 });\r\n n++;\r\n }", "createNewBag() {\n this.shuffleTetrominoes()\n for (let i = 0; i < this.tetrominoArray.length; i++) {\n this.bag[i] = this.tetrominoArray[i]\n }\n }", "static generateBombBoard(numberOfRows, numberOfColumns, numberOfBombs) \r\n {\r\n let board = [];\r\n // fill in the first row with empty values, then repeat\r\n for (let rowCounter = 0; rowCounter < numberOfRows; rowCounter++)\r\n {\r\n let row = [];\r\n // fill in each cell in the current row. when row is full, exit this\r\n for (let colCounter = 0; colCounter < numberOfColumns; colCounter++)\r\n {\r\n row.push(null);\r\n }\r\n board.push(row);\r\n \r\n } // row generator\r\n let numberOfBombsPlaced = 0;\r\n while(numberOfBombsPlaced < numberOfBombs)\r\n {\r\n let randomRowIndex = Math.floor(Math.random() * numberOfRows);\r\n let randomColIndex = Math.floor(Math.random() * numberOfColumns);\r\n if(board[randomRowIndex][randomColIndex] != 'B')\r\n {\r\n board[randomRowIndex][randomColIndex] = 'B';\r\n numberOfBombsPlaced++;\r\n }\r\n \r\n }\r\n return board;\r\n }", "function buildTestBoard() {\n var size = 4;\n var bombsCount = 2;\n var board = [];\n //create empty board:\n for (var i = 0; i < size; i++) {\n var row = [];\n for (var j = 0; j < size; j++) {\n row.push({\n val: '', //can be empty, number, or '*' (stands for bomb)\n // negsCount: 0, //not sure if this is needed - to use only if value is not enough\n isShown: false,\n isMarkedBomb: false,\n isExplodedBomb: false\n });\n }\n board.push(row);\n }\n // fill in 2 bombs:\n board[1][1].val = '*';\n board[2][3].val = '*';\n gBombs.push({ i: 1, j: 1 });\n gBombs.push({ i: 2, j: 3 });\n fillNegsCount(board);\n printBoardToConsole(board);\n return board;\n}", "bpos()\n\t{\n\t\treturn [this.x + DIRS[this.dir][0], this.y + DIRS[this.dir][1]];\n\t}", "function displayBombs() {\n fill(ballColour);\n \n for (let b = 0; b < numberofbombs; b++) {\n circle(bombposX[b], bombposY[b], bombSize)\n \n hit = collidePointCircle(mouseX, mouseY - duck.height * duckScalar / 2, bombposX[b], bombposY[b], bombSize);\n \n if (hit) {\n endGame();\n }\n }\n}", "function bombs(){\r\n \tpineapples = game.add.group();\r\n pineapples.enableBody = true;\r\n pineapples.physicsBodyType = Phaser.Physics.ARCADE;\r\n\r\n for (var i = 0; i < 10; i++)\r\n {\r\n var pineapple = pineapples.create(200 + i * 48,50, 'pineapple');\r\n\r\n //This allows your sprite to collide with the world bounds like they were rigid objects\r\n pineapple.body.collideWorldBounds=true;\r\n pineapple.body.gravity.x = game.rnd.integerInRange(-50, 50);\r\n pineapple.body.gravity.y = 100 + Math.random() * 100;\r\n pineapple.body.bounce.setTo(1.1, 1.1);\r\n } \r\n }", "function Autofill(){\n for(var i = 0; i < mesh.Length; i++)\n {\n \tbones += mesh[i].bones;\n }\n}", "function init_boids_birds(boids, birds, xwing) {\n var total = init_count;\n if (xwing)\n total *= 1.05;\n console.log(total);\n\n for ( var i = 0; i < total; i ++ ) {\n boid = boids[ i ] = new Boid();\n //boid.position.x = Math.random() * scene_width_half * 2 - scene_width_half;\n boid.position.y = Math.random() * scene_height_half * 2 - scene_height_half;\n boid.position.z = Math.random() * scene_depth_half * 2 - scene_depth_half;\n //boid.velocity.x = Math.random() * init_vel - init_vel/2.;\n boid.velocity.y = (Math.random() * init_vel - init_vel/2);\n boid.velocity.z = (Math.random() * init_vel - init_vel/2);\n if (xwing) {\n boid.position.x = Math.random() * scene_width_half/3 + 3/5*scene_width_half;\n boid.velocity.x = -Math.random() *init_vel*2;\n } else {\n boid.position.x = -(Math.random() * scene_width_half/3 + 3/5*scene_width_half);\n boid.velocity.x = Math.random() * init_vel*2;\n }\n \n boid.setAvoidWalls( true );\n boid.setWorldSize( scene_width_half, scene_height_half, scene_depth_half );\n boid.setMaxSpeed(init_vel);\n boid.setAvoidStarDestroyer( true );\n if (xwing) {\n // var material = new THREE.MeshBasicMaterial( \n // { color:Math.random() * 0xff0000, \n // side: THREE.DoubleSide } );\n var material = new THREE.MeshPhongMaterial( {color: 0xffffff, side: THREE.DoubleSide });\n material.map = THREE.ImageUtils.loadTexture('/star_wars_boids/images/xwing.png');\n bird = birds[ i ] = new THREE.Mesh( new Xwing(), material);\n boid.type = 'xwing';\n } else {\n // var material = new THREE.MeshBasicMaterial( \n // { color:Math.random() * 0xff0000, \n // side: THREE.DoubleSide } ) ;\n // var material = new THREE.MeshPhongMaterial({ transparent: false, map: THREE.ImageUtils.loadTexture('../images/tie.jpg') });\n // material.side = THREE.DoubleSide;\n // material.color = 0xff0000;\n\n var material = new THREE.MeshPhongMaterial( {color: 0xffffff, side: THREE.DoubleSide });\n material.map = THREE.ImageUtils.loadTexture('/star_wars_boids/images/tie2.png');\n\n bird = birds[ i ] = new THREE.Mesh( new Tie(), material);\n boid.type = 'tie';\n }\n bird.scale.set(2,2,2);\n bird.phase = Math.floor( Math.random() * 62.83 );\n scene.add( bird );\n }\n}", "function addBall1(){\n while (ball1.length < 1){\n let newBall = new Ball();\n ball1.push(newBall)\n }\n }", "static generateBombBoard(numberOfRows, numberOfColumns, numberOfBombs) \n {\n let board = [];\n // fill in the first row with empty values, then repeat\n for (let rowCounter = 0; rowCounter < numberOfRows; rowCounter++)\n {\n let row = [];\n // fill in each cell in the current row. when row is full, exit this\n for (let colCounter = 0; colCounter < numberOfColumns; colCounter++)\n {\n row.push(null);\n }\n board.push(row);\n \n } // row generator\n let numberOfBombsPlaced = 0;\n while(numberOfBombsPlaced < numberOfBombs)\n {\n let randomRowIndex = Math.floor(Math.random() * numberOfRows);\n let randomColIndex = Math.floor(Math.random() * numberOfColumns);\n if(board[randomRowIndex][randomColIndex] != 'B')\n {\n board[randomRowIndex][randomColIndex] = 'B';\n numberOfBombsPlaced++;\n }\n \n }\n return board;\n }", "function createBalls() {\r\n // this can create as many balls as needed in this case five\r\n for (i = 0; i < maxBalls; i++) {\r\n // calls the function\r\n createCollide(\"red\", i);\r\n }\r\n //does the same for stick side\r\n for (j = maxBalls + 1; j < maxBallstwo; j++) {\r\n createStick(\"blue\", j);\r\n }\r\n\r\n // this just shows whats happening with the arrays when createBalls() is called\r\n //all the balls with id 0-4 and 5-9 and attributes are pushed into arrays\r\n console.log(ballsCollide);\r\n\r\n console.log(ballsStick);\r\n\r\n console.log(xC);\r\n\r\n console.log(yC);\r\n\r\n console.log(xS);\r\n\r\n console.log(yS);\r\n console.log(velocity_xC);\r\n console.log(velocity_yC);\r\n}", "function createPositionArray() {\n\t\n\tvar i, j, len;\n\n\tlen = inputDigits.length;\n\n\tpositionArray[1] = 95;\n\n\tfor(i = 2; i <= len; i++){\n\n\t\tpositionArray[i] = positionArray[i - 1] + 70;\n\t}\n}", "function draw() {\r\n background(20,20,20, 90);\r\n chaser.run();\r\n for(var i= 0; i<boids.length; i++){\r\n boids[i].run();\r\n }\r\n\r\n//This is to splice the boids\r\n for(var i = 0; i < boids.length; i++){\r\n var x = boids[i];\r\n var y = chaser.loc;\r\n var z = x.loc;\r\n//here we are checking to see if the boids should be spliced from the array\r\n var dist = y.dist(z);\r\n if (dist <=25){\r\n boids.splice(i,1);\r\n }\r\n }\r\n}", "function drawBirds(){\n for (let i = 0; i<birds.length; i++){\n let constant = 200\n \n if (birds[i].x == -50){\n birds.push({\n x: canvas.width+birdHeight,\n y: (Math.floor(150 +Math.random()* 200 )) \n })\n\n }\n\n ctx.drawImage(bird1, birds[i].x, birds[i].y, birdWidth,birdHeight)\n ctx.drawImage(bird2, birds[i].x, birds[i].y - constant, birdWidth, birdHeight)\n birds[i].x = birds[i].x-5;\n } \n\n checkBirdCollision()\n }", "setBombArea(pos) {\n if (this.canSetBomb(pos)) {\n this._nextState.map[pos.x][pos.y] = elements.empty;\n this._nextState.bombArea.push({x : pos.x, y: pos.y});\n this.bombKillEnemy(pos);\n }\n }", "function addBoat(board) {\n let added = false;\n while(!added){ \n let x = getRandomNumber();\n let y = getRandomNumber();\n\n if(x + 1 < board.length && board[x][y] === '~' && board[x+1][y] === '~'){\n board[x][y] = 'O';\n board[x + 1][y] = 'O';\n added = true;\n }\n }\n}", "function blockpositions(B) {\n var posx = 0;\n var posy = 0;\n var Px = [];\n var Py = [];\n for (var x = 0; x < B; ++x) {\n for (var y = 0; y < B; ++y) {\n Px.push(posx);\n Py.push(posy);\n posx += B;\n posy += 1;\n }\n posx += (B * B * B) - (B * B)\n posy += (B * B) - B\n }\n return [Px, Py];\n}", "function moveObstacles() {\n // Move all obstacles forward\n for (var i = obstacles.length - 1; i >= 0; --i)\n obstacles[i].x -= scrollSpeed;\n\n // If obstacle goes off-screen, put it in the back of the array and reset its position\n if (obstacles[0].x <= -obstacles[0].width) {\n obstacles.push(obstacles.shift());\n obstacles[obstacles.length - 1].resetPosition(obstacles[0].x);\n // Once the array is correctly sorted, set scored to false again.\n // (If it is set to false too soon, the score will just keep incrementing)\n bird.scored = false;\n }\n}", "explodeBombs() {\n let characterIOnGrid = this.character.y / BLOCK_SIZE;\n let characterJOnGrid = this.character.x / BLOCK_SIZE;\n\n //iterates over the rows in the blocks array of arrays\n for (let i = 0; i < this.blocks.length; i++) {\n //iterates over the columns in that row\n for (let j = 0; j < this.blocks[i].length; j++) {\n //block at i, j\n const block = this.blocks[i][j];\n if (this.blocks[i][j] !== null) {\n this.blocks[i][j] = this.blocks[i][j].update();\n }\n // if the position is a bomb and the time is up\n if (block instanceof Bomb && block.shouldExplode()) {\n // Destroy neighbour blocks (calls method onExplosion of a block)\n if (j + 1 < NUM_BLOCKS_HORIZONTAL && this.blocks[i][j + 1] !== null) {\n this.blocks[i][j + 1] = this.blocks[i][j + 1].onExplosion();\n }\n if (j - 1 >= 0 && this.blocks[i][j - 1] !== null) {\n this.blocks[i][j - 1] = this.blocks[i][j - 1].onExplosion();\n }\n if (i + 1 < NUM_BLOCKS_VERTICAL && this.blocks[i + 1][j] !== null) {\n this.blocks[i + 1][j] = this.blocks[i + 1][j].onExplosion();\n }\n if (i - 1 >= 0 && this.blocks[i - 1][j] !== null) {\n this.blocks[i - 1][j] = this.blocks[i - 1][j].onExplosion();\n }\n\n // Destroy the bomb (inside the if that states the [i][j] is an instance of bomb)\n this.blocks[i][j] = this.blocks[i][j].onExplosion();\n\n // Check if character is caught in explosion (vertical region and horizontal region)\n if (\n (characterJOnGrid === j && (i - 1 <= characterIOnGrid && characterIOnGrid <= i + 1)) ||\n (characterIOnGrid === i && (j - 1 <= characterJOnGrid && characterJOnGrid <= j + 1))\n ) {\n this.character.die();\n this.setGameOver();\n }\n\n // Positions next to a bomb - 10 pixels to adjust buffer zone\n const minXHorizontalBomb = j * BLOCK_SIZE - BLOCK_SIZE + 10;\n const maxXHorizontalBomb = j * BLOCK_SIZE + 2 * BLOCK_SIZE - 10;\n const minYHorizontalBomb = i * BLOCK_SIZE + 10;\n const maxYHorizontalBomb = i * BLOCK_SIZE + BLOCK_SIZE - 10;\n const minXVerticalBomb = j * BLOCK_SIZE + 10;\n const maxXVerticalBomb = j * BLOCK_SIZE + BLOCK_SIZE - 10;\n const minYVerticalBomb = i * BLOCK_SIZE - BLOCK_SIZE + 10;\n const maxYVerticalBomb = i * BLOCK_SIZE + 2 * BLOCK_SIZE - 10;\n\n // Retuns a array whith the bugs that will survive (rectIntersect - utils)\n this.bugs = this.bugs.filter(bug => {\n //return true if rect horizontal Intresect\n if (\n rectIntersect(\n minXHorizontalBomb,\n maxXHorizontalBomb,\n minYHorizontalBomb,\n maxYHorizontalBomb,\n bug.x,\n bug.x + BLOCK_SIZE,\n bug.y,\n bug.y + BLOCK_SIZE\n )\n ) {\n // return false to be removed from bugs array\n return false;\n }\n //return true if rect vertical Intresect\n if (\n rectIntersect(\n minXVerticalBomb,\n maxXVerticalBomb,\n minYVerticalBomb,\n maxYVerticalBomb,\n bug.x,\n bug.x + BLOCK_SIZE,\n bug.y,\n bug.y + BLOCK_SIZE\n )\n ) {\n // return false to be removed from bugs array\n return false;\n }\n // if don't intersect, keep in the array\n return true;\n });\n }\n }\n }\n }", "function addPosToBoard() {\r\n let blockPos = getPosOnBoard();\r\n blockPos.forEach(block => { //change the matching board pos to the colour code\r\n board[block.y][block.x] = currentTetromino.colourCode;\r\n });\r\n}", "function createAsteroidBelt () {\n\troids = [];\n\troidsTotal = (roidsNum + level) * 7;\n\troidsLeft = roidsTotal;\n\tlet x, y;\n\tfor (let i = 0; i < roidsNum + level; i++) {\n\t\tdo { \n\t\t\tx = Math.floor(Math.random() * canvas.width);\n\t\t\ty = Math.floor(Math.random() * canvas.height);\n\t\t} while (distBetweenPoints(ship.x, ship.y, x, y) < roidsSize * 2 + ship.r);\n\t\troids.push(newAsteroid(x, y, Math.ceil(roidsSize / 2)));\n\t}\n}", "setUp(player, squares) {\n this.squares = Array(100).fill(null)\n player === 1?\n this.player1Pieces = Array(12).fill(0):\n this.player2Pieces = Array(12).fill(0)\n let ranksArray = [1, 1, 8, 5, 4, 4, 4, 3, 2, 1, 1, 6]//length: 12\n let flagInd, bomb1Ind, bomb2Ind, bomb3Ind\n if (player === 1) {\n //Initialize flag and three bombs pieces\n flagInd = Math.floor(Math.random() * (99 - 91) + 91)\n bomb1Ind = flagInd - 1\n bomb2Ind = flagInd + 1\n bomb3Ind = flagInd - 10\n squares[flagInd] = this.getObject(player, 0, ranksArray)\n squares[bomb1Ind] = this.getObject(player, 11, ranksArray)\n squares[bomb2Ind] = this.getObject(player, 11, ranksArray)\n squares[bomb3Ind] = this.getObject(player, 11, ranksArray)\n for (let i = 60; i < 100; i++) {\n if (squares[i] == null) {\n let randomRank = Math.floor(Math.random() * (ranksArray.length))\n //Remove 0 amount from array\n while (ranksArray[randomRank] === 0) {\n randomRank += 1\n randomRank = randomRank >= ranksArray.length? 0 : randomRank\n }\n squares[i] = this.getObject(player, randomRank, ranksArray)\n }\n }\n } else {\n flagInd = Math.floor(Math.random() * (9 - 1) + 1)\n bomb1Ind = flagInd - 1\n bomb2Ind = flagInd + 1\n bomb3Ind = flagInd + 10\n squares[flagInd] = this.getObject(player, 0, ranksArray)\n squares[bomb1Ind] = this.getObject(player, 11, ranksArray)\n squares[bomb2Ind] = this.getObject(player, 11, ranksArray)\n squares[bomb3Ind] = this.getObject(player, 11, ranksArray)\n for (let i = 0; i < 40; i++) {\n if (squares[i] == null) {\n let randomRank = Math.floor(Math.random() * (ranksArray.length))\n //Remove 0 amount from array\n while (ranksArray[randomRank] === 0) {\n randomRank += 1\n randomRank = randomRank >= ranksArray.length? 0 : randomRank\n }\n squares[i] = this.getObject(player, randomRank, ranksArray)\n }\n }\n }\n\n return squares\n }", "function isRocket_Clash_Bomb() {\r\n for (let i in stages.bomb) {\r\n if (\r\n stages.bomb[i].y >= rocket1.y &&\r\n stages.bomb[i].y <= rocket1.y + rocket1.height &&\r\n stages.bomb[i].x - rocket1.width <= rocket1.x &&\r\n stages.bomb[i].x >= rocket1.x\r\n ) {\r\n stages.bomb[i].x = -200;\r\n soundDestroy();\r\n drawBlast(\r\n imageBlast,\r\n rocket1.x,\r\n rocket1.y - 10,\r\n rocket1.width + 10,\r\n rocket1.height + 10\r\n );\r\n rocket1.x = 0;\r\n lives -= 1;\r\n }\r\n }\r\n }", "function generateRandom(){\n let r=0;\n while(length<10){\n r=Math.floor(Math.random()* (81)+1); \n // if(bomb.indexOf(r)==-1){\n // }\n while(bomb.includes(r)){\n r=Math.floor(Math.random()* (81)+1);\n }\n bomb.push(r);\n length++;\n }\n for(let i=0; i<bomb.length; i++){\n bombArray[bomb[i]]=1;\n random[i]=bomb[i];\n }\n //alert(random);\n }", "function handleObstacles(){\n if (frame%200 === 0){\n var randomBoolean = Math.random() >= 0.5;\n if(randomBoolean === true){obstaclesArray.unshift(new Pylon());}\n else{obstaclesArray.unshift(new Bird());}\n }\n for(let i = 0; i < obstaclesArray.length; i++){\n obstaclesArray[i].update();\n if (obstaclesArray.length > 5){\n obstaclesArray.pop(obstaclesArray[0]);\n }\n }\n}", "function blowUpBomb(bomb) {\n\n // bomb has already exploded so don't blow up again\n if (!bomb.alive) return;\n\n bomb.alive = false;\n\n // remove bomb from grid\n cells[bomb.row][bomb.col] = null;\n\n // explode bomb outward by size\n const dirs = [{\n // up\n row: -1,\n col: 0\n }, {\n // down\n row: 1,\n col: 0\n }, {\n // left\n row: 0,\n col: -1\n }, {\n // right\n row: 0,\n col: 1\n }];\n dirs.forEach((dir) => {\n for (let i = 0; i < bomb.size; i++) {\n const row = bomb.row + dir.row * i;\n const col = bomb.col + dir.col * i;\n const cell = cells[row][col];\n\n // stop the explosion if it hit a wall\n if (cell === types.wall) {\n return;\n }\n\n // center of the explosion is the first iteration of the loop\n entities.push(new Explosion(row, col, dir, i === 0 ? true : false));\n cells[row][col] = null;\n\n // bomb hit another bomb so blow that one up too\n if (cell === types.bomb) {\n\n // find the bomb that was hit by comparing positions\n const nextBomb = entities.find((entity) => {\n return (\n entity.type === types.bomb &&\n entity.row === row && entity.col === col\n );\n });\n blowUpBomb(nextBomb);\n }\n\n // stop the explosion if hit anything\n if (cell) {\n return;\n }\n }\n });\n}", "function emptyArrayPush(i, j) {\n\t\t\t_emptyArray.push( i*_height+j );\n\t\t}", "function updateObjectsData() {\n\n for (var i = 0; i < numBalls; i++) {\n balls[i].nextX = balls[i].x + balls[i].velocityX;\n balls[i].nextY = balls[i].y + balls[i].velocityY;\n }\n }", "getPocketedBalls() {\n\n let ballPocketed = [];\n\n for (let i = 0; i < this.balls.length; i++) {\n\n for (let j = 0; j < TABLE_POCKETS.length; j++) {\n\n if (this.balls[i].position.distanceFrom(TABLE_POCKETS[j]) < POCKET_RADIUS\n && this.balls[i].include) {\n\n ballPocketed.push(this.balls[i]);\n\n if (!this.balls[i].visible) this.balls[i].include = false;\n }\n }\n }\n\n return ballPocketed;\n }", "function bouncing_ball() {\n\n\tdraw_briques();\n\n\tfor(j=0;j<balls_lost.length;j++) {\n\t\tif (x[j] + dx[j] > WIDTH || x[j] + dx[j] < 0)\n\t\t\tdx[j] = -dx[j];\n\t\tif (y[j] + dy[j] > HEIGHT || y[j] + dy[j] < 0)\n\t\t\tdy[j] = -dy[j];\n\t}\n\tdraw_ball_or_balls();\n}", "function markWaterCircles(array) {\n for (let circleIndex = 0; circleIndex < array.length / 2 + 1; ++circleIndex) {\n for (let y = circleIndex + 1; y < array.length - circleIndex - 1; ++y) {\n for (let x = circleIndex + 1; x < array.length - circleIndex - 1; ++x) {\n array[y][x] = circleIndex + 1;\n }\n }\n }\n}", "function genrandom(){\r\n\r\nfor(var i = 0;i<9; i++){\r\n\tbomb[i] = Math.floor(Math.random() * 81);\r\n}\r\n}", "function showAllBombs() {\n for (var i = 0; i < gBoard.length; i++) {\n for (var j = 0; j < gBoard[0].length; j++) {\n var cell = gBoard[i][j];\n if (cell.isBomb) {\n colorCell(i, j, 'red');\n }\n }\n }\n}", "getNumberOfNeighborBombs(rowIndex, columnIndex) {\r\n const neighborOffsets = [\r\n [-1, -1], [-1, 0], [-1, 0],\r\n [0, -1], [0, 1],\r\n [1, -1], [1, 0], [1, 1]\r\n ];\r\n \r\n const numberOfRows = this._bombBoard.length; \r\n /* because the board generated by \r\n generateBombBoard is a 2D array - the first layer of array values = # of rows */\r\n const numberOfColumns = this._bombBoard[0].length; // how many values in first row\r\n let numberOfBombs = 0;\r\n \r\n /* this runs on EVERY element in the array, aka [1, -1] is ONE element.\r\n The first parameter in foreach(), aka offset here, represents the \r\n current element in the array that foreach() is iterating through. \r\n rowIndex and columnIndex is the row/column of the tile the player's flipping. */\r\n neighborOffsets.forEach(offset => {\r\n \r\n /* offset[0] means the row offset, offset[1] means the column offset,\r\n because each element in the neighborOffsets array has 2 elements (aka [-1, -1]). */\r\n const neighborRowIndex = rowIndex + offset[0];\r\n const neighborColumnIndex = columnIndex + offset[1]; \r\n \r\n // check if the neighbor cell selected is off the board or not\r\n if(neighborRowIndex >= 0 && neighborRowIndex < numberOfRows &&\r\n neighborColumnIndex >= 0 && neighborColumnIndex < numberOfColumns)\r\n {\r\n if(this._bombBoard[neighborRowIndex][neighborColumnIndex] === 'B')\r\n {\r\n numberOfBombs++;\r\n }\r\n }\r\n }); // this ends the parameters for the forEach() method\r\n return numberOfBombs;\r\n }", "getNumberOfNeighborBombs(rowIndex, columnIndex) {\n const neighborOffsets = [\n [-1, -1], [-1, 0], [-1, 0],\n [0, -1], [0, 1],\n [1, -1], [1, 0], [1, 1]\n ];\n \n const numberOfRows = this._bombBoard.length; \n /* because the board generated by \n generateBombBoard is a 2D array - the first layer of array values = # of rows */\n const numberOfColumns = this._bombBoard[0].length; // how many values in first row\n let numberOfBombs = 0;\n \n /* this runs on EVERY element in the array, aka [1, -1] is ONE element.\n The first parameter in foreach(), aka offset here, represents the \n current element in the array that foreach() is iterating through. \n rowIndex and columnIndex is the row/column of the tile the player's flipping. */\n neighborOffsets.forEach(offset => {\n \n /* offset[0] means the row offset, offset[1] means the column offset,\n because each element in the neighborOffsets array has 2 elements (aka [-1, -1]). */\n const neighborRowIndex = rowIndex + offset[0];\n const neighborColumnIndex = columnIndex + offset[1]; \n \n // check if the neighbor cell selected is off the board or not\n if(neighborRowIndex >= 0 && neighborRowIndex < numberOfRows &&\n neighborColumnIndex >= 0 && neighborColumnIndex < numberOfColumns)\n {\n if(this._bombBoard[neighborRowIndex][neighborColumnIndex] === 'B')\n {\n numberOfBombs++;\n }\n }\n }); // this ends the parameters for the forEach() method\n return numberOfBombs;\n }", "constructor(s, colour) {\r\n this.boids = [];\r\n this.colour = colour;\r\n this.colShift = random(0.001, 0.005);\r\n \r\n this.grid = new Grid(width/neighbourRadius, height/neighbourRadius);\r\n \r\n for (let i = 0; i < s; i++) {\r\n let boid = new Boid(this.grid.rows, this.grid.cols);\r\n \r\n this.boids[i] = boid;\r\n this.grid.cells[this.boids[i].cell[0]][this.boids[i].cell[1]].push(i);\r\n }\r\n }" ]
[ "0.6396883", "0.6237637", "0.61271197", "0.61118287", "0.61042994", "0.6089339", "0.5955847", "0.5876888", "0.58056986", "0.5786145", "0.576682", "0.574836", "0.5731219", "0.56807494", "0.56795233", "0.5675958", "0.5656267", "0.5644881", "0.561572", "0.5606117", "0.5583883", "0.5557589", "0.5553039", "0.55506444", "0.55393606", "0.55204916", "0.55160993", "0.54909945", "0.5474703", "0.54539776", "0.5444904", "0.54072833", "0.5390469", "0.5388874", "0.538457", "0.5377836", "0.5377288", "0.536127", "0.53560805", "0.5346424", "0.5308399", "0.5300939", "0.52995425", "0.5289243", "0.52837855", "0.5254411", "0.5236124", "0.52359265", "0.52145386", "0.5214508", "0.52142596", "0.5211769", "0.5206412", "0.520428", "0.5187905", "0.5180131", "0.5176354", "0.5175854", "0.51692367", "0.51440084", "0.5134897", "0.51283705", "0.51181275", "0.51103276", "0.50999284", "0.50944674", "0.50890046", "0.5083018", "0.5081562", "0.5076264", "0.50760233", "0.50758964", "0.5073532", "0.5068866", "0.5059608", "0.50422734", "0.5040215", "0.50341177", "0.5033421", "0.5031682", "0.50246245", "0.50178087", "0.5015105", "0.5014419", "0.50124073", "0.5002142", "0.49926615", "0.4991421", "0.4989003", "0.49871063", "0.4986057", "0.49711245", "0.49633867", "0.49628025", "0.49504635", "0.49477288", "0.49435747", "0.4943309", "0.49406037", "0.4935244", "0.49347356" ]
0.0
-1
changing quantity of bombs at the field
function mudar_quant_bombs() { if (!isStarted) { //checking if field supports that quantity of bombs if (input_quant_bombs.value < (field_size ** 2)) { if (input_quant_bombs.value != '') { quantidade_bombs = input_quant_bombs.value; restart(); } else alert('Escolha um valor.') } else alert('Quantidade de bombas maior que o campo.'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function incrementNumBags() {\n\n\tvar current = document.getElementById(\"bagInputField\");\n\tvar value = parseInt(current.value);\n\tvalue += 1;\n\n\ttry {\n\t\tvar geese = parseInt(document.getElementById(\"geeseInputField\").value);\n\t\tvar result = calculateTransportCost(value, geese);\n\t\tupdateElement(result);\n\t\tcurrent.value = value;\n\t} catch (err) {\n\n\t}\n\n\t// if (value + 1 <= MAXIMUM_BAGS_OF_CORN) {\n\t// \tcurrent.value = value + 1;\n\t// \tupdateCost(value + 1);\n\t// }\n\n}", "updateBombCount(amount) {\n this.amountBombs += amount;\n\n if (this.id === this.game.id) {\n // set counter of your bombs in the browser\n document.getElementById(\"amountBombs\").innerText = this.amountBombs;\n }\n }", "function updateBombCounter(change) {\n let bombPanel = document.getElementById(\"bomb-qty\");\n bombPanel.textContent = bombCounter + change;\n}", "function bombJuggler(numBombs) {\n\n}", "editHearth(item, newQuantity) {\n for (let i = 0; i < this.inventory.length; i++) {\n if (this.inventory[i].item === item) {\n this.inventory[i].quantity = newQuantity;\n }\n console.log(\"This is the new quantity\", this.inventory[i].quantity);\n }\n }", "function updateBrie(item) {\n item.sell_in = item.sell_in - 1;\n item.quality = item.quality + 2;\n item.quality = Math.min(50, item.quality);\n return item;\n}", "function updateQuantityField(el) {\r\n // Set minimum value to 1\r\n if (isNaN(el.value) || el.value <= 0) {\r\n el.value = 1;\r\n }\r\n // Set maximum value to 99\r\n else if (el.value >= 100) {\r\n el.value = 99;\r\n }\r\n // Update cart values\r\n updateCartSubtotal();\r\n updateCartTotal();\r\n updateQuantityToStorage(el);\r\n}", "static set BoneCount(value) {}", "function incrementNumGeese() {\n\n\tvar current = document.getElementById(\"geeseInputField\");\n\tvar value = parseInt(current.value);\n\tvalue += 1;\n\n\ttry {\n\t\tvar numBags = parseInt(document.getElementById(\"bagInputField\").value);\n\t\tvar result = calculateTransportCost(numBags, value);\n\t\tupdateElement(result);\n\t\tcurrent.value = value;\n\t} catch (err) {\n\n\t}\n\n\t// if (value + 1 <= MAXIMUM_BAGS_OF_CORN) {\n\t// \tcurrent.value = value + 1;\n\t// \tupdateCost(value + 1);\n\t// }\n\n}", "function quantityChangedMB(event) {\n var input = event.target\n if (isNaN(input.value) || input.value <= 0) {\n input.value = 1\n }\n var quantity = input.value\n var product_id = input.getAttribute('data-productid')\n ajaxUpdateItemCart(product_id,quantity)\n updateCartTotalMB()\n}", "function decrementNumBags() {\n\n\tvar current = document.getElementById(\"bagInputField\");\n\tvar value = parseInt(current.value);\n\tvalue -= 1;\n\n\ttry {\n\t\tvar geese = parseInt(document.getElementById(\"geeseInputField\").value);\n\t\tvar result = calculateTransportCost(value, geese);\n\t\tupdateElement(result);\n\t\tcurrent.value = value;\n\n\t} catch (err) {\n\n\t}\n\n\t// if (value - 1 >= MINIMUM_BAGS_OF_CORN) {\n\t// \tcurrent.value = value - 1;\n\t// \tupdateCost(value - 1);\n\t// }\n\n}", "function addquatity(){\n updateQuantity(quantity + 1);\n }", "boredIncrease() {\n\t\tif(this.timeSpan % 10 === 0) {\n\t\t\tthis.currentPet.boredom += 1;\n\t\t}\n\t}", "addOne(item) {\n const newItems = this.state.inventoryItems;\n newItems[item].quantity = parseInt(newItems[item].quantity);\n newItems[item].quantity = (newItems[item].quantity + 1);\n this.setState({\n inventoryItems: newItems\n })\n }", "function adder2(id){\r\r\n ////obtenemos el numero actual\r\r\n var addItems = $(\"#eitem\"+id).val();\r\r\n if(addItems<50){\r\r\n addItems++;\r\r\n $(\".eitem\"+id).val(addItems);\r\r\n }\r\r\n}", "changeQuantity(itemName, index, quantity) {\n newItems = this.state.items;\n\n if(quantity >= 0) {\n newItems[index][Object.keys(newItems[index])[0]].quantity = quantity;\n }\n\n this.setState({items: newItems});\n }", "function addItemQty(item, quantity){\n\t\t\tif(!item.qty) item.qty = quantity;\n\t\t\telse item.qty += quantity;\n\t\t}", "static set RequiredBoneCount(value) {}", "updateIngredients(type) {\n const newServings = (type === 'dec' ? this.servings - 1 : this.servings + 1);\n this.ingredients.forEach(ing => {\n ing.count *= (newServings / this.servings);\n });\n this.servings = newServings;\n }", "function updateNumBombs() {\n if ((!dead) && (!win) && (openRemaining) && ((maxNumBombs-bombsFlagged) == 0)) {\n document.bomb1s.src = movesDigits0.src;\n document.bomb10s.src = movesDigits0.src;\n document.bomb100s.src = movesDigits0.src; }\n else {\n digit = Math.abs(maxNumBombs-bombsFlagged) % 10;\n document.bomb1s.src = timeDigits[digit].src;\n digit = Math.floor(Math.abs(maxNumBombs-bombsFlagged) / 10 % 10);\n document.bomb10s.src = timeDigits[digit].src;\n digit = Math.floor(Math.abs(maxNumBombs-bombsFlagged) / 100 % 10);\n document.bomb100s.src = timeDigits[digit].src;\n if (maxNumBombs < bombsFlagged)\n document.bomb100s.src = timeNeg.src; } }", "setAmount(state, data){ \r\n\t\t\tvar i = data.i\r\n\t\t\tvar count = data.count\r\n\t\t\tstate.basket[i].count = +count\t\r\n\r\n\t\t\tthis.dispatch(\"basket/saveBasket\")\r\n\t\t}", "setQuantity(quantity) {\n this.quantity = quantity;\n }", "function changeItemCount(value, item)\r\n{\r\n\tvar count = parseInt(document.getElementById(item + \"-qty\").value);\r\n\tif(value === \"+\")\r\n\t{\r\n\t\tcount = count + 1;\r\n\t\tdocument.getElementById(item + \"-qty\").value = count.toString();\r\n\t\tdocument.getElementById(item).style.background = \"pink\";\r\n\t}\r\n\telse if(value === \"-\")\r\n\t{\r\n\t\tif(count > 0)\r\n\t\t{\r\n\t\t\tcount = count-1;\r\n\t\t\tdocument.getElementById(item + \"-qty\").value = count.toString();\r\n\t\t\tif(count == 0)\r\n\t\t\t{\r\n\t\t\t\tdocument.getElementById(item).style.background = \"white\";\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "function updateQuantity(count, iid) {\n connection.query(\"UPDATE products SET stock_quantity = stock_quantity - ? WHERE item_id = ?\", [count, iid], function (err, res, field) {\n promptUserEntry();\n\n });\n }", "function increase() {\n if (quantity >= 99) {\n return;\n }\n quantity += 1;\n\n if (quantity < 10) {\n counter.setAttribute('value', `0${quantity}`);\n } else {\n counter.setAttribute('value', quantity);\n }\n quantityPrice();\n}", "function updateQuantity(item, type) {\n let indx = cart.findIndex((x) => x.name == item.name);\n let qty = qtyBtn.textContent;\n\n if (type == \"dec\") {\n if (qty > 0) {\n qty--;\n qtyBtn.textContent = qty;\n if (indx != -1) {\n cart[indx].quantity = qty;\n } else {\n let billObj = {\n name: item.name,\n price: item.price,\n quantity: qty,\n category: item.category\n };\n cart.push(billObj);\n }\n }\n if (qty == 0) {\n cart = cart.filter((item) => item.quantity != 0);\n }\n }\n\n if (type == \"inc\") {\n if (qty < 10) {\n qty++;\n qtyBtn.textContent = qty;\n if (indx != -1) {\n cart[indx].quantity = qty;\n } else {\n let billObj = {\n name: item.name,\n price: item.price,\n quantity: qty,\n category: item.category\n };\n cart.push(billObj);\n }\n }\n }\n\n updateBill();\n showCartItems();\n }", "function proforma_qty(item){\n\tif(jQuery('div#tabella').attr('qty')=='1'){\n\t\tvar pers = parseInt(jQuery('#pers').val());\n\t\tvar jours = parseInt(jQuery('#jours').val());\n\t\t//set the quantity\n\t\tif(jQuery(item).attr('id')=='pers'){\n\t\t\tjQuery(\"input[class='qty']\").each(function(){\n\t\t\t\tif(jQuery(this).val()!=''){\n\t\t\t\t\tjQuery(this).val(pers*jours);\t\n\t\t\t\t}\t\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\tjQuery(item).parents('td').next().children().children('input').val(pers*jours);\n\t\t}\n\t}\n}", "function setCellsNumOfBombsAround() {\n for (var i = 0; i < gBoard.length; i++) {\n for (var j = 0; j < gBoard[0].length; j++) {\n var cell = gBoard[i][j];\n cell.numOfBombsAround = getNumOfBombsAround(cell.coord);\n }\n }\n}", "function updateItemQuantity(id) {\n\t$('#qty_'+id).val( function(i, oldval) {\n \treturn parseInt( oldval, 10) + 1;\n\t});\t\t\n}", "@onValuesChanged(\"quantity\", [\"insert\", \"modify\"])\n\t\t\tchangeQuantity(value) {\n\t\t\t\teventLog.push(\"Quantity changed: \" + value);\n\t\t\t}", "function adjustCount(amount){\n\t\t\titemCount = itemCount + amount;\n\t\t}", "updateServings(type) {\n const servings = type === \"dec\" ? this.servings - 1 : this.servings + 1;\n\n this.ingredients.forEach(ingredient => {\n ingredient.count *= servings / this.servings;\n });\n this.servings = servings;\n }", "increaseComicsNumber(){\n this.limit += 6;\n }", "function replaceQuantity(qty, name, list) {\n // console.log(\"list\", list)\n list.forEach(function(obj) {\n if (obj.item === name) obj.quantity = qty;\n });\n }", "function quantityUp() {\n document.getElementById('input_quantity').value++;\n}", "updateServings(type){\n //update servings based on dec or inc\n const newServings=type==='dec'? this.servings-1:this.servings+1;\n\n //update ingredients\n this.ingredients.forEach(ing=>{\n ing.count*= (newServings/this.servings)\n });\n this.servings= newServings;\n console.log(this.ingredients,this.servings);\n }", "onChangeQty(e, Itemname) {\n let rewardsEnum = this.state.rewardsEnum;\n rewardsEnum.forEach(item => {\n if (item.name === Itemname) {\n item.qty = e;\n }\n });\n\n this.setState({\n rewardsEnum: rewardsEnum\n });\n }", "function pret_a_la_banque(numero)\n{\n\tthis.money += numero * 5;\n}", "function updateQty(){\r\n\tqty += 1;\r\n\tdocument.getElementById(\"numItem\").innerText = qty;\r\n}", "function intakeBits(amt){\r\n var dbo = mongo.getDb();\r\n dbo.collection(\"features\").updateOne(\r\n { \"_id\" : ObjectID(\"5f9a7a9d4acd644478d42d0c\")},\r\n {$inc: {\r\n \"marathonTotalPoints\": amt //bits come in as cents\r\n }}\r\n );\r\n}", "cartPlusOne(product) {\r\n product.quantity = product.quantity + 1;\r\n }", "function quantityIncrement(){\nquantity=$(\"#quantity\").val();\nquantity=++quantity;\n$(\"#quantity\").val(quantity);\n}", "function addOneB(){\n billInput.value++;\n calculateTip()\n}", "increaseItem(state, payload){\n state.shoppingCart[payload].cantidad = state.shoppingCart[payload].cantidad + 1 \n }", "function bombCheck(value){\n if (bomb.value == value){\n bomb.count += 1;\n } else{\n bomb.value = value;\n bomb.count = 0;\n }\n if (bomb.count >= 3){\n pile.length = 0;\n bomb.count = 0;\n bomb.value = -1;\n console.log(\"pile:\",pile.length);\n }\n}", "function changeQuantityByTyping(evt, input, index) {\n if(isNaN(input.value)) {\n\t\tvar splitArray = input.value.split('');\n\t\tsplitArray.pop();\n\t\tinput.value = splitArray.join('');\n\t} else {\n\t\tif (input.value < 1) input.value = 1;\n\t\tif (input.value > 10) input.value = 10;\n\t\tappData.selectedItems[index].quantity = Number(input.value);\n\t\tappData.selectedItems[index].cost = Number((appData.selectedItems[index].quantity * appData.selectedItems[index].price).toFixed(2));\n\t\tupdateCartAmount();\n\t}\n}", "function updateCartItems(ItemName, quantity, OneOrHalf) {\n for (var i = 0; i < 8; i++) {\n if (QuantityFromIceCream[i].brand == ItemName) {\n if (OneOrHalf == 1) {\n QuantityFromIceCream[i].Onekg = quantity;\n } else {\n QuantityFromIceCream[i].Halfkg = quantity;\n }\n }\n }\n var JSONreadyUsers = JSON.stringify(QuantityFromIceCream);\n updateShoppingCart();\n}", "function quantityChanged(event){\n const input = event.target;\n input.value <= 0 ? (input.value = 1) : null;\n\n //actualizamos precio//\n updateShoppingCartTotal();\n}", "SetNumBombas(cantidad){\n this.bomba = new Array(cantidad);\n for(let i=0;i<cantidad;i++){\n this.bomba[i]=false;\n } \n }", "function _UpdateBCAdd(evt){\n var ct = _CountBC(evt.value), \n t = this.tree;\n t.set('bandingCount', t.bandingCount + ct.b);\n t.set('conditionCount', t.conditionCount + ct.c); \n}", "function setRandBombs(numOfBombs) {\n gEmptyCells = createCoordsArray();\n for (var i = 0; i < numOfBombs; i++) {\n var randCoord = drawRandCoord(gEmptyCells);\n //model\n var cell = gBoard[randCoord.i][randCoord.j];\n cell.isBomb = true;\n }\n}", "function adder(id){\r\r\r\r\r\r\n ////obtenemos el numero actual\r\r\r\r\r\r\n var addItems = $(\"#eitem\"+id).val();\r\r\r\r\r\r\n if(addItems<50){\r\r\r\r\r\r\n addItems++;\r\r\r\r\r\r\n $(\"#eitem\"+id).val(addItems);\r\r\r\r\r\r\n }\r\r\r\r\r\r\r\r\n}", "increment(itemData) {\n itemData.quantity += 1;\n this.props.setItemQuantity(itemData);\n }", "addBombs(numberBombs)\n {\n let bombLoop = 0;\n\n while(bombLoop < numberBombs)\n {\n let bombX = Math.floor(Math.random() * this.xSize);\n let bombY = Math.floor(Math.random() * this.ySize);\n if (!this.isBomb(bombX, bombY))\n {\n this.gameState[bombX][bombY].bomb = true;\n\n bombLoop++;\n }\n } \n }", "updateServings(type) {\n // Increase OR Decrease servings\n const newServings = type === 'dec' ? this.servings - 1 : this.servings + 1;\n\n // Change the ingredients count\n this.ingredients.forEach(ingredient => {\n ingredient.count *= newServings / this.servings;\n });\n\n // Append new servings to the instance\n this.servings = newServings;\n }", "updateBombs(deltaTime) {\n this.bombs.forEach(elm => elm.update(deltaTime))\n this.bombs = this.bombs.filter(elm => !elm.isDone)\n }", "incrementQuantity(itemName, sign) {\n newItems = this.state.items;\n // increment\n if(sign === true) {\n ++newItems[index][Object.keys(newItems[index])[0]].quantity;\n }\n // decrement (if quantity > 0)\n else if(sign === false && newItems[index][Object.keys(newItems[index])[0]].quantity > 0) {\n --newItems[index][Object.keys(newItems[index])[0]].quantity;\n }\n this.setState({items: newItems});\n }", "function replaceQuantity(qty, name, list) {\n list.forEach(function(obj) {\n if (obj.item === name) obj.quantity = qty;\n });\n}", "function or_change_quantity(supplier_id, product_id, qty)\n{\n\tsupplier_orders_list[supplier_id].products_list[product_id].quantity = qty;\n\tvar moq = order_list[product_id].pricing_list[supplier_id].moq;\n\tvar ioq = order_list[product_id].pricing_list[supplier_id].ioq;\n\tif ((qty<moq)||((qty-moq)%ioq!=0)) \n\t{\n\t\tsupplier_orders_list[supplier_id].products_list[product_id].moqioqflag = false;\n\t}\n\t//Recalculate MOv flag \n\tor_recalculate_mov_flag();\n\t//Change quantity in order list also \n\tchange_product_quantity(product_id);\n\t//Redraw the order review screeen\n\tredraw_order_review();\n}", "function changeNumberOfUnits(action,id){\n cart = cart.map((item)=>{\n let numberOfUnits = item.numberOfUnits;\n\n if(item.id === id){\n if(action === 'minus' && numberOfUnits > 1){\n numberOfUnits--\n }else if(action === 'plus'){\n numberOfUnits++\n }\n }\n return {\n ...item,\n numberOfUnits,\n }\n })\n updateCart();\n}", "function up() {\n if(quantite.value < 10){\n \n quantite.value= parseInt(quantite.value)+1;\n}else {\n alert(\"Vous pouvez commander jusqu'a 10 appareils maximum\")\n}\n}", "_changeQuantity(productId) {\n const value = this.shadowRoot.querySelector('#chart_item_' + productId).value;\n\n const cartItem = this._findCartItem(productId);\n\n const index = this.cartItems.indexOf(cartItem);\n this.cartItems[index].quantity = value;\n this.cartItems = [...this.cartItems]; // this.cartItems[index] = cartItem['quantity'] + 1;\n // this.set('cartItems.' + index + '.quantity', cartItem['quantity'] + 1);\n\n localStorage.setItem('shop-cart', JSON.stringify(this.cartItems));\n this.dispatchEvent(new CustomEvent('change-cart-count', {\n bubbles: true,\n composed: true,\n detail: {}\n }));\n }", "function addBillerMultInput(n) {\n if (!n) n = 1;\n for (let i = 0; i < n; i++) {\n inputValue.billersMultiple.push({\n typeOrSelect: 'type',\n selected: null,\n typed: '',\n amount: BillFormAmountData.generateAmountInputValueObj()\n });\n }\n }", "changeHp(event, index, hpPropertyName) {\n const value = event.target.value;\n event.target.value = '';\n const number = parseInt(value);\n if(!number) return;\n const bar = this.listOfBars[index];\n if(value.startsWith('-') || value.startsWith('+')) {\n bar[hpPropertyName] = bar[hpPropertyName] + number;\n } else {\n bar[hpPropertyName] = number;\n }\n this.update(); \n }", "function decrementNumGeese() {\n\n\tvar current = document.getElementById(\"geeseInputField\");\n\tvar value = parseInt(current.value);\n\tvalue -= 1;\n\n\ttry {\n\t\tvar numBags = parseInt(document.getElementById(\"bagInputField\").value);\n\t\tvar result = calculateTransportCost(numBags, value);\n\t\tupdateElement(result);\n\t\tcurrent.value = value;\n\n\t} catch (err) {\n\n\t}\n\n\t// if (value - 1 >= MINIMUM_BAGS_OF_CORN) {\n\t// \tcurrent.value = value - 1;\n\t// \tupdateCost(value - 1);\n\t// }\n\n}", "function changeCount(count) {\r\n Tinycon.setBubble(count);\r\n}", "INCREMENT(state, reference) {\n for (let key in state.cart) {\n if (key === reference) state.cart[key].qty += 1\n }\n }", "updateBasket(item, amount){\n let itemsBought = Object.assign({}, this.state.itemsBought);\n //if changed mind and down to 0, remove from bought items list\n if(amount < 1){\n delete itemsBought[item];\n }else{\n itemsBought[item] = this.state.items[item];\n }\n this.setState({itemsBought : itemsBought});\n }", "quantityChange(event) {\n let ind = this.accesList.findIndex(record => record.Id === event.target.dataset.id);\n this.accesList[ind].quantity = event.detail.value;\n this.accesList[ind].price = event.detail.value * this.accesList[ind].unitPrice;\n this.countTotalAmontOnchange();\n }", "init() {\n this.quantity = 3;\n }", "function reccuperate( qty ) {\n\n\t\tif (this.health + qty > 100) {\n\t\t\tthis.health = 100;\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.health += qty;\n\t\treturn false;\n\n\t}", "set weight(value) {}", "function increaseQuantity(){\n let currentCost = (document.getElementById(\"cat-harness-item-cost\").innerHTML).replace( /^\\D+/g, '');\n if (quantity == 1){\n totalCost = 58;\n }\n else{\n totalCost = totalCost+(parseInt(currentCost)/(quantity));\n }\n quantity = parseInt(document.getElementById(\"num-items\").innerHTML, 10) + 1;\n document.getElementById(\"num-items\").innerHTML = quantity;\n document.getElementById(\"cat-harness-item-cost\").innerHTML = \"$\" + totalCost;\n \n}", "function changeQty(data, qty) {\n data[`${prefix}_qty`] = qty;\n return data;\n}", "function quantityChanged(event){\n\tvar input = event.target;\n\tif (isNaN(input.value) || input.value <= 0) {\n\t\tinput.value = 1;\n\t}\n\tupdateCartTotal();\n}", "updateGroceryList() {\n\t\t// Clear the quantities for all the ingredients\n\t\tlet ingrNodes = graph.getNodesByID_partial(\"ingr\", \"\")\n\t\tfor (let ingr of ingrNodes) {\n\t\t\tingr.grocQuantity = 0;\n\t\t}\n\n\t\t// Now go through menu and tally up ingredients\n\t\tthis.groceryCloset.destructBoxes()\n\t\tfor (let box of this.menuCloset.boxes) {\n\t\t\tlet meal = box.node\n\t\t\tfor (let node of meal.edges) {\n\t\t\t\tif (node.type === \"ingr\") { // Only tally ingredients\n\t\t\t\t\tnode.grocQuantity++\n\t\t\t\t\tthis.groceryCloset.add(node) // add to list\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.groceryCloset.updateBoxes() // ensure quantities are updated\n\t}", "function updateBinNo(entity) {\n vm.itemList.forEach(function(row) {\n if (entity.TrxNo == row.TrxNo && entity.LineItemNo == row.LineItemNo) {\n row['BinNo'] = entity['BinNo'];\n return;\n }\n });\n }", "function totaalBedragToevoegen(bedrag){\n totaalBedrag = totaalBedrag + Number(bedrag);\n totaal.value = totaalBedrag;\n}", "function quantityChanged(event) {\n var input = event.target;\n if (isNaN(input.value) || input.value <= 0) {\n input.value = 1;\n }\n updateCartTotals();\n}", "function change_quantity_in_cart(itemid,mode){\n if(mode==1){\n cart_info[itemid].cart_item.quantity+=1;\n cart_info[itemid].cart_div.find(\".cart-item-quantity\")[0].value=cart_info[itemid].cart_item.quantity;\n }else if(mode==0){\n $(cart_info[itemid].cart_div).remove();\n delete cart_info[itemid]; \n }else if(mode==-1){\n if(cart_info[itemid].cart_item.quantity==1){\n return;\n }\n cart_info[itemid].cart_item.quantity-=1;\n cart_info[itemid].cart_div.find(\".cart-item-quantity\")[0].value=cart_info[itemid].cart_item.quantity;\n }\n \n}", "function qtyRepair(objArray) {\n \n for(i = 0; i < objArray.length; i++) {\n \n if (!objArray[i].hasOwnProperty('quantity')) {\n \n objArray[i].quantity = 0; \n }\n } \n}", "decQuantity(name, quantity){\n changeProductQuantity(name.toLowerCase(), Math.max(quantity - 1, 0));\n this.setState(this.state);\n this.props.update();\n }", "function buyCharm() {\n if(charm.quantity < charm.maxQuantity) {\n if(zenny >= charm.price) {\n zenny -= charm.price;\n charm.quantity++;\n }\n }\n}", "function quantityChanged(event) {\r\n var input = event.target;\r\n if (isNaN(input.value) || input.value <= 0) {\r\n input.value = 1;\r\n }\r\n updateCartTotal();\r\n }", "function itemUpdate(index, type) {\n var quantity = document.getElementById(`quantity-${index}`).value;\n var newQuantity;\n if (type === \"inc\") {\n newQuantity = parseInt(quantity) + 1;\n } else if (type === \"dec\") {\n newQuantity = parseInt(quantity) - (parseInt(quantity) > 0 ? 1 : 0);\n } else {\n newQuantity = 0;\n }\n currentPrice[index] = basePrice[index] * newQuantity;\n document.getElementById(`price-${index}`).innerText = currentPrice[index];\n document.getElementById(`quantity-${index}`).value = newQuantity;\n quantity = newQuantity;\n totalPriceUpdate();\n}", "increaseVotes( id ) {\n this.bands = this.bands.map( band => {\n\n if ( band.id === id ){\n band.votes += 1\n }\n return band\n })\n }", "changeSize( preCovid ) {\n\n if ( preCovid ) {\n // larger the frequency, bigger the size\n if ( this.size < this.preCovidSize ) {\n this.size++;\n }\n else if ( this.size > this.preCovidSize ) {\n this.size--;\n }\n }\n else {\n if ( this.size < this.postCovidSize ) {\n this.size++;\n }\n else if ( this.size > this.postCovidSize ) {\n this.size--;\n }\n }\n }", "function quantityChanged(event) {\n // var input = event.target;\n updateCartTotal();\n }", "set number (newNum) {\n this.__number = newNum + 2\n }", "updateNewItemQuantity(event) {\n this.setState({\n newItemQuantity : event.target.value\n });\n }", "function increaseValue(inputField, increaseType) {\n const quantity = parseInt(inputField.value);\n let newQuantity = parseInt(inputField.value);\n\n if (increaseType == true) {\n newQuantity = quantity + 1;\n }\n if (increaseType == false && quantity > 0) {\n newQuantity = quantity - 1;\n }\n inputField.value = newQuantity;\n}", "function quantityChangedplus(event) {\r\n var purchaseClicked = event.target\r\n purchaseClicked.previousElementSibling.value = Number(purchaseClicked.previousElementSibling.value) + 1\r\n updateCartTotal()\r\n}", "addNumber(n, count) {\n for (let i = 0; i < count; i++) {\n let r = Math.floor(this.rand() * this.bagList.length);\n this.bagList.splice(r, 0, n);\n }\n }", "updateServerings(updateType) {\n //Servings\n const newServings = (updateType === 'dec' ? this.servings - 1 : this.servings + 1);\n\n //Ingredients\n this.ingredients.forEach(ing => {\n ing.qty *= (newServings / this.servings); //this.servings is the old value\n });\n\n //Update servings property\n this.servings = newServings;\n }", "replenishStock(name, count) {\n // we look at the stock for this item and run a function for each that takes in an item as a parameter\n this.stock.forEach(item => {\n // if the item name is equal to a name of a toy in our store.\n if (item.name === name) {\n // increment the item count by the number inputed into the funciton\n item.count += count;\n // console.log the change\n console.log(`Replenished ${item.name} by ${item.count}`);\n }\n });\n }", "function addToInventory(determine) {\n App[App.myRole].inventory[determine-1].quantity++;\n }", "function quantityChanged(event) {\n var input = event.target;\n\n if (isNaN(input.value) || input.value <= 0) {\n input.value = 1;\n return;\n }\n\n var artikelid = input.parentElement.parentElement.id;\n doit (quantityChangedObj(artikelid, input.value));\n}", "hunt () {\n this.food += 2;\n }", "function setDesiredBT(newVal) {\n desiredBT = parseInt(newVal);\n}", "function handleProductChange(product,isIncrease){\n const unitPrice = (product === 'phone')? 1219 : 59 ;\n let currentCount = getProductCount(product);\n if(isIncrease == false && currentCount > 0 ){\n currentCount--;\n }\n else if(isIncrease == true){\n currentCount++;\n }\n document.getElementById(product + '-count').value = currentCount;\n const updatedPrice = unitPrice * currentCount;\n document.getElementById(product + '-total').innerText = updatedPrice.toLocaleString();\n updateCostSection();\n\n}" ]
[ "0.6484524", "0.6452571", "0.64519185", "0.6220082", "0.6142708", "0.6141687", "0.59738594", "0.5969904", "0.5946509", "0.59402275", "0.5928903", "0.5906383", "0.5873179", "0.58485943", "0.57861584", "0.5783713", "0.57603365", "0.57305396", "0.5722212", "0.5711935", "0.56824774", "0.56703746", "0.5670001", "0.56628734", "0.56601787", "0.5649203", "0.5647953", "0.5616439", "0.56161016", "0.5599261", "0.55958766", "0.5595581", "0.5587972", "0.5584202", "0.556793", "0.55571926", "0.55510247", "0.5539959", "0.55258477", "0.5525748", "0.55170333", "0.5510915", "0.5508643", "0.55071485", "0.5502674", "0.5497289", "0.5495163", "0.5483598", "0.54800624", "0.54712886", "0.5466118", "0.54589605", "0.54543936", "0.5450685", "0.5444223", "0.5421407", "0.5420005", "0.5401562", "0.54015446", "0.5398156", "0.53908277", "0.538568", "0.5383897", "0.5381798", "0.5380178", "0.5376454", "0.5371825", "0.53716904", "0.5369636", "0.53646207", "0.5363376", "0.5348356", "0.53343725", "0.531729", "0.53091216", "0.530668", "0.53043807", "0.5296664", "0.5296641", "0.5293991", "0.52826136", "0.5278284", "0.52752626", "0.52714217", "0.52697384", "0.5269636", "0.5266933", "0.5264476", "0.52634895", "0.5261641", "0.52587175", "0.5255031", "0.5254057", "0.5245501", "0.52452236", "0.5226439", "0.52261245", "0.5225523", "0.5224603", "0.52197737" ]
0.60431916
6
Toggle children on click.
function click(d) { if (d3.event.defaultPrevented) return // ignore drag if (d.children) { d._children = d.children d.children = null } else { d.children = d._children d._children = null } update() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toggleChildren() {\n\t\tthis.setState({\n\t\t\tlinksVisible: !this.state.linksVisible\n\t\t});\n\t}", "function toggle_sidebar_sublist()\n{\n $(\".navbar_right_sidebar .sidebar_main_item.expandable\").click(function(){\n var child_container=$(this).find(\".subele_container\");\n if (child_container.hasClass(\"hidden\"))\n child_container.removeClass(\"hidden\");\n else\n child_container.addClass(\"hidden\");\n });\n\n}", "_toggleAllTreeItems() {\n this._toggleTreeItem(this.container, !this._lastToggleIsShow);\n }", "function toggle(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n }", "function toggleChildren(d) {\n var children = (d.children) ? d.children : null;\n var _children = (d._children) ? d._children : null;\n d._children = children;\n d.children = _children;\n return d;\n }", "function toggle(d) \n\t\t{\n\t\t\tif (d.children) \n\t\t\t{\n\t\t\t\td._children = d.children;\n\t\t\t\td.children = null;\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\td.children = d._children;\n\t\t\t\td._children = null;\n\t\t\t}\n\t\t\tupdate(d);\n\t\t}", "function toggle(d) {\n\tif (d.children) {\n\t\td._children = d.children;\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children;\n\t\td._children = null;\n\t}\n}", "toggleSelected(value = null) {\n const toToggle = this;\n if (value == null) {\n if (toToggle.selected === true) {\n toToggle.selected = false;\n } else {\n toToggle.selected = true;\n }\n } else {\n toToggle.selected = value;\n }\n\n if (toToggle.children) {\n toToggle.children.forEach((child) => {\n child.toggleSelected(toToggle.selected);\n });\n }\n }", "function click(d) {\r\n\ttoggleChildren(d);\r\n\tupdate(d);\r\n}", "click(e) {\n $(ReactDOM.findDOMNode(e.currentTarget)).siblings('.collapsible-body').toggle();\n }", "function toggle(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else if (d._children) {\n d.children = d._children;\n d._children = null;\n }\n }", "function getChilds(){ \n var current = $(this);\n var cat_id = current.attr('data-key');\n if($(\"#product-cat-child-\"+cat_id).length > 0){\n replaceChildHtml(cat_id);\n\n $(\"#product-cat-child-\"+cat_id).slideToggle('slow');\n $(this).toggleClass('carat-up');\n $(this).closest('.parent-checkbox-wrapper').toggleClass('parent-dropdown-open');\n }\n }", "function treeClick(id) {\n var tlr = document.getElementById(id);\n tlr.querySelector(\".nested\").classList.toggle(\"activeToggle\");\n tlr.classList.toggle(\"caret-down\");\n}", "function toggleAll(node) {\n if (node[childrenIdentifier]) {\n node[childrenIdentifier].forEach(toggleAll);\n toggle(node);\n }\n }", "function click(d) {\n d = toggleChildren(d);\n update(d);\n }", "function toggleAll(d) {\n\t\t\tif (d && d.children) {\n\t\t\t\td.children.forEach(toggleAll);\n\t\t\t\ttoggle(d);\n\t\t\t}\n\t\t}", "function showMobileChildren(event){\n\n $(event).parent().find('>ul').slideToggle(200, function(){\n\n $(event).parent().toggleClass('mobile-active');\n\n $(event).parent().hasClass('mobile-active') ? \n $(event).parent().find('.mobile-active').trigger('click') : '';\n\n });\n $(event).find('.fa').toggle();\n return false; \n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d.children.forEach(expand); //Expand all at once\n d._children = null;\n }\n update(d);\n}", "function toggle(node) {\n if (node[childrenIdentifier]) {\n node._children = node[childrenIdentifier];\n node[childrenIdentifier] = null;\n } else {\n node[childrenIdentifier] = node._children;\n node._children = null;\n }\n }", "function _toggle() {\n\tconst parent = this.parentElement.parentElement;\n\tparent.classList.toggle('hidden')\n}", "function click(d) {\n\t\t\t\t\t\t//root.children.forEach(collapse);\n\t\t\t\t\t\tif (d.children) {\n\t\t\t\t\t\t\td._children = d.children;\n\t\t\t\t\t\t\td.children = null;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\td.children = d._children;\n\t\t\t\t\t\t\td._children = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tupdate(d);\n\t\t\t\t\t}", "toggle() {\n this.expanded = !this.expanded;\n }", "function toggleArtists(d) {\n\tif (d.children) {\n\t\td._children = d.children; //TEMPORARILY STORE CHILDREN IN ._CHILDREN TO HIDE\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children; //MOVE CHILDREN BACK INTO .CHILDREN TO SHOW\n\t\td._children = null;\n\t}\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n updateTree(d,viewOptions); \n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n //If the node has children, collapse unfolded sibling nodes\n if(d.parent)\n {\n d.parent.children.forEach(function(element){\n \n if(d !== element){\n collapse(element);\n \n }\n });\n }\n update(d);\n}", "function toggle(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n Erase(root);\n update(d);\n $(\"#search_bar\").select2(\"val\", \"\");\n}", "function clicked(d){\n if(d.children){\n d._children = d.children;\n d.children = null;\n }else{\n d.children = d._children;\n d._children = null;\n }\n updateTree(d);\n console.log(d);\n }", "function treeToggle(el, force) {\n el = this;\n \n while(el != null && (!el.tagName || el.tagName.toLowerCase() != \"li\")) el = el.parentNode;\n \n // Get UL within the LI\n var childSet = findChildWithTag(el, 'ul');\n var topSpan = findChildWithTag(el, 'span');\n\n if( force != null ){\n \n if( force == \"open\"){\n treeOpen( topSpan, el )\n }\n else if( force == \"close\" ){\n treeClose( topSpan, el )\n }\n \n }\n \n else if( childSet != null) {\n // Is open, close it\n if(!el.className.match(/(^| )closed($| )/)) { \n treeClose( topSpan, el )\n // Is closed, open it\n } else { \n treeOpen( topSpan, el )\n }\n }\n}", "toggleDescendants(dataNode) {\n this.expansionModel.isSelected(dataNode)\n ? this.collapseDescendants(dataNode)\n : this.expandDescendants(dataNode);\n }", "function showChildren(number) {\n\t$(\"#p\" + number).toggle();\n\tif($(\"#p\" + number).is(':visible')) {\n\t\tthis.innerHtml = \"Collapse\";\n\t} else {\n\t\tthis.innerHtml = \"Expand\";\n\t}\n}", "function checkChildren() {\n\n\n $(\"#filter-accordion ul.dynatree-container li\").click(function () {\n $('.linkAll').removeClass('active-link');\n });\n}", "function toggleAllChildrenClass(item, from, to) {\n for (var i = 0; i < item.children.length; ++i) {\n var child = item.children[i];\n child.className = child.className.replace(from, to);\n if (child.children.length > 0) {\n toggleIcon(child); // Toggle all icon under it, too..\n }\n }\n}", "function click(d) {\r\n\t if (d.children) {\r\n\t d._children = d.children;\r\n\t self.foldGroup(d.name, d.children);\r\n\t d.children = null;\r\n\r\n\t } else {\r\n\t d.children = d._children;\r\n self.unfoldGroup(d.name, d.children);\r\n\t d._children = null;\r\n\t }\r\n\t update(d);\r\n\t getShowData('update');\r\n\t}", "function click(d) {\n\t\t if (d.children) {\n\t\t\td.hiddenChildren = d.children;\n\t\t\td.children = null;\n\t\t } else {\n\t\t\td.children = d.hiddenChildren;\n\t\t\td.hiddenChildren = null;\n\t\t }\n\t\t update(d);\n\t\t}", "function toggleTOCSections () {\r\n $(\".toc-parent\").each (function () {\r\n var parent = $(this);\r\n $(this).find('button').click (function (){\r\n if (parent.next().is (\":hidden\")){\r\n // show subtree\r\n parent.next().show('slow');\r\n $(this).text(\"-\");\r\n } else {\r\n // hide subtree \r\n parent.next().hide('slow');\r\n $(this).text(\"+\");\r\n }\r\n });\r\n });\r\n}", "toggleNodes() {\n\t\tif (this.toggleVisibility) {\n\t\t\tthis.hideNodes();\n\t\t\tthis.toggleVisibility = false;\n\t\t} else {\n\t\t\tthis.showNodes();\n\t\t\tthis.toggleVisibility = true;\n\t\t}\n\t}", "function toggle(d) {\n // Toggle collapsed status of node.\n if (d.children) collapse(d);\n else expand(d);\n drawScenegraph(d);\n} // end toggle", "onClick_() {\n this.fire('toggle-expanded');\n }", "function toggleChildren(containerID, numTasks) { \n \n let childElements = document.getElementById(containerID.id).childNodes;\n childElements = Array.from(childElements);\n childElements = childElements.filter((node) => {\n return (node.nodeType == Node.ELEMENT_NODE);\n });\n\n console.log(\"length of childNodes: \" + childElements.length);\n\n if (numTasks == 0) { 1// test if empty\n console.log(\"%cNo elements found to drop down\",\"color: orange;\");\n }\n else if (childElements[1].style.display == \"grid\") { // if displaying\n console.log(\"Hiding elements\");\n for (var i = 1; i < childElements.length; i++) { // hide child elements \n console.log(\" hiding element with id: \" + childElements[i].id);\n childElements[i].style.display = \"none\";\n \n }\n } \n else { // if hidden \n console.log(\"Revealing elements\");\n for (var i = 1; i < childElements.length; i++) { // reveal child elements\n console.log(\" revealing element with id: \" + childElements[i].id);\n childElements[i].style.display = \"grid\";\n }\n } \n}", "function childClick ($event) {\n $event.stopPropagation();\n }", "function click(d) {\n if (d.children) {\n\td._children = d.children;\n\td.children = null;\n } else {\n\td.children = d._children;\n\td._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n\td._children = d.children;\n\td.children = null;\n } else {\n\td.children = d._children;\n\td._children = null;\n }\n update(d);\n}", "function toggleSubfields(e) {\n e.stopPropagation();\n $ul = getUl(this, 1);\n $ul.toggleClass('visible');\n}", "function click(d) {\n if (d.children) {\n \td._children = d.children;\n \td.children = null;\n } else {\n \td.children = d._children;\n \td._children = null;\n }\n update(d);\n }", "function toggle(id, recursive)\n {\n var node;\n if (node = indexbyid[id]) {\n collapse(id, recursive, !node.collapsed);\n }\n }", "expand () {\n this.root.toggle(true, true);\n }", "function toggle() {\n setOpened(!opened);\n expandedCallback(!opened);\n }", "function onTargetChildrenClick() {\n console.log(\"Clicked onTargetChildrenClick\");\n // update the UI\n w3.toggleClass('#targetChildren', 'w3-red');\n w3.removeClass('#targetLGTBIQ', 'w3-red');\n w3.removeClass('#targetWomen', 'w3-red');\n w3.removeClass('#targetOrigin', 'w3-red');\n // toggle this filter and disable the others\n targetChildren = !targetChildren;\n targetLGTBIQ = false;\n targetWomen = false;\n targetOrigin = false;\n // trigger the find operation\n findLocationsInDatabase(\"FILTER\", -1);\n}", "function click(d) {\n\t\n\t\n\t\n\tif (d.children) {\n\t\td._children = d.children;\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children;\n\t\td._children = null;\n\t}\n\tupdate(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n build_tree(d);\n }", "collapse () {\n this.root.toggle(true, false);\n }", "toggle (recursive, state, depth) {\n depth= depth === undefined ? 999 : depth;\n this.open= (state === undefined ? !this.open : state);\n this.update();\n this.onExpand(this.open);\n this.control.onExpand(this, this.open);\n if (recursive && depth > 0 ) this.nodes.forEach( function(node) {\n node.toggle(true, this.open, depth-1);\n }, this);\n }", "function toggleAll(e) {\n allClosed = !allClosed;\n let carrots = document.getElementsByClassName('carrot');\n for(let i = 0; i < carrots.length; i++) {\n let target = carrots[i].parentElement.getElementsByTagName('div')[0];\n if(allClosed) {\n if(target.classList.contains('d-none')){\n carrots[i].dispatchEvent(new Event('click'));\n }\n e.innerHTML = \"Hide All\";\n } else {\n if(!target.classList.contains('d-none')){\n carrots[i].dispatchEvent(new Event('click'));\n }\n e.innerHTML = \"Expand All\";\n }\n }\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n //update();\n }", "function showUp(parent) {\n parent.children[1].children[0].classList.toggle('active')\n}", "function click(d) {\n console.log(d);\n if (d.children) {\n\td._children = d.children;\n\td.children = null;\n } else {\n\td.children = d._children;\n\td._children = null;\n }\n update(d);\n}", "function click(d) {\n\t\t\t if (d.children) {\n\t\t\t d._children = d.children;\n\t\t\t d.children = null;\n\t\t\t } else {\n\t\t\t d.children = d._children;\n\t\t\t d._children = null;\n\t\t\t }\n\t\t\t update();\n\t\t\t}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n \n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n var updateFlag;\n if (d.children) {\n updateFlag = d.children.length > 0;\n d._children = d.children;\n d.children = null;\n } else {\n updateFlag = d._children.length > 0;\n d.children = d._children;\n d._children = null;\n }\n\n //Avoid updating if node has no children\n if(updateFlag){\n update(d);\n }\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update();\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "toggle() {\n this._setState({\n expanded: !this.state.expanded,\n });\n }", "function subMenusMobile() {\r\n $(\".sub-active\").each(function() {\r\n $(this).click(function(event) {\r\n event.preventDefault();\r\n // Abrindo o submenu mobile\r\n $(this).children(\".sub-menu-mobile\").slideToggle(\"slow\");\r\n // Abrindo o submenu desktop\r\n $(this).children(\".sub-menu-desk\").slideToggle(\"slow\");\r\n\r\n })\r\n });\r\n}", "function click(d)\n {\n toggleChildren(d);\n printNodeInfo(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n updateTree(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function toggle_button_click(e) {\n var $button = $(e.currentTarget);\n var $menu = $button.parent().parent().children('ul');\n var was_closed = $button.hasClass('menu-closed');\n\n if (was_closed) {\n expand($menu, $button);\n }\n else {\n collapse($menu, $button);\n }\n }", "function dd_click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n dd_update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n _this.update(d);\n }", "function StructureToggle(ele) {\n ele.nextElementSibling.classList.toggle(\"show\")\n ele.children[0].classList.toggle(\"fa-rotate-180\");\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function subNav_slideToggle() {\n $(this).toggleClass('nav__item--show-sub');\n }", "function collapse(d, x) {\n if (x && d === x) {\n return;\n }\n d.clicked = null;\n if(d.children) {\n d._children = d.children\n d.children = null\n d._children.forEach(collapse);\n }\n }", "function click(d) {\n /*if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);*/ \n }", "function click(d) {\n if (d.classe_id || d.root) {\n if (d.children) {\n //console.log(\"->1\")\n d._children = d.children;\n d.children = null;\n } else {\n if (d._children != null) {\n d.children = d._children;\n d._children = null;\n //console.log(\"anes\")\n //console.log(d.node_id)\n d.children.forEach(function (children) {\n expand(children);\n });\n }\n }\n update(d);\n } else {\n //código para mostrar os gráficos\n tooltip_tablle(d);\n }\n}", "function click(d) {\r\n if (d.children) {\r\n d._children = d.children;\r\n d.children = null;\r\n } else {\r\n d.children = d._children;\r\n d._children = null;\r\n }\r\n update(d);\r\n}", "function click(d) {\n\tif (d.children) {\n\t\td._children = d.children;\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children;\n\t\td._children = null;\n\t}\n\tupdate();\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "toggleExpand() {\n if (currentExpanded !== undefined) {\n currentExpanded.justToggleExpand();\n currentExpanded = undefined;\n }\n if (!this.state.expand && currentExpanded === undefined)\n currentExpanded = this;\n\n this.justToggleExpand();\n }", "toggleExpand() {\n if (currentExpanded !== undefined) {\n currentExpanded.justToggleExpand();\n currentExpanded = undefined;\n }\n if (!this.state.expand && currentExpanded === undefined)\n currentExpanded = this;\n\n this.justToggleExpand();\n }", "handler( children ) {\n const { classes } = this.props\n const { state } = this\nreturn children.map( ( subOption ) => {\n if ( !subOption.children ) {\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n key={ subOption.name }>\n <Link \n to={ subOption.url }\n className={ classes.links }>\n <ListItemText \n inset \n primary={ subOption.name } \n />\n </Link>\n </ListItem>\n </div>\n )\n }\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n onClick={ () => this.handleClick( subOption.name ) }>\n <ListItemText \n inset \n primary={ subOption.name } />\n { state[ subOption.name ] ? \n <ExpandLess /> :\n <ExpandMore />\n }\n </ListItem>\n <Collapse \n in={ state[ subOption.name ] } \n timeout=\"auto\" \n unmountOnExit\n >\n { this.handler( subOption.children ) }\n </Collapse>\n </div>\n )\n } )\n }", "handler( children ) {\n const { classes } = this.props\n const { state } = this\nreturn children.map( ( subOption ) => {\n if ( !subOption.children ) {\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n key={ subOption.name }>\n <Link \n to={ subOption.url }\n className={ classes.links }>\n <ListItemText \n inset \n primary={ subOption.name } \n />\n </Link>\n </ListItem>\n </div>\n )\n }\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n onClick={ () => this.handleClick( subOption.name ) }>\n <ListItemText \n inset \n primary={ subOption.name } />\n { state[ subOption.name ] ? \n <ExpandLess /> :\n <ExpandMore />\n }\n </ListItem>\n <Collapse \n in={ state[ subOption.name ] } \n timeout=\"auto\" \n unmountOnExit\n >\n { this.handler( subOption.children ) }\n </Collapse>\n </div>\n )\n } )\n }", "function click(d) {\n// use the following to superficially change the text of the node.\n// this.getElementsByTagName('text')[0].textContent = \"clicked all over\"\n\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n\n update(d);\n}", "toggle() {\n this.collapsed = !this.collapsed\n }", "toggle() {\n this.collapsed = !this.collapsed\n }" ]
[ "0.7109894", "0.6869202", "0.665626", "0.6655057", "0.6650161", "0.6647868", "0.66203606", "0.66193414", "0.66120464", "0.65928566", "0.6550344", "0.64945227", "0.6459832", "0.641936", "0.64049387", "0.6374655", "0.6367121", "0.630328", "0.63023406", "0.62904346", "0.62541735", "0.6247139", "0.62183267", "0.6213882", "0.6192106", "0.616484", "0.61530274", "0.6131095", "0.61212015", "0.6108744", "0.6103536", "0.60996", "0.6090052", "0.6076593", "0.607527", "0.60628116", "0.6049298", "0.60435194", "0.6027867", "0.6026974", "0.60165143", "0.60165143", "0.60130346", "0.6011138", "0.5978006", "0.5977234", "0.5967642", "0.59645617", "0.596439", "0.5962566", "0.5952472", "0.5936599", "0.59234536", "0.59155643", "0.59086305", "0.58978015", "0.58959126", "0.58920187", "0.5891611", "0.588887", "0.5887095", "0.5872134", "0.5865016", "0.5865016", "0.5865016", "0.5865016", "0.58581084", "0.5848389", "0.584743", "0.5840479", "0.58385503", "0.5837094", "0.5837094", "0.5837094", "0.5837094", "0.5834104", "0.5824108", "0.5822644", "0.5822644", "0.58222896", "0.5820444", "0.5809543", "0.5808603", "0.5808603", "0.5808603", "0.5808603", "0.5805901", "0.5802797", "0.58007497", "0.57998866", "0.57940537", "0.57913834", "0.5790443", "0.5786103", "0.5786103", "0.5782996", "0.5782996", "0.5772706", "0.57694185", "0.576896", "0.576896" ]
0.0
-1
Returns a list of all nodes under the root.
function flatten(rootTree) { let nodes = [], i = 0, depth = 0, level_widths = [1], max_width, max_depth = 1, kx, ky; function recurse(node, parent, depth, x) { if (node.children) { let w = level_widths[depth + 1] || 0 level_widths[depth + 1] = w + node.children.length max_depth = Math.max(max_depth, depth + 1); node.size = node.children.reduce(function(p, v, i) { return p + recurse(v, node, depth + 1, w + i); }); } if (!node.id) { node.id = ++i } node.parent = parent node.depth = depth if (!node.px) { node.y = depth node.x = x } nodes.push(node) return node.size } rootTree.size = recurse(rootTree, null, 0); // now correct/balance the x positions: max_width = 1; for (i = level_widths.length; --i > 0;) { max_width = Math.max(max_width, level_widths[i]); } kx = (width - 20) / max_width; ky = (height - 20) / max_depth; for (i = nodes.length; --i >= 0;) { var node = nodes[i]; if (!node.px) { node.y *= ky; node.y += 10 + ky / 2; node.x *= kx; node.x += 10 + kx / 2; } } return nodes; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "list_nodes() {\n let result = this._list_nodes_in_subtree(this.root);\n return result;\n }", "getRootNodes() {\n return this.model.getRoots();\n }", "function getRootNodes(target) {\n var roots = [];\n $(target).children('li').each(function () {\n var node = $(this).children('div.tree-node');\n roots.push(getNode(target, node[0]));\n });\n return roots;\n }", "function visibleNodes() {\n var temp = [];\n for (var i = 0; i < root.length ; i++) {\n if(root[i]){\n temp.push(root[i]);\n }\n }\n return temp;\n}", "LeafNodes() {\r\n\r\n\t\tif(this.isEmpty()){\r\n\t\t\treturn [];\r\n\t\t}\r\n\r\n\t\telse{\r\n\t\t\tvar result = [];\r\n\r\n\t\t\tvar traverse = node => {\r\n\t\t\t\tif (node.left !== null)\r\n\t\t\t\t\ttraverse(node.left);\r\n\r\n\t\t\t\tif (node.right !== null)\r\n\t\t\t\t\ttraverse(node.right);\r\n\r\n\t\t\t\tif (node.left === null && node.right === null)\r\n\t\t\t\t\tresult.push(node.value);\r\n\t\t\t}\r\n\r\n\t\t\ttraverse(this.root);\r\n\t\t\treturn result;\r\n\t\t}\r\n\t}", "function getRootNodes(selfUL) {\r\n\t\tvar rootNodes = [];\r\n\t\t$f(\">DIV>li\", $(selfUL)).each(function() {\r\n\t\t\tvar $node = $c(\"div.TrN\", $(this));\r\n\t\t\trootNodes.push(getNode(selfUL, $node[0]));\r\n\t\t});\r\n\t\treturn rootNodes;\r\n\t}", "FindRoots() {\n let roots = new Array();\n for (let i = 0; i < this.NodeList.length; i++) {\n if (this.NodeList[i].parents.length == []) {\n roots.push(this.NodeList[i]);\n }\n }\n return roots;\n }", "*nodes(){\n if(!this.root) return;\n let stack = [this.root];\n while(stack.length){\n const node = stack.pop();\n if(node.left) stack.push(node.left);\n if(node.right) stack.push(node.right);\n yield node;\n }\n }", "function getRootServicesNodes() {\n\t\t\t\t\n\t\t\t\tvar\n\t\t\t\t\trootServices = ServicesUtils.getRootServices(),\n\t\t\t\t\trootServicesNodes = Utils.map(rootServices, function(service) {\n\t\t\t\t\t\treturn service.node;\n\t\t\t\t\t})\n\t\t\t\t;\n\t\t\t\t\t\n\t\t\t\treturn rootServicesNodes;\n\t\t\t\t\n\t\t\t}", "function flatten(root) {\n var nodes = [];\n\n function recurse(node) {\n if (node.children) {\n node.children.forEach(recurse);\n }\n nodes.push(node);\n }\n recurse(root);\n return nodes;\n}", "function flatten(root) {\n\t \tvar nodes = [];\n\t \tfunction recurse(node) {\n\t \tif (node.children) node.children.forEach(recurse);\n\t \tnodes.push(node);\n\t \t}\n\t \trecurse(root);\n\t \treturn nodes;\n\t}", "function getNodes() {\n var allNodes = nodes.get();\n var nodeList = [];\n for(var i = 0; i < allNodes.length; i++) {\n nodeList.push(allNodes[i].id);\n }\n return nodeList;\n}", "nodes() {\r\n if (this.isEmpty()) return [];\r\n return this.nodesHelper1(this.min().key, this.max().key);\r\n }", "function flatten(root) {\n var nodes = [],\n i = 0;\n\n function recurse(node) {\n if (node.children) node.children.forEach(recurse);\n if (node._children) node._children.forEach(recurse);\n if (!node.id) node.id = ++i;\n nodes.push(node);\n }\n\n recurse(root);\n return nodes;\n }", "function flatten(root) {\n var nodes = [], i = 0;\n\n function recurse(node) {\n if (node.children) node.children.forEach(recurse);\n if (!node.id) node.id = ++i;\n nodes.push(node);\n }\n\n recurse(root);\n return nodes;\n }", "function flatten (root) {\n var nodes = [], i = 0;\n\n function recurse (node) {\n if (node.children) node.children.forEach(recurse);\n if (!node.id) node.id = ++i;\n nodes.push(node);\n }\n\n recurse(root);\n return nodes;\n }", "allElems() {\n return this.rootNode;\n }", "allElems() {\n return this.rootNode;\n }", "function flatten(root) {\n\tvar nodes = [];\n\n\tfunction nodeSize(node) {\n\t\tif (node.children)\n\t\t\tnode.size = node.children.reduce(function(p, v) {\n\t\t\t\treturn p + nodeSize(v);\n\t\t\t}, 0);\n\t\tif (!node.id)\n\t\t\tnode.id = ++i;\n\t\tnodes.push(node);\n\t\treturn node.size;\n\t}\n\n\troot.size = nodeSize(root);\n\treturn nodes;\n}", "function flatten(root) {\n var nodes = [], i = 0;\n\n function recurse(node) {\n if (node.children) node.children.forEach(recurse);\n if (!node.id) node.id = ++i;\n nodes.push(node);\n }\n\n recurse(root);\n return nodes;\n }", "getNodes() {\n if (\"subtree\" in this.options) {\n return Array.from(this.target.querySelectorAll(this.options.selector));\n }\n\n return Array.from(this.target.childNodes);\n }", "function listNodes(all_nodes) {\n var container = [];\n for (var i in all_nodes) {\n container.push(i);\n }\n return container;\n }", "function flatten(root) {\n\n var nodes = [], i = 0;\n\n function recurse(node) {\n\n if (node.children) node.children.forEach(recurse);\n if (!node.id) node.id=++i;\n nodes.push(node);\n \n }\n\n recurse(root);\n return nodes;\n }", "function nodes(tree) {\n\t var nodes = [];\n\t // tree.walk((node, x0, y0, x1, y1) => {\n\t // node.x0 = x0, node.y0 = y0;\n\t // node.x1 = x1, node.y1 = y1;\n\t // nodes.push(node);\n\t // });\n\t var collect = tree._bucketSize === 0\n\t ? function (n) { if (!n.data) { nodes.push(n); } }\n\t : function (n) { nodes.push(n); };\n\t tree.postOrder(getTightBoxes);\n\t tree.preOrder(collect);\n\t return nodes;\n\t}", "getLeafNodes() {\n return this.model.getLeafs();\n }", "inOrder() {\n const results = [];\n const _traverse = (node) => {\n if (node.left) _traverse(node.left);\n results.push(node.value);\n if (node.right) _traverse(node.right);\n };\n\n _traverse(this.root);\n return results;\n }", "function flatten(root) {\n var nodes = [], i = 0;\n\n function recurse(node) {\n if (node.children) node.children.forEach(recurse);\n if (!node.id) node.id = ++i;\n nodes.push(node);\n }\n\n recurse(root);\n //nodes = JSON.parse(JSON.stringify(nodes))\n return nodes;\n}", "getNodes() {\n return this.model.getNodes();\n }", "getNodes() {\n return Object.values(this.lookup);\n }", "inOrder() {\n let results = [];\n\n let _walk = node => {\n if (node.left) _walk(node.left);\n results.push(node.value);\n if (node.right) _walk(node.right);\n };\n _walk(this.root);\n\n return results;\n }", "function getRoot(nodes){\n\tvar rootNodes=[];\n\tfor (var a=0;a<nodes.length;a++)\n\t{\n\t\tif (nodes[a].incoming.length==0)\n\t\t{\n\t\t\trootNodes.push(nodes[a]);\n\t\t}\n\n\t}\n\treturn rootNodes;\n}", "function listNodes(startNode) {\n var list = new Array();\n var node = startNode;\n while(node) {\n list.push(node);\n node = nextNode(node);\n }\n return list;\n}", "function createArrayFromRoot(root) {\n let nodesArray = [root];\n let currentNode = root;\n let counter = 0;\n\n while(currentNode.left || currentNode.right) {\n if(currentNode.left) {\n nodesArray.push(currentNode.left);\n }\n\n if(currentNode.right) {\n nodesArray.push(currentNode.right);\n }\n\n counter++;\n currentNode = nodesArray[counter];\n }\n\n return nodesArray;\n}", "function populateNodes(tree) {\n var out = [];\n visitInternal(tree, out);\n return out;\n }", "function flatten(root) {\n var nodes = [], i = 0;\n\n function recurse(node) {\n if (node.children) node.children.forEach(recurse);\n //In case,there is no 'id' on data\n if (!node.id) node.id = ++i;\n\n nodes.push(node);\n }\n\n recurse(root);\n return nodes;\n }", "function list() {\n return request({\n url: `/nodes`,\n method: 'GET'\n })\n}", "function getAllNodes() {\n return new Promise(function(resolve, reject) {\n db.all('SELECT * FROM Node', function(err, res) {\n if (err)\n return reject(err)\n resolve(res)\n })\n })\n}", "*descendants(root) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n for (var [node, path] of Node.nodes(root, options)) {\n if (path.length !== 0) {\n // NOTE: we have to coerce here because checking the path's length does\n // guarantee that `node` is not a `Editor`, but TypeScript doesn't know.\n yield [node, path];\n }\n }\n }", "*descendants(root) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n for (var [node, path] of Node.nodes(root, options)) {\n if (path.length !== 0) {\n // NOTE: we have to coerce here because checking the path's length does\n // guarantee that `node` is not a `Editor`, but TypeScript doesn't know.\n yield [node, path];\n }\n }\n }", "get nodes() {\n const lView = this._raw_lView;\n const tNode = lView[TVIEW].firstChild;\n return toDebugNodes(tNode, lView);\n }", "get nodes() {\n const lView = this._raw_lView;\n const tNode = lView[TVIEW].firstChild;\n return toDebugNodes(tNode, lView);\n }", "get nodes() {\n const lView = this._raw_lView;\n const tNode = lView[TVIEW].firstChild;\n return toDebugNodes(tNode, lView);\n }", "get nodes() {\n const lView = this._raw_lView;\n const tNode = lView[TVIEW].firstChild;\n return toDebugNodes(tNode, lView);\n }", "get nodes() {\n const lView = this._raw_lView;\n const tNode = lView[TVIEW].firstChild;\n return toDebugNodes(tNode, lView);\n }", "get nodes() {\n const lView = this._raw_lView;\n const tNode = lView[TVIEW].firstChild;\n return toDebugNodes(tNode, lView);\n }", "preOrder() {\n let results = [];\n\n let _walk = node => {\n results.push(node.value); //root\n if (node.left) _walk(node.left);\n if (node.right) _walk(node.right);\n };\n _walk(this.root);\n\n return results;\n }", "function flatten(root) \n{\n var nodes = [];\n var i = 0;\n var depth = 0;\n\n\n function recurse(node) \n {\n if(typeof node.depth === \"undefined\")\n {\n node.depth = depth;\n }\n\n if((typeof node.children !== \"undefined\") && (node.children.length > 0)) \n {\n depth++;\n node.children.forEach(recurse);\n depth--;\n }\n if(typeof node.id === \"undefined\") \n {\n node.id = ++i;\n }\n nodes.push(node);\n }\n\n recurse(root);\n return nodes;\n}", "preOrder() {\n const results = [];\n const _traverse = (node) => {\n results.push(node.value);\n if (node.left) _traverse(node.left);\n if (node.right) _traverse(node.right);\n }\n\n _traverse(this.root);\n return results;\n }", "getNodes() {\n return this.nodes;\n }", "inOrder() {\n const results = [];\n const _traversal = (node) => {\n if (node.left) _traversal(node.left);\n results.push(node.value);\n if (node.right) _traversal(node.right);\n };\n _traversal(this.root);\n return results;\n }", "function get_all_nodes(callback) {\n\tmongoClient.connect(url, function(err, db) {\n\t\tif (err) {\n\t\t\tcallback(err, 'Can\\'t connect to the server');\n\t\t} else {\n\t\t\tvar collection = db.collection('nodes');\n\t\t\tcollection.find().toArray(function(err, res) {\n\t\t\t\tif (err) {\n\t\t\t\t\tcallback(err, 'Can\\'t find nodes. errcode: ' + err.errcode);\n\t\t\t\t} else {\n\t\t\t\t\tcallback(null, res);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n}", "get childNodes()\n\t{\n\t\tvar result = [];\n\n\t\tif (this.distLists.length > 0) {\n\t\t\tfor each(var distList in this.distLists) {\n\t\t\t\tresult.push(distList);\n\t\t\t}\n\t\t}\n\t\treturn exchWebService.commonFunctions.CreateSimpleEnumerator(result);\n\t}", "inOrder() {\n const result = [];\n\n // The recursive function\n function _inOrder(node) {\n if (node) {\n _inOrder(node.left);\n result.push(node.value);\n _inOrder(node.right);\n }\n }\n\n if (this.root) _inOrder(this.root);\n\n return result;\n }", "function allKindsOfNodeDepths(root) {\n return getTreeInfo(root).sumOfAllDepths\n }", "preOrder(){\n let results = [];\n\n let _walk = node => {\n results.push(node.value); // root\n if(node.left) _walk(node.left); // left\n if(node.right) _walk(node.right); // right \n };\n\n _walk(this.root);\n\n return results;\n }", "get childNodes () {\n return childNodes(this._data).map(data => createNode(data));\n }", "function treeWalking(rootEl) {\n let ar = [];\n function rec(el) {\n if (el.localName !== 'script') {\n ar.push(el);\n if (el.children.length > 0) {\n for (let i = 0; i < el.children.length; i++) {\n rec(el.children[i]);\n }\n }\n }\n }\n rec(rootEl);\n return ar;\n}", "function iterativeFlatten(root) {\n var nodes = [], i = 0;\n var toRecurse = [root];\n\n function recurse() {\n var nextGen = []\n toRecurse.forEach(function(node){\n if (!node.id) node.id = ++i;\n nodes.push(node);\n\n if (node.children) nextGen = nextGen.concat(node.children);\n\n })\n\n toRecurse = nextGen\n }\n\n while (toRecurse.length>0) {\n recurse();\n }\n\n console.log(JSON.stringify(nodes))\n return nodes;\n}", "*nodes(root) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n pass,\n reverse = false\n } = options;\n var {\n from = [],\n to\n } = options;\n var visited = new Set();\n var p = [];\n var n = root;\n\n while (true) {\n if (to && (reverse ? Path.isBefore(p, to) : Path.isAfter(p, to))) {\n break;\n }\n\n if (!visited.has(n)) {\n yield [n, p];\n } // If we're allowed to go downward and we haven't descended yet, do.\n\n\n if (!visited.has(n) && !Text.isText(n) && n.children.length !== 0 && (pass == null || pass([n, p]) === false)) {\n visited.add(n);\n var nextIndex = reverse ? n.children.length - 1 : 0;\n\n if (Path.isAncestor(p, from)) {\n nextIndex = from[p.length];\n }\n\n p = p.concat(nextIndex);\n n = Node.get(root, p);\n continue;\n } // If we're at the root and we can't go down, we're done.\n\n\n if (p.length === 0) {\n break;\n } // If we're going forward...\n\n\n if (!reverse) {\n var newPath = Path.next(p);\n\n if (Node.has(root, newPath)) {\n p = newPath;\n n = Node.get(root, p);\n continue;\n }\n } // If we're going backward...\n\n\n if (reverse && p[p.length - 1] !== 0) {\n var _newPath = Path.previous(p);\n\n p = _newPath;\n n = Node.get(root, p);\n continue;\n } // Otherwise we're going upward...\n\n\n p = Path.parent(p);\n n = Node.get(root, p);\n visited.add(n);\n }\n }", "*nodes(root) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n pass,\n reverse = false\n } = options;\n var {\n from = [],\n to\n } = options;\n var visited = new Set();\n var p = [];\n var n = root;\n\n while (true) {\n if (to && (reverse ? Path.isBefore(p, to) : Path.isAfter(p, to))) {\n break;\n }\n\n if (!visited.has(n)) {\n yield [n, p];\n } // If we're allowed to go downward and we haven't decsended yet, do.\n\n\n if (!visited.has(n) && !Text.isText(n) && n.children.length !== 0 && (pass == null || pass([n, p]) === false)) {\n visited.add(n);\n var nextIndex = reverse ? n.children.length - 1 : 0;\n\n if (Path.isAncestor(p, from)) {\n nextIndex = from[p.length];\n }\n\n p = p.concat(nextIndex);\n n = Node.get(root, p);\n continue;\n } // If we're at the root and we can't go down, we're done.\n\n\n if (p.length === 0) {\n break;\n } // If we're going forward...\n\n\n if (!reverse) {\n var newPath = Path.next(p);\n\n if (Node.has(root, newPath)) {\n p = newPath;\n n = Node.get(root, p);\n continue;\n }\n } // If we're going backward...\n\n\n if (reverse && p[p.length - 1] !== 0) {\n var _newPath = Path.previous(p);\n\n p = _newPath;\n n = Node.get(root, p);\n continue;\n } // Otherwise we're going upward...\n\n\n p = Path.parent(p);\n n = Node.get(root, p);\n visited.add(n);\n }\n }", "_showAllNodes() {\n let currentNode = this.head;\n let nodeCounter = 0;\n\n if (currentNode === null) {\n console.log(`No nodes in current queue`);\n return null;\n }\n\n console.log(`\n There're currently ${this.length} nodes in queue\n `);\n\n let nodes = [];\n\n while (currentNode !== null) {\n // console.log(`\n // Node#${++nodeCounter} in queue: ${currentNode.value}`);\n nodes.push(currentNode);\n currentNode = currentNode.nextNode;\n }\n return nodes;\n }", "function visibleNodes(root) {\n return height(root);\n function height(node) {\n if (!node) {\n return 0;\n }\n\n return 1 + Math.max(height(node.left), height(node.right));\n }\n}", "function nodesAtLevels() {\n let x = createVector(WIDTH / 2, HEIGHT);\n let y = createVector(WIDTH / 2, HEIGHT - LENGTH);\n let root = new Branch(x, y, BRANCH_ANGLE, LENGTH_FACTOR);\n\n let byLevel = [];\n byLevel.push([root]);\n\n for (let i = 1; i < LEVELS; i++) {\n let prev = byLevel[i - 1];\n let curr = [];\n prev.forEach(b => {\n let t = b.branch();\n curr = curr.concat(t);\n })\n byLevel.push(curr);\n }\n return byLevel;\n}", "inorderNodes() {\r\n let queue = [];\r\n\r\n this.inorderNodesHelper(this.root, queue);\r\n\r\n return queue;\r\n }", "getNodes(parent) {\r\n if (!parent) {\r\n if (this.head) {\r\n return this.getNodes(this.head)\r\n }\r\n else {\r\n return []\r\n }\r\n }\r\n else {\r\n let nodes = [parent]\r\n for ( let c of this.getChildren(parent) ) {\r\n nodes = nodes.concat( this.getNodes(c) )\r\n }\r\n return nodes\r\n }\r\n }", "function flatten(root) {\n var nodes = [], i = 0;\n\n function recurse(node) {\n if (node.children) node.size = node.children.reduce(function(p, v) { return p + recurse(v); }, 0);\n if (!node.id) node.id = ++i;\n nodes.push(node);\n return node.size;\n }\n\n root.size = recurse(root);\n return nodes;\n }", "flatten(node = null) {\n let list = [];\n\n for (let child of (node || this.root).children || []) {\n list.push(child);\n list = list.concat(this.flatten(child));\n }\n return list;\n }", "preOrder() {\n const results = [];\n const _traversal = (node) => {\n results.push(node.value);\n if (node.left) _traversal(node.left);\n if (node.right) _traversal(node.right);\n };\n _traversal(this.root);\n return results;\n }", "function listOfDepths(root){\n let q = [root, 'next'];\n let lists = [];\n let ll = null;\n let current = null;\n while(q.length){\n let node = q.shift();\n if(node.left) q.push(node.left);\n if(node.right) q.push(node.right);\n if (node === 'next'){\n lists.push(ll);\n ll = null;\n current = null;\n if(q.length) q.push('next');\n continue;\n }\n if (!ll){\n ll = new Node(node);\n current = ll;\n }\n else {\n current.next = new Node(node);\n current = current.next;\n }\n }\n\n return lists;\n\n}", "function _printTreeLevelNodesWithNext(root) {\n let levelStart = root;\n while (levelStart) {\n const levelValues = [];\n let current = levelStart;\n levelStart = null;\n while (current) {\n levelValues.push(current.val);\n if (!levelStart) {\n levelStart = current.left || current.right;\n }\n current = current.next;\n }\n console.log(levelValues);\n }\n}", "function getAllNodes(grid) {\n const nodes = [];\n for (const row of grid) {\n for (const node of row) {\n nodes.push(node);\n }\n }\n return nodes;\n}", "function tree_to_list() {\n\tvar node_queue = [treeData[0]];\n\tvar node_list = [];\n\n\twhile (node_queue.length > 0) {\n\t\tnode = node_queue.pop();\n\t\tnode_list.push(node);\n\t\tif (node.children) {\n\t\t\tnode_queue.push(node.children[0]);\n\t\t\tnode_queue.push(node.children[1]);\n\t\t}\n\t}\n\treturn(node_list);\n}", "root() {\n return [];\n }", "getAllRootElements() {\n return Array.from(this._applications.keys());\n }", "getAllRootElements() {\n return Array.from(this._applications.keys());\n }", "getAllRootElements() {\n return Array.from(this._applications.keys());\n }", "getAllRootElements() {\n return Array.from(this._applications.keys());\n }", "getAllRootElements() {\n return Array.from(this._applications.keys());\n }", "getAllRootElements() {\n return Array.from(this._applications.keys());\n }", "DFSPre() {\n let result = [];\n let current = this.root;\n\n function helper(node) {\n result.push(node.value);\n if (node.left) {\n helper(node.left);\n }\n if (node.right) {\n helper(node.right);\n }\n }\n helper(current);\n return result;\n }", "function flatten(root) {\n var nodes = [], i = 0;\n\n function recurse(node) {\n if (node.children) node.size = node.children.reduce(function(p, v) { return p + recurse(v); }, 0);\n if (!node.id) node.id = ++i;\n nodes.push(node);\n return node.size;\n }\n root.size = recurse(root);\n return nodes;\n}", "function flatten(root) {\n\t\t\t var nodes = [], i = 0;\n\t\t\t\n\t\t\t function recurse(node) {\n\t\t\t if (node.children) node.size = node.children.reduce(function(p, v) { return p + recurse(v); }, 0);\n\t\t\t if (!node.id) node.id = ++i;\n\t\t\t nodes.push(node);\n\t\t\t return node.size;\n\t\t\t }\n\t\t\t\n\t\t\t root.size = recurse(root);\n\t\t\t return nodes;\n\t\t\t}", "function flatten(root) {\n\t\t\tvar nodes = [], i = 0;\n\t\t\t\n\t\t\tfunction recurse(node) {\n\t\t\t\tif (node.children) node.size = node.children.reduce(function(p, v) { return p + recurse(v); }, 0);\n\t\t\t if (!node.id) node.id = ++i;\n\t\t\t nodes.push(node);\n\t\t\t return node.size;\n\t\t\t}\n\t\t\t\n\t\t\troot.size = recurse(root);\n\t\t\treturn nodes;\n\t\t}", "function getDescendants(node) {\n if (isPortal(node)) {\n return getPortalContent(node);\n }\n return node.__k || [];\n}", "levelOrderTraversal() {\n\n if (!this.root || this.root === null) {\n return [];\n } \n\n let queue = new Queue();\n let visited = [];\n\n queue.enqueue(this.root);\n\n while (!queue.isEmpty()) {\n\n let topNode = queue.dequeue();\n\n visited.push(topNode.value);\n\n if (topNode.left !== null) {\n queue.enqueue(topNode.left);\n }\n\n if (topNode.right !== null) {\n queue.enqueue(topNode.right);\n }\n }\n\n return visited;\n }", "DFSIn() {\n let result = [];\n let current = this.root;\n\n function helper(node) {\n if (node.left) {\n helper(node.left);\n }\n result.push(node.value);\n if (node.right) {\n helper(node.right);\n }\n }\n helper(current);\n return result;\n }", "function getNodes() {\n return d3.selectAll('g .node');\n}", "children() {\n return new types_List(map(this.node.children, function (node) {\n return adopt(node);\n }));\n }", "function inorderTraversal(root) {\n const result = [];\n\n function traverse(node) {\n if (!node) return;\n traverse(node.left);\n result.push(node.val);\n traverse(node.right);\n }\n\n traverse(root);\n return result;\n}", "getNodes() {\n return this.target.assignedNodes(this.options);\n }", "nodes(quadtree) {\n var nodes = [];\n quadtree.visit(function(node, x0, y0, x1, y1) {\n node.x0 = x0, node.y0 = y0;\n node.x1 = x1, node.y1 = y1;\n nodes.push(node);\n });\n return nodes;\n }", "function flatten(root) {\n var nodes = [], i = 0;\n\n var parent = root;\n function recurse(node) {\n if (node.children) node.size = node.children.reduce(function(p, v) { \n parent = node; \n return p + recurse(v); \n }, 0);\n if (!node.id) node.id = ++i;\n if (!node.x) node.x = parent.x + Math.ceil(Math.random() * 50);\n if (!node.y) node.y = parent.y + Math.ceil(Math.random() * 50);\n if (node.status !== 'removed' /*&& node.status !== 'renamed'*/) nodes.push(node); // theres yet no way to get the previous name of a renamed or moved file as status is renamed with new filename\n return node.size;\n }\n\n root.size = recurse(root);\n return nodes;\n}", "inorder() {\n let values = [];\n if (this.root) this.root.inorder(values);\n return values;\n }", "function flattenTree(root) {\n const paths = [];\n const nodes = [root];\n for (let index = 0; index < nodes.length; index++) {\n const node = nodes[index];\n if (isLeaf(node)) {\n // We found a leaf so store the currentPath\n paths.push(node.path);\n }\n else {\n node.children.forEach(value => nodes.push(value));\n }\n }\n return paths;\n}", "function overAll(root) {\n if(!root) return [[]];\n let res = [];\n let temp = [];\n helper(root, temp, res);\n console.log(res);\n return res;\n}", "function flatten(root) {\r\n var flattenedNodes = [];\r\n function recurse(node) {\r\n // set size attribute to 1\r\n node.size = 1;\r\n if (node.children) node.size = node.children.reduce(function(p, v) {\r\n return p + recurse(v);\r\n }, 0);\r\n flattenedNodes.push(node);\r\n return node.size;\r\n }\r\n root.size = recurse(root);\r\n return flattenedNodes;\r\n }", "preOrder() {\n const result = [];\n\n // The recursive function\n function _preOrder(node) {\n if (node) {\n result.push(node.value);\n _preOrder(node.left);\n _preOrder(node.right);\n }\n }\n\n if (this.root) _preOrder(this.root);\n\n return result;\n }", "function calculateNodesList(page) {\n var config = page.config;\n var linkHeight = config.getLinkHeight();\n var treeData = page.root;\n var treeLayout = page.treeLayout;\n var nodesList;\n\n nodesList = treeLayout.nodes(treeData).reverse();\n nodesList.forEach(function(d){\n d.y = d.depth * linkHeight;\n d.y += 80;\n });\n\n return nodesList;\n}", "DFSPost() {\n let result = [];\n let current = this.root;\n\n function helper(node) {\n if (node.left) {\n helper(node.left);\n }\n if (node.right) {\n helper(node.right);\n }\n result.push(node.value)\n }\n helper(current);\n return result;\n }", "getNodes(){\n return Object.keys(this.nodes);\n }", "getRootNode() {\n return this.root;\n }" ]
[ "0.7944793", "0.70967126", "0.7038422", "0.69845325", "0.69387054", "0.68545365", "0.68474865", "0.66487837", "0.6616856", "0.65859073", "0.65618134", "0.65240645", "0.65237993", "0.65049374", "0.6487213", "0.648427", "0.6477388", "0.6477388", "0.6472023", "0.64695984", "0.64491343", "0.64392936", "0.64275557", "0.64141655", "0.6382788", "0.63105065", "0.63061917", "0.6274835", "0.6261887", "0.62599456", "0.62308794", "0.6208406", "0.6207552", "0.62070715", "0.6195654", "0.61714447", "0.616965", "0.61626863", "0.61626863", "0.61561155", "0.61561155", "0.61561155", "0.61561155", "0.61561155", "0.61561155", "0.6128373", "0.610791", "0.6107567", "0.610482", "0.6099351", "0.6070855", "0.60536844", "0.6040661", "0.6026692", "0.6021541", "0.59919363", "0.5990811", "0.5987185", "0.59854573", "0.5984791", "0.59809935", "0.5965716", "0.5965595", "0.59610647", "0.5957912", "0.5948997", "0.59415275", "0.5940495", "0.5922937", "0.5917067", "0.5910073", "0.58784384", "0.5863743", "0.5855335", "0.5855335", "0.5855335", "0.5855335", "0.5855335", "0.5855335", "0.5853824", "0.58431613", "0.58326685", "0.58307886", "0.58273786", "0.5822886", "0.5820937", "0.581734", "0.5803011", "0.5794883", "0.5785605", "0.5783692", "0.57708454", "0.5749208", "0.573227", "0.5730089", "0.5723102", "0.572281", "0.57204926", "0.57203424", "0.5711848", "0.5709457" ]
0.0
-1
When size is submitted by the user, call makeGrid()
function makeGrid() { // prevent submit button from reloading page event.preventDefault(); const grid = document.querySelector("table"); // clear any previously created table grid.innerHTML = ""; // get the users size input const size = getSize(); const width = size[0]; const height = size[1]; for (let y = 0; y < height; y++) { // table row is intitialized inside the for loop so as to create a different <tr> in each loop const tableRow = document.createElement("tr"); grid.appendChild(tableRow); for (let x = 0; x < width; x++) { const tableColumn = document.createElement("td"); tableRow.appendChild(tableColumn); } } grid.addEventListener("click", setCellColor); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gridSize() {\n size = prompt(\"What size do you want the grid?\");\n createGrid(size, size);\n\n}", "function resizeGrid() {\n do {\n size = prompt(\"Enter a number from 1-125\");\n if (size === null || isNaN(size)) {\n return;\n }\n } while (size > 125);\n container.innerHTML = \"\";\n createGrid(size);\n draw();\n}", "function changeSize() {\n row = prompt(\"Enter the amount of rows you want between 1 and 64.\");\n createGrid(row);\n}", "function setGridSize(){\n\t$('#squares-number-button').click(function(){\n\t\tvar gridSize = $('#squares-number-input').val();\n\t\tif(gridSize > 0){\n\t\t\t$('.squares').remove();\n\t\t\tcreateSquares(gridSize);\n\t\t\tcolorHover();\n\t\t\tgridSizeDisplay(gridSize);\n\t\t\t$('#squares-number-input').val('');\n\t\t}\n\t})\n}", "function changeGridSize() {\n $(\"#gridSize\").click(function() {\n userDimension = prompt(\"Enter the grid size (i.e. enter 10 for a 10x10 grid)\")\n while (isNaN(userDimension) === true) {\n userDimension = prompt(\"Please enter a number for the grid size.\");\n }\n createDivs(userDimension, userSize);\n });\n}", "function updateGrid(){\n //num = prompt(\"enter new grid dimensions\");\n clearGrid();\n newSizeGrid(num);\n}", "function customSize() {\n size.textContent = 'Grid Size';\n size.addEventListener('click', () => {\n let input = prompt('Please Enter a Grid Size');\n if (input === null || input < 1) {\n sizeSet();\n makeGrid(16, 16);\n makeGray();\n makeBlack();\n makeRGB();\n } else {\n sizeSet();\n makeGrid(input, input);\n makeGray();\n makeRGB();\n makeBlack();\n }\n })\n buttons.appendChild(size).classList.add('btn');\n}", "function changeSize() {\n const minSize = 2;\n const maxSize = 64;\n let newSize = 0;\n\n while (newSize < minSize || newSize > maxSize) {\n newSize = prompt(`Enter a new size (${minSize}–${maxSize}):`, 0);\n\n // Stop if user cancels\n if (!newSize) {\n return;\n }\n }\n\n clear();\n createGrid(newSize);\n}", "function refreshGrid(){\n clearGrid();\n makeGrid(document.getElementById(\"input_height\").value, document.getElementById(\"input_width\").value);\n}", "function formSubmission() {\n event.preventDefault();\n var height = document.getElementById('inputHeight').value;\n var width = document.getElementById('inputWidth').value;\n makeGrid(height, width);\n}", "function sizeToFit() {\n gridManager.sizeToFit();\n}", "function selectGridSizeFunc() {\n container.innerHTML = \"\";\n const input = prompt(\"Please select a grid resolution. (input 64 for a 64 x 64 sketchpad)\", 16);\n setUpSketch(input);\n}", "function gridSize(num){\n\n//if the original value given by the user is within the correct range\nif(num >= 2 && num <=64){\n//create square grid based on the argument assigned to the parameter num\nfor(x = 0; x < num; x++){\n for(let y = 0; y < num; y++){\n const boxDiv = document.createElement(\"div\")\n boxDiv.setAttribute(\"class\", \"boxDiv\")\n container.append(boxDiv)\n }\n } \n//add container id to body so that it can be manipulated using the DOM\n//style the container grid, ensuring the number of rows and columns is equal to the argument value\n body.append(container)\n document.querySelector(\".container\").style.gridTemplateColumns = `repeat(${num}, 1fr)`\n\n//else reprompt the user for a new number that is inbetween the correct range\n} else {\n\n //reprompt user for new argument value that fits within the range\n let updatedInput = prompt('Please choose a number between 2 and 64')\n\n //invoke the gridSize function again with the correct argument value\n gridSize(updatedInput)\n}\n\n\n\n}", "function getGridSize () {\n let newSize = prompt (\"How many squares per side?\", \"64\");\n if (newSize > 64 || newSize === \" \") {\n warning ();\n // if user doesn't enter new gize, auto generate 16x16 grid \n } else if (newSize === null) {\n clearGrid();\n createGrid(16);\n }\n else {\n clearGrid();\n createGrid(newSize); \n } \n}", "function makeGrid() {\n canvas.find('tablebody').remove();\n\n // \"submit\" the size form to update the grid size\n let gridRows = gridHeight.val();\n let gridCol = gridWeight.val();\n\n // set tablebody to the table\n canvas.append('<tablebody></tablebody>');\n\n let canvasBody = canvas.find('tablebody');\n\n // draw grid row\n for (let i = 0; i < gridRows; i++) {\n canvasBody.append('<tr></tr>');\n }\n\n // draw grid col\nfor (let i = 0; i < gridCol; i++) {\n canvas.find('tr').append('<td class=\"transparent\"></td>');\n }\n\n }", "function checkSize(size) {\n\tif (typeof size !== 'number' || size <= 0 || size > 60) {\n\t\tsize = Math.floor(Math.random() * 60);\n\t\tsizeInput.value = `${size}`;\n\t}\n\tcreateGrid(size);\n}", "function autoSize() {\n gridManager.autoSize();\n}", "function resize(request) { \n if (request === 'resize') {\n let number = prompt(\"Please enter desired grid size (must be under 100)\", 16);\n }\n if (number <= 100) { \n makeGrid(number);\n } else {\n prompt(\"Invalid response! Grid size must be under 100!\");\n }\n \n}", "function makeGrid() {\n // Avoid the creation of repeating elements (h3, h4 tags)\n setInitialStates();\n\n const tableHeight = $('#input_height').val();\n const tableWidth = $('#input_width').val();\n\n // clear the old canvas\n myTable.children().remove();\n\n //Set maximum limit for number inputs\n if(tableHeight>50||tableWidth>50){\n alert(\"Please Insert a Number Between 1 and 50 for GRID Height & Width\");\n // Function the removes the unnecessary info tags (at this point)\n setInitialStates();\n // Reset the input values\n $(\"form input[type=number]\").val(\"1\");\n return true;\n }else {\n // Create the table\n for (let n = 1; n<=tableHeight; n++){\n // Create rows\n myTable.append('<tr></tr>');\n for(let m = 1; m<=tableWidth; m++){\n $('tr').last().append('<td></td>');\n }\n }\n // Add the extra info\n addInfo();\n }\n}", "function changeSize() {\n let newSize = prompt(\"Enter new size\");\n\n if (newSize !== null) {\n newSize = parseInt(newSize);\n if (newSize < 1 || newSize > 100 || Number.isNaN(newSize)) {\n alert(\"Enter a number from 1-100\");\n changeSize();\n } else {\n clearGrid();\n setGridSize(newSize);\n fillGrid(newSize);\n }\n }\n}", "function submitForm() {\n\t$( \"#sizePicker\" ).on( \"submit\", function( evt ) {\n\t\tevt.preventDefault();\n\t\tmakeGrid();\n\t});\n}", "function makeGrid() {\n\n // get the table element\n const canvas = document.getElementById('pixelCanvas');\n // reset grid\n while(canvas.firstChild) {\n canvas.removeChild(canvas.firstChild);\n }\n\n\n var width = sizeForm.width.value;\n var height = sizeForm.height.value;\n console.debug(width);\n console.debug(height);\n \n // create grid with height and width inputs\n for(y = 0; y < height; y++) {\n row = canvas.appendChild(document.createElement('TR'));\n for(x = 0; x < width; x++) {\n cell = row.appendChild(document.createElement('TD'));\n }\n }\n\n canvas.addEventListener('click', changeColor);\n\n}", "_onChangeSize() {\n\t\t\t\tthis.collection.changeSize(this.model.get('width'), this.model.get('height'));\n\t\t\t\tthis._saveSize(this.model.get('width'), this.model.get('height'));\n\t\t\t\tthis.render();\n\t\t\t}", "function changeSize() {\n let newSize = prompt(\"Enter new size\");\n\n if (newSize !== null) {\n newSize = parseInt(newSize);\n if (newSize < 1 || newSize > 64 || Number.isNaN(newSize)) {\n alert(\"Enter a number from 1-64 range\");\n changeSize();\n } else {\n clearGrid();\n setGridSize(newSize);\n fillGrid(newSize);\n }\n }\n}", "function addChangeSizeEvent(button) {\n button.addEventListener('click', () => {\n let newGridSize = getUserInput();\n resetBackGroundButton(button);\n removeGridChilds();\n generateGridElement(newGridSize);\n addSingleButtonEvents();\n })\n}", "function listener(event) {\n event.preventDefault();\n let inputHeight = document.getElementById(\"inputHeight\").value;\n let inputWidth = document.getElementById(\"inputWidth\").value;\n\n makeGrid(inputHeight, inputWidth);\n}", "function drawGrid(sizeIn) {\n\tvar boxDivs = [];\n\tsize = sizeIn;\n\tboxSize = Math.floor(960/size);\n\n\t$('#grid').off();\n\t$('#grid').html('');\n\n\t$box = \"<div class='box' style='width:\" + boxSize + \"px; height:\" + boxSize+\"px;'></div>\";\n\t$('#grid').css('width', boxSize*sizeIn);\n\tfor (var i = 0; i < sizeIn * sizeIn; i++){\n\t\tboxDivs[i] = $box;\n\t}\n\t$('#grid').append(boxDivs.join(''));\n\n\tclearGrid();\n\tdraw();\n\tgridLines();\n}", "function drawResizedGrid(newGridSize) {\n gridContainer.innerHTML = '';\n drawGrid(newGridSize)\n}", "function populate() {\n\t\tvar temp = \"\";\n\t\tvar div = '<div class=\"squares\"></div>';\n\t\tvar input = parseInt(prompt(\"Choose a new grid size!\"), 10);\n\t\t$('.squares').remove();\n\t\tfor (var i = 1; i <= input * input; i++) {\n\t\t\ttemp += div;\n\t\t};\n\t\t$(\".wrapper\").append(temp);\n\t\tvar height = 640 / input;\n\t\t$('.squares').css('height', height);\n\t\t$('.squares').css('width', height);\n\t}", "function newSize() {\n\tvar newSize = prompt('Enter a number between 0 and 129.');\n\tif (newSize < 1 || newSize > 128) {\n\t\talert('That is definitely not between 0 and 129!');\n\t}\n\telse {\n\t\tdrawGrid(newSize);\n\t}\n}", "function createGrid(width, height) {\n\n}", "function setGridSize (newGrid) {\n\n\t\tnewGrid = newGrid || {};\n\n\t\tif (newGrid.rows) {\n\t\t\tgrid.rows = newGrid.rows;\t\n\t\t}\n\n\t\tif (newGrid.columns) {\n\t\t\tgrid.columns = newGrid.columns;\n\t\t}\n\t\t\n\n\t\tupdateGridText();\n\n\t\tupdateCanvas();\n\t}", "function setGridSize(size) {\n gridContainer.style.gridTemplateColumns = `repeat(${size}, 1fr)`;\n}", "function makeGrid() {\n // reset pixel canvas\n $(\"#pixelCanvas\").html(\"\");\n // Select size input\n height = $(\"#inputHeight\").val();\n width = $(\"#inputWeight\").val();\n //loop to add table cells and rows according to user input\n for (let x = 0; x < height; x++) {\n $('#pixelCanvas').append('<tr></tr>');\n }\n for (let y = 0; y < width; y++) {\n $('#pixelCanvas tr').each(function () {\n $(this).append('<td></td>');\n });\n }\n}", "function updateGridDimensions() \n{\n\tvar squareSize = $('.square').css('width');\n\tvar squareSizePx = parseInt(squareSize);\n\t$('.square').css('height', squareSize);\n\t$('.square').css('width', squareSize);\n\t$('.square').css('font-size', (squareSizePx * 0.5) + 'px');\n\t$('.square').css('border', (squareSizePx * 0.06) + 'px solid #baad9e');\n\t$('#grid').css('border', (squareSizePx * 0.06) + 'px solid #baad9e');\n}", "function createGrid(size) {\n var wrapper = $('#wrapper'),\n squareSide = 600 / size;\n $(wrapper).empty();\n for (var i = 0; i < size; i++) {\n for (var j = 0; j < size; j++) {\n $(wrapper).append('<div class=square id=xy_' + i + '_' + j + '></div>');\n\n }\n }\n\n //Single square size setting\n $('.square').css({\n \"height\": squareSide + \"px\",\n \"width\": squareSide + \"px\"\n\n });\n }", "function setGridSize(size) {\n gridContainer.style.gridTemplateColumns = `repeat(${size}, 1fr)`;\n}", "function createGrid(size) {\n container.style.gridTemplateColumns = `repeat(${size}, 1fr)`;\n container.style.gridTemplateRows = `repeat(${size}, 1fr)`;\n}", "fixSizes() {\n // subGrid width\n this.callEachSubGrid('fixWidths');\n }", "fixSizes() {\n // subGrid width\n this.callEachSubGrid('fixWidths');\n }", "function makeGrid() {\n\n\n}", "function createGrid(size){\n gridContainer.style.display='grid';\n gridContainer.style.gridTemplateColumns=`repeat(${size},1fr)`;\n gridContainer.style.gridTemplateRows=`repeat(${size},1fr)`;\n createElement(size);\n}", "function makeGrid() {\n canvas.find('tbody').remove();\n\n //submit button size changes to fit grid size\n var gridRows = heightInput.val();\n var gridCol = weightInput.val();\n\n //tbody set to the table\n canvas.append('<tbody></tbody>');\n\n var canvasBody = canvas.find('tbody');\n\n //drawing grid rows\n for (var i = 0; i < gridRows; i++) {\n canvasBody.append('<tr></tr>');\n }\n\n //draw grid col\n for (var i = 0; i < gridCol; i++) {\n canvas.find('tr').append('<td class=\"transparent\"></td>');\n }\n }", "_resize() {\n // Reset\n set_css_var('--grid-width', '100%');\n set_css_var('--grid-height', '100%');\n set_css_var('--grid-padding', '0');\n set_css_var('--font-size-normal', '0px');\n set_css_var('--font-size-flash', '0px');\n set_css_var('--font-size-focus', '0px');\n // Compute sizes\n let columns = this.options.grid.columns;\n let rows = Math.ceil(this.options.symbols.length / columns);\n let grid_width = this.options.grid.element.clientWidth;\n let grid_height = this.options.grid.element.clientHeight;\n let grid_padding = 0;\n if (this.options.grid.ratio) {\n let ratio = this.options.grid.ratio.split(':');\n if (ratio[0] * grid_height >= grid_width * ratio[1]) {\n let height = (ratio[1] * grid_width) / ratio[0];\n grid_padding = (grid_height - height) / 2 + \"px 0\";\n grid_height = height;\n\n } else {\n let width = (ratio[0] * grid_height) / ratio[1];\n grid_padding = \"0 \" + (grid_width - width) / 2 + \"px\";\n grid_width = width;\n }\n }\n let cell_width = grid_width / columns;\n let cell_height = grid_height / rows;\n let cell_size = (cell_width > cell_height) ? cell_height : cell_width;\n let cell_size_off = Math.ceil(cell_size * .5);\n let cell_size_on = this.options.stim.magnify ? Math.ceil(cell_size * .80) : cell_size_off;\n // Adjust\n set_css_var('--grid-width', grid_width + 'px');\n set_css_var('--grid-height', grid_height + 'px');\n set_css_var('--grid-padding', grid_padding);\n set_css_var('--font-size-normal', cell_size_off + 'px');\n set_css_var('--font-size-flash', cell_size_on + 'px');\n set_css_var('--font-size-focus', cell_size_on + 'px');\n }", "function setsize() {\n\tvar sizes = $(\".well input[name='size']\").val().split(\"x\");\n\t// add properties to object and store for future play\n\tCW.sizex = sizes[0];\n\tCW.sizey = sizes[1];\n\tlocalStorage[\"sizex\"] = sizes[0];\n\tlocalStorage[\"sizey\"] = sizes[1];\n\tlocalStorage[\"black\"] = CW.black;\n\tlocalStorage[\"blank\"] = CW.blank;\n\t$(\".well > h3\").text(\"Generator for \" + CW.sizex + \"x\" + CW.sizey + \" Crossword Puzzle\")\n\t$(\".word\").toggle(\"slow\");\n\t$(\".form-inline\").hide();\n\tevent.preventDefault();\n}", "function createGrid(size) {\n\tif (gridBlocks.length > 0) {\n\t\tfor (let block = 0; block < gridBlocks.length; block++) {\n\t\t\tcontainer.removeChild(gridBlocks[block]);\n\t\t}\n\n\t\tgridBlocks = [];\n\t}\n\n\tcontainer.style['grid-template-columns'] = `repeat(${size}, 1fr)`;\n\n\tfor (let i = 0; i < (size * size); i++) {\n\t\tconst gridBlock = document.createElement('div');\n\t\tgridBlock.style.width = `${480 / size}`;\n\t\tgridBlock.style.height = `${480 / size}`;\n\t\tgridBlock.style.border = '1px solid rgba(0, 0, 0, 0.3)';\n\t\tcontainer.appendChild(gridBlock);\n\n\t\tgridBlocks.push(gridBlock);\n\t}\n\n\tcheckForClick();\n\n}", "function buttonClicked() {\n \n let getGridSize = prompt(\"Please enter a new grid size (1-100)\");\n if (getGridSize >= 1 && getGridSize <=100){\n Array.from(gridItem_div).forEach(function (e){\n e.classList.remove(\"divChanged\");\n });\n gridSize = getGridSize; //modify global variable\n setGrid(gridSize);\n makeDivs() \n }\n}", "function userInput() {\n let gridSize = 1;\n while (gridSize < 2 || gridSize > 50) {\n gridSize = prompt(\"How many squares per side would you like your grid to have? Maximum of 50.\");\n }\n createChildDivs(gridSize);\n}", "function changeValue(){\n\tvar newGridValue = prompt(\"Set the new size for the grid! WARNING: Values above 64 may cause lag: \");\n\tif(!isNaN(newGridValue) && newGridValue > 0 && (newGridValue % 1 === 0)){\n\t\tclearGrid();\n\t\tdrawGrid(newGridValue);\n\t\tpixelHover();\n\t} else {\n\t\talert(\"INVALID INPUT. Make sure you're writing a positive whole NUMBER!\");\n\t}\n}", "function defaultGrid(){\n gridSize(24)\n createDivs(24)\n}", "function makeGrid() {\n\n\t// Your code goes here!\n\t\n\tlet submit = $('input[type=\"submit\"]');\n\tlet canvas = $('#pixelCanvas');\n\tlet colorPicker = $('#colorPicker');\n\n\tsubmit.on('click', function(e){\n\t\te.preventDefault();\n\t\tcanvas.empty();\n\t\tlet height = $('#inputHeight').val();\n\t\tlet width = $('#inputWeight').val();\n\t\tconsole.log(height);\n\t\tconsole.log(width);\n\t\taddRows(height, width);\n\t});\n\t\n\tfunction addRows(height,width){\n\t\tfor(var i=0; i < height; i++) {\n\t\t\tcanvas.append('<tr></tr>');\n\t\t}addColumns(width);\n\t}\n\t\n\tfunction addColumns(width){\n\t\tfor(var i=0; i <width; i++) {\n\t\t\tlet cell=$('<td></td>',{class:'cells'});\n\t\t\n\t\t\tcell.on('click',function(e){\n\t\t\t\te.preventDefault()\n\t\t\t\tlet color = colorPicker.val();\n\t\t\t\t$(this).css('background-color', color);\n\t\t\t});\n\n\t\t\t$('tr').append(cell);\n\t\t}\n\t}\n\n\t$('#clear').on('click', function(e){\n\t\te.preventDefault();\n\t\t$('.cells').css('background-color','');\n\t})\n}", "function createGrid() {\r\n removeSquares(); // remove the previous squars\r\n let squares = [];\r\n let grid = prompt('How many squares you need in each direction?', 16);\r\n if(grid < 0 || grid > 64 || isNaN(grid)){ //Check if the input is a valid numbers\r\n\r\n alert(\"Please enter a valid number of grid more than 0 and less than or equal 64 grids.\")\r\n\r\n }else{\r\n let squareSize = (100 / grid) + '%';\r\n for (let i = 1; i <= grid ** 2; i++) {\r\n squares[i] = document.createElement('div');\r\n squares[i].id = 'square' + i;\r\n squares[i].className = 'squares';\r\n container.appendChild(squares[i]);\r\n }\r\n\r\n const squareStyle = document.querySelectorAll('.squares');\r\n squareStyle.forEach((e) => {\r\n e.setAttribute('style', `width:${squareSize};height:${squareSize};`);\r\n });\r\n keepColor();\r\n}\r\n}", "function gridSize(size) {\n container.style.gridTemplateColumns = `repeat(${size}, 1fr)`;\n}", "function makeGrid() {\n\n// Your code goes here!\n\n const height = $(\"#input_height\").val();\n const width = $(\"#input_width\").val();\n const table = $(\"#pixel_canvas\");\n\n // Remove previous table\n table.children().remove();\n\n // Set the table\n for(let r = 0; r < height; r++ ){\n let tr = document.createElement(\"tr\");\n table.append(tr);\n\n for(let w = 0; w < width; w++){\n let td = document.createElement(\"td\");\n tr.append(td);\n }\n\n }\n\n // Submit the form and call function to set the grid\n $(\"#sizePicker\").submit(function(event){\n event.preventDefault();\n makeGrid();\n });\n\n // Declare clickable mouse event\n let mouseDown = false;\n\n $(\"td\").mousedown(function(event){\n mouseDown = true;\n const color = $(\"#colorPicker\").val();\n $(this).css(\"background\", color);\n // Mouse drag for drawing\n $(\"td\").mousemove(function(event){\n event.preventDefault();\n // Check if mouse is clicked and being held\n if(mouseDown === true){\n $(this).css(\"background\",color);\n }else{\n mouseDown = false;\n } \n });\n });\n\n // Mouse click release\n $(\"td\").mouseup(function(){\n mouseDown = false;\n });\n\n // Disable dragging when the pointer is outside the table\n $(\"#pixel_canvas\").mouseleave(\"td\",function(){\n mouseDown = false;\n });\n}", "function makeGrid() {\n\t// hide the Grid by defult to show it in an animation style\n\ttable.hide();\n\ttable.empty();\n\n\tconst width = $('#input_width').val() ;\n\tconst height = $('#input_height').val() ;\n\n\t// no create the Grid !!\n\t// create the rows first (height).\n\tfor(var i = 0; i < height; i++) {\n\t\ttable.append('<tr class=\"rows\"></tr>') ;\n\t}\n\t// then we create the columns(width).\n\tfor(var i = 0; i < width; i++) {\n\t\t$('.rows').append('<td class=\"col\"></td>') ;\n\t}\n}", "function createGrid(size = 4) {\n \n if ( size > 64 || isNaN(size)) return alert('the number has to be less than 64');\n \n for (let i = 0 ; i<size*size; i++){\n const createDivs = document.createElement('div');\n createDivs.style.width = `${(100/size)-0.4}%`;\n createDivs.classList.add('grid');\n main.appendChild(createDivs);\n}\n mouseOver();\n}", "function createNewGrid() {\n let gridSide = prompt('How many squares per side ?');\n\n if (gridSide <= 64 && gridSide > 1) {\n etchySketchy = new GridSystem(gridSide);\n } else {\n alert('Side must be between 2 and 64 squares !');\n }\n}", "SetOverallGridSize(value){\n\t\tvar chk = new Checker(\"SetOverallGridSize\");\n\t\tchk.isValidType(value, \"value\", 'number');\n\t\tthis.overallGridSize = value;\n\t\t\n\t}", "function drawGrid() {\n let dotCount = Number(inputDotCount.value);\n let dotSize = Number(inputDotSize.value);\n let desiredGridWidth = Number(inputGridWidth.value);\n let columnCount = Math.floor(desiredGridWidth / dotSize);\n\n // dette er bare for å vise ønsket bredde på grid\n // (faktisk bredde styres også av prikkstørrelse)\n widthIndicator.style.width = desiredGridWidth + 'px';\n\n // sette hvor mye man skal øke/minke input-feltet for gridbredde når man bruker pil opp/ned\n inputGridWidth.step = dotSize;\n\n grid.style.gridTemplateColumns = `repeat(${columnCount}, ${dotSize}px)`;\n grid.style.gridAutoRows = dotSize + 'px';\n\n let html = '';\n for (let i = 0; i < dotCount; i++) {\n html += '<div class=\"dot\"><div></div></div>';\n }\n\n grid.innerHTML = html;\n}", "function makeGrid (){\nvar in1= $('#input_height').val();\nvar in2= $('#input_width').val();\n$(\"#pixel_canvas\").html(table(in1,in2)); }", "constructor () {\n this.size = 16;\n this.grid_status = this.makeStatus();\n this.boxies = this.makeBoxes();\n }", "setWidth(){\n var newWidth = prompt(\"Enter a new bitmap width: \", 8);\n if(newWidth != null){\n newWidth = parseInt(newWidth);\n if(newWidth != NaN){\n if(newWidth >= 1 && newWidth <= 72){\n this.COLUMN_COUNT = newWidth;\n this.updatePanelTitle();\n this.renderGrid();\n this.saveLocally();\n this.applyGridSize();\n return true;\n }else{\n alert(\"That width is too large or small (min: 1, max: 72)\");\n return false;\n }\n }\n }\n return false;\n }", "function changeGridSize(){\n gridContainer.innerHTML = ''; //clear grid Container before adding new divs\n let gridSize = parseInt(slider.value,10);\n for (let i=1; i<=Math.pow(gridSize,2); i++){\n addElement();\n\n };\n gridContainer.style[\"grid-template-columns\"] = \"repeat(\" + gridSize + \", 1fr)\";\n}", "function resetGrid() {\n // remove the old grid\n const cells = Array.from(grid.childNodes);\n for(let i = 0; i < cells.length; i++)\n grid.removeChild(cells[i]);\n\n // get the new size\n let size = 0;\n while(size < 2 || size > 100 || isNaN(size)) {\n size = prompt(\"Enter a new grid size between 2 and 100:\");\n }\n // create a grid with the new size\n makeRows(size, size);\n}", "function makeGrid(event) {\n// Your code goes here!\n event.preventDefault();\n let height = heightInput.value;\n let width = widthInput.value;\n console.log(height + \",\" + width);\n while (pixelCanvas.firstChild) {\n pixelCanvas.removeChild(pixelCanvas.firstChild);\n }\n\n for (let i = 0; i < height; i++) {\n let newRow = document.createElement(\"tr\");\n for (let j = 0; j < width; j++) {\n let newTd = document.createElement(\"td\");\n newRow.appendChild(newTd);\n }\n pixelCanvas.append(newRow);\n }\n}", "function drawGrid(numTiles, qType) {\n var gridContainer = $('.grid');\n var gridSize = Math.sqrt(numTiles);\n gridContainer.css('width', gridSize * TILE_SIZE + \"px\");\n gridContainer.html('<label>Letters</label>');\n var rowTemplate = $('.gridRow.template');\n var tileTemplate = $('.tile.template');\n var tileContainer, rowCopy, tileCopy;\n for(var i = 1; i <= gridSize; ++i) {\n rowCopy = rowTemplate.clone();\n rowCopy.removeClass('template');\n rowCopy.addClass('gridRow' + i);\n for(var j = 1; j <= gridSize; ++j) {\n tileCopy = tileTemplate.clone();\n tileCopy.removeClass('template');\n tileCopy.addClass('tile' + ((i-1) * gridSize + j));\n tileCopy.html('<input type=\"text\" size=\"1\" maxlength=\"1\" align=\"middle\"></div>');\n rowCopy.append(tileCopy);\n }\n gridContainer.append(rowCopy);\n }\n $('.tile:not(.template):first input').focus();\n if (isTouchScreen()) {\n $('.tile:not(.template):first input').click();\n }\n}", "function makeGrid(e) {\n // Select color input\n // const colorPicked = document.getElementById('colorPicker').value;\n // Select size input\n //height (tr)\n let inputHeight = document.getElementById('inputHeight').value;\n // console.log(inputHeight);\n //width (td)\n let inputWidth = document.getElementById('inputWidth').value;\n // console.log(inputWidth);\n // canvas\n let pixelCnvs = document.getElementById('pixelCanvas');\n pixelCnvs.innerHTML = '';\n // adding tr and td to the table\n let tableBody = document.createElement('tbody');\n for(let i = 0; i < inputHeight; i++) {\n let tableRow = document.createElement('tr');\n for (let j = 0; j < inputWidth; j++) {\n let tableColumn = document.createElement('td');\n tableColumn.appendChild(document.createTextNode(''));\n tableRow.appendChild(tableColumn);\n }\n tableBody.appendChild(tableRow);\n }\n pixelCnvs.appendChild(tableBody);\n e.preventDefault();\n\n}", "function makeGrid() { // Select and create grid size\n \n // select the table\n let pixelCanvas = document.querySelector('#pixelCanvas');\n \n // Select size input\n let gridHeight;\n let gridWidth;\n \n gridHeight = document.querySelector(\"#inputHeight\").value;\n gridWidth = document.querySelector(\"#inputWidth\").value;\n\n console.log(`gridHeight is ${gridHeight} and gridWidth is ${gridWidth}`);\n\n for (let i = 0 ; i < gridHeight ; i++) {\n console.log(`before building row ${i} of ${gridHeight}`);\n pixelCanvas.insertAdjacentHTML('beforeend', '<tr></tr>');\n };\n \n let trs = document.querySelectorAll(\"tr\");\n console.log(`trs.length is ${trs.length}`);\n for (let i = 0 ; i < gridWidth ; i++) { \n console.log(`before building column ${i} of ${gridWidth}`);\n \n for (let tr = 0; tr < trs.length; tr++) {\n console.log(`before building on tr ${tr} of ${trs.length}`);\n trs[tr].insertAdjacentHTML('beforeend', '<td></td>');\n }\n }\n \n // creates the css background color decided before submit grid creation\n console.log(`background color is ${backgroundColor}`);\n //create variable for all cells\n let gridCells = document.querySelectorAll(\"td\");\n //paint all cells of the grid iterating through the nodelist gridCells\n for (let gridCell = 0; gridCell < gridCells.length; gridCell++) {\n console.log(`painting BG gridCell ${gridCell} of ${gridCells.length}`);\n gridCells[gridCell].style.backgroundColor = backgroundColor;\n }\n \n }", "function makeGrid() {\n var {width, height} = size_input();\n\n for (rowNum = 0; rowNum < height; rowNum++) {\n grid.append(\" <tr></tr>\");\n }\n for (colNum = 0; colNum < width; colNum++) {\n $(\"#pixel_canvas tr\").append(\" <td></td>\");\n }\n}", "function resetGrid(){\n let divCount = prompt(\"How many boxes per side do you need?\");\n clearGrid();\n createGrid(divCount);\n}", "function setSizes()\n {\n if (DOM.container.offsetHeight > DOM.container.offsetWidth)\n {\n DOM.container.style.minWidth = DOM.container.offsetHeight + \"PX\";\n }\n\n desk.style.height = sizes.desk.height + \"PX\";\n desk.style.width = sizes.desk.width + \"PX\";\n desk.style.marginBottom = sizes.deskContainer.marginBottom + \"PX\";\n\n for (var counterRow = 0; counterRow < sizes.field.rows; counterRow++)\n {\n for (var counterCol = 0; counterCol < sizes.field.cols; counterCol++)\n {\n DOM.game.field.rows[counterRow].cells[counterCol].style.height = sizes.card.height + \"PX\";\n DOM.game.field.rows[counterRow].cells[counterCol].style.width = sizes.card.width + \"PX\";\n\n var card = cards[counterRow * sizes.field.cols + counterCol];\n if (card)\n {\n card.style.height = sizes.card.height + \"PX\";\n card.style.width = sizes.card.width + \"PX\";\n }\n }\n }\n }", "function changeSize(val) {\n\tvar s = String(val).split(\",\");\n\td3.select('#viz_container').style('width', s[0] + 'px').style('height', s[1] + 'px');\n\tviz.update();\n}", "function changeSize(val) {\n\tvar s = String(val).split(\",\");\n\td3.select('#viz_container').style('width', s[0] + 'px').style('height', s[1] + 'px');\n\tviz.update();\n}", "function updateSizeValues(){\n\tswitch (runDialog.sizeConfig.outputPresetInput.selection.index){\n\t\tcase 0:\n\t\t\tsetSizeValues(8.5, 11, 6, 9, 150);\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tsetSizeValues(11, 8.5, 9, 6, 150);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tsetSizeValues(11, 14, 8, 12, 150);\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tsetSizeValues(14, 11, 12, 8, 150);\n\t\t\tbreak;\n\t}\n}", "function sizeChanged () {\n board = new Board(sizeSlider.value())\n board.initView(windowWidth / 2, windowHeight / 2, CENTER_BOARD_SIZE)\n}", "function SizeCheckBox() {\n guiData.sizeActivated = !guiData.sizeActivated;\n p.getBubbleDrawer().useSize(guiData.sizeActivated);\n if (guiData.sizeActivated)\n {\n $(\"#selectSizeValue\").next(\"input\").autocomplete(\"enable\");\n }\n else\n {\n $(\"#selectSizeValue\").next(\"input\").autocomplete(\"disable\");\n }\n if (!isPlaying)\n refreshDisplay();\n}", "function changeGrid() {\n\t$( \"#inputHeight\" ).on( \"change\", function( evt ) {\n\t\tGRID.rows = evt.target.value;\n\t\t$(\"#inputHeight\").attr(\"value\", GRID.rows);\n\t\tconsole.log( \"-- Grid rows changed --\" );\n\t\tconsole.log( evt );\n\t\t//console.log( evt.target.value );\n\t\tgetGrid();\n\t});\n\n\t$( \"#inputWeight\" ).on( \"change\", function( evt ) {\n\t\tGRID.columns = evt.target.value;\n\t\t$(\"#inputWeight\").attr(\"value\", GRID.columns);\n\t\tconsole.log( \"-- Grid columns changed --\" );\n\t\tconsole.log( evt );\n\t\t//console.log( evt.target.value );\n\t\tgetGrid();\n\t});\n}", "function ChangeSize(value) {\n if (document.getElementById(\"sizeCheckBox\").checked == true) {\n guiData.cursorSize = value;\n if (!isPlaying) {\n refreshBubbles();\n refreshDisplay();\n }\n }\n else {\n p.getBubbleDrawer().setSize(value);\n if (!isPlaying) {\n refreshBubbles();\n refreshDisplay();\n }\n }\n}", "function editor_tools_handle_size()\n{\n editor_tools_store_range();\n\n // Create the size picker on first access.\n if (!editor_tools_size_picker_obj)\n {\n // Create a new popup.\n var popup = editor_tools_construct_popup('editor-tools-size-picker','l');\n editor_tools_size_picker_obj = popup[0];\n var content_obj = popup[1];\n\n // Populate the new popup.\n for (var i = 0; i < editor_tools_size_picker_sizes.length; i++)\n {\n var size = editor_tools_size_picker_sizes[i];\n var a_obj = document.createElement('a');\n a_obj.href = 'javascript:editor_tools_handle_size_select(\"' + size + '\")';\n a_obj.style.fontSize = size;\n a_obj.innerHTML = editor_tools_translate(size);\n content_obj.appendChild(a_obj);\n\n var br_obj = document.createElement('br');\n content_obj.appendChild(br_obj);\n }\n\n // Register the popup with the editor tools.\n editor_tools_register_popup_object(editor_tools_size_picker_obj);\n }\n\n // Display the popup.\n var button_obj = document.getElementById('editor-tools-img-size');\n editor_tools_toggle_popup(editor_tools_size_picker_obj, button_obj);\n}", "changeSize(width, height) {\n\t\t\t\tthis.each(function (model) {\n\t\t\t\t\tmodel.set({width, height});\n\t\t\t\t});\n\t\t\t}", "function buildGrid(size){\n \n let squareSize = document.getElementById('grid').clientWidth / size;\n //Creating the square and defining his size\n for(let i=1 ; i<=size*size;i++){ \n let square = document.createElement('div')\n grid.appendChild(square);\n square.classList.add('square-grid');\n square.style.width = squareSize + \"px\";\n square.style.height = squareSize + \"px\";\n //Rounding square grid corners\n if(i==1){\n square.style.borderTopLeftRadius = \"10px\";\n }else if(i==size){\n square.style.borderTopRightRadius = \"10px\";\n }else if(i==size*size-size+1){\n square.style.borderBottomLeftRadius = \"10px\";\n }else if(i==size*size){\n square.style.borderBottomRightRadius = \"10px\";\n }\n }\n \n}", "calcGridAndCellsSize() {\r\n let actualWidth = ~~$(\".mdl-grid\").width();\r\n let cellSize = actualWidth / this.game.config.numColumnsOnMap;\r\n if (cellSize > 120) {\r\n cellSize = 120;\r\n } else {\r\n cellSize = 60;\r\n }\r\n $(\".mdl-cell\").each((idx, cell) => {\r\n $(cell).width(cellSize);\r\n $(cell).height(cellSize);\r\n });\r\n if (actualWidth !== cellSize * this.game.config.numColumnsOnMap) {\r\n actualWidth = cellSize * this.game.config.numColumnsOnMap;\r\n $(\".mdl-grid\").width(actualWidth);\r\n }\r\n $(\".mdl-grid\").height(cellSize * this.game.config.numRowsOnMaps);\r\n }", "function changeSize(val) {\n\tvar s = String(val).split(\",\");\n\td3.select('#viz_container').style('width', s[0] + 'px').style('height', s[1] + 'px');\n\tviz\n\t .fontSizeMax(function () { return Math.max(30,s[1] * .1) })\n\t .update();\n}", "function calcCellSize(grid_size) {\n var cell_size = 5;\n return cell_size\n}", "function operate(option) {\n\tif (option == 4) {\n\t\tclear();\n\t\treturn;\n}\npresent_option = option;\nvar size = prompt(\"Enter a Grid Size from 1 - 128.\");\nif ((size > 0) && (size < 128)) {\n\tpresent_size = size;\n\tclear();\n} else {\n\toperate(option);\n}\n}", "function createGrid(gridSize) {\n const outerContainer = document.querySelector(\"#outer-container\");\n const container = document.createElement('div');\n container.setAttribute(\"id\", \"container\");\n outerContainer.appendChild(container);\n container.style = \"grid-template-columns: repeat(\"+ gridSize +\", 1fr)\";\n const informationBox = document.querySelector(\"#information-box\");\n outerContainer.insertBefore(container,informationBox);\n for (let i = 0; i < (gridSize * gridSize); i++) {\n const container = document.querySelector('#container');\n\n const div = document.createElement('div');\n div.className = 'grid-block';\n container.appendChild(div);\n }\n}", "function makeGrid(evt) {\n\t//access current height and width\n\txCell = $(\"#inputWidth\").val();\n\tyCell = $(\"#inputHeight\").val(); \n\t//access table element\n\ttable = $(\"#pixelCanvas\");\n\trows =\"\";//rows\n\tcols =\"\";//cols\n\t//create xCell no of row.\n\tfor(var r=1; r<=yCell; r++){\n\t\trows = rows + \"<tr></tr>\";\n\t}\n\t//create ycell no of column in each row.\n\tfor(var c=1; c<=xCell; c++){\n\t\tcols = cols + \"<td></td>\";\n\t}\n\t//create table with above rows and cols.\n\ttable.html(rows);\n\t$(\"tr\").html(cols);\n\t//do not submit.\n\tevt.preventDefault();\n}", "function createGrids() {\n // Clear previous grids\n $(\"#inputGrid\").empty();\n $(\"#outputGrid\").empty();\n\n // Set size for new grids\n let columns = (new Array(parseInt($(\"#width\").val()))).fill(\"1fr\").join(\" \");\n let rows = (new Array(parseInt($(\"#height\").val()))).fill(\"1fr\").join(\" \");\n\n $(\"#inputGrid\").css(\"grid-template-columns\", `${columns}`);\n $(\"#inputGrid\").css(\"grid-template-rows\", `${rows}`);\n $(\"#outputGrid\").css(\"grid-template-columns\", `${columns}`);\n $(\"#outputGrid\").css(\"grid-template-rows\", `${rows}`);\n\n let grids = parseInt($(\"#width\").val()) * parseInt($(\"#height\").val());\n\n for (let i = 0; i < grids; i++) {\n $(\"#inputGrid\").append(`<div id=\"input${i}\" style=\"background-color: white;\" onmouseover=paint(this)></div>`);\n $(\"#outputGrid\").append(`<div id=\"output${i}\" style=\"background-color: white;\"></div>`);\n }\n\n NETWORK = new HopfieldNetwork(parseInt($(\"#width\").val()) * parseInt($(\"#height\").val()));\n}", "function makeGrid() {\n removeGrid();\n let rows = gridHeight.val();\n let columns = gridWidth.val();\n //Add Row to the Table\n for (let addRow = 0; addRow < rows; addRow++) {\n grid.append('<tr class=\"tableRow\">');\n };\n //Add column to the table\n for (let addColumn = 0; addColumn < columns; addColumn++) {\n $(\"tr\").each(function() {\n $(this).append('<td class=\"tableCell\">');\n });\n }\n}", "function makeGrid() {\n // Removing previous grid if it exists\n $('tr').remove();\n // Setting variables for width and height\n const canvasWidth = $('#input_width').val();\n const canvasHeight = $('#input_height').val();\n // Conditional for checking correct input\n // NOT NEEDED ANYMORE\n\n // if (((canvasWidth < 1) || (canvasWidth > 50) || (canvasHeight < 1) || (canvasHeight > 50))) {\n // $('.warning p').css('visibility', 'visible');\n // $('.warning p').fadeOut(7000, function() {\n // $(this).css('display', 'block');\n // $(this).css('visibility', 'hidden');\n // });\n // } else {\n\n // Actual function making all hard work :)\n for (let i = 0; i < canvasHeight; i++) {\n $('#pixel_canvas').append('<tr></tr>');\n for (let i = 0; i < canvasWidth; i++) {\n $('tr:last-of-type').append('<td></td>');\n };\n };\n}", "function makeGrid() {\n // Removing previous grid if it exists\n $('tr').remove();\n // Setting variables for width and height\n const canvasWidth = $('#input_width').val();\n const canvasHeight = $('#input_height').val();\n // Conditional for checking correct input\n // NOT NEEDED ANYMORE\n\n // if (((canvasWidth < 1) || (canvasWidth > 50) || (canvasHeight < 1) || (canvasHeight > 50))) {\n // $('.warning p').css('visibility', 'visible');\n // $('.warning p').fadeOut(7000, function() {\n // $(this).css('display', 'block');\n // $(this).css('visibility', 'hidden');\n // });\n // } else {\n\n // Actual function making all hard work :)\n for (let i = 0; i < canvasHeight; i++) {\n $('#pixel_canvas').append('<tr></tr>');\n for (let i = 0; i < canvasWidth; i++) {\n $('tr:last-of-type').append('<td></td>');\n };\n };\n}", "function handleSize(e) {\n if (stateObject.isRunning) return;\n let value = e.currentTarget.value;\n\n if (window.innerWidth < 800) {\n if (value > 15) {\n value = 15;\n }\n }\n\n scaling[changeSize.id] = value;\n resetAndRenderArray();\n setTimeout(() => {\n for (let i = 0; i < scaling.changeSize; i++) {\n document.getElementById(`arrayBar_${i}`).style.width = scaleWidth(scaling.changeSize);\n }\n }, 100);\n}", "function makeGrid(height, width) {\n // set size of canvas\n for (var i = 0; i < height.value; i++) {\n const row = canvas.insertRow(i); // calls the function to set size rows\n for (var j = 0; j < width.value; j++) {\n const cell = row.insertCell(j); // cal the function to set size of insertCell\n cell.addEventListner(\"click\", fillSquare);\n }\n }\n}", "function drawSelGrid(){\n\tvar obj = gridSize();\n\tvar canvas = document.getElementById('sel_grid');\n\t\n\tvar context = canvas.getContext('2d');\n\tcontext.scale(dpr,dpr);\n\t\n\t//Set the canvas size\n\tcanvas.width = (obj.colWidth * obj.cols+0.5)*dpr;\n\tcanvas.height = (obj.rowHeight*obj.rows+0.5)*dpr;\n\t\n\tcanvas.style.width = `${obj.colWidth * obj.cols+0.5}px`;\n\tcanvas.style.height = `${obj.rowHeight*obj.rows+0.5}px`;\n\tcontext.scale(dpr,dpr);\n\n}", "setSize(size) {\n this.size = size;\n }", "_configurationGridSize (containerName, width, height) {\n if (width) {\n document.getElementById(containerName).style.width = width + \"px\";\n }\n else {\n document.getElementById(containerName).style.width = \"100%\";\n }\n if (height) {\n document.getElementById(containerName).style.height = height + \"px\";\n }\n else {\n document.getElementById(containerName).style.height = \"90%\";\n }\n }", "setSize(size) {\n this.size = size;\n }", "function setGrid(gridSize){\n container.style.gridTemplateColumns = `repeat(${gridSize}, 1fr)`;\n container.style.gridTemplateRows = `repeat(${gridSize}, 1fr)`;\n}", "function makeGrid() {\n const height = inputHeight.val();\n const width = inputWidth.val();\n\n for (let i = 0; i < height; i++) {\n const row = $('<tr></tr>');\n for (let j = 0; j < width; j++) {\n row.append('<td></td>');\n }\n canvas.append(row);\n }\n}", "scale(size) {\n document.getElementById(\"guiArea\").style.width = size + \"px\";\n }" ]
[ "0.7694769", "0.7553282", "0.75071144", "0.7472073", "0.72403735", "0.7214134", "0.71550834", "0.71263516", "0.71014583", "0.7092236", "0.7089094", "0.7048364", "0.7044207", "0.70392203", "0.6989688", "0.698586", "0.695496", "0.6931012", "0.68895555", "0.6859165", "0.6854571", "0.67962766", "0.6791262", "0.6781743", "0.6768817", "0.67542917", "0.67495996", "0.6717939", "0.6670979", "0.65453327", "0.6527294", "0.6524091", "0.646656", "0.6465283", "0.6459859", "0.64591527", "0.64510405", "0.64315385", "0.6416352", "0.6416352", "0.6410405", "0.640638", "0.6405619", "0.6398303", "0.6387057", "0.63784176", "0.6354271", "0.63501585", "0.63481945", "0.63474435", "0.63409567", "0.63073283", "0.6306975", "0.63063407", "0.6294092", "0.62732494", "0.6270905", "0.62413436", "0.6216883", "0.62155306", "0.62062967", "0.62060124", "0.6194892", "0.6193804", "0.6190504", "0.61773336", "0.61584926", "0.6150357", "0.6142566", "0.61414844", "0.6128697", "0.61214", "0.61214", "0.61202896", "0.6116438", "0.6115902", "0.6111947", "0.6108398", "0.6100641", "0.6097536", "0.60957706", "0.6093417", "0.6087868", "0.608277", "0.60773796", "0.6077234", "0.60752106", "0.6071659", "0.6065032", "0.6059744", "0.6059744", "0.605542", "0.6054886", "0.60532486", "0.6051262", "0.6032548", "0.6032522", "0.6028474", "0.6026949", "0.60140455" ]
0.64906025
32
function to run when user clicks on a cell
function setCellColor(event) { const colorPicker = document.querySelector("input[type='color']"); event.target.style.backgroundColor = colorPicker.value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleHTMLCellClick(e) {\n // https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n let idArray = e.currentTarget.id.split(\"-\");\n let row = Number(idArray[1]);\n let col = Number(idArray[2]);\n\n chess.handleCellSelected(row, col);\n}", "function cellClicked(event){\n event.preventDefault(); // prevent right-click context menu\n $.get(\"/cellClicked\", {pid: window.pid, row: this.r, col: this.c, clickType: event.which}, function(response){\n var data = JSON.parse(response);\n if(data[\"groupClear\"]){ //If cell clicked == 0 cell, update all cells\n updateGrid(window.pid);\n }\n else if (data[\"value\"]!==void(0)) { // else update single cell if given a value\n var value = data[\"value\"]; //0-8 = num, 10 == bomb, flag == 10\n var r = data[\"row\"];\n var c = data[\"col\"];\n // set cell value\n var id = r.toString() + \"-\" + c.toString();\n $(\"#\"+id).text(value).removeClass().addClass(\"value\"+value)\n }\n });\n}", "function cell_click(evt) {\n let cell_id = evt.srcElement.id;\n let id = cell_id.split(\"_\");\n let x = parseInt(id[0]);\n let y = parseInt(id[1]);\n\n switch (evt.which) {\n case LEFT:\n cell_on(x, y);\n break;\n case MIDDLE:\n cell_toggle(x, y);\n break;\n case RIGHT:\n cell_off(x, y);\n break;\n }\n return false;\n}", "function cellDblClicked() {\n changeColor()\n}", "function handleClickOnCell(event) {\n let cell = event.target;\n \n currentOnTurn = circleTurn ? CIRCLE : X;\n \n placeMark(cell, currentOnTurn); \n\n // check if have a winner Game is over!\n if (checkForWin(currentOnTurn)) { \n return endGame(false);\n } else if (isDraw()) {\n return endGame(true);\n } \n switchTurns();\n setHoverClass(); \n}", "function clickOnCell() {\n const clickedCell = event.target;\n const clickedCellIndex = clickedCell.dataset.index;\n cellPlayed(clickedCell, clickedCellIndex);\n resultValidation();\n \n clickedCell.removeEventListener('click', clickOnCell);\n return;\n}", "cellClicked(event) {\n const target = event.target;\n if (target.classList.contains('cell')) {\n const col = parseInt(target.dataset.column);\n const row = parseInt(target.dataset.row);\n this.history[this.step][col][row] = !this.history[this.step][col][row];\n if (this.history[this.step][col][row]) {\n this.gridItems[col + (row * this.cols)].classList.add('alive');\n }\n else {\n this.gridItems[col + (row * this.cols)].classList.remove('alive');\n }\n }\n }", "function ClickCell(ref) \n{\n _rcArray = ref.id.split('_');\n _currentCell = ref.id;\n ref.style.borderColor = \"#000\";\n document.getElementById(\"txtFilter\").value = _tblArray[_rcArray[0]][_rcArray[1]];\n document.getElementById(\"span\").innerHTML = \"Current Cell: \" + String.fromCharCode(64 + parseInt(_rcArray[1])) + _rcArray[0];\n}", "_cellClicked(cell, event) {\n if (cell.enabled) {\n this.selectedValueChange.emit({ value: cell.value, event });\n }\n }", "_cellClicked(cell, event) {\n if (cell.enabled) {\n this.selectedValueChange.emit({ value: cell.value, event });\n }\n }", "function cellClick(clickedCellEvent) {\n\n const clickedCell = clickedCellEvent.target; // saves clicked html in a variable for future use\n\n const clickedCellIndex = parseInt(clickedCell.getAttribute('data-cell-index')); // grabs the 'data-cell-index' attribute from clicked cell\n if (board[clickedCellIndex] !== \"\" || !gameActive) { //checks if the cell has been clicked before or if the game has been paused. If true will ignore the click\n return;\n }\n cellPlayed(clickedCell, clickedCellIndex);\n resultValidation();\n}", "clickHandler () {\n this.props.cellClick(this.props.keyy, this.props.turn);\n }", "function handleCellClick(clickedCellEvent) {\n //clicked html saved in a variable\n const clickedCell = clickedCellEvent.target;\n\n //grabbing 'data-cell-index' attribute from the clicked cell to identify where that cell is in our table.\n //**getAttribute will return a string value.We will parse it to an integer(number)\n const clickedCellIndex = parseInt(\n clickedCell.getAttribute(\"data-cell-index\")\n );\n\n //to ignore the click if cell has been clicked and game is paused\n if (gameState[clickedCellIndex] !== \"\" || !gameActive) {\n return;\n }\n //to proceed with the game\n handleCellPlayed(clickedCell, clickedCellIndex);\n handleResultValidation();\n}", "function handleCellClick(clickedCellEvent) {\n const clickedCell = clickedCellEvent.target;\n // below gives corresponding cell index\n const clickedCellIndex = parseInt(clickedCell.getAttribute('data-cell-index'));\n\n\n // delete this line to make code run?...\n if (gameState[clickedCellIndex] !== '') /*|| !gameActive)*/ {\n return;\n } \n\n // clickedCell = html, clickedCellIndex for the gameState[]\n handleCellPlayed(clickedCell, clickedCellIndex);\n handleResultValidation();\n}", "function cellChange( row, col ) {\n var editing = editingCellInfo();\n if ( ! editing )\n return true;\n row += editing.row;\n if ( row >= 1 && row <= editing.rows )\n editing.row = row;\n col += editing.col;\n if ( col >= 1 && col <= editing.cols )\n editing.col = col;\n $(self.util.svgRoot).find('#'+editing.tabid+'_'+editing.row+'_'+editing.col).click();\n return false;\n }", "onCellClick({\n grid,\n column,\n record,\n target\n }) {\n if (!target.classList.contains('b-action-item') || grid.readOnly) {\n return;\n }\n\n let actionIndex = target.dataset.index; // index may be set in a parent node if user used an html string in his custom renderer\n // and we take care to set this property to support onClick handler\n\n if (!actionIndex) {\n actionIndex = target.parentElement.dataset && target.parentElement.dataset.index;\n }\n\n const action = column.actions[actionIndex],\n actionHandler = action && action.onClick;\n\n if (actionHandler) {\n this.callback(actionHandler, column, [{\n record,\n action\n }]);\n }\n }", "onRightClick( event ) {\r\n var cell = event.target.dataMine;\r\n this.flagCell(cell);\r\n event.preventDefault();\r\n }", "function handleCellClick(clickedCellEvent) {\n\n const clickedCell = clickedCellEvent.target;\n // below gives corresponding cell index\n const clickedCellIndex = parseInt(clickedCell.getAttribute('data-cell-index'));\n // delete this line to let the game decide if final clicked cell is a winner or draw?...\n\n if (gameState[clickedCellIndex] !== '') /* !== \"\" || !gameActive) */ {\n return;\n } \n\n // clickedCell = html, clickedCellIndex for the gameState[]\n handleCellPlayed(clickedCell, clickedCellIndex);\n handleResultValidation();\n}", "function clickyClick (evt) {\n // get mouse coordinates relative to canvas\n var rect = canv.getBoundingClientRect();\n let x = evt.clientX - rect.left;\n let y = evt.clientY - rect.top;\n \n if (x >= 0 && x <= canvWidth && y >= 0 && y <= canvHeight) {\n \n let cellNumber;\n cellX = x + (cellSize - x % cellSize);\n cellY = y + (cellSize - y % cellSize);\n cellNumber = ((cellX / cellSize) - 1) + (((cellY / cellSize) - 1) * xCells);\n \n switch (input) {\n case 'click':\n singleClick (cellNumber);\n break;\n case 'glider':\n glider(cellNumber);\n break;\n case 'pulsar':\n pulsar(cellNumber);\n break;\n }\n\n fillCanvas();\n\n displayCells();\n }\n}", "cellOnClick(event) {\n console.log(\"Click on Cell: \", event.target.id);\n this.setState({\n sensorObject: rows[event.target.id]\n });\n this.handleOpen();\n }", "squareClick(){\n this.props.boardClick(this.props.rowIndex, this.props.columnIndex);\n }", "function addClickHandlers(){\n var cells = document.getElementsByTagName(\"td\");\n var gridTable = document.getElementById(\"genGrid\");\n var cordDisp = document.getElementById(\"clickedCell\");\n \n\n for (i = 0; i < cells.length; i++){\n cells[i].onclick = function(){\n var html = '';\n var col = this.cellIndex;\n var row = this.parentNode.rowIndex;\n cell = gridTable.rows[row].cells[col];\n cell.style.backgroundColor = \"orange\";\n html += \"You clicked a cell! \"\n html += \"In programming notation the coordinates are: Column: \" + col + \" Row: \" + row;\n var engCol = col + 1;\n var engRow = row + 1;\n html += \" In english the coordinates are: Column: \" + engCol + \" Row: \" + engRow;\n cordDisp.innerHTML = html;\n }\n }\n}", "onElementClick(event) {\n const me = this,\n cellData = me.getEventData(event);\n\n // There is a cell\n if (cellData) {\n me.triggerCellMouseEvent('click', event);\n\n // Clear hover styling when clicking in a row to avoid having it stick around if you keyboard navigate\n // away from it\n // https://app.assembla.com/spaces/bryntum/tickets/5848\n DomDataStore.get(cellData.cellElement).row.removeCls('b-hover');\n }\n }", "function onCanvasMouseDown(event) {\n window.mouseDown = true;\n clickCell(event.pageX, event.pageY);\n}", "function cellClicked(elCell, i, j) {\r\n if (!gGame.isOn) return;\r\n if (gGame.isFirstClick) {\r\n gGame.isOn = true;\r\n setMinesRand(gBoard, { i, j })\r\n setMinesNegsCount(gBoard)\r\n gGame.isFirstClick = false\r\n }\r\n if (gBoard[i][j].isShown) return;\r\n\r\n gBoard[i][j].isShown = true;\r\n elCell.innerText = gBoard[i][j].type;\r\n}", "function click(cell, col){\n //console.log(\"clicked cell # \"+cell.id);\n if(cell.hasValue)\n {\n alert(\"Cannot click here.\");\n return;\n }\n\n if(playerRed==true) //player red\n {\n\n let cellSelected=selectCell(cell, col); //finds next available cell at bottom of column and adds emoji to the board\n\n if(winChoice())\n {\n printWinner();\n return;\n }\n }\n else //player yellow\n {\n let cellSelected=selectCell(cell, col);\n\n if(winChoice())\n {\n printWinner();\n return;\n }\n }\n switchPlayer();\n}", "triggerCellMouseEvent(name, event) {\n const me = this,\n cellData = me.getCellDataFromEvent(event); // There is a cell\n\n if (cellData) {\n const column = me.columns.getById(cellData.columnId);\n me.trigger('cell' + StringHelper.capitalize(name), {\n grid: this,\n record: cellData.record,\n column,\n cellSelector: cellData.cellSelector,\n cellElement: cellData.cellElement,\n target: event.target,\n event\n });\n }\n }", "function cellClicked(elCell, i, j) {\r\n if (!gGameBoardCreated) {\r\n if (gManualModeOn && gManualMinesLeft > 0) {\r\n return positionMine(elCell, i, j);\r\n } else {\r\n gElManualSpan.innerText = ``;\r\n createGameBoard(i, j)\r\n }\r\n }\r\n if (!gStartTime) startGame();\r\n if (!gGame.isOn) return\r\n var cell = gBoard[i][j]\r\n if (cell.isMarked || cell.isShown) return\r\n if (gGame.isHintOn) {\r\n handleHint(i, j);\r\n return\r\n }\r\n if (cell.isMine) {\r\n cell.isShown = true;\r\n elCell.innerHTML = MINE;\r\n elCell.classList.add('shown');\r\n gGame.shownCount++;\r\n gGame.lives--;\r\n gElLives.innerText = gGame.lives;\r\n gMovesHistory.push({ location: { i, j }, isShown: true, userClicked: true });\r\n if (gGame.lives < 1) {\r\n revealAllMines();\r\n gameOver();\r\n }\r\n } else {\r\n expandShown(gBoard, elCell, i, j, userClicked = true)\r\n if (checkGameOver()) gameOver(WIN);\r\n }\r\n}", "function changeCell() {\n var clicked = document.getElementById(\"box\").click;\n if (clicked == true) {\n alert(\"box clicked\")\n document.getElementById(\"box\").background = colorSelected;\n }\n // mouse clicks on cell change to colorSelecetd value\n}", "function clickEvent1() {\n addSymbol(cell1);\n winCheck();\n return;\n}", "function handleCellClick(x, y, e) {\n console.log(`Cell clicked X: ${x}, Y: ${y}`);\n fetch(`${API_URL}/shoot`, {\n method: \"POST\", // *GET, POST, PUT, DELETE, etc.\n mode: \"cors\", // no-cors, cors, *same-origin\n cache: \"no-cache\", // *default, no-cache, reload, force-cache, only-if-cached\n credentials: \"same-origin\", // include, *same-origin, omit\n headers: {\n \"Content-Type\": \"application/json\",\n // \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n redirect: \"follow\", // manual, *follow, error\n referrer: \"no-referrer\", // no-referrer, *client\n body: JSON.stringify({x, y}),\n })\n .then(res => res.json())\n .then(data => {\n props.onUserDataUpdate(data);\n })\n .catch(e => {\n console.log('Error ' + e);\n })\n }", "onElementClick(event) {\n const me = this,\n cellData = me.getCellDataFromEvent(event); // There is a cell\n\n if (cellData) {\n me.triggerCellMouseEvent('click', event); // Clear hover styling when clicking in a row to avoid having it stick around if you keyboard navigate\n // away from it\n // https://app.assembla.com/spaces/bryntum/tickets/5848\n\n DomDataStore.get(cellData.cellElement).row.removeCls('b-hover');\n }\n }", "clickCell(cell, event, leftClick = true) {\n if (this.parent.currMark == \"vertices\") {\n cell.toggleEdge(cell.eventDirection(event), leftClick);\n } else {\n cell.toggleShading(leftClick);\n }\n this.update();\n\n // Linked boards:\n // Copy edges/crosses to Slitherlink\n // Copy shading status to Corralsyu\n cell.transfer(this.parent.slitherlink, \"edges\");\n cell.transfer(this.parent.slitherlink, \"crosses\");\n this.parent.slitherlink.update();\n\n this.parent.corralsyu.board[cell.row][cell.column].shaded = cell.shaded;\n this.parent.corralsyu.board[cell.row][cell.column].unshaded = cell.unshaded;\n this.parent.corralsyu.update();\n }", "triggerCellMouseEvent(name, event) {\n const me = this,\n cellData = me.getEventData(event);\n\n // There is a cell\n if (cellData) {\n const column = me.columns.getById(cellData.columnId);\n\n me.trigger('cell' + StringHelper.capitalizeFirstLetter(name), {\n grid: this,\n record: cellData.record,\n column,\n cellSelector: cellData.cellSelector,\n cellElement: cellData.cellElement,\n target: event.target,\n event\n });\n }\n }", "onCellClick({ source: grid, record, cellSelector, cellElement, target, event }) {\n const selected = grid.focusedCell || {},\n column = grid.columns.getById(cellSelector.columnId);\n\n // Columns may provide their own handling of cell editing\n if (column.onCellClick) {\n column.onCellClick({ grid, column, record, cellSelector, cellElement, target, event });\n } else if (target.matches('.b-tree-expander')) {\n this.cancelEditing();\n return false;\n } else if (DomHelper.isTouchEvent && cellSelector.id == selected.id && cellSelector.columnId == selected.columnId) {\n this.startEditing(cellSelector);\n }\n }", "function cellClicked(elCell, i, j) {\n // doesn't let you click when game isn't active i.e when you win or get a game over\n if (!gGame.isOn) return;\n\n // starting timer on first click\n if (gFirstClicked === true) {\n // makes sure first click is not a bomb\n while (gBoard[i][j].isBomb) {\n init(gSize, gBombAmount);\n }\n // starts running the timer\n timer();\n\n gFirstClicked = false;\n }\n\n // stops user from unmarking a flagged cell\n if (gBoard[i][j].isFlagged) return;\n\n // In the case a hint was requested\n if (gIsHint) {\n hints(i, j); // displays the hint in this location\n gIsHint = false;\n elHintButton.style.removeProperty('background-color');\n return;\n }\n\n // when clicked an empty cell opens an expansion\n if (gBoard[i][j].neighBombs === EMPTY && !gBoard[i][j].isBomb) expandShown(gBoard, i, j);\n else revealCell(gBoard, i, j);\n\n // finishes game when bomb is clicked\n if (gBoard[i][j].isBomb) {\n var elBombs = document.querySelectorAll('.bomb.hide');\n for (let k = 0; k < elBombs.length; k++) {\n elBombs[k].classList.remove('hide');\n elBombs[k].innerHTML = BOMB;\n }\n gameOver(gBoard);\n }\n isWin(); // checks if game was won\n}", "function clickCell(ref) {\n //var rcArray = ref.id.split('_'); \n // alert(\"You selected row \" + rcArray[0] + \" and column \" + rcArray[1]);\n\n //Set Colour of previous id back to the rest of the grid\n document.getElementById(prevSelect).style.background = \"#C3DAF9\";\n\n //Set Colour of selected id\n document.getElementById(ref.id).style.background = \"#00FFFF\";\n prevSelect = ref.id;\n currSelect = ref.id;\n\n var selecVal = document.getElementById(currSelect).innerHTML;\n var selecDivVal = document.getElementById(\"div\" + currSelect).innerHTML;\n\n document.getElementById(\"formulaBox\").focus();\n\n //if div contains a formula, update formula box to show the formula.\n if (document.getElementById(\"div\" + currSelect).innerHTML.substring(0, 5) == \"SUM=(\") {\n document.getElementById(\"formulaBox\").value = selecDivVal;\n }\n else {\n document.getElementById(\"formulaBox\").value = selecVal;\n }\n\n\n}", "function cellRightClick() {\n\tcellClick(pointingAtX,pointingAtY, null);\n}", "function addCellEvents() {\n cells.forEach(function (cell) {\n cell.addEventListener(\"click\", cellEventListener);\n });\n}", "function click() {\n\t// If clicking on a cell with your piece in it, highlight the cell\n\tif (!selectedBox) { // 1st click\n\t\tif ((!blueTurn && this.hasClassName(\"red\")) || (blueTurn && this.hasClassName(\"blue\"))) {\n\t\t\tthis.addClassName(\"selected\");\n\t\t\tselectedBox = this;\n\t\t}\n\t}\n\t\n\t// Player is trying to move a piece\n\telse { // 2nd click\n\t\tselectedBox.removeClassName(\"selected\");\n\t\tthis.onmouseout();\n\t\t\n\t\t// If there are forced jumps and player is not jumping, highlight forced jumps\n\t\tif (forcedJumps != false) {\n\t\t\tif (!jump(this)) {\n\t\t\t\thighlightForcedJumps(forcedJumps);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Try moving, then try jumping\n\t\telse if (!move(this))\n\t\t\tjump(this);\n\t\t\t\n\t\tselectedBox = null;\n\t\tcheckVictory();\n\t}\n}", "function clickCell(e) {\n // find cell that was clicked\n var clickedCell= $(e.target).closest(\"td\");\n\n // set starting cell if not set\n if (!start) {\n start = new Node(null, parseInt(clickedCell.attr(\"data-col\"), 10), parseInt(clickedCell.attr(\"data-row\"), 10), 0);\n\n // mark the starting cell with a green color\n clickedCell.addClass(\"start\");\n }\n // set ending cell if start has been set but not end\n else if (!end) {\n end = new Node(null, parseInt(clickedCell.attr(\"data-col\"), 10), parseInt(clickedCell.attr(\"data-row\"), 10), 0);\n\n // mark the ending cell with a red color\n clickedCell.addClass(\"end\");\n\n // calculate and display the shortest path\n $(\"#output\").html('Minimum hops required is: ' + findShortestPath());\n }\n}", "function cellClicked(elCell) {\n if (!gGame.isOn) return; // Died / won? return\n\n let cellCoords = getCellCoord(elCell.id);\n let currCell = gBoard[cellCoords.i][cellCoords.j];\n if (currCell.isShown) return; // If already shown - do nothing\n\n // If hint mode is on, show hint\n if (gGame.isHintOn) {\n showHint(gBoard, cellCoords);\n return;\n }\n\n // If marked, do nothing (placed here to allow hint for marked cells)\n if (currCell.isMarked) return;\n\n // If clicked on a mine, end game and return\n if (gBoard[cellCoords.i][cellCoords.j].isMine) {\n clickedOnMine();\n return;\n }\n\n // If a cell is legit, reveal and expand it, check for victory\n if (gGame.revealedCount === 0) gameStart(cellCoords); // If first click, start the game!\n expandShown(gBoard, cellCoords);\n checkVictory();\n}", "clickEvent(event) {\n if (!event.target.classList.contains(\"cell\")) return;\n const cellElement = event.target;\n console.log(cellElement);\n console.log(\"Row Index:\", cellElement.dataset.rowIndex, \"| Column Index:\", cellElement.dataset.colIndex);\n const rowIndex = Number(cellElement.dataset.rowIndex);\n const colIndex = Number(cellElement.dataset.colIndex);\n const clickedCell = this.findCellByIndexes(rowIndex, colIndex);\n const neighborCells = this.findSurroundingCells(rowIndex, colIndex);\n\n // const clickedCellBelow = this.findCellByIndexes(rowIndex + 1, colIndex);\n // const clickedCellBelowLeft = this.findCellByIndexes(rowIndex + 1, colIndex - 1);\n // const clickedCellBelowRight = this.findCellByIndexes(rowIndex + 1, colIndex + 1);\n // const clickedCellLeft = this.findCellByIndexes(rowIndex, colIndex - 1);\n // const clickedCellTopLeft = this.findCellByIndexes(rowIndex - 1, colIndex - 1);\n // const clickedCellTopRight = this.findCellByIndexes(rowIndex - 1, colIndex + 1);\n // const clickedCellTop = this.findCellByIndexes(rowIndex - 1, colIndex);\n console.log(neighborCells, \"yeah\");\n console.log(\"index\", clickedCell);\n // console.log(\"index below\", clickedCellBelow);\n // console.log(\"index below right\", clickedCellBelowRight);\n // console.log(\"index top left\", clickedCellTopLeft);\n // console.log(\"index top\", clickedCellTop);\n }", "addCellClickListener(callback) {\n this.cellClickListeners.push(callback);\n }", "function attachCellClickListeners() {\n $.each(grid[0].rows, function(i, row) {\n $.each(row.cells, function(j, cell) {\n $(cell).click(function changeColor() {\n var color = color_input();\n $(this).css({backgroundColor: color});\n });\n });\n });\n}", "function clickable(){\n var table = document.getElementById(\"table\"); // select the table\n var columns = table.getElementsByTagName('td'); // select al the `td` children of `table`\n for (i = 0; i < columns.length; i++) { // for each column\n if(columns[i].className == \"W\"){ // for each row, if the class is W (white)\n columns[i].addEventListener('click', mark); // set the event `addEventListener`\n // if the are others class inside the cell\n // (if the cell is already filled)\n // the click is denied\n }\n }\n}", "function cellClicked(elCell, i, j) {\n if (gState.isGameOn) {\n // build board data on first click\n if (!gState.markedCount){\n initMines(gBoard,i,j);\n setMinesNegsCount(gBoard); \n }\n if (!gBoard[i][j].isFlagged) {\n if (gBoard[i][j].isMine) {\n elCell.classList.add('mine','mark');\n } else {\n elCell.classList.add(getNumClass(gBoard[i][j].MineNegCnt));\n if (!elCell.classList.contains('mark')) {\n elCell.classList.add('mark');\n if (gState.markedCount === 0) gGameInterval = setInterval(updTime, 1000);\n gState.markedCount++;\n expandShown(gBoard, i, j);\n }\n }\n checkGameOver(i, j);\n }\n }\n}", "function delegatedCellClick ( event ) {\n\n\t\t\tif ( ACTIVE_CELL && event.target === ACTIVE_CELL ) {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tinterfaceClear();\n\t\t\t}\n\n\t\t\telse if ( isValidCellTarget(event.target) ) {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\thandleClickOnValidCell(event.target);\n\t\t\t}\n\t\t}", "function toggleCell (e) {\n var xy = d3.mouse(this);\n var cell = [scaleDown(xy[0]), scaleDown(xy[1])];\n settings.population.toggleCell(cell);\n displayCells(settings.population.liveCells(), settings);\n\n function scaleDown (n) {\n return Math.floor(n / settings.cellSize);\n }\n }", "function clickme(){\n\t\t//pop up with a message when the table is clicked\n\t\talert('Hey, you clicked me!');\n\t}", "function getCellPosition(){\r\n\tfor (var i = 0; i < squres.rows.length; i++) {\r\n\t\tfor (var j = 0; j < squres.rows[i].cells.length; j++) {\r\n\t\t\tsqures.rows[i].cells[j].onclick = function(){\r\n\t\t\t\tcurrentRow = this.parentElement.rowIndex;\r\n\t\t\t\tcurrentCol = this.cellIndex;\r\n\t\t\t\tprevCol = colPosition(currentCol);\r\n\t\t\t\tprevRow = rowPosition(currentRow);\r\n\t\t\t};\r\n\t\t\tconsole.log(\"click not working\");\r\n\t\t}\r\n\t}\r\n}", "function handleCellClick(e, args){\n e.preventDefault();\n selctedCell = args;\n \tvar model = window.multiview.model;\n \tvar fields = model.fields;\n var fieldID = grid.getColumns()[selctedCell.cell].field;\n var model = window.multiview.model;\n selectedField = model.fields.get(fieldID); \n \n \tif(selectedField.get(\"hostsInterlinkingResults\")){\n \t\t// A context menu is loaded containing other alternatives\n \t\t//TODO: getting results with an AJAX call\n \t\t\n \t\tvar originalFieldId = fields.at(fields.indexOf(selectedField) - 1).id;\n var ul = $(\"#termsMenu\");\n ul.empty();\n var originalValue = model.records.at(selctedCell.row).get(similarityResults[originalFieldId].field)\n var bestResults = JSON.parse(similarityResults[originalFieldId].results[selctedCell.row].terms);\n\n ul.append('<b>Choices:</b>')\n ul.append('<li id=\"originalOption\">Original Value: ' + originalValue + '</li> <hr />')\n $.each(bestResults, function (idx, item){\n \tul.append('<li id=\"termOption\" term=\"' + item.term + '\" score=\"' + item.score + '\">' +\n \t\t item.term + \" (score: \"+ (item.score*100) +\"%)\" + \"</li>\");\n })\n ul.append('<hr /><li id=\"finalizeOption\">Finalize interlinking</li>');\n ul.append('<hr /><li id=\"abortOption\" class=\"abort\">Abort interlinking</li>');\n \n $(\"#termsMenu\")\n \t.css(\"top\", e.pageY)\n \t.css(\"left\", e.pageX)\n \t.show();\n \n \t$(\"body\").click(function(e) {\n \t if (!$(e.target).hasClass(\"slick-cell\")){\n \t \t$(\"#termsMenu\").hide();\n \t }\n \t});\n \n \t} else{\n $(\"body\").one(\"click\", function () {\n $(\"#termsMenu\").hide();\n });\n \t}\n \t\n }", "function addClickEventToCells() {\n var cells = document.getElementsByClassName('cell');\n for (var i = 0; i < cells.length; i++) {\n cells[i].addEventListener(\"click\", function(event) {\n var chosenCell = event.target;\n chosenCell.style.backgroundColor = chosenColor;\n });\n }\n}", "function click_tile_callback(tile_info){\n console.log('tile callback');\n console.log('clicking on ' + tile_info.row + ' row and ' + tile_info.col + ' col with value ' + String(tile_info.value))\n }", "function cellClick(event) {\n // getting position of empty cell\n const emptyCell = getEmptyCell();\n const { target } = event;\n const targetClasses = target.className.split(' ');\n const position = targetClasses.find(name => /(x[1-4]y[1-4])/.test(name));\n // if block was not empty cell himself (empty cell don't have positioning class)\n if (position) {\n // position is string (e.g. x1y1) so we take x and y values from it and convert to number\n const x = Number(position[1]);\n const y = Number(position[3]);\n\n // check if clicked block is nearby empty cell\n if (\n ((x - 1 === emptyCell.x || x + 1 === emptyCell.x) && y === emptyCell.y)\n || ((y - 1 === emptyCell.y || y + 1 === emptyCell.y) && x === emptyCell.x)\n ) {\n // increase score and move clicked block to empty cell, check if game was won\n setScore(score + 1);\n target.classList.remove(position);\n target.classList.add(`x${emptyCell.x}y${emptyCell.y}`);\n checkWin();\n }\n }\n}", "function OnClick (event)\n{\n if (currSelCell == null)\n {\n currSelCell = event.target;\n event.target.style.backgroundColor = selectedColour;\n event.target.style.color = givenColour;\n }\n else\n {\n if (event.target == currSelCell)\n {\n if (currSelCell.getAttribute ('CellState') == 'error')\n event.target.style.backgroundColor = currSelCell.getAttribute ('ErrorBGColour');\n else\n event.target.style.backgroundColor = currSelCell.getAttribute ('OriginalBGColour');\n\n currSelCell = null;\n }\n else\n {\n if (currSelCell.getAttribute ('CellState') == 'error')\n currSelCell.style.backgroundColor = currSelCell.getAttribute ('ErrorBGColour');\n else\n currSelCell.style.backgroundColor = currSelCell.getAttribute ('OriginalBGColour');\n\n event.target.style.backgroundColor = selectedColour;\n currSelCell = event.target;\n } \n }\n}", "onCellClick({\n source: grid,\n record,\n cellSelector,\n cellElement,\n target,\n event\n }) {\n const selected = grid.focusedCell || {},\n column = grid.columns.getById(cellSelector.columnId); // Columns may provide their own handling of cell editing\n\n if (column.onCellClick) {\n column.onCellClick({\n grid,\n column,\n record,\n cellSelector,\n cellElement,\n target,\n event\n });\n } else if (target.closest('.b-tree-expander')) {\n this.cancelEditing();\n return false;\n } else if (DomHelper.isTouchEvent && cellSelector.id == selected.id && cellSelector.columnId == selected.columnId) {\n this.startEditing(cellSelector);\n } else if (this.triggerEvent === 'cellclick') {\n this.onTriggerEditEvent({\n cellSelector\n });\n }\n }", "function notifyClick(event) {\n var $cell = $(this);\n var numberOnCell = parseInt($cell.text(), 10);\n\n // Ignore the invalid click\n if(! isValidClick(numberOnCell))\n return;\n\n // Move the cells\n moveCell(getRowNumber(numberOnCell), getColumnNumber(numberOnCell));\n var isBoardSolved = isSolvedFn();\n\n if(isBoardSolved) {\n if (confirm('Yay! You solved the puzzle. \\n Want to play another game?')) {\n initializeboard();\n drawBoard();\n } else {\n return;\n }\n }\n\n }", "function cellsClicked(e) {\n if (gameOver == true) {\n clearBoard();\n return;\n } else if (event.target.textContent) {\n messageBox.textContent = \"That square is already taken!\";\n return;\n }\n if (playersTurn % 2 == 0) {\n e.target.textContent = ' X ';\n } else {\n e.target.textContent = ' 0 ';\n }\n //Run the function to check who turn it is every click\n checkPlayersTurn();\n //Run function to check if their is a winner every click\n checkWinner();\n}", "function cellClicked(i, j) {\n if (gGame.isManualOn) {\n addMinesManually(i, j);\n return;\n }\n if (!gGame.shownCount && !gGame.isManualOn && !gManualMode) {\n gGame.isOn = true;\n beginGame(i, j);\n }\n if (gGame.isHintOn) {\n revealHint({ i: i, j: j });\n return;\n }\n updateState();\n if (!gBoard[i][j].isShown && gGame.isOn) {\n // gBoard[i][j].isShown = true;\n // gGame.shownCount++;\n recursiveOpenCells(i, j);\n }\n renderBoard(gBoard);\n if (gBoard[i][j].isMine) {\n gGame.lives--;\n document.querySelector('.lives').innerText = 'Lives: ' + gGame.lives;\n renderSmiley(false);\n if (!gGame.lives) {\n renderSmiley(false);\n finishGame(false);\n }\n }\n}", "_onClick(e){if(e.defaultPrevented){// Something has handled this click already, e. g., <vaadin-grid-sorter>\nreturn}const path=e.composedPath(),cell=path[path.indexOf(this.$.table)-3];if(!cell||-1<cell.getAttribute(\"part\").indexOf(\"details-cell\")){return}const cellContent=cell._content,activeElement=this.getRootNode().activeElement,cellContentHasFocus=cellContent.contains(activeElement)&&(// MSIE bug: flex children receive focus. Make type & attributes check.\n!this._ie||this._isFocusable(activeElement));if(!cellContentHasFocus&&!this._isFocusable(e.target)){this.dispatchEvent(new CustomEvent(\"cell-activate\",{detail:{model:this.__getRowModel(cell.parentElement)}}))}}", "function cellLeftClickHandler() {\n\n let rowCol = cellIdNumToRowCol(parseInt((this.id).substring(1)), currentGridWidth);\n let row = rowCol[0], col = rowCol[1];\n\n let changeFirstTime = clickFirstTime;\n while (clickFirstTime && grid[row][col].isMine) {\n // console.log('reconfiguring mine board');\n resetBoard();\n }\n\n // mechanism to make timer call only once\n // start timer on the very very first click\n clickFirstTime = false;\n if (changeFirstTime != clickFirstTime) {\n if (gameTimeInSec == 0) {\n gameTimeInSec = 1;\n gameTimerDisplay.innerHTML = gameTimeInSec;\n }\n timer();\n }\n\n // if cell hasn't been clicked -> update UI to make the cell visible\n if (!grid[row][col].isVisible) {\n setVisible(row, col, currentGridWidth, currentGridHeight, gameSvg);\n }\n}", "function handleClick(e) {\n\tconst cell = e.target\n\tconst currentClass = oTurn ? oClass : xClass \n\tplaceMark(cell, currentClass)\n\tif (checkWin(currentClass)) {\n\t\tendGame(false)\n\t} else if (isDraw()) {\n\t\tendGame(true)\n\t} else {\n\t\tswapTurns()\n\t}\n}", "function addClickEventToCells() {\n var box = document.getElementsByClassName('cell');\n for (x = 0; x < box.length; x++) {\n box[x].addEventListener(\"click\", function(event) {\n var selectedBox = event.target;\n selectedBox.style.backgroundColor = selectedColor;\n });\n }\n}", "onLeftClick( event ) {\r\n let cell = event.target.dataMine;\r\n\r\n if (this.state == STATES.idle) {\r\n this.startGame(cell);\r\n }\r\n\r\n if (this.mode == MODES.dig ) {\r\n this.digCell(cell);\r\n }\r\n else {\r\n this.flagCell(cell);\r\n } \r\n }", "function giveCellsClick() {\n if(turn)\n {\n player = whitePlayer;\n }\n else\n {\n player = blackPlayer;\n }\n cells.forEach(cell => {\n cell.addEventListener('click', () =>\n { \n i = cell.closest('tr').rowIndex;\n j = cell.cellIndex;\n if(board[i][j] == 0 && player.possiblemoves[i][j] == 1)\n { \n if(HumanIsWhite)\n {\n placePiece(i, j, \"white\");\n }\n else\n {\n placePiece(i, j, \"black\");\n }\n \n }\n }); \n });\n}", "function cellClick(cell) {\r\n\t\r\n\t\t//check if there is a winner\r\n\t\t//decrease the number of cells to click\r\n\t\tif (!gameOver && cell.innerHTML == \" \") {\r\n\t\t\tcell.innerHTML = player;\r\n\t\t\tcleanBgColor();\r\n\t\t\tcell.style.backgroundColor = 'lightBlue';\r\n\t\t\tif (player == \"X\") {\r\n\t\t\t\tplayer = \"O\";\r\n\t\t\t\tsetMessage(\"It's \" + player +\"'s turn\");\r\n\t\t\t}else{\r\n\t\t\t\tplayer = \"X\";\r\n\t\t\t\tsetMessage(\"It's \" + player +\"'s turn\");\r\n\t\t\t}empty--;\r\n\t\t\tcheckWinner();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tsetMessage(\"Wrong move\");\r\n\t\t}\r\n\t}", "function handleClick(evt) {\n // get x from ID of clicked cell\n let x = +evt.target.id[6];\n\n // get next spot in column (if none, ignore click)\n let y = findSpotForCol(x);\n if (y === null) {\n return;\n }\n\n // place piece in board and add to HTML table\n // TODO: add line to update in-memory board\n placeInTable(y, x);\n\n // check for win\n if (checkForWin()) {\n return endGame(`Player ${currPlayer} won!`);\n }\n\n // check for tie\n // TODO: check if all cells in board are filled; if so call, call endGame\n if (board[0].every(cell => cell !== null)){\n endGame();\n }\n\n // switch players\n currPlayer = currPlayer === 1 ? 2 : 1;\n}", "function setCell(cell){\n cell.style.backgroundColor = \"white\"; //default white background\n\n //add eventlistener of click & change color\n cell.addEventListener(\"click\", function(evt){\n targetCell = evt.target;\n colorSelected = document.getElementById(\"selectedID\").value;\n targetCell.style.backgroundColor = colorSelected;\n });\n}", "function tdDblClick(e) {\n self.onCellDblClick(e.target);\n }", "function clickme(){\n //alert when the table is clicked\n\t\t alert('Hey, you clicked me!');\n\t ;\n\n\t $('table').on('click', clickme);\n\n }", "function handleClick(evt) {\n // get x from ID of clicked cell\n let x = +evt.target.id;\n\n // get next spot in column (if none, ignore click)\n let y = findSpotForCol(x,board);\n if (y === null) {\n console.log(\"End of game board reached\");\n return;\n }\n\n // place piece in board and add to HTML table\n placeInTable(x, y,currPlayer);\n board[x][y] = currPlayer;\n\n turnResolution();\n\n //if current player is a computer player, computer analyzes the board for both players and decides a defensive play if necessary otherwise picks an offensive player\n if (computerPlayer === currPlayer){\n computerPlays();\n turnResolution();\n }\n}", "function clickedCourse(){\n\t $(\"#course_table #rows\").click(function(e){\n\t \tvar course_id = $(this).find('td:eq(0)').text();\n\t \tcourseInfo(course_id);\n\t });\t\n\t}", "function handleCellClick(divObj) {\n\tif (RUNNING == false) {\n\t\tconsole.log(divObj.className);\n\t\tif (divObj[0].className == ALIVE_CLASS) {\n\t\t\tdivObj[0].className = DEAD_CLASS; //index in at 0 since only one element will be returned\n\t\t}\n\t\telse { //dead\n\t\t\tdivObj[0].className = ALIVE_CLASS;\n\t\t}\n\t}\n\t//do nothing if running\n}", "function clickCell(x,y) {\n if (grid[x][y]>0) {\n alert(\"Dont Try To Cheat Bud!!!!!\");\n } \n\n\n// Clicking Of Boxes\n else {\n if (currentPlayer==1) {\n document.getElementById(\"cell_\"+x+\"_\"+y).style.color=\"#3F88C5\";\n document.getElementById(\"cell_\"+x+\"_\"+y).innerHTML=\"X\";\n grid[x][y]=1;\n currentPlayer=2;\n } else {\n document.getElementById(\"cell_\"+x+\"_\"+y).style.color=\"#E2C290\";\n document.getElementById(\"cell_\"+x+\"_\"+y).innerHTML=\"O\";\n grid[x][y]=2;\n currentPlayer=1;\n }\n }\n}", "function onCanvasMouseUp() {\n window.mouseDown = false;\n window.lastCellClicked = null;\n}", "handleClick(evt) {\n // get x from ID of clicked cell\n const x = +evt.target.id;\n\n // get next spot in column (if none, ignore click)\n const y = this.findSpotForCol(x);\n if (y === null) {\n return;\n }\n\n // place piece in board and add to HTML table\n this.board[y][x] = this.currPlayer;\n this.placeInTable(y, x);\n\n // check for win\n if (this.checkForWin()) {\n this.gameOver = true;\n return this.endGame(`${this.currPlayer.name} won!`);\n }\n\n // check for tie\n if (this.board.every(row => row.every(cell => cell))) {\n return this.endGame('Tie!');\n }\n\n // switch players\n this.currPlayer = this.currPlayer === this.players[0] ? this.players[1] : this.players[0];\n }", "function col4_onClick(e, obj){\n this.cell.childNodes[0].innerHTML = this.cell.previousSibling.childNodes[0].innerHTML;\n var a=this.cell.id.split(/_/);\n var l=a.length;\n var r=parseInt(a[l-2]);\n var c=parseInt(a[l-1]);\n// oPreciosProv.rowHighlight(r+oPreciosProv.headerRowCnt);\n oPreciosProv.rowIdx = r;\n oPreciosProvEd.rowIdx = r;\n if (oPreciosProv.lastEditedRow <0) {\n oPreciosProvEd.grid.lastEditedRow=r;\n oPreciosProvEd.editRecord();\n }\n}", "function onClick(event) {\n for(let i=0; i<(rows*cols); ++i) {\n //Add start cell \n if(cells[i] == event.target && cells[i].contains(event.target) && currentKey == 83 && start == null) {\n cells[i].style.backgroundColor = \"blue\"\n start = cells[i];\n }\n //Add end cell \n else if(cells[i] == event.target && cells[i].contains(event.target) && currentKey == 69 && end == null) {\n cells[i].style.backgroundColor = \"red\"\n end = cells[i];\n }\n \n }\n}", "doOnClickJumpToCode(row) {\n let lineData = {lineNumber: this.rows[row.$index].range.start.row + 1};\n this.eventAggregator.publish(\"traceSearchGotoLine\", lineData);\n }", "function checkSquare() {\n $(document).ready(function( ) {\n $(\"td\").bind(\"click\", function(){\n if ($(this).text() == \"X\"){\n alert(\"It has been selected!\");\n }\n if ($(this).text() == \"O\"){\n alert(\"It has been selected!\");\n }\n });\n });\n }", "clicked(x, y) {}", "function handleClick(evt) {\n\t// get \"x\" coordinate from ID of clicked cell\n\tconst x = +evt.target.id;\n\n\t// get next spot in column (if none, ignore click)\n\tlet y = findSpotForCol(x);\n\tif (y === null) {\n\t\treturn;\n\t}\n\n\t// place piece in board and add to HTML table\n\t// TODO: add line to update in-memory board\n\tboard[y][x] = currPlayer;\n\tplaceInTable(y, x);\n\n\t// check for win\n\tif (checkForWin()) {\n\t\treturn endGame(`Player ${currPlayer} won!`);\n\t}\n\n\t// check for tie\n\t// TODO: check if all cells in board are filled; if so call, call endGame\n\tlet tie = board.every(function(val) {\n\t\treturn val > 0;\n\t});\n\tif (tie) {\n\t\tendGame('Game is a TIE! Play again.');\n\t}\n\n\tswitchPlayers();\n}", "function handleClick(evt) {\n // get x from ID of clicked cell\n let x = +evt.target.id;\n\n // get next spot in column (if none, ignore click)\n let y = findSpotForCol(x);\n if (y === null) {\n return;\n }\n\n // place piece in board and add to HTML table\n // TODO: add line to update in-memory board\n BOARD[y][x] = currPlayer;\n placeInTable(y, x);\n\n // check for win\n if (checkForWin()) {\n return endGame(`Player ${currPlayer} won!`);\n }\n\n // check for tie\n // TODO: check if all cells in board are filled; if so call, call endGame\n if (BOARD[0].every(ele => ele)) {\n return endGame('Tie game!')\n }\n \n\n // switch players\n // TODO: switch currPlayer 1 <-> 2\n (currPlayer === 1) ? currPlayer = 2 : currPlayer = 1;\n}", "function handleClick(evt) {\n\n // get x from ID of clicked cell\n const x = +evt.target.id;\n\n // get next spot in column (if none, ignore click)\n const y = findSpotForCol(x);\n if (y === null) {\n return;\n }\n\n // place piece in board and add to HTML table\n board[y][x] = currPlayer;\n placeInTable(y, x);\n\n\n // check for win\n if (checkForWin()) {\n return endGame(`Player ${currPlayer} won!`);\n }\n\n // check for tie\n if(board.every(arr => arr.every(cell => cell === typeof Array))){\n return endGame(`This game is a tie.`);\n }\n\n // switch players\n (currPlayer === 1) ? currPlayer = 2 : currPlayer = 1; // switch players\n}", "function handleClick() {\n const cell = event.target;\n const id = cell.dataset.id;\n if (isCellValid(id)) {\n cell.textContent = currentPlayer;\n currentCells[id] = currentPlayer;\n if (checkWin()) {\n board.endGame(false);\n } else if (checkDraw()) {\n board.endGame(true);\n }\n else {\n togglePlayer();\n }\n }\n}", "function addClickEventToCells() {\n const cells = document.getElementsByClassName(\"cell\");\n for (let i = 0; i < cells.length; i++) {\n cells[i].addEventListener('click', function (event) {\n let clickedCell = event.target;\n clickedCell.style.backgroundColor = inputColor.value;\n });\n };\n}", "function setCellClickHandlers(){\r\n\r\n\tvar cells = document.getElementsByTagName(\"td\");\r\n\r\n\tfor(var i = 0; i < cells.length; i++){\r\n\r\n\t\tcells[i].onclick = function(){\r\n\r\n\t\t\tvar row = this.dataset.row;\r\n\t\t\tvar col = this.dataset.column;\r\n\t\t\tvar gridTable = document.getElementsByTagName(\"table\")[0];\r\n\t\t\tvar cell = gridTable.rows[row].cells[col];\r\n\t\t\tdocument.getElementById(\"errorDiv\").innerHTML = \"\";\r\n\r\n\t\t\t//First click\r\n\t\t\tif(chipSelected == false){\r\n\r\n\t\t\t\t//Black turn\r\n\t\t\t\tif(gameState.turn == BLACK){\r\n\r\n\t\t\t\t\tif(this.dataset.checkChip == BLACK || this.dataset.checkChip == BLACKKING){\r\n\r\n\t\t\t\t\t\tprevColor = this.style.background;\r\n\t\t\t\t\t\tprevRow = row;\r\n\t\t\t\t\t\tprevCol = col;\r\n\t\t\t\t\t\tprevCell = cell;\r\n\t\t\t\t\t\tprevChip = this.dataset.checkChip;\r\n\t\t\t\t\t\tthis.style.background = selectedColor;\r\n\t\t\t\t\t\tchipSelected = true;\r\n\t\t\t\t\t\t//Call chipPossMoves and store in firstClickPossMovesArr\r\n\t\t\t\t\t\tvar selectedChip = gameState.checkArr[this.dataset.row][this.dataset.column];\r\n\t\t\t\t\t\tfirstClickMovesArr = chipPossMoves(selectedChip, cell);\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\t//Error message\r\n\t\t\t\t\t\tdocument.getElementById(\"errorDiv\").innerHTML = \"ERROR: Please select a Black Chip\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//Grey turn\r\n\t\t\t\telse{\r\n\r\n\t\t\t\t\tif(this.dataset.checkChip == GREY || this.dataset.checkChip == GREYKING){\r\n\r\n\t\t\t\t\t\tprevColor = this.style.background;\r\n\t\t\t\t\t\tprevRow = row;\r\n\t\t\t\t\t\tprevCol = col;\r\n\t\t\t\t\t\tprevCell = cell;\r\n\t\t\t\t\t\tprevChip = this.dataset.checkChip;\r\n\t\t\t\t\t\tthis.style.background = selectedColor;\r\n\t\t\t\t\t\tchipSelected = true;\r\n\t\t\t\t\t\t//Call chipPossMoves and store in firstClickPossMovesArr\r\n\t\t\t\t\t\tvar selectedChip = gameState.checkArr[this.dataset.row][this.dataset.column];\r\n\t\t\t\t\t\tfirstClickMovesArr = chipPossMoves(selectedChip, cell);\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tdocument.getElementById(\"errorDiv\").innerHTML = \"ERROR: Please select a Grey Chip\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//Second click\r\n\t\t\telse{\r\n\r\n\t\t\t\t//Check to see if selected cell is in the firstClickPossMovesArr[]\r\n\t\t\t\tvar validMove = false;\r\n\t\t\t\tvar normMovesLength = firstClickMovesArr[0].length;\r\n\t\t\t\tvar jumpMovesLength = firstClickMovesArr[1].length;\r\n\r\n\t\t\t\tfor(var i = 0; i < normMovesLength; i++){\r\n\r\n\t\t\t\t\tif(firstClickMovesArr[0][i] == cell){\r\n\r\n\t\t\t\t\t\tvalidMove = true;\r\n\r\n\t\t\t\t\t\t//Black chip hitting King row\r\n\t\t\t\t\t\tif(cell.dataset.row == 7 && prevCell.dataset.checkChip == 1){\r\n\r\n\t\t\t\t\t\t\tcell.innerHTML = BLACKKINGDIV;\r\n\t\t\t\t\t\t\tprevCell.innerHTML = \"\";\r\n\t\t\t\t\t\t\tprevCell.style.background = prevColor;\r\n\t\t\t\t\t\t\tprevCell.dataset.checkChip = 0;\r\n\t\t\t\t\t\t\tthis.dataset.checkChip = BLACKKING;\r\n\r\n\t\t\t\t\t\t\tgameState.checkArr[this.dataset.row][this.dataset.column] =\r\n\t\t\t\t\t\t\tgameState.checkArr[prevCell.dataset.row][prevCell.dataset.column];\r\n\t\t\t\t\t\t\tgameState.checkArr[prevCell.dataset.row][prevCell.dataset.column] = 0;\r\n\t\t\t\t\t\t\tgameState.checkArr[this.dataset.row][this.dataset.column].king = true;\r\n\r\n\r\n\r\n\t\t\t\t\t\t\tchipSelected = false;\r\n\t\t\t\t\t\t\tif(gameState.turn == BLACK) gameState.turn = GREY;\r\n\t\t\t\t\t\t\telse gameState.turn = BLACK;\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t//Grey chip hitting King row\r\n\t\t\t\t\t\telse if(cell.dataset.row == 0 && prevCell.dataset.checkChip == 2){\r\n\r\n\t\t\t\t\t\t\tcell.innerHTML = GREYKINGDIV;\r\n\t\t\t\t\t\t\tprevCell.innerHTML = \"\";\r\n\t\t\t\t\t\t\tprevCell.style.background = prevColor;\r\n\t\t\t\t\t\t\tprevCell.dataset.checkChip = 0;\r\n\t\t\t\t\t\t\tthis.dataset.checkChip = GREYKING;\r\n\r\n\t\t\t\t\t\t\tgameState.checkArr[this.dataset.row][this.dataset.column] =\r\n\t\t\t\t\t\t\tgameState.checkArr[prevCell.dataset.row][prevCell.dataset.column];\r\n\t\t\t\t\t\t\tgameState.checkArr[prevCell.dataset.row][prevCell.dataset.column] = 0;\r\n\t\t\t\t\t\t\tgameState.checkArr[this.dataset.row][this.dataset.column].king = true;\r\n\r\n\r\n\t\t\t\t\t\t\tchipSelected = false;\r\n\t\t\t\t\t\t\tif(gameState.turn == BLACK) gameState.turn = GREY;\r\n\t\t\t\t\t\t\telse gameState.turn = BLACK;\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t//Normal movement\r\n\t\t\t\t\t\telse{\r\n\r\n\t\t\t\t\t\tcell.innerHTML = prevCell.innerHTML;\r\n\t\t\t\t\t\tprevCell.innerHTML = \"\";\r\n\t\t\t\t\t\tprevCell.style.background = prevColor;\r\n\t\t\t\t\t\tprevCell.dataset.checkChip = 0;\r\n\t\t\t\t\t\tthis.dataset.checkChip = prevChip;\r\n\r\n\t\t\t\t\t\tgameState.checkArr[this.dataset.row][this.dataset.column] =\r\n\t\t\t\t\t\tgameState.checkArr[prevCell.dataset.row][prevCell.dataset.column];\r\n\t\t\t\t\t\tgameState.checkArr[prevCell.dataset.row][prevCell.dataset.column] = 0;\r\n\r\n\t\t\t\t\t\t//Need to update chipSelected no matter where they click\r\n\t\t\t\t\t\tchipSelected = false;\r\n\t\t\t\t\t\tif(gameState.turn == BLACK) gameState.turn = GREY;\r\n\t\t\t\t\t\telse gameState.turn = BLACK;\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}//End for\r\n\r\n\t\t\t\t//Second for-loop to test jump cells\r\n\t\t\t\tfor(var i = 1; i < jumpMovesLength; i++){\r\n\r\n\t\t\t\t\tif(firstClickMovesArr[1][i] == cell){\r\n\r\n\t\t\t\t\t\tvalidMove = true;\r\n\r\n\t\t\t\t\t\t//Black chip jumping and hitting King row\r\n\t\t\t\t\t\tif(cell.dataset.row == 7 && prevCell.dataset.checkChip == 1){\r\n\r\n\t\t\t\t\t\t\tcell.innerHTML = BLACKKINGDIV;\r\n\t\t\t\t\t\t\tprevCell.innerHTML = \"\";\r\n\t\t\t\t\t\t\tprevCell.style.background = prevColor;\r\n\t\t\t\t\t\t\tprevCell.dataset.checkChip = 0;\r\n\t\t\t\t\t\t\tthis.dataset.checkChip = BLACKKING;\r\n\r\n\t\t\t\t\t\t\tgameState.checkArr[this.dataset.row][this.dataset.column] =\r\n\t\t\t\t\t\t\tgameState.checkArr[prevCell.dataset.row][prevCell.dataset.column];\r\n\t\t\t\t\t\t\tgameState.checkArr[prevCell.dataset.row][prevCell.dataset.column] = 0;\r\n\t\t\t\t\t\t\tgameState.checkArr[this.dataset.row][this.dataset.column].king = true;\r\n\r\n\t\t\t\t\t\t var currChip = gameState.checkArr[this.dataset.row][this.dataset.column];\r\n\t\t\t\t\t\t jump(firstClickMovesArr[1][i], firstClickMovesArr[1][i-1], currChip);\r\n\r\n\r\n\t\t\t\t\t\t\tchipSelected = false;\r\n\t\t\t\t\t\t\tif(gameState.turn == BLACK) gameState.turn = GREY;\r\n\t\t\t\t\t\t\telse gameState.turn = BLACK;\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t//Grey chip hitting King row\r\n\t\t\t\t\t\telse if(cell.dataset.row == 0 && prevCell.dataset.checkChip == 2){\r\n\r\n\t\t\t\t\t\t\tcell.innerHTML = GREYKINGDIV;\r\n\t\t\t\t\t\t\tprevCell.innerHTML = \"\";\r\n\t\t\t\t\t\t\tprevCell.style.background = prevColor;\r\n\t\t\t\t\t\t\tprevCell.dataset.checkChip = 0;\r\n\t\t\t\t\t\t\tthis.dataset.checkChip = GREYKING;\r\n\r\n\t\t\t\t\t\t\tgameState.checkArr[this.dataset.row][this.dataset.column] =\r\n\t\t\t\t\t\t\tgameState.checkArr[prevCell.dataset.row][prevCell.dataset.column];\r\n\t\t\t\t\t\t\tgameState.checkArr[prevCell.dataset.row][prevCell.dataset.column] = 0;\r\n\t\t\t\t\t\t\tgameState.checkArr[this.dataset.row][this.dataset.column].king = true;\r\n\r\n\t\t\t\t\t\t var currChip = gameState.checkArr[this.dataset.row][this.dataset.column];\r\n\t\t\t\t\t\t jump(firstClickMovesArr[1][i], firstClickMovesArr[1][i-1], currChip);\r\n\r\n\r\n\t\t\t\t\t\t\tchipSelected = false;\r\n\t\t\t\t\t\t\tif(gameState.turn == BLACK) gameState.turn = GREY;\r\n\t\t\t\t\t\t\telse gameState.turn = BLACK;\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t//Normal jump movement\r\n\t\t\t\t\t\telse{\r\n\r\n\t\t\t\t\t\tcell.innerHTML = prevCell.innerHTML;\r\n\t\t\t\t\t\tprevCell.innerHTML = \"\";\r\n\t\t\t\t\t\tprevCell.style.background = prevColor;\r\n\t\t\t\t\t\tprevCell.dataset.checkChip = 0;\r\n\t\t\t\t\t\tthis.dataset.checkChip = prevChip;\r\n\r\n\t\t\t\t\t\tgameState.checkArr[this.dataset.row][this.dataset.column] =\r\n\t\t\t\t\t\tgameState.checkArr[prevCell.dataset.row][prevCell.dataset.column];\r\n\t\t\t\t\t\tgameState.checkArr[prevCell.dataset.row][prevCell.dataset.column] = 0;\r\n\r\n\t\t\t\t\t\tvar currChip = gameState.checkArr[this.dataset.row][this.dataset.column];\r\n\t\t\t\t\t\tjump(firstClickMovesArr[1][i], firstClickMovesArr[1][i-1], currChip);\r\n\r\n\t\t\t\t\t\tchipSelected = false;\r\n\t\t\t\t\t\tif(gameState.turn == BLACK) gameState.turn = GREY;\r\n\t\t\t\t\t\telse gameState.turn = BLACK;\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}//End for\r\n\r\n\t\t\t\tif(validMove == false){\r\n\t\t\t\t\tdocument.getElementById(\"errorDiv\").innerHTML = \"ERROR: Invalid move\";\r\n\t\t\t\t\tprevCell.style.background = prevColor;\r\n\t\t\t\t\tchipSelected = false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfirstClickMovesArr = null;\r\n\r\n endGame();\r\n\r\n\t\t\t}//End Second Click\r\n\r\n\t\t}//End onclick\r\n\r\n\t}//End for\r\n\r\n}", "function handleClick(evt) {\n\tif (gameLive === true) {\n\t\t// get x from ID of clicked cell\n\t\tconst x = +evt.target.id;\n\t\tconst top = document.querySelector('#column-top');\n\t\t\n\n\t\t// get next spot in column (if none, ignore click)\n\t\tconst y = findSpotForCol(x);\n\t\tif (y === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// place piece in board and add to HTML table\n\t\t// TODO: add line to update in-memory board\n\t\tplaceInTable(y, x);\n\t\tboard[y][x] = currPlayer;\n\t\ttop.classList.toggle('p1');\n\t\t// check for win\n\t\t// check if there is a winner, if so it will run function endgame with the winner player\n\t\tif (checkForWin()) {\n\t\t\treturn endGame(`Player ${currPlayer} won!`);\n\t\t}\n\n\t\t// check for tie\n\t\t// TODO: check if all cells in board are filled; if so call, call endGame\n\t\tif (board.every((row) => row.every((cell) => cell))) {\n\t\t\treturn endGame('Game is a Tie!');\n\t\t}\n\n\t\t// switch players\n\t\t// TODO: switch currPlayer 1 <-> 2\n\t\tcurrPlayer = currPlayer === 1 ? 2 : 1;\n\t}\n\treturn;\n}", "function handleClick(evt) {\n // get col from ID of clicked cell\n let col = +evt.target.id;\n\n // get the row available in column (if none, ignore click)\n let row = findSpotForCol(col);\n if (row === null) {\n return;\n }\n\n\n // place piece in board and add to HTML table\n placeInTable(row, col);\n\n // also adding undo button\n let htmlPieces = document.getElementsByClassName(\"piece\");\n if (htmlPieces.length > 0) {\n document.querySelector(\".undo\").classList.add(\"visible\");\n }\n\n board[row][col] = currPlayer === 1 ? PLAYER_ONE_COLOR : PLAYER_TWO_COLOR;\n\n // check for win\n if (checkForWin()) {\n return endGame(`Player ${currPlayer} won!`);\n }\n\n // check for tie\n if(isTie()) {\n return endGame(\"It's a tie!\");\n }\n\n// switch players\ncurrPlayer = (currPlayer === 1) ? 2 : 1;\n}", "function handleClick(evt) {\n // get x from ID of clicked cell\n let x = +evt.target.id;\n\n // get next spot in column (if none, ignore click)\n let y = findSpotForCol(x);\n if (y === null) {\n return;\n }\n\n // place piece in board and add to HTML table\n // adds line to update in-memory board\n // y,x coordinates at the current player's selection\n board[y][x] = currPlayer;\n // adds selection to the board as current player\n placeInTable(y, x);\n\n // check for win\n if (checkForWin()) {\n // runs end game function w/ message\n return endGame(`Player ${currPlayer} won!`);\n }\n\n // check for tie\n // checks if all cells in board are filled; if so call, call endGame\n if (board.every(row => row.every(cell => cell))) {\n return endGame('Tie!');\n }\n // switch players\n // switch currPlayer 1 <-> 2\n currPlayer = currPlayer === 1 ? 2 : 1;\n\n}", "function handleCellClick(event, rowIndex, cellIndex){\n\n if(gameState.board[rowIndex][cellIndex] == null ){\n gameState.board[rowIndex][cellIndex] = gameState.players[gameState.currentPlayerIndex];\n changeTurn();\n renderBoard();\n if(checkWin()){\n //do something\n alert(\"We; have a winner\")\n console.log(gameState)\n } else if(checkDraw()){\n alert(`We have a draw`)\n }\n }\n\n}", "serverKnowsAsFocusedCell() {\n\n }", "handleClick(evt) {\n // get x from ID of clicked cell\n const x = +evt.target.id;\n\n // get next spot in column (if none, ignore click)\n const y = this.findSpotForCol(x);\n if (y === null) {\n return;\n }\n\n // place piece in board and add to HTML table\n this.board[y][x] = this.currPlayer;\n this.placeInTable(y, x);\n\n // check for tie\n if (this.board.every(row => row.every(cell => cell))) {\n return this.endGame('Tie!');\n }\n\n // check for win\n if (this.checkForWin()) {\n this.gameOver = true;\n return this.endGame(`The ${this.currPlayer.color} player won!`);\n }\n\n // switch players\n this.currPlayer =\n this.currPlayer === this.players[0] ? this.players[1] : this.players[0];\n }", "function _handleClickEvent(e){\n const cellID = e.target.getAttribute('id');\n const cellIndex = cellID.slice(5);\n\n if(gameBoard.state[cellIndex]){\n return;\n }\n\n //deciding turn based on how many cells were actually filled\n let filledCells = gameBoard.state.filter(cell => cell);\n let cellValue = filledCells.length % 2 === 0 ? 'X' : 'O';\n\n //updating the array and the display\n gameBoard.state[cellIndex] = cellValue;\n e.target.textContent = cellValue;\n\n gameFlow.checkWinner();\n }", "function clickCell() {\n $(\".cell\").click(function() {\n var id = $(this).attr('id');\n //console.log(typeof id);\n var x = id[0];\n var y = id[1];\n board.play(parseInt(x), parseInt(y));\n if (board.turn % 2 === 1) {\n $(this).html('<p class=\"move\">x</p>'); \n } else if (board.turn % 2 === 0) {\n $(this).html('<p class=\"move\">o</p>'); \n }\n setTimeout(function() {\n endGame();}, 1700);\n })\n}", "function cellClick(cells){\n console.log('clicked'+cells.target.id);\n var cellid;\n if(isChallenge){\ncellid=cells.target.id.substr(5);\n }else{\n cellid=cells.target.id;\n }\n if(typeof boardList[cellid]=='number'){\n Currcell=cellid;\n if(emptycells().length==boardSize){\n startTimer();\n }\n gameTurn(cellid,currPlayer);\n if(($(\".endgame\").css('display')=='none')){\n if(!checkDraw()){\n if($(\".endgame\").css('display')=='none'){\n if(isTwoMode){\n if(currPlayer==player){\n currPlayer=secondPlayer;\n }else{\n currPlayer=player;\n } \n }else{\n gameTurn(bestMove(),computer);\n if(emptycells().length==0&&($(\".endgame\").css('display')=='none')){\n checkDraw();\n }\n \n } \n }\n }\n } \n } \n}", "function handleClick(event) {\n\t// get x from ID of clicked cell\n\tconst x = +event.target.id;\n\n\t// get next spot in column (if none, ignore click)\n\tconst y = findSpotForCol(x);\n\tif (y === null) return;\n\n\t// place piece in board and add to HTML table\n\tboard[y][x] = currPlayer;\n\tplaceInTable(y, x);\n\n\t// check for win\n\tif (checkForWin()) return endGame(`Player ${currPlayer} won!`);\n\n\t// check for tie\n\tconst checkForTie = board[0].every((cell) => cell);\n\tif (checkForTie) return endGame('The game is a tie!');\n\n\t// switch players 1 <-> 2\n\t// [currPlayer, nextPlayer] = [nextPlayer, currPlayer];\n\tcurrPlayer = currPlayer % 2 + 1;\n}", "function onEventListViewGridDoubleClick(grid, rowIndex, e) {alert('hi');\n //e.stopEvent();\n //var coords = e.getXY();\n alert(grid.store.getAt(rowIndex).json.id);\n displayEventViewPanel(rowIndex);\n}", "onElementClick(event) {\n const\n me = this,\n target = event.target,\n cellData = me.grid.getCellDataFromEvent(event),\n clickedExpander = target.closest('.b-tree-expander');\n\n // Checks if click is on node expander icon, then toggles expand/collapse. Also toggles on entire cell if expandOnCellClick is true\n if (clickedExpander || (me.expandOnCellClick && cellData && cellData.record.isParent)) {\n clickedExpander && event.preventDefault();\n\n me.toggleCollapse(cellData.record);\n }\n }", "function clickTable(tr, td, e) {\n\t\n\tif (td.attr('type') != null) {\n\t\n\t\t// COLOR\n\t\t$('#table tr td').css('color', '');\n\t\ttd.css('color', 'red');\n\t\t\n\t\t// OPEN INFO WINDOW\n\t\t//$('#floatWindow').fadeOut('fast');\n\t\t$('#floatWindow').css({top:e.pageY+20,left:e.pageX});\n\t\t$('#floatWindow').fadeIn('fast');\n\t\t\n\t\t// CLEAR INFO\n\t\t$('#textInfo').html('');\n\t\t\n\t\t// SHOW INFO\n\t\tshowInfo(td.attr('type'), td.attr('id'));\n\t}\n}" ]
[ "0.77602804", "0.76863885", "0.76629746", "0.7433937", "0.7337495", "0.7318651", "0.7271263", "0.7270575", "0.72393847", "0.72393847", "0.72236615", "0.72215426", "0.71854264", "0.71683455", "0.71220696", "0.7071764", "0.70253825", "0.7017108", "0.70153993", "0.7011232", "0.69583404", "0.69425625", "0.69069153", "0.68643016", "0.68465805", "0.68413836", "0.6825051", "0.68190795", "0.68030727", "0.6794917", "0.6761417", "0.6759767", "0.6750926", "0.672905", "0.6727417", "0.6718762", "0.6707691", "0.6706486", "0.6706081", "0.6704125", "0.6701626", "0.66984814", "0.6690226", "0.66810423", "0.6679115", "0.6659173", "0.66480523", "0.66443604", "0.663078", "0.6626615", "0.662468", "0.6615651", "0.6605393", "0.66028893", "0.65868163", "0.6578887", "0.6574399", "0.6574237", "0.6566678", "0.6549365", "0.6536364", "0.650337", "0.6450863", "0.6441259", "0.6441015", "0.642199", "0.6412159", "0.6401308", "0.63874614", "0.63874316", "0.63755506", "0.6370842", "0.6345238", "0.6342008", "0.6340085", "0.6332535", "0.6320105", "0.6317504", "0.63138384", "0.6311059", "0.6306282", "0.6305733", "0.63014424", "0.6293825", "0.62867045", "0.628209", "0.6277028", "0.62679064", "0.6256672", "0.62546754", "0.62487346", "0.6242858", "0.624119", "0.6237495", "0.6230205", "0.6226452", "0.62199986", "0.62192833", "0.6217898", "0.61993086", "0.619576" ]
0.0
-1
Constructs a new CustomerPaymentCardRequest. Document representing a customer payment card request.
constructor() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createPaymentRequest() {\n var _this = this;\n var methodData = [{\n supportedMethods: 'basic-card',\n data: {\n supportedNetworks: Array.from(this.allowedCardNetworks, (network) => network.toLowerCase())\n }\n }];\n\n var details = {\n total: {\n label: 'Test Purchase',\n amount: {\n currency: 'USD',\n value: '1.00'\n }\n }\n };\n\n var options = {\n requestPayerEmail: true,\n requestPayerName: true\n };\n\n return new PaymentRequest(methodData, details, options);\n }", "function PaymentCard() {\n this.id = 0;\n \n // the collection of language specific descriptors \n this.descriptors = [];\n \n // a language specific text name of the card\n this.name = '';\n \n // the status of the payment card\n this.status = new Status();\n \n this.created = null;\n this.modified = null;\n}", "function stripeApiCreateCustomer (req) {\n return stripe.customers.create({\n description: 'Customer for johndoe@gmail.com',\n source: req.body.userCardDetails.id\n })\n}", "function createPaymentRequest(cartId, product) {\n if (!cartId) {\n throw new Error('cartId is missing');\n }\n\n if (!product) {\n throw new Error('product is missing');\n }\n\n // PaymentMethodData[]\n var paymentMethods = [{\n supportedMethods: [payments.MicrosoftPayMethodName],\n data: {\n mode: process.env.PAYMENTS_LIVEMODE === 'true' ? null : 'TEST',\n merchantId: process.env.PAYMENTS_MERCHANT_ID,\n supportedNetworks: ['visa', 'mastercard'],\n supportedTypes: ['credit']\n }\n }];\n\n // PaymentDetails\n var paymentDetails = {\n total: {\n label: product.vehicleNum,\n amount: { currency: 'USD', value: product.balance.toFixed(2) },\n pending: true,\n },\n displayItems: [\n {\n label: 'Payment for Contravention Number: ' + product.pcnNum,\n amount: { currency: 'USD', value: product.balance.toFixed(2) }\n }, \n ],\n // until a shipping address is selected, we can't offer shipping options or calculate taxes or shipping costs\n shippingOptions: []\n};\n\n // PaymentOptions\n var paymentOptions = {\n requestPayerName: true,\n requestPayerEmail: true,\n requestPayerPhone: true,\n requestShipping: false,\n shippingType: 'shipping'\n };\n\n // PaymentRequest\n return {\n id: product.pcnNum,\n expires: '1.00:00:00', // 1 day\n methodData: paymentMethods, // paymethodMethods: paymentMethods,\n details: paymentDetails, // paymentDetails: paymentDetails,\n options: paymentOptions // paymentOptions: paymentOptions\n};\n}", "function makeCard(cardNumber, expirationDate, securityCode) {\n var creditCard = {};\n creditCard.cardNumber = cardNumber;\n creditCard.expirationDate = expirationDate;\n creditCard.securityCode = securityCode;\n return creditCard;\n }", "function createPaymentRequest(cartId, product) {\n// if (!cartId) {\n// throw new Error('cartId is missing');\n// }\n\n// if (!product) {\n// throw new Error('product is missing');\n// }\n\n // PaymentMethodData[]\n var paymentMethods = [{\n supportedMethods: [payments.MicrosoftPayMethodName],\n data: {\n mode: process.env.PAYMENTS_LIVEMODE === 'true' ? null : 'TEST',\n merchantId: process.env.PAYMENTS_MERCHANT_ID,\n supportedNetworks: ['visa', 'mastercard'],\n supportedTypes: ['credit']\n }\n }];\n\n // PaymentDetails\n var paymentDetails = {\n total: {\n label: 'Total',\n amount: { currency: 'USD', value: '5.00' },\n pending: true\n },\n displayItems: [\n {\n label: 'Deposit',\n amount: { currency: 'USD', value: '5.00' }\n }],\n // until a shipping address is selected, we can't offer shipping options or calculate taxes or shipping costs\n // shippingOptions: []\n };\n\n // PaymentOptions\n var paymentOptions = {\n requestPayerName: true,\n requestPayerEmail: true,\n requestPayerPhone: true,\n requestShipping: false,\n // shippingType: 'shipping'\n };\n\n // PaymentRequest\n return {\n id: 1,\n expires: '1.00:00:00', // 1 day\n methodData: paymentMethods, // paymethodMethods: paymentMethods,\n details: paymentDetails, // paymentDetails: paymentDetails,\n options: paymentOptions // paymentOptions: paymentOptions\n };\n}", "async createRequest(ctx, supplyRequestNumber, state, paid, itemId, amount, isInBudget) {\n console.info('============= START : Create SupplyRequest ===========');\n\n const supplyRequest = {\n state,\n docType: 'request',\n paid,\n itemId,\n amount,\n isInBudget\n };\n\n await ctx.stub.putState(supplyRequestNumber, Buffer.from(JSON.stringify(supplyRequest)));\n console.info('============= END : Create SupplyRequest ===========');\n }", "function GetBucketRequestPaymentCommand(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 }", "async initPaymentRequest() {\n if (!this.stripe) return;\n const stripePaymentRequestOptions = this.getStripePaymentRequestOptions();\n const paymentRequest = this.stripe.paymentRequest(stripePaymentRequestOptions);\n const canMakePayment = await paymentRequest.canMakePayment();\n await this.set({ paymentRequest, canMakePayment });\n if (!this.canMakePayment) this.fire('unsupported');\n }", "function stripe_pay(request, response) {\n\n Stripe.Customers.create({\n card: request.params.token,\n plan: request.params.plan,\n quantity: request.params.quantity\n // coupon: request.params.coupon, \n // email: request.params.email\n\n }).then(function (httpResponse) {\n response.success(httpResponse);\n });\n}", "function buildPaymentRequest(checkoutPaymentInfo, visaData, payInitParams) {\n\n if (!window.PaymentRequest) {\n console.log(\"buildSimplePaymentRequest: PaymentRequest API is not available!\");\n alert('PaymentRequest API is not available!');\n return null;\n }\n \n // generate payment request data:\n var payRequestData = {\n checkoutPartner: \"VisaCheckout\",\n requestPayload: {\n data: {\n checkoutPaymentInfo: checkoutPaymentInfo,\n visaIntentData: visaData,\n paymentInitParams: payInitParams\n }\n }\n };\n \n // generate payment method data:\n var methodData = [{\n supportedMethods: supportedPayMethods,\n data: payRequestData\n }];\n \n \n // generate W3C PaymentRequest object:\n var dummyRequest = new PaymentRequest( \n methodData, \n dummyDetails, // not being used since spay has its own payment sheet.\n dummyOptions \n );\n \n return dummyRequest;\n}", "function makeCard(cardNumber, expirationDate, securityCode) {\n card = {\n cardNumber: cardNumber,\n expirationDate: expirationDate,\n securityCode: securityCode\n }\n return card;\n\n }", "function CustomerCreditTransferFile(groupHeader) {\n /**\n * @var GroupHeader\n */\n this.groupHeader = groupHeader;\n\n /**\n * @var array<PaymentInformation>\n */\n this.paymentInformations = [];\n}", "function Card(cardKey, cardName, cardColor, cardPayout, cardType, cardCost) {\n this.cardKey = cardKey;\n this.cardName = cardName;\n this.cardColor = cardColor;\n this.cardPayout = cardPayout;\n this.cardType = cardType;\n this.cardCost = cardCost;\n}", "function makeCard(cardNumber,expirationDate,securityCode) {\n var creditcard = {cardNumber:cardNumber,expirationDate:expirationDate,securityCode:securityCode};\n return creditcard;\n\n}", "function Customer(firstName, lastName, phone, membership) {\n Person.call(this, firstName, lastName);\n\n this.phone = phone;\n this.membership = membership;\n}", "function PutBucketRequestPaymentCommand(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 }", "function makeCard(cardNumber, expirationDate, securityCode) {\n var newCard = {};\n newCard.cardNumber = cardNumber;\n newCard.expirationDate = expirationDate;\n newCard.securityCode = securityCode;\n return newCard;\n}", "function makeCard(cardNumber, expirationMonth, expirationYr){\n return {CardNumber: cardNumber, ExpirationMonth: expirationMonth, expirationYear: expirationYr};\n }", "function instanceCreditCard(name, number) {\n return new CreditCard(name, number);\n}", "function MakeCard(cardNumber, expirationDate, securityCode) {\n var obj = {}\n obj.cardNumber = cardNumber;\n obj.expirationDate = expirationDate;\n obj.securityCode = securityCode;\n\n return obj;\n}", "function Payment() {\n _classCallCheck(this, Payment);\n\n Payment.initialize(this);\n }", "function Customer(name,street,city,state,zip) {\r\n\tthis.name = defaultValue(name,\"\");\r\n\tthis.street = defaultValue(street,\"\");\r\n\tthis.city = defaultValue(city,\"\");\r\n\tthis.state = defaultValue(state,\"\");\r\n\tthis.zip = defaultValue(zip,\"\");\r\n\tthis.taxRate=0.06;\r\n}", "function Customer(name, course, author){\n this.name = name;\n this.course = course;\n this.author = author;\n }", "async handleRequest (ctx, params) {\n const { stripe } = ctx\n const { customerID } = params\n\n const creditCardInfo = { ...params }\n delete creditCardInfo.customerID\n\n ctx.data = await stripe.customers.createSource(customerID, {\n source: {\n ...creditCardInfo,\n object: 'card',\n }\n })\n }", "function ProcessCCPayment() {\n \n data = donation;\n\n onValidationSuccess = function (result) {\n\t\t\t\n makePayment();\n return false;\n };\n onValidationFailed = function (error) {\n console.log(error);\n };\n\n ds.validateDonationRequest(data, onValidationSuccess, onValidationFailed);\n\n }", "function MakeCard(cardNumber, expirationDate, securityCode) {\n var newCard = {};\n newCard[\"cardNumber\"] = cardNumber;\n newCard[\"expirationDate\"] = expirationDate;\n newCard[\"securityCode\"] = securityCode;\n\n return newCard;\n}", "function LoyaltyMerchantcardsDTOTransaction() {\n _classCallCheck(this, LoyaltyMerchantcardsDTOTransaction);\n\n this.action = undefined;\n this.terminal_id = undefined;\n this.amount = undefined;\n this.tid = undefined;\n this.store = undefined;\n this.cardnumber = undefined;\n this.bonus_amount = undefined;\n this.amount_split_allowed = undefined;\n this.merchant_id = undefined;\n }", "function createCustomerInvoice(database, customer, user) {\n const currentDate = new Date();\n const invoice = database.create('Transaction', {\n id: generateUUID(),\n serialNumber: getNextNumber(database, CUSTOMER_INVOICE_NUMBER),\n entryDate: currentDate,\n confirmDate: currentDate, // Customer invoices always confirmed in mobile\n type: 'customer_invoice',\n status: 'confirmed', // Customer invoices always confirmed in mobile for easy stock tracking\n comment: '',\n otherParty: customer,\n enteredBy: user,\n });\n database.save('Transaction', invoice);\n customer.addTransaction(invoice);\n database.save('Name', customer);\n return invoice;\n}", "function MakeCard(theName, theBirthday, theSsn, theAddress) {\n var creditCard = {\n name: theName,\n birthday: theBirthday,\n ssn: theSsn,\n address: theAddress\n };\n return creditCard;\n}", "async initPaymentRequestButton() {\n const { buttonTheme: theme, buttonType: type, canMakePayment, paymentRequest } = this;\n if (!canMakePayment) return;\n const computedStyle = window.ShadyCSS ? undefined : getComputedStyle(this);\n const propertyName = '--stripe-payment-request-button-height';\n const height = this.getCSSCustomPropertyValue(propertyName, computedStyle) || '40px';\n const style = { paymentRequestButton: { height, theme, type } };\n const options = { paymentRequest, style };\n const element = this.elements.create('paymentRequestButton', options);\n await this.set({ element });\n }", "create(customer) {\n if (customer.id) {\n return Promise.reject(new Error('invalid_parameter'));\n }\n return this.iugu.makeRequest('POST', '/customers').begin(customer).then(outCustomer => object_1.recreateDateFields(outCustomer));\n }", "async function payment(req, res) {\n const body = req.body;\n const uid = body.uid;\n const token = body.token.id;\n const email = body.email;\n // Charge card\n try {\n const response = await admin\n .firestore()\n .collection(\"users\")\n .doc(uid)\n .get();\n if (response.exists) {\n const userData = response.data();\n if (!userData.customerId) {\n const customer = await stripe.customers.create({\n source: token,\n email: userData.email\n });\n\n admin\n .firestore()\n .collection(\"users\")\n .doc(uid)\n .set({ customerId: customer.id }, { merge: true });\n\n const cardList = await stripe.customers.listCards(customer.id);\n send(res, 200, {\n message: \"Success\",\n cardList: cardList.data\n });\n } else {\n const charge = await stripe.customers.createSource(\n userData.customerId,\n {\n source: token\n }\n );\n const cardList = await stripe.customers.listCards(userData.customerId);\n\n send(res, 200, {\n message: \"Success\",\n cardList: cardList.data\n });\n }\n } else {\n const customer = await stripe.customers.create({\n source: token,\n email: email\n });\n\n admin\n .firestore()\n .collection(\"users\")\n .doc(uid)\n .set({ customerId: customer.id }, { merge: true });\n\n const cardList = await stripe.customers.listCards(customer.id);\n send(res, 200, {\n message: \"Success\",\n cardList: cardList.data\n });\n }\n } catch (err) {\n send(res, 500, {\n error: err.message\n });\n }\n}", "function CreditCard(number){\n this.number = number;\n this.checkCard();\n}", "clone() {\n let signature;\n if (this.signature) {\n signature = JSON.parse(JSON.stringify(this.signature));\n }\n const data = JSON.stringify(this.data, (key, value) => {\n if (value instanceof Uint8Array) {\n return Array.from(value);\n }\n return value;\n });\n return new SigningRequest(this.version, JSON.parse(data), this.textEncoder, this.textDecoder, this.zlib, this.abiProvider, signature);\n }", "function cardPayment(){\n\n // Hide div if not hidden\n if (!$errors_div.hasClass('hide')) {\n $errors_div.addClass('hide');\n }\n // Get payload\n payload = {\n \"invoice\": String(invoice),\n \"action\": $('#card_action').val(),\n \"type\": \"telephoneorder\"\n }\n // Check if amount filed is present and has value has value\n if ($('#card_amount').val()) {\n payload[\"amount\"] = $('#card_amount').val();\n }\n // Check if the pay by stroed cards checkbox is selected\n if ($('#use_stored').is(':checked')){\n payload['using_token'] = true;\n payload['token'] = $('input[name=card]:checked').val();\n }\n else{\n var card= {\n \"number\": $('#card_number').val(),\n \"cvn\": $('#card_cvn').val(),\n \"expiry\": $('#month_expiry').val()+$('#year_expiry').val(),\n }\n payload[\"card\"] = card;\n }\n // POST\n $.ajax ({\n beforeSend: function(xhrObj){\n xhrObj.setRequestHeader(\"Content-Type\",\"application/json\");\n xhrObj.setRequestHeader(\"Accept\",\"application/json\");\n },\n type: \"POST\",\n url: \"/ledger/payments/api/bpoint/payment\",\n data: JSON.stringify(payload),\n dataType: \"json\",\n success: function(resp){\n success(resp,invoice,'card');\n },\n error: function(resp){\n error(resp);\n },\n complete: function(resp){\n checkInvoiceStatus();\n }\n });\n }", "function Customer(name, last_name, email) {\n this.name = name;\n this.last_name = last_name;\n this.email = email;\n}", "function createCustomer(name) {\n name = name || \"New customer\";\n var customerType = getCustomerType();\n var customer = customerType.createEntity();\n customer.CompanyName(name);\n return customer;\n }", "function Customer(firstName, lastName, phone, membership) {\n\tPerson.call(this, firstName, lastName); //how to inherit\n\n\tthis.phone = phone;\n\tthis.membership = membership;\n}", "function ClaimRequest(\r\n /** A name of a claim to return. */\r\n name, \r\n /** A database to search for an attribute. */\r\n db, \r\n /** An attribute name to search. */\r\n attr) {\r\n this.name = name;\r\n this.db = db;\r\n this.attr = attr;\r\n }", "constructor(payment) {\n this.paymentType = payment.paymentType\n this.doneBy = payment.doneBy;\n this.description = payment.description;\n this.reducingBalance = payment.reducingBalance;\n this.priorBalance = payment.priorBalance;\n this.amount = payment.amount;\n this.contractID = payment.contractID;\n this.adminID = payment.adminID;\n }", "function chargeCustomer (chargeMetadata, isSubscription, callback) {\n var payload = {\n uc: $scope.userCountry\n };\n\n // Add order message if one was entered\n payload.orderMessage = $scope.orderMessage.message;\n\n // Alter payload based on subscription or charge\n if (isSubscription) {\n payload.planId = $scope.$parent.planToSub.id;\n payload.couponId = $scope.$parent.subscriptionCouponId;\n }\n else {\n payload.cart = [];\n payload.metadata = chargeMetadata;\n\n var detailedCart = $scope.$parent.cart;\n for (var i = 0; i < detailedCart.length; i++) {\n payload.cart.push({\n id: detailedCart[i].product.id,\n quantity: detailedCart[i].quantity\n });\n }\n }\n\n // Alternate shipping address which the user has not yet used before\n if ($scope.newAltShipping) {\n\n // Create new altShippingAddress for customer\n appService.altShippingAddress.save({shipping: $scope.shipping}, function(newAltAddr) {\n $scope.$parent.altShippingAddr = newAltAddr;\n $scope.newAltShipping = false;\n\n payload.altShipping = newAltAddr;\n\n // If charge failed new token is required (user may have changed their card)\n // Option to modify card in the form is only available on first ever checkout\n if ( ($scope.billing.source.number) && ($scope.chargeErr) ) {\n revalidateSourceAndCharge(payload, isSubscription, function(result) {\n return callback(result);\n });\n }\n else {\n // Create subscription\n if (isSubscription) {\n appService.subscription.save(payload, function(subscription) {\n return callback(subscription);\n }, function(err) {\n handleStCCErr(err);\n return callback(false);\n });\n }\n\n // Create charge\n else {\n appService.charge.save(payload, function(charge) {\n return callback(charge);\n }, function(err) {\n handleStCCErr(err);\n return callback(false);\n });\n }\n }\n\n }, function(err) {\n return callback(false);\n });\n }\n\n // Use one of the pre-saved addresses\n else {\n\n // Use pre-selected saved alternate address\n if ($scope.altShippingReq) {\n payload.altShipping = $scope.altShippingAddr;\n }\n\n // If charge failed new token is required (user may have changed their card)\n // Option to modify card in the form is only available on first ever checkout\n if ( ($scope.billing.source.number) && ($scope.chargeErr) ) {\n revalidateSourceAndCharge(payload, isSubscription, function(result) {\n return callback(result);\n });\n }\n else {\n // Create subscription\n if (isSubscription) {\n appService.subscription.save(payload, function(subscription) {\n return callback(subscription);\n }, function(err) {\n handleStCCErr(err);\n return callback(false);\n });\n }\n\n // Create charge\n else {\n appService.charge.save(payload, function(charge) {\n return callback(charge);\n }, function(err) {\n handleStCCErr(err);\n return callback(false);\n });\n }\n }\n\n }\n\n }", "addCODCredit(payload) {\n return this.request.post('', payload);\n }", "function Customer(customerJSON){\n this.name = customerJSON.name;\n this.address = customerJSON.address;\n this.email = customerJSON.email;\n this.loyalty_code = customerJSON.loyalty_code;\n this.id = customerJSON.id;\n}", "function createPersonRequest (uinfin, validToken) {\n var url = personApiUrl+ \"/\" + uinfin + \"/\"\n var cacheCtl = \"no-cache\";\n var method = \"GET\";\n\n // assemble params for Person API\n var strParams = \"client_id=\" + clientId\n\t\t\t\t+ \"&attributes=\" + attributes;\n var params = querystring.parse(strParams)\n\n // assemble headers for Person API\n var strHeaders = \"Cache-Control=\" + cacheCtl\n var headers = querystring.parse(strHeaders)\n\n // Add Authorisation headers for connecting to API Gateway\n var authHeaders = generateAuthorizationHeader(\n \turl,\n \tparams,\n \tmethod,\n \t\"\", // no content type needed for GET\n \tauthLevel,\n \tclientId,\n \tclientSecret\n \t);\n\n // NOTE: include access token in Authorization header as \"Bearer \" (with space behind)\n if(!_.isEmpty(authHeaders)) {\n _.set(headers, \"Authorization\", authHeaders + \",Bearer \" + validToken);\n } else {\n _.set(headers, \"Authorization\", \"Bearer \" + validToken);\n }\n\n\t// invoke token API\n var request = restClient.get(url);\n\n // Set headers\n if(!_.isUndefined(headers) && !_.isEmpty(headers))\n \trequest.set(headers);\n\n // Set Params\n if(!_.isUndefined(params) && !_.isEmpty(params))\n request.query(params);\n\n console.log('CLAP CLAP CLAP')\n console.log(request)\n\n\treturn request\n}", "function CustomerCreditTransferInformation(id, name, amount) {\n\n /**\n * @var string\n */\n this.bankAccount = '';\n\n /**\n * @var string\n */\n this.bankName = '';\n\n /**\n * @var string|array\n */\n this.bankAddress = '';\n\n /**\n * Financial Institution Identifier;\n *\n * @var string\n */\n this.bic = '';\n\n /**\n * @var string\n */\n this.categoryPurpose = '';\n\n /**\n * @var string\n */\n this.country = '';\n\n /**\n * Structured creditor reference type.\n *\n * @var string\n */\n this.creditorReferenceType = '';\n\n /**\n * Structured creditor reference.\n *\n * @var string\n */\n this.creditorReference = '';\n\n /**\n * @var string\n */\n this.currency = '';\n\n /**\n * @var string\n */\n this.EndToEndIdentification = id;\n\n /**\n\t * Account Identifier\n *\n * @var string\n */\n this.iban;\n\n /**\n * @var string\n */\n this.instructionId = '';\n\n /**\n * @var string Local service instrument code.\n */\n this.localInstrumentCode = '';\n\n /**\n * @var string Local service instrument proprietary.\n */\n this.localInstrumentProprietary = '';\n\n /**\n * @var string\n */\n this.name = name;\n\n /**\n * @var string|array\n */\n this.postalAddress = '';\n\n /**\n * Purpose of this transaction\n *\n * @var string\n */\n this.remittanceInformation = '';\n\n /**\n * @var string Service level affects the way the payment is made.\n * S (SEPA) must be used\n */\n this.serviceLevelCode = '';\n\n /**\n * Must be between 0.01 and 999999999.99\n *\n * @var string\n */\n this.transferAmount = amount;\n\n /**\n * @var string\n */\n this.ultimateDebtorName = ''; \n}", "function makePayment\n(\n customerId,\n orderId,\n balance\n)\n{\n var makePayRet = true;\n var payerId = NO_ID;\n var arrCustomer = getCustomerByCustomerId(customerId, true);\n if(($('firstName',arrCustomer).text().toLowerCase() == \n $('#firstNamePayment').val().toLowerCase()) ||\n ($('lastName',arrCustomer).text().toLowerCase() == \n $('#lastNamePayment').val().toLowerCase()) )\n {\n payerId = customerId;\n }\n var expMonth = $('#ccExpMonth option:selected').val();\n\n if($('#ccExpMonth option:selected').val().length == 1)\n {\n expMonth= '0' + $('#ccExpMonth option:selected').val();\n }\n \n var payer = {\n \"id\" : $('id',arrCustomer).text(),\n \"parentID\" : $('parentId',arrCustomer).text(),\n \"typeId\" : $('typeId',arrCustomer).text(),\n \"status\" : $('status',arrCustomer).text(),\n \"number\" : $('number',arrCustomer).text(),\n \"firstName\" : $('#firstNamePayment').val(),\n \"lastName\" : $('#lastNamePayment').val(),\n \"middleName\" : $('#middleNamePayment').val(),\n \"companyName\" : $('companyName',arrCustomer).text(),\n \"address1\" : $('#steetAddress').val(),\n \"address2\" : '',\n \"city\" : $('#city').val(),\n \"state\" : $('#state option:selected').val(),\n \"zipCode\" : $('#zipCode').val(),\n \"country\" : COUNTRY_NAME,\n \"email\" : $('email',arrCustomer).text(),\n \"phone1\" : $('phone1',arrCustomer).text(),\n \"phone2\" : $('phone2',arrCustomer).text(),\n \"fax\" : $('fax',arrCustomer).text(),\n \"balance\" : balance,\n \"note\" : $('note',arrCustomer).text(),\n \"taxRate\" : $('taxRate',arrCustomer).text(),\n \"subscribed\" : $('subscribed',arrCustomer).text()\n };\n var payment = {\n \"id\" : NO_ID,\n \"orderId\" : orderId,\n \"payerId\" : payerId,\n \"ccType\" : $('#ccType option:selected').val(),\n \"ccNum\" : $('#ccNumber').val(),\n \"ccCode\" : $('#cvv').val(),\n \"ccExpMonth\": expMonth,\n \"ccExpYear\" : $('#ccExpYear option:selected').val(),\n \"amount\" : balance\n };\n var dataToSend = {\n 'action' : MAKE_PAYMENT,\n 'payer' : JSON.stringify(payer),\n 'payment' : JSON.stringify(payment)\n };\n $.ajax({\n type : \"POST\",\n url : API_URL,\n data : dataToSend, \n dataType : \"json\",\n async : false, \n headers : HEADER,\n error : function (e)\n { \n $('.modal').modal('hide');\n },\n success : function(jsonResult)\n { \n var location = window.location.pathname; \n if(jsonResult.returnCode == -1)\n {\n makePayRet = false;\n showAlertBox('Payment Failure Alert',jsonResult.errorMsg,\n SITE_URL + location.split('/')[1]);\n }\n else if(jsonResult.returnCode == 1)\n {\n var liftId = $.session.get('liftId');\n var hasConfirm = pendingFulFilledALift(liftId);\n if(hasConfirm == 1)\n { \n var result = getLiftById($.session.get('liftId')); \n lift = result.lift;\n var hasSent = true; \n if (lift.textYes)\n {\n hasSent = sendTextMessage($('phone1',\n arrCustomer).text(),\n \"Your payment was processed.\"+\"\\n\" +\n \"Your Confirmation no :\"+\"\\n\" +\n $.session.get('confirmationNo') + \n ' Please check your email to see the detailed information ' + \n 'on the confirmation.');\n } \n \n var emailBody = getEmailBody('payment',\n $('firstName',arrCustomer).text() +' '+\n $('lastName',arrCustomer).text(),\n '', '', '', '', '', lift); \n\n var emailSubject = 'AirPnd - Payment confirmation '; \n var hasMailSent = sendEmail($('email',arrCustomer).text(),\n emailSubject,emailBody); \n \n if (hasMailSent)\n {\n $('.modal').modal('hide');\n $.session.clear('confirmationNo');\n showAlertBox('Payment Confirmation',\n 'Your payment was processed. Please ' + \n 'check your email or text message for ' + \n 'the confirmation number and please ' +\n 'provide the confirmation number to ' + \n 'your driver at the end of the ride.',\n SITE_URL + location.split('/')[1]);\n } \n else\n {\n $.session.clear('confirmationNo');\n showAlertBox('Mail failure',\n 'Email Sending Failed',\n SITE_URL + location.split('/')[1]);\n } \n }\n }\n else\n {\n makePayRet = false;\n showAlertBox('Payment Failure Alert','Failed to set lift to confirm',\n SITE_URL + location.split('/')[1]);\n }\n }\n });\n return makePayRet;\n}", "function MakeCard(pName, ccVendor, expire) {\n var sp = ' ';\n var cCard = {};\n\n var ccNum1 = getRandomInt(1000, 9999);\n var ccNum2 = getRandomInt(1000, 9999);\n var ccNum3 = getRandomInt(1000, 9999);\n var ccNum4 = getRandomInt(1000, 9999);\n var ccNum = ccNum1 + sp + ccNum2 + sp + ccNum3 + sp + ccNum4;\n\n var secCode = getRandomInt(200, 999);\n\n cCard.cardvendor = ccVendor;\n cCard.name = pName;\n cCard.cardnumber = ccNum;\n cCard.cardexpire = expire;\n cCard.securitycode = secCode;\n\n return cCard;\n}", "function PaymentTransactionVO(clientPayload) {\n this.amountOfMoney = clientPayload.amount_of_money;\n this.currency = clientPayload.currency;\n this.firstName = clientPayload.first_name;\n this.lastName = clientPayload.last_name;\n this.expiryMonth = clientPayload.expiry_month;\n this.expiryYear = clientPayload.expiry_year;\n this.cardType = clientPayload.card_type;\n this.cardName = clientPayload.card_name;\n this.cardNumber = clientPayload.card_number;\n this.cvv = clientPayload.cvv;\n}", "async payBill(ctx, requestNumber) {\n console.info('============= START : payBill ===========');\n const requestAsBytes = await ctx.stub.getState(requestNumber); // get the from chaincode state\n\n if (!requestAsBytes || requestAsBytes.length === 0) {\n throw new Error(`request ${requestNumber} does not exist`);\n }\n const request = JSON.parse(requestAsBytes.toString());\n // simulates changing the abstract state.\n request.paid = true;\n await ctx.stub.putState(requestNumber, Buffer.from(JSON.stringify(request)));\n\n return request;\n console.info('============= END : payBill ===========');\n }", "function MakeCard(firstName, lastName, pan, expDate, cvv) {\n this.firstName = firstName;\n this.lastName = lastName;\n this.pan = pan;\n this.expDate = expDate;\n this.cvv = cvv;\n}", "function createRESTPOSTObject (senderAddress, chainId, { sequence, accountNumber, memo }, msg) {\n const requestMetaData = {\n sequence,\n from: senderAddress,\n account_number: accountNumber,\n chain_id: chainId,\n simulate: true,\n memo\n }\n\n return { base_req: requestMetaData, ...msg.value }\n}", "function cardConstructor(card, value) {\n this.card = card;\n this.value = value\n}", "function customer(name,email,pizza,cost) { //Declaring customer object\n this.name = name;\n this.email = email;\n\n}", "function createCustomer(firebaseUser) {\n return __awaiter(this, void 0, void 0, function* () {\n return yield config_1.stripe.customers.create({\n email: firebaseUser.email,\n metadata: { firebaseUID: firebaseUser.uid }\n });\n });\n}", "create(req, res) {\n\t\tlet card = new cardM();\n\t\tif (!req.body.card_no) {\n\t\t\treturn this.common.findError(res);\n\t\t}\n\n\t\tcard.card_no = req.body.card_no;\n\n\t\treturn this.dao.create(card)\n\t\t\t.then(this.common.editSuccess(res))\n\t\t\t.catch(this.common.serverError(res));\n\t}", "function needMyPay() {\n if (window.PaymentRequest) {\n\n let supportedMethodsToPay = [{\n supportedMethods: [\"basic-card\"],\n data: {\n supportedNetworks: [\"visa\", \"mastercard\"]\n }\n }];\n\n let paymentDescription = {\n total: {\n label: \"My TO-DO list charges\",\n amount: {\n currency: 'CAD',\n value: 20\n }\n }\n };\n\n let paymentRequesting = new PaymentRequest(supportedMethodsToPay, paymentDescription);\n paymentRequesting.show();\n\n } else {\n alert('You have some issues with the payment, resolve it and then come 😥');\n }\n}", "constructor ($resource, $braintree, $q) {\n // keep resource\n this.$resource = $resource;\n this.$braintree = $braintree;\n this.$q = $q;\n\n this.creditCardsPerAccount = new Map();\n this.tokensPerAccount = new Map();\n this.invoicesPerAccount = new Map();\n\n // remote call\n this.remotePaymentAPI = this.$resource('/api/creditcard/:accountId',{}, {\n getToken: {method: 'GET', url: '/api/creditcard/:accountId/token'},\n add: {method: 'POST', url: '/api/creditcard/:accountId'},\n remove: {method: 'DELETE', url: '/api/creditcard/:accountId/:creditCardNumber'},\n getInvoices: {method: 'GET', url: '/api/invoice/find/?accountId=:accountId', isArray: true}\n });\n\n }", "getCustomerData() {\n const newCustomer = {\n id: $.uuid(),\n name: customerNameInput.val(),\n phone: customerPhoneInput.val(),\n address: customerAddressInput.val(),\n district: customerDistrictInput.val(),\n note: {\n note: customerNoteInput.val(),\n caution: customerCautionInput.val()\n },\n debt: {\n installment: installmentDebtInput.val() === '' ? 0 : parseInt(installmentDebtInput.val()),\n overlapping: overlappingDebtInput.val() === '' ? 0 : parseInt(overlappingDebtInput.val()),\n old: oldDebtInput.val() === '' ? 0 : parseInt(oldDebtInput.val()),\n new: newDebtInput.val() === '' ? 0 : parseInt(newDebtInput.val())\n }\n }\n return newCustomer\n }", "function customerAddressObject() {\n this.id = 0;\n this.street1 = \"\";\n this.street2 = \"\";\n this.city = \"\";\n this.zip_code = \"\";\n this.metro_id = 0;\n this.state = \"\";\n this.created_at = null;\n this.updated_at = null;\n }", "function cardToContact(card) {\n return {\n company: card.name,\n recipient_name: card.pluginValues['Contact greeting'],\n to_recipients: card.pluginValues['Main contact (Email)'],\n cc_recipients: card.pluginValues['Secondary contact (email)'],\n idCard: card.id\n };\n}", "function selectCreditCard() {\n var cart, applicableCreditCards, selectedCreditCard, instrumentsIter, creditCardInstrument;\n cart = app.getModel('Cart').get();\n applicableCreditCards = initCreditCardList(cart).ApplicableCreditCards;\n selectedCreditCard = null;\n\n // ensure mandatory parameter 'CreditCardUUID' and 'CustomerPaymentInstruments'\n // in pipeline dictionary and collection is not empty\n if (request.httpParameterMap.creditCardUUID.value && applicableCreditCards && !applicableCreditCards.empty) {\n // find credit card in payment instruments\n instrumentsIter = applicableCreditCards.iterator();\n while (instrumentsIter.hasNext()) {\n creditCardInstrument = instrumentsIter.next();\n if (request.httpParameterMap.creditCardUUID.value.equals(creditCardInstrument.UUID)) {\n selectedCreditCard = creditCardInstrument;\n }\n }\n if (selectedCreditCard) {\n app.getForm('billing').object.paymentMethods.creditCard.number.value = selectedCreditCard.getCreditCardNumber();\n }\n }\n app.getView({\n SelectedCreditCard: selectedCreditCard\n }).render('checkout/billing/creditcardjson');\n}", "function PostChargeRequest(accessToken, userPhone, amount, note) {\n var post_options = {\n \thost: 'api.venmo.com',\n \tport: '443',\n \tpath: '/v1/payments'\n }\n\n var r = request.post('https://api.venmo.com/v1/payments', function(err, httpResponse, body) {\n var transaction = JSON.parse(body);\n var transactionID = transaction.data.payment.id;\n return transactionID;\n });\n\n var form = r.form();\n form.append('access_token', accessToken);\n form.append('phone', userPhone);\n form.append('amount', amount);\n form.append('note', note);\n}", "function Contact(firstName, lastName, phoneNumber) {\n this.firstName = firstName,\n this.lastName = lastName,\n this.phoneNumber = phoneNumber\n}", "function Contact(firstName, lastName, phoneNumber) {\n this.firstName = firstName,\n this.lastName = lastName,\n this.phoneNumber = phoneNumber\n}", "function Contact(firstName, lastName, phoneNumber) {\n this.firstName = firstName;\n this.lastName = lastName;\n this.phoneNumber = phoneNumber;\n }", "function BitrateRequest() {\n var __arguments = new Array(arguments.length);\n for (var __argumentIndex = 0; __argumentIndex < __arguments.length; ++__argumentIndex) {\n __arguments[__argumentIndex] = arguments[__argumentIndex];\n }\n if (__arguments.length == 0) {\n //super();\n this.fmliveswitchBitrateRequestInit();\n this.setSynchronizationSource(-1);\n this.setMediaDescriptionId(null);\n this.setRtpStreamId(null);\n this.setBitrate(-1);\n this.setSenderSynchronizationSource(-1);\n }\n else {\n throw new fm.liveswitch.Exception('Constructor overload does not exist with specified parameter count/type combination.');\n }\n }", "_createReviewRequest() {\n if (this.model.get('accessible')) {\n const url = this.model.get('reviewRequestURL');\n\n if (url) {\n RB.navigateTo(url);\n } else {\n this.model.trigger('create', this.model);\n }\n }\n }", "function CreditPackage(response) {\r\n this.init(response);\r\n}", "function createCustomerGroupWithCustomer() {\n return {\n customers: [\n {}\n ],\n salesChannels: []\n };\n}", "function Contact(firstName, lastName, phoneNumber) {\n this.firstName = firstName;\n this.lastName = lastName;\n this.phoneNumber = phoneNumber;\n}", "function buildSOAPRequest()\r\n{\r\n\r\n\ttry\r\n\t{\r\n\r\n\t\tpostObject = \r\n\t\t\t'<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>' +\r\n\t\t\t'<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">'+\r\n\t\t\t'<soapenv:Body>'+\r\n\t\t\t'<ns1:findDeliveryOptions soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns1=\"urn:DeliveryManager/services\">'+\r\n\t\t\t'<consignment xsi:type=\"ns2:Consignment\" xmlns:ns2=\"urn:DeliveryManager/types\">'+\r\n\t\t\t'<alreadyPalletisedGoodsFlag xsi:type=\"xsd:boolean\">' + alreadyPalletisedGoodsFlag + '</alreadyPalletisedGoodsFlag>'+\r\n\t\t\t'<cardNumber xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<carrierCode xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<carrierConsignmentCode xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t' <carrierName xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<carrierServiceCode xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<carrierServiceName xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<cartonNumber xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<consignmentCode xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<consignmentLevelDetailsFlag xsi:type=\"xsd:boolean\">' + consignmentLevelDetailsFlag + '</consignmentLevelDetailsFlag>'+\r\n\t\t\t'<consignmentValue xsi:type=\"xsd:double\">' + consignmentValue + '</consignmentValue>'+\r\n\t\t\t'<consignmentWeight xsi:type=\"xsd:double\">' +consignmentWeight+'</consignmentWeight>'+\r\n\r\n\t\t\t' <custom1 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<custom10 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\t\r\n\t\t\t'<custom2 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<custom3 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<custom4 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<custom5 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<custom6 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<custom7 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<custom8 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<custom9 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<cutOffDate xsi:type=\"xsd:dateTime\" xsi:nil=\"true\"/>'+\r\n\t\t\t//'<deliveryPrice xsi:type=\"xsd:double\" xsi:nil=\"true\"/>'+\r\n\t\t\t'<despatchDate xsi:type=\"xsd:dateTime\" xsi:nil=\"true\"/>'+\r\n\t\t\t'<earliestDeliveryDate xsi:type=\"xsd:dateTime\" xsi:nil=\"true\"/>'+\r\n\t\t\t'<fragileGoodsFlag xsi:type=\"xsd:boolean\">'+fragileGoodsFlag+'</fragileGoodsFlag>'+\r\n\t\t\t'<guaranteedDeliveryDate xsi:type=\"xsd:dateTime\" xsi:nil=\"true\"/>'+\r\n\t\t\t'<hazardousGoodsFlag xsi:type=\"xsd:boolean\">'+hazardousGoodsFlag+'</hazardousGoodsFlag>'+\r\n\r\n\t\t\t'<insuranceValue xsi:type=\"xsd:double\">'+insuranceValue+'</insuranceValue>'+\r\n\t\t\t'<liquidGoodsFlag xsi:type=\"xsd:boolean\">'+liquidGoodsFlag+'</liquidGoodsFlag>'+\r\n\t\t\t'<maxDimension xsi:type=\"xsd:double\">'+maxDimension+'</maxDimension>'+\r\n\t\t\t'<moreThanOneMetreGoodsFlag xsi:type=\"xsd:boolean\">'+moreThanOneMetreGoodsFlag+'</moreThanOneMetreGoodsFlag>'+\r\n\t\t\t'<moreThanTwentyFiveKgGoodsFlag xsi:type=\"xsd:boolean\">'+moreThanTwentyFiveKgGoodsFlag+'</moreThanTwentyFiveKgGoodsFlag>'+\r\n\t\t\t'<orderNumber xsi:type=\"soapenc:string\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">'+orderNumber+'</orderNumber>'+\r\n\r\n\t\t\t'<parcelCount xsi:type=\"xsd:int\">'+parcelCount+'</parcelCount>'+\r\n\t\t\t'<parcels soapenc:arrayType=\"ns2:Parcel[1]\" xsi:type=\"soapenc:Array\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">'+\r\n\t\t\t'<item xsi:type=\"ns2:Parcel\">'+\r\n\t\t\t'<code xsi:type=\"soapenc:string\" xsi:nil=\"true\"/>'+\r\n\t\t\t'<dutyPaid xsi:type=\"xsd:double\">'+dutyPaid+'</dutyPaid>'+\r\n\t\t\t'<number xsi:type=\"xsd:int\">'+number+'</number>'+\r\n\t\t\t'<parcelDepth xsi:type=\"xsd:double\">'+parcelDepth+'</parcelDepth>'+\r\n\t\t\t'<parcelHeight xsi:type=\"xsd:double\">'+parcelHeight+'</parcelHeight>'+\r\n\t\t\t'<parcelValue xsi:type=\"xsd:double\">'+parcelValue+'</parcelValue>'+\r\n\t\t\t'<parcelWeight xsi:type=\"xsd:double\">'+parcelWeight+'</parcelWeight>'+\r\n\t\t\t'<parcelWidth xsi:type=\"xsd:double\">'+parcelWidth+'</parcelWidth>'+\r\n\t\t\t'<products xsi:type=\"ns2:Product\" xsi:nil=\"true\"/>'+\r\n\t\t\t'</item>'+\r\n\t\t\t'</parcels>'+\r\n\r\n\t\t\t'<pickTicketNumber xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<pickupPoint xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<podRequired xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<properties xsi:type=\"ns2:Property\" xsi:nil=\"true\"/>'+\r\n\r\n\t\t\t'<recipientAddress xsi:type=\"ns2:Address\">'+\r\n\t\t\t'<countryCode xsi:type=\"soapenc:string\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">'+reciepientCountryCode+'</countryCode>'+\r\n\t\t\t'<line1 xsi:type=\"soapenc:string\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">'+reciepientLine1+'</line1>'+\r\n\t\t\t'<line2 xsi:type=\"soapenc:string\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">'+reciepientLine2+'</line2>'+\r\n\t\t\t'<line3 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<line4 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<postCode xsi:type=\"soapenc:string\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">'+reciepientPostCode+'</postCode>'+\r\n\t\t\t'<type xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'</recipientAddress>'+\r\n\r\n\t\t\t'<recipientCode xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<recipientContactPhone xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<recipientEmail xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<recipientMobilePhone xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<recipientName xsi:type=\"soapenc:string\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">'+recipientName+'</recipientName>'+\t\t\t\t\t\t'<recipientNotificationType xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<recipientPhone xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<recipientVatNumber xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\r\n\t\t\t'<senderAddress xsi:type=\"ns2:Address\">'+\r\n\t\t\t'<countryCode xsi:type=\"soapenc:string\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">'+senderCountryCode+'</countryCode>'+\r\n\t\t\t'<line1 xsi:type=\"soapenc:string\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">'+senderLine1+'</line1>'+\r\n\t\t\t'<line2 xsi:type=\"soapenc:string\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">'+senderLine2+'</line2>'+\r\n\t\t\t'<line3 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<line4 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<postCode xsi:type=\"soapenc:string\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">'+senderPostCode+'</postCode>'+\r\n\t\t\t'<type xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'</senderAddress>'+\r\n\r\n\t\t\t'<senderCode xsi:type=\"soapenc:string\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">'+senderCode+'</senderCode>'+\r\n\t\t\t'<senderContactPhone xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<senderEmail xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<senderMobilePhone xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<senderName xsi:type=\"soapenc:string\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">'+senderName+'</senderName>'+\r\n\t\t\t'<senderNotificationType xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<senderPhone xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<senderVatNumber xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\r\n\t\t\t'<shipmentTypeCode xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<shippingAccount xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<signatoryOnCustoms xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<specialInstructions1 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<specialInstructions2 xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<status xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<termsOfTradeCode xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<transactionType xsi:type=\"soapenc:string\" xsi:nil=\"true\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"/>'+\r\n\t\t\t'<twoManLiftFlag xsi:type=\"xsd:boolean\">'+twoManLiftFlag+'</twoManLiftFlag>'+\r\n\r\n\t\t\t'</consignment>'+\r\n\r\n\t\t\t'<filter xsi:type=\"ns3:AllocationFilter\" xsi:nil=\"true\" xmlns:ns3=\"urn:DeliveryManager/types\"/>'+\r\n\r\n\t\t\t'<calculateTaxAndDuty xsi:type=\"xsd:boolean\"> '+calculateTaxAndDuty+' </calculateTaxAndDuty>'+\r\n\r\n\t\t\t'</ns1:findDeliveryOptions>'+\r\n\t\t\t'</soapenv:Body>'+\r\n\t\t\t'</soapenv:Envelope>';\r\n\r\n\r\n\t}\r\n\tcatch(e)\r\n\t{\r\n\t\terrorHandler('buildSOAPRequest', e);\r\n\t}\r\n\r\n\r\n}", "addCreditCard(accountId, creditCard) {\n var client;\n var remotePaymentAPI = this.remotePaymentAPI;\n var mainCreditCardInfo = {};\n mainCreditCardInfo.number = creditCard.number;\n mainCreditCardInfo.cardholderName = creditCard.cardholder;\n mainCreditCardInfo.expirationDate = creditCard.expires.replace(/ /g, '');\n mainCreditCardInfo.cvv = creditCard.cvv;\n mainCreditCardInfo.billingAddress = {};\n mainCreditCardInfo.billingAddress = {postalCode: creditCard.postCode};\n var defer = this.$q.defer();\n\n this.getClientToken(accountId).then(() => {\n client = new this.$braintree.api.Client({\n clientToken: this.tokensPerAccount.get(accountId)\n });\n\n client.tokenizeCard(mainCreditCardInfo, function (err, nonce) {\n var newCreditCard = {nonce: nonce};\n newCreditCard.state = creditCard.state;\n newCreditCard.country = creditCard.country;\n newCreditCard.streetAddress = creditCard.streetAddress;\n newCreditCard.city = creditCard.city;\n\n remotePaymentAPI.add({accountId: accountId}, newCreditCard).$promise.then(() => {\n defer.resolve();\n }, (error) => {\n defer.reject(error);\n });\n\n });\n });\n return defer.promise;\n }", "function createContatct() {\n let firstName = prompt(\"Enter First Name \");\n let lastName = prompt(\"Enter last Name \");\n let address = prompt(\"Enter Address \");\n let city = prompt(\"Enter City \");\n let state = prompt(\"Enter State \");\n let zip = prompt(\"Enter Zip \");\n let phoneNumber = prompt(\"Enter phone number \");\n let email = prompt(\"Enter Email address \");\n return new Contact(firstName,lastName,address,city,state,zip,phoneNumber,email)\n}", "function Card(definedCard) {\n\t\t// this ensures that if we're not passed an object, we throw an error\n\t\tif (definedCard !== undefined && 'object' !== typeof definedCard) {\n\t\t\tthrow new Error('');\n\t\t}\n\n\t\tthis.suit = definedCard.suit;\n\t\tthis.symbol = definedCard.symbol;\n\t\tthis.color = definedCard.color;\n\t\tthis.face = definedCard.face;\n\t\tthis.name = definedCard.name;\n\t\tthis.value = definedCard.value;\n\t}", "function ProcedureRequest() {\n\t\tthis.procedure_id = 0;\n\t\tthis.encounter_id = 0;\n\t\tthis.active_ind = 0;\n\t\tthis.nomenclature_id = 0;\n\t\tthis.procedure_date = \"\";\n\t\tthis.procedure_date_precision = 0;\n\t\tthis.procedure_date_precision_cd = 0;\n\t\tthis.free_text = \"\";\n\t\tthis.update_cnt = 0;\n\t}", "function createCard(card, player, pos) {\n var cardInstance = clone(card);\n cardInstance.id = _.uniqueId('card');\n cardInstance.player = player;\n if (card.type === 'unit') {\n cardInstance.attacks = 1;\n cardInstance.attacksLeft = 1;\n cardInstance.moves = 1;\n cardInstance.movesLeft = 1;\n }\n if (pos)\n cardInstance.pos = pos;\n return cardInstance;\n}", "function PaymantCard(accBal, status, date) {\n this.accountBalance = parseFloat(accBal.toFixed(2));\n this.status = (function () {\n status ? \"Card is active!\" : \"Card is not active\";\n })();\n this.valid = \"Valid until \" + date;\n }", "constructor() {\n super('VerificationRequest', new SimpleSchema({\n studentID: { type: SimpleSchema.RegEx.Id },\n opportunityInstanceID: { type: SimpleSchema.RegEx.Id },\n submittedOn: { type: Date },\n status: { type: String },\n processed: { type: [ProcessedSchema] },\n ice: { type: Object, optional: true, blackbox: true },\n }));\n this.ACCEPTED = 'Accepted';\n this.REJECTED = 'Rejected';\n this.OPEN = 'Open';\n }", "static fromTransaction(chainId, serializedTransaction, options = {}) {\n if (typeof chainId !== 'string') {\n chainId = Serialize.arrayToHex(chainId);\n }\n if (typeof serializedTransaction === 'string') {\n serializedTransaction = Serialize.hexToUint8Array(serializedTransaction);\n }\n let buf = new Serialize.SerialBuffer({\n textDecoder: options.textDecoder,\n textEncoder: options.textEncoder,\n });\n buf.push(2); // header\n const id = variantId(chainId);\n if (id[0] === 'chain_alias') {\n buf.push(0);\n buf.push(id[1]);\n }\n else {\n buf.push(1);\n buf.pushArray(Serialize.hexToUint8Array(id[1]));\n }\n buf.push(2); // transaction variant\n buf.pushArray(serializedTransaction);\n buf.push(abi.RequestFlagsBroadcast); // flags\n buf.push(0); // callback\n buf.push(0); // info\n return SigningRequest.fromData(buf.asUint8Array(), options);\n }", "function createPipelineRequest(options) {\n return new PipelineRequestImpl(options);\n}", "function Contact(firstName, lastName, phoneNumber, email, address, address2, city, state, zip) {\n this.firstName = firstName;\n this.lastName = lastName;\n this.phoneNumber = phoneNumber;\n this.email = email;\n this.address = address;\n this.address2 = address2\n this.city = city;\n this.state = state;\n this.zip = zip;\n}", "function exploreCertificateSigningRequest(crl) {\r\n const blockInfo = asn1_1.readTag(crl, 0);\r\n const blocks = asn1_1._readStruct(crl, blockInfo);\r\n const csrInfo = readCertificationRequestInfo(crl, blocks[0]);\r\n return csrInfo;\r\n}", "create () {\n return StripeAction.extend ({\n schema: {\n 'stripe-account.type': {\n in: 'body',\n isIn: {\n options: ['standard', 'express', 'custom']\n }\n }\n },\n\n execute (req, res) {\n const { [this.controller.name]: data } = req.body;\n\n return this.stripe.accounts.create (data)\n .then (result => res.status (200).json ({[this.controller.resourceName]: result}));\n }\n });\n }", "createDelivery (clientId, data) {\n return this.createRequest(`/clients/${clientId}/card-deliveries`,'POST', data);\n }", "function setCardNumber(cardnumber) \n{\n\tthis.cardnumber = cardnumber;\n\treturn this;\n}", "request() {\n return new SkillRequest(this._context);\n }", "createSubscription(subscriptionData) {\n var path = '/subscriptions';\n var method = 'POST';\n var options = buildOptions(this.token, this.endPoint, path, method, subscriptionData);\n return goCardlessRequest(options);\n }", "function commentOnBillRequest() {\n return {\n type: POST_COMMENT_ON_BILL_REQUEST\n };\n}", "function submitAccount(){\n let customerInfo = {\n \"first_name\" : $(\"#firstName_input\").val(),\n \"middle_name\" : $(\"#middleName_input\").val(),\n \"last_name\" : $(\"#lastName_input\").val(),\n \"email\" : $(\"#email_input\").val(),\n \"phone\" : $(\"#phone_input\").val(),\n \"address_line1\" : $(\"#address1_input\").val(),\n \"address_line2\" : $(\"#address2_input\").val(),\n \"city\" : $(\"#city_input\").val(),\n \"state\" : $(\"#state_input\").val(),\n \"zip\" : $(\"#zip_input\").val(),\n \"notes\" : $(\"#customerNotes_input\").val()\n }\n\n createCustomer(customerInfo);\n}", "function createPrepaidRecord(purchaseOrderId, code, callback) {\n var success = function (data) {\n PageVariable.prepaidCardRecord = data;\n if (typeof callback == \"function\") {\n callback();\n }\n };\n var requestParam = {};\n requestParam.code = code;\n requestParam.purchaseOrderId = purchaseOrderId;\n ajaxRequest(PageVariable.service.createPrepaidRecord, requestParam, success);\n\n}", "function buildRequest(options, req) {\n var operation = options.operation,\n requestBody = options.requestBody,\n securities = options.securities,\n spec = options.spec,\n attachContentTypeForEmptyPayload = options.attachContentTypeForEmptyPayload;\n var requestContentType = options.requestContentType;\n req = applySecurities({\n request: req,\n securities: securities,\n operation: operation,\n spec: spec\n });\n var requestBodyDef = operation.requestBody || {};\n\n var requestBodyMediaTypes = _babel_runtime_corejs3_core_js_stable_object_keys__WEBPACK_IMPORTED_MODULE_2___default()(requestBodyDef.content || {});\n\n var isExplicitContentTypeValid = requestContentType && requestBodyMediaTypes.indexOf(requestContentType) > -1; // for OAS3: set the Content-Type\n\n if (requestBody || attachContentTypeForEmptyPayload) {\n // does the passed requestContentType appear in the requestBody definition?\n if (requestContentType && isExplicitContentTypeValid) {\n req.headers['Content-Type'] = requestContentType;\n } else if (!requestContentType) {\n var firstMediaType = requestBodyMediaTypes[0];\n\n if (firstMediaType) {\n req.headers['Content-Type'] = firstMediaType;\n requestContentType = firstMediaType;\n }\n }\n } else if (requestContentType && isExplicitContentTypeValid) {\n req.headers['Content-Type'] = requestContentType;\n }\n\n if (!options.responseContentType && operation.responses) {\n var _context;\n\n var mediaTypes = _babel_runtime_corejs3_core_js_stable_instance_filter__WEBPACK_IMPORTED_MODULE_3___default()(_context = _babel_runtime_corejs3_core_js_stable_object_entries__WEBPACK_IMPORTED_MODULE_4___default()(operation.responses)).call(_context, function (_ref) {\n var _ref2 = (0,_babel_runtime_corejs3_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__.default)(_ref, 2),\n key = _ref2[0],\n value = _ref2[1];\n\n var code = parseInt(key, 10);\n return code >= 200 && code < 300 && lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_8___default()(value.content);\n }).reduce(function (acc, _ref3) {\n var _ref4 = (0,_babel_runtime_corejs3_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__.default)(_ref3, 2),\n value = _ref4[1];\n\n return _babel_runtime_corejs3_core_js_stable_instance_concat__WEBPACK_IMPORTED_MODULE_5___default()(acc).call(acc, _babel_runtime_corejs3_core_js_stable_object_keys__WEBPACK_IMPORTED_MODULE_2___default()(value.content));\n }, []);\n\n if (mediaTypes.length > 0) {\n req.headers.accept = mediaTypes.join(', ');\n }\n } // for OAS3: add requestBody to request\n\n\n if (requestBody) {\n if (requestContentType) {\n if (requestBodyMediaTypes.indexOf(requestContentType) > -1) {\n // only attach body if the requestBody has a definition for the\n // contentType that has been explicitly set\n if (requestContentType === 'application/x-www-form-urlencoded' || requestContentType === 'multipart/form-data') {\n if ((0,_babel_runtime_corejs3_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__.default)(requestBody) === 'object') {\n var encoding = (requestBodyDef.content[requestContentType] || {}).encoding || {};\n req.form = {};\n\n _babel_runtime_corejs3_core_js_stable_object_keys__WEBPACK_IMPORTED_MODULE_2___default()(requestBody).forEach(function (k) {\n req.form[k] = {\n value: requestBody[k],\n encoding: encoding[k] || {}\n };\n });\n } else {\n req.form = requestBody;\n }\n } else {\n req.body = requestBody;\n }\n }\n } else {\n req.body = requestBody;\n }\n }\n\n return req;\n} // Add security values, to operations - that declare their need on them", "function buildRequest(options, req) {\n var operation = options.operation,\n requestBody = options.requestBody,\n securities = options.securities,\n spec = options.spec,\n attachContentTypeForEmptyPayload = options.attachContentTypeForEmptyPayload;\n var requestContentType = options.requestContentType;\n req = applySecurities({\n request: req,\n securities: securities,\n operation: operation,\n spec: spec\n });\n var requestBodyDef = operation.requestBody || {};\n\n var requestBodyMediaTypes = _babel_runtime_corejs3_core_js_stable_object_keys__WEBPACK_IMPORTED_MODULE_2___default()(requestBodyDef.content || {});\n\n var isExplicitContentTypeValid = requestContentType && requestBodyMediaTypes.indexOf(requestContentType) > -1; // for OAS3: set the Content-Type\n\n if (requestBody || attachContentTypeForEmptyPayload) {\n // does the passed requestContentType appear in the requestBody definition?\n if (requestContentType && isExplicitContentTypeValid) {\n req.headers['Content-Type'] = requestContentType;\n } else if (!requestContentType) {\n var firstMediaType = requestBodyMediaTypes[0];\n\n if (firstMediaType) {\n req.headers['Content-Type'] = firstMediaType;\n requestContentType = firstMediaType;\n }\n }\n } else if (requestContentType && isExplicitContentTypeValid) {\n req.headers['Content-Type'] = requestContentType;\n }\n\n if (!options.responseContentType && operation.responses) {\n var _context;\n\n var mediaTypes = _babel_runtime_corejs3_core_js_stable_instance_filter__WEBPACK_IMPORTED_MODULE_3___default()(_context = _babel_runtime_corejs3_core_js_stable_object_entries__WEBPACK_IMPORTED_MODULE_4___default()(operation.responses)).call(_context, function (_ref) {\n var _ref2 = _babel_runtime_corejs3_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_ref, 2),\n key = _ref2[0],\n value = _ref2[1];\n\n var code = parseInt(key, 10);\n return code >= 200 && code < 300 && lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_8___default()(value.content);\n }).reduce(function (acc, _ref3) {\n var _ref4 = _babel_runtime_corejs3_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_ref3, 2),\n value = _ref4[1];\n\n return _babel_runtime_corejs3_core_js_stable_instance_concat__WEBPACK_IMPORTED_MODULE_5___default()(acc).call(acc, _babel_runtime_corejs3_core_js_stable_object_keys__WEBPACK_IMPORTED_MODULE_2___default()(value.content));\n }, []);\n\n if (mediaTypes.length > 0) {\n req.headers.accept = mediaTypes.join(', ');\n }\n } // for OAS3: add requestBody to request\n\n\n if (requestBody) {\n if (requestContentType) {\n if (requestBodyMediaTypes.indexOf(requestContentType) > -1) {\n // only attach body if the requestBody has a definition for the\n // contentType that has been explicitly set\n if (requestContentType === 'application/x-www-form-urlencoded' || requestContentType === 'multipart/form-data') {\n if (_babel_runtime_corejs3_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(requestBody) === 'object') {\n var encoding = (requestBodyDef.content[requestContentType] || {}).encoding || {};\n req.form = {};\n\n _babel_runtime_corejs3_core_js_stable_object_keys__WEBPACK_IMPORTED_MODULE_2___default()(requestBody).forEach(function (k) {\n req.form[k] = {\n value: requestBody[k],\n encoding: encoding[k] || {}\n };\n });\n } else {\n req.form = requestBody;\n }\n } else {\n req.body = requestBody;\n }\n }\n } else {\n req.body = requestBody;\n }\n }\n\n return req;\n} // Add security values, to operations - that declare their need on them", "clone () {\n\t if (!(this instanceof Request)) {\n\t throw new TypeError('Illegal invocation')\n\t }\n\n\t // 1. If this is unusable, then throw a TypeError.\n\t if (this.bodyUsed || this.body?.locked) {\n\t throw new TypeError('unusable')\n\t }\n\n\t // 2. Let clonedRequest be the result of cloning this’s request.\n\t const clonedRequest = cloneRequest(this[kState]);\n\n\t // 3. Let clonedRequestObject be the result of creating a Request object,\n\t // given clonedRequest, this’s headers’s guard, and this’s relevant Realm.\n\t const clonedRequestObject = new Request(kInit);\n\t clonedRequestObject[kState] = clonedRequest;\n\t clonedRequestObject[kRealm] = this[kRealm];\n\t clonedRequestObject[kHeaders] = new Headers();\n\t clonedRequestObject[kHeaders][kHeadersList] = clonedRequest.headersList;\n\t clonedRequestObject[kHeaders][kGuard] = this[kHeaders][kGuard];\n\t clonedRequestObject[kHeaders][kRealm] = this[kHeaders][kRealm];\n\n\t // 4. Make clonedRequestObject’s signal follow this’s signal.\n\t const ac = new AbortController();\n\t if (this.signal.aborted) {\n\t ac.abort(this.signal.reason);\n\t } else {\n\t this.signal.addEventListener(\n\t 'abort',\n\t () => {\n\t ac.abort(this.signal.reason);\n\t },\n\t { once: true }\n\t );\n\t }\n\t clonedRequestObject[kSignal] = ac.signal;\n\n\t // 4. Return clonedRequestObject.\n\t return clonedRequestObject\n\t }", "function MakeCard(number,expdate){\n var newcard = {\n number: number,\n exp: expdate\n };\n return newcard; \n }", "createPaymentLink (clientId) {\n return this.createRequest(`/clients/${clientId}/card2card`,'POST');\n }", "function create(customer) {\n const newCust = {}\n newCust.id = Date.now() % 100000;\n newCust.first_name = customer.first_name;\n newCust.last_name = customer.last_name;\n newCust.company_name = customer.company_name;\n newCust.address = customer.address;\n newCust.city = customer.city;\n newCust.province = customer.province;\n newCust.postal = customer.postal;\n newCust.phone1 = customer.phone1;\n newCust.phone2 = customer.phone2;\n newCust.email = customer.email;\n newCust.web = customer.web;\n\n customers.push(newCust);\n}", "function prepareContactDetail (customerDO) {\n\t\t\t\tvar contactDetail = {\n\t\t\t\t\t'phone1' : customerDO.phoneNumber,\n\t\t\t\t\t'email' : customerDO.email,\n\t\t\t\t\t'person' : {\n\t\t\t\t\t\t'firstName' : customerDO.firstName,\n\t\t\t\t\t\t'lastName' :customerDO.lastName\n\t\t\t\t\t},\n\t\t\t\t\t'address' : {\n\t\t\t\t\t\t'street1' : $scope.customerDO.street1,\n\t\t\t\t\t\t'city' : $scope.customerDO.city,\n\t\t\t\t\t\t'state' : $scope.customerDO.state,\n\t\t\t\t\t\t'country' : $scope.customerDO.country,\n\t\t\t\t\t\t'postalCode' : $scope.customerDO.postalCode\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\treturn contactDetail;\n\t\t\t}", "createNew(request, response, next) {\n console.log(request.query)\n console.log(request.body)\n\n // minimum check\n if (request.body.email !== null) {\n \n // create object with form input\n const costumerData = {\n firstName: request.body.firstName,\n lastName: request.body.lastName,\n contactNumber: request.body.contactNumber,\n address: request.body.address,\n city: request.body.city,\n state: request.body.state,\n email: request.body.email,\n };\n\n // Save on DB\n // this.create...\n this.model.create(costumerData, (err, data) => {\n debug('Costumers response:', data, err);\n if (err) {\n return next(err);\n }\n return response.json(data);\n });\n }\n else {\n const err = new Error('All fields required.');\n err.status = 400;\n return next(err);\n }\n }", "function getRawPaymentRequest(paymentUrl) {\n var deferred = jquery_default.a.Deferred();\n\n var paymentUrlObject = new url_parse_default.a(paymentUrl, true);\n\n // Detect 'bitcoin:' urls and extract payment-protocol section\n if (paymentUrlObject.protocol !== 'http:' && paymentUrlObject.protocol !== 'https:') {\n if (!paymentUrlObject.query.r) {\n return deferred.reject(new Error('Invalid payment protocol url'));\n } else {\n paymentUrl = paymentUrlObject.query.r;\n }\n }\n\n var requestOptions = {\n dataType: 'text',\n url: paymentUrl,\n headers: {\n 'Accept': 'application/payment-request'\n }\n };\n\n jquery_default.a.get(requestOptions).done(function (data, textStatus, jqXHR) {\n /* See [Header Issue] section above\n const digest = jqXHR.getResponseHeader('digest')\n if (digest) {\n deferred.resolve(data, digest)\n } else {\n deferred.reject('Digest missing from response headers')\n }\n */\n deferred.resolve(data, null);\n }).fail(function (xhr) {\n deferred.reject(xhr.responseText || 'Could not get data for the specified payment request');\n });\n\n return deferred;\n}", "get certificateSigningRequestInput() {\n return this._certificateSigningRequest;\n }" ]
[ "0.602485", "0.5595641", "0.53184956", "0.52775127", "0.52107126", "0.51801497", "0.5150606", "0.5078826", "0.5068721", "0.4944214", "0.48754525", "0.48325714", "0.47940364", "0.47901103", "0.4780391", "0.47507906", "0.47404736", "0.47304383", "0.47131157", "0.4674268", "0.46518442", "0.46386477", "0.4626208", "0.46088484", "0.4595576", "0.45573604", "0.45441785", "0.4522389", "0.44882908", "0.44692346", "0.4467513", "0.44611174", "0.44534984", "0.4430236", "0.4413565", "0.439357", "0.437926", "0.43559593", "0.43496034", "0.433562", "0.4329442", "0.4328921", "0.43162972", "0.43087757", "0.42989203", "0.42844215", "0.42308363", "0.42307878", "0.42217302", "0.42214328", "0.41890237", "0.41815564", "0.41612095", "0.41605434", "0.4142674", "0.41346583", "0.4116888", "0.41131905", "0.41018096", "0.4081022", "0.40772346", "0.40531415", "0.4041224", "0.40393496", "0.40393496", "0.40243638", "0.40222585", "0.40158686", "0.40004054", "0.397739", "0.39773735", "0.39723402", "0.39633676", "0.3955194", "0.39457574", "0.39425766", "0.3942507", "0.39320213", "0.39311802", "0.39311272", "0.3921861", "0.3921595", "0.3920926", "0.39187694", "0.3907375", "0.39009497", "0.38974422", "0.38962388", "0.38910156", "0.3889357", "0.3885755", "0.38826928", "0.3882534", "0.388245", "0.38792673", "0.38785332", "0.38728034", "0.38693997", "0.38573268", "0.38491902", "0.38467118" ]
0.0
-1
vuerouter v3.0.1 (c) 2017 Evan You
function i(e,t){0}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jj(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"source.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function TM(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function vT(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"layer.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "vampireWithName(name) {\n \n }", "function Uk(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function BO(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function Es(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function VI(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"layer.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function iP(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"source.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function Qw(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function fyv(){\n \n }", "function Vt(){this.__data__=[]}", "function VO(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};VO.installed||(VO.installed=!0,t.use(i,e),t.use(r,e),t.use(o,e),t.use(a,e),t.use(s,e),t.use(u,e),t.use(l,e),t.use(c,e),t.use(d,e),t.use(h,e),t.use(f,e),t.use(p,e),t.use(m,e),t.use(v,e),t.use(g,e),t.use(_,e),t.use(y,e),t.use(b,e),t.use(x,e),t.use(w,e),t.use(A,e),t.use(M,e),t.use(S,e),t.use(T,e),t.use(k,e),t.use(O,e),t.use(C,e),t.use(L,e),t.use(E,e),t.use(D,e),t.use(j,e),t.use(I,e),t.use(P,e),t.use(Y,e),t.use(F,e),t.use(R,e),t.use(N,e),t.use(B,e),t.use($,e),t.use(z,e),t.use(H,e),t.use(V,e),t.use(G,e))}", "function Ak(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function cO(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function Wx(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function version(){ return \"0.13.0\" }", "function SigV4Utils() { }", "function Rb(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function yh(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"graticule.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function jx(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function ow(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function Ek(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function uf(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"layer.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "private public function m246() {}", "added(vrobject){}", "function PD(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function dp(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function Mv(){var t=this;ci()(this,{$source:{enumerable:!0,get:function(){return t.$olObject}},$map:{enumerable:!0,get:function(){return t.$services&&uu()(t.$services)}},$view:{enumerable:!0,get:function(){return t.$services&&t.$services.view}},$sourceContainer:{enumerable:!0,get:function(){return t.$services&&t.$services.sourceContainer}}})}", "function vI(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"style.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "InitVsaEngine() {\n\n }", "upgrade() {}", "function vinewx(t=\"untitled\",s=!1){return new class{constructor(t,s){this.name=t,this.debug=s,this.isQX=\"undefined\"!=typeof $task,this.isLoon=\"undefined\"!=typeof $loon,this.isSurge=\"undefined\"!=typeof $httpClient&&!this.isLoon,this.isNode=\"function\"==typeof require,this.isJSBox=this.isNode&&\"undefined\"!=typeof $jsbox,this.node=(()=>this.isNode?{request:\"undefined\"!=typeof $request?void 0:require(\"request\"),fs:require(\"fs\")}:null)(),this.cache=this.initCache(),this.log(`INITIAL CACHE:\\n${JSON.stringify(this.cache)}`),Promise.prototype.delay=function(t){return this.then(function(s){return((t,s)=>new Promise(function(e){setTimeout(e.bind(null,s),t)}))(t,s)})}}get(t){return this.isQX?(\"string\"==typeof t&&(t={url:t,method:\"GET\"}),$task.fetch(t)):new Promise((s,e)=>{this.isLoon||this.isSurge?$httpClient.get(t,(t,i,o)=>{t?e(t):s({status:i.status,headers:i.headers,body:o})}):this.node.request(t,(t,i,o)=>{t?e(t):s({...i,status:i.statusCode,body:o})})})}post(t){return this.isQX?(\"string\"==typeof t&&(t={url:t}),t.method=\"POST\",$task.fetch(t)):new Promise((s,e)=>{this.isLoon||this.isSurge?$httpClient.post(t,(t,i,o)=>{t?e(t):s({status:i.status,headers:i.headers,body:o})}):this.node.request.post(t,(t,i,o)=>{t?e(t):s({...i,status:i.statusCode,body:o})})})}initCache(){if(this.isQX)return JSON.parse($prefs.valueForKey(this.name)||\"{}\");if(this.isLoon||this.isSurge)return JSON.parse($persistentStore.read(this.name)||\"{}\");if(this.isNode){const t=`${this.name}.json`;return this.node.fs.existsSync(t)?JSON.parse(this.node.fs.readFileSync(`${this.name}.json`)):(this.node.fs.writeFileSync(t,JSON.stringify({}),{flag:\"wx\"},t=>console.log(t)),{})}}persistCache(){const t=JSON.stringify(this.cache);this.log(`FLUSHING DATA:\\n${t}`),this.isQX&&$prefs.setValueForKey(t,this.name),(this.isLoon||this.isSurge)&&$persistentStore.write(t,this.name),this.isNode&&this.node.fs.writeFileSync(`${this.name}.json`,t,{flag:\"w\"},t=>console.log(t))}write(t,s){this.log(`SET ${s} = ${JSON.stringify(t)}`),this.cache[s]=t,this.persistCache()}read(t){return this.log(`READ ${t} ==> ${JSON.stringify(this.cache[t])}`),this.cache[t]}delete(t){this.log(`DELETE ${t}`),delete this.cache[t],this.persistCache()}notify(t,s,e,i){const o=\"string\"==typeof i?i:void 0,n=e+(null==o?\"\":`\\n${o}`);this.isQX&&(void 0!==o?$notify(t,s,e,{\"open-url\":o}):$notify(t,s,e,i)),this.isSurge&&$notification.post(t,s,n),this.isLoon&&$notification.post(t,s,e),this.isNode&&(this.isJSBox?require(\"push\").schedule({title:t,body:s?s+\"\\n\"+e:e}):console.log(`${t}\\n${s}\\n${n}\\n\\n`))}log(t){this.debug&&console.log(t)}info(t){console.log(t)}error(t){console.log(\"ERROR: \"+t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){this.isQX||this.isLoon||this.isSurge?$done(t):this.isNode&&!this.isJSBox&&\"undefined\"!=typeof $context&&($context.headers=t.headers,$context.statusCode=t.statusCode,$context.body=t.body)}}(t,s)}", "function r(t,e,n){if(a(t,e))return void(t[e]=n);if(t._isVue)return void r(t._data,e,n);var i=t.__ob__;if(!i)return void(t[e]=n);if(i.convert(e,n),i.dep.notify(),i.vms)for(var s=i.vms.length;s--;){var o=i.vms[s];o._proxy(e),o._digest()}return n}", "function $S(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function EN(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"layer.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function iT(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"layer.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function Bv(e){let{basename:t,children:n,window:r}=e,l=X.exports.useRef();l.current==null&&(l.current=gv({window:r}));let o=l.current,[i,u]=X.exports.useState({action:o.action,location:o.location});return X.exports.useLayoutEffect(()=>o.listen(u),[o]),X.exports.createElement(Fv,{basename:t,children:n,location:i.location,navigationType:i.action,navigator:o})}", "function WD(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "constructor() { \n \n Souvenir.initialize(this);\n }", "function i(t,e,n){if(o(t,e))return void(t[e]=n);if(t._isVue)return void i(t._data,e,n);var r=t.__ob__;if(!r)return void(t[e]=n);if(r.convert(e,n),r.dep.notify(),r.vms)for(var s=r.vms.length;s--;){var a=r.vms[s];a._proxy(e),a._digest()}return n}", "function zC(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"layer.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function vh(){}", "function Visitor(q,v){function y(a){function c(a,d,c){c=c?c+=\"|\":c;return c+(a+\"=\"+encodeURIComponent(d))}for(var b=\"\",e=0,f=a.length;e<f;e++){var g=a[e],h=g[0],g=g[1];g!=i&&g!==t&&(b=c(h,g,b))}return function(a){var d=(new Date).getTime(),a=a?a+=\"|\":a;return a+(\"TS=\"+d)}(b)}if(!q)throw\"Visitor requires Adobe Marketing Cloud Org ID\";var a=this;a.version=\"1.9.1\";var m=window,l=m.Visitor;l.version=a.version;m.s_c_in||(m.s_c_il=[],m.s_c_in=0);a._c=\"Visitor\";a._il=m.s_c_il;a._in=m.s_c_in;a._il[a._in]=a;m.s_c_in++;a.ja={Fa:[]};var u=m.document,i=l.Cb;i||(i=null);var E=l.Db;E||(E=void 0);var j=l.Oa;j||(j=!0);var k=l.Ma;k||(k=!1);a.fa=function(a){var c=0,b,e;if(a)for(b=0;b<a.length;b++)e=a.charCodeAt(b),c=(c<<5)-c+e,c&=c;return c};a.s=function(a,c){var b=\"0123456789\",e=\"\",f=\"\",g,h,i=8,k=10,l=10;c===n&&(w.isClientSideMarketingCloudVisitorID=j);if(1==a){b+=\"ABCDEF\";for(g=0;16>g;g++)h=Math.floor(Math.random()*i),e+=b.substring(h,h+1),h=Math.floor(Math.random()*i),f+=b.substring(h,h+1),i=16;return e+\n\"-\"+f}for(g=0;19>g;g++)h=Math.floor(Math.random()*k),e+=b.substring(h,h+1),0==g&&9==h?k=3:(1==g||2==g)&&10!=k&&2>h?k=10:2<g&&(k=10),h=Math.floor(Math.random()*l),f+=b.substring(h,h+1),0==g&&9==h?l=3:(1==g||2==g)&&10!=l&&2>h?l=10:2<g&&(l=10);return e+f};a.Ra=function(){var a;!a&&m.location&&(a=m.location.hostname);if(a)if(/^[0-9.]+$/.test(a))a=\"\";else{var c=a.split(\".\"),b=c.length-1,e=b-1;1<b&&2>=c[b].length&&(2==c[b-1].length||0>\",ac,ad,ae,af,ag,ai,al,am,an,ao,aq,ar,as,at,au,aw,ax,az,ba,bb,be,bf,bg,bh,bi,bj,bm,bo,br,bs,bt,bv,bw,by,bz,ca,cc,cd,cf,cg,ch,ci,cl,cm,cn,co,cr,cu,cv,cw,cx,cz,de,dj,dk,dm,do,dz,ec,ee,eg,es,et,eu,fi,fm,fo,fr,ga,gb,gd,ge,gf,gg,gh,gi,gl,gm,gn,gp,gq,gr,gs,gt,gw,gy,hk,hm,hn,hr,ht,hu,id,ie,im,in,io,iq,ir,is,it,je,jo,jp,kg,ki,km,kn,kp,kr,ky,kz,la,lb,lc,li,lk,lr,ls,lt,lu,lv,ly,ma,mc,md,me,mg,mh,mk,ml,mn,mo,mp,mq,mr,ms,mt,mu,mv,mw,mx,my,na,nc,ne,nf,ng,nl,no,nr,nu,nz,om,pa,pe,pf,ph,pk,pl,pm,pn,pr,ps,pt,pw,py,qa,re,ro,rs,ru,rw,sa,sb,sc,sd,se,sg,sh,si,sj,sk,sl,sm,sn,so,sr,st,su,sv,sx,sy,sz,tc,td,tf,tg,th,tj,tk,tl,tm,tn,to,tp,tr,tt,tv,tw,tz,ua,ug,uk,us,uy,uz,va,vc,ve,vg,vi,vn,vu,wf,ws,yt,\".indexOf(\",\"+\nc[b]+\",\"))&&e--;if(0<e)for(a=\"\";b>=e;)a=c[b]+(a?\".\":\"\")+a,b--}return a};a.cookieRead=function(a){var a=encodeURIComponent(a),c=(\";\"+u.cookie).split(\" \").join(\";\"),b=c.indexOf(\";\"+a+\"=\"),e=0>b?b:c.indexOf(\";\",b+1);return 0>b?\"\":decodeURIComponent(c.substring(b+2+a.length,0>e?c.length:e))};a.cookieWrite=function(d,c,b){var e=a.cookieLifetime,f,c=\"\"+c,e=e?(\"\"+e).toUpperCase():\"\";b&&\"SESSION\"!=e&&\"NONE\"!=e?(f=\"\"!=c?parseInt(e?e:0,10):-60)?(b=new Date,b.setTime(b.getTime()+1E3*f)):1==b&&(b=new Date,f=b.getYear(),b.setYear(f+2+(1900>f?1900:0))):b=0;return d&&\"NONE\"!=e?(u.cookie=encodeURIComponent(d)+\"=\"+encodeURIComponent(c)+\"; path=/;\"+(b?\" expires=\"+b.toGMTString()+\";\":\"\")+(a.cookieDomain?\" domain=\"+a.cookieDomain+\";\":\"\"),a.cookieRead(d)==c):0};a.h=i;a.J=function(a,c){try{\"function\"==typeof a?a.apply(m,c):a[1].apply(a[0],c)}catch(b){}};a.Xa=function(d,c){c&&(a.h==i&&(a.h={}),a.h[d]==E&&(a.h[d]=[]),a.h[d].push(c))};a.r=function(d,c){if(a.h!=i){var b=a.h[d];if(b)for(;0<b.length;)a.J(b.shift(),c)}};a.v=function(a,c,b,e){b=encodeURIComponent(c)+\"=\"+encodeURIComponent(b);c=x.vb(a);a=x.mb(a);if(-1===a.indexOf(\"?\"))return a+\"?\"+b+c;var f=a.split(\"?\"),a=f[0]+\"?\",e=x.$a(f[1],b,e);return a+e+c};a.Qa=function(a,c){var b=RegExp(\"[\\\\?&#]\"+c+\"=([^&#]*)\").exec(a);if(b&&b.length)return decodeURIComponent(b[1])};a.Wa=function(){var d=i,c=m.location.href;try{var b=a.Qa(c,r.Z);if(b)for(var d={},e=b.split(\"|\"),c=0,f=e.length;c<f;c++){var g=e[c].split(\"=\");d[g[0]]=decodeURIComponent(g[1])}return d}catch(h){}};a.ba=function(){var d=a.Wa();if(d&&d.TS&&!(((new Date).getTime()-d.TS)/6E4>r.Ka||d[I]!==q)){var c=d[n],b=a.setMarketingCloudVisitorID;c&&c.match(r.u)&&b(c);a.j(s,-1);d=d[p];c=a.setAnalyticsVisitorID;d&&d.match(r.u)&&c(d)}};a.Va=function(d){function c(d){x.pb(d)&&a.setCustomerIDs(d)}function b(d){d=d||{};a._supplementalDataIDCurrent=d.supplementalDataIDCurrent||\"\";a._supplementalDataIDCurrentConsumed=d.supplementalDataIDCurrentConsumed||{};a._supplementalDataIDLast=d.supplementalDataIDLast||\"\";a._supplementalDataIDLastConsumed=d.supplementalDataIDLastConsumed||{}}d&&d[a.marketingCloudOrgID]&&(d=d[a.marketingCloudOrgID],c(d.customerIDs),b(d.sdid))};a.l=i;a.Ta=function(d,c,b,e){c=a.v(c,\"d_fieldgroup\",d,1);e.url=a.v(e.url,\"d_fieldgroup\",d,1);e.m=a.v(e.m,\"d_fieldgroup\",d,1);w.d[d]=j;e===Object(e)&&e.m&&\"XMLHttpRequest\"===a.la.C.D?a.la.ib(e,b,d):a.useCORSOnly||a.ia(d,c,b)};a.ia=function(d,c,b){var e=0,f=0,g;if(c&&u){for(g=0;!e&&2>g;){try{e=(e=u.getElementsByTagName(0<g?\"HEAD\":\"head\"))&&0<e.length?e[0]:0}catch(h){e=0}g++}if(!e)try{u.body&&(e=u.body)}catch(k){e=0}if(e)for(g=0;!f&&2>g;){try{f=u.createElement(0<g?\"SCRIPT\":\"script\")}catch(l){f=0}g++}}!c||!e||!f?b&&b():(f.type=\"text/javascript\",f.src=c,e.firstChild?e.insertBefore(f,e.firstChild):e.appendChild(f),e=a.loadTimeout,o.d[d]={requestStart:o.o(),url:c,ta:e,ra:o.ya(),sa:0},b&&(a.l==i&&(a.l={}),a.l[d]=setTimeout(function(){b(j)},e)),a.ja.Fa.push(c))};a.Pa=function(d){a.l!=i&&a.l[d]&&(clearTimeout(a.l[d]),a.l[d]=0)};a.ga=k;a.ha=k;a.isAllowed=function(){if(!a.ga&&(a.ga=j,a.cookieRead(a.cookieName)||a.cookieWrite(a.cookieName,\"T\",1)))a.ha=j;return a.ha};a.b=i;a.c=i;var F=l.Ub;F||(F=\"MC\");var n=l.ac;n||(n=\"MCMID\");var I=l.Yb;I||(I=\"MCORGID\");var H=l.Vb;H||(H=\"MCCIDH\");var L=l.Zb;L||(L=\"MCSYNCS\");var J=l.$b;J||(J=\"MCSYNCSOP\");var K=l.Wb;K||(K=\"MCIDTS\");var B=l.Xb;B||(B=\"MCOPTOUT\");var D=l.Sb;D||(D=\"A\");var p=l.Pb;p||(p=\"MCAID\");var C=l.Tb;C||(C=\"AAM\");var A=l.Rb;A||(A=\"MCAAMLH\");var s=l.Qb;s||(s=\"MCAAMB\");var t=l.bc;t||(t=\"NONE\");a.L=0;a.ea=function(){if(!a.L){var d=a.version;a.audienceManagerServer&&(d+=\"|\"+a.audienceManagerServer);a.audienceManagerServerSecure&&(d+=\"|\"+a.audienceManagerServerSecure);a.L=a.fa(d)}return a.L};a.ka=k;a.f=function(){if(!a.ka){a.ka=j;var d=a.ea(),c=k,b=a.cookieRead(a.cookieName),e,f,g,h,l=new Date;a.b==i&&(a.b={});if(b&&\"T\"!=b){b=b.split(\"|\");b[0].match(/^[\\-0-9]+$/)&&(parseInt(b[0],10)!=d&&(c=j),b.shift());1==b.length%2&&b.pop();for(d=0;d<b.length;d+=2)if(e=b[d].split(\"-\"),f=e[0],g=b[d+1],1<e.length?(h=parseInt(e[1],10),e=0<e[1].indexOf(\"s\")):(h=0,e=k),c&&(f==H&&(g=\"\"),0<h&&(h=l.getTime()/1E3-60)),f&&g&&(a.e(f,g,1),0<h&&(a.b[\"expire\"+f]=h+(e?\"s\":\"\"),l.getTime()>=1E3*h||e&&!a.cookieRead(a.sessionCookieName))))a.c||(a.c={}),a.c[f]=j}c=a.loadSSL?!!a.trackingServerSecure:!!a.trackingServer;if(!a.a(p)&&c&&(b=a.cookieRead(\"s_vi\")))b=b.split(\"|\"),1<b.length&&0<=b[0].indexOf(\"v1\")&&(g=b[1],d=g.indexOf(\"[\"),0<=d&&(g=g.substring(0,d)),g&&g.match(r.u)&&a.e(p,g))}};a.Za=function(){var d=a.ea(),c,b;for(c in a.b)!Object.prototype[c]&&a.b[c]&&\"expire\"!=c.substring(0,6)&&(b=a.b[c],d+=(d?\"|\":\"\")+c+(a.b[\"expire\"+c]?\"-\"+a.b[\"expire\"+c]:\"\")+\"|\"+b);a.cookieWrite(a.cookieName,d,1)};a.a=function(d,c){return a.b!=i&&(c||!a.c||!a.c[d])?a.b[d]:i};a.e=function(d,c,b){a.b==i&&(a.b={});a.b[d]=c;b||a.Za()};a.Sa=function(d,c){var b=a.a(d,c);return b?b.split(\"*\"):i};a.Ya=function(d,c,b){a.e(d,c?c.join(\"*\"):\"\",b)};a.Jb=function(d,c){var b=a.Sa(d,c);if(b){var e={},f;for(f=0;f<b.length;f+=2)e[b[f]]=b[f+1];return e}return i};a.Lb=function(d,c,b){var e=i,f;if(c)for(f in e=[],c)Object.prototype[f]||(e.push(f),e.push(c[f]));a.Ya(d,e,b)};a.j=function(d,c,b){var e=new Date;e.setTime(e.getTime()+1E3*c);a.b==i&&(a.b={});a.b[\"expire\"+d]=Math.floor(e.getTime()/1E3)+(b?\"s\":\"\");0>c?(a.c||(a.c={}),a.c[d]=j):a.c&&(a.c[d]=k);b&&(a.cookieRead(a.sessionCookieName)||a.cookieWrite(a.sessionCookieName,\"1\"))};a.da=function(a){if(a&&(\"object\"==typeof a&&(a=a.d_mid?a.d_mid:a.visitorID?a.visitorID:a.id?a.id:a.uuid?a.uuid:\"\"+a),a&&(a=a.toUpperCase(),\"NOTARGET\"==a&&(a=t)),!a||a!=t&&!a.match(r.u)))a=\"\";return a};a.k=function(d,c){a.Pa(d);a.i!=i&&(a.i[d]=k);o.d[d]&&(o.d[d].Ab=o.o(),o.I(d));w.d[d]&&w.Ha(d,k);if(d==F){w.isClientSideMarketingCloudVisitorID!==j&&(w.isClientSideMarketingCloudVisitorID=k);var b=a.a(n);if(!b||a.overwriteCrossDomainMCIDAndAID){b=\"object\"==typeof c&&c.mid?c.mid:a.da(c);if(!b){if(a.B){a.getAnalyticsVisitorID(i,k,j);return}b=a.s(0,n)}a.e(n,b)}if(!b||b==t)b=\"\";\"object\"==typeof c&&((c.d_region||c.dcs_region||c.d_blob||c.blob)&&a.k(C,c),a.B&&c.mid&&a.k(D,{id:c.id}));a.r(n,[b])}if(d==C&&\"object\"==typeof c){b=604800;c.id_sync_ttl!=E&&c.id_sync_ttl&&(b=parseInt(c.id_sync_ttl,10));var e=a.a(A);e||((e=c.d_region)||(e=c.dcs_region),e&&(a.j(A,b),a.e(A,e)));e||(e=\"\");a.r(A,[e]);e=a.a(s);if(c.d_blob||c.blob)(e=c.d_blob)||(e=c.blob),a.j(s,b),a.e(s,e);e||(e=\"\");a.r(s,[e]);!c.error_msg&&a.A&&a.e(H,a.A)}if(d==D){b=a.a(p);if(!b||a.overwriteCrossDomainMCIDAndAID)(b=a.da(c))?b!==t&&a.j(s,-1):b=t,a.e(p,b);if(!b||b==t)b=\"\";a.r(p,[b])}a.idSyncDisableSyncs?z.za=j:(z.za=k,b={},b.ibs=c.ibs,b.subdomain=c.subdomain,z.wb(b));if(c===Object(c)){var f;a.isAllowed()&&(f=a.a(B));f||(f=t,c.d_optout&&c.d_optout instanceof Array&&(f=c.d_optout.join(\",\")),b=parseInt(c.d_ottl,10),isNaN(b)&&(b=7200),a.j(B,b,j),a.e(B,f));a.r(B,[f])}};a.i=i;a.t=function(d,c,b,e,f){var g=\"\",h,k=x.ob(d);if(a.isAllowed()&&(a.f(),g=a.a(d,M[d]===j),a.disableThirdPartyCalls&&!g&&(d===n?(g=a.s(0,n),a.setMarketingCloudVisitorID(g)):d===p&&!k&&(g=\"\",a.setAnalyticsVisitorID(g))),(!g||a.c&&a.c[d])&&(!a.disableThirdPartyCalls||k)))if(d==n||d==B?h=F:d==A||d==s?h=C:d==p&&(h=D),h){if(c&&(a.i==i||!a.i[h]))a.i==i&&(a.i={}),a.i[h]=j,a.Ta(h,c,function(c,b){if(!a.a(d))if(o.d[h]&&(o.d[h].timeout=o.o(),o.d[h].nb=!!c,o.I(h)),b===Object(b)&&!a.useCORSOnly)a.ia(h,b.url,b.G);else{c&&w.Ha(h,j);var e=\"\";d==n?e=a.s(0,n):h==C&&(e={error_msg:\"timeout\"});a.k(h,e)}},f);if(g)return g;a.Xa(d,b);c||a.k(h,{id:t});return\"\"}if((d==n||d==p)&&g==t)g=\"\",e=j;b&&(e||a.disableThirdPartyCalls)&&a.J(b,[g]);return g};a._setMarketingCloudFields=function(d){a.f();a.k(F,d)};a.setMarketingCloudVisitorID=function(d){a._setMarketingCloudFields(d)};a.B=k;a.getMarketingCloudVisitorID=function(d,c){if(a.isAllowed()){a.marketingCloudServer&&0>a.marketingCloudServer.indexOf(\".demdex.net\")&&(a.B=j);var b=a.z(\"_setMarketingCloudFields\");return a.t(n,b.url,d,c,b)}return\"\"};a.Ua=function(){a.getAudienceManagerBlob()};l.AuthState={UNKNOWN:0,AUTHENTICATED:1,LOGGED_OUT:2};a.w={};a.ca=k;a.A=\"\";a.setCustomerIDs=function(d){if(a.isAllowed()&&d){a.f();var c,b;for(c in d)if(!Object.prototype[c]&&(b=d[c]))if(\"object\"==typeof b){var e={};b.id&&(e.id=b.id);b.authState!=E&&(e.authState=b.authState);a.w[c]=e}else a.w[c]={id:b};var d=a.getCustomerIDs(),e=a.a(H),f=\"\";e||(e=0);for(c in d)Object.prototype[c]||(b=d[c],f+=(f?\"|\":\"\")+c+\"|\"+(b.id?b.id:\"\")+(b.authState?b.authState:\"\"));a.A=a.fa(f);a.A!=e&&(a.ca=j,a.Ua())}};a.getCustomerIDs=function(){a.f();var d={},c,b;for(c in a.w)Object.prototype[c]||(b=a.w[c],d[c]||(d[c]={}),b.id&&(d[c].id=b.id),d[c].authState=b.authState!=E?b.authState:l.AuthState.UNKNOWN);return d};a._setAnalyticsFields=function(d){a.f();a.k(D,d)};a.setAnalyticsVisitorID=function(d){a._setAnalyticsFields(d)};a.getAnalyticsVisitorID=function(d,c,b){if(a.isAllowed()){var e=\"\";b||(e=a.getMarketingCloudVisitorID(function(){a.getAnalyticsVisitorID(d,j)}));if(e||b){var f=b?a.marketingCloudServer:a.trackingServer,g=\"\";a.loadSSL&&(b?a.marketingCloudServerSecure&&(f=a.marketingCloudServerSecure):a.trackingServerSecure&&(f=a.trackingServerSecure));var h={};if(f){var f=\"http\"+(a.loadSSL?\"s\":\"\")+\"://\"+f+\"/id\",e=\"d_visid_ver=\"+\na.version+\"&mcorgid=\"+encodeURIComponent(a.marketingCloudOrgID)+(e?\"&mid=\"+encodeURIComponent(e):\"\")+(a.idSyncDisable3rdPartySyncing?\"&d_coppa=true\":\"\"),i=[\"s_c_il\",a._in,\"_set\"+(b?\"MarketingCloud\":\"Analytics\")+\"Fields\"],g=f+\"?\"+e+\"&callback=s_c_il%5B\"+a._in+\"%5D._set\"+(b?\"MarketingCloud\":\"Analytics\")+\"Fields\";h.m=f+\"?\"+e;h.oa=i}h.url=g;return a.t(b?n:p,g,d,c,h)}}return\"\"};a._setAudienceManagerFields=function(d){a.f();a.k(C,d)};a.z=function(d){var c=a.audienceManagerServer,b=\"\",e=a.a(n),f=a.a(s,j),g=a.a(p),g=g&&g!=t?\"&d_cid_ic=AVID%01\"+encodeURIComponent(g):\"\";a.loadSSL&&a.audienceManagerServerSecure&&(c=a.audienceManagerServerSecure);if(c){var b=a.getCustomerIDs(),h,i;if(b)for(h in b)Object.prototype[h]||(i=b[h],g+=\"&d_cid_ic=\"+encodeURIComponent(h)+\"%01\"+encodeURIComponent(i.id?i.id:\"\")+(i.authState?\"%01\"+i.authState:\"\"));d||(d=\"_setAudienceManagerFields\");c=\"http\"+(a.loadSSL?\"s\":\"\")+\"://\"+c+\"/id\";e=\"d_visid_ver=\"+a.version+\"&d_rtbd=json&d_ver=2\"+(!e&&a.B?\"&d_verify=1\":\"\")+\"&d_orgid=\"+encodeURIComponent(a.marketingCloudOrgID)+\n\"&d_nsid=\"+(a.idSyncContainerID||0)+(e?\"&d_mid=\"+encodeURIComponent(e):\"\")+(a.idSyncDisable3rdPartySyncing?\"&d_coppa=true\":\"\")+(f?\"&d_blob=\"+encodeURIComponent(f):\"\")+g;f=[\"s_c_il\",a._in,d];b=c+\"?\"+e+\"&d_cb=s_c_il%5B\"+a._in+\"%5D.\"+d;return{url:b,m:c+\"?\"+e,oa:f}}return{url:b}};a.getAudienceManagerLocationHint=function(d,c){if(a.isAllowed()&&a.getMarketingCloudVisitorID(function(){a.getAudienceManagerLocationHint(d,j)})){var b=a.a(p);b||(b=a.getAnalyticsVisitorID(function(){a.getAudienceManagerLocationHint(d,j)}));if(b)return b=a.z(),a.t(A,b.url,d,c,b)}return\"\"};a.getLocationHint=a.getAudienceManagerLocationHint;a.getAudienceManagerBlob=function(d,c){if(a.isAllowed()&&a.getMarketingCloudVisitorID(function(){a.getAudienceManagerBlob(d,j)})){var b=a.a(p);b||(b=a.getAnalyticsVisitorID(function(){a.getAudienceManagerBlob(d,j)}));if(b){var b=a.z(),e=b.url;a.ca&&a.j(s,-1);return a.t(s,e,d,c,b)}}return\"\"};a._supplementalDataIDCurrent=\"\";a._supplementalDataIDCurrentConsumed={};a._supplementalDataIDLast=\"\";a._supplementalDataIDLastConsumed={};a.getSupplementalDataID=function(d,c){!a._supplementalDataIDCurrent&&!c&&(a._supplementalDataIDCurrent=a.s(1));var b=a._supplementalDataIDCurrent;a._supplementalDataIDLast&&!a._supplementalDataIDLastConsumed[d]?(b=a._supplementalDataIDLast,a._supplementalDataIDLastConsumed[d]=j):b&&(a._supplementalDataIDCurrentConsumed[d]&&(a._supplementalDataIDLast=a._supplementalDataIDCurrent,a._supplementalDataIDLastConsumed=a._supplementalDataIDCurrentConsumed,a._supplementalDataIDCurrent=b=!c?a.s(1):\"\",a._supplementalDataIDCurrentConsumed={}),b&&(a._supplementalDataIDCurrentConsumed[d]=j));return b};l.OptOut={GLOBAL:\"global\"};a.getOptOut=function(d,c){if(a.isAllowed()){var b=a.z(\"_setMarketingCloudFields\");return a.t(B,b.url,d,c,b)}return\"\"};a.isOptedOut=function(d,c,b){return a.isAllowed()?(c||(c=l.OptOut.GLOBAL),(b=a.getOptOut(function(b){a.J(d,[b==l.OptOut.GLOBAL||0<=b.indexOf(c)])},b))?b==l.OptOut.GLOBAL||0<=b.indexOf(c):i):k};a.appendVisitorIDsTo=function(d){var c=r.Z,b=y([[n,a.a(n)],[p,a.a(p)],[I,a.marketingCloudOrgID]]);try{return a.v(d,c,b)}catch(e){return d}};var r={q:!!m.postMessage,La:1,aa:864E5,Z:\"adobe_mc\",u:/^[0-9a-fA-F\\-]+$/,Ka:5};a.Eb=r;a.na={postMessage:function(a,c,b){var e=1;c&&(r.q?b.postMessage(a,c.replace(/([^:]+:\\/\\/[^\\/]+).*/,\"$1\")):c&&(b.location=c.replace(/#.*$/,\"\")+\"#\"+ +new Date+e++ +\"&\"+a))},U:function(a,c){var b;try{if(r.q)if(a&&(b=function(b){if(\"string\"===typeof c&&b.origin!==c||\"[object Function]\"===Object.prototype.toString.call(c)&&!1===c(b.origin))return!1;a(b)}),window.addEventListener)window[a?\"addEventListener\":\"removeEventListener\"](\"message\",b,!1);else window[a?\"attachEvent\":\"detachEvent\"](\"onmessage\",b)}catch(e){}}};var x={M:function(){if(u.addEventListener)return function(a,c,b){a.addEventListener(c,function(a){\"function\"===typeof b&&b(a)},k)};if(u.attachEvent)return function(a,c,b){a.attachEvent(\"on\"+c,function(a){\"function\"===typeof b&&b(a)})}}(),map:function(a,c){if(Array.prototype.map)return a.map(c);if(void 0===a||a===i)throw new TypeError;var b=Object(a),e=b.length>>>0;if(\"function\"!==typeof c)throw new TypeError;for(var f=Array(e),g=0;g<e;g++)g in b&&(f[g]=c.call(c,b[g],g,b));return f},va:function(a,c){return this.map(a,function(a){return encodeURIComponent(a)}).join(c)},vb:function(a){var c=a.indexOf(\"#\");return 0<c?a.substr(c):\"\"},mb:function(a){var c=a.indexOf(\"#\");return 0<c?a.substr(0,c):a},$a:function(a,c,b){a=a.split(\"&\");b=b!=i?b:a.length;a.splice(b,0,c);return a.join(\"&\")},ob:function(d,c,b){if(d!==p)return k;c||(c=a.trackingServer);b||(b=a.trackingServerSecure);d=a.loadSSL?b:c;return\"string\"===typeof d&&d.length?0>d.indexOf(\"2o7.net\")&&0>d.indexOf(\"omtrdc.net\"):k},pb:function(a){return Boolean(a&&a===Object(a))}};a.Kb=x;var N={C:function(){var a=\"none\",c=j;\"undefined\"!==typeof XMLHttpRequest&&XMLHttpRequest===Object(XMLHttpRequest)&&(\"withCredentials\"in new XMLHttpRequest?a=\"XMLHttpRequest\":(new Function(\"/*@cc_on return /^10/.test(@_jscript_version) @*/\"))()?a=\"XMLHttpRequest\":\"undefined\"!==typeof XDomainRequest&&XDomainRequest===Object(XDomainRequest)&&(c=k),0<Object.prototype.toString.call(window.Bb).indexOf(\"Constructor\")&&(c=k));return{D:a,Nb:c}}(),jb:function(){return\"none\"===this.C.D?i:new window[this.C.D]},ib:function(d,c,b){var e=this;c&&(d.G=c);try{var f=this.jb();f.open(\"get\",d.m+\"&ts=\"+(new Date).getTime(),j);\"XMLHttpRequest\"===this.C.D&&(f.withCredentials=j,f.timeout=a.loadTimeout,f.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\"),f.onreadystatechange=function(){if(4===this.readyState&&200===this.status)a:{var a;try{if(a=JSON.parse(this.responseText),a!==Object(a)){e.n(d,i,\"Response is not JSON\");break a}}catch(c){e.n(d,c,\"Error parsing response as JSON\");break a}try{for(var b=d.oa,f=window,g=0;g<b.length;g++)f=f[b[g]];f(a)}catch(j){e.n(d,j,\"Error forming callback function\")}}});f.onerror=function(a){e.n(d,a,\"onerror\")};f.ontimeout=function(a){e.n(d,a,\"ontimeout\")};f.send();o.d[b]={requestStart:o.o(),url:d.m,ta:f.timeout,ra:o.ya(),sa:1};a.ja.Fa.push(d.m)}catch(g){this.n(d,g,\"try-catch\")}},n:function(d,c,b){a.CORSErrors.push({Ob:d,error:c,description:b});d.G&&(\"ontimeout\"===b?d.G(j):d.G(k,d))}};a.la=N;var z={Na:3E4,$:649,Ja:k,id:i,T:[],Q:i,xa:function(a){if(\"string\"===typeof a)return a=a.split(\"/\"),a[0]+\"//\"+a[2]},g:i,url:i,kb:function(){var d=\"http://fast.\",c=\"?d_nsid=\"+a.idSyncContainerID+\"#\"+encodeURIComponent(u.location.href);this.g||(this.g=\"nosubdomainreturned\");a.loadSSL&&(d=a.idSyncSSLUseAkamai?\"https://fast.\":\"https://\");d=d+this.g+\".demdex.net/dest5.html\"+c;this.Q=this.xa(d);this.id=\"destination_publishing_iframe_\"+this.g+\"_\"+a.idSyncContainerID;return d},cb:function(){var d=\"?d_nsid=\"+a.idSyncContainerID+\"#\"+encodeURIComponent(u.location.href);\"string\"===typeof a.K&&a.K.length&&(this.id=\"destination_publishing_iframe_\"+(new Date).getTime()+\"_\"+a.idSyncContainerID,this.Q=this.xa(a.K),this.url=a.K+d)},za:i,ua:k,W:k,F:i,cc:i,ub:i,dc:i,V:k,H:[],sb:[],tb:[],Ba:r.q?15:100,R:[],qb:[],pa:j,Ea:k,Da:function(){return!a.idSyncDisable3rdPartySyncing&&(this.ua||a.Gb)&&this.g&&\"nosubdomainreturned\"!==this.g&&this.url&&!this.W},O:function(){function a(){e=document.createElement(\"iframe\");e.sandbox=\"allow-scripts allow-same-origin\";e.title=\"Adobe ID Syncing iFrame\";e.id=b.id;e.style.cssText=\"display: none; width: 0; height: 0;\";e.src=b.url;b.ub=j;c();document.body.appendChild(e)}function c(){x.M(e,\"load\",function(){e.className=\"aamIframeLoaded\";b.F=j;b.p()})}this.W=j;var b=this,e=document.getElementById(this.id);e?\"IFRAME\"!==e.nodeName?(this.id+=\"_2\",a()):\"aamIframeLoaded\"!==e.className?c():(this.F=j,this.Aa=e,this.p()):a();this.Aa=e},p:function(d){var c=this;d===Object(d)&&(this.R.push(d),this.xb(d));if((this.Ea||!r.q||this.F)&&this.R.length)this.I(this.R.shift()),this.p();!a.idSyncDisableSyncs&&this.F&&this.H.length&&!this.V&&(this.Ja||(this.Ja=j,setTimeout(function(){c.Ba=r.q?15:150},this.Na)),this.V=j,this.Ga())},xb:function(a){var c,b,e;if((c=a.ibs)&&c instanceof Array&&(b=c.length))for(a=0;a<b;a++)e=c[a],e.syncOnPage&&this.qa(e,\"\",\"syncOnPage\")},I:function(a){var c=encodeURIComponent,b,e,f,g,h;if((b=a.ibs)&&b instanceof Array&&(e=b.length))for(f=0;f<e;f++)g=b[f],h=[c(\"ibs\"),c(g.id||\"\"),c(g.tag||\"\"),x.va(g.url||[],\",\"),c(g.ttl||\"\"),\"\",\"\",g.fireURLSync?\"true\":\"false\"],g.syncOnPage||(this.pa?this.N(h.join(\"|\")):g.fireURLSync&&this.qa(g,h.join(\"|\")));this.qb.push(a)},qa:function(d,c,b){var e=(b=\"syncOnPage\"===b?j:k)?J:L;a.f();var f=a.a(e),g=k,h=k,i=Math.ceil((new Date).getTime()/r.aa);f?(f=f.split(\"*\"),h=this.yb(f,d.id,i),g=h.gb,h=h.hb,(!g||!h)&&this.wa(b,d,c,f,e,i)):(f=[],this.wa(b,d,c,f,e,i))},yb:function(a,c,b){var e=k,f=k,g,h,i;for(h=0;h<a.length;h++)g=a[h],i=parseInt(g.split(\"-\")[1],10),g.match(\"^\"+c+\"-\")?(e=j,b<i?f=j:(a.splice(h,1),h--)):b>=i&&(a.splice(h,1),h--);return{gb:e,hb:f}},rb:function(a){if(a.join(\"*\").length>this.$)for(a.sort(function(a,b){return parseInt(a.split(\"-\")[1],10)-parseInt(b.split(\"-\")[1],10)});a.join(\"*\").length>this.$;)a.shift()},wa:function(d,c,b,e,f,g){var h=this;if(d){if(\"img\"===c.tag){var d=c.url,b=a.loadSSL?\"https:\":\"http:\",j,k,l;for(e=0,j=d.length;e<j;e++){k=d[e];l=/^\\/\\//.test(k);var m=new Image;x.M(m,\"load\",function(b,c,d,e){return function(){h.T[b]=i;a.f();var g=a.a(f),j=[];if(g){var g=g.split(\"*\"),k,l,m;for(k=0,l=g.length;k<l;k++)m=g[k],m.match(\"^\"+c.id+\"-\")||j.push(m)}h.Ia(j,c,d,e)}}(this.T.length,c,f,g));m.src=(l?b:\"\")+k;this.T.push(m)}}}else this.N(b),this.Ia(e,c,f,g)},N:function(d){var c=encodeURIComponent;this.H.push((a.Hb?c(\"---destpub-debug---\"):c(\"---destpub---\"))+d)},Ia:function(d,c,b,e){d.push(c.id+\"-\"+(e+Math.ceil(c.ttl/60/24)));this.rb(d);a.e(b,d.join(\"*\"))},Ga:function(){var d=this,c;this.H.length?(c=this.H.shift(),a.na.postMessage(c,this.url,this.Aa.contentWindow),this.sb.push(c),setTimeout(function(){d.Ga()},this.Ba)):this.V=k},U:function(a){var c=/^---destpub-to-parent---/;\"string\"===typeof a&&c.test(a)&&(c=a.replace(c,\"\").split(\"|\"),\"canSetThirdPartyCookies\"===c[0]&&(this.pa=\"true\"===c[1]?j:k,this.Ea=j,this.p()),this.tb.push(a))},wb:function(d){if(this.url===i||d.subdomain&&\"nosubdomainreturned\"===this.g)this.g=\"string\"===typeof a.ma&&a.ma.length?a.ma:d.subdomain||\"\",this.url=this.kb();d.ibs instanceof Array&&d.ibs.length&&(this.ua=j);this.Da()&&(a.idSyncAttachIframeOnWindowLoad?(l.Y||\"complete\"===u.readyState||\"loaded\"===u.readyState)&&this.O():this.ab());\"function\"===typeof a.idSyncIDCallResult?a.idSyncIDCallResult(d):this.p(d);\"function\"===typeof a.idSyncAfterIDCallResult&&a.idSyncAfterIDCallResult(d)},bb:function(d,c){return a.Ib||!d||c-d>r.La},ab:function(){function a(){c.W||(document.body?c.O():setTimeout(a,30))}var c=this;a()}};a.Fb=z;a.timeoutMetricsLog=[];var o={fb:window.performance&&window.performance.timing?1:0,Ca:window.performance&&window.performance.timing?window.performance.timing:i,X:i,P:i,d:{},S:[],send:function(d){if(a.takeTimeoutMetrics&&d===Object(d)){var c=[],b=encodeURIComponent,e;for(e in d)d.hasOwnProperty(e)&&c.push(b(e)+\"=\"+b(d[e]));d=\"http\"+(a.loadSSL?\"s\":\"\")+\"://dpm.demdex.net/event?d_visid_ver=\"+a.version+\"&d_visid_stg_timeout=\"+a.loadTimeout+\"&\"+c.join(\"&\")+\"&d_orgid=\"+b(a.marketingCloudOrgID)+\"&d_timingapi=\"+this.fb+\"&d_winload=\"+this.lb()+\"&d_ld=\"+this.o();(new Image).src=d;a.timeoutMetricsLog.push(d)}},lb:function(){this.P===i&&(this.P=this.Ca?this.X-this.Ca.navigationStart:this.X-l.eb);return this.P},o:function(){return(new Date).getTime()},I:function(a){var c=this.d[a],b={};b.d_visid_stg_timeout_captured=c.ta;b.d_visid_cors=c.sa;b.d_fieldgroup=a;b.d_settimeout_overriden=c.ra;c.timeout?c.nb?(b.d_visid_timedout=1,b.d_visid_timeout=c.timeout-c.requestStart,b.d_visid_response=-1):(b.d_visid_timedout=\"n/a\",b.d_visid_timeout=\"n/a\",b.d_visid_response=\"n/a\"):(b.d_visid_timedout=0,b.d_visid_timeout=-1,b.d_visid_response=c.Ab-c.requestStart);b.d_visid_url=c.url;l.Y?this.send(b):this.S.push(b);delete this.d[a]},zb:function(){for(var a=0,c=this.S.length;a<c;a++)this.send(this.S[a])},ya:function(){return\"function\"===typeof setTimeout.toString?-1<setTimeout.toString().indexOf(\"[native code]\")?0:1:-1}};a.Mb=o;var w={isClientSideMarketingCloudVisitorID:i,MCIDCallTimedOut:i,AnalyticsIDCallTimedOut:i,AAMIDCallTimedOut:i,d:{},Ha:function(a,c){switch(a){case F:c===k?this.MCIDCallTimedOut!==j&&(this.MCIDCallTimedOut=k):this.MCIDCallTimedOut=c;break;case D:c===k?this.AnalyticsIDCallTimedOut!==j&&(this.AnalyticsIDCallTimedOut=k):this.AnalyticsIDCallTimedOut=c;break;case C:c===k?this.AAMIDCallTimedOut!==j&&(this.AAMIDCallTimedOut=k):this.AAMIDCallTimedOut=c}}};a.isClientSideMarketingCloudVisitorID=function(){return w.isClientSideMarketingCloudVisitorID};a.MCIDCallTimedOut=function(){return w.MCIDCallTimedOut};a.AnalyticsIDCallTimedOut=function(){return w.AnalyticsIDCallTimedOut};a.AAMIDCallTimedOut=function(){return w.AAMIDCallTimedOut};a.idSyncGetOnPageSyncInfo=function(){a.f();return a.a(J)};a.idSyncByURL=function(d){var c,b=d||{};c=b.minutesToLive;var e=\"\";a.idSyncDisableSyncs&&(e=e?e:\"Error: id syncs have been disabled\");if(\"string\"!==typeof b.dpid||!b.dpid.length)e=e?e:\"Error: config.dpid is empty\";if(\"string\"!==typeof b.url||!b.url.length)e=e?e:\"Error: config.url is empty\";if(\"undefined\"===typeof c)c=20160;else if(c=parseInt(c,10),isNaN(c)||0>=c)e=e?e:\"Error: config.minutesToLive needs to be a positive number\";c={error:e,ec:c};if(c.error)return c.error;var e=d.url,f=encodeURIComponent,b=z,g,e=e.replace(/^https:/,\"\").replace(/^http:/,\"\");g=x.va([\"\",d.dpid,d.dpuuid||\"\"],\",\");d=[\"ibs\",f(d.dpid),\"img\",f(e),c.ttl,\"\",g];b.N(d.join(\"|\"));b.p();return\"Successfully queued\"};a.idSyncByDataSource=function(d){if(d!==Object(d)||\"string\"!==typeof d.dpuuid||!d.dpuuid.length)return\"Error: config or config.dpuuid is empty\";d.url=\"//dpm.demdex.net/ibs:dpid=\"+d.dpid+\"&dpuuid=\"+d.dpuuid;return a.idSyncByURL(d)};0>q.indexOf(\"@\")&&(q+=\"@AdobeOrg\");a.marketingCloudOrgID=q;a.cookieName=\"AMCV_\"+q;a.sessionCookieName=\"AMCVS_\"+q;a.cookieDomain=a.Ra();a.cookieDomain==m.location.hostname&&(a.cookieDomain=\"\");a.loadSSL=0<=m.location.protocol.toLowerCase().indexOf(\"https\");a.loadTimeout=3E4;a.CORSErrors=[];a.marketingCloudServer=a.audienceManagerServer=\"dpm.demdex.net\";var M={};M[A]=j;M[s]=j;if(v&&\"object\"==typeof v){for(var G in v)!Object.prototype[G]&&(a[G]=v[G]);a.idSyncContainerID=a.idSyncContainerID||0;a.ba();a.f();N=a.a(K);G=Math.ceil((new Date).getTime()/\nr.aa);!a.idSyncDisableSyncs&&z.bb(N,G)&&(a.j(s,-1),a.e(K,G));a.getMarketingCloudVisitorID();a.getAudienceManagerLocationHint();a.getAudienceManagerBlob();a.Va(a.serverState)}else a.ba();if(!a.idSyncDisableSyncs){z.cb();x.M(window,\"load\",function(){l.Y=j;o.X=o.o();o.zb();var a=z;a.Da()&&a.O()});try{a.na.U(function(a){z.U(a.data)},z.Q)}catch(O){}}}", "function hA(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "drive() {\n\t\tconsole.log('vroom vroom');\n\t}", "private internal function m248() {}", "function Rv(){var t=this;ci()(this,{$interaction:{enumerable:!0,get:function(){return t.$olObject}},$map:{enumerable:!0,get:function(){return t.$services&&uu()(t.$services)}},$view:{enumerable:!0,get:function(){return t.$services&&t.$services.view}},$interactionsContainer:{enumerable:!0,get:function(){return t.$services&&t.$services.interactionsContainer}}})}", "function VNode() {}", "transient private internal function m185() {}", "function tC(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"layer.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function JV(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function Vf(a,b,c){Vf.s.constructor.call(this,a);this.ab=a.ab||Wf;this.wf=a.wf||Xf;var e=[];e[w.Va]=new pe;e[w.Ug]=new pe;e[w.Ia]=new pe;e[w.Lf]=new pe;this.gm=e;b&&(this.$a=b);c&&(this.Lg=c);this.El=this.Lg&&w.h.cf();this.Ii=[];this.Wc=new Kf(a.Hc);this.cd=this.options.gq?new nf(a.gq,a.fq):null;w.I&&w.I.Se&&Yf(this,w.Mo,w.I.Se);w.Uc&&w.Uc.Se&&Yf(this,w.Ps,w.Uc.Se);w.Ta&&w.Ta.Se&&Yf(this,w.Jo,w.Ta.Se)}", "function Fv(){var t=this;ci()(this,{$style:{enumerable:!0,get:function(){return t.$olObject}},$map:{enumerable:!0,get:function(){return t.$services&&uu()(t.$services)}},$view:{enumerable:!0,get:function(){return t.$services&&t.$services.view}},$stylesContainer:{enumerable:!0,get:function(){return t.$services&&t.$services.stylesContainer}}})}", "function DI(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"layer.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "ready() {\n window.plugin = new window.Vue( {\n el : this.shadowRoot,\n created() {\n Editor.log( \"成功初始化\" );\n },\n data : {\n uuid : \"bae4f6b4-7d1e-4612-99b7-ab5239576cc1\",\n scriptUrl: \"\",\n uuidObj : {},\n isFind : false,\n isFindAll: true,\n },\n methods: {\n _setOpenUrl() {\n let path = Editor.url( 'db://assets' );\n let files = Editor.Dialog.openFile( {\n defaultPath: path,\n properties : [ 'openDirectory' ]\n } );\n if ( files ) {\n path = files[0];\n }\n this.scriptUrl = path;\n },\n onSelectJSPath() {\n this._setOpenUrl();\n let assetUrl = Editor.remote.assetdb.fspathToUrl( this.scriptUrl );\n if ( this.scriptUrl === assetUrl ) {\n Editor.warn( \"请选择项目目录哦\" );\n return;\n }\n this._analyzeUUIDInfo( assetUrl, \"javascript\" );\n },\n\n onSelectSFPath() {\n this._setOpenUrl();\n let assetUrl = Editor.remote.assetdb.fspathToUrl( this.scriptUrl );\n if ( this.scriptUrl === assetUrl ) {\n Editor.warn( \"请选择项目目录哦\" );\n return;\n }\n this._analyzeUUIDInfo( assetUrl, \"sprite-frame\" );\n },\n\n onSelectFontPath() {\n this._setOpenUrl();\n let assetUrl = Editor.remote.assetdb.fspathToUrl( this.scriptUrl );\n if ( this.scriptUrl === assetUrl ) {\n Editor.warn( \"请选择项目目录哦\" );\n return;\n }\n this._analyzeUUIDInfo( assetUrl, [ \"label-atlas\", \"bitmap-font\" ] );\n },\n\n _analyzeUUIDInfo( url, type ) {\n let self = this;\n self.uuidObj = {};\n Editor.assetdb.queryAssets( url + \"/**/*\", type, function ( err, results ) {\n if ( err ) return;\n let len = results.length;\n for (let i = 0; i < len; i++) {\n let uuid = results[i].uuid;\n if ( type === \"javascript\" ) uuid = Editor.Utils.UuidUtils.compressUuid( results[i].uuid );\n self.uuidObj[uuid] = results[i];\n }\n } );\n },\n onCheckUUID() {\n Editor.log( 'check uuid', this.uuid );\n },\n onFindUUID() {\n // Editor.assetdb.queryUuidByUrl( url, function ( err, uuid ) {\n // Editor.log( \"uuid\", uuid );\n // } );\n if ( this.isFind ) {\n Editor.log( \"正在查找中.........\" );\n return;\n }\n this.isFind = true;\n let self = this;\n let objs = Object.values( this.uuidObj );\n if ( objs.length > 0 ) {\n Editor.log( objs[0].type );\n this._findInfo( objs[0].type, this.uuidObj );\n return;\n }\n if ( !this._isUUID() ) {\n Editor.log( \"uuid 无效\" );\n return;\n }\n let url = Editor.remote.assetdb.uuidToUrl( this.uuid );\n Editor.log( \"开始查找!!!!!!!\", this.uuid, url );\n Editor.assetdb.queryInfoByUuid( this.uuid, function ( err, info ) {\n Editor.log( \"当前查找的文件信息\", info, self.uuid );\n if ( err ) return;\n self._findInfo( info.type );\n } );\n // Editor.assetdb.queryUrlByUuid( this.uuid, function ( err, url ) {\n // Editor.log( \"info1\", url );\n // } );\n },\n _isUUID() {\n let isUUID = Editor.Utils.UuidUtils.isUuid( this.uuid );\n return isUUID;\n },\n\n _findInfo( type, uuidOrObj ) {\n let self = this;\n Editor.log( \"find \" + type );\n if ( type === \"sprite-frame\" || type === \"label-atlas\" || type === \"bitmap-font\" ) {\n Editor.assetdb.queryAssets( \"db://assets/resources/prefab/**/*\", [ 'prefab', 'scene' ], function ( err, results ) {\n Editor.log( \"查找 prefab 文件数量:\", results.length );\n self._analyze( results, type, uuidOrObj || self.uuid );\n } );\n } else if ( type === \"javascript\" ) {\n Editor.assetdb.queryAssets( \"db://assets/resources/prefab/**/*\", [ 'prefab', 'scene' ], function ( err, results ) {\n Editor.log( \"查找 prefab 文件数量:\", results.length );\n let uuid = uuidOrObj || Editor.Utils.UuidUtils.compressUuid( self.uuid );\n self._analyze( results, type, uuid );\n } );\n }\n },\n\n _analyze( list, type, uuidOrObj ) {\n let uuidObj = uuidOrObj;\n if ( typeof uuidOrObj === \"string\" ) {\n uuidObj = { [uuidOrObj]: { uuid: uuidOrObj } };\n }\n let len = Array.isArray( list ) ? list.length : 0;\n let result = \"\";\n for (let i = 0; i < len; i++) {\n let template = Fs.readFileSync( list[i].path, 'utf-8' );\n let json = JSON.parse( template ) || [];\n let num = json.length;\n Editor.log( \"正在查找当前文件:\", list[i].path );\n for (let j = 0; j < num; j++) {\n let obj = json[j];\n if ( !obj ) continue;\n let uObj = null;\n if ( type === \"sprite-frame\" ) {\n uObj = this._getSpriteFrame( obj, uuidObj );\n } else if ( type === \"javascript\" ) {\n uObj = this._getSpriteScript( obj, uuidObj );\n } else if ( type === \"label-atlas\" || type === \"bitmap-font\" ) {\n uObj = this._getSpriteFont( obj, uuidObj );\n }\n if ( !uObj ) continue;\n if ( uObj.isExist && !this.isFindAll ) continue;\n uObj.isExist = true;\n let path = uObj.path ? \"<\" + uObj.path + \">\" : uObj.uuid;\n result = result + path + list[i].path + \"\\n\";\n }\n }\n //查找玩家\n Editor.log( \"----------以下文件暂时没有找到引用---------------\" );\n let values = Object.values( uuidObj );\n let count = values.length;\n let sum = 0;\n for (let i = 0; i < count; i++) {\n if ( values[i].isExist ) continue;\n let path = values[i].path ? values[i].path : values[i].uuid;\n Editor.log( path );\n sum++;\n }\n Editor.log( \"总计有\", sum, \"个类型\", type, \"文件未被引用\" );\n this.uuidObj = {};\n this.isFind = false;\n Editor.log( \"----------查找到以下文件以及在那个预制文件下引用---------------\" );\n Editor.log( result );\n Editor.log( \"----------complete---------------\" );\n },\n _getSpriteFrame( obj, uuidObj ) {\n let result = null;\n do {\n if ( obj[\"__type__\"] !== \"cc.Sprite\" ) break;\n if ( !obj[\"_spriteFrame\"] ) break;\n let uObj = uuidObj[obj[\"_spriteFrame\"][\"__uuid__\"]];\n if ( !uObj ) break;\n result = uObj;\n } while ( 0 );\n return result;\n },\n\n _getSpriteScript( obj, uuidObj ) {\n let result = null;\n do {\n let uObj = uuidObj[obj[\"__type__\"]];\n if ( uObj ) {\n result = uObj;\n break;\n }\n let componentId = obj[\"_componentId\"];\n if ( !componentId ) break;\n uObj = uuidObj[componentId];\n if ( !uObj ) break;\n result = uObj;\n } while ( 0 );\n return result;\n },\n _getSpriteFont( obj, uuidObj ) {\n let result = null;\n do {\n if ( obj[\"__type__\"] !== \"cc.Label\" ) break;\n if ( !obj[\"_N$file\"] ) break;\n let uObj = uuidObj[obj[\"_N$file\"][\"__uuid__\"]];\n if ( !uObj ) break;\n result = uObj;\n } while ( 0 );\n return result;\n },\n }\n } );\n }", "ready() {\n this.vue = createVUE(this[\"$mainDiv\"]);\n Editor.log(\"ConvertHelper view ready\");\n }", "function UserGallerie()\n{\n var Video=deserialize(\"Video\",{});\n // Vorschauliste bunt\n var VideoLinks=$x(\"//a[contains(@href,'watch?v=')]\")\n .map(function (a) { return { link:a.href, elem:('user'==Kategorie?$xs(\"ancestor::div[@class='video yt-tile-visible'] | ancestor::li[@class='channels-content-item']\",a):'channel'==Kategorie?$xs('../..',a):a.parentNode)||a }; })\n .map(function (vid) { vid.id=((vid.link||\"\").match(/v=([a-zA-Z0-9-_]*)/)||[\"\",\"\"])[1]; return vid; });\n //alert(uneval(VideoLinks));\n VideoLinks.forEach(function (vid) { if (Video[vid.id]) /*vid.elem.className=\"w\"+Video[vid.id].qualitaet;*/ vid.elem.style.backgroundColor={ \"gut\":\"green\", \"schlecht\":\"red\", undefined:\"yellow\" }[Video[vid.id].qualitaet]; });\n //showmsg({ text:\"aaa\" });\n $x(\"//a[contains(@href,'v=')]\").forEach(function (a) { a.addEventListener(\"click\",function(event){\n //if (event.ctrlKey) // && event.altKey)\n //{\n var e=event.target;\n while (!e || !e.href) e=e.parentNode;\n var VideoID=e.href.match(/v=([a-zA-Z0-9-_]*)/)[1];\n var Video=deserialize(\"Video\",{});\n if (!Video[VideoID])\n {\n Video[VideoID]={ id:VideoID, anz:0, lastseen:new Date() };\n serialize(\"Video\",Video);\n var ColorNode=$xs(\"ancestor::div[@class='video yt-tile-visible'] | ancestor::li[@class='channels-content-item']\",a)||a;\n ColorNode.style.color=\"lightgray\";\n ColorNode.style.backgroundColor=\"darkgray\";\n event.stopPropagation();\n event.preventDefault();\n }\n //}\n }, true); });\n}", "function getVersion(){return _VERSION}", "function Bevy() {}", "function __vue_normalize__(a,b,c,d,e){var f=(\"function\"==typeof c?c.options:c)||{};// For security concerns, we use only base name in production mode.\nreturn f.__file=\"/Users/hadefication/Packages/vue-chartisan/src/components/Pie.vue\",f.render||(f.render=a.render,f.staticRenderFns=a.staticRenderFns,f._compiled=!0,e&&(f.functional=!0)),f._scopeId=d,f}", "function Jb(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"style.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function vB_PHP_Emulator()\n{\n}", "init() {\n }", "install(Vue, options) {\n Vue.VERSION = 'v0.0.1';\n\n let userOptions = {...defaultOptions, ...options};\n // console.log(userOptions)\n\n // create a mixin\n Vue.mixin({\n // created() {\n // console.log(Vue.VERSION);\n // },\n\n\n });\n Vue.prototype.$italicHTML = function (text) {\n return '<i>' + text + '</i>';\n }\n Vue.prototype.$boldHTML = function (text) {\n return '<b>' + text + '</b>';\n }\n\n // define a global filter\n Vue.filter('preview', (value) => {\n if (!value) {\n return '';\n }\n return value.substring(0, userOptions.cutoff) + '...';\n })\n\n Vue.filter('localname', (value) => {\n if (!value) {\n return '';\n }\n var ln = value;\n if(value!= undefined){\n if ( value.lastIndexOf(\"#\") != -1) { ln = value.substr(value.lastIndexOf(\"#\")).substr(1)}\n else{ ln = value.substr(value.lastIndexOf(\"/\")).substr(1) }\n ln = ln.length == 0 ? value : ln\n }\n return ln\n })\n\n // add a custom directive\n Vue.directive('focus', {\n // When the bound element is inserted into the DOM...\n inserted: function (el) {\n // Focus the element\n el.focus();\n }\n })\n\n }", "function qv() {}", "function fl_outToLevivot ()\n\t\t{if(freez==\"false\"){\n\t\t\tconsole.log(\"hit\")\n\t\t\tthis.rimon.alpha=1\n\t\t\tthis.sufgania.alpha=1\n\t\t\tthis.selek.alpha=1\n\t\t\tthis.tamar.alpha=1\n\t\t\tthis.karpas.alpha=1\n\t\t\tthis.haroset.alpha=1\n\t\t\tthis.maza.alpha=1\n\t\t\tthis.hasa.alpha=1\n\t\t\tthis.beiza.alpha=1\n\t\t\tthis.hazeret.alpha=1\n\t\t\tthis.mamtak.alpha=1\n\t\t\tthis.gvina.alpha=1\n\t\t\tthis.oznei_aman.alpha=1\n\t\t\tthis.dvash.alpha=1\n\t\t\tthis.dag.alpha=1\n\t\t\tthis.sumsum.alpha=1\n\t\t\tthis.perot.alpha=1\n\t\t\tthis.mishloah.alpha=1\n\t\t\tthis.of.alpha=1\n\t\t this.tu_btn.alpha=1\n\t\t this.purim_btn.alpha=1\n\t\t this.pesach_btn.alpha=1\n\t\t this.shavuot_btn.alpha=1\n\t\t this.rosh_ha_shana_btn.alpha=1\n\t\t this.modern_btn.alpha=1\n\t\t\t\t\t this.arrow_btn.alpha=0\n\t\tthis.arrowAside_mc.alpha=0\n\t\tthis.gvina_explain.alpha=0\n\t\tthis.mishloah_explain.alpha=0\n\t\tthis.sufgania_explain.alpha=0\n\t\tthis.perot_explain.alpha=0\n\t\tthis.tapuah_explain.alpha=0\n\t\tthis.maza_explain.alpha=0\n\t\t\n\t\t}}", "function Ok(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"layer.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function version() {\n outlet(2, 249);\n}", "function v77(v78,v79,v80,v81,v82) {\n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }" ]
[ "0.60794616", "0.60604215", "0.58815044", "0.58643883", "0.5863571", "0.583801", "0.58183414", "0.57860523", "0.5745682", "0.5725272", "0.5636772", "0.5615987", "0.56147796", "0.5608149", "0.5605216", "0.5597615", "0.5582921", "0.55762595", "0.55645746", "0.555929", "0.5558931", "0.5541705", "0.5530456", "0.5525291", "0.55113846", "0.5503554", "0.54866165", "0.54831237", "0.54705584", "0.5464994", "0.54353267", "0.5432505", "0.5395967", "0.53952765", "0.5393472", "0.53884506", "0.53652513", "0.5358475", "0.53532404", "0.5348776", "0.5340896", "0.5339969", "0.53182745", "0.53176683", "0.53017783", "0.52677387", "0.5263174", "0.5257041", "0.5243658", "0.5236696", "0.5228128", "0.5216443", "0.52097064", "0.52021474", "0.5199564", "0.51900554", "0.5189072", "0.51870793", "0.5172843", "0.5171242", "0.5169049", "0.5166608", "0.5158323", "0.5157454", "0.51490986", "0.51473325", "0.5141451", "0.51273566", "0.5116138", "0.51143885", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434", "0.51127434" ]
0.0
-1
delete and edit delete Array.splice(index, how many) list = [a,b,c,d] list.splice(1,2) => list = [a,d] delete
function deleteEntry(ENTRY){ ENTRY_LIST.splice(ENTRY.id,1) updateUI() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "splice(position = self.list.length, deleteCount = 0, ...elements) {\n return self.list.splice(position, deleteCount, ...elements)\n }", "function splice(arr, start, deleteCount, element1, elementN) {\n let deleted = [];\n let i;\n let arrLength = arr.length;\n\n // arr = [1, 2, 3];\n // start = 1;\n // deleteCount = 1;\n // element1 = 'two'\n\n if (element1 === undefined && elementN === undefined) {\n if ((start + deleteCount) >= arrLength) {\n deleted = arr.slice(start, deleteCount); \n arrLength -= deleteCount;\n } else if (start == 0) {\n for (i = 0; i < deleteCount; i += 1) {\n deleted.push(arr.shift()); \n }\n }\n } else if (element1 !== undefined && elementN === undefined) {\n if (deleteCount === 0) {\n for (i = arrLength; i > start; i -= 1) {\n arr[i + 1] = arr[i - 1]; \n } \n arr[start] = element1;\n } else if (deleteCount === 1) {\n deleted.push(arr[start]);\n arr[start] = element1; \n } \n } else if (element1 !== undefined && elementN !== undefined) {\n if (deleteCount === 2) {\n deleted = arr.slice(start, 2);\n arr[start] = element1; \n arr[start + 1] = elementN;\n } \n }\n return deleted;\n}", "function splice(array, start, deleteCount, element1, elementN) {\n var newElements = [];\n var oldElements = [];\n var i;\n\n for (i = 3; i < arguments.length; i += 1) {\n newElements.push(arguments[i]);\n }\n\n for (i = start; i < start + deleteCount; i += 1) {\n oldElements.push(array[i]);\n array[i] = undefined;\n }\n\n console.log(oldElements);\n console.log(array);\n}", "function splice(arr, start, deleteCount, items) {\n arr.splice(start, deleteCount, items);\n}", "function usingSplice(array, start, deleteCount, item) {\n array.splice(start, deleteCount, item)\n return array;\n}", "function spliceOne(list,index){for(var i=index,k=i+1,n=list.length;k<n;i+=1,k+=1){list[i]=list[k];}list.pop();}", "function spliceOne(list,index){for(var i=index,k=i+1,n=list.length;k<n;i+=1,k+=1){list[i]=list[k];}list.pop();}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n list[i] = list[k];\n list.pop();\n }", "function arrDel(list, value) {\n var clone = list.slice();\n var index = clone.indexOf(value);\n\n if (index >= 0) {\n clone.splice(index, 1);\n }\n\n return clone;\n}", "function spliceOne(list, index) {\n for (\n var i = index, k = i + 1, n = list.length;\n k < n;\n i += 1, k += 1\n ) {\n list[i] = list[k];\n }\n\n list.pop();\n }", "function spliceMe(tempArr,ind,howmanytoRemove,AddedItem ){\r\n\r\n return tempArr.splice(ind,howmanytoRemove,AddedItem);\r\n\r\n\r\n }", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n list[i] = list[k];\n list.pop();\n }", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n list[i] = list[k];\n list.pop();\n }", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n list[i] = list[k];\n list.pop();\n }", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n list[i] = list[k];\n list.pop();\n }", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n list[i] = list[k];\n list.pop();\n }", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n list[i] = list[k];\n list.pop();\n }", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) list[i] = list[k];\n\n list.pop();\n }", "splice(start, deleteCount, ...items) {\n // Delete items\n if (deleteCount) {\n for (let i = start; i < this._length - deleteCount; i++) {\n this._array[this._getCyclicIndex(i)] = this._array[this._getCyclicIndex(i + deleteCount)];\n }\n this._length -= deleteCount;\n this.onDeleteEmitter.fire({ index: start, amount: deleteCount });\n }\n // Add items\n for (let i = this._length - 1; i >= start; i--) {\n this._array[this._getCyclicIndex(i + items.length)] = this._array[this._getCyclicIndex(i)];\n }\n for (let i = 0; i < items.length; i++) {\n this._array[this._getCyclicIndex(start + i)] = items[i];\n }\n if (items.length) {\n this.onInsertEmitter.fire({ index: start, amount: items.length });\n }\n // Adjust length as needed\n if (this._length + items.length > this._maxLength) {\n const countToTrim = (this._length + items.length) - this._maxLength;\n this._startIndex += countToTrim;\n this._length = this._maxLength;\n this.onTrimEmitter.fire(countToTrim);\n }\n else {\n this._length += items.length;\n }\n }", "function spliceOne(list, index) {\n for (let i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n list.pop();\n}", "function spliceOne(list, index) {\n\t for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n\t list[i] = list[k];\n\t }\n\t\n\t list.pop();\n\t}", "function spliceOne(list, index) {\n\t for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n\t list[i] = list[k];\n\t }\n\t\n\t list.pop();\n\t}", "function spliceOne (list, index) {\n for (let i = index, k = i + 1; k < list.length; i += 1, k += 1) {\n list[i] = list[k]\n }\n list.pop()\n}", "function spliceOne(list, index) {\n\t for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n\t list[i] = list[k];\n\t list.pop();\n\t}", "function spliceOne(list, index) {\n\t for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n\t list[i] = list[k];\n\t list.pop();\n\t}", "function spliceOne(list, index) {\n\t for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n\t list[i] = list[k];\n\t list.pop();\n\t}", "function spliceOne(list, index) {\n\t for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n\t list[i] = list[k];\n\t list.pop();\n\t}", "function spliceOne(list, index) {\n\t for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n\t list[i] = list[k];\n\t list.pop();\n\t}", "function spliceOne(list, index) {\n\t for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n\t list[i] = list[k];\n\t list.pop();\n\t}", "function spliceOne(list, index) {\n\t for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n\t list[i] = list[k];\n\t list.pop();\n\t}", "function testSplice3(arr) {\n let newArr = arr.splice(3); // default start at 0, delete 3 element\n console.log(newArr); // [ 4, 5, 6, 7 ]\n console.log(arr); // [ 1, 2, 3 ]\n}", "function spliceOne(list, index) {\n\t for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n\t list[i] = list[k];\n\t }\n\n\t list.pop();\n\t}", "function spliceOne(list, index) {\n\t for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n\t list[i] = list[k];\n\t }\n\n\t list.pop();\n\t}", "function spliceOne(list, index) {\n\t for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n\t list[i] = list[k];\n\t }\n\n\t list.pop();\n\t}", "function spliceOne(list, index) {\n\t for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n\t list[i] = list[k];\n\t }\n\n\t list.pop();\n\t}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}", "function spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {\n list[i] = list[k];\n }\n\n list.pop();\n}" ]
[ "0.75611836", "0.74313694", "0.7288266", "0.7198349", "0.7082078", "0.7031479", "0.7031479", "0.7004342", "0.6950201", "0.6924521", "0.69026154", "0.6896922", "0.6896922", "0.6896922", "0.68754995", "0.68754995", "0.68754995", "0.6869601", "0.6863267", "0.68492156", "0.68384033", "0.68384033", "0.6833288", "0.68316084", "0.68316084", "0.68316084", "0.68316084", "0.68316084", "0.68316084", "0.68316084", "0.68202615", "0.68037504", "0.68037504", "0.68037504", "0.68037504", "0.680372", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875", "0.6802875" ]
0.0
-1
total distance of whole path
function CalculateTotalDistancePolyline(path) { var distance = google.maps.geometry.spherical.computeLength(path); $('#distance').append('<div>Polyline dist mts:' + distance.toFixed(2) + '</div>'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeLength(path) {\n path = common.convertToPositionArray(path);\n if (path.length < 2) {\n return 0;\n }\n var length = 0;\n var prev = path[0];\n var prevLat = toRadians(prev.lat);\n var prevLng = toRadians(prev.lng);\n path.forEach(function (point) {\n var lat = toRadians(point.lat);\n var lng = toRadians(point.lng);\n length += distanceRadians(prevLat, prevLng, lat, lng);\n prevLat = lat;\n prevLng = lng;\n });\n return length * EARTH_RADIUS;\n}", "function pathLength(path) {\n var i, sum = 0, a, b, dx, dy;\n for (i = 1; i < path.length; ++i) {\n a = path[i - 1];\n b = path[i];\n dx = a[0] - b[0];\n dy = a[1] - b[1];\n sum += Math.sqrt(dx * dx + dy * dy);\n }\n return sum;\n}", "function getTotalDistance (result) {\n var total = 0;\n var myroute = result.routes[0];\n for (var i = 0; i < myroute.legs.length; i++) {\n total += myroute.legs[i].distance.value;\n }\n total /= 1000;\n return total;\n}", "function computeTotalDistance(result) {\n var total = 0;\n var myroute = result.routes[0];\n for (var i = 0; i < myroute.legs.length; i++) {\n total += myroute.legs[i].distance.value;\n }\n total = total / 1000.0;\n}", "function totalDistance() {\n var distanceSum = 0;\n for (let index = 0; index < distancesPointToPoint.length; index++) { //iterationg over the distances\n distanceSum += distancesPointToPoint[index]; //add the distance\n }\n distanceSum = Math.round(distanceSum * 1000) / 1000;\n return distanceSum;\n}", "distance() {\n return distanceBetweenPoints(this.sourceAirport.latLng, this.destinationAirport.latLng);\n }", "function pathLength() {\n\t\tvar l = this.getTotalLength();\n\t\treturn -l;\n\t}", "_getRemainingDistance()\r\n {\r\n let distanceList = this._navPath.distances;\r\n let distRemaining = 0;\r\n\r\n // Add distance to next waypoint.\r\n distRemaining += this._distanceToNext();\r\n\r\n for (let distIdx = this._waypointIdx + 1; distIdx < distanceList.length; distIdx++)\r\n {\r\n // Add distances between all successive waypoints.\r\n distRemaining += distanceList[distIdx]\r\n }\r\n\r\n // Return distance in metres.\r\n return distRemaining;\r\n }", "get totalDistance() {\n this._totalDistanceCalc = 0;\n\n for (let i = 0; i < this._locations.length - 1; i ++) {\n this._latLngFrom = new google.maps.LatLng(this._locations[i].lat, this._locations[i].lng);\n this._latLngTo = new google.maps.LatLng(this._locations[i + 1].lat, this._locations[i + 1].lng);\n\n this._totalDistanceCalc += google.maps.geometry.spherical.computeDistanceBetween(this._latLngFrom,this._latLngTo);\n }\n\n this._totalDistanceCalc = this._totalDistanceCalc.toFixed(1);\n return this._totalDistanceCalc + \"m\";\n }", "get distance() {}", "GetDistanceToPoint() {}", "function PathLength(points) {\n let length = 0.0;\n for (let i = 1; i < points.length - 1; i += 1) {\n length += EuclideanDistance(points[i - 1], points[i]);\n }\n return length;\n }", "getLength() {\n var x1 = this.point1.getX();\n var y1 = this.point1.getY();\n var x2 = this.point2.getX();\n var y2 = this.point2.getY();\n return Math.hypot(x1 - x2, y1 - y2);\n }", "function totalDistance(vector)\r\n{\r\n\tvar sum = 0;\r\n\tfor (var i = 0; i<vector.length; i++)\r\n\t{\r\n\t\tsum += vector[i][1];\r\n\t}\r\n\treturn sum;\r\n}", "function computeTotalDistance(result) {\n var total = 0;\n var myroute = result.routes[0];\n for (var i = 0; i < myroute.legs.length; i++) {\n total += myroute.legs[i].distance.value;\n }\n total = total / 1000;\n document.getElementById('distancia_value').innerHTML = total + ' km';\n}", "function dist() {\n let temp = Math.floor(\n findDistance(coord.lat, goal.lat, coord.long, goal.long)\n );\n\n return temp;\n }", "calculer_distance() {}", "function totalDistance(height, length, tower) {\n\tlet numberStair = 0;\n numberOfStair = tower / height;\n totaldistance = numberOfStair * (height + length);\n return totaldistance.toFixed(1)*1;\n}", "function computeTotalDistance(result) {\n let total = 0;\n let myroute = result.routes[0];\n for (let i = 0; i < myroute.legs.length; i++) {\n total += myroute.legs[i].distance.value;\n }\n total = total / 1000;\n // it displays in km, in future we will converting to miles\n document.getElementById('total').innerHTML = total + ' km';\n}", "distance() {\n return this.speed * this.duration() / 3600000;\n }", "function computeTotalDistance(result) {\n var total = 0;\n var myroute = result.routes[0];\n for (var i = 0; i < myroute.legs.length; i++) {\n total += myroute.legs[i].distance.value;\n }\n total = total / 1000.0;\n // document.getElementById('total').innerHTML = total + ' km';\n // pushing new destination info\n destinationInfo.push({\n label: \"distance\",\n value: total + \" km\"\n });\n}", "get distanceToNext()\r\n {\r\n if (!this._endOfPath)\r\n {\r\n // Return remaining distance in m.\r\n let distanceValue = this._distanceToNext().toFixed(2);\r\n return distanceValue.toString() + \" m\"\r\n }\r\n else\r\n {\r\n return \"None\"\r\n }\r\n }", "function calcTripLength([x1, y1, x2, y2, x3, y3]) {\n [x1, y1, x2, y2, x3, y3] = [x1, y1, x2, y2, x3, y3].map(Number);\n let distance1 = Math.sqrt(Math.pow(x1 - x2, 2) + (Math.pow(y1 - y2, 2)));\n let distance2 = Math.sqrt(Math.pow(x2 - x3, 2) + (Math.pow(y2 - y3, 2)));\n let distance3 = Math.sqrt(Math.pow(x1 - x3, 2) + (Math.pow(y1 - y3, 2)));\n let distances = [distance1, distance2, distance3].sort();\n let first = distances[0];\n let second = distances[1];\n let sum = first + second;\n if (first == distance1 && second == distance2) {\n console.log('1->2->3: ' + sum);\n } else if (first == distance1 && second == distance3) {\n console.log('2->1->3: ' + sum);\n } else if (first == distance2 && second == distance3) {\n console.log('1->3->2: ' + sum);\n }\n}", "function get_total_distance(result) {\n var meters = 0;\n var route = result.routes[0];\n for (ii = 0; ii < route.legs.length; ii++) {\n // Google stores distance value in meters\n meters += route.legs[ii].distance.value;\n }\n //Make it km with 1 decimal\n km = make_km(meters);\n return km;\n}", "distanceRan(){\n var resultDist = google.maps.geometry.spherical.computeDistanceBetween(this._startLocation, this._endLocation);\n this._distanceRan = resultDist;\n return resultDist.toFixed(2);\n }", "distance(vertices) {\n let d = 0\n for(let i=0; i<vertices.length; i++) {\n if (i > 0) d = d + distance(vertices[i], vertices[i-1])\n }\n\n return d\n }", "function computeDistance(distances, route) {\n \n let totalDistance = 0;\n \n for (let i = 0; i < route.length; i++){\n if (i == route.length-1){\n const finalCity = route[i];\n const startCity = route[0];\n const homeTripDistance = distances[finalCity][startCity];\n totalDistance = totalDistance + homeTripDistance;\n }\n else {\n const city1 = route[i];\n const city2 = route[i+1];\n const aDistance = distances[city1][city2];\n totalDistance = totalDistance + aDistance;\n }\n }\n return totalDistance;\n}", "get remainingDistance()\r\n {\r\n if (!this._endOfPath)\r\n {\r\n // Return remaining distance in km.\r\n let distanceValue = this._getRemainingDistance().toFixed(2);\r\n return distanceValue.toString() + \" m\"\r\n }\r\n else\r\n {\r\n return \"None\"\r\n }\r\n }", "function computeTotalDistance(result) {\n var total = 0, i,\n myroute = result.routes[0];\n for (i = 0; i < myroute.legs.length; i++) {\n total += myroute.legs[i].distance.value;\n }\n total = total / 1000;\n scope.$apply(function() {\n model.totalKm = total;\n });\n }", "function calcDistance(portal, userClick) {\n return (google.maps.geometry.spherical.computeDistanceBetween(portal, userClick)).toFixed(0);\n }", "_getDistance (timeElapsed) {\r\n const currentSeg = this._dna[this._getSegIndex(timeElapsed)]\r\n const distInThisSeg = (timeElapsed - currentSeg.startTime) / (currentSeg.pace * 60 / 1000)\r\n return currentSeg.startDistance + distInThisSeg\r\n }", "function distance(from, to) {\n let fromloc = from.location;\n let toloc = to.location;\n return Math.sqrt(\n (fromloc.coords.x - toloc.coords.x) ** 2 +\n (fromloc.coords.y - toloc.coords.y) ** 2\n );\n}", "static DistanceToArc() {}", "function distance_down_path(point, polypath) {\n var path = polypath.getPath(), len = path.getLength(), dist = 0;\n for(var i=0; i < len-1; i++){\n\tvar curpoint = path.getAt(i);\n\tvar nextpoint = path.getAt(i+1);\n\tvar segment = new google.maps.Polyline({path: [curpoint, nextpoint]});\n\tif(google.maps.geometry.poly.isLocationOnEdge(point, segment, TOLERANCE)) {\n\t dist += google.maps.geometry.spherical.computeDistanceBetween(curpoint, point);\n\t break;\n\t} else {\n\t dist += google.maps.geometry.spherical.computeDistanceBetween(curpoint, nextpoint);\n\t}\n } \n return dist.toFixed(2); \n}", "function getDistance(x1, y1, x2, y2)\r\n{\r\n\treturn (((x2-x1)**2)+((y2-y1)**2))**(1/2);\r\n}", "function getDistance() {\n var dLat = deg2rad(loc2X - loc1X); // deg2rad below\n var dLon = deg2rad(loc2Y - loc1Y);\n var a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(deg2rad(loc1X)) *\n Math.cos(deg2rad(loc2X)) *\n Math.sin(dLon / 2) *\n Math.sin(dLon / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = rr * c; // Distance in km\n return d;\n}", "get totalDistance()\r\n {\r\n // Return total distance in km.\r\n let distanceValue = this._totalDistance.toFixed(2);\r\n return distanceValue.toString() + \" m\"\r\n }", "function DISTANCE(here, there) {\n \n var mapObj = Maps.newDirectionFinder();\n mapObj.setOrigin(here);\n mapObj.setDestination(there);\n \n var directions = mapObj.getDirections();\n var getTheLeg = directions[\"routes\"][0][\"legs\"][0];\n var mins = getTheLeg[\"duration\"][\"text\"];\n \n return mins;\n}", "getStationDistanceToLocation(dest) {\n let currentStation = this.props.closestStations[0]\n if (!currentStation) return 0 // wtf?\n return Utils.getDistanceFromLatLonInKm(currentStation.latitude,currentStation.longitude,dest.latitude,dest.longitude).toFixed(2)\n\n }", "function m_distancia(px, py, dx1, dy1, dx2, dy2) {\r\n\r\n\tif (dx2 == dx1) {\r\n\t\tdx2 += 0.00001;\r\n\t}\r\n\r\n\tvar a = (dy2 - dy1) / (dx2 - dx1);\r\n\tvar b = -1;\r\n\tvar c = dy1 - a * dx1;\r\n\r\n\tvar dis = Math.abs((a * px + b * py + c) / Math.sqrt(a * a + b * b));\r\n\r\n\treturn dis;\r\n\r\n}", "calDistance(lat1, lon1, lat2, lon2) {\n let R = 6371; // km\n let dLat = this.toRad(lat2 - lat1);\n let dLon = this.toRad(lon2 - lon1);\n let radlat1 = this.toRad(lat1);\n let radlat2 = this.toRad(lat2);\n let a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(radlat1) * Math.cos(radlat2);\n let c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n let d = R * c;\n return d;\n }", "function calculatePath() {\n // create Nodes from the Start and End x,y coordinates\n let mypathStart = Node(null, { x: pathStart[0], y: pathStart[1] });\n let mypathEnd = Node(null, { x: pathEnd[0], y: pathEnd[1] });\n // create an array that will contain all world cells\n let AStar = new Array(worldSize);\n // list of currently open Nodes\n let Open = [mypathStart];\n // list of the final output array\n let result = [];\n // reference to a Node (that is nearby)\n let myNeighbours;\n // reference to a Node (that we are considering now)\n let myNode;\n // reference to a Node (that starts a path in question)\n let myPath;\n // temp integer variables used in the calculations\n let length, max, min, i, j;\n // iterate through the open list until none are left\n do {\n max = worldSize;\n min = -1;\n for (i = 0; i < length; i++) {\n if (Open[i].f < max) {\n max = Open[i].f;\n min = i;\n }\n }\n // grab the next node and remove it from Open array\n myNode = Open.splice(min, 1)[0];\n // is it the destination node?\n if (myNode.value === mypathEnd.value) {\n // we found a path!\n do {\n result.unshift([myNode.x, myNode.y]);\n\n myNode = myNode.Parent;\n }\n while (myNode !== null);\n\n // clear the working arrays\n AStar = Open = [];\n\n return result;\n }\n\n // find which nearby nodes are walkable\n myNeighbours = neighbours(myNode.x, myNode.y);\n for (i = 0, j = myNeighbours.length; i < j; i++) {\n // test each one that hasn't been tried already\n myPath = Node(myNode, myNeighbours[i]);\n if (!AStar[myPath.value]) {\n // estimated cost of this particular route so far\n myPath.g = myNode.g + distanceFunction(myNeighbours[i], myNode);\n // estimated cost of entire guessed route to the destination\n myPath.f = myPath.g + distanceFunction(myNeighbours[i], mypathEnd);\n // remember this new path for testing above\n Open.push(myPath);\n // mark this node in the world graph as visited\n AStar[myPath.value] = true;\n }\n }\n\n length = Open.length;\n } while (0 < length);\n\n return result;\n }", "function totalDistance(legsArray) {\n var result = 0;\n for(var i=0; i<legsArray.length; i++) {\n result += legsArray[i].distance.value;\n }\n return result;\n}", "function closestPath(waypoint){\n var pathDistances = [];\n var percentage = [];\n for (var i=0; i<vm.trailPath.length-1; i++){\n let a = spherical.computeDistanceBetween(waypoint, vm.trailPath[i+1]);\n let b = spherical.computeDistanceBetween(waypoint, vm.trailPath[i]);\n let c = spherical.computeDistanceBetween(vm.trailPath[i], vm.trailPath[i+1]);\n let A = Math.acos(Math.min((Math.pow(b,2)+Math.pow(c,2)-Math.pow(a,2))/(2*b*c), 1));\n let B = Math.acos(Math.min((Math.pow(c,2)+Math.pow(a,2)-Math.pow(b,2))/(2*a*c), 1));\n let C = Math.PI-B-A;\n\n if (A > (Math.PI/2)){\n pathDistances[i] = b;\n percentage[i]=0;\n } else if (B > (Math.PI/2)){\n pathDistances[i] = a;\n percentage[i]=1;\n } else {\n pathDistances[i] = a*Math.sin(B);\n percentage[i]=Math.sqrt(Math.pow(b,2) - Math.pow(pathDistances[i],2))/c;\n }\n }\n let minIndex = pathDistances.reduce((iMin, x, i, arr) => x < arr[iMin] ? i : iMin, 0) + 1;\n let finalPercentage = percentage[minIndex-1];\n let path1 = vm.trailPath.slice(0, [minIndex]);\n let path2 = vm.trailPath.slice(0, [minIndex+1]);\n let distance = (spherical.computeLength(path1)+ (spherical.computeLength(path2) - spherical.computeLength(path1))*finalPercentage)\n * metersMilesConversion;\n\n return [minIndex, finalPercentage, distance];\n}", "getPathLength(lat1, lng1, lat2, lng2) {\n var lat1rads, lat2rads, deltaLat, lat2rads, deltaLng,\n a, c, dist_metre, R;\n\n // Avoid to return NAN, if finding distance between same lat long.\n if (lat1 == lat2 && lng1 == lng2) {\n return 0;\n }\n\n //Earth Radius (in metre)\n R = 6371000\n\n lat1rads = this.degreesToRadians(lat1)\n lat2rads = this.degreesToRadians(lat2)\n deltaLat = this.degreesToRadians((lat2 - lat1))\n deltaLng = this.degreesToRadians((lng2 - lng1))\n\n a = Math.sin(deltaLat / 2) * Math.sin(deltaLat / 2) +\n Math.cos(lat1rads) * Math.cos(lat2rads) * Math.sin(deltaLng / 2) * Math.sin(deltaLng / 2)\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))\n\n dist_metre = R * c;\n\n if (isNaN(dist_metre)) {\n return 0;\n }\n\n return dist_metre\n }", "function calculate_distance() {\n\n currgal_length_in_Mpc = convert_ltyr_to_Mpc(currgal_length_in_ltyr);\n currgal_distance = currgal_length_in_Mpc / view_height_rad;\n\n print_distance(\"calculating.\");\n setTimeout(function () {\n print_distance(\"calculating..\")\n }, 500);\n setTimeout(function () {\n print_distance(\"calculating...\")\n }, 1000);\n setTimeout(function () {\n print_distance(Math.round(currgal_distance).toLocaleString() + \" Mpc\")\n }, 1500);\n }", "function calculeDistance(x1, y1, x2, y2) {\r\n return Math.sqrt(Math.pow((y2 - y1),2) + Math.pow((x2 - x1),2));\r\n}", "function calculateDistance(pointer_1, pointer_2) {\n var dist = (google.maps.geometry.spherical.computeDistanceBetween(pointer_1, pointer_2) / 1000).toFixed(2);\n return parseFloat(dist);\n\n }", "getPathCost() {\n if (this.parent === null) {\n return 0;\n } else {\n return this.parent.getPathCost() + this.action.cost;\n }\n }", "distanceFrom(node){\n const halfWidth = this.width/2;\n const nodeHalfWidth = node.width/2;\n // max(a[0], b[0]) - min(a[1], b[1])\n return Math.max(this.currentPos - halfWidth, node.currentPos - nodeHalfWidth) - Math.min(this.currentPos + halfWidth, node.currentPos + nodeHalfWidth);\n }", "getDistance(pt) {\n var x = (this.x - this.y) * this.TILE_HEIGHT + this.MAP_OFFSET_X;\n var y = (this.x + this.y) * this.TILE_HEIGHT / 2 + this.MAP_OFFSET_Y;\n return Math.sqrt(Math.pow(x - pt.x, 2) + Math.pow(y - pt.y, 2));\n }", "function calculateStepDistance(steps, midlength) {\n var distanceTravelled = 0, previousTravelled, pathLength = 0;\n var currentCalculatedLocation;\n var increment = 50 * 1.75;//$('#radius').val() * 1.75;\n var pathWalked = 0;\n var pathLeftToWalk = 0;\n var distanceOvershot = 0;\n var searchCount = 0;\n var distanceTravelledThisPath = 0;\n var midlocation = '';\n //console.log('Traversing route steps-midpoint' + midlength); //this is the distance\n for (var i = 0; i < steps.length; i++) {\n //console.log('distance of step i:' + i + ' distance:' + steps[i].distance.value);\n //console.log('step' + i + ' has ' + steps[i].path.length + ' paths');\n var distanceStep = 0;\n pathWalked = 0;\n for (var j = 1; j < steps[i].path.length; j++) {\n //we have to iterate through the length of each path\n //console.log('i,j'+i+':'+j);\n if (j === 1) {\n currentCalculatedLocation = steps[i].path[0];\n }\n pathLength = google.maps.geometry.spherical.computeDistanceBetween(currentCalculatedLocation, steps[i].path[j]);\n distanceTravelledThisPath = 0;\n pathLeftToWalk = pathLength;\n //console.log('distance in path ' + pathLength);\n //case 1 pathLength=100, increment=50\n //case 2 pathLegth 10\n //case 2 step 2 pathLength 42, pathLeftToWalk will be 42-40=2\n pathWalked = 0;\n do {\n //record keeping\n previousTravelled = pathWalked;\n //update the path to walk before incrementing with how far overshot the last iteration\n //console.log('distanceOvershot check' + distanceOvershot + 'pathLeftToWalk' + pathLeftToWalk);\n if (distanceOvershot > 0) {\n pathLeftToWalk = pathLeftToWalk - distanceOvershot;\n //check for midpoint and search circle has to be made evertime the pathWalked is incremented\n //there is two possible iterations with this logic that can happen when this path is first\n //entered, causing the possibility that a search circle and midpoint be missed.\n\n //only time pathLeftToWalk can be <0 is if distanceOvershot >0 and pathLeftToWalk < that.. when first entered.\n if (pathLeftToWalk < 0) {//ok increment>distance\n pathWalked += pathLength;\n distanceOvershot = -pathLeftToWalk;\n } else {\n pathWalked = distanceOvershot;\n distanceOvershot = 0;\n }\n distanceTravelledThisPath += pathWalked;\n } else {\n //we don't want to run this in the first iteration\n pathLeftToWalk = pathLeftToWalk - increment;\n if (pathLeftToWalk < 0) {//ok increment>distance\n pathWalked += (increment + pathLeftToWalk) + distanceOvershot;\n distanceOvershot = -pathLeftToWalk;\n } else {\n //case 1 step 2 pathWalked=50\n //case 2 step\n pathWalked += increment + distanceOvershot;\n distanceOvershot = 0;\n }\n }\n if (midlocation === '' && midlength <= (distanceTravelled + pathWalked)) {\n //displayInfo.midlocation =\n midlocation = google.maps.geometry.spherical.interpolate(currentCalculatedLocation, steps[i].path[j], (midlength - distanceTravelled) / pathLength);\n //console.log('midpoint calculated at ' + midlocation);\n return midlocation;\n }\n //this is old code, we don't have to draw search circles because it's too resource heavy\n if (parseInt((distanceTravelled + pathWalked) / increment, 10) > searchCount) {\n //the pathWalked might have been too far, we want to get it as it steps over the increment in whole units\n /*\n if (pathLeftToWalk < 0) {//if the overshot goes beyond the path, then the search is less than that\n //console.log('CIRCLE pathlength' + pathLength + 'negative overshoot' + distanceOvershot + 'increment' + increment);\n drawCircle(google.maps.geometry.spherical.interpolate(currentCalculatedLocation, steps[i].path[j], ((((searchCount + 1) * increment) - (distanceTravelled + previousTravelled)) / pathLength)), 2);\n } else {\n //console.log('CIRCLE distance ' + pathLength + ' distanceStep:' + pathLeftToWalk + ' prevous walked:' + previousTravelled);\n drawCircle(google.maps.geometry.spherical.interpolate(currentCalculatedLocation, steps[i].path[j], 1 - (pathLeftToWalk / pathLength)), 2);\n }\n */\n searchCount++;\n }\n //console.log('distanceTravelledThisStep:' + pathWalked + ' searchCount:' + searchCount);\n } while (pathLeftToWalk > 0);\n //console.log('-----------------');\n distanceTravelled += pathWalked;\n currentCalculatedLocation = steps[i].path[j];\n }\n\n //console.log('distance travelled:' + distanceTravelled + ' distance travelled this step:' + pathWalked);\n }\n //console.log('distance travelled:' + distanceTravelled);\n}", "function calculatePath(){\n\t\t// create Nodes from the Start and End x,y coordinates\n\t\tvar\tmypathStart = Node(null, {x:pathStart[0], y:pathStart[1]});\n\t\tvar mypathEnd = Node(null, {x:pathEnd[0], y:pathEnd[1]});\n\t\t// create an array that will contain all world cells\n\t\tvar AStar = new Array(worldSize);\n\t\t// list of currently open Nodes\n\t\tvar Open = [mypathStart];\n\t\t// list of closed Nodes\n\t\tvar Closed = [];\n\t\t// list of the final output array\n\t\tvar result = [];\n\t\t// reference to a Node (that is nearby)\n\t\tvar myNeighbours;\n\t\t// reference to a Node (that we are considering now)\n\t\tvar myNode;\n\t\t// reference to a Node (that starts a path in question)\n\t\tvar myPath;\n\t\t// temp integer variables used in the calculations\n\t\tvar length, max, min, i, j;\n\t\t// iterate through the open list until none are left\n\t\twhile(length = Open.length)\n\t\t{\n\t\t\tmax = worldSize;\n\t\t\tmin = -1;\n\t\t\tfor(i = 0; i < length; i++)\n\t\t\t{\n\t\t\t\tif(Open[i].f < max)\n\t\t\t\t{\n\t\t\t\t\tmax = Open[i].f;\n\t\t\t\t\tmin = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// grab the next node and remove it from Open array\n\t\t\tmyNode = Open.splice(min, 1)[0];\n\t\t\t// is it the destination node?\n\t\t\tif(myNode.value === mypathEnd.value)\n\t\t\t{\n\t\t\t\tmyPath = Closed[Closed.push(myNode) - 1];\n\t\t\t\tdo\n\t\t\t\t{\n\t\t\t\t\tresult.push([myPath.x, myPath.y]);\n\t\t\t\t}\n\t\t\t\twhile (myPath = myPath.Parent);\n\t\t\t\t// clear the working arrays\n\t\t\t\tAStar = Closed = Open = [];\n\t\t\t\t// we want to return start to finish\n\t\t\t\tresult.reverse();\n\t\t\t}\n\t\t\telse // not the destination\n\t\t\t{\n\t\t\t\t// find which nearby nodes are walkable\n\t\t\t\tmyNeighbours = Neighbours(myNode.x, myNode.y);\n\t\t\t\t// test each one that hasn't been tried already\n\t\t\t\tfor(i = 0, j = myNeighbours.length; i < j; i++)\n\t\t\t\t{\n\t\t\t\t\tmyPath = Node(myNode, myNeighbours[i]);\n\t\t\t\t\tif (!AStar[myPath.value])\n\t\t\t\t\t{\n\t\t\t\t\t\t// estimated cost of this particular route so far\n\t\t\t\t\t\tmyPath.g = myNode.g + distanceFunction(myNeighbours[i], myNode);\n\t\t\t\t\t\t// estimated cost of entire guessed route to the destination\n\t\t\t\t\t\tmyPath.f = myPath.g + distanceFunction(myNeighbours[i], mypathEnd);\n\t\t\t\t\t\t// remember this new path for testing above\n\t\t\t\t\t\tOpen.push(myPath);\n\t\t\t\t\t\t// mark this node in the world graph as visited\n\t\t\t\t\t\tAStar[myPath.value] = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// remember this route as having no more untested options\n\t\t\t\tClosed.push(myNode);\n\t\t\t}\n\t\t} // keep iterating until the Open list is empty\n\t\treturn result;\n\t}", "function calculatePath()\n {\n // create Nodes from the Start and End x,y coordinates\n var mypathStart = Node(null,\n {\n x: pathStart[0],\n y: pathStart[1]\n });\n var mypathEnd = Node(null,\n {\n x: pathEnd[0],\n y: pathEnd[1]\n });\n // create an array that will contain all world cells\n var AStar = new Array(worldSize);\n // list of currently open Nodes\n var Open = [mypathStart];\n // list of closed Nodes\n var Closed = [];\n // list of the final output array\n var result = [];\n // reference to a Node (that is nearby)\n var myNeighbours;\n // reference to a Node (that we are considering now)\n var myNode;\n // reference to a Node (that starts a path in question)\n var myPath;\n // temp integer variables used in the calculations\n var length, max, min, i, j;\n // iterate through the open list until none are left\n while (length = Open.length)\n {\n max = worldSize;\n min = -1;\n for (i = 0; i < length; i++)\n {\n if (Open[i].f < max)\n {\n max = Open[i].f;\n min = i;\n }\n }\n // grab the next node and remove it from Open array\n myNode = Open.splice(min, 1)[0];\n // is it the destination node?\n if (myNode.value === mypathEnd.value)\n {\n myPath = Closed[Closed.push(myNode) - 1];\n do {\n result.push([myPath.x, myPath.y]);\n }\n while (myPath = myPath.Parent);\n // clear the working arrays\n AStar = Closed = Open = [];\n // we want to return start to finish\n result.reverse();\n }\n else // not the destination\n {\n // find which nearby nodes are walkable\n myNeighbours = Neighbours(myNode.x, myNode.y);\n // test each one that hasn't been tried already\n for (i = 0, j = myNeighbours.length; i < j; i++)\n {\n myPath = Node(myNode, myNeighbours[i]);\n if (!AStar[myPath.value])\n {\n // estimated cost of this particular route so far\n myPath.g = myNode.g + distanceFunction(myNeighbours[i], myNode);\n // estimated cost of entire guessed route to the destination\n myPath.f = myPath.g + distanceFunction(myNeighbours[i], mypathEnd);\n // remember this new path for testing above\n Open.push(myPath);\n // mark this node in the world graph as visited\n AStar[myPath.value] = true;\n }\n }\n // remember this route as having no more untested options\n Closed.push(myNode);\n }\n } // keep iterating until the Open list is empty\n return result;\n }", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }", "function calculatePath()\r\n\t{\r\n\t\t// create Nodes from the Start and End x,y coordinates\r\n\t\tvar\tmypathStart = Node(null, {x:pathStart[0], y:pathStart[1]});\r\n\t\tvar mypathEnd = Node(null, {x:pathEnd[0], y:pathEnd[1]});\r\n\t\t// create an array that will contain all world cells\r\n\t\tvar AStar = new Array(worldSize);\r\n\t\t// list of currently open Nodes\r\n\t\tvar Open = [mypathStart];\r\n\t\t// list of closed Nodes\r\n\t\tvar Closed = [];\r\n\t\t// list of the final output array\r\n\t\tvar result = [];\r\n\t\t// reference to a Node (that is nearby)\r\n\t\tvar myNeighbours;\r\n\t\t// reference to a Node (that we are considering now)\r\n\t\tvar myNode;\r\n\t\t// reference to a Node (that starts a path in question)\r\n\t\tvar myPath;\r\n\t\t// temp integer variables used in the calculations\r\n\t\tvar length, max, min, i, j;\r\n\t\t// iterate through the open list until none are left\r\n\t\twhile(length = Open.length)\r\n\t\t{\r\n\t\t\tmax = worldSize;\r\n\t\t\tmin = -1;\r\n\t\t\tfor(i = 0; i < length; i++)\r\n\t\t\t{\r\n\t\t\t\tif(Open[i].f < max)\r\n\t\t\t\t{\r\n\t\t\t\t\tmax = Open[i].f;\r\n\t\t\t\t\tmin = i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// grab the next node and remove it from Open array\r\n\t\t\tmyNode = Open.splice(min, 1)[0];\r\n\t\t\t// is it the destination node?\r\n\t\t\tif(myNode.value === mypathEnd.value)\r\n\t\t\t{\r\n\t\t\t\tmyPath = Closed[Closed.push(myNode) - 1];\r\n\t\t\t\tdo\r\n\t\t\t\t{\r\n\t\t\t\t\tresult.push([myPath.x, myPath.y]);\r\n\t\t\t\t}\r\n\t\t\t\twhile (myPath = myPath.Parent);\r\n\t\t\t\t// clear the working arrays\r\n\t\t\t\tAStar = Closed = Open = [];\r\n\t\t\t\t// we want to return start to finish\r\n\t\t\t\tresult.reverse();\r\n\t\t\t}\r\n\t\t\telse // not the destination\r\n\t\t\t{\r\n\t\t\t\t// find which nearby nodes are walkable\r\n\t\t\t\tmyNeighbours = Neighbours(myNode.x, myNode.y);\r\n\t\t\t\t// test each one that hasn't been tried already\r\n\t\t\t\tfor(i = 0, j = myNeighbours.length; i < j; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tmyPath = Node(myNode, myNeighbours[i]);\r\n\t\t\t\t\tif (!AStar[myPath.value])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// estimated cost of this particular route so far\r\n\t\t\t\t\t\tmyPath.g = myNode.g + distanceFunction(myNeighbours[i], myNode);\r\n\t\t\t\t\t\t// estimated cost of entire guessed route to the destination\r\n\t\t\t\t\t\tmyPath.f = myPath.g + distanceFunction(myNeighbours[i], mypathEnd);\r\n\t\t\t\t\t\t// remember this new path for testing above\r\n\t\t\t\t\t\tOpen.push(myPath);\r\n\t\t\t\t\t\t// mark this node in the world graph as visited\r\n\t\t\t\t\t\tAStar[myPath.value] = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// remember this route as having no more untested options\r\n\t\t\t\tClosed.push(myNode);\r\n\t\t\t}\r\n\t\t} // keep iterating until the Open list is empty\r\n\t\treturn result;\r\n\t}", "function calcDistance(x1, y1, x2, y2)\n{\n\treturn Math.sqrt(Math.pow((x2 - x1),2) + Math.pow((y2 - y1),2));\n}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)); \n }", "function dist(p1, p2)\n{\n return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);\n}", "function distance(p1, p2) { return length_v2(diff_v2(p1, p2)); }", "function calcDistance(points) {\n\tlet sum = 0;\n\n\tfor (let i = 0; i < points.length - 1; i++) {\n\t\tlet d = dist(points[i].x, points[i].y, points[i + 1].x, points[i + 1].y);\n\t\tsum += d;\n\t}\n\n\treturn sum;\n}", "dist(vector) {\n return vector\n .copy()\n .sub(this)\n .getLength();\n }", "function calcDistance(destination){\n var p1 = new google.maps.LatLng(destination.A, destination.F);\n var p2 = new google.maps.LatLng($scope.position.latitude, $scope.position.longitude);\n return (google.maps.geometry.spherical.computeDistanceBetween(p1, p2) / 1000 * 0.621371).toFixed(2);\n }", "function computeDistanceBetween(from, to) {\n return computeAngleBetween(from, to) * EARTH_RADIUS;\n}", "function getDistance(){\n if (departure.value == \"dep-auck\" && destination.value == \"dest-taup\" || departure.value == \"dep-taup\" && destination.value == \"dest-auck\"){\n tripDistance = distance.taupAuck;\n }\n else if (departure.value == \"dep-well\" && destination.value == \"dest-taup\" || departure.value == \"dep-taup\" && destination.value == \"dest-well\"){\n tripDistance = distance.wellTaup;\n }\n else if (departure.value == \"dep-well\" && destination.value == \"dest-auck\" || departure.value == \"dep-auck\" && destination.value == \"dest-well\"){\n tripDistance = distance.auckWell;\n }\n }", "function calculateDistance(x1,x2,y1,y2){\n return Math.sqrt(Math.pow((x2-x1),2)+Math.pow((y2-y1),2));\n}", "static distance(a, b) {\n const dx = a.x - b.x;\n const dy = a.y - b.y;\n return Math.hypot(dx, dy);\n // Math.hypot(3, 4);\n // 5\n }", "function distanceTravelledInFeet(start, destination) {\n let result = Math.abs(start - destination) * 264;\n // console.log('start:', start);\n // console.log('dest: ', destination);\n // console.log('result: ', result);\n return result;\n}", "distanceTo(p) {\n let x = (this.pos.x - p.translation[0]);\n let y = (this.pos.y - p.translation[1]);\n let euclDist = sqrt(pow(x, 2) + pow(y, 2));\n return euclDist;\n }", "function calculateDistance(linkStation, device) {\n return Math.sqrt(Math.pow(device.x - linkStation.x, 2) + Math.pow(device.y - linkStation.y, 2));\n}", "distance(p) {\n return Math.sqrt(this.squaredDistance(p));\n }", "function calculatePath() {\n\t // create Nodes from the Start and End x,y coordinates\n\t var mypathStart = Node(null, { x: pathStart[0], y: pathStart[1] });\n\t var mypathEnd = Node(null, { x: pathEnd[0], y: pathEnd[1] });\n\t // create an array that will contain all world cells\n\t var AStar = new Array(worldSize);\n\t // list of currently open Nodes\n\t var Open = [mypathStart];\n\t // list of closed Nodes\n\t var Closed = [];\n\t // list of the final output array\n\t var result = [];\n\t // reference to a Node (that is nearby)\n\t var myNeighbours;\n\t // reference to a Node (that we are considering now)\n\t var myNode;\n\t // reference to a Node (that starts a path in question)\n\t var myPath;\n\t // temp integer variables used in the calculations\n\t var length, max, min, i, j;\n\t // iterate through the open list until none are left\n\t while (length = Open.length) {\n\t max = worldSize * 999999;\n\t min = -1;\n\t for (i = 0; i < length; i++) {\n\t if (Open[i].f < max) {\n\t max = Open[i].f;\n\t min = i;\n\t }\n\t }\n\t // grab the next node and remove it from Open array\n\t myNode = Open.splice(min, 1)[0];\n\t // is it the destination node?\n\t if (myNode.value === mypathEnd.value) {\n\t myPath = Closed[Closed.push(myNode) - 1];\n\t do {\n\t result.push([myPath.x, myPath.y]);\n\t } while (myPath = myPath.Parent);\n\t // clear the working arrays\n\t AStar = Closed = Open = [];\n\t // we want to return start to finish\n\t result.reverse();\n\t } else // not the destination\n\t {\n\t // find which nearby nodes are walkable\n\t myNeighbours = Neighbours(myNode.x, myNode.y);\n\t // test each one that hasn't been tried already\n\t for (i = 0, j = myNeighbours.length; i < j; i++) {\n\t myPath = Node(myNode, myNeighbours[i], world[myNeighbours[i].x][myNeighbours[i].y]);\n\t if (!AStar[myPath.value]) {\n\t // estimated cost of this particular route so far\n\t myPath.g += myNode.g + distanceFunction(myNeighbours[i], myNode);\n\t // estimated cost of entire guessed route to the destination\n\t myPath.f = myPath.g + distanceFunction(myNeighbours[i], mypathEnd);\n\t // remember this new path for testing above\n\t Open.push(myPath);\n\t // mark this node in the world graph as visited\n\t AStar[myPath.value] = true;\n\t }\n\t }\n\t // remember this route as having no more untested options\n\t Closed.push(myNode);\n\t }\n\t } // keep iterating until the Open list is empty\n\t return result;\n\t }", "function getDistance(c1 ,c2){\n \n let x1 = c1.x ;\n let y1 = c1.y ;\n let x2 = c2.x ;\n let y2 = c2.y ;\n let x = x2-x1;\n let y = y2-y1;\n return (Math.sqrt(Math.pow(x,2)+Math.pow(y,2)));\n\n }", "function distance(p1, p2)\n{\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "getDistance(x, y) {\n\n const currentObject = this;\n\n const getNewDirection = function(c1x, c1y, dir) {\n const radsOffset = dir*Math.PI/2.0;\n const isZero = (y - c1y) == 0 && (x - c1x) == 0;\n var rads = 0.0;\n if (!isZero) {\n rads = (Math.atan2(y - c1y, x - c1x) - radsOffset + 4.0*Math.PI) % (2.0*Math.PI);\n }\n\n if (rads <= Math.PI/4.0) {\n return currentObject.dirReturn(dir, 0);\n }\n else if (rads <= Math.PI) {\n return currentObject.dirReturn(dir, 1);\n }\n else if (rads <= Math.PI*7.0/4.0) {\n return currentObject.dirReturn(dir, 3);\n }\n else {\n return currentObject.dirReturn(dir, 0);\n }\n };\n\n // NOTE: Since JavaScript is not guaranteed to have tail recursion optimization,\n // this can overflow the stack for too high iteration values.\n const distanceToCircle = function(c1x, c1y, r1, n1, dir, lastDistance) {\n\n const currentDistance = Math.min(calcLength(x - c1x, y - c1y) - r1, lastDistance);\n\n if (currentDistance <= 0 || n1 <= 0) {\n return currentDistance;\n }\n else {\n // Calculate new circle.\n\n const rnew = r1*(1.0/(1.0*currentObject.divisionFactor));\n const dirnew = getNewDirection(c1x, c1y, dir);\n const radsnew = dirnew*Math.PI/2.0;\n const cnx = c1x + (r1 + rnew)*Math.cos(radsnew);\n const cny = c1y + (r1 + rnew)*Math.sin(radsnew);\n\n return distanceToCircle(cnx, cny, rnew, n1 - 1, dirnew, currentDistance);\n }\n };\n\n return distanceToCircle(\n this.centerX, this.centerY, this.startRadius, this.numberOfIterations,\n this.startDirection, this.maximumDistance);\n }", "distance(x0, y0, x1, y1) {\n return Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2));\n }", "dist (x, y) {\n const dx = (this.x - x);\n const dy = (this.y - y);\n return dx ** 2 + dy ** 2 \n }", "distance() { // Method to compute distance from origin to point.\n return Math.sqrt( // Return the square root of x² + y².\n this.x * this.x + // this refers to the Point object on which\n this.y * this.y // the distance method is invoked.\n );\n }", "static distance(p1, p2) {\n const dx = (p1.x - p2.x);\n const dy = (p1.y - p2.y);\n return Math.sqrt(dx * dx + dy * dy);\n }", "function getDist(ax, ay, bx, by){\n\tvar dx = ax - bx;\n\tvar dy = ay - by;\n\tvar d = Math.sqrt(dx*dx + dy*dy);\n\treturn d;\n}", "distanceToPoint (p0) {\n const dd = (this.a * p0.x + this.b * p0.y + this.c * p0.z + this.d) /\n Math.sqrt(this.a * this.a + this.b * this.b + this.c * this.c)\n return dd\n }", "distance (a, b) {\n return Math.sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));\n }", "function findTotalDistance(startLocation, endLocation, callback){\n\tvar location1 = this.origin.results[0].formatted_address;\n\tvar location2 = this.destination.results[0].formatted_address;\n\n\tgm.distance(location1, startLocation, function(err, dst1){\n\t\tif (dst1 == undefined){\n\t\t\tconsole.log(\"Error in findTotalDistance dst1\");\n\t\t\t//handle error case here\n\t\t}\n\t\telse{\n\t\t\tgm.distance(location2, endLocation, function(err, dst2){\n\t\t\t\tif (dst2 == undefined){\n\t\t\t\t\tconsole.log(\"Error in findTotalDistance dst1\");\n\t\t\t\t\t//handle error case here\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tcallback(dst1.rows[0].elements[0].distance.value/1000 + dst2.rows[0].elements[0].distance.value/1000);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n}", "perimeterDistance(v1, v2) {\n return this.distance(this.tracePerimeter(v1, v2, true))\n }", "function getPointDistance(p) {\n if (p === 0) {\n return 0.0;\n }\n\n return points[p].distance(points[p - 1]) + path[p - 1].startDistance;\n}", "function getDistance(a, b) {\n return Math.sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));\n }", "static DistanceToLine() {}", "function distance(p1, p2) {\n\t\treturn Math.sqrt(Math.pow(p2.y - p1.y, 2) + Math.pow(p2.x - p1.x, 2));\n\t}", "function calculatePath()\n\t{\n\t\t// create Nodes from the Start and End x,y coordinates\n\t\tvar\tmypathStart = Node(null, {x:pathStart[0], y:pathStart[1]});\n\t\t//console.log(\"mypathStart =\", mypathStart);\n\n\t\tvar mypathEnd = Node(null, {x:pathEnd[0], y:pathEnd[1]});\n\t\t//console.log(\"mypathend =\", mypathEnd);\n\t\t// create an array that will contain all world cells\n\t\tvar AStar = new Array(worldSize);\n\t\t// list of currently open Nodes\n\t\tvar Open = [mypathStart];\n\t\t// list of closed Nodes\n\t\tvar Closed = [];\n\t\t// list of the final output array\n\t\tvar result = [];\n\t\t// reference to a Node (that is nearby)\n\t\tvar myNeighbours;\n\t\t// reference to a Node (that we are considering now)\n\t\tvar myNode;\n\t\t// reference to a Node (that starts a path in question)\n\t\tvar myPath;\n\t\t// temp integer variables used in the calculations\n\t\tvar length, max, min, i, j;\n\t\t// iterate through the open list until none are left\n\t\twhile(length = Open.length)\n\t\t{\n\t\t\tmax = worldSize;\n\t\t\tmin = -1;\n\t\t\tfor(i = 0; i < length; i++)\n\t\t\t{\n\t\t\t\tif(Open[i].f < max)\n\t\t\t\t{\n\t\t\t\t\tmax = Open[i].f;\n\t\t\t\t\tmin = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// grab the next node and remove it from Open array\n\t\t\tmyNode = Open.splice(min, 1)[0];\n\t\t\t// is it the destination node?\n\t\t\tif(myNode.value === mypathEnd.value)\n\t\t\t{\n\t\t\t\tmyPath = Closed[Closed.push(myNode) - 1];\n\t\t\t\tdo\n\t\t\t\t{\n\t\t\t\t\tresult.push([myPath.x, myPath.y]);\n\t\t\t\t}\n\t\t\t\twhile (myPath = myPath.Parent);\n\t\t\t\t// clear the working arrays\n\t\t\t\tAStar = Closed = Open = [];\n\t\t\t\t// we want to return start to finish\n\t\t\t\tresult.reverse();\n\t\t\t}\n\t\t\telse // not the destination\n\t\t\t{\n\n\t\t\t\tmyNeighbours = Neighbours(myNode.x, myNode.y);\n\t\t\t\t// test each one that hasn't been tried already\n\t\t\t\tfor(i = 0, j = myNeighbours.length; i < j; i++)\n\t\t\t\t{\n\t\t\t\t\tmyPath = Node(myNode, myNeighbours[i]);\n\t\t\t\t\tif (!AStar[myPath.value])\n\t\t\t\t\t{\n\t\t\t\t\t\t// estimated cost of this particular route so far\n\t\t\t\t\t\tmyPath.g = myNode.g + distanceFunction(myNeighbours[i], myNode);\n\t\t\t\t\t\t// estimated cost of entire guessed route to the destination\n\t\t\t\t\t\tmyPath.f = myPath.g + distanceFunction(myNeighbours[i], mypathEnd);\n\t\t\t\t\t\t// remember this new path for testing above\n\t\t\t\t\t\tOpen.push(myPath);\n\t\t\t\t\t\t// mark this node in the world graph as visited\n\t\t\t\t\t\tAStar[myPath.value] = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tClosed.push(myNode);\n\t\t\t}\n\t\t} \n\t\treturn result;\n\t}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function getDistance(x1,y1,x2,y2){\n // this is the equation: square root of (x1-y1)*(x1-y2)+(y1-y2)*(y2-y1)\n return Math.sqrt( Math.pow((x1-x2), 2) + Math.pow((y1-y2), 2) );\n}", "get planeDistance() {}", "function distancia(p1,p2){\n //obteniendo los parametros de el objeto\n const x= p1.x - p2.x;\n const y= p1.y - p2.y;\n //to fixed, redondear decimales\n return (Math.sqrt(Math.pow(x,2)+Math.pow(y,2))).toFixed(2)\n}", "function getDistance(x1, y1, x2, y2) {\n return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n }", "function distance(pt1, pt2) { \n\n return Math.sqrt(Math.pow((pt1.x - pt2.x), 2) + Math.pow((pt1.y - pt2.y), 2));\n}" ]
[ "0.7210126", "0.7151468", "0.69926953", "0.69369656", "0.6807505", "0.67762655", "0.67177165", "0.66839963", "0.6634162", "0.6633744", "0.6580088", "0.6577251", "0.65378577", "0.6420952", "0.6411197", "0.63623935", "0.63603246", "0.63479435", "0.631411", "0.62686557", "0.62576145", "0.6256484", "0.62119615", "0.61658263", "0.61425436", "0.61418474", "0.6127767", "0.61190784", "0.6103728", "0.60981953", "0.6026116", "0.60208935", "0.60161364", "0.6005227", "0.6002741", "0.5993896", "0.59919816", "0.59839725", "0.5982065", "0.5975542", "0.5944942", "0.59387314", "0.5934542", "0.5934039", "0.5931916", "0.59113985", "0.5900092", "0.5896465", "0.58927315", "0.5887517", "0.5883992", "0.5883863", "0.5875861", "0.5869595", "0.58645904", "0.58645904", "0.58645904", "0.58610284", "0.5859711", "0.58505553", "0.58495843", "0.5847623", "0.5845536", "0.5845516", "0.58373827", "0.5837321", "0.58335197", "0.58260185", "0.5824513", "0.58223164", "0.5819993", "0.581947", "0.58116287", "0.58111244", "0.5807366", "0.5806667", "0.5806272", "0.5801542", "0.5789838", "0.5789362", "0.5783702", "0.5774685", "0.5770704", "0.5769294", "0.5764968", "0.5763432", "0.5749267", "0.5733284", "0.5728761", "0.5725516", "0.5724349", "0.5723583", "0.5723583", "0.5723583", "0.5723583", "0.57220805", "0.57192653", "0.57135934", "0.57134974", "0.57108307" ]
0.7126329
2
Pass: redux state to props
function mapStateToProps(state, props) { return { token: state.authReducer.token, moji_stack: state.navReducer.moji_stack }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapStateToProps (state) {\n //return object of what you want to pass to component as a prop\n\n}", "function mapStateToProps(state) {\n return {\n data: state,\n };\n}", "function mapStateToProps(state) {\n // Whatever is returned from here it shows up as props\n return {\n asd: '123',\n books: state.books\n };\n}", "function mapStateToProps(state) {\n // whatever gets returned will show up as props inside of dispatch fun\n return {\n theme: state.theme, \n layout: state.layout, \n weapons: state.weapons,\n targets: state.targets,\n options: state.options,\n history: state.history\n };\n}", "function mapStateToProps(state) {\n // whatever is returned will show up as props inside of ThreadList\n return { threads: state.threads }\n}", "function mapStateToProps (state)\n{\n return state;\n}", "function mapStateToProps(state){\n\treturn state\n}", "function mapStateToProps(state) {\n return {msg: state.msg};//just maintain only one level of state/ otherwise you can't get the child obj props\n}", "function mapStateToProps(state) {\n return {\n redux: state\n };\n}", "function mapStateToProps(state) {\n\treturn state; \n}", "function mapStateToProps(state) {\n //whatever is returned here shows up as props in `this.props`\n return {\n books: state.books\n };\n}", "function mapStateToProps(state) {\n return state;\n}", "function mapStateToProps(state) {\n return state\n}", "function mapStateToProps(state){\n // whatever you return here will be put on the props object for this component;\n // the key in this object will be the key on the props object\n // the value for the key in this object will be the value for the key on the props object\n return{\n name: state.name,\n description: state.description\n }\n}", "function mapStateToProps(state) { //makes this.props.books used in renderList. need react-redux. takes app state as argument\n return { //whatever is returned will show up as props inside Book-List\n books: state.books //makes this.props.books. value = list of books off of state\n };\n}", "function mapStateToProps(state, ownProps){\n return {\n // You can now say this.props.books\n books: state.books\n }\n}", "function mapStateToProps(state) {\n return {\n // TODO: add state\n };\n}", "function mapStateToProps (state) {\n return state;\n}", "function mapStateToProps(state) {\n return {\n // myState: state.myState,\n }\n}", "function mapStateToProps(state, props) {\n return {\n count: state.count,\n incrValues: state.incrValues\n }\n}", "function mapStateToProps(state) {\n return state;\n}", "function mapStateToProps(state) {\n return state;\n}", "function mapStateToProps(state) {\n return state;\n}", "function mapStateToProps(state) {\n return state;\n}", "function mapStateToProps(state){\n return {\n //the left side key must be the name of the prop that you want to put info in\n count:state.currentCount\n //the right side value is the name of the state\n }\n }", "function mapStateToProps(state) {\n return state;\n}", "function mapStateToProps(state) {\n return state;\n}", "function mapStateToProps(state, props) {\r\n return {\r\n loading: state.dataReducer.loading,\r\n data: state.dataReducer.data\r\n }\r\n}", "function mapStateToProps(state){\r\n // Whatever object is returned will show up as this.props\r\n // inside of BookList\r\n return{\r\n books : state.books\r\n };\r\n}", "function mapStateToProps(state) {\n // What ever is returned will show up as props inside of CardList\n return {\n // this is what took me a weekend to figure out...\n card: state.activeCard\n };\n}", "function mapStateToProps(state) {\n //whatever is returned will show up as props inside of BookList\n return {\n books: state.books\n }\n}", "function mapStateToProps(state) {\n return {\n data: state.interested\n };\n}", "function mapStateToPros(state){\n //So take state from store and pass to components as props\n return{\n trainers:state.trainers\n }\n}", "function mapStateToProps(state) {\n return {};//just maintain only one level of state/ otherwise you can't get the child obj props\n}", "function mapStateToProps(state) {\n return { ...state }\n}", "function mapStateToProps(state) {\r\n return {\r\n // propertyname : stateValue\r\n counter : state.counter\r\n }\r\n}", "function mapStateToProps(state){\n return {\n //the left side key must be the name of the prop that you want to put info in\n temp:state.currentTemp\n //the right side value is the name of the state\n }\n }", "function mapStateToProps() {\r\n return {\r\n };\r\n}", "function mapStateToProps(state){\n console.log(state)\n return{\n mydata:state.movies\n }\n}", "function mapStateToProps(state) {\n return {\n result: state.result,\n };\n}", "function mapStateToProps(state){\n console.log(state)\n return{\n mydata:state.movies\n }\n \n}", "function mapStateToProps(state, props) {\n return {\n loading: state.dataReducer.loading,\n data: state.dataReducer.data\n }\n}", "function mapStateToProps(state) {\n return {\n // addsDataFromStore : state.Adds_Data_Updater,\n \n };\n}", "function mapStateToProps(state) {\n return {\n ...state\n }\n}", "function mapStateToProps(state){\n return {\n mydata:state.Films\n }\n}", "function mapStateToProps(state){\n return {store: state}\n}", "function mapStateToProps(reduxState){\n return {\n todos: reduxState.todos\n }\n}", "function mapStateToProps(state) {\n return {\n // something: from state.something\n state\n };\n}", "function mapStateToProps(state){\n return{\n mydata:state.films\n }\n}", "function mapStateToProps(state){\n console.log(state)\n return{\n mydata:state.Movies\n }\n}", "function mapStateToProps(state, ownProps) {\n return {\n redux: state.layout.blockLoader\n };\n}", "function mapStateToProps(state) {\n //whatever is returned here will show up as props in bookList\n return {\n books:state.books\n };\n}", "function mapStateToProps(state) {\n console.log('App.js mapStateToProps: mapping Redux state <-> React component props');\n return {\n countValue: state.count\n }\n}", "function mapStateToProps(state){\n return {\n }\n}", "function mapStateToProps(state, ownProps) {\n console.log(\"provera za test\" + JSON.stringify(state));\n return {\n courses: state.courses\n };\n}", "function mapStateToProps(state) {\n return {\n\n }\n}", "function mapStateToProps(state) {\n return {\n\n }\n}", "function mapStateToProps(state) {\n //props inside UserList\n return {\n users: state.users\n };\n}", "function mapStateToProps(state, props) {\n return {\n loading: state.dataReducer.loading,\n messages: state.dataReducer.messages,\n cards: state.dataReducer.cards\n }\n}", "function mapStateToProps(state, ownProps) {\r\n return { categoryList: state.activityCreation.categoryList, projectList: state.documentCreation.projectList, individualList: state.opportunity.individualList, oppList: state.documentCreation.oppList };\r\n}", "function mapStateToProps(state){\n return {\n count: state.count\n };\n}", "function mapStateToProps(state) {\n return {\n loadingProgress: state.loadingProgress,\n navState: state.navState,\n emailStore: state.emailStore,\n }\n}", "function mapStateToProps(state) {\n return {\n popupState: state.popupState,\n dataStore: state.dataStore\n }\n}", "function mapStateToProps(state, props) {\n return {\n }\n}", "function mapStateToProps() {\n return {\n };\n}", "function mapStateToProps(state, ownProps){\n return {\n compras:state.compras,\n filtro:state.filtro\n }\n}", "function mapStateToProps(state){\n\n return {\n main_coins_list: state.main_coins_list,\n search_res_list: state.search_res_list,\n compare_list: state.compare_list,\n\n view_sort_obj: state.view_sort_obj\n\n }\n\n}", "function mapStateToProps(state) {\n return {\n wantedPeople: state.wantedPeople,\n toast: state.toast\n }\n}", "function mapStateToProps(state) {\n return {\n ...state,\n };\n}", "function mapStateToProps(state) {\n return {\n // property name: value from state\n counter: state.counter\n }\n}", "function mapStateToProps(state) {\n return {\n \n };\n}", "function mapStateToProps(state) {\n return {\n\n };\n}", "function mapStateToProps(state) {\n return {\n\n }\n}", "function mapStatetoProps(state){\n // this function will return an object\n // property will be the props in this component\n // the value will be the piece of state from the reducer \n return{\n students: state.students\n } \n}", "function mapStateToProps(state) {\n return {\n counter: state.counter\n };\n}", "function mapStateToProps({ auth }) {\n //drog piece info from state\n return { auth };\n}", "function mapStateToProps(state) {\n return {\n value: state.counter\n };\n}", "function mapStateToProps(state) {\n return {\n counter: state\n }\n}", "function mapStateToProps(state) {\n console.log(state, 'hello')\n return {\n listDiagram: state.diagram\n };\n}", "function mapStateToProps(state) {\n return {\n context: state.context,\n selected: state.selected,\n sortBy: state.sortBy,\n dex: dex,\n options: options,\n date: date\n }\n}", "function mapStateToProps ( state ) {\n //the return here will show up as props in book_list.js\n return {\n books: state.books\n };\n}", "function mapStateToProps(state) {\n // Whatever is returned here will show up as props in BookList\n // If the state ever changes, this container will instantly re-render\n return {\n books: state.books\n };\n}", "function TestRedux(props) {\n console.log(props);\n return (\n <>\n <h1>Hello{props.initialstate}</h1>\n <button onClick={() => props.ADD(10)}>+</button>\n <button>-</button>\n </>\n );\n}", "function mapStateToProps(state) {\n return {\n canvas: state.canvas.data,\n context: state.context.data\n };\n}", "function mapStateToProps(state){\n console.log(state)\nreturn {\n messages:state\n}\n}", "function mapStateToProps(state){\n return{\n books: state.books\n };\n}", "function mapStateToProps(state){\n return {items: state.items}\n}", "function mapReduxStateToProps(state) {\n const { counter } = state;\n return {\n counter\n };\n}", "function mapStateToProps(state) {\n return {\n users: state.users,\n background: state.background\n }\n}", "function mapStateToProps(state) {\n return {\n productData : state.productData.ActiveProductData,\n // userData : state.SessionStorage.UserData,\n userData : state.Consumer.GetConsumerDetail\n\n };\n}", "function mapStateToProps(state) \n{\n console.log(state);\n\n const {dispatch, Reducer}=state;\n return {\n Reducer,\n dispatch\n }\n}", "function mapStateToProps(state){\n return{user: state}\n}", "function mapStateToProps(state) {\r\n\treturn {\r\n\t\ttree: state.tree,\r\n\t\ttraversed: state.traversed,\r\n\t\tdata: state.dgmData.data\r\n\t};\r\n}", "function mapStateToProps(state) {\n return {\n books: state.books,\n booksTotal: state.booksTotal,\n }\n}", "function mapStateToProps(state) {\n return {\n count: state.count\n }\n}", "function mapStateToProps(state){\n return{\n books: state.books\n }\n}", "function mapStateToProps(state, props) {\n return {\n }\n}", "function mapStateToProps(state, ownProps) {\n return {\n todos: state.todos\n }\n}", "function mapStateToProps(state) {\n return {\n counter: state.counter\n };\n}", "function mapStateToProps(state) {\n return { count: state.count }\n}", "function mapStateToProps(state) {\n return {\n category: state.activeCategory,\n meal: state.activeMeal\n };\n}" ]
[ "0.73820907", "0.71932817", "0.70546466", "0.7033385", "0.6977673", "0.69719833", "0.6941645", "0.6893427", "0.6882383", "0.68685305", "0.68535876", "0.6843393", "0.6842213", "0.68400353", "0.68379897", "0.6827367", "0.6819815", "0.6819619", "0.68185794", "0.679889", "0.6795944", "0.6795944", "0.6795944", "0.6795944", "0.6791234", "0.678972", "0.678972", "0.67823035", "0.67802805", "0.6748749", "0.6742053", "0.67380553", "0.6735274", "0.6726651", "0.672338", "0.6722425", "0.67215866", "0.6718982", "0.67132837", "0.6704279", "0.67015046", "0.66958624", "0.66943794", "0.66876906", "0.6685617", "0.66852605", "0.66794854", "0.66744137", "0.66736406", "0.6669603", "0.6660927", "0.66591513", "0.6652491", "0.6651798", "0.6648605", "0.66478276", "0.66478276", "0.66458637", "0.66439193", "0.66437", "0.6643276", "0.6638513", "0.6638228", "0.662354", "0.6618683", "0.66144174", "0.6606806", "0.66061664", "0.6604414", "0.66027355", "0.6600604", "0.6599698", "0.6593166", "0.65923244", "0.65847594", "0.65847325", "0.6583329", "0.65751326", "0.65738726", "0.65645474", "0.6559314", "0.65547585", "0.6552356", "0.65519613", "0.65485203", "0.6548411", "0.65452933", "0.65424424", "0.6541928", "0.65337485", "0.6531274", "0.6528347", "0.65274304", "0.6526274", "0.6524071", "0.65196705", "0.6517622", "0.65146285", "0.6511388", "0.650834", "0.6508005" ]
0.0
-1
Pass: redux actions to props
function mapDispatchToProps(dispatch) { return bindActionCreators(Actions, dispatch); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapActionToProps(dispatch) { return bindActionCreators({ ConfirmProductInfoAction, }, dispatch); }", "function mapActionToProps(dispatch) { return bindActionCreators({ GetActivityAction }, dispatch); }", "function mapActionToProps(dispatch) { return bindActionCreators({ GoProductAction }, dispatch); }", "render() {\n return (\n <div>\n {this.actions.map(action => (\n <Action\n handleAction={() => action.run()}\n updateToDo={() => this.props.updateToDo()}\n key={action.key}\n {...action}\n />\n )\n )}\n </div>\n )\n }", "componentWillReceiveProps(props) {\n actions.get(props.visible)(\n props.title,\n props.message,\n props.buttons,\n );\n }", "function mapDispatchToProps(dispatch) {\n\treturn {\n\t\tactions: bindActionCreators(actions, dispatch) //so we don't have to use this.props.dispatch(actionName())\n\t}\n}", "function mapActionToProps(dispatch) { return bindActionCreators({ SwitchSceneAction }, dispatch); }", "function mapActionToProps(dispatch) { return bindActionCreators({ SwitchTabAction }, dispatch); }", "function mapDispatchToProps(dispatch) { // whenever <function below> is called result should be passed to all of our\n // reducers\n return bindActionCreators({\n LayoutChange: LayoutChange,\n WeaponChange: WeaponChange,\n FireWeapon: FireWeapon,\n OptionChange: OptionChange\n }, dispatch);\n}", "function matchDispatchToProps(dispatch){\n\nreturn bindActionCreators({pokedexView: pokedexView}, dispatch);\n\n //connect-function\n // prop : action/function\n // dispatch (behind the scenes with redux to call func)\n\n}", "function mapDispatchToProps(dispatch) {\n // take all action and pass it into funnel (dispatch)\n return bindActionCreators({ selectBook: selectBook}, dispatch);\n}", "addProduct() {\n var action = {\n type: 'ADD_PRODUCT'\n };\n this.props.dispatch(action);\n }", "function mapDispatchToProps(dispatch) {\n console.log('App.js mapDispatchToProps: mapping Redux actions <-> React component props');\n return {\n increaseCount: function() {\n return dispatch(increaseAction);\n },\n decreaseCount: function() {\n return dispatch(decreaseAction);\n }\n };\n}", "function mapDispatchToProps(dispatch){\n return bindActionCreators(\n //whenever select book is called the result should be passed to\n //all reduxers\n {selectBook: selectBook}, dispatch\n );\n}", "function mapDispatchToProps(dispatch) {\n return bindActionCreators(actions, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return {\n //onIncreaseClick: () => dispatch(increaseAction)\n }\n}", "function mapDispatchToProps(dispatch) {\n return { actions: bindActionCreators(actions, dispatch) };\n}", "function mapDispatchToProps(dispatch) {\n return { actions: bindActionCreators(actions, dispatch) };\n}", "function mapDispatchToProps(dispatch){\n return {\n onIncreaseClick: () => dispatch(increaseAction())\n }\n}", "function mapDispatchToProps(dispatch) {\n return bindActionCreators(actions, dispatch);\n}", "action(params) {\n this.beforeAction();\n this.setParams(params);\n Dispatcher.action(this, params);\n }", "function matchDispatchToProps(dispatch) { // dispatch => call a function\n return bindActionCreators({\n // you can register all your actions here\n selectUser: selectUser\n }, dispatch)\n}", "componentDidMount() {\n actions.get(this.props.visible)(\n this.props.title,\n this.props.message,\n this.props.buttons,\n );\n }", "function mapDispatchToProps(dispatch) {\n//Whenever selectBook is called, the result should be passed to all of our reducers.\n return {\n actions: bindActionCreators(actions, dispatch)\n };\n}", "function mapDispatchToProps(dispatch){\n return {\n onIncreaseClick: () => dispatch(increaseAction)\n }\n}", "function mapDispatchToProps(dispatch) {\n return {\n actions: bindActionCreators({\n }, dispatch)\n };\n}", "function mapDispatchToProps(dispatch) { \n \nreturn bindActionCreators(actionCreators, dispatch);\n}", "function mapDispatchToProps(dispatch){\n\treturn bindActionCreators(ActionCreators, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return {\n actions: bindActionCreators(actions, dispatch)\n };\n}", "function mapDispatchToProps(dispatch) {\n\nreturn bindActionCreators(actionCreators, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return {\n // onIncreaseClick: () => dispatch(increaseAction)\n onIncreaseClick: function() { dispatch(increaseAction) },\n addItem: function(inputt) { return dispatch(increaseAction2(inputt)) },\n\n ChangeDos: function(){ dispatch(dosAction) },\n\n addTodo: function(add){ return dispatch(addTodo(add))},\n deleteSong: function(indexID){ return dispatch(deleteSong(indexID))}\n\n }\n}", "function mapDispatchToProps(dispatch) {\n return bindActionCreators(ACTIONS, dispatch);\n}", "function mapDispatchToProps(dispatch){\n return{\n actions: bindActionCreators(courseActions, dispatch)\n };\n}", "function mapDispatchToProps(dispatch) {\n //whenever actions are called, the result should be passed to all reducers\n return bindActionCreators({\n selectEntry: selectEntry,\n fetchEntry: fetchEntry,\n fetchMedia: fetchMedia,\n }, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return {\n actions: bindActionCreators(actions, dispatch)\n }\n}", "function mapDispatchToProps(dispatch) {\n //whenever selectBook is called, the result should be passed to all reducers\n return bindActionCreators({\n selectBook: selectBook //this.props.selectBook is now available as an action creator\n }, dispatch) //dispatch => is the function that we want the action to flow through\n} //dispatch takes all the actions and makes sure they get passed to reducers", "function mapDispatchToProps(dispatch) {\n return {\n onIncreaseClick: () => dispatch(increaseAction)\n }\n}", "function mapDispatchToProps(dispatch) {\n // when selectBook is called, result is passed to all reducers\n return bindActionCreators({\n selectBook: selectBook\n }, dispatch);// dispatch is the funnel that sends the result to everyone\n}", "function mapDispatchToProps(dispatch) {\n return bindActionCreators({},dispatch)\n}", "function matchDispatchToProps(dispatch){\n return bindActionCreators({\n }, dispatch);\n}", "function mapDispatchToProps(dispatch){\n //whenever selectBook is called the result should be passed to all of our reducers.\n return bindActionCreators({selectBook: selectBook}, dispatch);\n //now inside our container we can call this.props.selectBook specifically becoz of the property here.\n}", "function mapDispatchToProps(dispatch) {\n // whenever selectbook is called, the result should be passed to all the reducers\n return bindActionCreators( actions, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return bindActionCreators({\n ...PatientsAction,\n }, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return bindActionCreators({redirect: redirect, userSignin: userSignin, setMsg: setMsg}, dispatch);\n}", "function mapDispatchToProps(dispatch){\r\n return bindActionCreators({deleteSelectedTracks, changeTrack, play, selectInTracklist}, dispatch)\r\n}", "function mapDispatchToProps(dispatch){\n return bindActionCreators(actionCreators, dispatch)\n}", "function mapDispatchToProps(dispatch) {\r\n //Whenever selectBook is called the result has to be passed\r\n //to all the reducers\r\n return bindActionCreators({ selectBook : selectBook}, dispatch); \r\n}", "function mapActionsToProps(dispatch) {\n return {\n buy: function () {\n dispatch(buyAction);\n },\n sell: function () {\n dispatch(sellAction);\n },\n randomize: function () {\n dispatch(exchangeAction);\n }\n };\n}", "function mapDispatchToProps(dispatch){\r\n // Second selectbook is the actioncreator imported\r\n // First one is the key\r\n // Whenever selecBook is called the result should be passed\r\n // to all our reducers\r\n return bindActionCreators({selectBook: selectBook }, dispatch)\r\n}", "mapActionsToComponents() {\n return {\n recipeCardActions: {\n editRecipe: this.props.editRecipe,\n cancelEditingRecipe: this.props.cancelEditingRecipe,\n doneEditingRecipe: this.props.doneEditingRecipe,\n saveRecipe: this.props.saveRecipe,\n ingredientActions: {\n editIngredient: this.props.editIngredient,\n cancelEditingIngredient: this.props.cancelEditingIngredient,\n doneEditingIngredient: this.props.doneEditingIngredient,\n addIngredient: this.props.addIngredient,\n deleteIngredient: this.props.deleteIngredient,\n cancelDeletingIngredient: this.props.cancelDeletingIngredient\n },\n processActions: {\n editStep: this.props.editStep,\n cancelEditingStep: this.props.cancelEditingStep,\n doneEditingStep: this.props.doneEditingStep,\n addStep: this.props.addStep,\n deleteStep: this.props.deleteStep,\n cancelDeletingStep: this.props.cancelDeletingStep\n }\n }\n } \n }", "function mapDispatchToProps(dispatch) {\n return {\n onIncreaseClick: () => dispatch(increaseAction)\n }\n}", "function mapDispatchToProps(dispatch) {\n return {\n onIncreaseClick: () => dispatch(increaseAction)\n }\n}", "function mapDispatchToProps(dispatch) {\n return {\n onIncreaseClick: () => dispatch(increaseAction)\n }\n}", "function mapDispatchToProps(dispatch) {\n //whenever select is call, the result should be passed to all reducers\n return bindActionCreators(\n {\n closeAddParamModal,\n updateActiveConfig,\n selectAddParamFormControl,\n addParamFormControlSetValue,\n updateAddParamsListFilter\n },\n dispatch\n );\n}", "function mapDispatchToProps(dispatch) {\n return { actions: bindActionCreators(actionCreators, dispatch) };\n}", "function mapDispachToProps(dispatch) {\n return bindActionCreators(actionCreators, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return {\n Actions: bindActionCreators(ActionCreators, dispatch),\n };\n}", "function mapDispatchToProps(dispatch){\n return bindActionCreators({moviesList},dispatch)\n}", "function mapDispatchToProps(dispatch, ownProps) {\n return {\n close: () =>{ dispatch({\n type: 'close',\n payload: {\n choice: 1\n }\n }),\n // console.log(ownProps)\n dispatch({\n type: 'TableData2projectData',\n payload: ownProps\n })\n },\n \n \n }\n}", "function mapDispatchToProps ( dispatch ){\n //whenever selectBook is called, the result should be passed to all reducers\n //key: importet action creator //pass dispacth, after obejct as 2nd arg\n return bindActionCreators({ selectBook: selectBook }, dispatch)\n}", "function mapDispatchToProps(dispatch){\n return{\n roomActions:bindActionCreators(roomActions,dispatch)\n }\n}", "handleAction(rec) {\r\n this.props.handleToDoActions(rec, this.props.record);\r\n }", "function mapDispatchToProps(dispatch) {\n return {\n actions: bindActionCreators(actionsMap, dispatch),\n };\n}", "function mapDispatchToProps(dispatch){\n return bindActionCreators({getHotel, getAllHotels, getBooking},dispatch);\n}", "dispatch(action) {\n this.store.dispatch(action);\n }", "function mapDispatchToProps(dispatch) { //dispatch allows the action executed to be DISPATCHED to all the reducers\n return bindActionCreators ({ selectBook: selectBook}, dispatch); //whenever selectBook is called (upon selection), the action associated here is called\n}", "function mapDispatchToProps(dispatch, ownProps) {\n //\n return {};\n}", "function mapDispatchToProps(dispatch){\n return {\n changeStatus: (id)=>{dispatch(actions.changeStatus(id))}\n }\n}", "function mapActionCreatorsToProps (dispatch) {\n return bindActionCreators(userActions, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return bindActionCreators(ActionCreators, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return bindActionCreators(ActionCreators, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return bindActionCreators(ActionCreators, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return bindActionCreators({\n // TODO: add actions\n }, dispatch);\n}", "function mapDispatchToProps(dispatch)\n {\n return {\n readUpdate: () => dispatch(readUpdate()),\n successUpdate: (id) => dispatch(failureUpdate(id)),\n failureUpdate: (payload) => dispatch(successUpdate(payload)) \n };\n }", "function mapDispatchToProps(dispatch) {\n return {\n //bindActionCreators goes to productActionCreators and find all the actions and wrap them and call the dispatch\n actions: bindActionCreators(productActionCreators, dispatch)\n };\n}", "function mapDispatchToProps(dispatch) {\n \n //whenever selectBook is called, result be passed to all reducers\n //dispatch receives all these actions and distributes to reducers\n\n return bindActionCreators({ selectBook: selectBook}, dispatch)\n}", "function mapDispatchToProps(dispatch) {\n return bindActionCreators({\n getWantedList: getWantedList,\n addPerson: addPerson,\n clearToast: clearToast\n }, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return {\n fetchProjects () {\n\t\t//console.log('the store', store)\n\t\tdispatch({ type: 'AUTH_USER', payload: JSON.parse(localStorage.getItem('user'))})\n },\n Projects(results){\n \tdispatch({ type: 'FETCH_HOME_PROJECTS', payload: results })\n\t\t},\n\t\taddVote(obj){\n\t\t\tconsole.log('THE PROPS FUNC', obj)\n\t\t\tdispatch({ type: 'ADD_VOTE', payload: obj})\n\t\t},\n\t\tdeleteVote(obj){\n\t\t\tdispatch({ type: 'DELETE_VOTE', payload: obj})\n\t\t}\n }\n}", "function mapDispatchToProps(dispatch) {\n return {\n actions: bindActionCreators(studentActions, dispatch)\n };\n}", "handleActions(action){\n switch(action.type){\n case 'ADD_NODE':\n this.addNode(action.data)\n break\n case 'ADD_LINK':\n this.addLink(action.data)\n break\n case 'UPDATE_WEIGHTS':\n this.updateWeights()\n break\n case 'SET_PATH_STATS':\n this.setPathStats(action.newPathStats)\n break\n case 'RESET_PATH_STATS':\n this.resetPathStats()\n break\n case 'ADD_COLORS':\n this.addColors(action.hotLinks)\n break\n case 'ADD_NODE_LOCATION':\n this.addNodeLocation(action.data)\n break\n case 'CLEAR_STATE':\n this.clearState()\n break\n }\n }", "function mapDispatchToProps(dispatch) {\r\n//the purpose of bindActionCreators is to take the action return value and flow it to all reducers\r\n// Whenever selectBook is called, the result would be passed to all of our reducers\r\n// { <props key> : <action creator value>, <function dispatch > }\r\n// the dispatch function receives the action return value and gives it to all the reducers\r\n return bindActionCreators({ selectBook: selectBook }, dispatch);\r\n}", "function mapDispatchToProps (dispatch) {\n return bindActionCreators({ removeMonster, generateTurnOrder, selectMonster, selectTab }, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return bindActionCreators(ActionCreators, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return bindActionCreators(ActionCreators, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return bindActionCreators(ActionCreators, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n return bindActionCreators(ActionCreators, dispatch);\n}", "function mapDispatchToProps(dispatch){\n\t// bindActionCreators takes 2 args.\n\t// \t1. object: property of local prp name (this.props.whatever)\n\t// \t\tvalue: the callback or ACTION \n\t// \t2. dispatcher\n\n\treturn bindActionCreators({\n\t\tupdateHome: UpdateHome\n\t}, dispatch)\n\n\n}", "function mapDispatchToProps(dispatch){\n //whenever selectBodyPart is called, the result should be passed to all of our reducers\n return bindActionCreators({selectPain: selectPain, selectSeverity: selectSeverity}, dispatch); //takes all actions and sends them to all reducers\n //this.props.selectBodyPart will call our action creator\n //selectBodyPart is a plain function that returns an object. The purpose of binding is to take selectBodyPart and give it to the reducers\n}", "function dispatch (action) {\n var entries = app.store.state.entries.concat(action)\n app.store.setState({entries: entries})\n}", "function mapDispatchToProps(dispatch){\n return {\n //createCourse : (course) => dispatch(courseActions.createCourse(course))\n actions : bindActionCreators(courseActions,dispatch)\n }\n}", "function matchDispatchToProps(dispatch) {\n\treturn bindActionCreators({save, getInfo}, dispatch);\n}", "function mapDispatchToProps(dispatch) {\n\treturn {\n\t\tactions: bindActionCreators(actions, dispatch),\n\t\tdispatch\n\t};\n}", "function mapDispatchToProps(dispatch) {\r\n return bindActionCreators( {fetchGif, SearchTerm}, dispatch );\r\n}", "handleViewAction(action: Action): void {\n this.dispatch({\n source: constants.VIEW_ACTION,\n action: action\n });\n }", "function mapDispatchToProps(dispatch) {\r\n\r\n return {\r\n actions: bindActionCreators(documentAction, dispatch),\r\n oppActions: bindActionCreators(opportunityAction, dispatch),\r\n actActions: bindActionCreators(activityAction, dispatch)\r\n };\r\n}", "function mapDispatchToProps(dispatch) {\n return {\n actions: bindActionCreators(Actions, dispatch)\n }\n}", "function mapDispatchToProps(dispatch) {\n // Whenever selectBook action is called,the result should be\n // past to all our reducers\n return bindActionCreators({selectBook: selectBook}, dispatch);\n}" ]
[ "0.71711874", "0.716163", "0.7112648", "0.68945664", "0.67625546", "0.6756405", "0.67439777", "0.6671289", "0.6629192", "0.6615264", "0.6607731", "0.6559039", "0.6556852", "0.6528068", "0.6523479", "0.6521232", "0.65202993", "0.65202993", "0.6517265", "0.6491125", "0.6486365", "0.6485446", "0.6479315", "0.6460684", "0.64548755", "0.64447355", "0.6443876", "0.64431345", "0.6435137", "0.6433853", "0.64109534", "0.6399099", "0.63934654", "0.6385835", "0.63769025", "0.6373658", "0.6366765", "0.6365979", "0.63565075", "0.6352271", "0.6351315", "0.63481855", "0.63466257", "0.6335486", "0.63343775", "0.6318098", "0.6315632", "0.6313796", "0.6309078", "0.6297258", "0.6293441", "0.6293441", "0.6293441", "0.62931055", "0.62918997", "0.62861156", "0.6281274", "0.6278471", "0.62777233", "0.6276846", "0.6265574", "0.62604517", "0.6257075", "0.6253506", "0.6245907", "0.6245077", "0.62427807", "0.62336147", "0.62280476", "0.62242556", "0.62242556", "0.62242556", "0.6222536", "0.62173915", "0.62173855", "0.620706", "0.6199772", "0.61993706", "0.61954147", "0.6191659", "0.61861736", "0.61860424", "0.6179655", "0.6179655", "0.6179655", "0.6179655", "0.6179647", "0.6174109", "0.6169984", "0.61692923", "0.6167345", "0.6166697", "0.6163867", "0.61632574", "0.6162283", "0.6162035", "0.6159272" ]
0.62863857
57
ignore above this line
function main() { var n = parseInt(readLine()); arr = readLine().split(' '); arr = arr.map(Number); var posCounter = 0; var negCounter = 0; var zerCounter = 0; for (var i = 0; i < n; i++) { if (arr[i] === 0) { zerCounter++; } else if (arr[i] < 0) { negCounter++; } else { posCounter++; } } console.log((posCounter / n).toFixed(6)); console.log((negCounter / n).toFixed(6)); console.log((zerCounter / n).toFixed(6)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ignore() { }", "function IGNORE() {\r\n //Do not delete.\r\n }", "doNotDisplayLineText() {\r\n this._ignoredLine = true;\r\n }", "function ignore() {\n return null\n }", "function remove_ignore_lines_DocGenerator() {\n\t//----Debugging------------------------------------------\n\t// The following alert-Command is useful for debugging \n\t//alert(\"docgenerator.js:remove_ignore_lines()-Call\")\n\t//----Create Object/Instance of DocGenerator----\n\t// var vMyInstance = new DocGenerator();\n\t// vMyInstance.remove_ignore_lines();\n\t//-------------------------------------------------------\n\t\n\t//>>>> INSERT YOUR CODE HERE <<<<<\n\n \t\n\n}", "voidLine() {\r\n\t\treturn null\r\n\t}", "function ignore() {\n return null\n}", "function ignore() {\n return null;\n}", "get Ignore() {}", "set Ignore(value) {}", "preorder() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "function checkPreviousLine() {\n if (/^\\s*[\\/\\/]/gi.test(previousLine)) {\n stdout.splice(-1);\n }\n}", "function skip(){\n\t\n}", "protected internal function m252() {}", "unvoidLine() {\r\n\t\treturn null\r\n\t}", "if (matches = line.match(\"/^(~|`){3,}([^`~]*)$/i\")) {\n if (this.isBlock('code')) {\n this.setBlock(key)\n .endBlock()\n } else {\n this.startBlock('code', key, matches[2])\n }\n\n continue\n }", "function skipCommentLine(state) {\n while (state.position < state.length) {\n var c = state.data.charCodeAt(state.position);\n if (c === 10 || c === 13) {\n return;\n }\n ++state.position;\n }\n }", "function skipHello(){saidHello=true;}", "function appendLine (line) {\n\tline.ishidden = false;\n\tswitch (line.exclude) {\n\t\tcase 'rule':\n\t\t\tappendProblemLineExcludingRule(line);\n\t\t\tbreak;\n\t\tcase 'premises':\n\t\t\tappendProblemLineExcludingPremise(line);\n\t\t\tbreak;\n\t\tcase 'both':\n\t\t\tappendProblemLineExcludingBoth(line);\n\t\t\tbreak;\n\t\tcase 'allbutderived':\n\t\t\tappendProblemLineExcludingBoth(line);\n\t\t\tbreak;\n\t}\n}", "function hello2() {\n const bye = \"bye\";\n\n /**\n * For disable the es-lint on the line\n * Please put the below comment\n * now instead of the error we will have the warning for below 2\n */\n // eslint-disable-next-line\n console.log(\"this is sample \", bye);\n\n /**\n * disabling a particular rule for the eslint\n */\n // eslint-disable-next-line quotes\n console.log(\"this is sample \", 2323232);\n\n const a = 95;\n\n console.log(`vaylue for the a the `, a);\n}", "function skipMarker(state, line) {\n\t var pos, marker,\n\t start = state.bMarks[line] + state.tShift[line],\n\t max = state.eMarks[line];\n\n\t if (start >= max) { return -1; }\n\n\t // Check bullet\n\t marker = state.src.charCodeAt(start++);\n\t if (marker !== 0x7E/* ~ */ && marker !== 0x3A/* : */) { return -1; }\n\n\t pos = state.skipSpaces(start);\n\n\t // require space after \":\"\n\t if (start === pos) { return -1; }\n\n\t // no empty definitions, e.g. \" : \"\n\t if (pos >= max) { return -1; }\n\n\t return pos;\n\t}", "function skipMarker(state, line) {\n\t var pos, marker,\n\t start = state.bMarks[line] + state.tShift[line],\n\t max = state.eMarks[line];\n\n\t if (start >= max) { return -1; }\n\n\t // Check bullet\n\t marker = state.src.charCodeAt(start++);\n\t if (marker !== 0x7E/* ~ */ && marker !== 0x3A/* : */) { return -1; }\n\n\t pos = state.skipSpaces(start);\n\n\t // require space after \":\"\n\t if (start === pos) { return -1; }\n\n\t // no empty definitions, e.g. \" : \"\n\t if (pos >= max) { return -1; }\n\n\t return pos;\n\t}", "function skipMarker(state, line) {\n\t var pos, marker,\n\t start = state.bMarks[line] + state.tShift[line],\n\t max = state.eMarks[line];\n\n\t if (start >= max) { return -1; }\n\n\t // Check bullet\n\t marker = state.src.charCodeAt(start++);\n\t if (marker !== 0x7E/* ~ */ && marker !== 0x3A/* : */) { return -1; }\n\n\t pos = state.skipSpaces(start);\n\n\t // require space after \":\"\n\t if (start === pos) { return -1; }\n\n\t // no empty definitions, e.g. \" : \"\n\t if (pos >= max) { return -1; }\n\n\t return pos;\n\t}", "function skipMarker(state, line) {\n var pos, marker,\n start = state.bMarks[line] + state.tShift[line],\n max = state.eMarks[line];\n\n if (start >= max) { return -1; }\n\n // Check bullet\n marker = state.src.charCodeAt(start++);\n if (marker !== 0x7E/* ~ */ && marker !== 0x3A/* : */) { return -1; }\n\n pos = state.skipSpaces(start);\n\n // require space after \":\"\n if (start === pos) { return -1; }\n\n // no empty definitions, e.g. \" : \"\n if (pos >= max) { return -1; }\n\n return pos;\n}", "function skipMarker(state, line) {\n var pos, marker,\n start = state.bMarks[line] + state.tShift[line],\n max = state.eMarks[line];\n\n if (start >= max) { return -1; }\n\n // Check bullet\n marker = state.src.charCodeAt(start++);\n if (marker !== 0x7E/* ~ */ && marker !== 0x3A/* : */) { return -1; }\n\n pos = state.skipSpaces(start);\n\n // require space after \":\"\n if (start === pos) { return -1; }\n\n // no empty definitions, e.g. \" : \"\n if (pos >= max) { return -1; }\n\n return pos;\n}", "function skipMarker(state, line) {\n var pos, marker,\n start = state.bMarks[line] + state.tShift[line],\n max = state.eMarks[line];\n\n if (start >= max) { return -1; }\n\n // Check bullet\n marker = state.src.charCodeAt(start++);\n if (marker !== 0x7E/* ~ */ && marker !== 0x3A/* : */) { return -1; }\n\n pos = state.skipSpaces(start);\n\n // require space after \":\"\n if (start === pos) { return -1; }\n\n // no empty definitions, e.g. \" : \"\n if (pos >= max) { return -1; }\n\n return pos;\n }", "function isUsefulLine(aLine) {\n return !(/^\\s*($|#)/i.test(aLine));\n}", "function skipMarker(state, line) {\n var pos, marker,\n start = state.bMarks[line] + state.tShift[line],\n max = state.eMarks[line];\n\n if (start >= max) { return -1; }\n\n // Check bullet\n marker = state.src.charCodeAt(start++);\n if (marker !== 0x7E/* ~ */ && marker !== 0x3A/* : */) { return -1; }\n\n pos = state.skipSpaces(start);\n\n // require space after \":\"\n if (start === pos) { return -1; }\n\n // no empty definitions, e.g. \" : \"\n if (pos >= max) { return -1; }\n\n return start;\n }", "function skipMarker(state, line) {\n var pos, marker,\n start = state.bMarks[line] + state.tShift[line],\n max = state.eMarks[line];\n\n if (start >= max) { return -1; }\n\n // Check bullet\n marker = state.src.charCodeAt(start++);\n if (marker !== 0x7E/* ~ */ && marker !== 0x3A/* : */) { return -1; }\n\n pos = state.skipSpaces(start);\n\n // require space after \":\"\n if (start === pos) { return -1; }\n\n // no empty definitions, e.g. \" : \"\n if (pos >= max) { return -1; }\n\n return start;\n }", "function skipMarker(state, line) {\n var pos, marker,\n start = state.bMarks[line] + state.tShift[line],\n max = state.eMarks[line];\n\n if (start >= max) { return -1; }\n\n // Check bullet\n marker = state.src.charCodeAt(start++);\n if (marker !== 0x7E/* ~ */ && marker !== 0x3A/* : */) { return -1; }\n\n pos = state.skipSpaces(start);\n\n // require space after \":\"\n if (start === pos) { return -1; }\n\n // no empty definitions, e.g. \" : \"\n if (pos >= max) { return -1; }\n\n return start;\n }", "function skipMarker(state, line) {\n var pos, marker,\n start = state.bMarks[line] + state.tShift[line],\n max = state.eMarks[line];\n\n if (start >= max) { return -1; }\n\n // Check bullet\n marker = state.src.charCodeAt(start++);\n if (marker !== 0x7E/* ~ */ && marker !== 0x3A/* : */) { return -1; }\n\n pos = state.skipSpaces(start);\n\n // require space after \":\"\n if (start === pos) { return -1; }\n\n // no empty definitions, e.g. \" : \"\n if (pos >= max) { return -1; }\n\n return start;\n }", "_shouldDisplayLine(line) {\r\n return line.length > 0 && !this._ignoredLine;\r\n }", "hacky(){\n return\n }", "function skip() {\n return null;\n }", "before (callback) {\n\t\t// for the stream we want to create on-the-fly, substitute a bogus ID for the repo\n\t\tsuper.before(error => {\n\t\t\tif (error) { return callback(error); }\n\t\t\tconst marker = this.data.codemark.markers[0];\n\t\t\tdelete marker.remotes;\n\t\t\tmarker.repoId = 'x';\n\t\t\tcallback();\n\t\t});\n\t}", "suppressNewlines() {\r\n\t\t\t\tvar prev;\r\n\t\t\t\tprev = this.prev();\r\n\t\t\t\tif (prev[1] === '\\\\') {\r\n\t\t\t\t\tif (prev.comments && this.tokens.length > 1) {\r\n\t\t\t\t\t\t// `@tokens.length` should be at least 2 (some code, then `\\`).\r\n\t\t\t\t\t\t// If something puts a `\\` after nothing, they deserve to lose any\r\n\t\t\t\t\t\t// comments that trail it.\r\n\t\t\t\t\t\tattachCommentsToNode(prev.comments, this.tokens[this.tokens.length - 2]);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.tokens.pop();\r\n\t\t\t\t}\r\n\t\t\t\treturn this;\r\n\t\t\t}", "transient private protected internal function m182() {}", "function __FIXME_SBean_assert_ignore_list() {\n\tthis._pname_ = \"assert_ignore_list\";\n\t//this.keywords:\t\tset[string]\t\n}", "private internal function m248() {}", "function onIgnoreTagStripAll(){return\"\";}", "function skipComment () {\n i += 2;\n while (i < jsString.length && (curr() !== '\\n')) {\n i++;\n }\n }", "constructor() {\n super()\n log.info(\"Fixing CSV incorrect new lines\")\n }", "function Skip() { return Skip }", "function anyIndention() {\n return skipSatisfyMany(satisyTab);\n }", "dontWantToken () {\n\t\treturn true;\n\t}", "function h(){if(!h.called){h.called=!0;var e=document.querySelectorAll(\"pre code\");x.forEach.call(e,p)}}", "function SkipSelfDecorator() { }", "function SkipSelfDecorator() { }", "function reserved(){}", "function ignoreDiagnostics(node) {\n ts.addSyntheticTrailingComment(node, ts.SyntaxKind.MultiLineCommentTrivia, IGNORE_MARKER, /* hasTrailingNewLine */ false);\n }", "function notInlineUseCase() { console.log('Not an inline use case');}", "beforeHandling() {}", "function SkipSelfDecorator() {}", "function SkipSelfDecorator() {}", "function SkipSelfDecorator() {}", "function onEmphasis(){labelLine.ignore = labelLine.hoverIgnore;text.ignore = text.hoverIgnore;}", "function ignore(self, __trace) {\n return fold_(self, _index12.constVoid, _index12.constVoid, __trace);\n}", "function removeUnnecessaryData(line, next) {\n const newData = line.replace(/^\\w+\\s?/, '');\n\n next(null, newData ? newData : undefined);\n}", "preset () { return false }", "async 'after sunbath' () {\n console.log( 'see? I appear here because of the first custom above' )\n }", "function notBlockUseCaseMultilineBlock() { console.log('Not an block use case - Block - Multine');}", "skip(opSt) { return false; }", "fixBlankLines(){\n\t\tconst settingName = \"language-roff.blankLineReplacement\";\n\t\tconst replacement = atom.config.get(settingName) || \".\";\n\t\t\n\t\tthis.replace(/^[ \\t]*$/gm, match => {\n\t\t\tconst {range, replace} = match;\n\t\t\tconst {scopes} = ed.scopeDescriptorForBufferPosition(range.start);\n\t\t\tif(-1 === scopes.indexOf(\"comment.block.ignored-input.roff\")\n\t\t\t&& -1 === scopes.indexOf(\"meta.function.definition.request.de.roff\")\n\t\t\t&& -1 === scopes.indexOf(\"meta.function.definition.request.am.roff\")\n\t\t\t&& -1 === scopes.indexOf(\"string.unquoted.roff\"))\n\t\t\t\treplace(replacement);\n\t\t});\n\t}", "function customHandling() { }", "function skipCommentAndContinue() {\n nextComment(null, dumpComment);\n}", "function skipBlockComment () {\n i += 2;\n while (i < jsString.length && (curr() !== '*' || next() !== '/')) {\n i++;\n }\n i += 2;\n }", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function skip() {\n\t this.shouldSkip = true;\n\t}", "function skip() {\n\t this.shouldSkip = true;\n\t}", "function skip_comment() {\n read_while(function(char) { return char !== \"\\n\" });\n // Skip over newline character\n input.next();\n }", "function de(e){for(var t;t=se(e);)e=t.find(-1,!0).line;return e}", "ignoreFallback(dom) {\n if (dom.nodeName == \"BR\" && (!this.top.type || !this.top.type.inlineContent))\n this.findPlace(this.parser.schema.text(\"-\"));\n }", "function OBSOLETE(what,hint) {\r\n Ezer.fce.echo(\"WARNING - \\\"\",what,\"\\\" is OBSOLETE\",(hint ? ` - use \\\"${hint}\\\" instead` : ''));\r\n}", "function commentCleanup() {\n\t\t\n }", "function insertTsIgnoreBeforeStatement(statement) {\n typescript_1.default.setSyntheticLeadingComments(statement, [\n {\n text: \" @ts-ignore\",\n kind: typescript_1.default.SyntaxKind.SingleLineCommentTrivia,\n pos: -1,\n end: -1,\n },\n ]);\n return statement;\n}", "static tag_lines(raw)\r\n {\r\n let lines = [];\r\n let next_is_def = false;\r\n let in_code_block = false;\r\n let in_quote_block = false;\r\n for (const [index, value] of raw.entries())\r\n {\r\n let trimmed = value.trim();\r\n if (in_code_block)\r\n {\r\n lines.push(new Line(value, 'code'))\r\n }\r\n else if (in_quote_block)\r\n {\r\n lines.push(new Line(value, 'quote'))\r\n }\r\n else if (trimmed.length === 0)\r\n {\r\n lines.push(new Line('', 'empty'));\r\n }\r\n // Titles :\r\n else if (trimmed[0] === '#')\r\n {\r\n lines.push(new Line(trimmed, 'title'));\r\n }\r\n // HR :\r\n else if ((trimmed.match(/-/g)||[]).length === trimmed.length)\r\n {\r\n lines.push(new Line('', 'separator'));\r\n }\r\n // Lists, line with the first non empty character is \"* \" or \"+ \" or \"- \" :\r\n else if (trimmed.substring(0, 2) === '* ')\r\n {\r\n lines.push(new Line(value, 'unordered_list'));\r\n }\r\n else if (trimmed.substring(0, 2) === '+ ')\r\n {\r\n lines.push(new Line(value, 'ordered_list'));\r\n }\r\n else if (trimmed.substring(0, 2) === '- ')\r\n {\r\n lines.push(new Line(value, 'reverse_list'));\r\n }\r\n // Keywords, line with the first non empty character is \"!\" :\r\n // var, const, include, require, css, html, comment\r\n else if (trimmed.startsWith('!var '))\r\n {\r\n lines.push(new Line(trimmed, 'var'));\r\n }\r\n else if (trimmed.startsWith('!const '))\r\n {\r\n lines.push(new Line(trimmed, 'const'));\r\n }\r\n else if (trimmed.startsWith('!include '))\r\n {\r\n lines.push(new Line(trimmed, 'include'));\r\n }\r\n else if (trimmed.startsWith('!require '))\r\n {\r\n lines.push(new Line(trimmed, 'require'));\r\n }\r\n else if (trimmed.startsWith('!css '))\r\n {\r\n lines.push(new Line(trimmed, 'css'));\r\n }\r\n else if (trimmed.startsWith('!html'))\r\n {\r\n lines.push(new Line(trimmed, 'html'));\r\n }\r\n else if (trimmed.substring(0, 2) === '//')\r\n {\r\n lines.push(new Line(trimmed, 'comment'));\r\n }\r\n // Block of code\r\n else if (trimmed.substring(0, 2) === '@@@')\r\n {\r\n in_code_block = !in_code_block;\r\n lines.push(new Line(value, 'code'))\r\n }\r\n else if (trimmed.substring(0, 2) === '@@' && trimmed.substring(trimmed.length-2, trimmed.length) !== '@@') // :TODO: Escaping @@ in code for Ruby. @@code@@ should be a <p> not a <pre>!\r\n {\r\n lines.push(new Line(value, 'code'));\r\n }\r\n // Block of quote\r\n else if (trimmed.substring(0, 2) === '>>>')\r\n {\r\n in_quote_block = !in_quote_block;\r\n lines.push(new Line(value, 'quote'))\r\n }\r\n else if (trimmed.substring(0, 2) === '>>')\r\n {\r\n lines.push(new Line(value, 'quote'));\r\n }\r\n // Labels\r\n else if (trimmed.substring(0, 2) === '::')\r\n {\r\n lines.push(new Line(trimmed, 'label'));\r\n }\r\n // Div (Si la ligne entière est {{ }}, c'est une div. On ne fait pas de span d'une ligne)\r\n else if (trimmed.substring(0, 2) === '{{' && trimmed.substring(trimmed.length - 2) === '}}')\r\n {\r\n lines.push(new Line(trimmed, 'div'));\r\n }\r\n // Tables\r\n else if (trimmed[0] === '|' && trimmed[trimmed.length - 1] === '|')\r\n {\r\n lines.push(new Line(trimmed, 'row'));\r\n }\r\n // Definition lists\r\n else if (trimmed.substring(0, 2) === '$ ')\r\n {\r\n lines.push(new Line(trimmed.substring(2), 'definition-header'));\r\n next_is_def = true;\r\n }\r\n else\r\n {\r\n if (!next_is_def)\r\n {\r\n lines.push(new Line(trimmed, 'text'));\r\n }\r\n else\r\n {\r\n lines.push(new Line(trimmed, 'definition-content'));\r\n next_is_def = false;\r\n }\r\n }\r\n }\r\n return lines;\r\n }", "async before(ctx, args) {\n return true;\n }", "transient final private protected internal function m167() {}", "ignoreCall() {\r\n var callId = firstCallId; //getSelectedCall();\r\n kandy.ignoreCall(callId);\r\n }", "ignoreCall() {\r\n var callId = firstCallId; //getSelectedCall();\r\n kandy.ignoreCall(callId);\r\n }", "ignoreEvent(event) { return true; }", "inorder() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "function skipHello()\n\t{\n\t saidHello = true;\n\t}", "function platinumHandler () {\n return;\n}", "postorder() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "transient protected internal function m189() {}", "function checkSpanForClassLine(str) {\n\t\tif(str.search(/code-line/) == -1) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}", "execute (scriptLine){\r\n var commentPattern = /^\\s*;.*$/;\r\n if (commentPattern.test(scriptLine))\r\n {\r\n //nothing to do \r\n }\r\n }", "function aFunction(/* Dismiss args */) {/* End of line comment\n*/\n var a = \"THis is a string\";\n}", "function skipBrace() {\n\t\twhile (thisToken && thisToken != '}') {\n\t\t\tgetToken();\n\t\t\tif (!thisToken)\n\t\t\t\treturn;\n\t\t\texecut();\n\t\t}\n\t\tgetToken();\n\t\tif (thisToken != ';')\n\t\t\tpreviousToken();\n\t\tremoveNewLine();\n\t\tregisterCount = 1;\n\t}", "function isFenceLine (line) {\n if (line == null) return false\n return line.startsWith('```')\n}", "function skipHello()\n{\n saidHello = true;\n}", "function noop(){\n\t// Left intentionally blank. \n}", "scanline_invisible() {\n // Literally do nothing bro\n }", "function cleanUpLine(line) {\n\t\t line.parent = null;\n\t\t detachMarkedSpans(line);\n\t\t }" ]
[ "0.7002511", "0.6313994", "0.62586504", "0.61209166", "0.60574675", "0.6047923", "0.59494466", "0.5940073", "0.59276366", "0.59249926", "0.5907571", "0.59008515", "0.58524996", "0.5824406", "0.58213234", "0.58134085", "0.5805963", "0.5723673", "0.5688489", "0.56424433", "0.5620119", "0.5620119", "0.5620119", "0.5616652", "0.5616652", "0.5609236", "0.5591018", "0.5581648", "0.5581648", "0.5581648", "0.5581648", "0.5560684", "0.55416065", "0.55266804", "0.5493536", "0.5436953", "0.5412975", "0.5412393", "0.539606", "0.53842676", "0.53831965", "0.53714925", "0.53681207", "0.5362414", "0.53521794", "0.53365135", "0.5335682", "0.5335682", "0.532352", "0.53206795", "0.5312219", "0.528811", "0.5272659", "0.5272659", "0.5272659", "0.52672607", "0.52482164", "0.5241976", "0.52393115", "0.5236237", "0.5226571", "0.52261144", "0.5210785", "0.52037597", "0.52014637", "0.5187704", "0.51844656", "0.51844656", "0.51844656", "0.51844656", "0.51844656", "0.51844656", "0.51844656", "0.518112", "0.518112", "0.51690286", "0.51640975", "0.5157709", "0.5141318", "0.51412225", "0.51370496", "0.51326734", "0.5130511", "0.51288325", "0.51266414", "0.51266414", "0.5116168", "0.5115819", "0.5115355", "0.51149434", "0.5112175", "0.5109206", "0.510605", "0.51003265", "0.5099666", "0.5087814", "0.5080607", "0.50743496", "0.5072355", "0.50703543", "0.50675064" ]
0.0
-1
Log: var log = new Log(); log(0, "nuntia") log.trace("nuntia") => trace: nuntia 0: trace 1: debug 2: info 3: warning 4: error 5: fatal
function LLog(){ var level_name = { 0: "trace", 1: "debug", 2: "info", 3: "warning", 4: "error", 5: "fatal" }; this.log = function(level, o1, o2, o3, o4, o5){ console.log( level_name[level] + ": ", o1 ? o1 : "", o2 ? o2 : "", o3 ? o3 : "", o4 ? o4 : "", o5 ? o5 : "" ); }; this.log.trace = function(o1, o2, o3, o4, o5){this(0, o1, o2, o3, o4, o5)}; this.log.debug = function(o1, o2, o3, o4, o5){this(1, o1, o2, o3, o4, o5)}; this.log.info = function(o1, o2, o3, o4, o5){this(2, o1, o2, o3, o4, o5)}; this.log.warning = function(o1, o2, o3, o4, o5){this(3, o1, o2, o3, o4, o5)}; this.log.error = function(o1, o2, o3, o4, o5){this(4, o1, o2, o3, o4, o5)}; this.log.fatal = function(o1, o2, o3, o4, o5){this(5, o1, o2, o3, o4, o5)}; return this.log; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Log() {}", "Trace(...args) { this.do_log(\"TRACE\", args, true); }", "function _log() {\n // logger.trace.apply(logger, arguments)\n}", "log() {}", "function logSomething(log) { log.info('something'); }", "function trace(msg){\r\n rootLogger.trace(msg)\r\n}", "function hook_log(){\n var Log = Java.use(\"android.util.Log\")\n\n var logMethods = ['d', 'e', 'i', 'v', 'w']\n\n logMethods.forEach(function(method, i) {\n Log[method].overload('java.lang.String','java.lang.String').implementation = function(tag, msg) {\n send('Log: ' + tag + '|' + msg);\n var ret = this[method](tag, msg);\n return ret;\n }\n Log[method].overload('java.lang.String','java.lang.String','java.lang.Throwable').implementation = function(tag, msg, th) {\n send('Log: ' + tag + '|' + msg);\n var ret = this[method](tag, msg, th);\n return ret;\n } \n });\n}", "function algo(){\n console.log('Mensaje antes del Trace'); //Es como el rastreo\n console.trace();\n}", "log(_args) {\n\n }", "TraceOnly(...args) { this.do_log(\"TRACE\", args, false); }", "trace(...args) {\n return this.getInstance().trace(...args);\n }", "function log() {\n //log here\n }", "trace(...parameters)\n\t{\n\t\tif (this.options.debug)\n\t\t{\n\t\t\tconsole.log(colors.gray(this.preamble, '[trace]', generate_log_message(parameters)))\n\t\t}\n\t}", "function PrintLog(a)\n{\nlogger.info(a);\n}", "trace(message, type = 'log') {\n console[type](`[app] ${message}`);\n }", "function trace(msg)\n{\n console.log(\"builder:\" + msg)\n}", "log(...args) {\n return this.getInstance().log(...args);\n }", "log(kind, msg, data){ this.logger(kind, msg, data) }", "debug(...theArgs) { return this._log('DEBUG', {}, theArgs); }", "function log(data)\n{\n\tvar str = logComplexObj(data);\n\tfl.trace(str);\n}", "debug(...message) { this.log.debug(...message); }", "function LogOperator(){}", "function trace(msg)\n{\n\tfl.trace(msg);\n}", "function Log(node) {\n this.node = node;\n}", "function _____INTERNAL_log_functions_____(){}\t\t//{", "function classLog() {\n console.log('x' ,x);\n console.log('y' ,y);\n console.log('z' ,z);\n console.log('a' ,a);\n console.log('arg_a' ,arg_a);\n console.log('----');\n }", "function log(txt) {\n // commented out for production version\n // IJ.log(txt);\n}", "function log() {\n dump(Array.slice(arguments).join(' ') + '\\n');\n }", "function log (level, message) {\r\n\r\n}", "function log(a) {\n a();\n}", "function custom_log(string)\n{\n log(\"SKETCH2CODE | \" + string)\n}", "function msg() {\n if (!check.assigned(message.get('log'))) {\n console.log(arguments[0]);\n return;\n }\n message.get('log').put(arguments[0], arguments[1], __filename.split('/').pop(), arguments.callee.caller.name.toString());\n }", "function log() {\n\t\t//var args = [].slice.call(arguments);\n\t\t//send('LOG', args);\n\t}", "function log(a) {\n a();\n}", "function logger() {}", "function log()\n {\n if (my.logFunction == null)\n return\n\n var meta = ['name', 'QuickQWERTY']\n var data = Array.prototype.slice.call(arguments)\n my.logFunction.apply(this, meta.concat(data))\n }", "function mylog(msg){\n if (debug == \"1\"){\n console.log(msg)\n }\n}", "info(...theArgs) { return this._log('INFO', {}, theArgs); }", "function log(str) { Logger.log(str); }", "trace(method, requestUrl, body, responseBody, responseStatus) {\n this.log.trace(`${method} ${requestUrl.path} ${responseStatus}`);\n }", "function trace(x){\n console.log(x)\n\n return x\n}", "function log$2() {\n console.log('%s - %s', timestamp(), format.apply(null, arguments));\n}", "LogError() {}", "trace(...args) {\n if (this.isVerbose()) {\n console.warn(this.getColorOn() + args.join(\" \"));\n }\n }", "debug(log) {\n this.manageLogByLevelName(log, 'debug');\n }", "function _logS(i) { console.info(i); }", "function tlog__(msg){console.log(msg);}", "function log(txt){ console.log(txt); }", "log(...params) {\r\n console.log(this.getLogStamp(), ...params);\r\n }", "function logit(module,level,method,message) {\n\tconsole.log(module+\" \"+level+\" \"+method+\" \"+message);\n\tswitch(level) {\n\t\tcase 'info':\n\t\t\tmoduleLoggers[module]['am'].info(\"in method \"+method+\":\"+message);\n\t\t\tbreak;\n\t\tcase 'warn':\n\t\t\tmoduleLoggers[module]['am'].warn(\"in method \"+method+\":\"+message);\n\t\t\tbreak;\n\t\tcase 'error':\n\t\t\tmoduleLoggers[module]['am'].error(\"in method \"+method+\":\"+message);\n\t\t\tmoduleLoggers[module]['em'].error(\"in method \"+method+\":\"+message);\n\t\t\tbreak;\n\t\tcase 'fatal':\n\t\t\tmoduleLoggers[module]['am'].fatal(\"in method \"+method+\":\"+message);\n\t\t\tmoduleLoggers[module]['em'].fatal(\"in method \"+method+\":\"+message);\n\t\t\tbreak;\n\t}\n}", "function trace(txt) {\r\n\tif (DEBUG_MODE) { \r\n\t\tconsole.log(txt);\r\n\t}\r\n}", "function log(msg) {\r\n co(co_log(msg))\r\n}", "log (...args) {\n _.log(`[${fmt.time}] ${args}`)\n return this\n }", "static log() {\n var str;\n str = Util.toStrArgs('', arguments);\n Util.consoleLog(str);\n }", "function consoleTraceLog(message) {\r\n // console.log to keep\r\n console.log(message);\r\n}", "_log(param1, param2) {\n if (this.debug)\n console.log(this, ...arguments);\n }", "traceInfo(message, object) {\n if (this.traceLevel >= 1) {\n let stack = ` len(stack)=${this.stack.length} `;\n if (this.traceLevel >= 3) {\n stack = this.stack.map(n => n.v);\n }\n let registers = `(x:${this.x},y:${this.y})`;\n console.log(registers, stack, message, object);\n }\n }", "function Logger()\r\n {\r\n this.error = function (msg) { this.logit(\"error\", msg); };\r\n this.warn = function (msg) { this.logit(\"warn\", msg); };\r\n this.info = function (msg) { this.logit(\"info\", msg); };\r\n this.debug = function (msg) { this.logit(\"debug\", msg); };\r\n this.trace = function (msg) { this.logit(\"debug\", msg); }; // selenium doesn't have trace level\r\n\r\n this.logit = function (logLevel, msg) {\r\n LOG[logLevel](\"[\" + $$.name + \"] \" + msg); // call the Selenium logger\r\n };\r\n\r\n // ==================== Stack Tracer ====================\r\n\r\n this.genStackTrace = function(err)\r\n {\r\n var e = err || new Error();\r\n var stackTrace = [];\r\n if (!e.stack)\r\n stackTrace.push(\"No stack trace, (Firefox only)\");\r\n else {\r\n var funcCallPattern = /^\\s*[A-Za-z0-9\\-_\\$]+\\(/;\r\n var lines = e.stack.split(\"\\n\");\r\n for (var i=0; i < lines.length; i++) {\r\n if (lines[i].match(funcCallPattern))\r\n stackTrace.push(lines[i]);\r\n }\r\n if (!err)\r\n stackTrace.shift(); // remove the call to genStackTrace() itself\r\n }\r\n return stackTrace;\r\n };\r\n\r\n this.logStackTrace = function(err)\r\n {\r\n var t = this.genStackTrace(err);\r\n if (!err)\r\n t.shift(); // remove the call to logStackTrace() itself\r\n this.warn(\"__Stack Trace__\");\r\n for (var i = 0; i < t.length; i++) {\r\n this.warn(\"@@ \" + t[i]);\r\n }\r\n };\r\n\r\n // describe the calling function\r\n this.descCaller = function()\r\n {\r\n var t = this.genStackTrace(new Error());\r\n if (t.length == 0) return \"no client function\";\r\n t.shift(); // remove the call to descCaller() itself\r\n if (t.length == 0) return \"no caller function\";\r\n t.shift(); // remove the call to client function\r\n if (t.length == 0) return \"undefined caller function\";\r\n return \"caller: \" + t[0];\r\n };\r\n }", "function Logger()\r\n {\r\n this.error = function (msg) { this.logit(\"error\", msg); };\r\n this.warn = function (msg) { this.logit(\"warn\", msg); };\r\n this.info = function (msg) { this.logit(\"info\", msg); };\r\n this.debug = function (msg) { this.logit(\"debug\", msg); };\r\n this.trace = function (msg) { this.logit(\"debug\", msg); }; // selenium doesn't have trace level\r\n\r\n this.logit = function (logLevel, msg) {\r\n LOG[logLevel](\"[\" + $$.name + \"] \" + msg); // call the Selenium logger\r\n };\r\n\r\n // ==================== Stack Tracer ====================\r\n\r\n this.genStackTrace = function(err)\r\n {\r\n var e = err || new Error();\r\n var stackTrace = [];\r\n if (!e.stack)\r\n stackTrace.push(\"No stack trace, (Firefox only)\");\r\n else {\r\n var funcCallPattern = /^\\s*[A-Za-z0-9\\-_\\$]+\\(/;\r\n var lines = e.stack.split(\"\\n\");\r\n for (var i=0; i < lines.length; i++) {\r\n if (lines[i].match(funcCallPattern))\r\n stackTrace.push(lines[i]);\r\n }\r\n if (!err)\r\n stackTrace.shift(); // remove the call to genStackTrace() itself\r\n }\r\n return stackTrace;\r\n };\r\n\r\n this.logStackTrace = function(err)\r\n {\r\n var t = this.genStackTrace(err);\r\n if (!err)\r\n t.shift(); // remove the call to logStackTrace() itself\r\n this.warn(\"__Stack Trace__\");\r\n for (var i = 0; i < t.length; i++) {\r\n this.warn(\"@@ \" + t[i]);\r\n }\r\n };\r\n\r\n // describe the calling function\r\n this.descCaller = function()\r\n {\r\n var t = this.genStackTrace(new Error());\r\n if (t.length == 0) return \"no client function\";\r\n t.shift(); // remove the call to descCaller() itself\r\n if (t.length == 0) return \"no caller function\";\r\n t.shift(); // remove the call to client function\r\n if (t.length == 0) return \"undefined caller function\";\r\n return \"caller: \" + t[0];\r\n };\r\n }", "function PROFILERTRACE(msg) {\n if (gDebugTrace)\n PROFILERLOG(msg);\n}", "function logit(msg){\r\n if(lc_Prefs.debug){\r\n if(logit.caller.name){\r\n msg = logit.caller.name + \": \" + msg\r\n }\r\n GM_log(msg);\r\n // !if not GM_log write to console!\r\n }\r\n}", "function touchlog() {\n //log.apply(undefined, arguments);\n}", "_log() {\n if (this.debug) {\n console.log(...arguments);\n }\n }", "log() {\n if (this.debug) {\n console.log(...arguments)\n }\n }", "traceDebug(message, object) {\n if (this.traceLevel >= 2) {\n let stack = ` len(stack)=${this.stack.length} `;\n if (this.traceLevel >= 3) {\n stack = this.stack.map(n => n.v);\n }\n let registers = `(x:${this.x},y:${this.y})`;\n console.log(registers, stack, message, object);\n }\n }", "function log() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i - 0] = arguments[_i];\n }\n if (!args.length) {\n return;\n }\n var id = args[0] + '';\n var fn = logMap[id];\n if (fn) {\n fn.apply(void 0, args.slice(1));\n }\n else {\n console.log('log: ' + JSON.stringify(args));\n }\n}", "function logFunct(_function, _text, _type) {\n\n\tif (trace) {\n\t\tif (_type == INFO) {\n\t\t\tconsole.info(\"%c\" + _function + ': ' + _text, \"color:\" + _type);\n\t\t}\n\t\tif (_type == WARN) {\n\t\t\tconsole.warn(\"%c\" + _function + ': ' + _text, \"color:\" + _type);\n\t\t}\n\t\tif (_type == ERROR) {\n\t\t\tconsole.error(\"%c\" + _function + ': ' + _text, \"color:\" + _type);\n\t\t}\n\t}\n}", "function log() {\n\t console.log('%s - %s', timestamp(), format$1.apply(null, arguments));\n\t}", "function log() {\n\t console.log('%s - %s', timestamp(), format$1.apply(null, arguments));\n\t}", "function log() {\n\t console.log('%s - %s', timestamp(), format$1.apply(null, arguments));\n\t}", "function log() {\n if (!config.debug) return\n let ln = '??'\n try {\n const line = ((new Error).stack ?? '').split('\\n')[2]\n const parts = line.split(':')\n ln = parts[parts.length - 2]\n }\n catch { }\n log_print(ln, 'log', arguments)\n}", "trace(message) {\n return this.sendMessage(MessageType.Trace, message);\n }", "function l(pvScriptName,pvFunctionName,pvMessage,pvLevel){\n\n // This function can be passed a pre-formatted log string, usually passed back from the balu-parse-server.\n // In this case, just console.log it, without the preceeding or trailing carriage returns\n if(typeof pvFunctionName === 'undefined' &&\n typeof pvMessage === 'undefined' &&\n typeof pvLevel === 'undefined') {\n console.log(pvScriptName.substring(1,pvScriptName.length));\n return '\\n' + pvScriptName.substring(1,pvScriptName.length);\n }\n\n var lvMaxAppNameLength = 22;\n var lvPadding = ' '.substring(0,lvMaxAppNameLength - gvAppName.length + 1);\n var lvLogText = '';\n\n switch(pvLevel) {\n\n case 'ERROR':\n if (gvLogErrors) {\n lvLogText = gvAppName.substring(0,lvMaxAppNameLength) + lvPadding + '| ' + pvLevel + ': ' + pvScriptName + '.' + pvFunctionName + ': ' + pvMessage;\n console.log(lvLogText);\n lvLogText = '\\n' + lvLogText;\n }\n break;\n\n case 'PROCS':\n // Short for \"process\", these are the ubiquitous logs that\n // track (at the least) the start of every function, as well\n // as other key points\n // On by default\n if (gvLogProcs) {\n lvLogText = gvAppName.substring(0,lvMaxAppNameLength) + lvPadding + '| ' + pvLevel + ': ' + pvScriptName + '.' + pvFunctionName + ': ' + pvMessage;\n console.log(lvLogText);\n lvLogText = '\\n' + lvLogText;\n }\n break;\n\n case 'ROUTE':\n // Similar to PROCS, but for the web server routes\n // On by default\n if (gvLogRoutes) {\n lvLogText = gvAppName.substring(0,lvMaxAppNameLength) + lvPadding + '| ' + pvLevel + ': ' + pvScriptName + '.' + pvFunctionName + ': ' + pvMessage;\n console.log(lvLogText);\n lvLogText = '\\n' + lvLogText;\n }\n break;\n\n case ' INFO':\n // Additional to PROCS, these don't just track process, they\n // record information as well. Similar to DEBUG.\n // Off by default\n if (gvLogInfos){\n lvLogText = gvAppName.substring(0,lvMaxAppNameLength) + lvPadding + '| ' + pvLevel + ': ' + pvScriptName + '.' + pvFunctionName + ': ' + pvMessage;\n console.log(lvLogText);\n lvLogText = '\\n' + lvLogText;\n }\n break;\n\n case 'DEBUG':\n // Useful log points for debugging\n // Off by default\n if (gvLogDebugs){\n lvLogText = gvAppName.substring(0,lvMaxAppNameLength) + lvPadding + '| ' + pvLevel + ': ' + pvScriptName + '.' + pvFunctionName + ': ' + pvMessage;\n console.log(lvLogText);\n lvLogText = '\\n' + lvLogText;\n }\n break;\n\n case 'INITS':\n // Rather than putting PROCS in init functions (which always fire\n // and, once the app is working reliably, aren't particularly interesting)\n // Off by default\n if (gvLogInits){\n lvLogText = gvAppName.substring(0,lvMaxAppNameLength) + lvPadding + '| ' + pvLevel + ': ' + pvScriptName + '.' + pvFunctionName + ': ' + pvMessage;\n console.log(lvLogText);\n lvLogText = '\\n' + lvLogText;\n }\n break;\n\n case ' AJAX':\n if (gvLogAJAX){\n lvLogText = gvAppName.substring(0,lvMaxAppNameLength) + lvPadding + '| ' + pvLevel + ': ' + pvScriptName + '.' + pvFunctionName + ': ' + pvMessage;\n console.log(lvLogText);\n lvLogText = '\\n' + lvLogText;\n }\n break;\n\n case 'LSTNR':\n // Rather than putting PROCS in listeners (which can fire\n // continually in some scenarios), use LSTNR and keep them ...\n // Off by default\n if (gvLogLstnrs){\n lvLogText = gvAppName.substring(0,lvMaxAppNameLength) + lvPadding + '| ' + pvLevel + ': ' + pvScriptName + '.' + pvFunctionName + ': ' + pvMessage;\n console.log(lvLogText);\n lvLogText = '\\n' + lvLogText;\n }\n break;\n\n case ' TEMP':\n // What it says on the tin. These should not stay in the code for long\n // On by default\n if (gvLogTemps){\n lvLogText = gvAppName.substring(0,lvMaxAppNameLength) + lvPadding + '| ' + pvLevel + ': ' + pvScriptName + '.' + pvFunctionName + ': ' + pvMessage;\n console.log(lvLogText);\n lvLogText = '\\n' + lvLogText;\n }\n break;\n\n default:\n lvLogText = gvAppName.substring(0,lvMaxAppNameLength) + lvPadding + '| ' + 'UNKWN' + ': ' + pvScriptName + '.' + pvFunctionName + ': ' + pvMessage;\n console.log(lvLogText);\n lvLogText = '\\n' + lvLogText;\n }\n return lvLogText; // Set to '' if logging is off for the given level.\n}", "function log() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n}", "function debug(msg){\r\n rootLogger.debug(msg)\r\n}", "function log(apiMethod, apiUri, msg) {\r\n console.log(\"[\" + apiMethod + \"], [\" + apiUri + \"], [\" + msg + \"], [UTC:\" +\r\n new Date().toISOString().replace(/\\..+/, '') + \"]\");\r\n }", "getClientLog() {\n\n }", "function log() {\n\t console.log('%s - %s', timestamp(), format.apply(null, arguments));\n\t}", "function logger() {\r\n // if $log fn is called directly, default to \"info\" message\r\n logger.info.apply(logger, arguments);\r\n }", "function log(apiMethod, apiUri, msg) {\n console.log(\"[\" + apiMethod + \"], [\" + apiUri + \"], [\" + msg + \"], [UTC:\" +\n new Date().toISOString().replace(/\\..+/, '') + \"]\");\n }", "function log(apiMethod, apiUri, msg) {\n console.log(\"[\" + apiMethod + \"], [\" + apiUri + \"], [\" + msg + \"], [UTC:\" +\n new Date().toISOString().replace(/\\..+/, '') + \"]\");\n }", "function foo(){\n lib.log( \"hello world!\" );\n}", "function log( type, message ){\n\ttry {\n\t\tvar curTime = new Date();\n\t\tcurTime = curTime.toISOString();\n\n\t\tvar functionName = getFunctionName( arguments.callee.caller.toString() );\n\n\t\tlogFileWriteStream.write( \"[\" + type + \"] - [\" + __callerFileName + \" : \" + __line + \" | \" + functionName + \" - \" + curTime + \"] \" + message + \"\\n\" );\n\t\tconsole.log( \"[\" + type + \"] - [\" + __callerFileName + \" : \" + __line + \" | \" + functionName + \" - \" + curTime + \"] \" + message + \"\" );\n\t} catch( err ){\n\t\tconsole.log( \"\\x1b[31m%s\\x1b[0m\", \"[summer-mvc core]\", \"[logger.js]\", err );\n\t\tthrow err;\n\t}\n}", "function _log(text) {\r\n\tif (Config.debug) {\r\n\t\tGM_log((new Date().getTime() - Cache.startTime) + 'ms | ' + text);\r\n\t}\r\n}", "function log(name) {\n console.log(name);\n}", "function logtest(name) {\n log.info(\"----------\");\n log.info((testnum++)+\". \"+name);\n}", "log() {\n\n this.respond(undefined, \"log\", undefined, undefined, arguments);\n\n }", "function Logarithm() {\r\n}", "function log(txt) {\r\n console.log(txt);\r\n}", "function log(text) {\n console.log(text);\n}", "function log(message){\n console.log(message);\n }", "function aliasLog(log) {\n function logInfo() {\n // @ts-ignore\n log.info(...arguments);\n }\n for (const key in log) {\n // @ts-ignore\n logInfo[key] =\n typeof log[key] === \"function\" ? log[key].bind(log) : log[key];\n }\n // @ts-ignore\n return logInfo;\n}", "function log(level) {\n if(level <= verbosity && trace) {\n var args = Array.prototype.slice.call(arguments, 1);\n args.unshift(\"WebSQL:\");\n if(_isFunction(trace.text)) {\n trace.text(args, \"color: purple\");\n } else if(_isFunction(trace.log)) {\n trace.log(args.join(' '));\n }\n }\n }", "function _log() {\n\tvar d = new Date();\n\n\t// Year\n\td_str = d.getFullYear();\n\td_str += '-';\n\n\t// Month\n\tif(d.getMonth()+1<10) d_str += '0';\n\td_str += (d.getMonth()+1);\n\td_str += '-';\n\n\t// Day\n\tif(d.getDate()<10) d_str += '0';\n\td_str += d.getDate();\n\td_str += ' ';\n\n\t// Hour\n\tif(d.getHours()<10) d_str += '0';\n\td_str += d.getHours();\n\td_str += ':';\n\n\t// Minute\n\tif(d.getMinutes()<10) d_str += '0';\n\td_str += d.getMinutes();\n\td_str += ':';\n\n\t// Second\n\tif(d.getSeconds()<10) d_str += '0';\n\td_str += d.getSeconds();\n\td_str += '.';\n\n\t// Milliseconds\n\td_str += d.getMilliseconds();\n\n\n\tif(arguments.length==1)\n\t\tvar l = arguments[0];\n\telse {\n\t\tvar l = [];\n\t\tfor(var i=0; i<arguments.length; i++)\n\t\t\tl.push(arguments[i]);\n\t}\n\n\n\tconsole.log('['+d_str+']', l);\n}", "function log() {\n console.log(arguments);\n }", "function foo() {\n lib.log(\"hello world!\");\n}", "log(message) {\n console.log(message)\n\n return null\n\t }", "function _log() {\n\tvar d = new Date();\n\n\t// Year\n\td_str = d.getFullYear();\n\td_str += '-';\n\n\t// Month\n\tif(d.getMonth()+1<10) d_str += '0';\n\td_str += (d.getMonth()+1);\n\td_str += '-';\n\n\t// Day\n\tif(d.getDate()<10) d_str += '0';\n\td_str += d.getDate();\n\td_str += ' ';\n\n\t// Hour\n\tif(d.getHours()<10) d_str += '0';\n\td_str += d.getHours();\n\td_str += ':';\n\n\t// Minute\n\tif(d.getMinutes()<10) d_str += '0';\n\td_str += d.getMinutes();\n\td_str += ':';\n\n\t// Second\n\tif(d.getSeconds()<10) d_str += '0';\n\td_str += d.getSeconds();\n\td_str += '.';\n\n\t// Milliseconds\n\td_str += d.getMilliseconds();\n\n\n\tif(arguments.length==1)\n\t\tvar l = arguments[0];\n\telse {\n\t\tvar l = [];\n\t\tfor(var i=0; i<arguments.length; i++)\n\t\t\tl.push(arguments[i]);\n\t}\n\t\t\t\n\n\tconsole.log('['+d_str+']', l);\n}", "static log() {\n console.log(\n\t\t\t`\\n\\n${CustomLog.top_banner}\\\n\t\t\t\\n\\n${CustomLog.Use.SPACE}${arguments[0]}\\\n\t\t\t\\n${CustomLog.Use.INDENT}${CustomLog.Use.SOLID_LINE}\\n\\n`\n\t\t)\n let Args = Array.from(arguments).splice(1)\n Args.forEach( w => { console.log( CustomLog.Use.SPACE + (\n\t\t typeof w.get_custom_log_format === 'undefined' ?\n w : w.get_custom_log_format()\n ))\n })\n console.log(\n `\\n${CustomLog.Use.INDENT}${CustomLog.Use.SOLID_LINE}\\\n \\n${CustomLog.Use.INDENT}${CustomLog.Use.SOLID_LINE}\\n\\n\\n` )\n }", "function logger(param) {\n\t\tif (DEBUG)\n\t\t\tconsole.log(param);\n\t}" ]
[ "0.73539543", "0.7285786", "0.7260934", "0.70252436", "0.699583", "0.6872711", "0.6731688", "0.6728357", "0.6692784", "0.65004903", "0.6494829", "0.6486238", "0.64171493", "0.6306172", "0.63050413", "0.6304797", "0.6280164", "0.62639517", "0.6235636", "0.62187165", "0.6215945", "0.61886084", "0.6170298", "0.6169159", "0.6143601", "0.61392915", "0.6135636", "0.6128192", "0.6078716", "0.6073125", "0.60683507", "0.60630226", "0.60571116", "0.60570335", "0.6052332", "0.6039928", "0.6036918", "0.60271215", "0.6012646", "0.5999633", "0.5980415", "0.5975616", "0.596823", "0.5958088", "0.5948867", "0.594621", "0.5945137", "0.5934933", "0.5933141", "0.5919863", "0.5911687", "0.5904144", "0.5885293", "0.5884441", "0.5878571", "0.5867995", "0.5864117", "0.586015", "0.586015", "0.58548707", "0.5849468", "0.5842286", "0.5841256", "0.58203876", "0.5818944", "0.581853", "0.5812076", "0.58087176", "0.58087176", "0.58087176", "0.58047754", "0.58045095", "0.5803793", "0.5789961", "0.57890177", "0.57875425", "0.5779065", "0.57742083", "0.57582366", "0.5752875", "0.5752875", "0.57350814", "0.5733843", "0.57331693", "0.5732615", "0.5728409", "0.5726407", "0.5723596", "0.57218856", "0.57115024", "0.5704371", "0.5702648", "0.5695812", "0.5693144", "0.56801456", "0.5678121", "0.5670268", "0.5669307", "0.5669292", "0.5665356" ]
0.6882355
5
have to be init
function Modal(html, init_open){ var el; this.close = function(){ return el.hide(); }; this.nevv = function(){ el = $j('<div id="modal"></div>').append($j(html)).appendTo($j("body")).hide(); if(init_open){this.open()}; }; this.open = function(){ var h = $j(el).outerHeight(), w = $j(el).outerWidth(), w_sidebar = $j('#aside').outerWidth(), css = { 'margin-left': -(w/2), //-(w_sidebar/2), 'margin-top': -(h/2+50) }; $this.log.trace(w_sidebar); return el.css(css).show(); }; this.nevv(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n\t \t\n\t }", "init() {\n }", "function init() {\r\n\r\n }", "function init() {\n }", "function init() {\n\n }", "function init() {\n\n }", "function init() {\r\n }", "function _init() {\n }", "init() { }", "init() { }", "init() { }", "init() { }", "init() { }", "__previnit(){}", "init () {}", "init () {}", "function init() {\n\n\n\n\t}", "function init(){\n\n }", "function init() { }", "function init() { }", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "function init () {\n // Here below all inits you need\n }", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function _construct()\n\t\t{;\n\t\t}", "init () {\n }", "init(){}", "function init() {\n\t//TODO\n}", "function init() {\n\n }", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "init() {\n }", "init() {\n }", "init() {\n }", "function _init() {\n }", "function _init() {\n }", "function _init() {\n }", "initialize() {\n //\n }", "function init() {\n //UH HUH, THIS MY SHIT!\n }", "function init() {\n\n }", "function init(){}", "init () {\n\t\treturn null;\n\t}", "initialize()\n {\n }", "init() {\n\n }", "init() {\n\n }", "constructor() {\n super();\n this._init();\n }", "constructor () {\r\n\t\t\r\n\t}", "init(){\n\n\n }", "init () {\n\n }", "constructor() {\r\n // ohne Inhalt\r\n }", "function init () {\n}", "init() {\n\n }", "init() {\n\n }", "function init()\n{}", "init(){\n \n }", "init () {\n }", "function init () {\n\n}", "initialise () {}", "init() {\n }", "init() {\n }", "constructor() {\r\n super()\r\n this.init()\r\n }", "function init() {\n \n}", "function init() {\n \n}", "function init() {\n \n\n}", "function init() {\n}", "function init() {\n}", "_initialize() {\n\n }", "constructor()\n {\n this.init();\n }", "consructor() {\n }", "init() {\n //todo: other init stuff here\n }", "function init() {\n\n}", "function init() {\n\n}", "constructor() {\n this.init();\n }", "function init() {\n\n\n}", "constructur() {}", "function initialize() {\n }", "constructor() {\n\n\t}" ]
[ "0.82072645", "0.7964122", "0.7906558", "0.7896364", "0.7870771", "0.7870771", "0.7855315", "0.78176004", "0.778161", "0.778161", "0.778161", "0.778161", "0.778161", "0.7756173", "0.7687618", "0.7687618", "0.76394415", "0.760387", "0.7582838", "0.7582838", "0.75315285", "0.75315285", "0.75315285", "0.75315285", "0.75315285", "0.75315285", "0.75315285", "0.75315285", "0.75315285", "0.75315285", "0.75315285", "0.75315285", "0.75315285", "0.7496312", "0.7484777", "0.7484777", "0.7484777", "0.7484777", "0.7484777", "0.7484777", "0.7484777", "0.7484777", "0.7484777", "0.7484777", "0.7434493", "0.7421342", "0.7421116", "0.7419384", "0.74140644", "0.73962796", "0.73962796", "0.73962796", "0.73962796", "0.73962796", "0.73962796", "0.73884195", "0.73884195", "0.73884195", "0.7377529", "0.7377529", "0.7377529", "0.7368386", "0.7337334", "0.7260215", "0.7253672", "0.72495717", "0.72150284", "0.72103167", "0.72103167", "0.7208671", "0.7208451", "0.71931386", "0.71561366", "0.7154598", "0.7130879", "0.710598", "0.710598", "0.70933646", "0.7089769", "0.7083536", "0.7064019", "0.70475936", "0.7039553", "0.7039553", "0.701002", "0.7006832", "0.7006832", "0.6999652", "0.69807166", "0.69807166", "0.6976792", "0.6974478", "0.6955869", "0.69407344", "0.6940718", "0.6940718", "0.6933438", "0.6912331", "0.6893808", "0.68805933", "0.68725234" ]
0.0
-1
Initializes the application settings. The method loads the settings for all environments and then pics the settings for the current environment. The method also handles using the values in the production environment as default values for configuration items in other environments.
_initSettings() { let currentApplicationSettings = {}; let plugins = this._config.plugins.concat([ { name: ObjectContainer.APP_BINDING_STATE, module: this._config } ]); plugins .filter(plugin => typeof plugin.module.initSettings === 'function') .forEach(plugin => { let allPluginSettings = plugin.module.initSettings( ns, this._oc, this._config.settings ); let environmentPluginSetting = $Helper.resolveEnvironmentSetting( allPluginSettings, this._config.settings.$Env ); $Helper.assignRecursivelyWithTracking(plugin.name)( currentApplicationSettings, environmentPluginSetting ); }); this._config.bind = Object.assign( this._config.bind || {}, currentApplicationSettings, this._config.settings ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setApplicationSettings() {\n // custom user settings.\n if (this.config.settings && typeof(this.config.settings) === 'object') {\n Object.keys(this.config.settings)\n .forEach(key => {\n let value = this.config.settings[key];\n this.app.set(key, value);\n log.debug(`setting \"${key}\" to \"${value}\"`);\n });\n } \n\n // override 'env' settings to match NODE_ENV.\n let value = this.config.env === 'prod' ? 'production' : this.config.env;\n this.app\n .set('env', value);\n log.debug(`setting \"env\" to \"${value}\"`);\n }", "function initEnvironment() {\n if (env === \"dev\") {\n }\n else if (env === \"production\") {\n\n }\n else {\n throw \"ERROR: Unidentified env variable (from initEnvironment method)\";\n }\n }", "init_config_values() {\n\t\tif ( 'undefined' === typeof( greeter_config ) ) {\n\t\t\tgreeter_config = { branding: {}, greeter: {} };\n\t\t}\n\n\t\tthis.logo = greeter_config.branding.logo || 'img/antergos.png';\n\t\tthis.user_image = greeter_config.branding.user_image || 'img/antergos-logo-user.png';\n\t\tthis.background_images_dir = greeter_config.branding.background_images || '/usr/share/backgrounds';\n\t\tthis.debug = greeter_config.greeter.debug_mode || false;\n\t\tthis.background_images = this._get( 'background_manager', 'background_images' );\n\t\tthis.images_cache_expires = moment.unix( parseInt( this._get( 'background_manager', 'cache_expires' ) ) );\n\n\t\tlet expired = ( null === this.background_images || ! this.images_cache_expires.isValid() || moment().isAfter( this.images_cache_expires ) );\n\n\t\tif ( ! expired || ! this.background_images_dir ) {\n\t\t\tthis.background_images = JSON.parse( this.background_images );\n\t\t\treturn;\n\t\t}\n\n\t\ttheme_utils.dirlist( this.background_images_dir, true, result => this.cache_background_images(result) );\n\t}", "function loadConfiguration() {\n if (isProdEnvironment()) {\n appConfiguration = require('./production/productionConfiguration.json');\n } else if (isQAEnvironment()) {\n appConfiguration = require('./sandbox/sandboxConfiguration.json');\n } else if (isDevEnvironment()) {\n appConfiguration = require('./development/devConfiguration.json');\n } else {\n appConfiguration = require('./local/localConfiguration.json');\n }\n console.log(\n '******************** Environment detected ********************',\n process.env.NODE_ENV,\n );\n console.log('appConfiguration loaded ', appConfiguration);\n}", "function loadAppSettings() {\n 'use strict';\n \n var _filePath = path.normalize('./config/settings.json');\n var _configAppString = '';\n \n switch(process.env.NODE_ENV) {\n case 'production':\n\t _filePath = path.normalize('./config/production.json');\n\t break;\n case 'test':\n\t _filePath = path.normalize('./config/test.json');\n\t break;\n case 'development':\n\t _filePath = path.normalize('./config/development.json');\n\t break;\n\tdefault:\n\t _filePath = path.normalize('./config/settings.json');\n\t break;\n }\n \n try {\n _configAppString = fs.readFileSync(_filePath, 'utf8');\n _configApp = JSON.parse(_configAppString);\n } catch(e) {\n _configApp = {};\n }\n}", "function applyAlternateSettings () {\n\t\tvar envCookie = document.cookie.match(/__forcev18env=(\\w*)/), // \"dev|staging|preview|\".\n\t\t\tconfigName = IBM.common.config.ibmForceConfig || \"\"; // \"dev|staging|preview|\".\n\t\t\n\t\t// #1. Check if we forced a config thru the build (var at top), and set flag if so.\n\t\tif (configName) {\n\t\t\tIBM.common.config.forced = true;\n\t\t}\n\t\t\n\t\t// #2. Check for environment cookie that overrides whatever the build says to use.\n\t\tif (envCookie && envCookie[1] !== \"\") {\n\t\t\tconfigName = envCookie[1];\n\t\t\tIBM.common.config.forced = false;\n\t\t}\n\n\t\t// Now apply the alternate settings if we need to and they are valid settings.\n\t\tif (configName !== \"\" && configName !== \"production\" && settings[configName]) {\n\t\t\t$.extend(true, IBM.common.config, settings[configName]);\n\t\t}\n\t}", "function initializeAppEnv() {\n appEnv = cfenv.getAppEnv(appEnvOpts);\n if (appEnv.isLocal) {\n require('dotenv').load();\n }\n if (appEnv.services.cloudantNoSQLDB) {\n initCloudant();\n } else {\n console.error(\"No Cloudant service exists.\");\n }\n}", "static init(e) {\n if (process.env.NODE_ENV) {\n if (environment.indexOf(process.env.NODE_ENV) >= 0) {\n console.log(chalk.bold.green(`\\n[NODE_ENV] Application loaded using the ${process.env.NODE_ENV} environment configuration.\\n`));\n } else {\n console.error(chalk.red(`\\n[Warning] Configuration not found for ${process.env.NODE_ENV} environment using [development, test, production] instead.\\n`));\n process.exit(0);\n }\n } else if (environment.indexOf(e) >= 0) {\n console.log(chalk.bold.green(`\\n[Initialize] Application loaded using the ${e} environment configuration.\\n`));\n\n } else {\n console.error(chalk.red(`\\n[Default] NODE_ENV is not defined! Using default product environment.\\n`));\n }\n env.checkEnv(process.env.NODE_ENV || e || 'production');\n }", "function initializeAppEnv() {\n appEnv = cfenv.getAppEnv(appEnvOpts);\n if (appEnv.isLocal) {\n require('dotenv').load();\n }\n if (appEnv.services.cloudantNoSQLDB) {\n initCloudant();\n } else {\n console.error(\"No Cloudant service exists.\");\n }\n\n if(appEnv.services.conversation){\n console.log(\"Services\");\n initConversation();\n }else{\n console.error(\"No Conversation service exists\");\n }\n}", "function setDefault() {\n var environment = SUPPORTED.LOCAL;\n\n if (grunt.option('env')) {\n environment = grunt.option('env');\n } else if (grunt.option('browserstack')) {\n environment = SUPPORTED.LOCAL_BS;\n if (!grunt.file.exists('browserstack.env')) {\n utils.fatal('Expected browserstack.env file to exist.');\n } else {\n require('dotenv').config({ path: 'browserstack.env' });\n }\n } else if (process.env.TRAVIS) {\n if (process.env.TRAVIS_SECURE_ENV_VARS === 'true') {\n if (process.env.TRAVIS_PULL_REQUEST === 'false' && process.env.TRAVIS_REPO_SLUG === 'blackbaud/skyux') {\n environment = SUPPORTED.CI_PUSH;\n } else {\n environment = SUPPORTED.CI_PR_BRANCH;\n }\n } else {\n environment = SUPPORTED.CI_PR_FORK;\n }\n }\n set(environment);\n }", "function retrieveBaseConfig() {\n // check that environment variables are set\n ensureEnvVariablesSet([\n 'ALGOD_TOKEN',\n 'ALGOD_SERVER',\n 'ALGOD_PORT'\n ])\n}", "function fillSettings() {\n fs.readFile(\n path.join(appPath, 'settings.json'),\n 'utf8',\n (error, data) => {\n if (error) {\n return logger.error(\n 'Unable to read app/settings.json:',\n error\n )\n }\n\n try {\n data = JSON.parse(data)\n } catch (error) {\n return logger.error(\n 'Unable to parse app/settings.json:',\n error\n )\n }\n\n lastSaveTime = Date.now() + 1\n\n for (let section in data) {\n for (let subSection in data[section]) {\n if (typeof data[section][subSection] === 'object') {\n let keyGroup = section + '.' + subSection\n if (\n typeof data[section][subSection].map ===\n 'string'\n ) {\n keyGroup = data[section][subSection].map\n }\n keyGroup += '.'\n\n let entries = data[section][subSection].entries\n\n for (let option in entries) {\n if (!settings.has(keyGroup + option)) {\n settings.set(\n keyGroup + option,\n entries[option].default\n )\n }\n }\n }\n }\n }\n }\n )\n }", "fromEnvironment() {\n var cloudinary_url, query, uri, uriRegex;\n if(typeof process !== \"undefined\" && process !== null && process.env && process.env.CLOUDINARY_URL ){\n cloudinary_url = process.env.CLOUDINARY_URL;\n uriRegex = /cloudinary:\\/\\/(?:(\\w+)(?:\\:([\\w-]+))?@)?([\\w\\.-]+)(?:\\/([^?]*))?(?:\\?(.+))?/;\n uri = uriRegex.exec(cloudinary_url);\n if (uri) {\n if (uri[3] != null) {\n this.configuration['cloud_name'] = uri[3];\n }\n if (uri[1] != null) {\n this.configuration['api_key'] = uri[1];\n }\n if (uri[2] != null) {\n this.configuration['api_secret'] = uri[2];\n }\n if (uri[4] != null) {\n this.configuration['private_cdn'] = uri[4] != null;\n }\n if (uri[4] != null) {\n this.configuration['secure_distribution'] = uri[4];\n }\n query = uri[5];\n if (query != null) {\n query.split('&').forEach(value=>{\n let [k, v] = value.split('=');\n if (v == null) {\n v = true;\n }\n this.configuration[k] = v;\n });\n }\n }\n }\n return this;\n }", "function init(){\n let vcap = {};\n vcap.services = config.VCAP_SERVICES;\n vcap.name = config.processname;\n vcap.port = process.env.PORT || (config.server && config.server.port);\n //vcap.protocol = config.server.protocol;\n //vcap.bind = config.server.host;\n vcap.env = process.env.NODE_ENV || config.env;\n\n //API doc says that if the environment is local then the vcap in options is used.\n appEnv = cfenv.getAppEnv(vcap);\n console.log(\"application environment is \");\n console.log(appEnv);\n\n if (!appEnv.env){\n appEnv.env = \"development\";\n }\n}", "function initConfig(N) {\n // set application environment\n N.environment = process.env.NODECA_ENV || N.config.env_default || 'development';\n\n // do global expansion first\n // merge `^all` branch\n if (N.config['^all']) {\n mergeConfigs(N.config, N.config['^all']);\n delete N.config['^all'];\n }\n\n // expand environment-dependent configs\n _.forEach(N.config, (val, key) => {\n if (key[0] === '^') {\n delete N.config[key];\n\n if (N.environment === key.substr(1)) {\n mergeConfigs(N.config, val);\n }\n }\n });\n\n //\n // Post-process config.\n //\n N.config.options = N.config.options || {};\n}", "function EnvConfig(init) {\n for (var i in init) {\n if (init.hasOwnProperty(i)) {\n this[i] = init[i];\n }\n }\n }", "function initialConfiguration() {\n if (config.chooseTheme) theme = config.chooseTheme;\n\n if (\n theme == `Horizontal` ||\n theme == `Vertical` ||\n theme == `Horizontal Stack` ||\n theme == `Vertical Stack`\n ) {\n if (globalTheme != `horizontalOrVertical`) {\n globalTheme = `horizontalOrVertical`;\n settings.customSpacing.hidden = true;\n settings.customLabel.hidden = true;\n settings.dataLabels.hidden = true;\n settings.horizontal.hidden = true;\n settings.endingShape.hidden = true;\n settings.stack.hidden = true;\n settings.alignLegend.hidden = true;\n settings.alignYaxis.hidden = true;\n settings.styleGrid.hidden = true;\n settings.fill.hidden = true;\n settings.stackType.hidden = true;\n if (settings.multipleAxes) settings.multipleAxes.hidden = true;\n changed = true;\n }\n\n if (theme == `Horizontal`) horizontal = true;\n if (theme == `Vertical`) horizontal = false;\n if (theme == `Vertical Stack`) stack = true;\n if (theme == `Horizontal Stack`) {\n horizontal = true;\n stack = true;\n }\n }\n\n if (theme == `Custom`) {\n if (globalTheme != `Custom`) {\n globalTheme = `Custom`;\n settings.customSpacing.hidden = false;\n settings.customLabel.hidden = false;\n settings.dataLabels.hidden = false;\n settings.horizontal.hidden = false;\n settings.endingShape.hidden = false;\n settings.stack.hidden = false;\n settings.alignLegend.hidden = false;\n settings.alignYaxis.hidden = true;\n settings.styleGrid.hidden = true;\n settings.fill.hidden = true;\n if (settings.multipleAxes) settings.multipleAxes.hidden = false;\n changed = true;\n }\n\n // 100% stack type display\n if (config.stack) {\n if (stackGlobal != `true`) {\n stackGlobal = `true`;\n changed = true;\n settings.stackType.hidden = false;\n }\n } else {\n if (stackGlobal != `false`) {\n stackGlobal = `false`;\n changed = true;\n settings.stackType.hidden = true;\n }\n }\n\n if (config.dataLabels) dataLabels = config.dataLabels;\n if (config.endingShape) endingShape = config.endingShape;\n if (config.stack) stack = config.stack;\n if (config.horizontal) horizontal = config.horizontal;\n if (config.alignLegend) alignLegend = config.alignLegend;\n }\n\n if (config.title != ``) title = config.title;\n if (config.subtitle) subtitle = config.subtitle;\n\n if (config.showActualTitle) showActualTitle = config.showActualTitle;\n if (config.showSubtitle) showSubtitle = config.showSubtitle;\n if (config.showTitleX) showTitleX = config.showTitleX;\n if (config.showTitleY) showTitleY = config.showTitleY; // y titles are 1 and 2\n if (config.showSecondTitleY) showSecondTitleY = config.showSecondTitleY;\n if (config.alignYaxis) alignYaxis = config.alignYaxis;\n if (config.styleGrid) grid = config.styleGrid;\n if (config.fill) fill = config.fill;\n if (config.multipleAxes) multipleAxes = config.multipleAxes;\n }", "function initializeConfig() {\n _config = {\n appConfig: APP_CONFIG_DATA,\n routes: [],\n currentRoute: {\n route: '/',\n data: undefined\n }\n };\n }", "function config() {\n global.config.build.rootDirectory = path.join('../EquiTrack/assets/frontend/', global.config.appName);\n global.config.build.templateDirectory = path.join('../EquiTrack/templates/frontend/', global.config.appName);\n global.config.build.bundledDirectory = '.';\n indexPath = path.join(global.config.build.rootDirectory, 'index.html');\n bowerPath = path.join(global.config.build.rootDirectory, 'bower.json');\n templatePath = global.config.build.templateDirectory;\n}", "_loadEnvironment() {\n this.envname = process.env.NODE_ENV;\n this.env = require('./env/' + this.envname + '.env.js');\n }", "function setDefaults() {\n\tconfig.all = {\n\t\ttitleStyle: {\n\t\t\t'font-src': 'http://fonts.googleapis.com/css?family=Chango',\n\t\t\t'font-family': 'Chango, cursive',\n\t\t\t'color': '#000000',\n\t\t\t'font-size': '48px'\n\t\t},\n\t\ttimerStyle: {\n\t\t\t'background-color': '#32cd32',\n\t\t\t'font-src': 'http://fonts.googleapis.com/css?family=Chango',\n\t\t\t'font-family': 'Chango, cursive',\n\t\t\t'color': '#000000',\n\t\t\t'font-size': '48px'\n\t\t},\n\t\ttimers: [],\n\t\twindowSettings: {\n\t\t\twidth: 650,\n\t\t\theight: 350\n\t\t},\n\t\tusername: '',\n\t\tpassword: '',\n\t\tchannel: '',\n\t\tidInc: 0,\n\t\tactiveID: null\n\t}\n}", "function initialConfiguration() {\n if (config.themes) theme = config.themes;\n\n if (theme == `classic` || theme == `smooth` || theme == `stepline`) {\n if (customGlobal != `classic`) {\n customGlobal = `classic`;\n settings.customSpacing.hidden = true;\n settings.customLabel.hidden = true;\n settings.curve.hidden = true;\n // settings.dataLabels.hidden = true;\n settings.alignLegend.hidden = true;\n settings.fill.hidden = true;\n settings.alignYaxis.hidden = true;\n settings.styleGrid.hidden = true;\n changed = true;\n }\n\n if (theme == `classic`) curve = `straight`;\n if (theme == `smooth`) curve = `smooth`;\n if (theme == `stepline`) curve = `stepline`;\n }\n\n if (theme == `custom`) {\n if (customGlobal != `custom`) {\n customGlobal = `custom`;\n settings.customSpacing.hidden = false;\n settings.customLabel.hidden = false;\n settings.curve.hidden = false;\n // settings.dataLabels.hidden = false;\n settings.alignLegend.hidden = false;\n settings.fill.hidden = false;\n settings.alignYaxis.hidden = true;\n settings.styleGrid.hidden = true;\n changed = true;\n }\n\n if (config.curve) curve = config.curve;\n if (config.alignLegend) alignLegend = config.alignLegend;\n if (config.formatDates) formatDates = config.formatDates;\n if (config.doNotTruncate) doNotTruncate = config.doNotTruncate;\n if (config.fill) fill = config.fill;\n }\n\n if (config.stack) stack = config.stack;\n if (stack == `overlay`) stacked = false;\n if (stack == `stack`) stacked = true;\n\n if (config.title != ``) title = config.title;\n if (config.label) label = config.label;\n\n if (config.showTitle) showTitle = config.showTitle;\n if (config.showSubtitle) showSubtitle = config.showSubtitle;\n if (config.showTitleX) showTitleX = config.showTitleX;\n if (config.showTitleY) showTitleY = config.showTitleY; // y titles are 1 and 2\n if (config.showSecondTitleY) showSecondTitleY = config.showSecondTitleY;\n\n if (config.alignYaxis) alignYaxis = config.alignYaxis;\n if (config.multipleAxes) multipleAxes = config.multipleAxes;\n if (config.styleGrid) grid = config.styleGrid;\n }", "function initEnvironmentVariables() {\n node_modules_shelljs_shell.env.SECHUB_USERID = user;\n node_modules_shelljs_shell.env.SECHUB_APITOKEN = apiToken;\n node_modules_shelljs_shell.env.SECHUB_SERVER = url;\n node_modules_shelljs_shell.env.SECHUB_PROJECT = projectName;\n node_modules_shelljs_shell.env.SECHUB_DEBUG = debug;\n}", "function setupEnvironment() {\n\tconsole.log(\"Setting up Suspend Application\");\n\thideTemplates();\n\tstartClock();\n\tsetupStorage();\n\trender();\n\tattachListeners();\n\tcheckFileAPI();\n}", "ensureConfig() {\n if (!window[Const.GLOBAL]) {\n var config = {\n guid: '',\n initialized: false,\n resolution: window.devicePixelRatio >= 2 ? 2 : 1,\n callbacks: [],\n [Const.COUNT.BUTTON]: 0,\n [Const.COUNT.FOLLOW]: 0,\n [Const.COUNT.PIN_SMALL]: 0,\n [Const.COUNT.PIN_MEDIUM]: 0,\n [Const.COUNT.PIN_LARGE]: 0,\n [Const.COUNT.PROFILE]: 0,\n [Const.COUNT.BOARD]: 0\n };\n for (var i = 0; i < 12; i++) {\n config.guid += Const.GUID_VARS.substr(Math.floor(Math.random() * 60), 1);\n }\n window[Const.GLOBAL] = config;\n }\n this.config = window[Const.GLOBAL];\n }", "constructor () {\n this.applyConfig(process.env)\n }", "loadEnvVarsForLocal() {\n const defaultEnvVars = {\n IS_LOCAL: 'true',\n };\n\n _.merge(process.env, defaultEnvVars);\n\n // in some circumstances, setting these provider-independent environment variables is not enough\n // eg. in case of local 'docker' invocation, which relies on this module,\n // these provider-independent environment variables have to be propagated to the container\n this.serverless.service.provider.environment =\n this.serverless.service.provider.environment || {};\n const providerEnv = this.serverless.service.provider.environment;\n for (const [envVariableKey, envVariableValue] of Object.entries(defaultEnvVars)) {\n if (!Object.prototype.hasOwnProperty.call(providerEnv, envVariableKey)) {\n providerEnv[envVariableKey] = envVariableValue;\n }\n }\n\n // Turn zero or more --env options into an array\n // ...then split --env NAME=value and put into process.env.\n [].concat(this.options.env || []).forEach((itm) => {\n const splitItm = itm.split(/=(.+)/);\n process.env[splitItm[0]] = splitItm[1] || '';\n });\n }", "function loadDevEnvVariables() {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const dotenv = require('dotenv');\n const filePath = path_1.default.join(__dirname, '..', '..', '.env');\n const env = dotenv.config({ path: filePath }).parsed;\n forceEnvVar(env, 'ALGOLIA_API_KEY');\n forceEnvVar(env, 'ALGOLIA_BASE_URL');\n}", "function initializeConfiguration() {\n global.objLog = {\n log: obj => console.log(JSON.stringify(obj))\n }\n\n if (AppConfig.FORCE_FRESH_START || AppConfig.FORCE_NEW_ACCOUNT) {\n const user = getCurrentUser()\n\n if (user != null) {\n deleteAccount(getCurrentUser().uid).then().catch(error => { console.log(error) })\n }\n }\n\n if (AppConfig.FORCE_FRESH_START || AppConfig.FORCE_LOGOUT) {\n logOut().then().catch(error => { console.log(error) })\n }\n}", "function initSettings() {\n const PUBLIC_CONFIGURE_SETTINGS = [\n {\n key: SETTING_KEYS.TOOLTIP_POSITION,\n settings: {\n name: i18n('settings.TOOLTIP_POSITION.name'),\n hint: i18n('settings.TOOLTIP_POSITION.hint'),\n type: String,\n config: true,\n default: 'right',\n choices: {\n top: i18n('settings.TOOLTIP_POSITION.choices.top'),\n right: i18n('settings.TOOLTIP_POSITION.choices.right'),\n bottom: i18n('settings.TOOLTIP_POSITION.choices.bottom'),\n left: i18n('settings.TOOLTIP_POSITION.choices.left'),\n overlay: i18n('settings.TOOLTIP_POSITION.choices.overlay'),\n surprise: i18n('settings.TOOLTIP_POSITION.choices.surprise'),\n doubleSurprise: i18n('settings.TOOLTIP_POSITION.choices.doubleSurprise'),\n },\n },\n },\n {\n key: SETTING_KEYS.FONT_SIZE,\n settings: {\n name: i18n('settings.FONT_SIZE.name'),\n hint: i18n('settings.FONT_SIZE.hint'),\n type: Number,\n config: true,\n range: {\n min: 1,\n step: 0.1,\n max: 2.5,\n },\n default: 1.2,\n },\n },\n {\n key: SETTING_KEYS.MAX_ROWS,\n settings: {\n name: i18n('settings.MAX_ROWS.name'),\n hint: i18n('settings.MAX_ROWS.hint'),\n type: Number,\n config: true,\n range: {\n min: 1,\n step: 1,\n max: 20,\n },\n default: 5,\n },\n },\n {\n key: SETTING_KEYS.DATA_SOURCE,\n settings: {\n name: i18n('settings.DATA_SOURCE.name'),\n hint: i18n('settings.DATA_SOURCE.hint'),\n type: String,\n scope: 'world',\n config: true,\n restricted: true,\n default: 'actor.data.data',\n },\n },\n {\n key: SETTING_KEYS.DARK_THEME,\n settings: {\n name: i18n('settings.DARK_THEME.name'),\n hint: i18n('settings.DARK_THEME.hint'),\n type: Boolean,\n config: true,\n default: false,\n },\n },\n {\n key: SETTING_KEYS.SHOW_ALL_ON_ALT,\n settings: {\n name: i18n('settings.SHOW_ALL_ON_ALT.name'),\n hint: i18n('settings.SHOW_ALL_ON_ALT.hint'),\n type: Boolean,\n scope: 'world',\n config: true,\n restricted: true,\n default: true,\n },\n },\n {\n key: SETTING_KEYS.SHOW_TOOLTIP_FOR_HIDDEN_TOKENS,\n settings: {\n name: i18n('settings.SHOW_TOOLTIP_FOR_HIDDEN_TOKENS.name'),\n hint: i18n('settings.SHOW_TOOLTIP_FOR_HIDDEN_TOKENS.hint'),\n type: Boolean,\n scope: 'world',\n config: true,\n restricted: true,\n default: false,\n },\n },\n {\n key: SETTING_KEYS.DEBUG_OUTPUT,\n settings: {\n name: i18n('settings.DEBUG_OUTPUT.name'),\n hint: i18n('settings.DEBUG_OUTPUT.hint'),\n type: Boolean,\n scope: 'world',\n config: true,\n restricted: true,\n default: false,\n },\n },\n ];\n const HIDDEN_CONFIGURE_SETTINGS = [\n {\n key: SETTING_KEYS.GM_SETTINGS,\n settings: {\n type: Object,\n scope: 'world',\n restricted: true,\n default: {},\n },\n },\n {\n key: SETTING_KEYS.PLAYER_SETTINGS,\n settings: {\n type: Object,\n scope: 'world',\n restricted: true,\n default: {},\n },\n },\n {\n key: SETTING_KEYS.ACTORS,\n settings: {\n type: Object,\n scope: 'world',\n restricted: true,\n default: [],\n },\n },\n {\n key: SETTING_KEYS.CLIPBOARD,\n settings: {\n type: Object,\n default: [],\n },\n },\n ];\n\n registerTooltipManager();\n registerSettings([...PUBLIC_CONFIGURE_SETTINGS, ...HIDDEN_CONFIGURE_SETTINGS]);\n}", "init() {\n for (const itemKey in this._config) {\n // confirm itemKey isn't from prototype\n if (this._config.hasOwnProperty(itemKey)) {\n const itemValue = localStorage.getItem(itemKey);\n if (itemValue !== null) {\n this._config[itemKey] = itemValue;\n }\n }\n }\n }", "function initSettings() {\n\t\tns.settings.exampleSetting = 1337;\n\t}", "initSliderVariablesApp(){\n super.initSliderVariablesApp();\n\n this._initAppVariable(\"Speed\", 1);\n this._initAppVariable(\"Gravity\", 5);\n }", "function setup (options) {\n App.config = _.deepExtend(defaults, options);\n }", "function _getRuntimeEnv () {\n\n return http.get(endpoints.uiconfig, {}, function (err, results) {\n if (err) {\n Mojo.publishException(_component, err.message);\n }\n else {\n\n CONFIG.isProd = (results.env == 'production');\n CONFIG.env = results.env;\n CONFIG.appVersion = results.version;\n\n // TODO - set any 'supports' variables here that your server configuration sets up\n\n Mojo.setDataVal('configModel', \"isProd\", CONFIG.isProd);\n Mojo.setDataVal(\"configModel\", \"appVersion\", CONFIG.appVersion);\n Mojo.setDataVal(\"configModel\", \"env\", CONFIG.env);\n\n if (!CONFIG.isProd) {\n setTimeout(CONFIG.enableQA, 500);\n }\n\n // Let every one else know that were ready to roll.\n Mojo.publish(config.events.init, results);\n\n }\n });\n}", "async function init(){\n const libAppSettings = require(\"lib-app-settings\");\n var appSettings = new libAppSettings(\".settings\");\n await appSettings.loadSettingsFromFile()\n .then((settings)=>{\n if (settings){\n apps = settings.apps;\n addApps();\n checkAppsSlow();\n startApps();\n }\n })\n .catch((error)=>{\n alert(\"Problem with settings file - \" + error);\n });\n}", "loadConfig() {\n lumServer.config = require('../etc/config.json').lumServer || {};\n lumServer.config.serverName = lumServer.config.serverName || \"lum-server\";\n lumServer.config.port = (!isNaN(process.env.APPPORT) && Number(process.env.APPPORT))\n || lumServer.config.port || 2080;\n lumServer.config.maxTxRetryCount = lumServer.config.maxTxRetryCount || 20;\n lumServer.config.database = lumServer.config.database || {};\n lumServer.config.database.password = process.env.DATABASE_PASSWORD || lumServer.config.database.password;\n }", "function initialize() {\n\t\tconfig = Object.assign({}, config, $scope.config);\n\t}", "function _init(){\n if(mergedConfig.content && mergedConfig.button && mergedConfig.cookie_name && _util.validate.settingsConfig(mergedConfig)){\n //Add cookieValue globally if it exists.\n cookieValue = _util.validate.ifCookieNameSet(mergedConfig.cookie_name.name) ? JSON.parse(_util.getCookieValueByName(mergedConfig.cookie_name.name)) : undefined;\n // Build DOM\n _build.bannerLayout(mergedConfig);\n _build.modalLayout(mergedConfig);\n _util.toggleBanner(mergedConfig);\n };\n }", "function settingsSetup() {\n updateSettingsValues();\n }", "function AppConfig() {\n var _this = this;\n this.mongoEnvironments = function () {\n return {\n \"dev-docker\": \"mongodb://mongo:27017/\",\n \"dev-local\": \"mongodb://127.0.0.1:27017/\",\n \"prod\": \"mongodb://127.0.0.1:27017/\"\n };\n };\n this.mongoDb = function () {\n return \"templateWebAppDB\";\n };\n this.port = 0;\n this.host = \"127.0.0.1\";\n this.secure = false;\n this.isProduction = false;\n this.appName = \"Template-ts-webApp\";\n this.dbs = ['templateDB'];\n this.getEnv = function () {\n return process.NODE_ENV;\n };\n this.mongoURL = function () {\n var env = process.NODE_ENV || 'dev-local';\n var mongoURL = _this.mongoEnvironments[env];\n var dbName = _this.mongoDb;\n if (mongoURL && dbName) {\n return mongoURL + \"/\" + dbName;\n }\n else {\n throw new Error(\"AppConfig: MONGO URL Not available\");\n }\n };\n this.port = process.env.PORT || 8001;\n this.host = process.env.host || \"127.0.0.1\";\n }", "function __loadConfig(){\n if($rootScope.config === void 0 || typeof $rootScope.config == 'undefined'){\n //@todo test if we can get config from localStorage\n $http({url:'config/parrametters.json', method:'GET'})\n .then(function successCallback(response) {\n $rootScope.config = response.data;\n $rootScope.$emit('configurationFileLoaded');\n });\n }\n }", "function init() {\n\n initFloorsMapping(Config.BUILDINGS);\n createElevators(Config.BUILDINGS);\n\n AppUI.init();\n attachEvents(Config.BUILDINGS);\n }", "function getSettingsAndStart() {\n chrome.storage.local.get(null, function (settings) {\n // Begin parsing and injecting views\n if (window.location.href.indexOf('spryker-simplicity') !== -1) {\n if (window.location.href.indexOf('merge_requests') !== -1) {\n if ($.isNumeric(window.location.pathname.split('/')[4])) {\n addPipelineButton()\n addEnvironmentButton()\n }\n }\n }\n })\n}", "function initSentry() {\n if (process.env.REACT_APP_SENTRY_DSN) {\n let environment = '';\n if (window.location.hostname === 'cv19assist.com') {\n environment = 'production';\n } else if (/cv19assist-(.*)\\.web.app/g.test(window.location.hostname)) {\n [, environment] = /cv19assist-(.*)\\.web.app/g.exec(\n window.location.hostname,\n );\n } else {\n environment = `unknown-${window.location.hostname}`;\n }\n Sentry.init({\n dsn: process.env.REACT_APP_SENTRY_DSN,\n environment,\n release: version,\n });\n }\n}", "setEnvironmentVariables() {\n process.env.apiKey = this.configuration.apiKey;\n }", "function processEnv() {\n process.env.NODE_ENV = env.NODE_ENV || 'dev';\n console.log(`Running the application with '${env.NODE_ENV}' environment`);\n Object.entries(options).forEach(([key,val]) => process.env[`aat_${key}`] = val);\n modifyModulePaths();\n}", "ensureDefaults() {\n if ( typeof(this._defaults) !== undefined ) {\n for ( var k in this._defaults ) {\n if ( this._data[k] === undefined ) {\n this.setConfig(k, this._defaults[k]);\n }\n }\n }\n }", "function gatherEnv() {\n addSetting('Processors', os.cpus().length)\n addSetting('OS', os.type())\n addSetting('OS version', os.release())\n addSetting('Node.js version', process.version)\n addSetting('Architecture', process.arch)\n\n if ('NODE_ENV' in process.env) {\n addSetting('NODE_ENV', process.env.NODE_ENV)\n }\n}", "function loadSettings () {\n storage.get(vatobeStorage, function (error, data) {\n if (error) throw error\n // load storage into app state\n var intervalRange = data.intervalRange || data.interval // for backwards compatibility\n appState.interval = convertRangeToMillis(intervalRange)\n appState.speak = data.speak\n appState.notification = data.notification\n // match UI to the stored settings\n range.value = data.intervalRange\n speak.checked = data.speak\n notification.checked = data.notification\n })\n}", "function initConfig(env) {\n if (!configReady) {\n setConfig(env);\n }\n}", "function start(environment) {\n\tlog.message('Establishing configuration...', log.MODE.gold);\n\tconfiguration.server.name = environment.name;\n\tconfiguration.server.address = environment.hostname;\n\tconfiguration.server.port = environment.port;\n\tconfiguration.database.address = environment.store_hostname;\n\tconfiguration.database.name = environment.store_name;\n\tconfiguration.database.port = environment.store_port;\n\tconfiguration.database.username = environment.store_username;\n\tconfiguration.database.password = environment.store_password;\n}", "function EnvironmentLoader() {\n var _configReady = false,\n _domReady = false,\n\n isReady = function() {\n return _domReady && _configReady;\n },\n\n onLoaded = function() {\n if (isReady()) {\n OT.dispatchEvent(new OT.EnvLoadedEvent(OT.Event.names.ENV_LOADED));\n }\n },\n\n onDomReady = function() {\n _domReady = true;\n\n // The Dynamic Config won't load until the DOM is ready\n OT.Config.load(OT.properties.configURL);\n\n onLoaded();\n },\n\n configLoaded = function() {\n _configReady = true;\n OT.Config.off('dynamicConfigChanged', configLoaded);\n OT.Config.off('dynamicConfigLoadFailed', configLoadFailed);\n\n onLoaded();\n },\n\n configLoadFailed = function() {\n configLoaded();\n };\n\n OT.Config.on('dynamicConfigChanged', configLoaded);\n OT.Config.on('dynamicConfigLoadFailed', configLoadFailed);\n if (document.readyState == \"complete\" || (document.readyState == \"interactive\" && document.body)) {\n onDomReady();\n } else {\n if (document.addEventListener) {\n document.addEventListener(\"DOMContentLoaded\", onDomReady, false);\n } else if (document.attachEvent) {\n // This is so onLoad works in IE, primarily so we can show the upgrade to Chrome popup\n document.attachEvent(\"onreadystatechange\", function() {\n if (document.readyState == \"complete\") onDomReady();\n });\n }\n }\n\n this.onLoad = function(cb) {\n if (isReady()) {\n cb();\n return;\n }\n\n OT.on(OT.Event.names.ENV_LOADED, cb);\n };\n}", "function init_global_supplier_settings()\n{\n\t//for each supplier \n\t$.each(suppliers_list, function (key, value)\n\t{\n\t\tglobal_supplier_settings[key].premium = 0;\n\t\tglobal_supplier_settings[key].name = suppliers_list[key].name;\n\t});\n\n}", "function createDefaultConfig() {\n let keys = Object.keys(DEFAULT_CONFIG);\n for (let key of keys) {\n localStorage.setItem(key, DEFAULT_CONFIG[key]);\n }\n}", "function initialise() {\n loadConfig();\n createGrid();\n\n settingsContainer = document.getElementById('settings-container');\n authorizeButton = document.getElementById('authorize-button');\n signoutButton = document.getElementById('signout-button');\n fullscreenButton = document.getElementById('fullscreen-button');\n dialogButton = document.getElementById('settings-button');\n\n addWindowEventListeners();\n addNetworkChangeListeners();\n addSliderEventListeners();\n addSpreadsheetTextboxEventListener();\n\n initDialog();\n\n if (typeof gapi === 'undefined') {\n showSnackbar('Unable to load Google JS library (is internet connected?)',\n SNACKBAR_ERR_TIMEOUT_MS);\n } else {\n gapi.load('client:auth2', initAuth);\n }\n}", "function loadConfig() {\n var config = JSON.parse(fs.readFileSync(__dirname+ '/config.json', 'utf-8'));\n for (var i in config) {\n config[i] = process.env[i.toUpperCase()] || config[i];\n }\n console.log('Configuration');\n console.log(config);\n return config;\n}", "function getAppEnv(){\n //If not initialized then do that.\n if (!appEnv){\n init();\n }\n console.log(\"application environment variable\");\n console.log(appEnv);\n return appEnv;\n}", "__getFakeSettings() {\n return {\n environment: {\n home_url: \"http://example.com\",\n site_url: \"http://example.com\",\n version: \"3.0.0\",\n log_directory: \"/var/www/woocommerce/wp-content/uploads/wc-logs/\",\n log_directory_writable: true,\n wp_version: \"4.7.3\",\n wp_multisite: false,\n wp_memory_limit: 134217728,\n wp_debug_mode: true,\n wp_cron: true,\n language: \"en_US\",\n server_info: \"Apache/2.4.18 (Ubuntu)\",\n php_version: \"7.1.3-2+deb.sury.org~yakkety+1\",\n php_post_max_size: 8388608,\n php_max_execution_time: 30,\n php_max_input_vars: 1000,\n curl_version: \"7.50.1, OpenSSL/1.0.2g\",\n suhosin_installed: false,\n max_upload_size: 2097152,\n mysql_version: \"5.7.17\",\n default_timezone: \"UTC\",\n fsockopen_or_curl_enabled: true,\n soapclient_enabled: true,\n domdocument_enabled: true,\n gzip_enabled: true,\n mbstring_enabled: true,\n remote_post_successful: true,\n remote_post_response: \"200\",\n remote_get_successful: true,\n remote_get_response: \"200\",\n },\n database: {\n wc_database_version: \"3.0.0\",\n database_prefix: \"wp_\",\n maxmind_geoip_database:\n \"/var/www/woocommerce/wp-content/uploads/GeoIP.dat\",\n database_tables: {\n woocommerce_sessions: true,\n woocommerce_api_keys: true,\n woocommerce_attribute_taxonomies: true,\n woocommerce_downloadable_product_permissions: true,\n woocommerce_order_items: true,\n woocommerce_order_itemmeta: true,\n woocommerce_tax_rates: true,\n woocommerce_tax_rate_locations: true,\n woocommerce_shipping_zones: true,\n woocommerce_shipping_zone_locations: true,\n woocommerce_shipping_zone_methods: true,\n woocommerce_payment_tokens: true,\n woocommerce_payment_tokenmeta: true,\n },\n },\n active_plugins: [\n {\n plugin: \"woocommerce/woocommerce.php\",\n name: \"WooCommerce\",\n version: \"3.0.0-rc.1\",\n version_latest: \"2.6.14\",\n url: \"https://woocommerce.com/\",\n author_name: \"Automattic\",\n author_url: \"https://woocommerce.com\",\n network_activated: false,\n },\n ],\n theme: {\n name: \"Twenty Sixteen\",\n version: \"1.3\",\n version_latest: \"1.3\",\n author_url: \"https://wordpress.org/\",\n is_child_theme: false,\n has_woocommerce_support: true,\n has_woocommerce_file: false,\n has_outdated_templates: false,\n overrides: [],\n parent_name: \"\",\n parent_version: \"\",\n parent_version_latest: \"\",\n parent_author_url: \"\",\n },\n settings: {\n api_enabled: true,\n force_ssl: false,\n currency: \"USD\",\n currency_symbol: \"&#36;\",\n currency_position: \"left\",\n thousand_separator: \",\",\n decimal_separator: \".\",\n number_of_decimals: 2,\n geolocation_enabled: false,\n taxonomies: {\n external: \"external\",\n grouped: \"grouped\",\n simple: \"simple\",\n variable: \"variable\",\n },\n },\n security: {\n secure_connection: true,\n hide_errors: true,\n },\n pages: [\n {\n page_name: \"Shop base\",\n page_id: \"4\",\n page_set: true,\n page_exists: true,\n page_visible: true,\n shortcode: \"\",\n shortcode_required: false,\n shortcode_present: false,\n },\n {\n page_name: \"Cart\",\n page_id: \"5\",\n page_set: true,\n page_exists: true,\n page_visible: true,\n shortcode: \"[woocommerce_cart]\",\n shortcode_required: true,\n shortcode_present: true,\n },\n {\n page_name: \"Checkout\",\n page_id: \"6\",\n page_set: true,\n page_exists: true,\n page_visible: true,\n shortcode: \"[woocommerce_checkout]\",\n shortcode_required: true,\n shortcode_present: true,\n },\n {\n page_name: \"My account\",\n page_id: \"7\",\n page_set: true,\n page_exists: true,\n page_visible: true,\n shortcode: \"[woocommerce_my_account]\",\n shortcode_required: true,\n shortcode_present: true,\n },\n ],\n };\n }", "constructor(configType = '') {\n if (configType === 'heroku')\n this.config = HerokuAppConfig;\n else\n this.config = TestAppConfig;\n\n\n this.init();\n }", "function init() {\n fse\n .readJson('./site.json')\n .then(function(site) {\n // if the destination dir exists\n if (fse.pathExistsSync(config.baseDir)) {\n // clean it out before writing files\n fse.emptyDirSync(config.baseDir);\n } else {\n // ensure the destination dir exists\n fse.ensureDirSync(config.baseDir);\n }\n\n // copy assets in `/media`\n copyDirectory(config.mediaRoot, config.baseDir);\n // builds the CSS and JS bundles\n buildBundles(site.bundles);\n // generates the pages\n buildPages(site.pages);\n // clean up\n removeJSBundles();\n })\n .catch(function(err) {\n console.error('Error thrown while loading JSON', err);\n });\n}", "function loadSettings() {\n var settings;\n if (!localStorage.getItem(\"PWDSettings\")) {\n localStorage.setItem(\"PWDSettings\", JSON.stringify(require(\"./defaultSettings.json\")));\n }\n\n settings = JSON.parse(localStorage.getItem(\"PWDSettings\"));\n document.querySelector(\"body\").style.backgroundImage = \"url(\" + settings.wallpaper + \")\";\n\n if (settings.dockPosition === \"top\") {\n document.querySelector(\"#dock\").classList.add(\"dockTop\");\n } else {\n document.querySelector(\"#dock\").classList.add(\"dockBottom\");\n }\n}", "async beforeRun() {\n this._super.apply(this, arguments);\n\n // try to read global options from `config/crowdin.js`\n let configOptions = {};\n let module = path.join(this.project.root, 'config', 'crowdin');\n\n try {\n configOptions = require(module);\n if (typeof configOptions === 'function') {\n configOptions = configOptions();\n }\n } catch (e) {\n // do nothing, ignore the config\n }\n\n // For all options that are specified in config/crowdin.js, set the value there to be the actual default value\n this.availableOptions.map((option) => {\n let normalizedName = stringUtil.camelize(option.name);\n let configOption = configOptions[normalizedName];\n\n if (configOption !== undefined) {\n option.default = configOption;\n return option;\n }\n\n return option;\n });\n\n await this._createTmpFolder(this._getTmpDir());\n }", "function init()\r\n{\r\n\tif(!$.appConfiguration)\r\n\t{\r\n\t\tconsole.error(\"No appliation configuration is defined.\");\r\n\t\treturn;\r\n\t}\r\n\t\r\n\t//Load templates\r\n\tvar templateFiles = $.appConfiguration.templates;\r\n\r\n\tif(templateFiles)\r\n\t{\r\n\t\tfor(var i = 0; i < templateFiles.length; i++)\r\n\t\t{\r\n\t\t\tconsole.log(\"Loading template file - \" + templateFiles[i]);\r\n\t\t\t$.loadCustomDirectives(templateFiles[i]);\r\n\t\t}\r\n\t}\r\n}", "function init() {\r\n \r\n\t\t/**\r\n\t\t * Global settings\r\n\t\t */\r\n\t\t$rootScope.config = {};\r\n\t\t$rootScope.config.dateFormat = 'MMM d, y';\r\n\t\t$rootScope.config.today = new Date();\r\n\t\t\r\n\t\t/**\r\n\t\t * Set app access\r\n\t\t */\r\n\t\t$scope.access = true;\r\n\t\t$scope.errorCode = false;\r\n\t\t\r\n\t\t\r\n\t\t// avatar picture\r\n\t\t$scope.showAvatar = false;\r\n\t\t\r\n\t\t/**\r\n\t\t * Check master data\r\n\t\t * Check exception\r\n\t\t * Check user object\r\n\t\t * Check locations\r\n\t\t * Set languages\r\n\t\t */\r\n\t\tif(APP.CONFIG == null || angular.isUndefined(APP.CONFIG.data) || APP.CONFIG.data == null) {\r\n\t\t\t\r\n\t\t\t$scope.access = false;\r\n\t\t\t\r\n\t\t} else {\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * initialize the global level variables\r\n\t\t\t */\r\n\t\t\tvar config = APP.CONFIG.data;\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * User checking\r\n\t\t\t */\r\n\t\t\tif(angular.isUndefined(config.user) || config.user == null || angular.isUndefined(config.user.sso)) {\r\n\t\t\t\t$scope.access = false;\r\n\t\t\t} else {\r\n\t\t\t\t\r\n\t\t\t\t$scope.user = config.user;\r\n\t\t\t\t\r\n\t\t\t\t/**\r\n\t\t\t\t * Check for avatar picture\r\n\t\t\t\t *\r\n\t\t\t\t * @param null\r\n\t\t\t\t * @return bool\r\n\t\t\t\t */\r\n\t\t\t\tUtils.isImage($scope.user.sso).then(function(result) {\r\n\t\t\t\t\t\r\n\t\t\t\t\t$scope.showAvatar = result;\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * Location checking\r\n\t\t\t */\r\n\t\t\tif(config.locations.length == 0) {\r\n\t\t\t\t$scope.access = false;\r\n\t\t\t} else {\r\n\t\t\t\t\r\n\t\t\t\t/**\r\n\t\t\t\t * Set the home location\r\n\t\t\t\t */\r\n\t\t\t\t$rootScope.location = '';\r\n\t\t\t\t$rootScope.locations = config.locations;\r\n\t\t\t\t\r\n\t\t\t\tangular.forEach($rootScope.locations, function(location){\r\n\t\t\t\t\tif(location.isHome){\r\n\t\t\t\t\t\t$rootScope.location = location.id;\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * Set the preferred language\r\n\t\t\t */\r\n\t\t\tvar preferred = false;\r\n\t\t\t$rootScope.languages = config.languages;\r\n\t\t\t\r\n\t\t\tangular.forEach($rootScope.languages, function(language){\r\n\t\t\t\tif(language.isPreferred){\r\n\t\t\t\t\tpreferred = language.code;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\tif(angular.isUndefined(APP.CONFIG.data.user)){\r\n\t\t\t\tpreferred = 'en-GB'\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$cookies.langCode = (!$cookies.langCode) ? preferred : $cookies.langCode;\r\n\t\t\t$rootScope.langCode = $cookies.langCode;\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * Load the app language file\r\n\t\t\t */\r\n\t\t\t$rootScope.translation = APP.LANGUAGES[$cookies.langCode];\r\n\t\t}\r\n\t}", "static config() {\n dotenv.config({ path: path.join(__dirname, '../../.env') });\n const url = process.env.APP_URL || `http://localhost:${process.env.PORT}`;\n const port = process.env.PORT || 4040;\n const appSecret = process.env.APP_SECRET || 'This is your responsibility!';\n const mongooseUrl = process.env.MONGOOSE_URL;\n const maxUploadLimit = process.env.APP_MAX_UPLOAD_LIMIT || '50mb';\n const maxParameterLimit = process.env.APP_MAX_PARAMETER_LIMIT || '50mb';\n const name = process.env.APP_NAME || 'NodeTS Dashboard';\n const keywords = process.env.APP_KEYWORDS || 'somethings';\n const year = (new Date()).getFullYear();\n const copyright = `Copyright ${year} ${name} | All Rights Reserved`;\n const company = process.env.COMPANY_NAME || 'GeekyAnts';\n const description = process.env.APP_DESCRIPTION || 'Here goes the app description';\n const isCORSEnabled = process.env.CORS_ENABLED || true;\n const jwtExpiresIn = process.env.JWT_EXPIRES_IN || 3;\n const apiPrefix = process.env.API_PREFIX || 'api';\n const logDays = process.env.LOG_DAYS || 10;\n const queueMonitor = process.env.QUEUE_HTTP_ENABLED || true;\n const queueMonitorHttpPort = process.env.QUEUE_HTTP_PORT || 5550;\n const redisHttpPort = process.env.REDIS_QUEUE_PORT || 6379;\n const redisHttpHost = process.env.REDIS_QUEUE_HOST || '127.0.0.1';\n const redisPrefix = process.env.REDIS_QUEUE_DB || 'q';\n const redisDB = process.env.REDIS_QUEUE_PREFIX || 3;\n return {\n appSecret,\n apiPrefix,\n company,\n copyright,\n description,\n isCORSEnabled,\n jwtExpiresIn,\n keywords,\n logDays,\n maxUploadLimit,\n maxParameterLimit,\n mongooseUrl,\n name,\n port,\n redisDB,\n redisHttpPort,\n redisHttpHost,\n redisPrefix,\n url,\n queueMonitor,\n queueMonitorHttpPort\n };\n }", "function loadFile() //loads settings on first load of app\n{\n\ttry {\n\t\tlet rawdata = fs.readFileSync(configFile);\n\t\tlet myJson = JSON.parse(rawdata);\n\n\t\tif (myJson.port_udp)\n\t\t{\n\t\t\tconfig.port_udp = myJson.port_udp;\n\t\t}\n\t\n\t\tif (myJson.port_serial)\n\t\t{\n\t\t\tconfig.port_serial = myJson.port_serial;\n\t\t}\n\n\t\tif (myJson.baudRate) {\n\t\t\tconfig.baudRate = myJson.baudRate;\n\t\t}\n\t}\n\tcatch(error) {\n\t\tconsole.log('Error parsing config file:');\n\t\tconsole.log(error);\n\t}\n}", "function makeConfig(\n env /*: { [key: string]: ?string } | typeof undefined */\n) /*: Config */ {\n env = env || process.env;\n\n return {\n publicRuntimeConfig: {\n assetPrefix: makeAssetPrefix(env),\n // This is set by our standard deployment process.\n cacheParam: (env.GIT_REVISION && env.GIT_REVISION.substring(0, 8)) || '',\n graphqlApiKey: env.WEB_API_KEY || '',\n liveAgentButtonId: env.LIVE_AGENT_BUTTON_ID || '',\n cloudinaryUrl: `https://api.cloudinary.com/v1_1/${env.CLOUDINARY_CLOUD ||\n ''}`,\n cloudinaryUploadPreset: env.CLOUDINARY_UPLOAD_PRESET || '',\n mapboxAccessToken: env.MAPBOX_ACCESS_TOKEN || '',\n mapboxStylePath: env.MAPBOX_STYLE_PATH || '',\n },\n\n serverRuntimeConfig: {},\n };\n}", "function initBackground() {\n // Check config, init sequences\n chrome.storage.local.get(null, function(items) {\n\n // Get local strage, if undefined, Set default values\n let myLocation = items.myLocation || 'APAC';\n let instanceKeys = items.instanceKeys || ['AP0', 'CS5'];\n let intervalMin = items.intervalMin || '60';\n\n // Restore(Init) Configs\n chrome.storage.local.set({\n 'myLocation': myLocation,\n 'instanceKeys': instanceKeys,\n 'intervalMin': intervalMin,\n }, function() {\n\n // Init Instance List\n updateInstances();\n\n // Init Trust Data\n updateTrust();\n\n // Setup New-Timer\n resetUpdateTrustTimer();\n });\n });\n}", "function setEnvConfig(mode){\n if (mode == 'test') {\n console.warn('Running in testmode.'); \n environment = 'test';\n } else {\n environment = 'prod';\n }\n var config = ENV_SETTINGS[0][environment];\n console.log({'message': 'Loaded configuration settings for ' + environment + '.', \n 'ENV_CONFIG': config});\n return config;\n}", "function init() {\n\n\t\t\t// Shim for forEach for IE/Edge\n\t\t\tif (typeof NodeList.prototype.forEach !== 'function') {\n\t\t\t\t\t\tNodeList.prototype.forEach = Array.prototype.forEach;\n\t\t\t}\n\t\t\t_config2.default.browserUtils = new _BrowserUtils2.default();\n\t\t\t_config2.default.launchScreen = new _LaunchScreen2.default();\n\n\t\t\t_config2.default.learningSection = new _LearningSection2.default(document.querySelector('#learning-section'));\n\t\t\t_config2.default.inputSection = new _InputSection2.default(document.querySelector('#input-section'));\n\t\t\t_config2.default.outputSection = new _OutputSection2.default(document.querySelector('#output-section'));\n\t\t\t_config2.default.recordOpener = new _RecordOpener2.default(document.querySelector('#record-open-section'));\n\n\t\t\t_config2.default.inputSection.ready();\n\t\t\t_config2.default.learningSection.ready();\n\t\t\t_config2.default.wizard = new _Wizard2.default();\n\t\t\t_config2.default.recordSection = new _Recording2.default(document.querySelector('#recording'));\n\t\t\tif (localStorage.getItem('isBackFacingCam') && localStorage.getItem('isBackFacingCam') === 'true') {\n\t\t\t\t\t\t_config2.default.isBackFacingCam = true;\n\t\t\t}\n}", "function envVars(config) {\n if (process.env.AMQP_URL && !config.host) {\n config.host = process.env.AMQP_URL;\n }\n\n if (process.env.LOCAL_QUEUE && !config.consumerSuffix) {\n config.consumerSuffix = process.env.LOCAL_QUEUE;\n }\n\n if (process.env.AMQP_DEBUG) {\n try {\n config.transport = logger;\n } catch (e) {\n config.transport = console;\n }\n }\n}", "function _getSettings(){\n var keys = ManagerSettings.getKeys();\n keys.forEach(function(key){\n settings[key] = ManagerSettings.get(key)\n }); // keys.forEach\n}", "function init() {\n\tspeechEngine = Homey.manager('speech-output');\n\tHomey.log('NU.nl news app loaded.');\n\t\n\t// Create settings variables with default values if none seem to exist\n\tif (!Homey.manager('settings').get('mode')) {\n\t\tHomey.manager('settings').set('mode', 'title');\n\t\tHomey.log('Created setting: mode');\n\t}\n\tif (!Homey.manager('settings').get('max')) {\n\t\tHomey.manager('settings').set('max', 10);\n\t\tHomey.log('Created setting: max');\n\t}\n}", "function enviroGetSettings () {\n\t document.querySelector('[environment]').components['environment'].logPreset();\n\t}", "function init() {\n\t\tmasonryConfig();\n\t\towlCarouselConfig();\n\t\tisotopeConfig();\n\t\tmagnificPopupConfig() \n\t\tcontactValidateConfig()\n\t\tparallaxEffect();\n\t\tinternalMenu();\n\t\tflipMenuInit()\n\t}", "addEnv() {\n this.config = Object.assign(this.config, process.env);\n }", "loadSettings() {\n try {\n let displaySettingsChanged = false;\n let json = localStorage.getItem(\"weather-settings\");\n if (json == null) {\n json = localStorage.getItem(\"settings\");\n if (json) {\n localStorage.setItem(\"weather-settings\", json);\n localStorage.removeItem(\"settings\");\n }\n }\n\n let settings = Object.assign(WeatherDefaultSettings, JSON.parse(json || \"{}\"));\n\n // Clock settings\n if (this.language() !== settings.language) {\n this.language(settings.language);\n displaySettingsChanged = true;\n }\n if (this.units() !== settings.units) {\n this.units(settings.units);\n displaySettingsChanged = true;\n }\n if (this.twelveHourTime() !== settings.twelveHourTime) {\n this.twelveHourTime(settings.twelveHourTime);\n displaySettingsChanged = true;\n }\n if (this.useLocationTime() !== settings.useLocationTime) {\n this.useLocationTime(settings.useLocationTime);\n displaySettingsChanged = true;\n }\n if (this.hoursAhead() !== settings.hoursAhead) {\n this.hoursAhead(settings.hoursAhead);\n displaySettingsChanged = true;\n }\n if (this.daysAhead() !== settings.daysAhead) {\n this.daysAhead(settings.daysAhead);\n displaySettingsChanged = true;\n }\n if (this.useTwitterEmoji() !== settings.useTwitterEmoji) {\n this.useTwitterEmoji(settings.useTwitterEmoji);\n displaySettingsChanged = true;\n }\n\n // Display settings that don't require re-post\n this.displayHumidity(settings.displayHumidity);\n\n // Location settings\n this.defaultLatitude(settings.latitude);\n this.defaultLongitude(settings.longitude);\n this.useGeolocation(settings.useGeolocation);\n this.useTwitterEmoji(settings.useTwitterEmoji);\n\n this.theme(settings.theme || \"compact-light\");\n\n // If one of the time display settings changed, we'll want to refresh.\n // Otherwise, we only need to refresh if our location has changed.\n this.update(displaySettingsChanged ? true : false);\n } catch (e) {\n console.error(e);\n this.error(\"Could not load settings.\");\n }\n }", "function firstInitSettings() {\r\n\tlog(0, 'One time settings init called');\r\n\tsettings = {\r\n\t\ttileSize: 30,\r\n\t\tplayerSize: 20,\r\n\t\tdc: 0.85,\r\n\t\tmap: Maps[0].map,\r\n\t\tmapInfo: Maps[0].data,\r\n\t\twallsBreak: true,\r\n\t\tdefaultGun: 'pistol',\r\n\t\tgamemode: '',\r\n\t\tkillsToWin: 10,\r\n\t\titemSpawnRates: 30,\r\n\t\tblockHP: 1000,\r\n\t\tspawnTime: 0,\r\n\t\ttickLimiter: tickLimiter,\r\n\t\tteamMode: false,\r\n\t\tteams: 0,\r\n\t\tlives: 0,\r\n\t\tnumBots: 0,\r\n\t\toverrideEndGame: false,\r\n\t};\r\n\tsettingTypes = {\r\n\t\ttileSize: 'unchange',\r\n\t\tplayerSize: 'unchange',\r\n\t\tdc: 'number',\r\n\t\tmap: 'unchange',\r\n\t\tmapInfo: 'unchange',\r\n\t\twallsBreak: 'bool',\r\n\t\tteamMode: 'bool',\r\n\t\tdefaultGun: Object.getOwnPropertyNames(Guns),\r\n\t\tgamemode: Object.getOwnPropertyNames(GameModes),\r\n\t\tkillsToWin: ['1', '5', '10', '15', '25'],\r\n\t\titemSpawnRates: 'number',\r\n\t\tblockHP: ['1', '100', '250', '500', '1000', '5000'],\r\n\t\tspawnTime: ['1', '3', '5', '10'],\r\n\t\ttickLimiter: 'unchange',\r\n\t\tteams: ['1', '2', '3', '4'],\r\n\t\tlives: ['0', '1', '2', '3', '5', '10'],\r\n\t\tnumBots: ['0', '1', '2', '4', '8', '10'],\r\n\t\toverrideEndGame: 'unchange',\r\n\t\tisTypeList: true\r\n\t};\r\n}", "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}", "function loadAppSettings() {\n\twindow.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fs) {\n\t\tconsole.log('loadAppSettings() successfully accessed filesystem: ' + fs.name);\n\t\t\n\t\treadAppSettings('appSettings.json', fs);\n\t},\n\tfunction(fileSystemError) {\n\t\talert(fileSystemError);\n\t});\n}", "loadCustomConfig() {\n try {\n const config = require(`${process.cwd()}/config/server.js`) || {};\n\n this._config = merge.all([this._config, config]);\n } catch (err) {\n if (!err.code || err.code !== 'MODULE_NOT_FOUND') {\n throw err;\n }\n }\n }", "_setDefaultThemeSettings() {\n this.themeSettings = {\n theme: { theme: \"system\", dark: false },\n fontColor: \"#1E1E1E\",\n fontFamily: \"Quicksand, Roboto,'Open Sans','Rubik','Helvetica Neue', 'Helvetica', 'Arial', sans-serif\",\n gridlineColor: \"1E1E1E\",\n zeroLineColor: \"#333333\",\n tooltipsBackground: \"#ecf0f1\",\n tooltipsFontColor: \"#647687\",\n showGridLines: CT_CHARTGRIDLINES.includes(this.chart_type.toLowerCase()) || false,\n secondaryAxis: false,\n gridLineWidth: 1.0,\n borderDash: [1, 1],\n padding: {\n top: 20,\n right: 24,\n bottom: 12,\n left: 24\n },\n useAnimations: true,\n locale: this.chart_locale\n }\n }", "_setDefaultThemeSettings() {\n this.themeSettings = {\n theme: { theme: \"system\", dark: false },\n fontColor: \"#1E1E1E\",\n fontFamily: \"Quicksand, Roboto,'Open Sans','Rubik','Helvetica Neue', 'Helvetica', 'Arial', sans-serif\",\n gridlineColor: \"1E1E1E\",\n zeroLineColor: \"#333333\",\n tooltipsBackground: \"#ecf0f1\",\n tooltipsFontColor: \"#647687\",\n showGridLines: CT_CHARTGRIDLINES.includes(this.chart_type.toLowerCase()) || false,\n secondaryAxis: false,\n gridLineWidth: 1.0,\n borderDash: [1, 1],\n padding: {\n top: 20,\n right: 24,\n bottom: 12,\n left: 24\n },\n useAnimations: true,\n locale: this.chart_locale\n }\n }", "function setupConfig(data, textStatus, jqXHR) {\n\t\tif (data !== null) {\n\t\t\tthat.loadedConfig = data;\n\t\t}\n if (!that.loadedConfig) {\n // fall back to defaults\n that.loadedConfig = that.siteDefaults;\n }\n\t\tsite = that.loadedConfig;\n\t\tinitContinued();\n\t}", "function init() {\n\t\tif (!localStorage.getItem(SETTINGS_NAME)){\n\t\t\tlocalStorage.setItem(SETTINGS_NAME, JSON.stringify({}))\n\t\t}\n\n\t\t$('#importButton').click(() => {\n\t\t\tlet importSuccess = importSettingsHanlder($('textarea#importExportTextarea').val())\n\t\t\tif (importSuccess) {\n\t\t\t\tmarkProblem('textarea#importExportTextarea', false)\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmarkProblem('textarea#importExportTextarea', true)\n\t\t\t}\n\t\t})\n\n\t\t$('#exportButton').click(() => {\n\t\t\t$('textarea#importExportTextarea').val(exportSettings())\n\t\t})\n\n\t\t$('#downloadSettingsLink').click(() => {\n\t\t\tlet link = document.getElementById('downloadSettingsLink');\n\t\t\tlink.href = makeTextFile(localStorage.getItem(SETTINGS_NAME))\n\t\t\t$('#downloadSettingsLink').attr('download', `rph-tools-settings.txt`)\n\t\t})\n\n\t\t$('#importFileInput').change(() => {\n\t\t\tlet file = $(\"#importFileInput\")[0].files[0];\n\t\t\t(async () => {\n\t\t\t\tfileContent = await file.text();\n\t\t\t\tlet successfulImport = importSettingsHanlder(fileContent)\n\n\t\t\t\tif (successfulImport === false) {\n\t\t\t\t\t$('#importSettingsStatus').first().text('There was a problem with the import')\t\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$('#importSettingsStatus').first().text('Import successful')\n\t\t\t\t}\n\t\t\t})();\n\t\t})\n\t\n\n\t\t$('#printSettingsButton').click(() => {\n\t\t\tprintSettings()\n\t\t})\n\n\t\t$('#deleteSettingsButton').click(() => {\n\t\t\tdeleteSettingsHanlder()\n\t\t})\n\t}", "async loadEnvironmentParameterValues(){}", "_boot(){\r\n\t\tvar core = this;\r\n\t\tif(core._app_conf._template_dir != -1){\r\n\t\t\t\tcore._app_initialized = true;\r\n\t\t} else {\r\n\t\t\t\tcore._rest(\"POST\", core._app_conf._api_url, [[\"api\", \"template_get_dir\"]], core._app_conf, \"_template_dir\");\r\n\r\n\t\t\t// Wait until all the config variables are all retrieved\r\n\t\t\tvar _tmpVarCheck = setInterval(function(){\r\n\r\n\t\t\t\tif(core._app_verbose) console.log(\"Initializing application...\");\r\n\t\t\t\tif(core._app_conf._template_dir != -1){\r\n\t\t\t\t\tcore._app_initialized = true;\r\n\t\t\t\t\tclearInterval(_tmpVarCheck);\r\n\t\t\t\t}\r\n\t\t\t}, 1);\r\n\t\t}\r\n\t}", "static load (environment) {\n TestData.environment = environment || 'stage'\n\n let configData\n let testData\n\n try {\n const cdFile = path.join(configPath, `cd_${TestData.environment}.yml`)\n configData = yaml.safeLoad(fs.readFileSync(cdFile, 'utf8'))\n } catch (e) {\n console.log(`Unable to load config data for ${TestData.environment}!`)\n throw e\n }\n\n try {\n const tdFile = path.join(configPath, `td_${TestData.environment}.yml`)\n testData = yaml.safeLoad(fs.readFileSync(tdFile, 'utf8'))\n } catch (e) {\n console.log(`Unable to load ${TestData.environment} test data!`)\n throw e\n }\n\n try {\n TestData.data = _.merge(configData, testData)\n } catch (e) {\n console.log('Unable to load test data!')\n console.log(e)\n }\n }", "function settingSetup(){\n\tif(settings.get('network') === undefined){ settings.set('network', 'bitmark'); }\n\tif(settings.get('auto_update') === undefined){ settings.set('auto_update', true); }\n if(settings.get('directory') === undefined){ settings.set('directory', dataDir); }\n if(containerState === undefined){containerState='norun';}\n if(prevState === undefined){prevState='undefined';}\n}", "function settingSetup() {\n if (settings.get('network') === undefined) {\n settings.set('network', 'bitmark');\n }\n if (settings.get('auto_update') === undefined) {\n settings.set('auto_update', true);\n }\n if (settings.get('auto_ip') === undefined) {\n settings.set('auto_ip', true);\n }\n if (settings.get('ip') === undefined) {\n settings.set('ip', `xxx.xxx.xxx.xxx`);\n }\n if (settings.get('directory') === undefined) {\n settings.set('directory', dataDir);\n }\n\n // setup docker directory, in case environment variable PATH is not exist\n const cmd = getDockerPath().concat('docker');\n settings.set('docker_cmd', cmd);\n\n return new Promise((resolve) => {\n resolve();\n });\n}", "function getConfig() {\n // if you pass ?dev=true to your url address default config that will be used is `config-development`\n // otherwise - `config-production`\n var configName = getParameterByName('dev', false) ? 'env' : 'env';\n\n window._config || (window._config = {});\n\n // for production version you should concat your config with main script or put it above main script\n // inside global `_config` variable for example\n if (window._config[configName]) return window._config[configName];\n\n // for development version you can just make an ajax call to get the config\n $.ajax({\n url : '/static/' + configName + '.json',\n async : false,\n success : function(response) {\n window._config[configName] = response;\n }\n });\n return window._config[configName];\n}", "static getDatabaseConfig() {\n return {\n LOCAL: 'local',\n DEVELOPMENT: 'development',\n STAGING: 'staging',\n PRODUCTION: 'production',\n environment: {\n 'local': {config: 'mongodb://localhost:27017/tutorial-local'},\n 'development': {config: 'mongodb://localhost:27017/tutorial-develop'},\n 'staging': {config: 'mongodb://localhost:27017/tutorial-staging'},\n 'production': {config: 'mongodb://localhost:27017/tutorial-production'}\n }\n };\n }", "_setScreenConfig() {\n Settings.SCREEN_PROPS = Utils.getScreenProps();\n\n this.config.width = Settings.SCREEN_PROPS.calculatedWidth;\n this.config.height = Settings.SCREEN_PROPS.calculatedHeight;\n this.config.zoom = Settings.SCREEN_PROPS.calculatedZoom;\n\n this.config.autoResize = false;\n this.config.backgroundColor = '#000000';\n this.config.pixelArt = true;\n }", "function configure(root) {\n var environment = new Mincer.Environment(root);\n\n //\n // Provide some helpers to EJS and Stylus\n //\n\n environment.registerHelper({\n asset_path: function (pathname) {\n var asset = environment.findAsset(pathname);\n return !asset ? null : (\"/assets/\" + asset.digestPath);\n },\n N: function (path) {\n return treeGet(N, path);\n },\n jason: JASON.stringify\n });\n\n //\n // fill in 3rd-party modules paths\n //\n\n environment.appendPath(path.resolve(__dirname, '../../../../node_modules/nlib/node_modules/pointer/browser'));\n environment.appendPath(path.resolve(__dirname, '../../../../node_modules/nlib/node_modules/babelfish/browser'));\n\n //\n // fill in base assets (non-themable) of all apps\n //\n\n _.each(N.runtime.apps, function (app) {\n environment.appendPath(path.join(app.root, 'assets/javascripts'));\n environment.appendPath(path.join(app.root, 'assets/stylesheets'));\n environment.appendPath(path.join(app.root, 'assets/vendor'));\n });\n\n //\n // add embedded fonts path\n //\n\n environment.appendPath(path.join(\n N.runtime.apps[0].root, 'assets/embedded_fonts'\n ));\n\n //\n // add root path itself\n //\n\n environment.appendPath('.');\n\n //\n // Set JS/CSS compression if it was not explicitly disabled\n // USAGE: SKIP_ASSETS_COMPRESSION=1 ./N.js server\n //\n\n if (!process.env.SKIP_ASSETS_COMPRESSION) {\n environment.jsCompressor = compression.js;\n environment.cssCompressor = compression.css;\n }\n\n return environment;\n}", "function initEnvPools(cb) {\n\tlogger.info('initEnvPools');\n\tenvPools = {};\n\n\tvar envs = _.without(_.keys(Conf.db), 'default');\n\n\tlogger.debug('initializing pools', envs);\n\n\tasync.each(envs, function(env, callback) {\n\t\tvar c = Conf.db[env];\n\n\t\tvar poolOpts = {\n\t\t\thost: c.HOST,\n\t\t\tport: c.PORT,\n\t\t\tenv: env,\n\t\t\tuser: c.USER,\n\t\t\tpassword: c.PASS,\n\t\t\tlogger: hdbPoolLogger,\n\t\t\tmaxPoolSize: c.POOL_SIZE,\n\t\t\tidleTimeoutMillis: c.POOL_TTL_MS || 30000,\t// specifies how long a resource can stay idle in pool before being removed\n\t\t\tgenericPoolLog: c.POOL_LOG,\n\t\t\tresphPrefix: Conf.http.HEADER_PREFIX || 'x-hdb-',\n\t\t\tdefaultSchema: c.DEFAULT_SCHEMA || c.SCHEMA\n\t\t};\n\n\t\tenvPools[env] = hdbPool.createPool(poolOpts);\n\n\t\t// get system_id, host, and version\n\t\tenvPools[env].exec('SELECT system_id SID, host, version FROM M_DATABASE', [], function(err, rows) {\n\n\t\t\tif (err || rows.length !== 1) {\n\t\t\t\treturn callback('Error while getting system information on ' + env);\n\t\t\t}\n\n\t\t\tSYSFOOTPRINT[env] = rows[0];\n\t\t\tlogger.debug('System information updated on ' + env);\n\t\t\treturn callback();\n\t\t});\n\t}, function(err) {\n\t\tif (cb)\n\t\t\treturn cb(err);\n\t});\n}", "_load_configuration() {\n let _self = this;\n let ajaxDone = function(json) {\n // Setting kytos URL location\n SDNLG_CONF.setKytosServer(json.jsonData.kytos_url);\n\n _self._appConfigLoading = false;\n _self._appInitialized = true;\n\n for(let callback of _self._initializationCallbacks) {\n callback();\n }\n\n _self._initialize_libs();\n };\n\n // AJAX call\n $.ajax({\n url: \"/api/plugins/grafana-amlight-app-sdnlg/settings\",\n dataType: 'json'\n })\n .done(function(json) {\n ajaxDone(json);\n })\n .fail(function() {\n console.log( \"load_configuration ajax error\" );\n })\n .always(function() {\n console.log( \"load_configuration ajax complete\" );\n });\n }", "function loadConfig() {\n try {\n appConfig = require(\"./config/app-config.json\");\n if (typeof appConfig.token === \"undefined\" || appConfig.token === \"\") {\n Logger.log(\"Missing **token** in **app-config.json**.\", \"err\");\n process.exit();\n }\n if (typeof appConfig.applicationId === \"undefined\" || appConfig.applicationId === \"\") {\n Logger.log(\"Missing **applicationId** in **app-config.json**.\", \"err\");\n process.exit();\n }\n if (typeof appConfig.oauth2Secret === \"undefined\" || appConfig.oauth2Secret === \"\") {\n Logger.log(\"Missing **oauth2Secret** in **app-config.json**.\", \"err\");\n process.exit();\n }\n if (typeof appConfig.redirectURI === \"undefined\" || appConfig.redirectURI === \"\") {\n Logger.log(\"Missing **redirectURI** in **app-config.json**.\", \"err\");\n process.exit();\n }\n } catch (err) {\n Logger.log(\"Please run **npm install** and set up the application config.\", \"err\");\n process.exit();\n return;\n }\n\n}", "static get defaults(){\n\t\treturn {\n\t\t grid: {\n\t\t base:\t\t\"16px\",\n\t\t columns: \t12,\n\t\t gutter:\t \t.5,\n\t\t sizes:{\n\t\t xxs: \t.25,\n\t\t xs: \t.5,\n\t\t s: \t.75,\n\t\t m: \t1,\n\t\t l: \t1.5,\n\t\t xl: \t2,\n\t\t xxl: \t4\n\t\t }\n\t\t },\n\n\t\t breakpoints: {\n\t\t xxs: \t\"320px\",\n\t\t xs: \t\"375px\",\n\t\t s: \t\"425px\",\n\t\t m: \t\"768px\",\n\t\t l: \t\"1024px\",\n\t\t xl: \t\t\"1200px\",\n\t\t xxl: \t\"1440px\"\n\t\t }\n\t\t};\n\t}", "function _initialize() {\n\n /* FUTURE - revisit how we handle user config option overrides in a way that\n doesn't prevent us from updating shipped config option values. */\n try {\n // Try to read the Load the user options synchronously\n if(fs.existsSync(testOptionsFile)){\n userOptions = fs.readFileSync(testOptionsFile);\n }\n else\n userOptions = fs.readFileSync(userOptionsFile);\n userOptions = userOptions || \"{}\";\n userOptions = JSON.parse(userOptions.toString());\n } catch(e) {\n userOptions = defaultOptions;\n }\n\n checkUserOptions();\n\n dynamicOptions = {};\n\n // Added default options to dynamic options\n deepExtend(dynamicOptions, defaultOptions);\n\n // Add user options to dynamic options\n deepExtend(dynamicOptions, userOptions);\n\n}" ]
[ "0.6649135", "0.65116197", "0.6336812", "0.6107835", "0.60296214", "0.60022235", "0.5945021", "0.5836192", "0.5830076", "0.58182466", "0.57766944", "0.5773866", "0.5751086", "0.57258976", "0.5690169", "0.56866306", "0.56727606", "0.5663735", "0.56448025", "0.56324464", "0.562579", "0.5609508", "0.56066495", "0.5592851", "0.55864966", "0.5586132", "0.55660665", "0.55256134", "0.55060214", "0.5489817", "0.54748946", "0.5465731", "0.5462688", "0.54466486", "0.5442452", "0.54168534", "0.53962296", "0.5394984", "0.53696567", "0.5355063", "0.5325188", "0.5318747", "0.53102034", "0.53090566", "0.5292347", "0.52908444", "0.52773064", "0.5267972", "0.525357", "0.52461237", "0.5242226", "0.5222882", "0.52201647", "0.5194532", "0.51816595", "0.5175721", "0.5171061", "0.5158601", "0.5146376", "0.5131842", "0.5122102", "0.51184875", "0.51147956", "0.5113081", "0.51073366", "0.5096236", "0.5094329", "0.50943077", "0.5091145", "0.5085837", "0.5081957", "0.5079588", "0.50772935", "0.5065856", "0.5047639", "0.5046786", "0.5041799", "0.50412405", "0.5036589", "0.5032654", "0.5031918", "0.50270844", "0.5026965", "0.5026965", "0.50222", "0.502114", "0.5012651", "0.50121003", "0.5011418", "0.50080425", "0.500319", "0.49972883", "0.4995176", "0.498829", "0.4988199", "0.49767622", "0.49766856", "0.49758598", "0.497489", "0.49703667" ]
0.6135992
3
Binds the constants, service providers and class dependencies to the object container.
_bindDependencies() { this._oc.setBindingState(ObjectContainer.IMA_BINDING_STATE); this._config.initBindIma( ns, this._oc, this._config.bind, ObjectContainer.IMA_BINDING_STATE ); this._config.plugins .filter(plugin => typeof plugin.module.initBind === 'function') .forEach(plugin => { this._oc.setBindingState( ObjectContainer.PLUGIN_BINDING_STATE, plugin.name ); plugin.module.initBind(ns, this._oc, this._config.bind, plugin.name); }); this._oc.setBindingState(ObjectContainer.APP_BINDING_STATE); this._config.initBindApp( ns, this._oc, this._config.bind, ObjectContainer.APP_BINDING_STATE ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n /**\n * Set of registered bindings.\n *\n * A binding is a definition of how to create an object and an\n * identifier for that object within the container.\n *\n * @private\n * @type {Map.<string, {factory: Function, singleton: boolean}>}\n */\n this.bindings = new Map();\n\n /**\n * Set of concrete object instances.\n *\n * @private\n * @type {Map.<string, *>}\n */\n this.instances = new Map();\n\n /**\n * Set of aliases for bindings or instances.\n *\n * @private\n * @type {Map.<string, string>}\n */\n this.aliases = new Map();\n }", "function _resolve() {\n\t// low level dependencies need to be resolved first\n\t_adapters.resolve(_container)\n\t_services.resolve(_container)\n}", "constructor() {\n super();\n this._initBinder();\n }", "function _resolve() {\n \n // low level dependencies need to be resolved first\n _adapters.resolve(_container);\n _repositories.resolve(_container);\n _services.resolve(_container);\n}", "static get BINDINGS() { return _PROVIDERS; }", "register() {\n\t\tthis.loadAndPublishConfig(this.app.formatPath(__dirname, 'config'));\n\t\tthis.bindConnectionBuilder();\n\t\tthis.bindConnector();\n\t\tthis.bindFactoryService();\n\t\tthis.bindModelRepository();\n\t\tthis.bindORM();\n\t\tthis.bindResolver();\n\t}", "register() {\n this.bindConfigGrammar();\n this.bindEvaluator();\n this.bindConfigRepository();\n this.bindEnvironmentRepository();\n this.registerConfiguredProviders();\n }", "constructor() { \n autoBind(this); \n }", "function setup() { \n container.register({\n //controllers\n CartController: awilix.asClass(CartController),\n CartItemController: awilix.asClass(CartItemController),\n UserController: awilix.asClass(UserController),\n // services \n userService: awilix.asClass(userService),\n cartService: awilix.asClass(cartService),\n cartItemService: awilix.asClass(cartItemService),\n\n // repository \n pharmacyUserRepository: awilix.asClass(pharmacyUserRepository),\n supplierUserRepository: awilix.asClass(supplierUserRepository),\n orderRepository: awilix.asClass(orderRepository),\n cartRepository: awilix.asClass(cartRepository),\n cartItemRepository: awilix.asClass(cartItemRepository),\n requestRepository: awilix.asClass(requestRepository),\n\n // inject object with database connection pooling\n db2: awilix.asValue(db2.default), \n // DAO\n mongoDao: awilix.asValue(mongoDao), \n });\n}", "register() {\n\t\tthis.loadAndPublishConfig(this.app.formatPath(__dirname, 'config'));\n\t\tthis.bindHttpClient();\n\t\tthis.bindHttpServer();\n\t\tthis.bindRouter();\n\t\tthis.bindRouteHandler();\n\t\tthis.bindHttpErrorMapper();\n\t\tthis.bindRouteRepository();\n\t\tthis.bindControllerRepository();\n\t}", "function Bindr() {\n // Save all of the injections.\n this.injections = {};\n}", "function ServiceLocator() {\n this.dependencyMap = {};\n this.dependencyCache = {};\n}", "register() {\n this.loadAndPublishConfig(this.app.formatPath(__dirname, 'config'));\n this.bindHttpClient();\n this.bindHttpServer();\n this.bindRouter();\n this.bindRouteHandler();\n this.bindHttpErrorMapper();\n this.bindRouteRepository();\n this.bindControllerRepository();\n }", "function Container() {\n this.factories = {};\n this.instances = {};\n this.fns = {};\n}", "bindResolver() {\n\t\tthis.app.singleton('db.resolver', Resolver);\n\t}", "function ModuleWithProviders() { }", "function ModuleWithProviders() { }", "constructor() {\n super();\n this.services = null;\n this.instances = null;\n this.classBuilder = new ClassBuilder();\n }", "constructor() {\n super(...arguments);\n\n this.appConfig = getOwner(this).resolveRegistration('config:environment');\n\n }", "constructor() {\n this.dataService = new DataService();\n this.emailService = new EmailService();\n this.queueService = new QueueService();\n }", "function DependencyInjector(config) {\n this.deps = {};\n if(config) {\n _.extend(this.deps, config);\n }\n}", "function ServiceContainer(){\n\t/**\n\t * Contains service handlers, indexed by name.\n\t * @type {Object.<string,function>}\n\t * @private\n\t */\n\tthis._serviceFunctions = {};\n\t/**\n\t * Stores static resources, passed as the first argument to every service called (via bind, when requesting the service). String-keyed with arbitrary values.\n\t * Note that this map does not constitute the full nor the final dependencies passed as the first argument - they may be added or overriden by dynamically-generated resources at service call time.\n\t * @type {Object}\n\t * @private\n\t */\n\tthis._resources = {};\n}", "function ContainerBinding(container) {\n _super.call(this);\n /*============================================================================*/\n /* Private Properties */\n /*============================================================================*/\n this._handlers = [];\n this._container = container;\n }", "function ModuleWithProviders(){}", "function ModuleWithProviders() {}", "function ModuleWithProviders() {}", "function ModuleWithProviders() {}", "constructor(config = {}) {\n this.options = {};\n\n /**\n * The resolver functions for each service.\n */\n this.serviceResolvers = {};\n\n /**\n * The services that should be resolved together.\n */\n this.serviceGroups = {};\n\n /**\n * Services that have been resolved and are accessible from\n * the container.\n */\n this.resolvedServices = {};\n\n /**\n * The callbacks for each service to be called when the\n * service is first resolved.\n */\n this.resolverCallbacks = {};\n\n /**\n * The dependency tree for registered services.\n */\n this.dependencyTree = {};\n\n this.options.config = config;\n\n return new Proxy(() => {}, this);\n }", "function InjectableType(){}", "__construct(parameterBag) {\n super.__construct(parameterBag);\n\n /**\n * @type {Object<string, Jymfony.Component.DependencyInjection.ExtensionInterface>}\n * @private\n */\n this._extensions = {};\n\n /**\n * @type {Object<string, [Object<string, *>]>}\n * @private\n */\n this._extensionConfigs = {};\n\n /**\n * @type {Object<string, Jymfony.Component.DependencyInjection.Definition>}\n * @private\n */\n this._definitions = {};\n\n /**\n * @type {Object<string, Jymfony.Component.DependencyInjection.Alias>}\n * @private\n */\n this._aliasDefinitions = {};\n\n /**\n * @type {Jymfony.Component.Config.Resource.ResourceInterface[]}\n * @private\n */\n this._resources = [];\n\n /**\n * @type {boolean}\n * @private\n */\n this._trackResources = ReflectionClass.exists('Jymfony.Component.Config.Resource.ResourceInterface');\n\n this.setDefinition(\n 'service_container',\n (new Definition('Jymfony.Component.DependencyInjection.Container'))\n .setSynthetic(true)\n .setPublic(true)\n );\n }", "registerHTTPContext() {\n this.application.container.bind('Adonis/Core/HttpContext', () => {\n const { HttpContext } = require('../src/HttpContext');\n HttpContext.app = this.application.container.resolveBinding('Adonis/Core/Application');\n return HttpContext;\n });\n }", "prepareContract(contract) {\n let options = contract.options,\n classRefStr = contract.classRef.toString();\n\n // `params` is a list of constructor arguments\n if (!contract.params)\n {\n // Check if there is an injectable list\n if (!options.inject && options.autodetect !== false)\n {\n options.inject = this.extractInjectParams(classRefStr);\n }\n }\n\n // --debug-start--\n if (options.inject && options.augment)\n {\n console.warn(`#register(${contractStr}): the 'inject' setting will be used instead of 'augment'`);\n }\n // --debug-end--\n \n\n // Keep it simple; using both is not allowed\n if (!options.inject && options.augment)\n {\n contract.classRef = this.augment(classRef, classRefStr);\n }\n }", "bindCorrectContext() {\n this.listenForServices = this.listenForServices.bind(this);\n this.onAuthorizationCompleted = this.onAuthorizationCompleted.bind(this);\n }", "bindFactoryService() {\n\t\tthis.app.singleton('db.factory', Factory);\n\t}", "constructor(){\n\n this._ngAppName = APP_NAMESPACE;\n\n this._ngDependencies = [\n // 'ngAnimate',\n // 'ngTouch'\n ];\n\n this._ngControllers = [\n {\n name: 'TSTCarouselController',\n class: CarouselController\n },\n {\n name: 'TSTFormController',\n class: FormController\n },\n {\n name: 'TSTHeroController',\n class: HeroController\n },\n {\n name: 'TSTEventsController',\n class: EventsController\n }\n ];\n\n this._ngServices = [\n\n ];\n\n this._ngDirectives = [\n {\n name: 'tstMobileMenu',\n class: mobileMenuDirective\n }\n ];\n\n this._init();\n\n }", "function initModules() {\n model_store = new Soapify.model_store();\n vc_navbar = new Soapify.viewcontroller_navbar();\n vc_info = new Soapify.viewcontroller_info();\n vc_map = new Soapify.viewcontroller_map(model_store);\n vc_contact = new Soapify.viewcontroller_contact();\n }", "function inject(){\n interceptor({\n path: interceptorPath\n })(app);\n\n service({\n path: servicePath\n })(app);\n\n middleware({\n path: middlewarePath\n })(app);\n\n if(config.isDebug){\n require('@root/devserver')(app, config.proxy);\n }\n\n router({\n path: controllerPath\n })(app);\n}", "constructor(props) { super(props); autoBind(this); }", "init() {\n module_utils.patchModule(\n 'ldapjs',\n 'bind',\n bindWrapper,\n ldapjs => ldapjs.Client.prototype\n );\n }", "_initServices() {\n this.workbenchCoreSerivce = new WorkbenchCoreService();\n this.authTwoService = new AuthTwoService();\n }", "constructor(container) {\n this.container = container;\n }", "constructor() {\n // map with module filenames as keys\n this.modules = {};\n // global options\n this.options = {\n enableWrapping: true\n }\n }", "function BindFactory(){}", "function defineInjector(options){return{factory:options.factory,providers:options.providers||[],imports:options.imports||[]};}", "static get $inject() {\n return ['$http', '$rootScope', '$log', 'AuthService'];\n }", "constructor(commonService, homeService, titleService) {\n this.commonService = commonService;\n this.homeService = homeService;\n this.titleService = titleService;\n }", "autoBind() {\n this.bind(\n Object.getOwnPropertyNames(this.constructor.prototype)\n .filter(prop => typeof this[prop] === 'function')\n );\n }", "defineComponents() {\r\n this.components.forEach(Component => {\r\n this[Component.name] = new Component();\r\n });\r\n }", "setupServices() {\n // Setup services\n const coveringService = new this.hap.Service.WindowCovering();\n coveringService\n .getCharacteristic(this.hap.Characteristic.CurrentPosition)\n .on('get', this.getCurrentPosition.bind(this));\n coveringService\n .getCharacteristic(this.hap.Characteristic.TargetPosition)\n .on('set', this.setTargetPosition.bind(this));\n coveringService\n .getCharacteristic(this.hap.Characteristic.PositionState)\n .on('get', this.getPositionState.bind(this));\n\n this.services.push(coveringService);\n }", "register() {\n this.app.bind('Config', (App) => new Config(App, {\n debug: true\n }))\n }", "constructor(context) {\n super(context)\n this.metadata = MSApplicationMetadata.metadata()\n\n // this is a slightly clumsy way to pass related classes into Layer\n // without setting up a circular dependency between classes (eg Layer imports Artboard which imports Layer...)\n // there has to be a better way to do this...\n this.factory = {\n \"Group\" : Group,\n \"Page\" : Page,\n \"Artboard\" : Artboard,\n \"Shape\" : Shape,\n \"Image\" : Image,\n \"Text\" : Text\n }\n }", "function initDependencies(cb) {\n\n require('../config/initializers/DependencyInjectionInitializer.js')\n .setupDependencies(cb);\n\n}", "constructor(container) {\n this.container = container;\n }", "constructor(container) {\n this.container = container;\n }", "function InjectableType() {}", "static prepareDependencies (module) {\n\n\t\tif (!(module instanceof MiddlewareEngine)) { return module; }\n\n\t\tmodule.requires().forEach(requirement => {\n\n\t\t\tlet dependency;\n\n\t\t\tswitch (requirement) {\n\t\t\t\tcase `MessageObject`: dependency = MessageObject; break;\n\t\t\t\tcase `sharedLogger`: dependency = sharedLogger; break;\n\t\t\t\tdefault: break;\n\t\t\t}\n\n\t\t\tif (dependency) { module.inject(requirement, dependency); }\n\n\t\t});\n\n\t\treturn module;\n\n\t}", "function ServiceLocator() {\n\n this.register = function(name, dependencies)\n {\n \n }\n \n this.get = function(name)\n {\n \n }\n\n}", "static get $inject() {\n return ['$http', '$window'];\n }", "function _inject(done) {\n inject((_$rootScope_, _$q_, _DefaultExporter_) => {\n rootScope = _$rootScope_;\n q = _$q_;\n DefaultExporter = _DefaultExporter_;\n\n done();\n });\n }", "function InjectableType() { }", "bindCorrectContext() {\n this.checkDependencies = this.checkDependencies.bind(this);\n this.checkClients = this.checkClients.bind(this);\n this.getOfflineClients = this.getOfflineClients.bind(this);\n this.onDependencyTimeout = this.onDependencyTimeout.bind(this);\n this.waitFor = this.waitFor.bind(this);\n }", "function Wilson(module) {\n\n var _instance = this;\n var _module = module;\n var _appConfig = null;\n var _cache = { components: {}, behaviors: {}, services: {}, filters: {} };\n\n var _compileProvider = null;\n var _controllerProvider = null;\n var _filterProvider = null;\n var _provider = null;\n var _activePage = null;\n var _activeRouteInfo = {};\n var _componentMap = {};\n var _preloadQueue = [];\n\n\n // ____ _ _ __ __ _ _ _\n // | _ \\ _ __(_)_ ____ _| |_ ___ | \\/ | ___| |_| |__ ___ __| |___\n // | |_) | '__| \\ \\ / / _` | __/ _ \\ | |\\/| |/ _ \\ __| '_ \\ / _ \\ / _` / __|\n // | __/| | | |\\ V / (_| | || __/ | | | | __/ |_| | | | (_) | (_| \\__ \\\n // |_| |_| |_| \\_/ \\__,_|\\__\\___| |_| |_|\\___|\\__|_| |_|\\___/ \\__,_|___/\n //\n // region private methods\n\n\n /**\n * Return an appropriately formatted directive name given a prefix and name.\n *\n * @param prefix - The prefix to prepended to the name\n * @param name - The actual name to be formatted\n */\n function getDirectiveName(prefix, constructName) {\n return prefix + _.upperFirst(_.camelCase(constructName));\n }\n\n\n /**\n * Get component element markup tag\n */\n function getComponentTag(componentName) {\n var tagName = _appConfig.app.selectors.component + '-' + _.kebabCase(componentName);\n return '<' + tagName + '></' + tagName + '>';\n }\n\n\n /**\n * Validates the name, type and definition of a wilson construct\n *\n * @param type - Type of construct - service, filter, behavior or component\n * @param name - Name of service, filter, behavior or component\n * @param def - Primary service, filter, behavior or component-controller definition\n */\n function validateDefinition(type, name, def) {\n\n // Basic Validations for type and name here\n if (!_.isString(name)) { throw new Error(type + ' name must be a string!!!'); }\n if (!type) { throw new Error('Failed to validate definition params. Type is null or undefined!!'); }\n\n // Definition checks here\n var error = null;\n var prefix = (type === 'component') ? 'controller' : 'primary';\n\n if (!_.isFunction(def) && _.isEmpty(def)) { error = 'definition is empty and cannot be processed.'; }\n else if (!_.isFunction(def) && !_.isArray(def)) { error = 'definition must be a Function or an Array!!!'; }\n\n if (error) { throw new Error((type + ' [' + name + '] ' + prefix + ' ' + error)); }\n }\n\n\n /**\n * Create a specialized component controller. This specialized controller will instantiate a new component instance using\n * the ComponentFactoryService and register it with the wilson instance.\n *\n * @param name - The name of this component (kebabCase, with no prefix -- the pure component name)\n * @param controller - The controller definition for the component\n * @param config - The entire component configuration object\n * @returns [string|Function] - A new controller definition that represents the specialized component controller\n */\n function createComponentController(name, controller, config) {\n return ['ComponentFactoryService', 'WilsonUtils', '$scope', '$element', '$attrs',\n function(ComponentFactoryService, WilsonUtils, $scope, $element, $attrs) {\n var parent = _instance.getActiveComponent(_instance.findComponentId($element));\n var componentId = WilsonUtils.generateUUID();\n\n // Decorate componentId onto $element reference\n $element.data('wilsonComponentId', componentId);\n\n // Instantiate the new component and register the returned component $scope with the wilson instance\n _componentMap[componentId] = ComponentFactoryService.create(componentId, name, controller, this, parent, $scope, $element, $attrs, config);\n\n // Listen for component destroy to de-register\n $scope.on.event('$destroy', function() { delete _componentMap[componentId]; });\n }\n ];\n }\n\n\n /**\n * Create a specialized behavior definition. This specialized definition will create a wrapping link method around\n * the original link that can extend/decorate the $scope if needed. Currently this method simply decorates a\n * WilsonEventHelper instance if this is not a component scope)\n *\n * @param definition - The original behavior definition\n * @returns {[string,string, Function]} - The actual behavior definition that wraps the original\n */\n function createBehaviorDefinition(definition) {\n return ['$injector', 'WilsonEventHelper', function($injector, WilsonEventHelper) {\n var behaviorConfig = $injector.invoke(definition);\n var originalLink = behaviorConfig.link;\n var invokeTarget = _.isArray(definition) ? definition[definition.length - 1] : definition;\n\n if (originalLink) {\n behaviorConfig.link = function($scope, $element, $attrs, controller) {\n if (!$scope.hasOwnProperty('on')) { $scope.on = new WilsonEventHelper($scope); }\n originalLink.apply(invokeTarget, [$scope, $element, $attrs, controller]);\n };\n }\n\n return behaviorConfig;\n }];\n }\n\n\n /**\n * Validate and declare a given set of routes onto the given routeProvider instance. Facilitates all route setup\n * for a given set of configured application routes.\n *\n * @param routes - A collection of route objects\n * @param routeProvider - The angular routeProvider instance on which to declare the routes\n */\n function defineAppRoutes(routes, routeProvider) {\n // Enforce null route\n var nullRouteIdx = _.findIndex(routes, { path: null });\n\n if (nullRouteIdx === -1) { throw new Error('Null route MUST be specified in routes!'); }\n if (nullRouteIdx < routes.length - 1) { throw new Error('Null route MUST be the last specified route!'); }\n\n // Define Application URL Routes\n _.each(routes, function(routeInfo) { createRoute(routeInfo, routes, routeProvider); });\n }\n\n\n /**\n * Get all configured route options associated with a given matched route path. Given a path and the complete\n * set of routes, return a cloned copy of the configured options for the route matching the specified path.\n *\n * @param matchedPath - The path of the route\n * @param routes - The collection of route objects to search\n * @returns {Object} - A copy of the route options for the route that matches the given path (empty object if no match found)\n */\n function getRouteOptions(matchedPath, routes) {\n // find the matching route configuration for the given path\n // If no matching route was found then default to the null path route\n var routeConfig = _.find(routes, { path: matchedPath });\n routeConfig = routeConfig || _.find(routes, { path: null });\n\n // return the options from the matching route\n return (routeConfig && routeConfig.options) ? _.clone(routeConfig.options) : { };\n }\n\n\n /**\n * Define a route for the application from a given path and resulting state. The\n * given path will become a route that will map to the given state. The site control\n * component will then use the mapped state for a route to load the appropriate top-level\n * workflow component and compile it into the view.\n *\n * @param routeInfo - The route definition data for this explicit route\n * @param routes - The collection of all route objects\n * @param routeProvider - The angular routeProvider reference on which to declare the final route definition\n */\n function createRoute(routeInfo, routes, routeProvider) {\n // Determine early failures\n if (!routeProvider) { throw new Error('No RouteProvider included! Cannot create route!'); }\n if (_.isUndefined(routeInfo.path)) { throw new Error('Route information is invalid! Missing path definition: \\n' + JSON.stringify(routeInfo, undefined, 2)); }\n\n // Create routing data for this route\n var routingData = {\n controller: function() { _activePage = routeInfo.component; },\n template: getComponentTag(routeInfo.component),\n componentName: routeInfo.component,\n resolve: {\n title: ['$rootScope', 'WilsonRouter', function($rootScope, WilsonRouter) {\n _.merge($rootScope, { page: { title: WilsonRouter.getTitleText(routeInfo.title) } });\n return $rootScope.page.title;\n }],\n component: ['$route', '$q', '$location', '$window', 'WilsonRouter', 'WilsonUtils', 'ComponentLoaderService',\n function($route, $q, $location, $window, WilsonRouter, WilsonUtils, ComponentLoaderService) {\n var currentRoute = $location.path();\n var options = getRouteOptions($route.current.originalPath, routes);\n var activeInfo = _.extend({}, options, routeInfo.defaultParams || {}, $route.current.params);\n \n // Set Active Route Info\n WilsonUtils.replaceObject(_activeRouteInfo, activeInfo);\n\n // Handle special routing functionality via IRouteService\n return WilsonRouter.handleRouteChange(currentRoute, options, routeInfo).then(function() {\n // Load the route component\n return ComponentLoaderService.load(routeInfo.component);\n }).then(function(data) {\n // Force a reload to update if out of date component\n if (data.version !== angular.wilson.config.app.version) { $window.location.reload(); }\n return data;\n }).catch(function(error) { return $q.reject(error); });\n }\n ],\n dependencies: ['$q', 'WilsonRouter', function($q, WilsonRouter) {\n var promises = [];\n\n // Call load dependencies on IRouteService if exposed (this method should return a $q promise)\n promises.push(WilsonRouter.loadDependencies(routeInfo));\n promises.push(WilsonRouter.loadSession());\n\n return $q.allSettled(promises);\n }],\n retryOriginalRoute: ['$location', '$route', 'localStorageService', function($location, $route, localStorageService) {\n var retryRoute = localStorageService.get('retryRoute');\n\n // If we have the retryRoute object, then we need to setup our retry\n if (_.isObject(retryRoute) && $location.path() === retryRoute.path) {\n // If this is a subsequent attempt, then continue\n if (retryRoute.attempt > 0) {\n if (retryRoute.originalPath && retryRoute.path !== retryRoute.originalPath) {\n localStorageService.remove('retryRoute');\n $location.path(retryRoute.originalPath);\n }\n } else {\n retryRoute.attempt++;\n localStorageService.add('retryRoute', retryRoute);\n }\n } else {\n localStorageService.remove('retryRoute');\n }\n }]\n }\n };\n\n // Declare routes on the routeProvider\n if (routeInfo.path !== null) { routeProvider.when(routeInfo.path, routingData); }\n else { routeProvider.otherwise(routingData); }\n }\n\n // endregion\n\n\n // ____ _ _ _ __ __ _ _ _\n // | _ \\ _ _| |__ | (_) ___ | \\/ | ___| |_| |__ ___ __| |___\n // | |_) | | | | '_ \\| | |/ __| | |\\/| |/ _ \\ __| '_ \\ / _ \\ / _` / __|\n // | __/| |_| | |_) | | | (__ | | | | __/ |_| | | | (_) | (_| \\__ \\\n // |_| \\__,_|_.__/|_|_|\\___| |_| |_|\\___|\\__|_| |_|\\___/ \\__,_|___/\n //\n // region public methods\n\n\n /***** Public config property *****/\n this.config = _appConfig;\n\n\n /***** Public routeInfo virtual property *****/\n Object.defineProperty(this, 'routeInfo', {\n get: function() { return _.cloneDeep(_activeRouteInfo); }\n });\n\n\n /**\n * Sets the app config object.\n *\n * @param config - Object to be set as the new _appConfig\n */\n this.setAppConfig = function setAppConfig(config) { this.config = _appConfig = config; };\n\n\n /**\n * Get the currently active page name\n */\n this.getActivePage = function getActivePage() { return _activePage; };\n\n\n /**\n * Get a currently active component by componentId\n */\n this.getActiveComponent = function getActiveComponent(componentId) { return _componentMap[componentId]; };\n\n\n /**\n * Get an info string of components that are available.\n */\n this.getActiveComponentList = function getActiveComponentList() {\n return _.map(_componentMap, function(component) { return component });\n };\n\n\n /**\n * Get the containing componentId for the given jQuery DOM element reference\n */\n this.findComponentId = function findComponentId(jqElement) {\n if (!jqElement || !jqElement.length) { return null; } // If no element provided, then null\n\n // Return the componentId or the recursively found value\n return jqElement.data().wilsonComponentId || this.findComponentId(jqElement.parent());\n };\n\n\n /**\n * Destroy an active component\n */\n this.destroyComponent = function destroyComponent(componentId) {\n var component = this.getActiveComponent(componentId);\n\n // Remove the component if it exists\n if (component) { component.$destroy(); }\n };\n\n\n /**\n * Declare special route handler service on Angular.\n *\n * @param definition - Array or Function definition of the service\n */\n this.router = function defineRouter(definition) { this.service('WilsonRouteService', definition); };\n\n\n /**\n * Declare a filter on Angular.\n *\n * @param name - Filter Name\n * @param definition - Array or Function definition of the filter\n */\n this.filter = function defineFilter(name, definition) {\n validateDefinition('filter', name, definition);\n\n var filterName = _.camelCase(name);\n\n if (!_cache.filters[filterName]) {\n\n var provider = _filterProvider || _module;\n var filter = provider.filter || provider.register;\n\n filter(filterName, _.isArray(definition) ? definition : function() {\n return definition;\n });\n\n // Mark as cached\n _cache.filters[filterName] = true;\n }\n };\n\n\n /**\n * Declare an element-based directive on Angular. This element will represent\n * a reusable component. Component definitions must have an explicit controller declared.\n *\n * @param name - Component Name\n * @param definition - Object definition of the component directive\n */\n this.component = function defineComponent(name, config) {\n if (!_appConfig) { return _preloadQueue.push({ type: 'component', args: arguments }); }\n\n var directiveName = getDirectiveName(_appConfig.app.selectors.component, name);\n\n if (!_cache.components[directiveName]) {\n\n // Initialize the config with defaults\n var fullConfig = {\n restrict: 'EA',\n templateUrl: name.toLowerCase(),\n replace: true,\n scope: {}\n };\n\n // Extend default parameters\n _.extend(fullConfig, config);\n\n // Validate Component Definition\n validateDefinition('component', name, fullConfig.controller);\n\n // Build and set controller and link method -- passing the original controller and link\n fullConfig.controller = createComponentController(name, fullConfig.controller, fullConfig);\n\n // Create a new directive for the component\n var provider = _compileProvider || _module;\n provider.directive(directiveName, function() { return fullConfig; });\n\n // Mark as cached\n _cache.components[directiveName] = true;\n }\n };\n\n\n /**\n * Declare an attribute-based directive on Angular.\n *\n * @param name - Behavior Name\n * @param definition - Function or Array definition of the behavior directive\n */\n this.behavior = function defineBehavior(name, definition) {\n if (!_appConfig) { return _preloadQueue.push({ type: 'behavior', args: arguments }); }\n\n var directiveName = getDirectiveName(_appConfig.app.selectors.behavior, name);\n\n if (!_cache.behaviors[directiveName]) {\n // Validate Directive Definition\n validateDefinition('behavior', name, definition)\n\n // Determine if we are loading this dynamically with compileProvider\n var provider = _compileProvider || _module;\n\n // Create a new directive for this behavior\n provider.directive(directiveName, createBehaviorDefinition(definition));\n\n // Mark as cached\n _cache.behaviors[directiveName] = true;\n }\n };\n\n\n /**\n * Declare a service on Angular.\n *\n * @param name - Service Name\n * @param definition - Array or Function definition of the service\n */\n this.service = function defineService(name, definition) {\n validateDefinition('service', name, definition);\n\n if (!_cache.services[name]) {\n var provider = _provider || _module;\n provider.factory(name, definition);\n\n // Mark as cached\n _cache.services[name] = true;\n }\n };\n\n\n // Added convenience Aliases for services\n this.class = this.service;\n this.factory = this.service;\n this.utility = this.service;\n this.resource = this.service;\n\n // endregion\n\n\n // ___ _ _ _ _ _ _ _\n // |_ _|_ __ (_) |_(_) __ _| (_)______ _| |_(_) ___ _ __\n // | || '_ \\| | __| |/ _` | | |_ / _` | __| |/ _ \\| '_ \\\n // | || | | | | |_| | (_| | | |/ / (_| | |_| | (_) | | | |\n // |___|_| |_|_|\\__|_|\\__,_|_|_/___\\__,_|\\__|_|\\___/|_| |_|\n //\n // region initialization\n\n\n // Angular Module Config Routine\n _module.config(['$interpolateProvider', '$locationProvider', 'i18nextServiceProvider', '$routeProvider', 'localStorageServiceProvider', '$compileProvider', '$controllerProvider', '$filterProvider', '$provide',\n function wilsonConfig($interpolateProvider, $locationProvider, i18nextServiceProvider, $routeProvider, localStorageServiceProvider, $compileProvider, $controllerProvider, $filterProvider, $provide) {\n\n var config = angular.wilson.config;\n\n // Store our Providers\n _compileProvider = $compileProvider;\n _controllerProvider = $controllerProvider;\n _filterProvider = $filterProvider;\n _provider = $provide;\n\n // Disable Class/Comment and Debug Info for Performance\n _compileProvider.commentDirectivesEnabled(false);\n _compileProvider.cssClassDirectivesEnabled(false);\n _compileProvider.debugInfoEnabled(config.debugInfoEnabled);\n\n // use square brackets so they don't collide with handlebars;\n // plus, square goes with angular... get it?\n $interpolateProvider.startSymbol('[[');\n $interpolateProvider.endSymbol(']]');\n\n // Configure the i18n provider\n i18nextServiceProvider.init({\n lng: config.i18n.lng,\n resStore: config.i18n.resStore,\n ns: {\n namespaces: config.i18n.namespaces\n },\n fallbackToDefaultNS: false,\n nsseparator: ':::',\n keyseparator: '::',\n useCookie: false,\n useLocalStorage: config.i18n.useLocalStorage, // need to be true in production\n localStorageExpirationTime: config.i18n.localStorageExpirationTime,\n supportedLngs: _.map(config.i18n.supportedLngs, 'locale'),\n languageData: config.i18n.supportedLngs,\n fallbackLng: config.i18n.fallbackLng,\n sendMissing: config.i18n.sendMissing, // need to be false in prod\n sendMissingTo: 'all',\n resPostPath: '/locales/add/__lng__/__ns__',\n resSetPath: '/client/locales/__lng__/__ns__.json',\n resGetPath: '/client/locales/__lng__/__ns__.json'\n });\n\n localStorageServiceProvider.setPrefix(config.app.localStoragePrefix || 'wilson');\n\n $locationProvider.html5Mode(true).hashPrefix('!');\n\n // Declare Routes on Angular\n defineAppRoutes(config.routes, $routeProvider);\n }\n ]);\n\n // Angular Module Config Routine\n _module.run(['$rootScope', '$templateCache', '$location', '$timeout', 'WilsonUtils', 'WilsonLogger', 'ComponentLoaderService',\n function wilsonRun($rootScope, $templateCache, $location, $timeout, WilsonUtils, WilsonLogger, ComponentLoaderService) {\n\n // Local No Operation Function\n var noop = function() {};\n\n // Decorate utilities and logger onto this wilson instance\n _instance.utils = WilsonUtils;\n _instance.log = WilsonLogger;\n\n\n // ____ _ ____ _ _ _\n // | _ \\ ___ ___ | |_ / ___| ___ ___ _ __ ___ | | | | ___| |_ __ ___ _ __ ___\n // | |_) / _ \\ / _ \\| __| \\___ \\ / __/ _ \\| '_ \\ / _ \\ | |_| |/ _ \\ | '_ \\ / _ \\ '__/ __|\n // | _ < (_) | (_) | |_ ___) | (_| (_) | |_) | __/ | _ | __/ | |_) | __/ | \\__ \\\n // |_| \\_\\___/ \\___/ \\__| |____/ \\___\\___/| .__/ \\___| |_| |_|\\___|_| .__/ \\___|_| |___/\n // |_| |_|\n // region rootScope helpers\n\n // Set Default Page Title TODO: Drive this from a config setting\n $rootScope.page = { title: 'Wilson' };\n\n\n /**\n * Method to trigger an angular digest.\n *\n * @param fn\n */\n $rootScope.triggerDigest = function rootTriggerDigest() { return $timeout(noop); };\n\n\n /**\n * Method to bind a given function and context to run and then trigger an angular digest cycle.\n *\n * @param method\n * @param context\n * @returns {*}\n */\n $rootScope.bindToDigest = function rootBindToDigest(method, context) {\n context = context || this;\n\n var bound = function() {\n method.apply(context, arguments);\n $rootScope.triggerDigest();\n };\n\n return method ? bound : noop;\n };\n\n // endregion\n\n\n // ____ _ _ _\n // | _ \\ _ __ ___| | ___ __ _ __| (_)_ __ __ _\n // | |_) | '__/ _ \\ |/ _ \\ / _` |/ _` | | '_ \\ / _` |\n // | __/| | | __/ | (_) | (_| | (_| | | | | | (_| |\n // |_| |_| \\___|_|\\___/ \\__,_|\\__,_|_|_| |_|\\__, |\n // |___/\n // region preloading\n\n // Declare any pre-loaded items on this wilson instance\n _.each(_preloadQueue, function(item) { _instance[item.type].apply(_instance, item.args); });\n\n // Preload any marked route components\n var cleanup = $rootScope.$on('$locationChangeSuccess', function() {\n var loaded = {};\n _.each(_instance.config.routes, function(route) {\n if (route.preload && !loaded[route.component]) {\n loaded[route.component] = ComponentLoaderService.load(route.component);\n }\n });\n\n cleanup(); // Remove this one-time handling operation\n });\n\n // endregion\n\n }\n ]);\n\n // endregion\n\n }", "function initServices() {\n $scope.emoticonService = EmoticonsService;\n }", "function useContainer(iocContainer, options) {\n userContainer = iocContainer;\n userContainerOptions = options;\n}", "function useContainer(iocContainer, options) {\n userContainer = iocContainer;\n userContainerOptions = options;\n}", "function useContainer(iocContainer, options) {\n userContainer = iocContainer;\n userContainerOptions = options;\n}", "constructor(commonService) {\n this.commonService = commonService;\n }", "constructor(commonService) {\n this.commonService = commonService;\n }", "selfAssignHandlerFunctions() {\n this.request = this.api.request.bind(this.api);\n this.addRateLimitService = this.api.addRateLimitService.bind(this.api);\n this.addRequestService = this.api.addRequestService.bind(this.api);\n }", "init() {\n this._super(...arguments);\n this.set('dependencies', {\n services: [\n 'themeChanger'\n ]\n });\n }", "function init(beanDefinitionsURL) {\n /**\n * @private\n * @type {*}\n */\n var me = this;\n\n /**\n * Object containing bean definitions from loaded json file\n *\n * @private\n * @type {Object}\n */\n var beanDefinitions = {};\n\n /**\n * Object containing required beans\n *\n * @private\n * @type {Object}\n */\n var beans = {};\n\n /**\n * @constructor\n */\n function constructor() {\n console.log('DEBUG: NIoc.constructor');\n\n //If beanDefinitionsURL is not defined, look for beans.json one level above node_modules\n beanDefinitionsURL = beanDefinitionsURL ? beanDefinitionsURL : '../../../beans.json';\n\n console.log('DEBUG: Loading bean definitions - path: ' + beanDefinitionsURL);\n beanDefinitions = require(beanDefinitionsURL);\n\n //create singleton beans\n for(var beanId in beanDefinitions) {\n if(!beans[beanId] && beanDefinitions[beanId].singleton != false) {\n me.createBean(beanId, beanDefinitions[beanId]);\n }\n }\n\n //register self as bean\n beans['nioc'] = me;\n };\n\n /**\n * Creates a bean and registers it\n *\n * @public\n * @param {String} id The id of the bean to use for future injection\n * @param {Object} beanDefinition The bean definition used to create the bean\n * @returns {Object} The created/registered bean\n */\n me.createBean = function(id, beanDefinition) {\n console.log('DEBUG: Creating bean - id: ' + id + ' - path: ' + beanDefinition.path + ' - config: ' + beanDefinition.config);\n\n //load bean\n var bean = require(beanDefinition.path);\n bean = new bean(beanDefinition.config);\n\n //tack id onto bean for internal use\n bean.$id = id;\n\n //if bean definition contains postConstruct object, call post construct methods\n if(beanDefinition.postConstruct) {\n var len = beanDefinition.postConstruct.length;\n\n for(var i=0; i<len; i++) {\n performPostConstructMethodCall(bean, beanDefinition.postConstruct[i])\n }\n }\n\n //if singleton == false, do not register so that it is created again next time it gets injected\n if(beanDefinition.singleton != false)\n beans[id] = bean;\n\n return bean;\n };\n\n /**\n * Executes bean method post construction within the scope of the bean\n *\n * @private\n * @param {Object} bean The bean to execute the method on\n * @param {Object} postConstructDefinition The definition object containing the method name to call as well as attributes to pass to the method\n */\n function performPostConstructMethodCall(bean, postConstructDefinition) {\n console.log('DEBUG: Performing post construction method call - beanId: ' + bean.$id + ' - method: ' + postConstructDefinition.method + ' - arguments: ' + postConstructDefinition.arguments);\n bean[postConstructDefinition.method].apply(bean, postConstructDefinition.arguments);\n }\n\n /**\n * Removes a bean from the registry\n *\n * @public\n * @param {String} id\n */\n me.destroyBean = function(id) {\n delete beans[id];\n };\n\n /**\n * Add inject method to global scope to be used for bean injection\n *\n * @global\n * @param {String} id The id of the bean to return\n * @param {String} property (optional) The property on the associated bean to return\n * @returns {*}\n */\n global.inject = function(id, property) {\n //check for bean - if bean instance doesn't exist call createBean\n var bean = beans[id] ? beans[id] : me.createBean(id, beanDefinitions[id]);\n\n //check to see if injecting a bean property, return accordingly\n if(property) {\n console.log('DEBUG: Injecting bean property - id: ' + id + ' - property: ' + property);\n return bean[property];\n } else {\n console.log('DEBUG: Injecting bean - id: ' + id);\n return bean;\n }\n }\n\n //construct object\n constructor();\n}", "initializing() {\n this.initializeBoilerplate();\n }", "bindCorrectContext() {\n\t\tthis.onTitleChange = this.onTitleChange.bind(this);\n\t\tthis.onShowDockingToolTip = this.onShowDockingToolTip.bind(this);\n\t\tthis.onToggleDockingIcon = this.onToggleDockingIcon.bind(this);\n\t\tthis.onDocking = this.onDocking.bind(this);\n\t\tthis.showLinkerButton = this.showLinkerButton.bind(this);\n\t}", "constructor (options) {\n const _o = options\n\n // Bindings\n }", "bind(_scope, _containerDefinition) {\n try {\n jsiiDeprecationWarnings.aws_cdk_lib_aws_ecs_ContainerDefinition(_containerDefinition);\n }\n catch (error) {\n if (process.env.JSII_DEBUG !== \"1\" && error.name === \"DeprecationError\") {\n Error.captureStackTrace(error, this.bind);\n }\n throw error;\n }\n return {\n logDriver: this.logDriver,\n options: (0, utils_1.removeEmpty)(this.options),\n secretOptions: this.secretOptions && (0, utils_1.renderLogDriverSecretOptions)(this.secretOptions, _containerDefinition.taskDefinition),\n };\n }", "initializeScopedObjected() {\n this.scopeObject.pageTitle = `42 MATTERS`;\n this.scopeObject.subTitle = `Poiz' Solution to «42 Matters» FullStack Developer Assignment using AngularJS 1.6, Pug, Stylus, WebPack, ES6 & PHP 7`;\n this.scopeObject.objModel = {\n tag: 'all',\n text: '',\n sub: ''\n };\n\n // EXPOSES BOUND EVENT-HANDLERS USING ES 6 FAT-ARROW FUNCTION:\n this.scopeObject.filterDataByTag = () => {\n this.filterDataByTag()\n };\n this.scopeObject.getHighlightedTitle = (title) => {\n return this.getHighlightedTitle(title)\n };\n this.scopeObject.filterDataByTag2 = (tag, event) => {\n this.filterDataByTag2(tag, event)\n };\n this.scopeObject.filterDataByInputTextTag = () => {\n this.filterDataByInputTextTag()\n };\n\n // DEBUG A FEW ENDPOINTS: PLEASE, REMOVE THIS FROM THE PRODUCTION BUNDLE.\n this.debugEndpointProvider();\n }", "register() {\n if (this._registered) {\n return;\n }\n\n this._registered = true;\n this._debug = !! process.env.DEBUG;\n const autoloader = this;\n\n let ManagedProxy = null;\n\n const constructor = function (...$args) {\n if (undefined !== this[Symbol.__jymfony_field_initialization]) {\n this[Symbol.__jymfony_field_initialization]();\n }\n\n const retVal = this.__construct(...$args);\n if (undefined !== global.mixins && undefined !== this[global.mixins.initializerSymbol]) {\n this[global.mixins.initializerSymbol](...$args);\n }\n\n if (undefined !== retVal && this !== retVal) {\n return retVal;\n }\n\n let self = this;\n if (!! autoloader.debug) {\n self = new Proxy(self, {\n get: (target, p) => {\n if (p !== Symbol.toStringTag && ! Reflect.has(target, p)) {\n throw new TypeError('Undefined property ' + p.toString() + ' on instance of ' + ReflectionClass.getClassName(target));\n }\n\n return Reflect.get(target, p);\n },\n });\n }\n\n if (undefined !== this.__invoke) {\n return new ManagedProxy(self.__invoke, proxy => {\n proxy.target = self;\n return null;\n }, {\n get: (target, key) => {\n if ('__self__' === key) {\n return target;\n }\n\n return Reflect.get(target, key);\n },\n apply: (target, ctx, args) => {\n return target.__invoke(...args);\n },\n preventExtensions: (target) => {\n Reflect.preventExtensions(target);\n\n return false;\n },\n getOwnPropertyDescriptor: (target, key) => {\n if ('__self__' === key) {\n return { configurable: true, enumerable: false };\n }\n\n return Reflect.getOwnPropertyDescriptor(target, key);\n },\n });\n }\n\n return this;\n };\n\n /**\n * This is the base class of all the autoloaded classes.\n * It is runtime-injected where needed.\n */\n this._global.__jymfony.JObject = class JObject {\n constructor(...$args) {\n return constructor.bind(this)(...$args);\n }\n\n __construct() { }\n };\n\n this._global.Symbol.reflection = Symbol('reflection');\n this._global.Symbol.docblock = Symbol('docblock');\n this._global.Symbol.__jymfony_field_initialization = Symbol('[FieldInitialization]');\n\n const ClassLoader = require('./ClassLoader');\n this._classLoader = new ClassLoader(this._finder, path, require('vm'));\n\n ManagedProxy = require('./Proxy/ManagedProxy');\n\n const includes = new Set();\n for (const module of this._finder.listModules()) {\n let packageInfo;\n const packageJson = path.join(this._rootDir, 'node_modules', module, 'package.json');\n\n try {\n packageInfo = JSON.parse(fs.readFileSync(packageJson, { encoding: 'utf8' }));\n } catch (e) {\n continue;\n }\n\n const dir = path.join(this._rootDir, 'node_modules', module);\n this._processPackageInfo(packageInfo, dir, includes);\n }\n\n this._processPackageInfo(\n JSON.parse(fs.readFileSync(this._rootDir + '/package.json', { encoding: 'utf8' })),\n this._rootDir,\n includes,\n true\n );\n\n for (const file of includes) {\n this._classLoader.loadFile(file, null);\n }\n }", "function ServiceLocator() {\n\tthis._registrations = {};\n}", "function _BindGlobals(){\r\n\t\t\r\n\t\tif(typeof window.$$ !== \"undefined\"){\r\n\t\t\t_Original$$ = window.$$;\r\n\t\t}\r\n\t\t\r\n\t\twindow.$$ = _Penguin;\r\n\t\twindow.Penguin = _Penguin;\r\n\t\t\r\n\t}", "function BindObject(cbRef) {\n\t\tthis.bindTo = function(state) {\n\t\t\tif (state) {\n\t\t\t\tcbRef[1] = state;\n\t\t\t}\n\t\t};\n\t}", "bindHttpClient() {\n\t\tthis.app.singleton('http', HttpClient);\n\t}", "_initServices() {\n this._config.initServicesIma(ns, this._oc, this._config.services);\n\n this._config.plugins\n .filter(plugin => typeof plugin.module.initServices === 'function')\n .forEach(plugin => {\n plugin.module.initServices(ns, this._oc, this._config.services);\n });\n\n this._config.initServicesApp(ns, this._oc, this._config.services);\n }", "function BasapFact() {\n\n var _instance = self;\n\n // need to extend w/methods.\n _instance.routes = self.routes.bind(self);\n _instance.tryInject = self.tryInject.bind(self);\n _instance.contains = self.contains.bind(self);\n _instance.query = self.query.bind(self);\n _instance.providers = self.providers.bind(self);\n _instance.async = self.async.bind(self);\n _instance.menu = self.menu.bind(self);\n _instance.log = self.log;\n\n return _instance;\n }", "function _bindEvents() {\n // subscribe to 'peopleChanged' event\n // When received, fire setPeople\n app.events.on('peopleChanged', setPeople);\n }", "concatBindings() {\n set(this, 'classNameBindings', ['content'].concat(_gridBindings, _responsiveHelpers, _helpers));\n }", "init() {\n // Import indicator + set the default params\n this.ind1 = dep('SomeIndicator1', [12])\n\n // Import a TA library (nmp package)\n this.ta_lib = dep('@some_ta_lib')\n\n }", "init() {\n module_utils.patchModule(\n '@google-cloud/common/',\n 'makeRequest',\n bigQueryWrapper,\n common => common.util\n );\n module_utils.patchModule(\n '@google-cloud/pubsub/',\n 'request',\n wrapPubSubRequestFunction,\n pubsub => pubsub.PubSub.prototype\n );\n module_utils.patchModule(\n '@google-cloud/pubsub/',\n 'pull',\n wrapPubSubPullFunction,\n pubsub => pubsub.v1.SubscriberClient.prototype\n );\n }", "initBindingsAndEventListeners(){\n // Define links\n this.recipesLink = this.container.querySelector('a#recipes')\n this.ingredientsLink = this.container.querySelector('a#ingredients')\n\n // Listen for link clicks\n this.recipesLink.addEventListener('click', this.handleRecipesClick.bind(this))\n this.ingredientsLink.addEventListener('click', this.handleIngredientsClick.bind(this))\n }", "projectComponentBindings(component, bindings) {\n if (bindings) {\n if (bindings.inputs !== undefined) {\n const bindingKeys = Object.getOwnPropertyNames(bindings.inputs);\n for (const bindingName of bindingKeys) {\n component.instance[bindingName] = bindings.inputs[bindingName];\n }\n }\n if (bindings.outputs !== undefined) {\n const eventKeys = Object.getOwnPropertyNames(bindings.outputs);\n for (const eventName of eventKeys) {\n component.instance[eventName] = bindings.outputs[eventName];\n }\n }\n }\n return component;\n }", "projectComponentBindings(component, bindings) {\n if (bindings) {\n if (bindings.inputs !== undefined) {\n const bindingKeys = Object.getOwnPropertyNames(bindings.inputs);\n for (const bindingName of bindingKeys) {\n component.instance[bindingName] = bindings.inputs[bindingName];\n }\n }\n if (bindings.outputs !== undefined) {\n const eventKeys = Object.getOwnPropertyNames(bindings.outputs);\n for (const eventName of eventKeys) {\n component.instance[eventName] = bindings.outputs[eventName];\n }\n }\n }\n return component;\n }", "function provideServiceM(_) {\n return f => ma => As.accessM(r => As.chain_(f, t => As.provideAll_(ma, (0, _index3.mergeEnvironments)(_, r, t))));\n}", "function init() {\n ngAnnotationsInputModule.component('annotationsInput', annotationsInputComponent);\n annotations.forEach((annotation) => {\n const name = annotation + 'Annotation',\n component = componentGenerator(name)\n ngAnnotationsInputModule.component(name, component)\n })\n}", "function bindTypes (namespace, types={}) {\n Object.keys(types).forEach(type=> {\n let typeName = `${namespace}.${type}`;\n apiTypes[typeName] = types[type];\n });\n}", "initModels() {\n this.models = {};\n this.collections = {};\n MODELS.forEach(modulePath => {\n const { modelClass, collectionClass } = require(modulePath)(this.bookshelf);\n if (modelClass) {\n this.models[modelClass.prototype.modelName] = modelClass;\n }\n\n if (collectionClass) {\n this.collections[collectionClass.prototype.collectionName] = collectionClass;\n }\n });\n }", "_initSettings() {\n let currentApplicationSettings = {};\n\n let plugins = this._config.plugins.concat([\n { name: ObjectContainer.APP_BINDING_STATE, module: this._config }\n ]);\n\n plugins\n .filter(plugin => typeof plugin.module.initSettings === 'function')\n .forEach(plugin => {\n let allPluginSettings = plugin.module.initSettings(\n ns,\n this._oc,\n this._config.settings\n );\n let environmentPluginSetting = $Helper.resolveEnvironmentSetting(\n allPluginSettings,\n this._config.settings.$Env\n );\n\n $Helper.assignRecursivelyWithTracking(plugin.name)(\n currentApplicationSettings,\n environmentPluginSetting\n );\n });\n\n this._config.bind = Object.assign(\n this._config.bind || {},\n currentApplicationSettings,\n this._config.settings\n );\n }", "constructor(thisGlobalInstance) {\n\n this.thisContainer = thisGlobalInstance;\n }", "static $clinit() {\n CharSequences.$clinit = function() {};\n CharSequence = goog.module.get('java.lang.CharSequence$impl');\n String = goog.module.get('java.lang.String$impl');\n }", "function setup(info) {\n var _this = this;\n\n var _setupEventHandlers = _helpers.setupEventHandlers.bind(this, info);\n\n this._commons = info;\n\n // For a new connection, set up the service method handlers\n info.connection().on('connection', function (socket) {\n var _setupMethodHandlers = _helpers.setupMethodHandlers.bind(_this, info, socket);\n // Process all registered services\n (0, _utils.each)(_this.services, _setupMethodHandlers);\n });\n\n // Set up events and event dispatching\n (0, _utils.each)(this.services, _setupEventHandlers);\n}", "init() {\n // using shimmer directly cause can only be bundled in node\n shimmer.wrap(http, 'get', () => httpGetWrapper(http));\n shimmer.wrap(http, 'request', httpWrapper);\n shimmer.wrap(https, 'get', () => httpGetWrapper(https));\n shimmer.wrap(https, 'request', httpWrapper);\n\n module_utils.patchModule(\n 'fetch-h2/dist/lib/context-http1',\n 'connect',\n fetchH2Wrapper,\n fetch => fetch.OriginPool.prototype\n );\n // simple-oauth2 < 4.0\n module_utils.patchModule(\n 'simple-oauth2/lib/client.js',\n 'request',\n clientRequestWrapper,\n client => client.prototype\n );\n // simple-oauth2 >= 4.0\n module_utils.patchModule(\n 'simple-oauth2/lib/client/client.js',\n 'request',\n clientRequestWrapper,\n client => client.prototype\n );\n }", "function Injection(from, dependency) {\n this.from = from;\n this.dependency = dependency;\n}" ]
[ "0.6782557", "0.61832213", "0.6102641", "0.59739363", "0.5949272", "0.5879701", "0.58611596", "0.5834875", "0.5807689", "0.57684404", "0.5756915", "0.56696063", "0.56612456", "0.5622605", "0.5583802", "0.55646235", "0.55646235", "0.5551901", "0.55242205", "0.54883766", "0.5474118", "0.5471669", "0.54610914", "0.5437101", "0.5384898", "0.5384898", "0.5384898", "0.5330671", "0.533046", "0.5328883", "0.5328378", "0.53229046", "0.5309023", "0.52835715", "0.52796096", "0.5272183", "0.5264493", "0.5250424", "0.52209955", "0.5208227", "0.5207482", "0.51963717", "0.51923853", "0.51902884", "0.5185231", "0.5178991", "0.5177443", "0.51618594", "0.5141601", "0.512961", "0.51234555", "0.5122117", "0.5118575", "0.5118575", "0.51048994", "0.5104396", "0.50904524", "0.50763124", "0.5071608", "0.50683826", "0.5046723", "0.5034587", "0.5033426", "0.5028034", "0.5028034", "0.5028034", "0.50043815", "0.50043815", "0.5002169", "0.4998873", "0.49946582", "0.4994425", "0.49921033", "0.49899685", "0.4974929", "0.4955208", "0.49549448", "0.49544892", "0.49509412", "0.49434093", "0.49339017", "0.49238867", "0.4907175", "0.49056995", "0.49018097", "0.4894203", "0.48939073", "0.48919508", "0.48883197", "0.48883197", "0.487488", "0.48723623", "0.48685277", "0.48605144", "0.48565394", "0.48531482", "0.48527655", "0.4851288", "0.48496887", "0.48444873" ]
0.6893125
0
Initializes the basic application services.
_initServices() { this._config.initServicesIma(ns, this._oc, this._config.services); this._config.plugins .filter(plugin => typeof plugin.module.initServices === 'function') .forEach(plugin => { plugin.module.initServices(ns, this._oc, this._config.services); }); this._config.initServicesApp(ns, this._oc, this._config.services); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n TodoService.name = 'todo';\n readTodoList();\n }", "function initServices() {\n $scope.emoticonService = EmoticonsService;\n }", "function init() {\n // get current user from rootScope if present\n vm.user = $rootScope.currentUser;\n // get list of state abbreviations from constants for state dropdown\n vm.states = PetShelterConstants.getStates();\n // regex to validate zip codes\n vm.zipRegex = '^\\\\d{5}$';\n }", "function initController() {\n UserService.GetAll().then(function (user) {\n $scope.allUsers = user;\n $scope.userLength = Object.size(user);\n }).finally(function() {\n\t\t\t\t$scope.loading = false;\n\t\t\t});\n }", "function initialization() {\n $log.info('default component initialized');\n }", "function init() {\r\n // Set up the items that are needed for the controller to run\r\n }", "function init() {\n\n require('dotenv').load();\n\n app.port = process.env.PORT || 3002;\n\n // Default route\n app.get('/', function (req, res) {\n res.json({\n name: 'League of Legends eSports API',\n version: \"0.9.0\",\n author: \"Robert Manolea <manolea.robert@gmail.com>\",\n repository: \"https://github.com/Pupix/lol-esports-api\"\n });\n });\n\n // Dynamic API routes\n XP.forEach(routes, function (func, route) {\n app.get(route, requestHandler);\n });\n\n //Error Handling\n app.use(function (req, res) { res.status(404).json({error: 404, message: \"Not Found\"}); });\n app.use(function (req, res) { res.status(500).json({error: 500, message: 'Internal Server Error'}); });\n\n // Listening\n app.listen(app.port, function () { console.log('League of Legends eSports API is listening on port ' + app.port); });\n }", "function init() {\n AdminService\n .adminFindAllUsers()\n .then(handleSuccess, handleError);\n }", "$onInit() {\n\n \tPromise.all([\n \t\tthis.loadLocations(),\n \t\tthis.loadCategories(), \n \t\tthis.loadCollections()\n \t]).then(() => this.loadFeatures(this.filter))\n }", "function init() {\n // Enable debug mode for translations\n gettextCatalog.debug = config.debug;\n\n vm.setLanguage();\n\n // Set REST server configuration\n restService.setServer(config.server);\n }", "function init() {\n console.log( \"init\" );\n\n initExampleModule();\n //initScrollTo();\n //initCarouselModules();\n }", "function init(){\t\t// om het app te initializeren.\n console.log('1 Initialize the application');\n console.log('1.1 Create a GetAPerson object');\n _getAPerson = new GetAPerson();\n console.log('1.2 Chache the active DOM-elements');\n _aPersonElement = document.querySelector('.container');\n _aYayElement = document.querySelector('.yayContainer');\n _btnYay = document.querySelector('.yay');\n _btnNay = document.querySelector('.nay');\n console.log('1.3 Load the parking states via _parkingStatesService object');\n loadRandomPersonData();\n}", "_initServices() {\n this.workbenchCoreSerivce = new WorkbenchCoreService();\n this.authTwoService = new AuthTwoService();\n }", "constructor(){\n\n this._ngAppName = APP_NAMESPACE;\n\n this._ngDependencies = [\n // 'ngAnimate',\n // 'ngTouch'\n ];\n\n this._ngControllers = [\n {\n name: 'TSTCarouselController',\n class: CarouselController\n },\n {\n name: 'TSTFormController',\n class: FormController\n },\n {\n name: 'TSTHeroController',\n class: HeroController\n },\n {\n name: 'TSTEventsController',\n class: EventsController\n }\n ];\n\n this._ngServices = [\n\n ];\n\n this._ngDirectives = [\n {\n name: 'tstMobileMenu',\n class: mobileMenuDirective\n }\n ];\n\n this._init();\n\n }", "function init() {\n vm.products = orderService.getAll();\n }", "constructor($rootScope, $scope, http, $state, authService) {\r\n [this.$rootScope, this.$scope, this.http, this.$state, this.authService, this.name] = [$rootScope, $scope, http, $state, authService, 'MainController'];\r\n }", "function _init() {\r\n $sc['_name'] = CONTROLLER_NAME;\r\n\r\n //Set page title\r\n $hs.$scope.setTitle([\r\n characterInfo['serverName'],\r\n '->',\r\n characterInfo['characterName']\r\n ].join(' '));\r\n\r\n //Set up character and server names and stats\r\n $sc['serverName'] = characterInfo['serverName'];\r\n $sc['character'] = characterInfo;\r\n\r\n //Set up chart\r\n $sc['chart'] = _setUpChart(characterInfo);\r\n\r\n //Set up pagination\r\n $sc['pagination'] = _setUpPagination(characterInfo['status'], 10);\r\n\r\n //Search...\r\n $sc['search'] = _search;\r\n }", "function init() {\n UserService\n .checkLogin()\n .success(function (user) {\n if(user != '0'){\n vm.loggedIn = true;\n vm.currentUser = user;\n } else{\n vm.loggedIn = false;\n }\n })\n .error(function (error) {\n\n });\n GoogleBooksService\n .getNewReleasedBooks()\n .success(function (newReleases) {\n //Displaying only top 6 new release books\n vm.newReleases = newReleases.items.splice(0,6);\n })\n .then(function (error) {\n\n });\n ReviewService\n .getAllReviews()\n .success(function (allReviews) {\n //Displaying only top 4 reviews\n vm.readerReviews = allReviews.splice(0,4);\n })\n .error(function (error) {\n\n });\n }", "function initialize() {\n initializeStock();\n initializeChat();\n initializeHistoryExample();\n }", "function init() {\n // get current user from rootScope if present\n vm.user = $rootScope.currentUser;\n // will be true once search is ran\n vm.hasSearched = false;\n // determines whether 'Load more' button should be showing. only show when there\n // are search results. hide if 'Load more' search doesn't return additional results\n vm.showLoadMore = false;\n // determines offset for search results when the user clicks 'Load more'\n vm.pageOffset = 0;\n // get options for search field dropdowns\n vm.animals = PetShelterConstants.getAnimals();\n vm.breeds = PetShelterConstants.getBreeds();\n vm.sizes = PetShelterConstants.getSizes();\n vm.sexes = PetShelterConstants.getSexes();\n vm.ages = PetShelterConstants.getAges();\n // do initial search if there are search parameters in the URL\n if (!$.isEmptyObject($location.search())) {\n vm.query = $location.search();\n vm.search(vm.query);\n }\n }", "function _init() {\n console.log(\"Initialized.\");\n vm.service.getById('/api/character/', vm.id)\n .then(_getByIdSuccess, _error);\n }", "function _init() {\n vm.service.tncGetAll()\n .then(_tncGetAllSuccess, _tncGetAllError);\n }", "function init() {\n // var promise = WebsiteService.findAllWebsitesForUser(userId);\n // promise\n // .success(function(websites) {\n // vm.websites = websites;\n // })\n // var url = \"https://bgg-json.azurewebsites.net/hot\";\n // $http.get(url)\n // .success(function(result) {\n // vm.games = result;\n // });\n\n }", "function init() {\n OdhecatonUserService\n .findUserById(vm.userId)\n .success(renderUser);\n\n LibraryService\n .findAllDirLibrariesForUser(vm.userId)\n .success(renderDirLibraries);\n\n LibraryService\n .findAllMemLibrariesForUser(vm.userId)\n .success(renderMemLibraries);\n\n // LibraryService\n // .findAllMemLibrariesForUser(vm.userId)\n // .success(renderMemLibraries);\n\n LibraryService\n .findLibraryById(vm.libraryId)\n .success(renderLibrary);\n\n }", "function init() {\n\n UserService\n // .findUserById(userId)\n .findCurrentUser() //returning the current user from session which is stored in req.user on server\n .success(function (user) {\n if(user != '0') {\n vm.user = user;\n }\n })\n .error(function () {\n\n });\n }", "function init(){\n controllerInit(routerInitModel);\n serviceFilter(globalEmitter,'userAccount',globalCallBackRouter,commonAccessUrl,guardKey)\n createAccount(globalEmitter,'createAccount',globalCallBackRouter,commonAccessUrl,guardKey)\n updateAccount(globalEmitter,'updateAccount',globalCallBackRouter,commonAccessUrl,guardKey)\n //genericDataAccess(dataAccessInitModel);\n}", "init(){\n \n }", "function init() {\n $http.get('http://localhost:24099/api/cars')\n .success(function (data) {\n $scope.myItems = data;\n $scope.myCars = data;\n });\n }", "function init(){ // función que se llama así misma para indicar que sea lo primero que se ejecute\n carreraCtrl.carreras = carreraService.getCarreras();\n }", "function init() {\n\t\t\tinitAccessories();\n\t\t}", "_startUp()\n {\n // Check debug.\n if (RodanClientCore.config.DEBUG)\n {\n Radio.tuneIn('rodan');\n }\n\n this._initializeRadio();\n this._initializeControllers();\n this._initializeBehaviors();\n this._initializeDateTimeFormatter();\n this.addRegions({regionMaster: '#region-master'});\n this._initializeViews();\n require('./.plugins');\n }", "function init() {\n $scope.name = 'World';\n $scope.userPosition = null;\n $scope.eventRange = bg.storage.eventRange || 20;\n $scope.unitsInKilometres = bg.storage.unitsInKilomteres || true;\n $scope.currentEvent = null;\n $scope.eventQueue = new Queue();\n $scope.loadingQueue = new Queue();\n $scope.appName = APP_NAME;\n $scope.showTooltip = false;\n $scope.findEventsNextWeekend = bg.storage.findEventsNextWeekend || false;\n\n //begin fetching location\n load('Fetching location...');\n navigator.geolocation.getCurrentPosition(geoHandler); //get location, pass response to handler\n }", "function init() {\n websiteService.findAllWebsitesForUser(vm.userId)\n .then(function (websites) {\n vm.websites = websites;\n });\n }", "function init() {\n $scope.customers = customersService.getCustomers();\n }", "async function initServices() {\n await Vue.prototype.$appService.init()\n await Vue.prototype.$reviewAppService.init()\n}", "$onInit() {\n \n }", "function _init() {\n vm.loading = true;\n vm.success = false;\n vm.errmsg = null;\n _loadHome();\n }", "function module_init() {\n angular.module('nl.expression_processor', [])\n .service('nlExpressionProcessor', nlExpressionProcessor);\n}", "initialise() {\n cLogger('Initialising data state');\n // listen for socket events\n socketManager.setListener(this);\n // load the users\n this.getAllUsers();\n // load the entries\n this.getAllEntries();\n }", "function onInit() {\n vm.lists = mainService.get();\n }", "function init() {\n\t\tloadPosts();\n\t\tloadPages();\n\t\tloadCategories();\n\t\tloadTags();\n\t}", "function initialise() {\n\t\t\t\n\t\t\t$scope.title = \"My Project\";\n\n\t\t}", "function _init() {\r\n $sc['_name'] = CONTROLLER_NAME;\r\n\r\n $sc['servers'] = storedDataService.serversList;\r\n $sc['lastServerUpdateData'] = storedDataService.getLastServerData();\r\n\r\n _wholePosts = $posts;\r\n _wholePosts.forEach(function($$post){\r\n $$post['htmlContent'] = $marked($$post['content']);\r\n });\r\n\r\n $sc['posts'] = _wholePosts.slice(0, 1);\r\n $sc['posts_count'] = _wholePosts.length;\r\n\r\n $sc['search'] = _search;\r\n\r\n $hs.$scope.setTitle('Soyto.github.io');\r\n $hs.$scope.setNav('home');\r\n }", "function init(){\n UserService\n .findUserById(userId)\n .then(function (response) {\n vm.user = response.data;\n });\n }", "function initialize(){\n\n\t\t//sets all needed components, listeners, etc\n\t\tformatBodyPages();\n\t\tsetBodyTransitions();\n\n\t}", "function _init() {\r\n\r\n //Set name on scope\r\n $sc['_name'] = CONTROLLER_NAME;\r\n\r\n //Set title and navigation\r\n $hs['$scope'].setTitle(serverData['serverName'] + ' -> ' + serverData['date']);\r\n $hs['$scope'].setNav('ranking.list');\r\n\r\n $sc['data'] = _data;\r\n\r\n //Initialize serverData\r\n _initialize_versusData();\r\n _initialize_serverData();\r\n _initialize_navigation();\r\n _initialize_chartData();\r\n\r\n _initialize_pagination();\r\n\r\n _data['filter']['all_classess'] = storedDataService['characterClassIds'].where(function(itm){ return itm.id; });\r\n _data['filter']['all_ranks'] = storedDataService['characterClassIds']\r\n .where(function(itm){ return itm.id >= 10; })\r\n .sort(function(a, b){ return b.id - a.id; });\r\n }", "function init() {\n\t\t\tUser.all().success(function(data) {\n\t\t\t\t$rootScope.processing = false;\n\t\t\t\t$scope.users = data;\n\t\t\t});\n\t\t}", "initialize() {\n log('initialized');\n\n // Start listening to initialize events\n new Initializer();\n\n /**\n * App was initialized but hasn't started yet.\n *\n * @event App#init\n */\n this.channel.trigger('init');\n\n // Render the layout\n this.layout.render();\n }", "function init() {\n setupListeners();\n }", "function initialize(){\n initAPIKeys();\n initMap();\n}", "start() {// Your initialization goes here.\n }", "$onInit() {\n\n\t\tymaps.ready(() => {\n\n\t\t\t// Get location through browser native geolocation\n\t\t\tymaps.geolocation.get({\n\t\t\t\tprovider: \"browser\",\n\t\t\t\tmapStateAutoApply: true\n\t\t\t}).then((result) => {\n\t\t\t\tthis.initMap(result.geoObjects.position);\n\t\t\t}, (error) => {\n\t\t\t\tconsole.warn(error);\n\n\t\t\t\t// If something wrong run yandex provided geolocation api\n\t\t\t\tymaps.geolocation.get({\n\t\t\t\t\tprovider: \"yandex\",\n\t\t\t\t\tmapStateAutoApply: true\n\t\t\t\t}).then((result) => {\n\t\t\t\t\tthis.initMap(result.geoObjects.position);\n\t\t\t\t});\n\n\t\t\t});\n\t\t});\n\t}", "function init () {\n // Here below all inits you need\n }", "constructor() {\n\t\tthis.app = express();\n\t\tthis.initExpress();\n\t\tthis.initExpressMiddleWare();\n\t\tthis.initControllers();\n\t\tthis.start();\n\t}", "function init() {\n searchBookFactory.getBookById(bookId)\n .success(function (book) {\n $scope.book = book;\n })\n .error(function (data, status, headers, config) {\n $log.log(data.error + ' ' + status);\n });\n }", "start() {\n //DO BEFORE START APP CONFIGURATION/INITIALIZATION\n super.start();\n }", "init() {\n let vm = this;\n\n vm.entityTypesCollection = null;\n vm.entityTypes = [];\n\n vm.EntityTypesService.getAll().then(function(data){\n vm.entityTypesCollection = data;\n vm.entityTypes = vm.entityTypesCollection.models;\n });\n\n vm.localesCollection = null;\n vm.locales = [];\n\n vm.LocalesService.getAll().then(function(data){\n vm.localesCollection = data;\n vm.locales = vm.localesCollection.models;\n });\n }", "function init() {\n // load servers:\n deploymentsService.getServers().then(function (data) {\n vm.servers = data;\n }, function(reason) {\n console.log('Error fetching servers: ' + reason);\n });\n\n // load repositories:\n deploymentsService.getRepositories().then(function (data) {\n vm.repositories = data;\n }, function(reason) {\n console.log('Error fetching repositories: ' + reason);\n });\n\n // load deployment:\n var deploymentId = ($routeParams.deploymentId) ? parseInt($routeParams.deploymentId) : 0;\n deploymentsService.getDeploymentData(deploymentId).then(function(data) {\n vm.deployment = data;\n vm.refreshBranches();\n }, function(reason) {\n $location.path('/deployments');\n });\n }", "function INIT() {\n //--Check is Page Accessible\n $rootScope.CheckIsPageAccessible(\"Admin\", \"Location Quick Links\", \"View Countries\");\n //\n $scope.UserId = $rootScope.LoginUserDetail.UserId;\n GetCountryList();\n }", "function initController() {\n }", "$onInit() {\n this.moviesList = this.MoviesService.getMovies();\n }", "function init() {\r\n bindEventListeners();\r\n }", "function onReady() {\n angular.bootstrap(document, ['simple-social']);\n }", "function initialize(servicePath) {\n app.use(bodyParser.text({type: '*/*'}));\n logger.debug(\"Loading Services From: %s\", servicePath);\n\n // Recursively Traverse servicePath to load all services\n fsWalk.walkSync(servicePath, function (basedir, file, stat) {\n\n // Skip directory\n if (stat.isDirectory()) {\n return;\n }\n\n // Skip if file does not have a Service.js suffix\n if (file.indexOf(\"Service.js\") == -1) {\n return;\n }\n\n // Mount the router exposed by each controller.\n var serviceFile = path.join(basedir, file)\n var serviceName = file.slice(0, file.indexOf(\"Service.js\"));\n logger.debug(\"Processing Service: [%s] %s\", serviceName, serviceFile);\n\n // Instantiate and Cache Reference to Service\n service = require(serviceFile);\n service.init();\n servicesMap[serviceName] = service;\n });\n\n}", "static init() {\n console.log(\"App is Initialize...\");\n }", "function init () {\n\t\t//Get the unique [charity] userId so we know \n\t\t//which url to used for the server-side API\n\t\tvar userId = $('[data-event-config=\"userId\"]').val();\n\t\t\n\t\t//Initialise events collection\n\t\tfunction initCollection () {\n\t\t\tvar evts = new Evts({\n\t\t\t\tuserId: userId\n\t\t\t});\n\n\t\t\tinitFormView(evts);\n\t\t\tinitEventsBoard(evts);\n\t\t}\n\n\t\t//Initialise event form view\n\t\tfunction initFormView (evts) {\n\t\t\tvar $el = $('[data-event=\"configure\"]');\n\t\t\tnew EventForm({\n\t\t\t\tel: $el,\n\t\t\t\tcollection: evts\n\t\t\t});\n\t\t}\n\n\t\t//Initialise events board with persisted events\n\t\tfunction initEventsBoard (evts) {\n\t\t\tvar $el = $('[data-events-board]');\n\t\t\tnew EventBoard({\n\t\t\t\tel: $el,\n\t\t\t\tcollection: evts\n\t\t\t});\n\t\t}\n\n\t\t//Start up everything\n\t\tinitCollection();\n\t}", "initializing() {\n this.initializeBoilerplate();\n }", "function init() {\n // connect to the taco database\n dbRef = firebase.database();\n\n // wire up the taco eaters collection\n tacoEatersRef = dbRef.ref('tacoEaters');\n tacoEatersCollection = $firebaseArray(tacoEatersRef);\n tacoEatersRef.on('value', function (snapshot) {\n var eaters = snapshotToArray(snapshot);\n service.users = _.map(eaters, mapUsers);\n $rootScope.$broadcast('firebase.usersUpdated');\n\n // set up activity and leaderboard\n service.activity = getActivityFeed(service.users);\n console.log(service.activity);\n service.leaderboard = getLeaderBoard(service.users);\n });\n\n // set up the user ref if we can\n addUserRef();\n }", "function initilizeController(){\n }", "function init () {\n Accordion.initAll()\n Alert.initAll()\n Disclosure.initAll()\n Dropdown.initAll()\n FileInput.initAll()\n Dialog.initAll()\n Sidenav.initAll()\n Switch.initAll()\n Tabs.initAll()\n}", "function init () {\n var url = 'http://localhost:3000/api/empleado';\n $http({\n method: 'GET',\n url: url\n }).then(function success(response) {\n vm.empleados = response.data\n }).catch(function err(error) {\n console.log(error)\n })\n }", "start() {\n Backend.init();\n Sessions.init();\n }", "function initExampleServices(services) {\n\t\n\t// an example of how to create a custom service\n\tlogger.info(\"Create the ExampleShapeManager service\")\n\tvar shapeManager = ExampleShapeManager.findService(services);\n\t\n\t//add any other service initialization code here\n}", "function $onInit () {\r\n DataService\r\n .pullDataDictionary()\r\n .then(function (dataDictionary) {\r\n self.dataDictionary = dataDictionary;\r\n });\r\n }", "constructor() {\n this.services = [];\n }", "constructor() { \n \n ServiceInstance.initialize(this);\n }", "function startAngular() {\n\t\tangular.element(document).ready(\n\t\t\tfunction() {\n\t\t\t\t// Angular bootstrap starts the application\n\t\t\t\tangular.bootstrap(document, ['app'], {\n\t\t\t\t\tstrictDi: true\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}", "constructor(Wallet, Alert, DataStore, $filter, $timeout, $http, $state) {\n 'ngInject';\n\n //// Module dependencies region ////\n\n this._Alert = Alert;\n this._Wallet = Wallet;\n this._DataStore = DataStore;\n this._$filter = $filter;\n this._$timeout = $timeout;\n this._$http = $http;\n this._Helpers = Helpers;\n this._$state = $state;\n\n //// End dependencies region ////\n \n // Initialization\n this.init();\n }", "function initializeController() {\n }", "function initializeController() {\n }", "function init() {\n express = require('express')\n router = express.Router()\n bodyParser = require('body-parser');\n\n actions = require('./actions');\n representation = require('./representation');\n transitions = require('./transitions');\n utils = require('./lib/utils');\n\n // set up request body parsing & response templates\n router.use(bodyParser.json({type:representation.getResponseTypes()}));\n router.use(bodyParser.urlencoded({extended:representation.urlencoded}));\n\n // load response templates and input forms\n templates = representation.getTemplates();\n forms = transitions.forms;\n}", "init () {\n // Load application configuration\n this.config = require('./config').init(this)\n\n // Axios Http client\n this.http = require('./http').init(this)\n\n // TigoPesa API client\n this.api = require('./api').init(this)\n\n // Init express app instance\n this.express = require('./express').init(this)\n\n // Init job queue\n this.jobs = require('./jobs').init(this)\n }", "function init () {\r\n\t\tconsole.log('all is loaded.');\r\n\t}", "function module_init() {\n angular.module('nl.ui.utils', ['nl.ui.keyboard'])\n .filter('nlDateTimeFormat', NlDateTimeFormat) // Usage: {{someDateJson | nlDateTimeFormat:\"date|minute(default)\"}}\n .filter('nlConvert', NlConvert) // Usage: {{someStr | nlConvert:convertDict}}\n .service('nlPrinter', PrinterSrv)\n .directive('nlCompile', Compile)\n .directive('nlLoading', LoadingDirective)\n .directive('nlNoCtxMenu', NoCtxMenuDirective)\n .directive('nlRetainAr', RetainArDirective)\n .directive('nlWaitOnClick', WaitOnClickDirective)\n .directive('nlFocusMe', FocusMeDirective)\n .directive('nlProgressLog', ProgressLogDirective)\n .directive('nlInlineHelp', InlineHelpDirective)\n .directive('nlProgressBar', ProgressBarDirective)\n .directive('nlSummaryBox', SummaryBoxDirective)\n .directive('nlSummaryBoxLg', SummaryBoxLgDirective)\n .directive('nlSummaryBoxSm', SummaryBoxSmDirective)\n .directive('nlSummaryBoxLarge', SummaryBoxLargeDirective)\n .directive('nlSummaryBoxLarge1', SummaryBoxLarge1Directive)\n .directive('nlIntelliTextarea', IntelliTextareaDirective)\n .filter('nlTrustUrl', TrustUrlFilter)\n .service('nlProgressLog', ProgressLogSrv);\n }", "constructor(){\n\t\t//console.log('API START');\n\t}", "function init(){\n initBackground();\n initNavBar();\n initLatestProjects();\n initCarrouselProjects();\n initDetailsProject();\n initGalleries();\n initContactForm();\n }", "init() {\n // Action to execute on load of the app\n }", "function init() {\n\t\tinitEvents();\n\t}", "function init() {\n initConnectionManager();\n initPingService();\n\n ros.connect(rosUrl);\n console.log('ros-connect-amigo initialized');\n}", "init()\r\n {\r\n var self = this;\r\n\r\n // set the template file for uri set method\r\n this.raumkernel.getSettings().uriMetaDataTemplateFile = \"node_modules/node-raumkernel/lib/setUriMetadata.template\";\r\n\r\n // set some other settings from the config/settings file\r\n // TODO: @@@\r\n //this.raumkernel.getSettings().\r\n\r\n // if there is no logger defined we do create a standard logger\r\n if(!this.parmLogger())\r\n this.createLogger(this.settings.loglevel, this.settings.logpath);\r\n\r\n this.logInfo(\"Welcome to raumserver v\" + PackageJSON.version +\" (raumkernel v\" + Raumkernel.PackageJSON.version + \")\");\r\n\r\n // log some information of the network interfaces for troubleshooting\r\n this.logNetworkInterfaces();\r\n\r\n // Do the init of the raumkernel. This will include starting for the raumfeld multiroom system and we\r\n // do hook up on some events so the raumserver knows the status of the multiroom system\r\n this.logVerbose(\"Setting up raumkernel\");\r\n this.raumkernel.parmLogger(this.parmLogger());\r\n // TODO: listen to events like hostOnline/hostOffline\r\n this.raumkernel.init();\r\n\r\n this.logVerbose(\"Starting HTTP server to receive requests\");\r\n this.startHTTPServer();\r\n\r\n this.logVerbose(\"Starting bonjour server for advertising\");\r\n // TODO: @@@\r\n }", "function init() {\n\t\t\tresetData();\n\t\t\trefreshTotalCount();\n\t\t\tloadVocabs();\n\t\t}", "init() {\n // Make sure we've got an exchange client for the request handling.\n this.router.use(this.initialiseExchangeClient.bind(this));\n this.router.get('/', this.query);\n this.router.post('/', this.create);\n this.router.get('/:id', this.get);\n this.router.delete('/:id', this.delete);\n }", "function init() {\r\n \r\n\t\t/**\r\n\t\t * Global settings\r\n\t\t */\r\n\t\t$rootScope.config = {};\r\n\t\t$rootScope.config.dateFormat = 'MMM d, y';\r\n\t\t$rootScope.config.today = new Date();\r\n\t\t\r\n\t\t/**\r\n\t\t * Set app access\r\n\t\t */\r\n\t\t$scope.access = true;\r\n\t\t$scope.errorCode = false;\r\n\t\t\r\n\t\t\r\n\t\t// avatar picture\r\n\t\t$scope.showAvatar = false;\r\n\t\t\r\n\t\t/**\r\n\t\t * Check master data\r\n\t\t * Check exception\r\n\t\t * Check user object\r\n\t\t * Check locations\r\n\t\t * Set languages\r\n\t\t */\r\n\t\tif(APP.CONFIG == null || angular.isUndefined(APP.CONFIG.data) || APP.CONFIG.data == null) {\r\n\t\t\t\r\n\t\t\t$scope.access = false;\r\n\t\t\t\r\n\t\t} else {\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * initialize the global level variables\r\n\t\t\t */\r\n\t\t\tvar config = APP.CONFIG.data;\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * User checking\r\n\t\t\t */\r\n\t\t\tif(angular.isUndefined(config.user) || config.user == null || angular.isUndefined(config.user.sso)) {\r\n\t\t\t\t$scope.access = false;\r\n\t\t\t} else {\r\n\t\t\t\t\r\n\t\t\t\t$scope.user = config.user;\r\n\t\t\t\t\r\n\t\t\t\t/**\r\n\t\t\t\t * Check for avatar picture\r\n\t\t\t\t *\r\n\t\t\t\t * @param null\r\n\t\t\t\t * @return bool\r\n\t\t\t\t */\r\n\t\t\t\tUtils.isImage($scope.user.sso).then(function(result) {\r\n\t\t\t\t\t\r\n\t\t\t\t\t$scope.showAvatar = result;\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * Location checking\r\n\t\t\t */\r\n\t\t\tif(config.locations.length == 0) {\r\n\t\t\t\t$scope.access = false;\r\n\t\t\t} else {\r\n\t\t\t\t\r\n\t\t\t\t/**\r\n\t\t\t\t * Set the home location\r\n\t\t\t\t */\r\n\t\t\t\t$rootScope.location = '';\r\n\t\t\t\t$rootScope.locations = config.locations;\r\n\t\t\t\t\r\n\t\t\t\tangular.forEach($rootScope.locations, function(location){\r\n\t\t\t\t\tif(location.isHome){\r\n\t\t\t\t\t\t$rootScope.location = location.id;\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * Set the preferred language\r\n\t\t\t */\r\n\t\t\tvar preferred = false;\r\n\t\t\t$rootScope.languages = config.languages;\r\n\t\t\t\r\n\t\t\tangular.forEach($rootScope.languages, function(language){\r\n\t\t\t\tif(language.isPreferred){\r\n\t\t\t\t\tpreferred = language.code;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\tif(angular.isUndefined(APP.CONFIG.data.user)){\r\n\t\t\t\tpreferred = 'en-GB'\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$cookies.langCode = (!$cookies.langCode) ? preferred : $cookies.langCode;\r\n\t\t\t$rootScope.langCode = $cookies.langCode;\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * Load the app language file\r\n\t\t\t */\r\n\t\t\t$rootScope.translation = APP.LANGUAGES[$cookies.langCode];\r\n\t\t}\r\n\t}", "function init() {\n\t\t//console.log(\"app.init()\");\n\t\tif(initDone) {\n\t\t\t//console.log(\"init already done.\");\n\t\t\treturn;\n\t\t} else {\n\t\t\tinitDone = true;\n\t\t}\n\n\t\t// Init HTML layout and from there the GUI/UI with interaction.\n\t\tlayout.init();\n\t\tscene.init();\n\t\t//ui.init();\n\t\t// Proceed directly to startup of the loop.\n\t\t//start();\n\t}", "initialize() {\n templates.loadTemplates()\n .then(() => {\n // Initialize GUIs\n GUI.initialize();\n\n // Initialize Others\n this.initializeAutoMinimize();\n this.initializeHotkeys();\n this.initializeIpcListeners();\n\n // Check dependencies and update poe.ninja\n this.checkDependencies();\n Pricecheck.updateNinja();\n Pricecheck.updatePoeData();\n return;\n })\n .catch((error) => {\n var errorMsg = \"Error initializing app\\n\" + JSON.stringify(error, null, 4);\n\n log.error(errorMsg);\n alert(errorMsg);\n windowManager.closeAll();\n return;\n });\n }", "initialize() {\n this.rootScope_.$on('$routeUpdate', this.onRouteUpdate.bind(this));\n this.initialized_ = true;\n this.onRouteUpdate();\n }", "function initialize() {\n loadMap();\n loadGroups();\n }", "function initializeAppEnv() {\n appEnv = cfenv.getAppEnv(appEnvOpts);\n if (appEnv.isLocal) {\n require('dotenv').load();\n }\n if (appEnv.services.cloudantNoSQLDB) {\n initCloudant();\n } else {\n console.error(\"No Cloudant service exists.\");\n }\n\n if(appEnv.services.conversation){\n console.log(\"Services\");\n initConversation();\n }else{\n console.error(\"No Conversation service exists\");\n }\n}", "function init() {\n autoScroll();\n countDown();\n fetchWeather();\n fetchDestinations();\n formValidation();\n }", "function module_init() {\n angular.module('nl.nl', [])\n .service('nl', Nl);\n}" ]
[ "0.62096035", "0.59624165", "0.58318615", "0.5751004", "0.5742075", "0.57262987", "0.5720235", "0.5676425", "0.5581177", "0.5578394", "0.55765706", "0.5570651", "0.556428", "0.5545863", "0.5534082", "0.5530031", "0.55104184", "0.5499722", "0.5494319", "0.54879725", "0.5461977", "0.54460615", "0.54404694", "0.54203963", "0.5413862", "0.5411039", "0.53907096", "0.5378572", "0.5363011", "0.5349715", "0.5346102", "0.53459275", "0.53384304", "0.5336237", "0.5328444", "0.5323276", "0.53187186", "0.5300511", "0.5293965", "0.5290488", "0.5284928", "0.5271433", "0.5271266", "0.5270227", "0.5267539", "0.5261671", "0.52588457", "0.5245645", "0.5244938", "0.5231567", "0.5221201", "0.522093", "0.5220611", "0.5212484", "0.51872575", "0.5184487", "0.51755005", "0.5174641", "0.51697415", "0.5163104", "0.5159338", "0.5152007", "0.5150407", "0.51476204", "0.5140589", "0.51356965", "0.5135205", "0.5131107", "0.5129614", "0.5129393", "0.51289874", "0.51282126", "0.5118969", "0.51188904", "0.51173866", "0.51162624", "0.5107116", "0.51014423", "0.5097922", "0.5097922", "0.509233", "0.50896674", "0.50879705", "0.50868416", "0.5082012", "0.5080492", "0.5075716", "0.5071973", "0.50687087", "0.5063291", "0.5061437", "0.5061039", "0.5056318", "0.50545937", "0.5053435", "0.5052377", "0.5048408", "0.504682", "0.50467116", "0.5036126" ]
0.5628387
8
Call back for when user selects an option
function onSelect(d) { alert(d.State); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clickOptiontoSelect(){\n\n}", "function getSelectedOption(){\n\n}", "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 }", "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 }", "function selectionMade()\n{\n\t//Get value currently selected\n\tvar e = document.getElementById(\"selector\");\n\tvar value = e.options[e.selectedIndex].value;\n\n //Enter neccessary function\n\tif(value == \"income\"){ setup(); }\n if(value == \"marijuana\"){ marijuana(); }\n}", "function optionChanged(){\n init();\n}", "onSelect() {}", "function onSelected($e, datum) {\n onAutocompleted($e,datum);\n }", "onSelect(event) {}", "function selectChange() {\n changeCouncil($(\"#selectCouncil option:selected\").val());\n}", "function SelectionChange() { }", "function SelectionChange() { }", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function optionChanged(selected){\n\tmakeBar(selected);\n\tmakeTable(selected);\n\tmakeBubbleMap(selected);\n}", "function optionClick(value, text) {\n addUserMessage(text);\n apiRequest(value);\n}", "onOptionSelect(evt, option) {\n var value,\n self = this;\n\n if (!option) {\n return;\n } // should not be possible to trigger a option under a disabled optgroup\n\n\n if (option.parentElement && option.parentElement.matches('[data-disabled]')) {\n return;\n }\n\n if (option.classList.contains('create')) {\n self.createItem(null, true, () => {\n if (self.settings.closeAfterSelect) {\n self.close();\n }\n });\n } else {\n value = option.dataset.value;\n\n if (typeof value !== 'undefined') {\n self.lastQuery = null;\n self.addItem(value);\n\n if (self.settings.closeAfterSelect) {\n self.close();\n } else if (!self.settings.hideSelected && evt.type && /mouse/.test(evt.type)) {\n self.setActiveOption(self.getOption(value));\n }\n }\n }\n }", "onSelect() {\n // Do something when a section instance is selected\n }", "onSelect() {\n // Do something when a section instance is selected\n }", "function mySelectEvent() {\n\n var selected = this.selected();\n if (selected === '1') {\n hStep=1;\n ItterNum=1;\n }\n\n if (selected === '2') {\n hStep=0.1;\n ItterNum=10;\n }\n\n if (selected === '3') {\n hStep=0.01;\n ItterNum=100;\n }\n\n}", "function onSelect(callback){\n\t\t\t_onSelectCallback = callback;\n\t\t}", "function selectOption() {\n let selection = document.querySelector('.pveSelect');\n let pveModal = document.querySelector('.pveModal');\n pveModal.style.cssText = 'display: none'; \n first.value = 'X';\n second.value = 'O';\n // determines which parts of code run\n if (selection.value == '2') {\n bestMove();\n GBModule.power('off');\n firstPlayer.winner('X');\n computer.power('off');\n AIGame.switch('on 2');\n playAgainPrompt.playAgain('on');\n } else if (selection.value == '1') {\n GBModule.power('off');\n firstPlayer.winner('X');\n computer.power('off');\n AIGame.switch('on 1');\n AIGame.random();\n playAgainPrompt.playAgain('on');\n\n }\n }", "selected(value) {\n value = this.convertOutput(value);\n this.set('model.' + this.get('field'), value);\n // Send action if it is passed.\n if (this.get('onSelect')) {\n this.get('onSelect')(value);\n }\n }", "_onChange(evt) {\n this.toggleActive().then(res => {\n this.dispatchEvent(new CustomEvent('selected-change',{\n bubbles: true,\n composed: true\n }))\n })\n }", "function optionChanged(newSelection) {\n console.log(newSelection);\n updateTable(newSelection);\n}", "function getSelectedChoice() {\n var selected = $(\"select\").val();\n var chosenAnswer = $( \"select option:selected\" ).text();\n\n answerFeedback(selected, chosenAnswer);\n\n }", "function select(fc) {\r\n document.getElementById('dropdown').value = fc;\r\n change();\r\n}", "function optionChanged(selectedPatientID) {\n console.log(selectedPatientID);\n buildCharts(selectedPatientID);\n populateDemographicInfo(selectedPatientID);\n}", "function handleOptionChange(selection) {\n setFieldValue(props.name, selection)\n props.onValueChange && props.onValueChange()\n }", "function selectAnswer() {\n\n}", "function handleDropdownSelection(e) {\n var $a = (0, _jquery2.default)(e.target);\n var value = $a.attr('data-value');\n updateOption(this, value, $a.hasClass('aui-dropdown2-checked'));\n}", "function optionListener(event) {\n let choice = event.target;\n checkAnswer(choice);\n // console.log(\"inside option event listener\")\n}", "function onChange() {\n // The current value of the combobox is in the value property.\n displayChoice(combobox.value);\n\n // Alternatively, you can use selectedIndex to get the selected item index.\n // Here, we output the index to the debug console.\n debug.trace(strings.SELECTED_INDEX + ': ' + combobox.selectedIndex);\n}", "function onSelect() {\n // Display correct data for the radio button checked.\n var sel = document.getElementById(\"dropdown\");\n update(mapData, sel.options[sel.selectedIndex].value);\n}", "function optionChanged(teamValue){\n \n\n console.log(`Team input from menu : ${teamValue}`);\n drawChart(teamValue);\n\n}", "function selectHandler() {\n var selectedItem = chart.getSelection()[0];\n if (selectedItem) {\n var value = data.getValue(selectedItem.row, 0);\n openPopup(value);\n // console.log('The user selected - ' + value);\n }\n }", "function selectchange(x,res,selectedval,targetdiv)\n {\n \n }", "change() {\n\n const divs = this.parent.querySelectorAll('[class^=\"toggle-select-\"],[class*=\" toggle-select-\"]');\n const selectOption = this.select.options[this.select.selectedIndex];\n let value;\n\n if(this.options.field == 'group')\n {\n value = selectOption.parentNode.label ? selectOption.parentNode.label.toLowerCase() : null;\n } else {\n value = selectOption.value;\n }\n\n // Toggle each div\n divs.forEach(div => {\n const isVisible = div.classList.contains('toggle-select-'+value);\n const inputs = div.querySelectorAll('select,textarea,input:not([type=\"hidden\"],[type=\"checkbox\"],[type=\"radio\"])');\n\n // Toggle the visible div\n isVisible ? div.classList.remove('d-none') : div.classList.add('d-none');\n\n // Toggle the inputs\n if(inputs)\n {\n this.toggleForm(inputs,isVisible);\n }\n\n });\n\n // Run the custom callback\n this.options.onChanged(value);\n\n }", "selectOption(optionId) {\n this.selectedOption = optionId;\n }", "_onChoiceChange(option, index) {\n\n if (this.props.multiSelect) {\n //Case Multi Select\n // Option info has the new selection state info for a specific item. \n // Option.selected has its new selection state, true or false. Index is its index. \n this._onChangeMulti(option);\n }\n else {\n //Case Single Select\n // Option info is undefined. The Index is the index of the newly selected item. \n this._onChangeSingle(index + 1);\n }\n }", "function _handleSelect(id) {\n selected(id);\n }", "function InitiateViewOption() {\n if ($(\".select-enable-btn\").text() == \"Select\") {\n $(location).attr('href', $(this).data(\"url\"));\n }\n}", "function y_select_change(self) {\n $(self).parent().find(\".attr-options\").fadeOut();\n var type = $(self).find(\":selected\").attr('type');\n if(type == \"gene\"){\n $(self).parent().find('.y-gene-attribute-select option:contains(\"select a specification\")').prop('selected', true);\n $(self).parent().find(\".y-gene-attribute-select\").fadeIn();\n var gene = $(self).find(\":selected\").val();\n } else {\n $(self).parent().find('.y-gene-attribute-select option:contains(\"select a specification\")').prop('selected', true);\n $(self).parent().find(\".y-gene-attribute-select\").fadeOut();\n $(self).parent().find(\"#y-data-type-container\").fadeOut();\n }\n }", "function optionChanged(id) {\n\n getData(id);\n}", "function selectChange() {\n var selected = jQuery(this).val();\n _this.getSearchService(selected).done(function(s) {\n _this.switchSearchServices(s);\n _this.eventEmitter.publish(\"SEARCH_SIZE_UPDATED.\" + _this.windowId);\n });\n _this.eventEmitter.publish(\"BROWSE_COLLECTION\", selected);\n }", "userQuerySubmit(selectedOption) {\n const _userOption = selectedOption === 'false' ? '' : this.userSelectedOption;\n if (_userOption) {\n this.select.emit(this.userSelectedOption);\n }\n else {\n // this.select.emit(false);\n }\n }", "_emitSelectEvent(option) {\n const event = new NovoOptionSelectedEvent(this, option);\n this.optionSelected.emit(event);\n }", "function optionChanged(selection) {\n // Select the input value from the form\n plottingAll(selection);\n}", "function optionChanged(newSampleID) {\n showDemographicInfo(newSampleID); \n drawBarGraph(newSampleID);\n drawBubbleChart(newSampleID); \n\n console.log(\"Dropdown changed to:\", newSampleID);\n}", "onchange() {}", "function optionChanged(id) {\n getData(id);\n}", "function changeSelectedOption(thisObject) {\n if (thisObject.value!=-1) {\n thisObject.form.submit();\n }\n}", "function select(option) {\n if (currentChoice) {\n currentChoice.deselect();\n }\n currentChoice = option;\n currentChoice.select();\n}", "function check_select() {\n if (select) {\n select.submitForm();\n } else {\n alert('Select not found');\n }\n }", "function optionChanged(id){\n showPlots(id);\n infoCard(id);\n}", "function selectbox() {\n var sim = document.getElementById(\"simple\");\n alert(\"the user is from: \" + sim.options[sim.selectedIndex].value);\n}", "function select() {\n /* Retrieving the index and the text of the selected option.\n https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_option_index\n */\n let index = document.getElementById(\"choice\").selectedIndex;\n\n let options = document.getElementById(\"choice\").options;\n\n let name = document.getElementById(\"dog\");\n name.innerHTML = options[index].value;\n\n /*\n To clear the timer from the previous slide show.\n */\n clearTimeout(timerID);\n\n /*\n Get the rest of the info through another Ajax, by passing the\n Id.\n */\n getInfo(options[index].id);\n }", "handleOptionChange(changeEvent){\n this.setState({\n selectedOption : changeEvent.target.value\n })\n }", "function doAfterSelectOptionChangedForHospitalExt(fieldName)\n{\n //Custom handling\n}", "function optionChanged(){\r\n var data=d3.select('option').node().value;\r\n getData(data)\r\n }", "function optionChanged(name){\r\n // Testing option change\r\n // console.log(name)\r\n buildCharts(name) \r\n demographicData(name)\r\n}", "function optionChanged(newSelection) {\n buildChart(newSelection);\n}", "function optionChanged(samplechoice) {\n\n buildCharts(samplechoice);\n meta(samplechoice);\n\n}", "function handleSelectOption() {\r\n $('body').on(\"submit\",'#js-questions', function(event) {\r\n event.preventDefault();\r\n let currentQues = STORE.questions[STORE.currentQuestion];\r\n let selectedOption = $(\"input[name=options]:checked\").val();\r\n if (!selectedOption) {\r\n alert(\"Avoidance of a selection will result in a justly fine or time in the nearest re-education center\");\r\n return;\r\n } \r\n let id_num = currentQues.options.findIndex(i => i === selectedOption);\r\n let id = \"#js-r\" + ++id_num;\r\n $('span').removeClass(\"right-answer wrong-answer\");\r\n if(selectedOption === currentQues.answer) {\r\n STORE.score++; \r\n $(`${id}`).append(`Correct. Your adherence will see positive results.<br/>`);\r\n $(`${id}`).addClass(\"right-answer\");\r\n }\r\n else {\r\n $(`${id}`).append(`Incorrect. <br/> The answer is \"${currentQues.answer}\"<br/> Your dissidence will be noted.`);\r\n $(`${id}`).addClass(\"wrong-answer\");\r\n }\r\n \r\n STORE.currentQuestion++;\r\n $(\"#js-score\").text(`Score: ${STORE.score}/${STORE.questions.length}`);\r\n $('#answer').hide();\r\n $(\"input[type=radio]\").attr('disabled', true);\r\n $('#next-question').show();\r\n });\r\n }", "function option_chosen() {\n var that = $(this);\n var token = that.parents('.custom_select:first');\n var main_option = token.find('.main_option');\n var candidates = token.find('.candidate_options');\n select.find('option').removeAttr('selected')\n select.find('option[seq_code=' + that.attr('seq_code') + ']').attr('selected', 'selected');\n var buffer = {\n text: that.text(), \n value: that.data('value'), \n seq_code: that.attr('seq_code')\n }\n that.text(main_option.text()).data('value', main_option.data('value')).attr('seq_code', main_option.attr('seq_code'));\n main_option.text(buffer.text).data('value', buffer.value).attr('seq_code', buffer.seq_code);\n candidates.hide();\t\n select.trigger('change');\n }", "optionClickedStaff(optionsList) {\r\n this.getGroupStaff(optionsList);\r\n}", "handleSelect(value) {\n\t\tthis.setValue(value, true)\n\t}", "dispatchSelectionResult() {\n let eventName = this.fieldName ? 'valueChanged' : 'recordselected';\n console.log('selected dropdown value -- ' + eventName);\n let payload = {\n canceled: this.selectedRecord ? false : true,\n recordId: this.selectedRecord ? this.selectedRecord.Id : '',\n value: this.selectedRecord,\n name: this.searchField\n };\n let selected = new CustomEvent(eventName, {\n detail: payload\n });\n this.dispatchEvent(selected);\n }", "function dropDown(event) {\n \tquery(event.target.name, event.target.value);\n }", "function onOptionClicked(option) {\r\n fetch(`https://${GetParentResourceName()}/clicked`, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json; charset=UTF-8',\r\n },\r\n body: JSON.stringify({\r\n option: option\r\n })\r\n }).then()\r\n}", "function optionChanged(){\r\n var dropdownMenu = d3.select('#selDataset');\r\n var subjectID = dropdownMenu.property('value');\r\n// run the plot data function (which includes the dropdownValue function)\r\n plotData(subjectID);\r\n}", "function optionChanged() {\n // Obtain selected sample from dropdown\n var selectedSample = Plotly.d3.select('select').property('value'); \n console.log('selectsamle_value : ' , selectedSample)\n // Call plot function with the new sample value\n fillOutTable(selectedSample);\n buildCharts(selectedSample);\n buildGauges(selectedSample);\n}", "function onOptionChange(selectedValue) {\n const { enumOptions } = this.state;\n const selectedIndex = findEnumOptionsIndex(enumOptions, selectedValue);\n\n this.setState({\n selectedIndex,\n selectedValue,\n });\n\n this.notifySelectionValue(selectedIndex, selectedValue);\n}", "function dd_change(selected_option) {\n $('.selectpicker').selectpicker('render');\n val = selected_option.attr(\"table\").substr(2)\n if (zoo != val) {\n zoo = val;\n set_zoo(selected_option.attr(\"search\"));\n }\n else {\n //updateData(selected_option.attr(\"search\"));\n };\n }", "handleSelect(event) {\n this.dispatchEvent(new CustomEvent('select', event));\n }", "function selectHandler() {\n var selectedItem = chart.getSelection()[0];\n if (selectedItem) {\n var value = data.getValue(selectedItem.row, selectedItem.column);\n alert('The user selected ' + value);\n }\n }", "function onSelect(event) {\r\n refresh(JSON.parse(event.data));\r\n}", "function optionChanged(id) {\n display_data(id);\n dyna_demos(id);\n}", "onChange(event) {\n this.props.onChange(event.target.selectedIndex);\n }", "function mySelectEvent() {\n let val = sel.value();\n if (val == 'square') {\n bgCol = new p5.Oscillator('square');\n } else if (val == 'triangle') {\n bgCol = new p5.Oscillator('triangle');\n } else if (val == 'sine') {\n bgCol = new p5.Oscillator('sine');\n }\n }", "function selectHandler() {\n var selectedItem = chart.getSelection()[0];\n if (selectedItem) {\n var value = data.getValue(selectedItem.row, selectedItem.column);\n alert('The user selected ' + value);\n }\n }", "function selectHandler() {\n var selectedItem = chart.getSelection()[0];\n if (selectedItem) {\n var value = data.getValue(selectedItem.row, selectedItem.column);\n alert('The user selected ' + value);\n }\n }", "onSelect(result) {\n var multiple = this.get('multiple')\n var value = multiple ? [] : null;\n var selectId = this.get('selectId');\n // If not multiple.\n if (!multiple && result) {\n value = result[selectId];\n }\n // If multiple.\n if (multiple && isArray(result)) {\n result.forEach(function (item) {\n value.push(item[selectId]);\n });\n }\n this.set('model.' + this.get('field'), value);\n // Send action if it is passed.\n if (this.get('onSelect')) {\n this.get('onSelect')(value);\n }\n }", "handleChange(selection) {\n this.setState({ selectedOption: selection });\n }", "function onSelect()\n\t{\n\t\tunit.div.toggleClass(\"selected\", unit.movePoints > 0);\n\t}", "function Changed()\n{\n \n\n if ($('#courseSelection option:selected').val() != 0) {\n var selected = $('#courseSelection option:selected').val();\n var decription = $('#courseSelection option:selected').text();\n\n alert('You Selected : ' + selected + '-' + ' ' + decription);\n }\n else\n alert('you must select a course');\n}", "function selected(value) { \r\n extraQuestion=value;\r\n}", "defineOptionEvent(e) {\n this.defineOption(e.detail);\n }", "function onItemChosen(callback) {\n events.itemChosen.push(callback);\n }", "function onOptionChanged() {\n var prom = pager.setState($scope.options);\n prom.then(ref, error, ref);\n ref();\n\n /** Refreshes the current data */\n function ref() {\n refresh(true);\n }\n }", "select() { this.selected = true; }", "_onSelect(option, isUserInput) {\n const wasSelected = this._selectionModel.isSelected(option);\n if (option.value == null && !this._multiple) {\n option.deselect();\n this._selectionModel.clear();\n if (this.value != null) {\n this._propagateChanges(option.value);\n }\n }\n else {\n if (wasSelected !== option.selected) {\n option.selected ? this._selectionModel.select(option) :\n this._selectionModel.deselect(option);\n }\n if (isUserInput) {\n this._keyManager.setActiveItem(option);\n }\n if (this.multiple) {\n this._sortValues();\n if (isUserInput) {\n // In case the user selected the option with their mouse, we\n // want to restore focus back to the trigger, in order to\n // prevent the select keyboard controls from clashing with\n // the ones from `mat-option`.\n this.focus();\n }\n }\n }\n if (wasSelected !== this._selectionModel.isSelected(option)) {\n this._propagateChanges();\n }\n this.stateChanges.next();\n }", "function optionChanged(newSampleID)\n\n { \n //Log new selection\n console.log(`User selected ${newSampleID}`) ;\n\n //Run functions to display data\n FillMetaData(newSampleID) ;\n\n DrawBarGraph(newSampleID) ;\n\n DrawBubbleChart(newSampleID) ;\n\n }", "_handleOptionFocus(e) {\n this._setActiveOption(e.detail.id);\n }", "function showOption() {\n\tclearRow();\n\tshowCalendar($(\"#m_select\").val(), $(\"#y_select\").val());\n}", "handleSelectChange(selectedOption) {\n if (selectedOption !== null) {\n this.setState({\n selectedOption,\n loading: true\n });\n this.handleApiData(selectedOption.value, selectedOption.label);\n }\n }", "function OnOptions()\n{\n\t// show options \n\tshowOptions = true;\n}", "function initOptions() {\n $('select#variant-select').change();\n}", "selectOption() {\n switch ( this.index ) {\n case 0:\n this.scene.start( 'GameScene' );\n break;\n }\n }" ]
[ "0.7469173", "0.7442079", "0.73111624", "0.73111624", "0.71811646", "0.7140011", "0.69488525", "0.6878511", "0.67932147", "0.67837125", "0.6767903", "0.6767903", "0.6751651", "0.6751651", "0.6751651", "0.6751651", "0.6738064", "0.67299914", "0.67264736", "0.67157793", "0.67157793", "0.67141384", "0.66204596", "0.6608667", "0.6602361", "0.6584899", "0.6555429", "0.65492713", "0.65480155", "0.6537369", "0.6529632", "0.6517564", "0.65126836", "0.65125144", "0.6505446", "0.64925826", "0.6492424", "0.6467566", "0.6463403", "0.6449444", "0.64461154", "0.64387065", "0.64247787", "0.6417687", "0.64139336", "0.6405155", "0.640146", "0.6383881", "0.63789046", "0.6372651", "0.63640755", "0.6359736", "0.63586634", "0.635593", "0.6355322", "0.6347179", "0.6328752", "0.6302045", "0.62821585", "0.6271673", "0.62615556", "0.6259068", "0.6252339", "0.6251177", "0.6243384", "0.6238932", "0.62376577", "0.6229506", "0.62282336", "0.6226138", "0.6215423", "0.6212946", "0.6212945", "0.62044334", "0.6202826", "0.61825633", "0.61825025", "0.6180453", "0.617991", "0.6169383", "0.61681694", "0.6165305", "0.6161746", "0.6161746", "0.6159368", "0.61591136", "0.61579084", "0.615246", "0.6152051", "0.614522", "0.6130839", "0.61282206", "0.6127973", "0.6127181", "0.61267024", "0.6123278", "0.61217594", "0.61210984", "0.6115664", "0.61075133", "0.61033964" ]
0.0
-1
Setup and render the autocomplete
function start() { var mc = autocomplete(document.getElementById('search')) .keys(keys) .dataField("State") .placeHolder("Search States - Start typing here") .width(960) .height(500) .onSelected(onSelect) .render(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setupAutoComplete() {\n autocomplete = new google.maps.places.Autocomplete(\n (document.getElementById('autocomplete')) /*,\n {types: ['geocode']}*/ );\n }", "AutocompleteAdapter() {}", "function autocomplete() {\nnew Ajax.Autocompleter ('autoCompleteTextField','menufield',\n'list.html',{});\n}", "function gfonts_setup_autocomplete(input) {\n // Not process if this isn't input\n if (input == null) return;\n // Setup ajax request for input field\n var link = 'index.php?jat3action=getFontList&jat3type=plugin&template='+template;\n new Autocompleter.Request.JSON(input, link, {\n onSelection: function(e) {\n gfonts_get_properties(null, null)\n }\n });\n}", "function init() {\n var autocomplete = new google.maps.places.Autocomplete(input);\n }", "render() {\n this.shadow.innerHTML = `\n <style>\n .autocomplete-container {\n margin: 10px 0px;\n padding: 5px 0px;\n }\n .autocomplete-label, autocomplete-input {\n display: block;\n margin: 5px 0px;\n }\n .autocomplete-input {\n padding: .375rem .75rem;\n width: 30%;\n outline: none;\n font-size: 1rem;\n line-height: 1.5;\n color: #495057;\n background-color: #fff;\n background-clip: padding-box;\n border: 1px solid #ced4da;\n border-radius: .25rem;\n transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;\n }\n </style>\n \n <div class=\"autocomplete-container\"> \n <label for=\"wizards\" class=\"autocomplete-label\">${this.label}</label>\n <input type=\"text\" class=\"autocomplete-input\" id=${this.inputId} name=${this.inputId} list=\"${this.inputId}List\">\n <datalist class=\"autocomplete-datalist\" id=${this.inputId}List>\n ${this.datalistOptions}\n </datalist>\n </div>\n `;\n }", "function autocomplete() {\n jQuery(function() {\n var names = baby.Name.toString().split(\",\");\n jQuery(\"#inputfordropdown\").autocomplete({\n source: names\n }); //testing SVC git\n });\n }", "_initializeAutocomplete() {\n Ember.assert('jquery-autocomplete.js must be loaded', typeof Ember.$().autocomplete === 'function');\n\n let options = this._options();\n\n const dataSourceConfigured = Ember.isPresent(options.get('serviceUrl')) || Ember.isPresent(options.get('lookup'));\n\n assign(options, this.get('autocompleteOptions') || {});\n\n Ember.assert('serviceUrl or lookup attributes must be provided', dataSourceConfigured === true);\n this.$().autocomplete(options);\n }", "function sonPageInit(){\n\t//all class autocomplete use autocomplete\n\t$('.autocomplete').each(function(){\n \t$(this).autocomplete({serviceUrl : TP_APP + '/Public/autocomplete'});\n \t});\n}", "autocomplete () {\n const input = $('input[data-role=fork-search-field][data-autocomplete=enabled]')\n const searchEngine = this.getSuggestionEngine('Autocomplete')\n\n // autocomplete (based on saved search terms) on results page\n // Init the typeahead search\n input.typeahead(null, {\n name: 'search',\n display: 'value',\n hint: false,\n limit: 5,\n source: searchEngine,\n templates: {\n suggestion (data) {\n return '<a><strong>' + data.value + '</strong></a>'\n }\n }\n }).bind('typeahead:select', function (ev, suggestion) {\n window.location.href = suggestion.url\n })\n\n // when we have been typing in the search textfield and we blur out of it, we're ready to save it\n input.on('blur', (e) => {\n if ($(e.currentTarget).val() !== '') {\n // ajax call!\n $.ajax({\n data: {\n fork: {module: 'Search', action: 'Save'},\n term: $(e.currentTarget).val()\n }\n })\n }\n })\n }", "function setUpAutoComplete(searchUrl) {\n $(\"#search-input\").autocomplete({\n source: function(request, response) {\n $.ajax({\n url: searchUrl,\n dataType: 'jsonp',\n data: {\n 'action': \"opensearch\",\n 'format': \"json\",\n 'search': request.term\n },\n success: function (data) {\n response(data[1]);\n }\n });\n }\n });\n}", "function initAutocomplete() {\n\n // Create the autocomplete object, restricting the search predictions to\n // geographical location types.\n autocomplete = new google.maps.places.Autocomplete(\n document.getElementById('autocomplete'), {types: ['geocode'], componentRestrictions: {country: 'au'}});\n \n // Avoid paying for data that you don't need by restricting the set of\n // place fields that are returned to just the address components.\n autocomplete.setFields(['formatted_address']);\n \n // When the user selects an address from the drop-down, populate the\n // address fields in the form.\n autocomplete.addListener('place_changed', fillInAddress);\n }", "function setUpAutocomplete() {\n $('#classInput')\n .addClass('ui-autocomplete-input')\n .attr('autocomplete', 'off')\n .autocomplete({\n source: abbrTags\n });\n}", "function setDropdown() {\n\n searchBar.autocomplete({\n source: availableTags, \n response: function(_, ui) {\n dropdownResponse = ui.content;\n }\n\n });\n searchBar.on(\"autocompletesearch\", function(_, ui){\n\n })\n }", "function autoCompleteShowData(input) {\n let allUsers = Object.keys(Users);\n autocomplete.innerHTML = \"\";\n //Check for Usernames that contain the input text\n if (input.length > 0) {\n for (let user in allUsers) {\n if (allUsers[user].includes(input)) {\n //Add to autocomplete ul\n let li = document.createElement(\"li\");\n let name = document.createElement(\"h3\");\n let email = document.createElement(\"p\");\n li.className = \"card\";\n name.innerHTML = `${allUsers[user]}`;\n email.className = \"email\";\n email.innerHTML = `${Users[allUsers[user]]}`;\n li.appendChild(name);\n li.appendChild(email);\n autocomplete.appendChild(li);\n }\n }\n }\n }", "function initAutocomplete() {\n autoComplete = new google.maps.places.Autocomplete(\n document.getElementById('address_autocomplete'),\n {types: []}\n );\n\n // Upon selecting address, populate form fields\n autoComplete.addListener('place_changed', fillInAddress);\n }", "function initAutocomplete() {\n // Create the autocomplete object, restricting the search predictions to\n // geographical location types.\n autocomplete = new google.maps.places.Autocomplete(\n document.getElementById('autocomplete'), {types: ['geocode']});\n\n // Avoid paying for data that you don't need by restricting the set of\n // place fields that are returned to just the address components.\n autocomplete.setFields(['address_component']);\n}", "function showResults () {\n const value = this.value\n const results = index.search(value, 8)\n // console.log('results: \\n')\n // console.log(results)\n let suggestion\n let childs = suggestions.childNodes\n let i = 0\n const len = results.length\n\n for (; i < len; i++) {\n suggestion = childs[i]\n\n if (!suggestion) {\n suggestion = document.createElement('div')\n suggestions.appendChild(suggestion)\n }\n suggestion.innerHTML = `<b>${results[i].tablecode}</>: ${results[i].label}`\n // `<a href = '${results[i].tablecode}'> ${results[i]['section-name']} ${results[i].title}</a>`\n\n // console.log(results[i])\n }\n\n while (childs.length > len) {\n suggestions.removeChild(childs[i])\n }\n //\n // // const firstResult = results[0].content\n // // const match = firstResult && firstResult.toLowerCase().indexOf(value.toLowerCase())\n // //\n // // if (firstResult && (match !== -1)) {\n // // autocomplete.value = value + firstResult.substring(match + value.length)\n // // autocomplete.current = firstResult\n // // } else {\n // // autocomplete.value = autocomplete.current = value\n // // }\n }", "initAutoComplete() {\n if ($(\"#banner-search-bar\").length) {\n this.initAutoCompleteOn($('#banner-search-bar'));\n }\n this.initAutoCompleteOn($('#header-search-bar'));\n }", "function autocompleteSearch(searchString) {\n rawString = convertToRawString(searchString);\n autoOptions = trie.getWords(rawString, 5);\n var options = '';\n for(var i = 0; i < autoOptions.length; i++) {\n option = tagsDict[autoOptions[i]]\n options += '<option value=\"'+option+'\" />';\n }\n \n document.getElementById('search-autocomplete').innerHTML = options;\n}", "function jackfrost_input($, id, source, renderer){\n $(function(){\n var wrapper_text = $(\"#\" + id);\n wrapper_text.autocomplete({\n source: source\n }).data( \"autocomplete\" )._renderItem = function(ul, item){\n return __jackfrost_autocomplete_render(wrapper_text, ul, item);\n };\n if (typeof renderer != 'undefined') wrapper_text.bind(\"render\", renderer);\n });\n}", "function showAutoComplete(results){\n var autocomplete = document.getElementById(\"autocomplete-div\");\n autocomplete.innerHTML = '';\n for(var i = 0; i < results.length; i++){\n var element = document.createElement(\"li\");\n element.setAttribute('onclick','addCityToInput(this);');\n element.innerText = results[i];\n autocomplete.append(element);\n }\n autocomplete.style.display = 'block';\n autocomplete.scrollTop = 0;\n}", "function initAutocomplete() {\n // Create the autocomplete object, restricting the search to geographical location types.\n autocomplete = new google.maps.places.Autocomplete(\n /** @type {!HTMLInputElement} */\n (searchEl), {\n // options(from google documentation)\n types: ['geocode'],\n componentRestrictions: { country: \"us\" }\n })\n}", "function setupDialogAutoComplete(cm, inpElt) { \n function getSearchHistoryHints(inpValue) {\n var res = [];\n var hist = getSearchHistory(cm).getAll();\n for (var i = hist.length - 1; i >= 0; i--) {\n // all search query starts with inpValue, \n // including \"\" as inpValue\n if (!inpValue || hist[i].indexOf(inpValue) === 0) {\n if (res.indexOf(hist[i]) < 0) { // remove duplicates\n res.push(hist[i]); \n }\n }\n }\n // keep the reverse history order\n return res;\n } // function getCodeMirrorCommandHints()\n \n function autoCompleteSearchCmd(event) {\n // if Ctrl-space,\n if (\"Ctrl-Space\" === CodeMirror.keyName(event)) { \n event.preventDefault();\n /// console.debug('Trying to to complete \"%s\"', event.target.value);\n var inpValue = event.target.value;\n var inpElt = event.target;\n CodeMirror.showHint4Dialog(cm, function() {\n var data = {};\n data.list = getSearchHistoryHints(inpValue);\n data.inpElt = inpElt;\n return data;\n }, { pressEnterOnPick: false } ); \n } // if ctrl-space\n } // function autoCompleteSearchCmd(..)\n \n //\n // the main setup logic: add keydown to the input box specified \n // use keydown event rather than keypress to handle some browser compatibility issue\n //\n inpElt.onkeydown = autoCompleteSearchCmd;\n\n } // function setupDialogAutoComplete(..)", "function autocomplete(tpl, element) {\n var url = element.data('ajaxUrl'),\n results_el = element.closest('fieldset').find('.autocomplete_results ul'),\n cached_results = [];\n var result_tpl = _.template('<% _.each(results, function(result) { %><li>'+tpl+'</li><% }) %>');\n\n element.on('keyup', function(evt) {\n results_el.removeClass('populated');\n results_el.html('');\n var term = $(this).val();\n if (term.length >= 3) {\n var deferred = $.get(url, {term: term});\n $.when(deferred).then(function(data) {\n cached_results = $.parseJSON(data);\n results_el.addClass('populated');\n results_el.html(result_tpl(cached_results));\n });\n }\n });\n}", "function autocomplete(element, options) {\n // we require a url option - this is where we\n // get our list of potential words from\n if(!options.url) return console.error(\"autocomplete requires a url to work.\")\n\n var acInput = $(element),\n acList = $('<div>');\n\n // Turn off the browser-based autocomplete\n acInput.attr('autocomplete', 'off');\n\n // Add the autocomplete list to the page\n // beneath its corresponding input\n $('body').append(acList);\n var offset = acInput.offset();\n acList.offset({\n left: offset.left,\n top: offset.top + acInput.height()\n });\n\n // Helper function to populate the autocomplete\n // list with options that glow when hovered over\n // and complete the input when clicked.\n function populateList(choices) {\n // first empty the list\n acList.empty();\n // then add all choices as children\n choices.forEach( function(optionText) {\n var opt = $('<div>');\n opt.width(200);\n opt.html(optionText);\n opt.css('color', 'blue');\n opt.css('border', '1px solid blue');\n opt.css('background-color','white');\n opt.on('mouseover', function(){opt.css('background-color', 'yellow')});\n opt.on('mouseout', function(){opt.css('background-color', 'white')});\n opt.on('click', function(){\n acInput.val(optionText);\n if(options.click) options.click(optionText);\n acList.empty();\n });\n acList.append(opt);\n });\n }\n\n // Attach an 'input' event listener to the input\n // that will offer autocomplete options.\n acInput.on('input', function() {\n $.get({\n url: options.url + acInput.val(),\n success: function(data) {\n populateList(data);\n }\n });\n });\n}", "_updateAutoCompleteHelper() {\n const that = this;\n\n that.$.autoCompleteString.style.width = that.$.input.offsetWidth + 'px';\n that.$.autoCompleteString.style.height = that.$.input.offsetHeight + 'px';\n that.$.autoCompleteString.style.left = that.$.input.offsetLeft + 'px';\n that.$.autoCompleteString.style.top = that.$.input.offsetTop + 'px';\n\n if (!that._focusedItem) {\n that.$.autoCompleteString.textContent = '';\n return;\n }\n\n if (that._focusedItem[that.inputMember].length !== that.$.input.value.length) {\n that.$.autoCompleteString.textContent = that.$.input.value + that._focusedItem[that.inputMember].slice(that.$.input.value.length);\n }\n }", "function initAutocomplete() {\n\n\t // Récupération de la search box et lien vers l'UI element.\n\t var input = document.getElementById('pac-input');\n\t var searchBox = new google.maps.places.SearchBox(input);\n\t map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);\n\n\t // Bias the SearchBox results towards current map's viewport.\n\t map.addListener('bounds_changed', function() {\n\t searchBox.setBounds(map.getBounds());\n\t });\n\n\t var markers = [];\n\n\t searchBox.addListener('places_changed', function() {\n\t var places = searchBox.getPlaces();\n\n\t if (places.length == 0) {\n\t return;\n\t }\n\n\t markers.forEach(function(marker) {\n\t marker.setMap(null);\n\t });\n\t markers = [];\n\n\t var bounds = new google.maps.LatLngBounds();\n\t places.forEach(function(place) {\n\t var icon = {\n\t url: place.icon,\n\t size: new google.maps.Size(71, 71),\n\t origin: new google.maps.Point(0, 0),\n\t anchor: new google.maps.Point(17, 34),\n\t scaledSize: new google.maps.Size(25, 25)\n\t };\n\n\t markers.push(new google.maps.Marker({\n\t map: map,\n\t icon: icon,\n\t title: place.name,\n\t position: place.geometry.location\n\t }));\n\n\t if (place.geometry.viewport) {\n\n\t bounds.union(place.geometry.viewport);\n\t } else {\n\t bounds.extend(place.geometry.location);\n\t }\n\t });\n\t map.fitBounds(bounds);\n\t });\n \t}", "function setupAutocomplete(data) {\t\n\n\t$(\"#addTermText\").focus();\n\t$(\"#addTermText\").keydown(function(event){\n\t\tif (event.keyCode == '13') {\n\t\t\taddTerm();\n\t\t}\n\t});\n}", "render() {\n\t\treturn (\n\t\t\t<div className=\"search\">\n\t\t\t\t<Autocomplete\n\t\t\t\t\tgetItemValue={(item) => item.symbol}\n\t\t\t\t\titems={this.state.renderData}\n\t\t\t\t\trenderItem={(item, isHighlighted) =>\n\t\t\t\t\t\t<div style={{ background: isHighlighted ? 'lightgray' : 'white' }} key={item.symbol}>\n\t\t\t\t\t\t\t{item.symbol} - {item.name}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t\tvalue={this.state.searchTerm}\n\t\t\t\t\tonChange={this.handleChange}\n\t\t\t\t\tonSelect={this.handleSelect}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t)\n\t}", "function initAutoComplete(){\n // jQuery(\"#contact_sphinx_search\")\n // jQuery(\"#account_sphinx_search\")\n // jQuery(\"#campaign_sphinx_search\")\n // jQuery(\"#opportunity_sphinx_search\")\n // jQuery(\"#matter_sphinx_search\")\n jQuery(\"#search_string\").keypress(function(e){\n if(e.which == 13){\n searchInCommon();\n return jQuery(\".ac_results\").fadeOut();\n }\n });\n\n jQuery(\"#lawyer_search_query\").keypress(function(e){\n if(e.which == 13){\n searchLawyer();\n return jQuery(\".ac_results\").fadeOut();\n }\n });\n}", "render() {\n\t\tconst { text } = this.state;\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<form className=\"form-inline AutoCompleteText my-2 my-lg-0\">\n\t\t\t\t\t<input\n\t\t\t\t\t\tvalue={text}\n\t\t\t\t\t\tonChange={this.onTextChanged}\n\t\t\t\t\t\tclassName=\"form-control mr-sm-2 text-monospace\"\n\t\t\t\t\t\ttype=\"search\"\n\t\t\t\t\t\tplaceholder=\"SEARCH\"\n\t\t\t\t\t\taria-label=\"Search\"\n\t\t\t\t\t/>\n\t\t\t\t\t{this.renderSuggestions()}\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t);\n\t}", "function searchOverride() {\n /**\n * Keep a copy of the original function\n */\n AjaxControlToolkit.AutoCompleteBehavior.prototype._update2 = AjaxControlToolkit.AutoCompleteBehavior.prototype._update;\n\n /**\n * Highlight Search Term.\n *\n * @param {string} picUrl\n * Picture URL used for autocomplete search results.\n * @param {string} fullName\n * Full name of the person found for autocomplete search results.\n * @param {string} prefixText\n * Prefix text.\n *\n * @return {string} divElement\n * HTML for the particular autocomplete search result.\n */\n function buildSearchResult(picUrl, fullName, prefixText) {\n /**\n * Add highlighting of the search term.\n */\n var index = fullName.toLowerCase().indexOf(prefixText.toLowerCase());\n var userName = '';\n var divElement = '';\n\n if (index >= 0) {\n userName = fullName.substr(0, index) + '<b>' + fullName.substr(index, prefixText.length) + '</b>' + fullName.substr(index + prefixText.length);\n } else {\n userName = fullName;\n }\n\n divElement = '<div class=\"item\">\\n <div class=\"id\">\\n <div class=\"ms-tableCell ms-verticalAlignTop\">\\n <div class=\"ms-peopleux-userImgDiv\">\\n <div class=\"ms-imnSpan\">\\n <div style=\"width: 36px; height: 30px;\" id=\"ImgPicSpan1\" class=\"ms-peopleux-userImgWrapper ms-subtleLink ms-peopleux-imgUserLink\"><img style=\"cliptop: 0px; clipright: 36px; clipbottom: 36px; clipleft: 0px; min-height: 30px; max-height:30px; min-width: 30px; max-width: 30px;\" id=\"PictureDiv1\" class=\"ms-peopleux-userImg\" src=\"' + picUrl + '\"/></div>\\n </div>\\n </div>\\n </div>\\n <div id=\"PersonNameDiv\" class=\"ms-tableCell ms-verticalAlignTop\" >\\n <div>' + userName + '</div>\\n </div>\\n </div>\\n </div>';\n\n return divElement;\n }\n\n /**\n * Format Autocomplete Results.\n *\n * @param {object} results\n * Autocomplete results object.\n *\n * @return {array} names\n * Array of all of the people found for autocomplete results.\n */\n function formatAutocompleteResults(results, prefixText) {\n var names = [];\n var fullName = null;\n var picUrl = null;\n var divElement = null;\n\n for (var i = 0; i < results.length; i++) {\n picUrl = '/Style%20Library/VMSNet/images/Anniversaries/person.gif';\n if (results[i].Cells.results[2].Value !== null) {\n picUrl = results[i].Cells.results[2].Value;\n }\n fullName = results[i].Cells.results[3].Value;\n divElement = buildSearchResult(picUrl, fullName, prefixText);\n names.push(divElement);\n }\n return names;\n }\n\n /**\n * Format Autocomplete Results With Pictures.\n *\n * @param {object} results\n * Autocomplete results object.\n *\n * @return {array} names\n * Array of all of the people found for autocomplete results.\n */\n function formatAutocompleteResutlsWithPictures(results, prefixText) {\n var names = [];\n var fullName = null;\n var userName = null;\n var index = null;\n var picUrl = null;\n var divElement = null;\n\n for (var i = 0; i < results.length; i++) {\n fullName = results[i].Cells.results[3].Value;\n index = fullName.toLowerCase().indexOf(prefixText.toLowerCase());\n\n if (index >= 0) {\n userName = fullName.substr(0, index) + '<b>' + fullName.substr(index, prefixText.length) + '</b>' + fullName.substr(index + prefixText.length);\n }\n\n if (results[i].Cells.results[4].Value.indexOf('Person.aspx?accountname') > -1) {\n picUrl = '/Style%20Library/VMSNet/images/Anniversaries/person.gif';\n if (results[i].Cells.results[2].Value !== null) {\n picUrl = results[i].Cells.results[2].Value;\n }\n divElement = buildSearchResult(picUrl, fullName, prefixText);\n names.push(divElement);\n } else {\n names.push(userName);\n }\n }\n return names;\n }\n\n /**\n * Register the searchOnSuccess on the same prototype object in order for\n * the update2 function to keep the context with all variables.\n */\n AjaxControlToolkit.AutoCompleteBehavior.prototype.searchOnSuccess = function (data, prefixText, completionItems, cacheResults) {\n var results = null;\n var names = null;\n\n if (data.d) {\n if ($('a[id$=\"csr_NavButton\"]').text() === 'People') {\n if (data.d.query) {\n results = data.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results;\n }\n names = formatAutocompleteResults(results, prefixText);\n } else {\n results = data.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results;\n names = formatAutocompleteResutlsWithPictures(results, prefixText);\n }\n } else if (data.d.postquery) {\n results = data.d.postquery.PrimaryQueryResult.RelevantResults.Table.Rows.results;\n } else {\n throw 'Results not found';\n }\n\n /**\n * Put our results in the people name container as we're not using it on our page\n */\n completionItems.set_peopleNames(names);\n /**\n * Call the original update function which renders out the results.\n */\n this._update2(prefixText, completionItems, cacheResults);\n };\n\n /**\n * Register an overload update function which executes a real search.\n */\n AjaxControlToolkit.AutoCompleteBehavior.prototype._update = function (prefixText, completionItems, cacheResults) {\n var context = this;\n var prefixTextWithAll = prefixText + '*';\n var queryUrl = '/_api/search/query?rowlimit=15&querytext=\\'' + prefixTextWithAll + '\\'&sourceid=\\'2e49acca-b037-413c-a140-f62c5938e7d8\\'&refinementfilters=\\'title:phrase(%22' + prefixTextWithAll + '%22)\\'&fprequerysuggestions=true&selectproperties=\\'PictureURL, Title, Path\\'';\n\n $.ajax({\n /**\n * Get top 5 results searching only on title field. Other paramaters can\n * be added as well query term is what the user has entered with a\n * wildcard appended.\n */\n url: queryUrl,\n method: 'GET',\n headers: {\n accept: 'application/json;odata=verbose;charset=utf-8'\n },\n success: function success(data) {\n context.searchOnSuccess(data, prefixText, completionItems, cacheResults);\n },\n error: function error(_error) {\n console.warn('Warning: ' + _error);\n }\n });\n };\n }", "function selectorOrganismo()\n{ \n $('#ente').autocomplete({\n minLength:1, //le indicamos que busque a partir de haber escrito dos o mas caracteres en el input\n delay:1,\n position:{my: \"left top\", at: \"left bottom\", collision: \"none\"},\n source: function(request, response)\n {\n var url=$('#base_url').val()+\"registrar/listar_organismos\"; //url donde buscará los organismos\n $.post(url,{'frase':request.term,'tipo_organismo':$(\"#tipo_organismo\").val()}, response, 'json');\n },\n select: function( event, ui ) \n { \n $(\"#ente\").val( ui.item.organismo ); \n $(\"#id_organismo\").val(ui.item.id_organismo); \n return false;\n }\n }).data( \"autocomplete\" )._renderItem = function( ul, item ) {\n return $( \"<li></li>\" ) \n .data( \"item.autocomplete\", item )\n\t\t.append( \"<a>\" + ((item.organismo==undefined)?'Sin coincidencias':item.organismo) +\n \"<br/><span style='font-size:10px;'>\" +\n ((item.pertenece_a==undefined)?'':item.pertenece_a) + \"</span></a>\" )\n\t\t.appendTo( ul );\n\t };\n}", "function BindSearchToDealerName()\n{\n $(\"#searchByDealerNameText\").autocomplete(\n {\n minLength: 3,\n autofocus: true,\n source: function(request, response)\n {\n response(FilterDealerNames(request));\n },\n select: function(event, ui)\n {\n CreateCookie(\"SearchKeyword\", 'D_' + ui.item.label + '_' + ui.item.value);\n\n SelectDealer(ui.item.value);\n SelectDealerMarker(ui.item.value);\n $('#searchByDealerNameText').val(ui.item.label);\n return false;\n },\n focus: function(event, ui)\n {\n $('#searchByDealerNameText').val(ui.item.label);\n return false;\n },\n open: function(event, ui)\n {\n $('#directionsContainer').hide();\n $('#myDealersContainer').hide();\n return false;\n },\n close: function(event, ui)\n {\n $('#directionsContainer').show();\n $('#myDealersContainer').show();\n return false;\n }\n });\n}", "function autocomplete() {\n\n // Autocomplete for search location\n let autocompleteSearch = $(\"#search-location\")[0];\n var autocompletedSearch = new google.maps.places.Autocomplete(autocompleteSearch);\n\n}", "function initAutocomplete() {\n // Create the autocomplete object, restricting the search to geographical\n // location types.\n autocomplete = new google.maps.places.Autocomplete(\n /** @type {!HTMLInputElement} */(document.getElementById('source_point')),\n {types: ['geocode']});\n\n // When the user selects an address from the dropdown, populate the address\n // fields in the form.\n autocomplete.addListener('place_changed', function(){\n fillInAddress(autocomplete, 'source_point');\n });\n\n autocomplete2 = new google.maps.places.Autocomplete(\n /** @type {!HTMLInputElement} */(document.getElementById('drop_point_1')),\n {types: ['geocode']});\n\n autocomplete2.addListener('place_changed', function(){\n fillInAddress(autocomplete2, 'drop_point_1');\n });\n}", "function AutoComplete_Create (id, url) {\r\n if (document.getElementById(id) == null) { return; }\r\n //this will remove the onchange of the search textbox because the form was causing a postback\r\n document.getElementById(id).onchange = function(e) { return false; }\r\n __AutoComplete[id] = { 'url': url,\r\n 'isVisible': false,\r\n 'element': document.getElementById(id),\r\n 'dropdown': null,\r\n 'highlighted': null,\r\n 'close': null,\r\n 'term_at_close': \"\"\r\n };\r\n\r\n __AutoComplete[id]['element'].setAttribute('autocomplete', 'off');\r\n __AutoComplete[id]['element'].onkeydown = function(e) { return AutoComplete_KeyDown(this.getAttribute('id'), e); }\r\n __AutoComplete[id]['element'].onkeyup = function(e) { return AutoComplete_KeyUp(this.getAttribute('id'), e); }\r\n __AutoComplete[id]['element'].onkeypress = function(e) { if (!e) e = window.event; if (e.keyCode == 13 || isOpera) return false; }\r\n __AutoComplete[id]['element'].ondblclick = function(e) { return AutoComplete_DoubleClick(this.getAttribute('id'), e); }\r\n __AutoComplete[id]['element'].onclick = function(e) { if (!e) e = window.event; e.cancelBubble = true; e.returnValue = false; }\r\n\r\n if (document.addEventListener) {\r\n document.addEventListener('click', CloseSearchPanel, false);\r\n } else if (document.attachEvent) {\r\n document.attachEvent('onclick', CloseSearchPanel, false);\r\n }\r\n\r\n // Max number of items shown at once\r\n if (arguments[2] != null) {\r\n __AutoComplete[id]['maxitems'] = arguments[2];\r\n __AutoComplete[id]['firstItemShowing'] = 1;\r\n __AutoComplete[id]['lastItemShowing'] = arguments[2];\r\n }\r\n\r\n AutoComplete_CreateDropdown(id);\r\n \r\n }", "handleAutocompleteInput(e) {\n const self = this;\n\n if (self.isLoading()) {\n e.preventDefault();\n return false;\n }\n\n // Makes a new AJAX call every time a key is pressed.\n const waitForSource = this.getDataFromSource();\n waitForSource.done((term, response) => {\n self.currentDataSet = response;\n self.openList(term, response);\n });\n\n return null;\n }", "render() {\n const {showOptions, data, selected, searchKey, loading} = this.state;\n \n return <div className=\"auto-complete\" onClick={this.onContentClick}>\n <div className=\"label-c\">\n <input ref={this.inputRef} onBlur={this.onBlur} onChange={this.debounceSearch} onFocus={this.onFocus}/>\n {!showOptions &&\n <div className=\"label\" onClick={() => this.onFocus(null, true)}>{selected} {!selected && <span>Search</span>}</div> \n } \n </div>\n {showOptions && (\n <div className=\"dropdown\">\n {loading && <div className=\"loader\"></div>}\n {searchKey && data.length === 0 && !loading && <div className=\"no-res\">No Results</div>}\n <div className=\"lists\">\n {data.map(d => \n <div className=\"list-itm\" key={d.name} onClick={() => this.onSelect(d)}>\n <HighletText text={d.name} highlet={searchKey}/>\n </div>\n )}\n </div>\n </div>\n )}\n \n </div>\n }", "function initAutoComplete(element)\n{\n functionObjects = getFunctions();\n availableTags = [];\n for(q = 0; q < functionObjects.length; q++)\n {\n functionString = functionObjects[q].functionName;\n for(j = 0; j < functionObjects[q].arguments.length;j++){\n functionString += \" \" + functionObjects[q].arguments[j];\n }\n\n tmpObj = {\n label: functionString,\n value: functionObjects[q].functionName + \" \"\n };\n\n availableTags[q] = tmpObj;\n }\n\n $( element ).autocomplete({\n source: availableTags\n });\n\n}", "function search_init(){\n\n // DOM contact points.\n var form_elt = '#search_form';\n var search_elt = '#search';\n\n // Helper lifted from bbop-js: bbop.core.first_split\n // For documentation, see:\n // http://cdn.berkeleybop.org/jsapi/bbop-js/docs/files/core-js.html\n var first_split = function(character, string){\n\tvar retlist = null;\n\n\tvar eq_loc = string.indexOf(character);\n\tif( eq_loc == 0 ){\n retlist = ['', string.substr(eq_loc +1, string.length)];\n\t}else if( eq_loc > 0 ){\n var before = string.substr(0, eq_loc);\n var after = string.substr(eq_loc +1, string.length);\n retlist = [before, after];\n\t}else{\n retlist = ['', ''];\n\t}\n\t\n\treturn retlist;\n };\n\n // Override form submission and bump to search page.\n jQuery(form_elt).submit(\n\tfunction(event){\n\t event.preventDefault();\n\t \n\t var val = jQuery(search_elt).val();\n\t var newurl = \"http://\"+window.location.host+\"/search/\"\n\t\t+encodeURIComponent(val);\n\t window.location.replace(newurl);\n\t});\n\n // Arguments for autocomplete box.\n var ac_args = {\n\tposition : {\n \t my: \"right top\",\n at: \"right bottom\",\n\t collision: \"none\"\n\t},\n\tsource: function(request, response) {\n\t console.log(\"trying autocomplete on \"+request.term);\n\n\t // Argument response from source gets map as argument.\n\t var _parse_data_item = function(item){\n\t\t\n\t\t// If has a category, append that; if not try to use\n\t\t// namespace; otherwise, nothing.\n\t\tvar appendee = '';\n\t\tif( item ){\n\t\t if( item['category'] ){\n\t\t\tappendee = item['category'];\n\t\t }else if( item['id'] ){\n\t\t\t// Get first split on '_'.\n\t\t\tvar fspl = first_split('_', item['id']);\n\t\t\tif( fspl[0] ){\n\t\t\t appendee = fspl[0];\n\t\t\t}\n\t\t }\n\t\t}\n\n\t\treturn {\n\t\t label: item.term,\n\t\t tag: appendee,\n\t\t name: item.id\n\t\t};\n\t };\n\t var _on_success = function(data) {\n\n\t\t// Pare out duplicates. Assume existance of 'id'\n\t\t// field. Would really be nice to have bbop.core in\n\t\t// here...\n\t\tvar pared_data = [];\n\t\tvar seen_ids = {};\n\t\tfor( var di = 0; di < data.length; di++ ){\n\t\t var datum = data[di];\n\t\t var datum_id = datum['id'];\n\t\t if( ! seen_ids[datum_id] ){\n\t\t\t// Only add new ids to pared data list.\n\t\t\tpared_data.push(datum);\n\t\t\t\n\t\t\t// Block them in the future.\n\t\t\tseen_ids[datum_id] = true;\n\t\t }\n\t\t}\n\n\t\tvar map = jQuery.map(pared_data, _parse_data_item);\n\t\tresponse(map);\n\t };\n\n\t var query = \"/autocomplete/\"+request.term+\".json\";\n\t jQuery.ajax({\n\t\t\t url: query,\n\t\t\t dataType:\"json\",\n\t\t\t /*data: {\n\t\t\t prefix: request.term,\n\t\t\t },*/\n\t\t\t success: _on_success\n\t\t\t});\n\t},\n\tmessages: {\n noResults: '',\n\t results: function() {}\n },\n\tselect: function(event,ui) {\n\t if (ui.item !== null) { \n\t\tvar newurl = \"http://\"+window.location.host+\"/search/\"\n\t \t +encodeURIComponent(ui.item.label);\n\t\twindow.location.replace(newurl);\n\t }\n\t}\t\n };\n\n // Create our own custom rendering to make the categories a little\n // nicer to look at (as minor data).\n // http://jqueryui.com/autocomplete/#custom-data\n var jac = jQuery(search_elt).autocomplete(ac_args);\n jac.data('ui-autocomplete')._renderItem = function(ul, item){\n\tvar li = jQuery('<li>');\n\tli.append('<a alt=\"'+ item.name +'\" title=\"'+ item.name +'\">' +\n\t\t '<span class=\"autocomplete-main-item\">' +\n\t\t item.label +\n\t\t '</span>' + \n\t\t '&nbsp;' + \n\t\t '<span class=\"autocomplete-tag-item\">' +\n\t\t item.tag +\n\t\t '</span>' + \n\t\t '</a>');\n\tli.appendTo(ul);\n\treturn li;\n };\n}", "function set_suggestions(field, suggestions) {\n field.autocomplete({\n source: suggestions\n });\n}", "_autoComplete(noSelectionRefresh) {\n const that = this;\n\n if (that.autoComplete === 'list') {\n return;\n }\n\n if (that.$.listBox._items.length === 0 && typeof that.dataSource !== 'function') {\n that.close();\n return;\n }\n\n const value = that.$.input.value.length < that.minLength ? '' :\n (that.displayMode === 'escaped' ? that._toDefaultDisplayMode(that.$.input.value) : that.$.input.value), //displayMode is a jqxTextBox property\n isItemFocused = function (items) {\n for (let i = 0; i < items.length; i++) {\n if (items[i]._focused && items[i].hasAttribute('focus')) {\n return true;\n }\n }\n };\n\n let selectedItem;\n\n if (that.$.listBox.selectedValues.length === 1) {\n selectedItem = that.$.listBox.getItem(that.$.listBox.selectedValues[0]);\n }\n\n that.$.autoCompleteString.textContent = '';\n that.$.listBox.$.filterInput.value = that.autoComplete === 'none' || that.$.input.value.length < that.minLength ? '' : value;\n\n const queryCallback = function () {\n if (!that.$.listBox.isAttached || !that.$.input) {\n return;\n }\n\n const activeElement = that.enableShadowDOM ? that.shadowRoot.activeElement : document.activeElement;\n\n that._setDropDownSize();\n\n if (that.opened) {\n that._positionDetection.positionDropDown();\n that._positionDetection.checkBrowserBounds();\n }\n\n if (that.$.listBox._filteredItems && that.$.listBox._filteredItems.length > 0) {\n that.$.listBox._scrollView.scrollTop = that.$.listBox._filteredItems[0].offsetTop;\n\n if (that.autoComplete !== 'none' && that.$.input.value.length >= that.minLength && !isItemFocused(that.$.listBox._filteredItems)) {\n that._focus(that.$.listBox._filteredItems[0]);\n }\n\n if (activeElement === that.$.input && that.autoComplete === 'inline' && that.$.input.value.length >= that.minLength) {\n that._updateAutoCompleteHelper();\n }\n\n if (selectedItem && selectedItem[that.inputMember] === that.$.listBox._filteredItems[0][that.inputMember] && selectedItem.value === that.$.listBox._filteredItems[0].value) {\n that.$.listBox.context = that.$.listBox;\n that.$.listBox._select(that.$.listBox._filteredItems[0], true);\n that.$.listBox.context = listBoxContext;\n }\n\n if (value !== that.$.listBox._filteredItems[0][that.inputMember] || (JQX.TextBox && that instanceof JQX.TextBox && that.dropDownOpenMode === 'auto')) {\n if (that._closedFromKeyCombination) {\n that._closedFromKeyCombination = false;\n return;\n }\n\n if (value.length < that.minLength && !(JQX.TextBox && that instanceof JQX.TextBox && that.dropDownOpenMode === 'auto')) {\n that.close();\n return;\n }\n\n if (that.isCompleted && that.dropDownOpenMode !== 'none' && activeElement === that.$.input) {\n that.open();\n }\n }\n\n return;\n }\n\n that.close();\n }\n\n //Context Fix\n let listBoxContext = that.$.listBox.context;\n\n that.$.listBox.context = that.$.listBox;\n that.$.listBox._filterItems(noSelectionRefresh ? true : false, queryCallback, JQX.TextBox && that instanceof JQX.TextBox && that.dropDownOpenMode === 'auto');\n that.$.listBox.context = listBoxContext;\n\n }", "setAutoComplete() {\n var _this = this,\n inventory_id = this.getWareHouseId();\n $(\"#c_p_name\").autocomplete({\n source: this.productNames,\n select: function (event, ui) {\n var label = ui.item.label;\n var value = ui.item.value;\n _this.clearFields(['#c_p_quantity', '#c_p_r_price']);\n _this.setProductDetails(inventory_id, value);\n $(\"#c_p_quantity\").focus();\n _this.errors.clearErrors();\n }\n });\n }", "initAutocomplete() {\n // Create the autocomplete object, restricting the search predictions to\n // geographical location types.\n this.autocomplete = new google.maps.places.Autocomplete(\n document.getElementById(\"autocomplete\"),\n {\n types: [\"geocode\"],\n // types: [\"(cities)\"],\n componentRestrictions: { country: \"au\" },\n }\n ); // Avoid paying for data that you don't need by restricting the set of\n // place fields that are returned to just the address components.\n\n\n // this.autocomplete.addListener(\"place_changed\", this.fillInAddress());\n console.log(\"auto-complete\", this.autocomplete);\n }", "function setAutocomplete(tags){\n var dataArr = new Array();\n for ( var i = 0; i < tags.children.length; i++ ){\n for ( var j = 0; j < tags.children[i].children.length; j++ ){\n // use title, tag for label, category by tags\n var data = new Object();\n data['category'] = tags.children[i].title // tag name\n data['label'] = tags.children[i].children[j].title; // bookmark name\n dataArr.push(data);\n }\n }\n console.log(dataArr);\n $( \"#search\" ).bookmarkcomplete({\n delay: 0,\n source: dataArr\n });\n}", "function fillInputBoxWithContents()\n{\n $jq = jQuery.noConflict();\n element = jQuery(\"#message_emp_name\");\n element.autocomplete({source: empNames[\"listedEmployees\"]});\n}", "function initAutocomplete() {\n console.log('initAutocomplete => fired!', 'addressAutofillInstances', addressAutofillInstances);\n isMapsScriptLoaded = true;\n addressAutofillInstances.forEach(function (instance) {\n instance.init();\n });\n}", "function autocomplete_init(type) {\n\tvar input = document.getElementById('location_input_' + type);\n\tvar autocomplete = null;\n\tif (input){\n \tautocomplete = new google.maps.places.Autocomplete(input);\n\t}\n}", "function populateAutocompleteList(select, query, dropdown = false) {\r\n const {\r\n autocomplete_options\r\n } = getOptions(select);\r\n\r\n\r\n let options_to_show;\r\n\r\n if (dropdown)\r\n options_to_show = autocomplete_options;\r\n else\r\n options_to_show = autocomplete(query, autocomplete_options);\r\n\r\n const wrapper = select.parentNode;\r\n const input_search = wrapper.querySelector(\".search-container\");\r\n const autocomplete_list = wrapper.querySelector(\".autocomplete-list\");\r\n autocomplete_list.innerHTML = \"\";\r\n const result_size = options_to_show.length;\r\n\r\n if (result_size == 1) {\r\n\r\n const li = document.createElement(\"li\");\r\n li.innerText = options_to_show[0];\r\n li.setAttribute('data-value', options_to_show[0]);\r\n li.addEventListener(\"click\", selectOption);\r\n autocomplete_list.appendChild(li);\r\n if (query.length == options_to_show[0].length) {\r\n const event = new Event('click');\r\n li.dispatchEvent(event);\r\n\r\n }\r\n } else if (result_size > 1) {\r\n\r\n for (let i = 0; i < result_size; i++) {\r\n const li = document.createElement(\"li\");\r\n li.innerText = options_to_show[i];\r\n li.setAttribute('data-value', options_to_show[i]);\r\n li.addEventListener(\"click\", selectOption);\r\n autocomplete_list.appendChild(li);\r\n }\r\n } else {\r\n const li = document.createElement(\"li\");\r\n li.classList.add(\"not-cursor\");\r\n li.innerText = \"No options found\";\r\n autocomplete_list.appendChild(li);\r\n }\r\n}", "function initAutocomplete() {\n\n // Tononto\n lat = 43.6565353;\n lng = -79.601036;\n var center = { lat: lat, lng: lng };\n\n // create map instance.\n var map = new google.maps.Map(document.getElementById('map'), {\n center: center,\n zoom: 10,\n mapTypeId: 'roadmap'\n });\n\n // create center marker on map.\n var centerMarker = new google.maps.Marker({\n position: center,\n map: map,\n icon: 'http://maps.google.com/mapfiles/ms/icons/blue-dot.png'\n });\n\n var centeriw = new google.maps.InfoWindow({\n content: 'Search places near Toronto!',\n maxWidth: 300\n });\n // listeners for place markers.\n centerMarker.addListener('click', function () {\n centeriw.open(map, centerMarker);\n });\n\n // setup searchBox. provide predictions for search.\n var input = $('#search-input')[0];\n var searchBox = new google.maps.places.SearchBox(input);\n map.controls[google.maps.ControlPosition.TOP_CENTER].push(input);\n\n // Bias the SearchBox results towards current map's .\n map.addListener('bounds_changed', function () {\n searchBox.setBounds(map.getBounds());\n });\n\n // setup searchBox places change listener. Manipulations on new places.\n searchBox.addListener('places_changed', onPlacesChanged(searchBox, map));\n\n function input_submit_debug() {\n input.value = 'coffee';\n $(input).submit();\n }\n}", "function doRequest() {\n\t\t\tif ($scope.q.length > 2) {\n\t\t\t\tResults.getAutocomplete($scope.q).then(function (result) {\n\t\t\t\t\t$scope.suggestions = result.D;\n\t\t\t\t});\n\t\t\t}\n\t\t}", "function autocomplete(inp, arr) {\n /*the autocomplete function takes two arguments,\n the text field element and an array of possible autocompleted values:*/\n var currentFocus, val_a, val_b;\n var listWidth = inp.offsetWidth;\n var btn_id = \"\";\n /*execute a function when someone writes in the text field:*/\n inp.addEventListener(\"input\", function() {\n var a, b, i, val = this.value;\n /*close any already open lists of autocompleted values*/\n closeAllLists();\n if (!val) { return false;}\n currentFocus = -1;\n /*create a DIV element that will contain the items (values):*/\n a = document.createElement(\"DIV\");\n a.setAttribute(\"id\", this.id + \"autocomplete-list\");\n a.setAttribute(\"class\", \"autocomplete-items\");\n a.setAttribute(\"style\", \"width: \"+listWidth+\"px\");\n inp.setAttribute(\"style\",\"border-bottom-left-radius: 0 !important;\");\n /*append the DIV element as a child of the autocomplete container:*/\n this.parentNode.appendChild(a);\n /*for each item in the array...*/\n for (i = 0; i < arr.length; i++) {\n /*check if the item starts with the same letters as the text field value:*/\n val_a = arr[i].substr(0, val.length).toUpperCase().replace(\"Ã\",\"A\").replace(\"Á\",\"A\").replace(\"Ú\",\"U\");\n val_a = val_a.replace(\"Ç\",\"C\").replace(\"Ó\",\"O\");\n val_b = val.toUpperCase().replace(\"Ã\",\"A\").replace(\"Á\",\"A\").replace(\"Ú\",\"U\");\n val_b = val_b.replace(\"Ç\",\"C\").replace(\"Ó\",\"O\");\n if (val_a === val_b) {\n /*create a DIV element for each matching element:*/\n b = document.createElement(\"DIV\");\n //btn_id = $(this).parent().find(\"[type=submit]\").attr(\"id\");\n //b.setAttribute(\"onclick\", \"if (ValidateCity('\" + btn_id + \"') == 'true') { $('#'+btn_id).trigger('click'); }\");\n /*make the matching letters bold:*/\n //b.innerHTML = \"<i class='fas fa-map-marker-alt' style='font-size: 18px;position: absolute;left: 0;padding: 4px 12px 8px 15px;color: lightslategray;'></i>\";\n b.innerHTML = \"<strong style='color: dodgerblue;'>\" + arr[i].substr(0, val.length) + \"</strong>\";\n b.innerHTML += arr[i].substr(val.length);\n /*insert a input field that will hold the current array item's value:*/\n b.innerHTML += \"<input type='hidden' value='\" + arr[i] + \"'>\";\n /*execute a function when someone clicks on the item value (DIV element):*/\n b.addEventListener(\"click\", function() {\n /*insert the value for the autocomplete text field:*/\n inp.value = this.getElementsByTagName(\"input\")[0].value;\n /*close the list of autocompleted values,\n (or any other open lists of autocompleted values:*/\n closeAllLists();\n console.log(inp.id);\n btn_id = $('#'+inp.id).parent().find(\"[type=submit]\").attr(\"id\");\n if (ValidateCity(btn_id) === true) {\n $('#'+btn_id).trigger('click');\n }\n });\n\n if ($('.autocomplete-items > div').length === 4) {\n return;\n }\n a.appendChild(b);\n }\n }\n });\n /*execute a function presses a key on the keyboard:*/\n inp.addEventListener(\"keydown\", function(e) {\n var x = document.getElementById(this.id + \"autocomplete-list\");\n if (x) x = x.getElementsByTagName(\"div\");\n if (e.keyCode === 40) {\n /*If the arrow DOWN key is pressed,\n increase the currentFocus constiable:*/\n currentFocus++;\n /*and and make the current item more visible:*/\n addActive(x);\n } else if (e.keyCode === 38) { //up\n /*If the arrow UP key is pressed,\n decrease the currentFocus constiable:*/\n currentFocus--;\n /*and and make the current item more visible:*/\n addActive(x);\n } else if (e.keyCode === 13) {\n /*If the ENTER key is pressed, prevent the form from being submitted,*/\n e.preventDefault();\n if (currentFocus > -1) {\n /*and simulate a click on the \"active\" item:*/\n if (x) x[currentFocus].click();\n }\n }\n });\n function addActive(x) {\n /*a function to classify an item as \"active\":*/\n if (!x) return false;\n /*start by removing the \"active\" class on all items:*/\n removeActive(x);\n if (currentFocus >= x.length) currentFocus = 0;\n if (currentFocus < 0) currentFocus = (x.length - 1);\n /*add class \"autocomplete-active\":*/\n x[currentFocus].classList.add(\"autocomplete-active\");\n }\n function removeActive(x) {\n /*a function to remove the \"active\" class from all autocomplete items:*/\n for (var i = 0; i < x.length; i++) {\n x[i].classList.remove(\"autocomplete-active\");\n }\n }\n function closeAllLists(elmnt) {\n /*close all autocomplete lists in the document,\n except the one passed as an argument:*/\n var x = document.getElementsByClassName(\"autocomplete-items\");\n for (var i = 0; i < x.length; i++) {\n if (elmnt !== x[i] && elmnt !== inp) {\n x[i].parentNode.removeChild(x[i]);\n }\n }\n}\n /*execute a function when someone clicks in the document:*/\n document.addEventListener(\"click\", function (e) {\n closeAllLists(e.target);\n $(\".home_filter_city\").css(\"border-bottom-left-radius\",\"\");\n });\n}", "function autocomplete(inp, hashmap) {\n /*the autocomplete function takes two arguments,\n the text field element and an array of possible autocompleted values:*/\n\n var currentFocus;\n /*execute a function when someone writes in the text field:*/\n inp.addEventListener(\"input\", function(e) {\n\n var a, b, i, val = this.value;\n\n console.log(hashmap);\n var arr = hashmap[val[0].toLowerCase()];\n\n // Only autocomplete if length is bigger than 5\n if (val.length >= 5){\n /*close any already open lists of autocompleted values*/\n closeAllLists();\n if (!val) { return false;}\n currentFocus = -1;\n /*create a DIV element that will contain the items (values):*/\n a = document.createElement(\"DIV\");\n a.setAttribute(\"id\", this.id + \"autocomplete-list\");\n a.setAttribute(\"class\", \"autocomplete-items\");\n /*append the DIV element as a child of the autocomplete container:*/\n this.parentNode.appendChild(a);\n /*for each item in the array...*/\n for (i = 0; i < arr.length; i++) {\n /*check if the item starts with the same letters as the text field value:*/\n if (arr[i].substr(0, val.length).toUpperCase() == val.toUpperCase()) {\n /*create a DIV element for each matching element:*/\n b = document.createElement(\"DIV\");\n /*make the matching letters bold:*/\n b.innerHTML = \"<strong>\" + arr[i].toUpperCase().substr(0, val.length) + \"</strong>\";\n b.innerHTML += arr[i].toUpperCase().substr(val.length);\n /*insert a input field that will hold the current array item's value:*/\n b.innerHTML += \"<input type='hidden' value='\" + arr[i].toUpperCase() + \"'>\";\n /*execute a function when someone clicks on the item value (DIV element):*/\n b.addEventListener(\"click\", function(e) {\n /*insert the value for the autocomplete text field:*/\n inp.value = this.getElementsByTagName(\"input\")[0].value;\n /*close the list of autocompleted values,\n (or any other open lists of autocompleted values:*/\n closeAllLists();\n });\n a.appendChild(b);\n \n // if more than 3000 results and starts with U (as in university), break\n if (val[0].toLowerCase() == 'u' && i >= 3000)\n break;\n }\n }\n\n }\n });\n /*execute a function presses a key on the keyboard:*/\n inp.addEventListener(\"keydown\", function(e) {\n var x = document.getElementById(this.id + \"autocomplete-list\");\n if (x) x = x.getElementsByTagName(\"div\");\n if (e.keyCode == 40) {\n /*If the arrow DOWN key is pressed,\n increase the currentFocus variable:*/\n currentFocus++;\n /*and and make the current item more visible:*/\n addActive(x);\n } else if (e.keyCode == 38) { //up\n /*If the arrow UP key is pressed,\n decrease the currentFocus variable:*/\n currentFocus--;\n /*and and make the current item more visible:*/\n addActive(x);\n } else if (e.keyCode == 13) {\n /*If the ENTER key is pressed, prevent the form from being submitted,*/\n e.preventDefault();\n if (currentFocus > -1) {\n /*and simulate a click on the \"active\" item:*/\n if (x) x[currentFocus].click();\n }\n }\n });\n function addActive(x) {\n /*a function to classify an item as \"active\":*/\n if (!x) return false;\n /*start by removing the \"active\" class on all items:*/\n removeActive(x);\n if (currentFocus >= x.length) currentFocus = 0;\n if (currentFocus < 0) currentFocus = (x.length - 1);\n /*add class \"autocomplete-active\":*/\n x[currentFocus].classList.add(\"autocomplete-active\");\n }\n function removeActive(x) {\n /*a function to remove the \"active\" class from all autocomplete items:*/\n for (var i = 0; i < x.length; i++) {\n x[i].classList.remove(\"autocomplete-active\");\n }\n }\n function closeAllLists(elmnt) {\n /*close all autocomplete lists in the document,\n except the one passed as an argument:*/\n var x = document.getElementsByClassName(\"autocomplete-items\");\n for (var i = 0; i < x.length; i++) {\n if (elmnt != x[i] && elmnt != inp) {\n x[i].parentNode.removeChild(x[i]);\n }\n }\n }\n /*execute a function when someone clicks in the document:*/\n document.addEventListener(\"click\", function (e) {\n closeAllLists(e.target);\n });\n}", "function initAutocomplete() {\n autocomplete = new google.maps.places.Autocomplete(\n /** @type {!HTMLInputElement} */\n (document.getElementById(\"location\")), {\n types: [\"geocode\"]\n });\n autocomplete.addListener(\"place_changed\", callbackPlace);\n}", "function activateAutocomplete() {\r\n\r\n $( function() {\r\n\r\n $( \"#station\" ).autocomplete({\r\n source: stationsArray\r\n })\r\n } )\r\n}", "function initUI () {\n // Clear query when clear icon is clicked\n $('#searchBoxIcon').click(function () {\n $('#searchBoxInput').val('')\n $('#searchBoxInput').trigger('keyup')\n })\n\n // Event when chenging query\n $('#searchBoxInput').keyup(function () {\n var $searchResults = $('#searchResults')\n var query = $(this).val().trim()\n\n // Icon switching\n if (query.length) {\n $('#searchBoxIcon').attr('src', '/img/clear.png')\n $('#searchBoxIcon').css('cursor', 'pointer')\n } else {\n $('#searchBoxIcon').attr('src', '/img/search.png')\n $('#searchBoxIcon').css('cursor', 'default')\n }\n\n // Only trigger a search when 2 chars. at least have been provided\n if (query.length < 2) {\n $searchResults.hide()\n return\n }\n\n // Display search results\n renderResults(fuse.search(query))\n $searchResults.show()\n })\n\n // Emit keyup event for when the query is already setted with browser back etc.\n $('#searchBoxInput').trigger('keyup')\n}", "function autocompleteState() {\n $('#js-state-entry').autocomplete({\n data: {\n 'Alabama': null,\n 'Alaska': null,\n 'American Samoa': null,\n 'Arizona': null,\n 'Arkansas': null,\n 'California': null,\n 'Colorado': null,\n 'Connecticut': null,\n 'Delaware': null,\n 'District Of Columbia': null,\n 'Federated States Of Micronesia': null,\n 'Florida': null,\n 'Georgia': null,\n 'Guam': null,\n 'Hawaii': null,\n 'Idaho': null,\n 'Illinois': null,\n 'Indiana': null,\n 'Iowa': null,\n 'Kansas': null,\n 'Kentucky': null,\n 'Louisiana': null,\n 'Maine': null,\n 'Marshall Islands': null,\n 'Maryland': null,\n 'Massachusetts': null,\n 'Michigan': null,\n 'Minnesota': null,\n 'Missouri': null,\n 'Northern Mariana Islands': null,\n 'Mississippi': null,\n 'Montana': null,\n 'Nebraska': null,\n 'Nevada': null,\n 'New Hampshire': null,\n 'New Jersey': null,\n 'New Mexico': null,\n 'New York': null,\n 'North Carolina': null,\n 'North Dakota': null,\n 'Ohio': null,\n 'Oklahoma': null,\n 'Oregon': null,\n 'Palau': null,\n 'Pennsylvania': null,\n 'Puerto Rico': null,\n 'Rhode Island': null,\n 'South Carolina': null,\n 'South Dakota': null,\n 'Tennessee': null,\n 'Texas': null,\n 'Utah': null,\n 'Vermont': null,\n 'Virgin Islands': null,\n 'Virginia': null,\n 'Washington': null,\n 'West Virginia': null,\n 'Wisconsin': null,\n 'Wyoming': null,\n },\n limit: 10,\n onAutocomplete: null,\n minLength: 2,\n });\n}", "function autoComplete( selector, url, min_length)\n{\n\tmin_length = typeof min_length !== 'undefined' ? min_length : 1;\n\tvar cache = {};\n\t$( selector ).autocomplete({\n\t\tminLength: min_length,\n\t\tsource: function( request, response ) {\n\t\tvar term = request.term;\n\t\tif ( term in cache ) {\n\t\tresponse( cache[ term ] );\n\t\treturn;\n\t\t}\n\t\t$.getJSON( url, request, function( data, status, xhr ) {\n\t\tcache[ term ] = data;\n\t\tresponse( data );\n\t\t});\n\t\t}\n\t});\n}", "function clienteAutocomeplete(){\n $('#nombre').autocomplete({\n source : urlCliente,\n minLength: 0,\n width: 320,\n max: 4,\n highlight: false,\n scroll: true,\n scrollHeight: 300,\n select: function(event, ui){\n $('#NIT').val(ui.item.nit);\n $('#id-cliente').val(ui.item.id);\n }\n });\n}", "function autocomplete(container,inp, arr, keyField, labelField) {\n var currentFocus;\n var open = false;\n\n function showList(el)\n {\n open = true;\n var val = el.value;\n\n /*close any already open lists of autocompleted values*/\n\n closeAllLists();\n //if (!val) { return false;} // Close if nothing typed\n currentFocus = -1;\n /*create a DIV element that will contain the items (values):*/\n var itemsDiv = document.createElement(\"DIV\");\n itemsDiv.setAttribute(\"id\", el.id + \"autocomplete-list\");\n itemsDiv.setAttribute(\"class\", \"autocomplete-items\");\n /*append the DIV element as a child of the autocomplete container:*/\n el.parentNode.appendChild(itemsDiv);\n\n // var drowdownArrow = document.createElement(\"SPAN\");\n // drowdownArrow.innerHTML = \" ^ \"\n // el.parentNode.appendChild(drowdownArrow);\n\n\n /*for each item in the array...*/\n for (var i = 0; i < arr.length; i++) {\n\n var optionValue = arr[i][labelField];\n var optionLabel = arr[i][labelField];\n\n /*check if the item contains with the same letters as the text field value:*/\n var matchIndex = optionLabel.toUpperCase().indexOf(val.toUpperCase()) ;\n\n if (matchIndex != -1){\n\n /*create a DIV element for each matching element:*/\n var optionDiv = document.createElement(\"DIV\");\n /*make the matching letters bold:*/\n optionDiv.innerHTML = optionLabel.substr(0,matchIndex)+\"<strong>\" + optionLabel.substr(matchIndex, val.length) + \"</strong>\";\n optionDiv.innerHTML += optionLabel.substr(val.length + matchIndex, optionLabel.length);\n\n /*insert a input field that will hold the current array item's value:*/\n optionDiv.innerHTML += \"<input type='hidden' class='text' value='\" + optionLabel + \"'>\";\n\n itemsDiv.appendChild(optionDiv);\n\n /*execute a function when someone clicks on the item value (DIV element):*/\n optionDiv.addEventListener(\"click\", function(e) {\n /*insert the value for the autocomplete text field:*/\n inp.value = e.target.querySelector(\".text\").value;\n closeAllLists();\n });\n\n }\n }\n }\n //container\n\n inp.addEventListener(\"click\",function(e){\n open = true;\n e.stopPropagation();\n });\n\n\n inp.addEventListener(\"blur\",function(e){\n if(!open)\n {\n closeAllLists();\n open = false;\n }\n\n });\n\n\n inp.addEventListener(\"input\", function(e) {\n el = this;\n showList(el);\n\n });\n\n inp.addEventListener(\"click\", function(e) {\n el = this;\n showList(el);\n });\n inp.addEventListener(\"focus\", function(e) {\n el = this;\n showList(el);\n });\n\n\n\n /*execute a function presses a key on the keyboard:*/\n inp.addEventListener(\"keydown\", function(e) {\n\n var x = document.getElementById(this.id + \"autocomplete-list\");\n if (x) x = x.getElementsByTagName(\"div\");\n if (e.keyCode == 40) {\n /*If the arrow DOWN key is pressed,\n increase the currentFocus variable:*/\n currentFocus++;\n /*and and make the current item more visible:*/\n addActive(x);\n } else if (e.keyCode == 38) { //up\n /*If the arrow UP key is pressed,\n decrease the currentFocus variable:*/\n currentFocus--;\n /*and and make the current item more visible:*/\n addActive(x);\n } else if (e.keyCode == 13) {\n /*If the ENTER key is pressed, prevent the form from being submitted,*/\n e.preventDefault();\n if (currentFocus > -1) {\n /*and simulate a click on the \"active\" item:*/\n if (x) x[currentFocus].click();\n }\n }\n });\n\n function addActive(x) {\n /*a function to classify an item as \"active\":*/\n if (!x) return false;\n /*start by removing the \"active\" class on all items:*/\n removeActive(x);\n if (currentFocus >= x.length) currentFocus = 0;\n if (currentFocus < 0) currentFocus = (x.length - 1);\n /*add class \"autocomplete-active\":*/\n x[currentFocus].classList.add(\"autocomplete-active\");\n }\n\n /*a function to remove the \"active\" class from all autocomplete items:*/\n function removeActive(x) {\n\n for (var i = 0; i < x.length; i++) {\n x[i].classList.remove(\"autocomplete-active\");\n }\n }\n }", "autoComplete () {\n var that = this;\n var autocompleteOn = true;\n GEPPETTO.CommandController.availableTags();\n\n var commandInputAreaEl = $(\"#\" + this.props.id + \"_component #commandInputArea\");\n // bind console input area to autocomplete event\n commandInputAreaEl.bind(\"keydown\", function (event) {\n if (event.keyCode === $.ui.keyCode.TAB\n && $(this).data(\"ui-autocomplete\").menu.active) {\n event.preventDefault();\n }\n if (event.keyCode === $.ui.keyCode.BACKSPACE) {\n autocompleteOn = false;\n }\n })\n .autocomplete({\n minLength: 0,\n delay: 0,\n source: that.matches.bind(that),\n focus: function () {\n // prevent value inserted on focus\n return false;\n },\n open: function (event, ui) {\n if (autocompleteOn) {\n var suggestions = $(this).data(\"uiAutocomplete\").menu.element[0].children\n , firstElement = suggestions[0]\n , inpt = commandInputAreaEl\n , original = inpt.val()\n , firstElementText = $(firstElement).text()\n , suggestionsSize = suggestions.length;\n /*\n * here we want to make sure that we're not matching something that doesn't start\n * with what was typed in\n */\n if (firstElementText.toLowerCase().indexOf(original.toLowerCase()) === 0) {\n\n // only one suggestion\n if (suggestionsSize == 1) {\n if (inpt.val() !== firstElementText) {\n inpt.val(firstElementText); // change the input to the first match\n\n inpt[0].selectionStart = original.length; // highlight from beginning of input\n inpt[0].selectionEnd = firstElementText.length;// highlight to the end\n }\n } else {\n // match multiple suggestions\n if (inpt.val() !== \"\") {\n let mostCommon;\n var elementsText = [];\n for (var i = 0; i < suggestionsSize; i++) {\n elementsText[i] = $(suggestions[i]).text();\n }\n var A = elementsText.slice(0).sort(),\n word1 = A[0], word2 = A[A.length - 1],\n i = 0;\n if (word1 != word2) {\n while (word1.charAt(i) == word2.charAt(i)){\n ++i;\n }\n // match up most common part\n mostCommon = word1.substring(0, i);\n } else {\n mostCommon = word1;\n }\n\n if (inpt.val().indexOf(mostCommon) == -1) {\n inpt.val(mostCommon);// change the input to the first match\n\n inpt[0].selectionStart = original.length; // highlight from end of input\n inpt[0].selectionEnd = mostCommon.length;// highlight to the end\n }\n }\n }\n }\n } else {\n autocompleteOn = true;\n }\n }\n });\n }", "function init_auto_complete(ajaxSpinner){\n\tvar field = $(autoComplField)\n\tfield.autocomplete({\n\t\t\tminLength: 5,\n\t\t\tdelay: 750,\n\t\t\tsource: '/lookup.json',\n\t\t\tselect: function(event, ui) {\n\t\t\t\thandle_select(field,ui.item); \n\t\t\t},\n\t\t\tsearch: function(event, ui) { \n\t\t\t\t$( ajaxSpinner ).show();\n\t\t\t},\n\t\t\topen: function(event, ui) { \n\t\t\t\t$( ajaxSpinner ).hide();\n\t\t\t}\n\t\t});\n}", "function autocomplete() {\n /* TODO: things that need to be done:\n 1º: colocar a função no sitio em que alteramos a current_word ou no sitio que processamos o input do user\n 2º: o output vem numa lista de 3 strings. este output deve ser renderizado para o user\n 3º: também temos de fazer um botão/algum sitio em que o user possa selecionar qual a palavra que quer\n */\n $.ajax({\n type: \"POST\",\n url: autoCompleteWebServer,\n data: `${current_word}`,\n success: function (response) {\n suggested_words = response.replace(/'/g, \"\").split(\",\");\n console.log(suggested_words); // FIXME: remove this. is just used for reference and to see what is being passed\n },\n error: function (xhr, status) {\n console.log(status);\n console.log(xhr);\n },\n });\n}", "function initAutocomplete() {\n sourceQuery = new google.maps.places.Autocomplete((document.getElementById('source')),{\n types: ['geocode']\n });\n destinationQuery = new google.maps.places.Autocomplete((document.getElementById('destination')),{\n types: ['geocode']\n });\n sourceQuery.addListener('place_changed', fillInAddressSource);\n}", "function makeStructureAC(inputID,containerID){\r\n var structureAC = $(\"#\" + inputID).autocomplete({\r\n\t\tsource: function( request, response ) {\r\n\t\t\t$.ajax({\r\n\t\t\t\turl: fewiurl + \"autocomplete/gxdEmapa?query=\" + request.term,\r\n\t\t\t\tdataType: \"json\",\r\n\t\t\t\tsuccess: function( data ) {\r\n\t\t\t\t\tresponse($.map(data[\"resultObjects\"], function( item ) {\r\n\t\t\t\t\t\treturn {synonym: item.synonym, \r\n\t\t\t\t\t\t\tisStrictSynonym: item.isStrictSynonym, label: item.structure,\r\n\t\t\t\t\t\t\toriginal: item.structure};\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\tminLength: 2,\t\t\t\t\t// start making autocomplete suggestions at 2 characters\r\n\t\tautoFocus: true,\t\t\t\t// automatically select first item on Enter\r\n\t\tselect: function (event, ui) {\r\n\t\t\t$(\"#\" + inputID).val(ui.item.label);\r\n\t\t\t$('[name=vocabBrowserSearchForm]').submit();\r\n\t\t}\r\n }).data( \"ui-autocomplete\" )._renderItem = function( ul, item ) {\r\n\t\tvar value = highlight(inputID, item.original);\r\n\t\tif (item.isStrictSynonym) {\r\n\t\t\tvalue = highlight(inputID, item.synonym);\r\n\t\t\tvar synonymColor = item.hasCre ? \"#222\" : gq_disableColor;\r\n\t\t\tvalue += \" <span style=\\\"color:\"+synonymColor+\"; font-size:0.9em; font-style:normal;\\\">[<span style=\\\"font-size:0.8em;\\\">syn. of</span> \"+item.original+\"]</span> \";\r\n\t\t}\r\n\t\treturn $('<li class=\"ui-menu-item\"></li>')\r\n\t\t\t.data(\"item.autocomplete\", item)\r\n\t\t\t.append('<span>'+value+'</span>')\r\n\t\t\t.appendTo(ul);\r\n };\r\n}", "function _mod_search() {\n\t\"use strict\";\n\t// private section - following fields and functions are private and need to be accessed by methods provided in the public section\n\tvar _inputId;\n\tvar autoComplete = {};\n\n\tautoComplete.suggestion = {};\n\tautoComplete.suggestion.tags = [];\n\tautoComplete.suggestion.id = [];\n\tautoComplete.dictionaryTags = [];\n\n\t/****\n\t * create a completely new tag\n\t * @param id of the corresponding html list element\n\t * @param tag to be linked to the id\n\t * @return {Object}\n\t */\n\tfunction newIdTagPair(id, tag) {\n\t\tvar liElem = {};\n\t\tliElem.id = id;\n\t\tliElem.tags = [];\n\t\tliElem.tags.push(tag);\n\t\treturn liElem;\n\t}\n\n\t/****\n\t * filters a list while typing text into an input field and hides all\n\t * list items that don't match to the search string.\n\t * @param searchStr string that is currently in the search field (others would be possible to, but mostly senseless)\n\t * @param listRootId list to be filterd\n\t */\n\tfunction searchFilter(searchStr, listRootId) {\n\t\tvar match;\n\t\tvar searchIndex;\n\t\tvar i, j;\n\t\tvar nodeJQ;\n\t\tvar visibleNodes = [];\n\n\t\t// show all\n\t\tif (!searchStr || searchStr === \"\") {\n\t\t\tjQuery(\"#\" + listRootId).find(\"li\").andSelf().show();\n\t\t}\n\n\t\tsearchStr = searchStr.toLowerCase();\n\n\n\t\t// hide all nodes while traversing\n\t\t// not to nice implemented ;)\n\t\tfor (i = autoComplete.dictionaryTags.length - 1; i >= 0; i--) {\n\t\t\tnodeJQ = jQuery(\"#\" + autoComplete.dictionaryTags[i].id);\n\t\t\t//console.log(autoComplete.dictionaryTags[i].tags[0])\n\t\t\tmatch = null;\n\t\t\tfor (j = 0; j < autoComplete.dictionaryTags[i].tags.length; j++) {\n\t\t\t\tsearchIndex = autoComplete.dictionaryTags[i].tags[j].toLowerCase().match(searchStr);\n\t\t\t\tif (searchIndex) {\n\t\t\t\t\tmatch = nodeJQ;\n\t\t\t\t\t//select node in tree to highlight\n\t\t\t\t\tif (searchIndex === 0 && autoComplete.dictionaryTags[i].tags[j].length === searchStr.length) {\n\t\t\t\t\t\tMYAPP.tree.select_node(jQuery(\"#\" + autoComplete.dictionaryTags[i].id));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnodeJQ.hide();\n\n\t\t\tif (match) {\n\t\t\t\tvisibleNodes.push(match);\n\t\t\t}\n\t\t}\n\n\t\t// show matching nodes and all their parents\n\t\t// !!! todo: the method parents gos up to the html root but it should stop at the top of the list\n\t\tfor (i = visibleNodes.length - 1; i >= 0; i--) {\n\t\t\tvisibleNodes[i].parents(\"#treeList li\").andSelf().show();\n\t\t}\n\t}\n\n\t// private section END\n\n\n\t// public section\n\t// all methods that give access to the private fields and allow to process the menu\n\treturn {\n\t\t/****\n\t\t * @param treeRootId\n\t\t * id of the root of the list that should be filtered\n\t\t * @param inputId\n\t\t * id of the input field in witch should get the autocompleate function\n\t\t * @param dictionaryTags\n\t\t * an array that looks as followed:\n\t\t * [ { id: ... , tags: [..., ...]}, { id: ... , tags: [..., ...]} ]\n\t\t * the id is the id of the li element that should be processed,\n\t\t * the tag is an array with corresponding strings (if the search string matches\n\t\t * any of the tag string or tag substring in any position the li element is displayed.\n\t\t * if there is no match at all the li element will be hidden.\n\t\t *\n\t\t */\n\t\tinitSearch : function (treeRootId, inputId, dictionaryTags) {\n\t\t\tvar i, j;\n\n\t\t\tdictionaryTags = dictionaryTags || [];\n\t\t\t_inputId = inputId;\n\t\t\tautoComplete.dictionaryTags = dictionaryTags;\n\n\t\t\tfor (i = 0; i < dictionaryTags.length; i++) {\n\t\t\t\tfor (j = 0; j < dictionaryTags[i].tags.length; j++) {\n\t\t\t\t\tautoComplete.suggestion.tags.push(dictionaryTags[i].tags[j]);\n\t\t\t\t\tautoComplete.suggestion.id.push(dictionaryTags[i].id);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tjQuery(\"#\" + inputId).autocomplete({\n\t\t\t\tsource : autoComplete.suggestion.tags,\n\t\t\t\tselect : function (event, ui) {\n\t\t\t\t\tif (ui.item) {\n\t\t\t\t\t\tvar i = jQuery.inArray(ui.item.value, autoComplete.suggestion.tags);\n\t\t\t\t\t\tvar node = jQuery(\"#\" + autoComplete.suggestion.id[i]);\n\t\t\t\t\t\tMYAPP.tree.select_node(node);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\talert(\"Dieses Element ist im Objekt nicht enthalten.\");\n\t\t\t\t\t}\n\t\t\t\t\t//alert(ui.item ? ui.item.value: \"Nothing selected, input was \" + this.value );\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tjQuery(\"#\" + inputId).keyup(function () {\n\t\t\t\t//alert(\"\")\n\t\t\t\tsearchFilter(jQuery(\"#\" + inputId).val(), treeRootId);\n\t\t\t});\n\t\t\t// filter when x is pressed\n\t\t\tjQuery(\"#\" + inputId).parent().children(\".ui-input-clear\").mouseup(function () {\n\t\t\t\tsearchFilter(\"\", treeRootId);\n\t\t\t});\n\n\t\t},\n\t\t/****\n\t\t * push a new tag to the data set that is used to filter the html list\n\t\t * and to the data set that is the base for the autoComplete suggestions\n\t\t * @param id of the corresponding list element\n\t\t * @param tag that is being linked to the tag\n\t\t */\n\t\tpushTag : function (id, tag) {\n\t\t\tvar i;\n\t\t\tvar index = -1;\n\n\t\t\t//console.log(\" id \" + id + \" tag \" + tag + \" _inputId \" + _inputId)\n\t\t\tif (typeof id !== \"string\" || typeof tag !== \"string\") {\n\t\t\t\tconsole.error(\"data to push are not valid (mod_search->method pushTag(id, tag)\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfor (i = 0; i < autoComplete.dictionaryTags.length; i++) {\n\t\t\t\tif (autoComplete.dictionaryTags[i].id.match(id)) {\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (-1 < index) { // element with the submitted id already exists\n\t\t\t\tautoComplete.dictionaryTags[index].tags.push(tag);\n\t\t\t\t/*\n\t\t\t\t console.log(\n\t\t\t\t autoComplete.dictionaryTags[index].id[0] + \" --- \" +\n\t\t\t\t autoComplete.dictionaryTags[index].tags[0] + \" --- \" +\n\t\t\t\t autoComplete.dictionaryTags[index].id[1] + \" --- \" +\n\t\t\t\t autoComplete.dictionaryTags[index].tags[1]\n\t\t\t\t )\n\t\t\t\t */\n\t\t\t}\n\t\t\telse { // create new entry\n\t\t\t\tautoComplete.dictionaryTags.push(newIdTagPair(id, tag));\n\t\t\t\t//console.log(newIdTagPair(id, tag).id + \" --- \" + autoComplete.dictionaryTags[testI].id + \" --- \" + autoComplete.dictionaryTags[testI].tags[0] )\n\t\t\t}\n\n\t\t\tautoComplete.suggestion.tags.push(tag);\n\t\t\tautoComplete.suggestion.id.push(id);\n\n\t\t\t//console.log( autoComplete.suggestion.id[testI] + \" --- \" + autoComplete.suggestion.tags[testI] ) ;\n\t\t\t//console.log( id + \" --- \" + tag ) ;\n\n\t\t\tjQuery(\"#\" + _inputId).autocomplete('option', 'source', autoComplete.suggestion.tags);\n\t\t}\n\t};\n\t// public section END (return end)\n}", "function autoComp() {\n // FIXME Reset search field doesn't work\n // $('#searchTextField').val('');\n\n if (generalMarker !== '') {\n generalMarker.setMap(null);\n }\n\n $('#dynamicDivWrap').hide();\n\n generalMarker = new google.maps.Marker({\n map: map,\n icon: \"/assets/MarkerGrey.png\",\n animation: google.maps.Animation.DROP,\n draggable: true,\n });\n\n generalMarker.setVisible(false);\n\n input.className = '';\n var place = autocomplete.getPlace();\n if (!place.geometry) {\n // Inform the user that the place was not found and return\n input.className = 'notfound';\n return;\n }\n\n // If the place has a geometry, then present it on a map\n if (place.geometry.viewport) {\n map.fitBounds(place.geometry.viewport);\n } else {\n map.setCenter(place.geometry.location);\n map.setZoom(17);\n }\n\n generalMarker.setPosition(place.geometry.location);\n generalMarker.setVisible(true);\n\n var contentString = JST['templates/selectItem']();\n\n generalInfoWindow = new google.maps.InfoWindow({\n content: contentString,\n maxWidth: 500\n });\n\n google.maps.event.addListener(generalMarker, 'click', function() {\n if (generalInfoWindow.getMap() == null) {\n generalInfoWindow.open(map, this);\n } else {\n generalInfoWindow.close();\n }\n });\n}", "function initAutoComplete() {\n\n autocomplete = new google.maps.places.Autocomplete(heroSearchEle, {\n types: ['geocode']\n });\n\n //Get Lat, Lng: When user selects from dropdown\n google.maps.event.addListener(autocomplete, 'place_changed', function() {\n getLatLng();\n });\n}", "function autoComplete(PhpUrl, atributo, operacao, maxElements, inputSelector, accao, pegarDados) {\n var pesquisa = {\n //Pesquisa e o texto digitado\n url : function (pesquisar) {\n return PhpUrl;\n },\n\n getValue:atributo,\n\n ajaxSettings: {\n dataType: \"json\",\n method: \"POST\",\n data: {\n operacao : operacao\n }\n },\n\n list :{\n //sera executada a funcao accao quando for selecionada um item\n onClickEvent : accao,\n\n onSelectItemEvent: pegarDados,\n\n onChooseEvent : function () {\n return(($(inputSelector).val()));\n },\n maxNumberOfElements : maxElements,\n match : {\n enabled : true\n },\n showAnimation: {\n type: \"fade\",\n time: 400,\n callback: function() {}\n },\n hideAnimation: {\n type: \"slide\",\n time: 400,\n callback: function() {}\n }\n }\n }\n\n $(inputSelector).easyAutocomplete(pesquisa);\n}", "initUI() {\n const newInputEle = this.input.getDomEle().cloneNode(true);\n newInputEle.classList.add(this.setting.suggestionInput.className);\n \n /**\n * Plugin container Dom node\n * @type {Element}\n */\n const containerNode = document.createElement('div');\n containerNode.classList.add(this.setting.container.className);\n this.input.getDomEle().replaceWith(containerNode);\n this.containerNode = containerNode;\n \n this.input.setDomEle(newInputEle);\n containerNode.appendChild(this.input.getDomEle());\n \n \n const suggestListNode = document.createElement('div');\n suggestListNode.classList.add(this.setting.suggestionList.className);\n containerNode.appendChild(suggestListNode);\n this.dropdown.setSuggestListNode(suggestListNode);\n \n this.dropdown.setListNodeEle(document.createElement('ul'));\n this.dropdown.getSuggestListNode().appendChild(this.dropdown.getListNodeEle());\n }", "function autocomplete_init() {\n $(\"#gmaps-input-address\").autocomplete({\n\n // source is the list of input options shown in the autocomplete dropdown.\n // see documentation: http://jqueryui.com/demos/autocomplete/\n source: function(request,response) {\n\n // the geocode method takes an address or LatLng to search for\n // and a callback function which should process the results into\n // a format accepted by jqueryUI autocomplete\n geocoder = new google.maps.Geocoder();\n geocoder.geocode( {'address': request.term }, function(results, status) {\n response($.map(results, function(item) {\n return {\n label: item.formatted_address, // appears in dropdown box\n value: item.formatted_address, // inserted into input element when selected\n geocode: item // all geocode data: used in select callback event\n }\n }));\n })\n },\n\n // event triggered when drop-down option selected\n select: function(event,ui){\n }\n });\n\n // triggered when user presses a key in the address box\n $(\"#gmaps-input-address\").bind('keydown', function(event) {\n if(event.keyCode == 13) {\n geocode_lookup( 'address', $('#gmaps-input-address').val(), true );\n\n // ensures dropdown disappears when enter is pressed\n $('#gmaps-input-address').autocomplete(\"disable\")\n } else {\n // re-enable if previously disabled above\n $('#gmaps-input-address').autocomplete(\"enable\")\n }\n });\n}", "function initSearchBox(options) {\n // Invoke auto complete for search box\n var searchOptions = {\n data: options,\n list: {\n maxNumberOfElments: 0,\n match: {enabled: true},\n onChooseEvent: function () {\n searchChooseItem();\n }\n }\n };\n searchInput.easyAutocomplete(searchOptions);\n\n // Start searching when typing in search box\n searchInput.on(\"input\", function (e) {\n e.preventDefault();\n searchChooseItem();\n });\n }", "function loadInputFieldWidgets(){\n $(\".search-group input#date-last-modified\").datepicker();\n $(\".search-group input#date-created\").datepicker();\n $(\".search-group input#autocomplete\").autocomplete({\n source: function(request, response){\n var matcher = new RegExp(\n $.ui.autocomplete.escapeRegex(request.term), \"i\");\n response($.grep(AUTOCOMPLETE_LANGUAGES, function(item){\n return matcher.test(item);\n }));\n }\n });\n}", "function setupAutoComplete() {\n $('#newTagTextBox').autocomplete({\n source: htData,\n change: function(event, ui) {\n var newHT = $('#newTagTextBox').val();\n if(htData.includes(newHT)) {\n createAnInfoMessage($.i18n.prop('htviewer_newht_exists', newHT));\n return;\n }\n \n $.ajax({\n url: '/api/hashtags/',\n type: 'POST',\n data: newHT,\n contentType: 'text/plain',\n error: function(xhr,textStatus,errorThrown) {\n createAnErrorMessage($.i18n.prop('htviewer_newht_error', newHT));\n }\n }).then(function(data) {\n createAnInfoMessage($.i18n.prop('htviewer_newht_success', newHT));\n window.location.reload();\n });\n }\n });\n}", "autoComplete(){\n $.ajax({\n url: '/autocomplete',\n type: 'GET',\n data: {input: this.refs.searchBar.value}\n }).success(data => {\n }).error(data => {\n });\n // var places = new google.maps.place.Autocomplete(document.getElementById('#input-autocomplete'));\n // google.maps.event.addListener(places, 'place_changed', function() {\n // var place = places.getPlace();\n // var address = place.formatted_address;\n // var latitude = place.geometry.location.lat();\n // var longitude = place.geometry.location.lng();\n // });\n }", "function initVisStatic() {\n // Autocomplete for hashtags.\n var options = {\n url: function(phrase) {\n return baseURL + hashtagURL + \"?phrase=\" + phrase;\n },\n list: {\n maxNumberOfElements: 15,\n match: {\n enabled: true\n },\n onClickEvent: function() {\n var value = $(\"#search-hashtag\").getSelectedItemData();\n params.hashtag = value;\n console.log(params);\n queryTweets(params);\n }\n },\n placeholder: \"type a hashtag\",\n requestDelay: 500,\n theme: \"square\"\n };\n $(\"#search-hashtag\").easyAutocomplete(options);\n }", "async run() {\n this.errorIfWindows();\n await AutocompleteScript.generateAutocompleteCommands(this);\n\n const shell = this.argv[0] || this.config.shell;\n if (!shell) {\n this.out.error('Error: Missing required argument shell');\n }\n\n switch (shell) {\n case 'zsh':\n this.out.log(`fpath=(\n ${_path2.default.join(this.functionsPath, 'zsh')}\n $fpath\n);\nautoload -Uz compinit;\ncompinit;`);\n break;\n default:\n this.out.error(`Currently ${shell} is not a supported shell for autocomplete`);\n }\n }", "function bindAutocomplete(){\n if( $(\".autocomplete\").length ){\n var i = 0;\n $(\".autocomplete\").each(function(){\n i++;\n $(this).wrap(\"<div class='autocomplete-cont'></div>\");\n var $this = $(this),\n data = JSON.parse($this.attr(\"data-values\"));\n $this.removeAttr(\"data-values\");\n\n var $cont = $this.parent(\"div\"),\n $clone = $this.clone(),\n $label = $this.clone();\n\n $clone.removeAttr(\"required\")\n .attr(\"name\",\"clone-\"+i)\n .attr(\"class\",\"clone\");\n $label.removeAttr(\"required\")\n .attr(\"name\",\"label-\"+i)\n .attr(\"class\",\"label\")\n .val($this.attr(\"data-label\"))\n .attr(\"readonly\",\"readonly\");\n $this.attr(\"type\",\"hidden\").removeClass(\"autocomplete\");\n $cont.prepend($clone);\n $cont.prepend($label);\n\n if( $this.hasClass(\"categories\") ){\n $clone.catcomplete({\n minLength: 0,\n delay: 0,\n source: data,\n appendTo: $cont,\n select: function( event, ui ) {\n $clone.val(ui.item.label);\n $label.show().val(ui.item.label);\n $this.val(ui.item.val).trigger(\"change\");\n return false;\n },\n focus: function( event, ui ) {\n // $(\".ui-menu-item\").each(function(){\n // alert($(this).attr(\"class\"));\n // });\n }\n }); \n }else{\n $clone.autocomplete({\n minLength: 0,\n delay: 0,\n source: data,\n appendTo: $cont,\n select: function( event, ui ) {\n $clone.val(ui.item.label);\n $label.show().val(ui.item.label);\n $this.val(ui.item.val).trigger(\"change\");\n return false;\n }\n });\n }\n \n $clone.blur(function(){\n $label.show();\n });\n\n $label.on(\"click focus\",function(){\n $label.hide();\n $clone.val(\"\").select();\n if( $this.hasClass(\"categories\") ){\n $clone.catcomplete('search');\n }else{\n $clone.autocomplete('search');\n }\n });\n });\n }\n }", "function GeoComplete(input,options){this.options=$.extend(true,{},defaults,options);\n// This is a fix to allow types:[] not to be overridden by defaults\n// so search results includes everything\nif(options&&options.types){this.options.types=options.types}this.input=input;this.$input=$(input);this._defaults=defaults;this._name=\"geocomplete\";this.init()}", "function makeScientificNameAutocomplete(valueControl, include_authorship, scope) { \n\t$('#'+valueControl).autocomplete({\n\t\tsource: function (request, response) { \n\t\t\t$.ajax({\n\t\t\t\turl: \"/taxonomy/component/search.cfc\",\n\t\t\t\tdata: { \n\t\t\t\t\tterm: request.term, \n\t\t\t\t\tinclude_authorship: include_authorship,\n\t\t\t\t\tscope: scope,\n\t\t\t\t\tmethod: 'getScientificNameAutocomplete' \n\t\t\t\t},\n\t\t\t\tdataType: 'json',\n\t\t\t\tsuccess : function (data) { response(data); },\n\t\t\t\terror : function (jqXHR, textStatus, error) {\n\t\t\t\t\thandleFail(jqXHR,textStatus,error,\"making a scientific name autocomplete\");\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\tselect: function (event, result) {\n\t\t\tevent.preventDefault();\n\t\t\t$('#'+valueControl).val(\"=\" + result.item.value);\n\t\t},\n\t\tminLength: 3\n\t}).autocomplete(\"instance\")._renderItem = function(ul,item) { \n\t\t// override to display meta with additional information instead of minimal value in picklist.\n\t\treturn $(\"<li>\").append(\"<span>\" + item.meta + \"</span>\").appendTo(ul);\n\t};\n}", "function Initialize(){\n \t \n \t \n \t document.getElementById(\"findRestaurant\").disabled = true;\n \t \n \t\n \tautocomplete = new google.maps.places.Autocomplete((document.getElementById('address')));\n \t\n autocomplete.addListener('place_changed', onPlaceChanged);\n\n \t\n \t\n \n \t\n }", "function autocompleteCodigo() {\n var options = {\n url: function (phrase) {\n return \"assets/parallevar/parallevar_controller.php\";\n },\n getValue: function (element) {\n return \"<b>\" + element.codProducto + \":\" + element.nombreProducto + \"</b>\" + \"<p>\" + element.nombreSubmenu + \"</p>\";\n },\n ajaxSettings: {\n dataType: \"json\",\n method: \"POST\",\n data: {\n dataType: \"json\"\n }\n },\n preparePostData: function (data) {\n data.cod_busqueda = $(\"#parallevar_cod_dirulo\").val();\n return data;\n },\n requestDelay: 100,\n list: {\n onClickEvent: function () {\n\n var res = $(\"#parallevar_cod_dirulo\").val().split(\":\");\n var n = (res[0]).match(/\\d/g);\n n = n.join(\"\");\n $(\"#parallevar_cod_dirulo\").val(n);\n estableceProducto($(\"#parallevar_cod_dirulo\").val());\n },\n onKeyEnterEvent: function () {\n var res = $(\"#parallevar_cod_dirulo\").val().split(\":\");\n var n = (res[0]).match(/\\d/g);\n n = n.join(\"\");\n $(\"#parallevar_cod_dirulo\").val(n);\n estableceProducto($(\"#parallevar_cod_dirulo\").val());\n }\n }\n };\n $(\"#parallevar_cod_dirulo\").easyAutocomplete(options);\n $(\".easy-autocomplete\").css(\"width\", \"\");\n}", "render() {\n //Set up autocomplete props\n const inputProps = {\n placeholder: 'Search for a player',\n value: this.state.value,\n onChange: this.onChange\n };\n\n //Return JSX\n return (\n <div className=\"player-search\">\n <label className=\"player-search__label\" htmlFor={this.props.id}>Your {this.props.id} player</label>\n <Autosuggest\n suggestions={this.state.suggestions}\n onSuggestionsFetchRequested={this.getSuggestions}\n onSuggestionsClearRequested={this.onSuggestionsClearRequested}\n getSuggestionValue={this.getSuggestionValue}\n renderSuggestion={this.renderSuggestion}\n inputProps={inputProps}\n id={this.props.id}\n />\n </div>\n );\n }", "function activatePlacesSearch() {\n console.log(\"In activatePlacesSearch function\");\n let options = {\n types: ['(regions)']\n };\n let input = document.getElementById('search-term');\n let autocomplete = new google.maps.places.Autocomplete(input, options);\n}", "function initAutocomplete() {\n\n map = new google.maps.Map(document.getElementById(\"map\"), {\n center: { lat: 40.836820, lng: -96.136490 },\n zoom: 5,\n mapTypeControl: false, //Turns the stellite & map feature off from the map feature\n });\n\n //set map's min and max zoom limit\n map.setOptions({ minZoom: 3, maxZoom: 17 });\n\n // Create search box\n const input = document.getElementById(\"auto-input\");\n const searchBox = new google.maps.places.SearchBox(input);\n\n //map.controls[google.maps.ControlPosition.LEFT].push(input);\n\n // Take searchbox results and pass it to map.\n map.addListener(\"bounds_changed\", () => {\n searchBox.setBounds(map.getBounds());\n });\n\n // Added event listener so that when user selects a place from list of places\n //more info is provided for that particular place.\n searchBox.addListener(\"places_changed\", () => {\n const places = searchBox.getPlaces();\n\n if (places.length == 0) {\n alert(\"There is no such place! Please try again!\")\n return;\n }\n\n //interate throw all the places\n places.forEach((place) => {\n\n //get the selected place in place input parameter\n console.log(\"address\" + place.formatted_address);\n\n if(place.formatted_address !== \"\") {\n var encodedCity = encodeURI(place.formatted_address);\n getCityDetails(encodedCity);\n }\n });\n });\n}", "didReceiveAttrs() {\n if (this.get('autocomplete')) {\n this.get('autocomplete').setOptions(this.getOptions());\n }\n }", "function initAutoComplete() {\n\n var addrComplete = new google.maps.places.Autocomplete(addr);\n\n addrComplete.addListener('place_changed', fillInAddress);\n\n var componentForm = {\n street_number: 'short_name',\n route: 'long_name',\n locality: 'long_name',\n administrative_area_level_1: 'short_name',\n country: 'long_name',\n postal_code: 'short_name'\n };\n\n function fillInAddress() {\n var place = addrComplete.getPlace();\n $('#address').val(\"\").css({ 'background-color': '#ffffff'});\n $('#city').val(\"\").css({ 'background-color': '#ffffff'});;\n $('#state').val(\"\").css({ 'background-color': '#ffffff'});;\n $('#zipcode').val(\"\").css({ 'background-color': '#ffffff'});;\n var street = \"\";\n\n for (var i = 0; i < place.address_components.length; i++) {\n var addressType = place.address_components[i].types[0];\n if (componentForm[addressType]) {\n var val = place.address_components[i][componentForm[addressType]];\n console.log(addressType, val)\n switch (addressType) {\n case \"street_number\":\n street = val;\n break;\n case \"route\":\n val = street+val\n $('#address').val(val).css({ 'background-color': '#F3FEFF'})\n break;\n case \"locality\":\n $('#city').val(val).css({ 'background-color': '#F3FEFF'})\n break;\n case \"administrative_area_level_1\":\n $('#state').val(val).css({ 'background-color': '#F3FEFF'})\n break;\n case \"postal_code\":\n $('#zipcode').val(val).css({ 'background-color': '#F3FEFF'})\n break;\n }\n }\n }\n\n }\n }", "renderSearch() {\n return <Autocomplete\n onPlaceSelected={ (place) => {\n this.props.receiveSearch(place.formatted_address);\n hashHistory.push(`/restaurants/index/${place.formatted_address}`);\n }}\n placeholder={'Enter a Location'}\n types={['address']}\n id='nav-auto' />;\n }", "function initializeAutoComplete() {\r\n let input = document.getElementById('searchTextField');\r\n let autocomplete = new google.maps.places.Autocomplete(input);\r\n google.maps.event.addListener(autocomplete, 'place_changed', function () {\r\n let place = autocomplete.getPlace();\r\n document.getElementById('city2').value = place.name;\r\n document.getElementById('cityLat').value = place.geometry.location.lat();\r\n document.getElementById('cityLng').value = place.geometry.location.lng();\r\n\t\t\t\t\r\n });\r\n}", "constructor(dispatcher) {\n super(dispatcher);\n\n\n // All suggestions\n this.suggestions = new List();\n }", "function initializeSearch() {\n fb.child('vpc/features').on('child_added', function (snapshot) {\n DATA.push(snapshot.val());\n var names = dataUtilities.getAutoCompleteNames([DATA]);\n $(\".search\").autocomplete({ source: names });\n });\n $(\".search\").on(\"autocompleteselect\", function (event, ui) {\n var landmark = dataUtilities.findData(DATA, ui.item.value);\n map.setView(landmark.properties.center, 8 /* LOL IGNORE ZOOM */, { animate: true });\n });\n}", "function autocomplete(inp, arr) {\r\n /*the autocomplete function takes two arguments,\r\n the text field element and an array of possible autocompleted values:*/\r\n var currentFocus;\r\n /*execute a function when someone writes in the text field:*/\r\n inp.addEventListener(\"input\", function(e) {\r\n var a, b, i, val = this.value;\r\n /*close any already open lists of autocompleted values*/\r\n closeAllLists();\r\n if (!val) { return false;}\r\n currentFocus = -1;\r\n /*create a DIV element that will contain the items (values):*/\r\n a = document.createElement(\"DIV\");\r\n a.setAttribute(\"id\", this.id + \"autocomplete-list\");\r\n a.setAttribute(\"class\", \"autocomplete-items\");\r\n /*append the DIV element as a child of the autocomplete container:*/\r\n this.parentNode.appendChild(a);\r\n /*for each item in the array...*/\r\n for (i = 0; i < arr.length; i++) {\r\n /*check if the item starts with the same letters as the text field value:*/\r\n if (arr[i].substr(0, val.length).toUpperCase() == val.toUpperCase()) {\r\n /*create a DIV element for each matching element:*/\r\n b = document.createElement(\"DIV\");\r\n /*make the matching letters bold:*/\r\n b.innerHTML = \"<strong>\" + arr[i].substr(0, val.length) + \"</strong>\";\r\n b.innerHTML += arr[i].substr(val.length);\r\n /*insert a input field that will hold the current array item's value:*/\r\n b.innerHTML += \"<input type='hidden' value='\" + arr[i] + \"'>\";\r\n /*execute a function when someone clicks on the item value (DIV element):*/\r\n b.addEventListener(\"click\", function(e) {\r\n /*insert the value for the autocomplete text field:*/\r\n inp.value = this.getElementsByTagName(\"input\")[0].value;\r\n /*close the list of autocompleted values,\r\n (or any other open lists of autocompleted values:*/\r\n closeAllLists();\r\n });\r\n a.appendChild(b);\r\n }\r\n }\r\n });\r\n /*execute a function presses a key on the keyboard:*/\r\n inp.addEventListener(\"keydown\", function(e) {\r\n var x = document.getElementById(this.id + \"autocomplete-list\");\r\n if (x) x = x.getElementsByTagName(\"div\");\r\n if (e.keyCode == 40) {\r\n /*If the arrow DOWN key is pressed,\r\n increase the currentFocus variable:*/\r\n currentFocus++;\r\n /*and and make the current item more visible:*/\r\n addActive(x);\r\n } else if (e.keyCode == 38) { //up\r\n /*If the arrow UP key is pressed,\r\n decrease the currentFocus variable:*/\r\n currentFocus--;\r\n /*and and make the current item more visible:*/\r\n addActive(x);\r\n } else if (e.keyCode == 13) {\r\n /*If the ENTER key is pressed, prevent the form from being submitted,*/\r\n e.preventDefault();\r\n if (currentFocus > -1) {\r\n /*and simulate a click on the \"active\" item:*/\r\n if (x) x[currentFocus].click();\r\n }\r\n }\r\n });\r\n function addActive(x) {\r\n /*a function to classify an item as \"active\":*/\r\n if (!x) return false;\r\n /*start by removing the \"active\" class on all items:*/\r\n removeActive(x);\r\n if (currentFocus >= x.length) currentFocus = 0;\r\n if (currentFocus < 0) currentFocus = (x.length - 1);\r\n /*add class \"autocomplete-active\":*/\r\n x[currentFocus].classList.add(\"autocomplete-active\");\r\n }\r\n function removeActive(x) {\r\n /*a function to remove the \"active\" class from all autocomplete items:*/\r\n for (var i = 0; i < x.length; i++) {\r\n x[i].classList.remove(\"autocomplete-active\");\r\n }\r\n }\r\n function closeAllLists(elmnt) {\r\n /*close all autocomplete lists in the document,\r\n except the one passed as an argument:*/\r\n var x = document.getElementsByClassName(\"autocomplete-items\");\r\n for (var i = 0; i < x.length; i++) {\r\n if (elmnt != x[i] && elmnt != inp) {\r\n x[i].parentNode.removeChild(x[i]);\r\n }\r\n }\r\n }\r\n /*execute a function when someone clicks in the document:*/\r\n document.addEventListener(\"click\", function (e) {\r\n closeAllLists(e.target);\r\n });\r\n }", "function autocomplete(inp, arr) { \n //the autocomplete function takes two arguments, the text field element and an array of possible autocompleted values:*/\n let currentFocus= \"\";\n /*execute a function when someone writes in the text field:*/\n inp.addEventListener(\"input\", function(e) {\n var a, b, i, val = this.value;\n // close any already open lists of autocompleted values*/\n closeAllLists();\n if (!val) { return false;}\n currentFocus = -1;\n // /*create a DIV element that will contain the items (values):*/\n a = document.createElement(\"DIV\");\n a.setAttribute(\"id\", this.id + \"autocomplete-list\");\n a.setAttribute(\"class\", \"autocomplete-items\");\n // /*append the DIV element as a child of the autocomplete container:*/\n this.parentNode.appendChild(a);\n // /*for each item in the array...*/\n for (i = 0; i < arr.length; i++) {\n // /*check if the item starts with the same letters as the text field value:*/\n if (arr[i].substr(0, val.length).toUpperCase() == val.toUpperCase()) {\n // /*create a DIV element for each matching element:*/\n b = document.createElement(\"DIV\");\n // /*make the matching letters bold:*/\n b.innerHTML = \"<strong>\" + arr[i].substr(0, val.length) + \"</strong>\";\n b.innerHTML += arr[i].substr(val.length);\n // /*insert a input field that will hold the current array item's value:*/\n b.innerHTML += \"<input type='hidden' value='\" + arr[i] + \"'>\";\n // /*execute a function when someone clicks on the item value (DIV element):*/\n b.addEventListener(\"click\", function(e) {\n // /*insert the value for the autocomplete text field:*/\n inp.value = this.getElementsByTagName(\"input\")[0].value;\n // /*close the list of autocompleted values,\n // (or any other open lists of autocompleted values:*/\n closeAllLists();\n });\n a.appendChild(b);\n }\n }\n });\n\n // /*execute a function presses a key on the keyboard:*/\n inp.addEventListener(\"keydown\", function(e) {\n var x = document.getElementById(this.id + \"autocomplete-list\");\n if (x) x = x.getElementsByTagName(\"div\");\n if (e.keyCode == 40) {\n /*If the arrow DOWN key is pressed,\n // increase the currentFocus variable:*/\n currentFocus++;\n // /*and and make the current item more visible:*/\n addActive(x);\n } else if (e.keyCode == 38) { //up\n // /*If the arrow UP key is pressed,\n // decrease the currentFocus variable:*/\n currentFocus--;\n // /*and and make the current item more visible:*/\n addActive(x);\n } else if (e.keyCode == 13) {\n // /*If the ENTER key is pressed, prevent the form from being submitted,*/\n e.preventDefault();\n if (currentFocus > -1) {\n // /*and simulate a click on the \"active\" item:*/\n if (x) x[currentFocus].click();\n }\n }\n });\n function addActive(x) {\n // /*a function to classify an item as \"active\":*/\n if (!x) return false;\n // /*start by removing the \"active\" class on all items:*/\n removeActive(x);\n if (currentFocus >= x.length) currentFocus = 0;\n if (currentFocus < 0) currentFocus = (x.length - 1);\n // /*add class \"autocomplete-active\":*/\n x[currentFocus].classList.add(\"autocomplete-active\");\n }\n function removeActive(x) {\n // /*a function to remove the \"active\" class from all autocomplete items:*/\n for (var i = 0; i < x.length; i++) {\n x[i].classList.remove(\"autocomplete-active\");\n }\n }\n function closeAllLists(elmnt) {\n // /*close all autocomplete lists in the document,\n // except the one passed as an argument:*/\n var x = document.getElementsByClassName(\"autocomplete-items\");\n for (var i = 0; i < x.length; i++) {\n if (elmnt != x[i] && elmnt != inp) {\n x[i].parentNode.removeChild(x[i]);\n }\n }\n }\n /*execute a function when someone clicks in the document:*/\n document.addEventListener(\"click\", function (e) {\n closeAllLists(e.target);\n });\n }", "function autocomplete(inp, arr) {\n // Takes in the text input field and the array of possible autocomplete values\n var currentFocus;\n var nameClicked = false;\n // Does this whenever the input field is changed\n inp.addEventListener(\"input\", function(e) {\n var a, b, i, val = this.value;\n\n closeAllLists();\n if (!val) { return false;}\n currentFocus = -1;\n // Creates a div element that will contain the autocomplete values\n a = document.createElement(\"DIV\");\n a.setAttribute(\"id\", this.id + \"contactList\");\n a.setAttribute(\"class\", \"autocomplete-items\");\n // Appends it to the autocomplete container\n this.parentNode.appendChild(a);\n // Makes a second array of just the names, not the full contact with\n // the index attached to it\n var arr1 = [];\n for(var i = 0; i < arr.length; i++) {\n var n = arr[i].indexOf(\",\");\n var name = arr[i].substr(0, n);\n arr1.push(name);\n }\n for (i = 0; i < arr.length; i++) {\n nameClicked = false;\n // Checks if the item starts with the same letters as the value in the input\n if (arr[i].substr(0, val.length).toUpperCase() == val.toUpperCase()) {\n // Creates a div element for the values that match the input field\n b = document.createElement(\"DIV\");\n // Makes the letters that match bold\n b.innerHTML = \"<strong>\" + arr1[i].substr(0, val.length) + \"</strong>\";\n b.innerHTML += arr1[i].substr(val.length);\n // Creating an input field that will hold the current array item's value\n b.innerHTML += \"<input type='hidden' value='\" + arr[i] + \"'>\";\n \n // Runs this function when a div element is clicked on\n b.addEventListener(\"click\", function(e) {\n // Grabs the full tag which contains the index and sends it to findAutocomplete()\n fullTag = this.getElementsByTagName(\"input\")[0].value;\n findAutocomplete(fullTag);\n // Figures out where the comma is to grab just the name and sets \n // the input field value just the name\n n = this.getElementsByTagName(\"input\")[0].value.indexOf(\",\");\n inp.value = this.getElementsByTagName(\"input\")[0].value.substr(0,n);\n closeAllLists();\n });\n a.appendChild(b);\n }\n } \n });\n // Runs the function when a key is pressed on the keyboard\n inp.addEventListener(\"keydown\", function(e) {\n var x = document.getElementById(this.id + \"contactList\");\n if (x) { x = x.getElementsByTagName(\"div\") };\n if (e.keyCode == 40) {\n // 40 == DOWN KEY, Moves the focus down an item\n currentFocus++;\n // Calls addActive to make it more visible\n addActive(x);\n } else if (e.keyCode == 38) { //up\n // 38 == UP KEY, Moves the focus up an item\n currentFocus--;\n // Calls addActive to make it more visible\n addActive(x);\n } else if (e.keyCode == 13) {\n // 13 == ENTER KEY, Prevents the form from being submitted\n e.preventDefault();\n if (currentFocus > -1) {\n // Clicks the active item when the user presses ENTER\n if (x) { x[currentFocus].click() };\n }\n }\n });\n // Classifies an item in the autocomplete list as \"active\"\n function addActive(x) {\n if (!x) { return false };\n // Gets rid of any active items\n removeActive(x);\n if (currentFocus >= x.length) currentFocus = 0;\n if (currentFocus < 0) currentFocus = (x.length - 1);\n // Adds the CSS class that makes the item active (Changes the color)\n x[currentFocus].classList.add(\"autocomplete-active\");\n }\n // Removes all of the active items\n function removeActive(x) {\n for (var i = 0; i < x.length; i++) {\n x[i].classList.remove(\"autocomplete-active\");\n }\n }\n // Closes all of the autocomplete lists in the doucment except\n // the one passed as an argument\n function closeAllLists(elmnt) {\n var x = document.getElementsByClassName(\"autocomplete-items\");\n for (var i = 0; i < x.length; i++) {\n if (elmnt != x[i] && elmnt != inp) {\n x[i].parentNode.removeChild(x[i]);\n }\n }\n }\n // Runs when someone clicks in the document\n document.addEventListener(\"click\", function (e) {\n closeAllLists(e.target);\n });\n // Grabs the index off of the full tag and makes it the currentContactIndex,\n // then displays the current contact\n function findAutocomplete(contactName) {\n var n = contactName.indexOf(\",\");\n var index = 0;\n index = contactName.substr(n+1,contactName.length-1);\n index = parseInt(index);\n currentContactIndex = index;\n viewCurrentContact();\n }\n}", "render(){\n\t// loading in slow connection scenario - just comment componentDidMount function for test\n\t// if (this.state.cities.length === 0){\n\t// \treturn <h1> Loading </h1>\n\t// } else {\n\treturn(\n\t<div className='tc'>\n\t\t<h1 className='f1'>Weather App</h1>\n\t\t<Autocomplete className='pa3 ba b--green bg-lightest-blue' \n\t\t\t\t\t cities={this.state.cities} />\n\t\t\n\t</div>\n\t\t);\n\t\t// }\n\t}", "autoCompleteFocus() {\n if (!this.receivedUserInput_) {\n this.activateFocus();\n }\n }", "autoCompleteFocus() {\n if (!this.receivedUserInput_) {\n this.activateFocus();\n }\n }", "autoCompleteFocus() {\n if (!this.receivedUserInput_) {\n this.activateFocus();\n }\n }" ]
[ "0.7224389", "0.7148656", "0.69499624", "0.68556064", "0.6735465", "0.6640301", "0.6621811", "0.66015255", "0.6592722", "0.65639806", "0.65550125", "0.65322906", "0.65264463", "0.64694536", "0.6460636", "0.64513713", "0.6414479", "0.6387037", "0.63833416", "0.6383247", "0.6371968", "0.63674223", "0.6344103", "0.6342534", "0.6335047", "0.63104445", "0.6271744", "0.62650543", "0.6251434", "0.6251402", "0.6247391", "0.62235254", "0.621471", "0.62028223", "0.6197166", "0.61823815", "0.617541", "0.61707896", "0.61672795", "0.61284363", "0.61240065", "0.6123114", "0.61150944", "0.61117995", "0.6111452", "0.6103512", "0.60974294", "0.6096813", "0.6071395", "0.6069264", "0.6067535", "0.606499", "0.6058669", "0.6055822", "0.60470814", "0.6043429", "0.6038264", "0.6025961", "0.6016861", "0.6012479", "0.6007383", "0.60064304", "0.6004457", "0.600426", "0.5997759", "0.5988548", "0.59885424", "0.5982616", "0.5979494", "0.597145", "0.59671104", "0.5956004", "0.5955884", "0.59550244", "0.59488356", "0.59435326", "0.5934551", "0.5932073", "0.5922637", "0.5920597", "0.59187335", "0.59186804", "0.59171164", "0.5915441", "0.5905312", "0.59038436", "0.5903795", "0.5896578", "0.58888257", "0.5887704", "0.58866537", "0.58813685", "0.5873075", "0.5865906", "0.58533674", "0.58525634", "0.5847364", "0.5832675", "0.5832675", "0.5832675" ]
0.71344686
2
Toggle children on click.
function mouseout(d) { d3.select(this).select("text.hover").remove(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toggleChildren() {\n\t\tthis.setState({\n\t\t\tlinksVisible: !this.state.linksVisible\n\t\t});\n\t}", "function toggle_sidebar_sublist()\n{\n $(\".navbar_right_sidebar .sidebar_main_item.expandable\").click(function(){\n var child_container=$(this).find(\".subele_container\");\n if (child_container.hasClass(\"hidden\"))\n child_container.removeClass(\"hidden\");\n else\n child_container.addClass(\"hidden\");\n });\n\n}", "_toggleAllTreeItems() {\n this._toggleTreeItem(this.container, !this._lastToggleIsShow);\n }", "function toggle(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n }", "function toggleChildren(d) {\n var children = (d.children) ? d.children : null;\n var _children = (d._children) ? d._children : null;\n d._children = children;\n d.children = _children;\n return d;\n }", "function toggle(d) \n\t\t{\n\t\t\tif (d.children) \n\t\t\t{\n\t\t\t\td._children = d.children;\n\t\t\t\td.children = null;\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\td.children = d._children;\n\t\t\t\td._children = null;\n\t\t\t}\n\t\t\tupdate(d);\n\t\t}", "function toggle(d) {\n\tif (d.children) {\n\t\td._children = d.children;\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children;\n\t\td._children = null;\n\t}\n}", "toggleSelected(value = null) {\n const toToggle = this;\n if (value == null) {\n if (toToggle.selected === true) {\n toToggle.selected = false;\n } else {\n toToggle.selected = true;\n }\n } else {\n toToggle.selected = value;\n }\n\n if (toToggle.children) {\n toToggle.children.forEach((child) => {\n child.toggleSelected(toToggle.selected);\n });\n }\n }", "function click(d) {\r\n\ttoggleChildren(d);\r\n\tupdate(d);\r\n}", "click(e) {\n $(ReactDOM.findDOMNode(e.currentTarget)).siblings('.collapsible-body').toggle();\n }", "function toggle(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else if (d._children) {\n d.children = d._children;\n d._children = null;\n }\n }", "function getChilds(){ \n var current = $(this);\n var cat_id = current.attr('data-key');\n if($(\"#product-cat-child-\"+cat_id).length > 0){\n replaceChildHtml(cat_id);\n\n $(\"#product-cat-child-\"+cat_id).slideToggle('slow');\n $(this).toggleClass('carat-up');\n $(this).closest('.parent-checkbox-wrapper').toggleClass('parent-dropdown-open');\n }\n }", "function treeClick(id) {\n var tlr = document.getElementById(id);\n tlr.querySelector(\".nested\").classList.toggle(\"activeToggle\");\n tlr.classList.toggle(\"caret-down\");\n}", "function toggleAll(node) {\n if (node[childrenIdentifier]) {\n node[childrenIdentifier].forEach(toggleAll);\n toggle(node);\n }\n }", "function click(d) {\n d = toggleChildren(d);\n update(d);\n }", "function toggleAll(d) {\n\t\t\tif (d && d.children) {\n\t\t\t\td.children.forEach(toggleAll);\n\t\t\t\ttoggle(d);\n\t\t\t}\n\t\t}", "function showMobileChildren(event){\n\n $(event).parent().find('>ul').slideToggle(200, function(){\n\n $(event).parent().toggleClass('mobile-active');\n\n $(event).parent().hasClass('mobile-active') ? \n $(event).parent().find('.mobile-active').trigger('click') : '';\n\n });\n $(event).find('.fa').toggle();\n return false; \n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d.children.forEach(expand); //Expand all at once\n d._children = null;\n }\n update(d);\n}", "function toggle(node) {\n if (node[childrenIdentifier]) {\n node._children = node[childrenIdentifier];\n node[childrenIdentifier] = null;\n } else {\n node[childrenIdentifier] = node._children;\n node._children = null;\n }\n }", "function _toggle() {\n\tconst parent = this.parentElement.parentElement;\n\tparent.classList.toggle('hidden')\n}", "function click(d) {\n\t\t\t\t\t\t//root.children.forEach(collapse);\n\t\t\t\t\t\tif (d.children) {\n\t\t\t\t\t\t\td._children = d.children;\n\t\t\t\t\t\t\td.children = null;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\td.children = d._children;\n\t\t\t\t\t\t\td._children = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tupdate(d);\n\t\t\t\t\t}", "toggle() {\n this.expanded = !this.expanded;\n }", "function toggleArtists(d) {\n\tif (d.children) {\n\t\td._children = d.children; //TEMPORARILY STORE CHILDREN IN ._CHILDREN TO HIDE\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children; //MOVE CHILDREN BACK INTO .CHILDREN TO SHOW\n\t\td._children = null;\n\t}\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n updateTree(d,viewOptions); \n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n //If the node has children, collapse unfolded sibling nodes\n if(d.parent)\n {\n d.parent.children.forEach(function(element){\n \n if(d !== element){\n collapse(element);\n \n }\n });\n }\n update(d);\n}", "function toggle(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n Erase(root);\n update(d);\n $(\"#search_bar\").select2(\"val\", \"\");\n}", "function clicked(d){\n if(d.children){\n d._children = d.children;\n d.children = null;\n }else{\n d.children = d._children;\n d._children = null;\n }\n updateTree(d);\n console.log(d);\n }", "function treeToggle(el, force) {\n el = this;\n \n while(el != null && (!el.tagName || el.tagName.toLowerCase() != \"li\")) el = el.parentNode;\n \n // Get UL within the LI\n var childSet = findChildWithTag(el, 'ul');\n var topSpan = findChildWithTag(el, 'span');\n\n if( force != null ){\n \n if( force == \"open\"){\n treeOpen( topSpan, el )\n }\n else if( force == \"close\" ){\n treeClose( topSpan, el )\n }\n \n }\n \n else if( childSet != null) {\n // Is open, close it\n if(!el.className.match(/(^| )closed($| )/)) { \n treeClose( topSpan, el )\n // Is closed, open it\n } else { \n treeOpen( topSpan, el )\n }\n }\n}", "toggleDescendants(dataNode) {\n this.expansionModel.isSelected(dataNode)\n ? this.collapseDescendants(dataNode)\n : this.expandDescendants(dataNode);\n }", "function showChildren(number) {\n\t$(\"#p\" + number).toggle();\n\tif($(\"#p\" + number).is(':visible')) {\n\t\tthis.innerHtml = \"Collapse\";\n\t} else {\n\t\tthis.innerHtml = \"Expand\";\n\t}\n}", "function checkChildren() {\n\n\n $(\"#filter-accordion ul.dynatree-container li\").click(function () {\n $('.linkAll').removeClass('active-link');\n });\n}", "function toggleAllChildrenClass(item, from, to) {\n for (var i = 0; i < item.children.length; ++i) {\n var child = item.children[i];\n child.className = child.className.replace(from, to);\n if (child.children.length > 0) {\n toggleIcon(child); // Toggle all icon under it, too..\n }\n }\n}", "function click(d) {\r\n\t if (d.children) {\r\n\t d._children = d.children;\r\n\t self.foldGroup(d.name, d.children);\r\n\t d.children = null;\r\n\r\n\t } else {\r\n\t d.children = d._children;\r\n self.unfoldGroup(d.name, d.children);\r\n\t d._children = null;\r\n\t }\r\n\t update(d);\r\n\t getShowData('update');\r\n\t}", "function click(d) {\n\t\t if (d.children) {\n\t\t\td.hiddenChildren = d.children;\n\t\t\td.children = null;\n\t\t } else {\n\t\t\td.children = d.hiddenChildren;\n\t\t\td.hiddenChildren = null;\n\t\t }\n\t\t update(d);\n\t\t}", "function toggleTOCSections () {\r\n $(\".toc-parent\").each (function () {\r\n var parent = $(this);\r\n $(this).find('button').click (function (){\r\n if (parent.next().is (\":hidden\")){\r\n // show subtree\r\n parent.next().show('slow');\r\n $(this).text(\"-\");\r\n } else {\r\n // hide subtree \r\n parent.next().hide('slow');\r\n $(this).text(\"+\");\r\n }\r\n });\r\n });\r\n}", "toggleNodes() {\n\t\tif (this.toggleVisibility) {\n\t\t\tthis.hideNodes();\n\t\t\tthis.toggleVisibility = false;\n\t\t} else {\n\t\t\tthis.showNodes();\n\t\t\tthis.toggleVisibility = true;\n\t\t}\n\t}", "function toggle(d) {\n // Toggle collapsed status of node.\n if (d.children) collapse(d);\n else expand(d);\n drawScenegraph(d);\n} // end toggle", "onClick_() {\n this.fire('toggle-expanded');\n }", "function toggleChildren(containerID, numTasks) { \n \n let childElements = document.getElementById(containerID.id).childNodes;\n childElements = Array.from(childElements);\n childElements = childElements.filter((node) => {\n return (node.nodeType == Node.ELEMENT_NODE);\n });\n\n console.log(\"length of childNodes: \" + childElements.length);\n\n if (numTasks == 0) { 1// test if empty\n console.log(\"%cNo elements found to drop down\",\"color: orange;\");\n }\n else if (childElements[1].style.display == \"grid\") { // if displaying\n console.log(\"Hiding elements\");\n for (var i = 1; i < childElements.length; i++) { // hide child elements \n console.log(\" hiding element with id: \" + childElements[i].id);\n childElements[i].style.display = \"none\";\n \n }\n } \n else { // if hidden \n console.log(\"Revealing elements\");\n for (var i = 1; i < childElements.length; i++) { // reveal child elements\n console.log(\" revealing element with id: \" + childElements[i].id);\n childElements[i].style.display = \"grid\";\n }\n } \n}", "function childClick ($event) {\n $event.stopPropagation();\n }", "function click(d) {\n if (d.children) {\n\td._children = d.children;\n\td.children = null;\n } else {\n\td.children = d._children;\n\td._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n\td._children = d.children;\n\td.children = null;\n } else {\n\td.children = d._children;\n\td._children = null;\n }\n update(d);\n}", "function toggleSubfields(e) {\n e.stopPropagation();\n $ul = getUl(this, 1);\n $ul.toggleClass('visible');\n}", "function click(d) {\n if (d.children) {\n \td._children = d.children;\n \td.children = null;\n } else {\n \td.children = d._children;\n \td._children = null;\n }\n update(d);\n }", "function toggle(id, recursive)\n {\n var node;\n if (node = indexbyid[id]) {\n collapse(id, recursive, !node.collapsed);\n }\n }", "expand () {\n this.root.toggle(true, true);\n }", "function toggle() {\n setOpened(!opened);\n expandedCallback(!opened);\n }", "function onTargetChildrenClick() {\n console.log(\"Clicked onTargetChildrenClick\");\n // update the UI\n w3.toggleClass('#targetChildren', 'w3-red');\n w3.removeClass('#targetLGTBIQ', 'w3-red');\n w3.removeClass('#targetWomen', 'w3-red');\n w3.removeClass('#targetOrigin', 'w3-red');\n // toggle this filter and disable the others\n targetChildren = !targetChildren;\n targetLGTBIQ = false;\n targetWomen = false;\n targetOrigin = false;\n // trigger the find operation\n findLocationsInDatabase(\"FILTER\", -1);\n}", "function click(d) {\n\t\n\t\n\t\n\tif (d.children) {\n\t\td._children = d.children;\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children;\n\t\td._children = null;\n\t}\n\tupdate(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n build_tree(d);\n }", "collapse () {\n this.root.toggle(true, false);\n }", "toggle (recursive, state, depth) {\n depth= depth === undefined ? 999 : depth;\n this.open= (state === undefined ? !this.open : state);\n this.update();\n this.onExpand(this.open);\n this.control.onExpand(this, this.open);\n if (recursive && depth > 0 ) this.nodes.forEach( function(node) {\n node.toggle(true, this.open, depth-1);\n }, this);\n }", "function toggleAll(e) {\n allClosed = !allClosed;\n let carrots = document.getElementsByClassName('carrot');\n for(let i = 0; i < carrots.length; i++) {\n let target = carrots[i].parentElement.getElementsByTagName('div')[0];\n if(allClosed) {\n if(target.classList.contains('d-none')){\n carrots[i].dispatchEvent(new Event('click'));\n }\n e.innerHTML = \"Hide All\";\n } else {\n if(!target.classList.contains('d-none')){\n carrots[i].dispatchEvent(new Event('click'));\n }\n e.innerHTML = \"Expand All\";\n }\n }\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n //update();\n }", "function showUp(parent) {\n parent.children[1].children[0].classList.toggle('active')\n}", "function click(d) {\n console.log(d);\n if (d.children) {\n\td._children = d.children;\n\td.children = null;\n } else {\n\td.children = d._children;\n\td._children = null;\n }\n update(d);\n}", "function click(d) {\n\t\t\t if (d.children) {\n\t\t\t d._children = d.children;\n\t\t\t d.children = null;\n\t\t\t } else {\n\t\t\t d.children = d._children;\n\t\t\t d._children = null;\n\t\t\t }\n\t\t\t update();\n\t\t\t}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n \n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n var updateFlag;\n if (d.children) {\n updateFlag = d.children.length > 0;\n d._children = d.children;\n d.children = null;\n } else {\n updateFlag = d._children.length > 0;\n d.children = d._children;\n d._children = null;\n }\n\n //Avoid updating if node has no children\n if(updateFlag){\n update(d);\n }\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update();\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "toggle() {\n this._setState({\n expanded: !this.state.expanded,\n });\n }", "function subMenusMobile() {\r\n $(\".sub-active\").each(function() {\r\n $(this).click(function(event) {\r\n event.preventDefault();\r\n // Abrindo o submenu mobile\r\n $(this).children(\".sub-menu-mobile\").slideToggle(\"slow\");\r\n // Abrindo o submenu desktop\r\n $(this).children(\".sub-menu-desk\").slideToggle(\"slow\");\r\n\r\n })\r\n });\r\n}", "function click(d)\n {\n toggleChildren(d);\n printNodeInfo(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n updateTree(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function toggle_button_click(e) {\n var $button = $(e.currentTarget);\n var $menu = $button.parent().parent().children('ul');\n var was_closed = $button.hasClass('menu-closed');\n\n if (was_closed) {\n expand($menu, $button);\n }\n else {\n collapse($menu, $button);\n }\n }", "function dd_click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n dd_update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n _this.update(d);\n }", "function StructureToggle(ele) {\n ele.nextElementSibling.classList.toggle(\"show\")\n ele.children[0].classList.toggle(\"fa-rotate-180\");\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function subNav_slideToggle() {\n $(this).toggleClass('nav__item--show-sub');\n }", "function collapse(d, x) {\n if (x && d === x) {\n return;\n }\n d.clicked = null;\n if(d.children) {\n d._children = d.children\n d.children = null\n d._children.forEach(collapse);\n }\n }", "function click(d) {\n /*if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);*/ \n }", "function click(d) {\n if (d.classe_id || d.root) {\n if (d.children) {\n //console.log(\"->1\")\n d._children = d.children;\n d.children = null;\n } else {\n if (d._children != null) {\n d.children = d._children;\n d._children = null;\n //console.log(\"anes\")\n //console.log(d.node_id)\n d.children.forEach(function (children) {\n expand(children);\n });\n }\n }\n update(d);\n } else {\n //código para mostrar os gráficos\n tooltip_tablle(d);\n }\n}", "function click(d) {\r\n if (d.children) {\r\n d._children = d.children;\r\n d.children = null;\r\n } else {\r\n d.children = d._children;\r\n d._children = null;\r\n }\r\n update(d);\r\n}", "function click(d) {\n\tif (d.children) {\n\t\td._children = d.children;\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children;\n\t\td._children = null;\n\t}\n\tupdate();\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "toggleExpand() {\n if (currentExpanded !== undefined) {\n currentExpanded.justToggleExpand();\n currentExpanded = undefined;\n }\n if (!this.state.expand && currentExpanded === undefined)\n currentExpanded = this;\n\n this.justToggleExpand();\n }", "toggleExpand() {\n if (currentExpanded !== undefined) {\n currentExpanded.justToggleExpand();\n currentExpanded = undefined;\n }\n if (!this.state.expand && currentExpanded === undefined)\n currentExpanded = this;\n\n this.justToggleExpand();\n }", "handler( children ) {\n const { classes } = this.props\n const { state } = this\nreturn children.map( ( subOption ) => {\n if ( !subOption.children ) {\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n key={ subOption.name }>\n <Link \n to={ subOption.url }\n className={ classes.links }>\n <ListItemText \n inset \n primary={ subOption.name } \n />\n </Link>\n </ListItem>\n </div>\n )\n }\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n onClick={ () => this.handleClick( subOption.name ) }>\n <ListItemText \n inset \n primary={ subOption.name } />\n { state[ subOption.name ] ? \n <ExpandLess /> :\n <ExpandMore />\n }\n </ListItem>\n <Collapse \n in={ state[ subOption.name ] } \n timeout=\"auto\" \n unmountOnExit\n >\n { this.handler( subOption.children ) }\n </Collapse>\n </div>\n )\n } )\n }", "handler( children ) {\n const { classes } = this.props\n const { state } = this\nreturn children.map( ( subOption ) => {\n if ( !subOption.children ) {\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n key={ subOption.name }>\n <Link \n to={ subOption.url }\n className={ classes.links }>\n <ListItemText \n inset \n primary={ subOption.name } \n />\n </Link>\n </ListItem>\n </div>\n )\n }\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n onClick={ () => this.handleClick( subOption.name ) }>\n <ListItemText \n inset \n primary={ subOption.name } />\n { state[ subOption.name ] ? \n <ExpandLess /> :\n <ExpandMore />\n }\n </ListItem>\n <Collapse \n in={ state[ subOption.name ] } \n timeout=\"auto\" \n unmountOnExit\n >\n { this.handler( subOption.children ) }\n </Collapse>\n </div>\n )\n } )\n }", "function click(d) {\n// use the following to superficially change the text of the node.\n// this.getElementsByTagName('text')[0].textContent = \"clicked all over\"\n\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n\n update(d);\n}", "toggle() {\n this.collapsed = !this.collapsed\n }", "toggle() {\n this.collapsed = !this.collapsed\n }" ]
[ "0.7109894", "0.6869202", "0.665626", "0.6655057", "0.6650161", "0.6647868", "0.66203606", "0.66193414", "0.66120464", "0.65928566", "0.6550344", "0.64945227", "0.6459832", "0.641936", "0.64049387", "0.6374655", "0.6367121", "0.630328", "0.63023406", "0.62904346", "0.62541735", "0.6247139", "0.62183267", "0.6213882", "0.6192106", "0.616484", "0.61530274", "0.6131095", "0.61212015", "0.6108744", "0.6103536", "0.60996", "0.6090052", "0.6076593", "0.607527", "0.60628116", "0.6049298", "0.60435194", "0.6027867", "0.6026974", "0.60165143", "0.60165143", "0.60130346", "0.6011138", "0.5978006", "0.5977234", "0.5967642", "0.59645617", "0.596439", "0.5962566", "0.5952472", "0.5936599", "0.59234536", "0.59155643", "0.59086305", "0.58978015", "0.58959126", "0.58920187", "0.5891611", "0.588887", "0.5887095", "0.5872134", "0.5865016", "0.5865016", "0.5865016", "0.5865016", "0.58581084", "0.5848389", "0.584743", "0.5840479", "0.58385503", "0.5837094", "0.5837094", "0.5837094", "0.5837094", "0.5834104", "0.5824108", "0.5822644", "0.5822644", "0.58222896", "0.5820444", "0.5809543", "0.5808603", "0.5808603", "0.5808603", "0.5808603", "0.5805901", "0.5802797", "0.58007497", "0.57998866", "0.57940537", "0.57913834", "0.5790443", "0.5786103", "0.5786103", "0.5782996", "0.5782996", "0.5772706", "0.57694185", "0.576896", "0.576896" ]
0.0
-1
Compare two scenario results to indicate if it's faster or slower. It considers the error margin, and returns 0 if the difference is in the error margin. It returns a percent of progress.
function compareScenarioResults( result: ScenarioResult, previous: ScenarioResult ): number { const error = Math.max(result.error, previous.error); const difference = (previous.time - result.time) * 100 / previous.time; if (Math.abs(difference) <= error) { return 0; } return difference; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function percentDiff(a, b) {\n let divideBy = (a > b) ? a : b;\n return Math.abs(a - b) / divideBy * 100;\n }", "function dividetest(v1, v2, expected) {\n results.total++;\n var r = calculator.division(v1, v2);\n if (r !== expected) {\n results.bad++;\n console.log(\"Expected \" + expected +\n \", but was \" + r);\n }\n }", "async function diffTwoBenchmarks(times = 1) {\n const result1 = await runBenchmarks(times);\n const result2 = await runBenchmarks(times);\n\n return await compareResults(result1, result2);\n}", "function checkPercent(num1, num2){\n\n ans = (100 - (num1/num2)*100).toFixed(2);\n return Math.abs(ans);\n\n }", "function checkPercent(num1, num2){\n\n ans = (100 - (num1/num2)*100).toFixed(2);\n return Math.abs(ans);\n\n }", "function percentage(a, b){\n\t var increase = b - a;\n\t var step2 = increase / a;\n\t return step2 * 100;\n\t}", "function compareResultScores(result1, result2) {\n return result2.score - result1.score;\n}", "function differenceAccuracy(target, data1, data2) {\n\n\t}", "async function logCompareResults(results, flags, cli) {\n const { fidelity } = flags;\n const benchmarkTable = new table_1.default('Initial Render');\n const phaseTable = new table_1.default('Sub Phase of Duration');\n const controlData = results.find(element => {\n return element.set === 'control';\n });\n const experimentData = results.find(element => {\n return element.set === 'experiment';\n });\n const valuesByPhaseControl = create_consumable_html_1.bucketPhaseValues(controlData.samples);\n const valuesByPhaseExperiment = create_consumable_html_1.bucketPhaseValues(experimentData.samples);\n const subPhases = Object.keys(valuesByPhaseControl).filter(k => k !== create_consumable_html_1.PAGE_LOAD_TIME);\n const phaseResultsFormatted = [];\n const durationStats = new stats_1.Stats({\n control: valuesByPhaseControl.duration,\n experiment: valuesByPhaseExperiment.duration,\n name: 'duration',\n });\n benchmarkTable.display.push(durationStats);\n // @ts-ignore\n phaseResultsFormatted.push(create_consumable_html_1.formatPhaseData(valuesByPhaseControl[create_consumable_html_1.PAGE_LOAD_TIME], valuesByPhaseExperiment[create_consumable_html_1.PAGE_LOAD_TIME], create_consumable_html_1.PAGE_LOAD_TIME));\n subPhases.forEach(phase => {\n phaseTable.display.push(new stats_1.Stats({\n control: valuesByPhaseControl[phase],\n experiment: valuesByPhaseExperiment[phase],\n name: phase,\n }));\n // @ts-ignore\n phaseResultsFormatted.push(create_consumable_html_1.formatPhaseData(valuesByPhaseControl[phase], valuesByPhaseExperiment[phase], phase));\n });\n let isBelowRegressionThreshold = true;\n const benchmarkTableData = benchmarkTable.getData();\n const phaseTableData = phaseTable.getData();\n const areResultsSignificant = anyResultsSignificant(fidelity, benchmarkTable.isSigArray, phaseTable.isSigArray);\n if (areResultsSignificant) {\n isBelowRegressionThreshold = allBelowRegressionThreshold(fidelity, benchmarkTable.estimatorDeltas, phaseTable.estimatorDeltas);\n }\n cli.log(`\\n\\n${benchmarkTable.render()}`);\n cli.log(`\\n\\n${phaseTable.render()}`);\n outputRunMetaMessagesAndWarnings(cli, flags, isBelowRegressionThreshold);\n outputSummaryReport(cli, phaseResultsFormatted);\n return outputJSONResults(benchmarkTableData, phaseTableData, areResultsSignificant, isBelowRegressionThreshold);\n}", "function compareSimulated(player1, player2) {\n // Round to whole number\n const p1Promo = parseFloat(player1.promoChance).toFixed(0);\n const p1Rel = parseFloat(player1.relegationChance).toFixed(0);\n const p2Promo = parseFloat(player2.promoChance).toFixed(0);\n const p2Rel = parseFloat(player2.relegationChance).toFixed(0);\n\n // Ideally, sort based on (promo %) - (rel %)\n // If it's significantly different between the two players, sort by that\n const diffFactor = p2Promo - p2Rel - (p1Promo - p1Rel);\n if (Math.abs(diffFactor) > 3) {\n return diffFactor;\n }\n\n // Otherwise, if their promo chances differ (after they were rounded to 1%), sort based on that\n if (p2Promo !== p1Promo) {\n return p2Promo - p1Promo;\n }\n\n // Likewise with relegation (but BACKWARDS because lower is better)\n if (p2Rel !== p1Rel) {\n return p1Rel - p2Rel;\n }\n\n // Otherwise sort by current points\n return compareRaw(player1, player2);\n}", "function percentLoggedDesc(a,b) {\n if (a.percentLogged < b.percentLogged) {\n return -1;\n } else if (a.percentLogged > b.percentLogged) {\n return 1;\n } else {\n return 0;\n }\n }", "function get_tr_diff_us (tr1, tr2)\n{\n\tvar diff;\n\n\tif (tr1.sample > tr2.sample)\n\t{\n\t\tdiff = (((tr1.sample - tr2.sample) * 1000000) / sample_rate);\n\t}\n\telse\n\t{\n\t\tdiff = (((tr2.sample - tr1.sample) * 1000000) / sample_rate);\n\t}\n\n\treturn diff\n}", "function diff(a, b) {\n totalDifference += Math.abs(a - b);\n }", "function logResult(newT, oldT) {\n const result = newT / oldT;\n console.log(`current: ${newT.toFixed(2)}ms, previous:${oldT.toFixed(2)}ms`);\n if (result > (1 + margin)) {\n console.log(`new version is ${result.toFixed(2)} times slower`);\n } else if (result < (1 - margin)) {\n console.log(`new version is ${(1/result).toFixed(2)} times quicker`);\n } else {\n console.log(`new version performs similar`);\n }\n }", "function compareSimulated(player1, player2) {\n // Round to whole number\n const p1Promo = (\n player1.autoPromoChance +\n 0.5 * player1.playoffPromoChance\n ).toFixed(0);\n const p1Rel = (\n player1.autoRelegationChance +\n 0.5 * player1.playoffRelegationChance\n ).toFixed(0);\n const p2Promo = (\n player2.autoPromoChance +\n 0.5 * player2.playoffPromoChance\n ).toFixed(0);\n const p2Rel = (\n player2.autoRelegationChance +\n 0.5 * player2.playoffRelegationChance\n ).toFixed(0);\n\n // Ideally, sort based on (promo %) - (rel %)\n // If it's significantly different between the two players, sort by that\n const diffFactor = p2Promo - p2Rel - (p1Promo - p1Rel);\n if (Math.abs(diffFactor) > 3) {\n return diffFactor;\n }\n\n // Otherwise, if their promo chances differ (after they were rounded to 1%), sort based on that\n if (p2Promo !== p1Promo) {\n return p2Promo - p1Promo;\n }\n\n // Likewise with relegation (but BACKWARDS because lower is better)\n if (p2Rel !== p1Rel) {\n return p1Rel - p2Rel;\n }\n\n // Otherwise sort by current points\n return compareRaw(player1, player2);\n}", "function percentOf(num1, num2) {\r\n var result = (num1 / num2) * 100;\r\n console.log(num1 + \" is \" + result + \"% of \" + num2);\r\n return result;\r\n}", "efficiency(pt1, pt2) {\n\t\t\tvar intermediatePt = new psych.PointBuilder()\n\t\t\t\t.withElevation(pt2.properties.elevation)\n\t\t\t\t.withHumidityRatio(pt1.properties.W)\n\t\t\t\t.withEnthalpy(pt2.properties.h)\n\t\t\t\t.build();\n\t\t\tvar saturationPt = new psych.PointBuilder()\n\t\t\t\t.withElevation(pt2.properties.elevation)\n\t\t\t\t.withRelativeHumidity(100)\n\t\t\t\t.withEnthalpy(pt2.properties.h)\n\t\t\t\t.build();\n\t\t\treturn (pt2.properties.W - intermediatePt.properties.W) /\n\t\t\t\t(saturationPt.properties.W - intermediatePt.properties.W); // %\n\t\t}", "function calculateAccuracy(){\n return Math.round( (cardMatches / matchAttempts) * 100 );\n}", "function pct(a, b) {\n return Math.round(a / b * 100) + '%';\n }", "function percentOf (num1, num2) {\n\tvar percent = (num1 / num2) * 100;\n\tconsole.log('3) ' + num1 + ' is ' + percent + '% of ' + num2 + '.');\n\treturn percent;\n}", "function compare(a, b) {\n if (a.totalDifference < b.totalDifference) {\n return -1;\n }\n if (a.totalDifference > b.totalDifference) {\n return 1;\n }\n return 0;\n }", "compareDNA(pAeq2){\n let count = 0;\n dna.forEach((base1, index) => {\n const base2 = pAeq2.dna[index];\n if(base1 == base2){\n count++;\n }\n });\n let percent = (count/(dna.length+pAeq2.dna.length))*100;\n percent = percent.toFixed(2);\n console.log(`specimen #${this.specimenNum} and specimen #${pAeq2.specimenNum} have ${percent}% DNA in common.`)\n }", "function subtracttest(v1, v2, expected) {\n results.total++;\n var r = calculator.subtraction(v1, v2);\n if (r !== expected) {\n results.bad++;\n console.log(\"Expected \" + expected +\n \", but was \" + r);\n }\n }", "function totalDiff(compare, myScores) {\n var td = 0;\n for (var i = 0; i < compare.length; i++) {\n td += Math.abs(compare[i] - myScores[i]);\n // console.log(Math.abs(compare[i] - myScores[i]));\n }\n return td;\n}", "function compareRobots(robot1, memory1, robot2, memory2) {\n \n let robot1Total = 0;\n let robot2Total = 0;\n let numberOfTasks = 100;\n let numberOfTurns = 0;\n \n for (let i = 0; i < numberOfTasks; i++){\n //console.log(\"Task number: \", i+1)\n let village = VillageState.random();\n //console.log(\"Parcels: \", village.parcels[0])\n numberOfTurns = runTest(village, robot1, []);\n robot1Total += numberOfTurns;\n //console.log(\"Robot 1 tasks: \", numberOfTurns);\n numberOfTurns = runTest(village, robot2, []);\n //console.log(\"Robot 2 tasks: \", numberOfTurns);\n robot2Total += numberOfTurns;\n //console.log(\"Robot 1: \", robot1Total)\n //console.log(\"Robot 2: \", robot2Total)\n }\n\n let r1avg = robot1Total/numberOfTasks;\n let r2avg = robot2Total/numberOfTasks;\n\n console.log(\"Grand totals\");\n console.log(\"Number of tasks: \", numberOfTasks)\n console.log(\"Robot 1 Average: \", r1avg)\n console.log(\"Robot 2 Average: \", r2avg)\n if ( r1avg > r2avg) {\n console.log(\"Robot 2 performed more efficiently\")\n }\n else if (r1avg < r2avg){\n console.log(\"Robot 1 performed more efficiently\")\n }\n else if(r1avg == r2avg){\n console.log(\"The robots were the same efficiency\")\n } \n}", "compareDnaV2 (pAequor) {\n const result = this.dna.reduce((acc, curr, idx, arr) => {\n if (arr[idx] === pAequor.dna[idx]) {\n return acc + 1;\n }\n else {\n return acc;\n }\n }, 0)\n const percentage2 = result / this.dna.length * 100;\n return `Specimen ${this.specimenNum} and specimen ${pAequor.specimenNum} have ${percentage2.toFixed \n (2)}% in common.`\n }", "function costDiff(costA, costB) {\n return (260/12) * (Math.abs(costA - costB));\n }", "function calculateDiff(personAsking, personCompared) {\n let tempArray = [];\n for (var i = 0; i < personAsking.Answers.length; i++) {\n var result = Math.abs(personAsking.Answers[i] - personCompared.Answers[i]);\n // console.log(\"This result: \" + result);\n var newResult = runPercentageFormula(result);\n tempArray.push(newResult);\n }\n var compabilityRate = addPercentageTogether(tempArray);\n compareArray.push({ name: personCompared.Name, rate: compabilityRate });\n\n // console.log(compabilityRate);\n}", "function caculateTotalDifference(scoresA, scoresB) {\n var totalDifference = 0;\n for (var i = 0; i < scoresA.length; i++) {\n totalDifference += Math.abs(scoresA[i] - scoresB[i]);\n }\n // console.log(\"totalDifference: \" + totalDifference);\n return totalDifference;\n}", "function compareByRelevance(o1, o2) {\n var result = 0;\n\n if (Math.abs(0.5 - o1.percentage) > Math.abs(0.5 - o2.percentage)) {\n result = -1; // A trait with 1% is more interesting than one with 60%.\n }\n\n if (Math.abs(0.5 - o1.percentage) < Math.abs(0.5 - o2.percentage)) {\n result = 1;\n }\n\n return result;\n}", "function compare(a,b){\n var x = a.totalDiff;\n var y = b.totalDiff;\n if (x < y) {return -1;}\n if (x > y) {return 1;}\n return 0;\n }", "function calculateAccuracy() {\nvar typedText = input.value;\nvar errorCount = 0;\nfor (var i = 0; i < typedText.length; i++) {\nif (typedText[i] !== currentSentence[i]) {\nerrorCount++;\n}\n}\nreturn ((currentSentence.length - errorCount) / currentSentence.length * 100).toFixed(2);\n}", "function calcPercentage(val1, val2) {\n let percentage = (val1 / val2) * 100;\n percentage = parseInt(percentage);\n return percentage;\n}", "function compareResults(result1, result2) {\n return (result2.score - result1.score) ||\n result1.name.localeCompare(result2.name);\n}", "function compareResults(result1, result2) {\n return (result2.score - result1.score) ||\n result1.name.localeCompare(result2.name);\n}", "function compareRobots(robot1, memory1, robot2, memory2) {\n const NUMBER_OF_TASKS = 100;\n const turn_counts = {robot1: 0, robot2: 0};\n let average_robot1 = 0;\n let average_robot2 = 0;\n for(let counter = 0; counter < NUMBER_OF_TASKS; counter++) {\n let villageState = (new classes.VillageState(null, null, roadGraph)).random();\n turn_counts.robot1 += utils.runRobot(villageState, robot1, memory1, roadGraph);\n turn_counts.robot2 += utils.runRobot(villageState, robot2, memory2, roadGraph);\n }\n\n average_robot1 = utils.calculateAverage(turn_counts.robot1, NUMBER_OF_TASKS);\n average_robot2 = utils.calculateAverage(turn_counts.robot2, NUMBER_OF_TASKS);\n\n console.log(\"Robot1: \" + average_robot1);\n console.log(\"Robot2: \" + average_robot2);\n}", "function getScore() {\n\treturn parseFloat((Math.abs(error) / ramp * 100).toPrecision(4));\n}", "function stringCompByLevenshteinDistance(s1,s2){\n\tlet longer = s1;\n\tlet shorter = s2;\n\tif (s1.length < s2.length) {\n\t\tlonger = s2;\n\t\tshorter = s1;\n\t}\n\tvar longerLength = longer.length;\n\tif (longerLength == 0) {\n\t\treturn 1.0;\n\t}\n\treturn (longerLength - editDistance(longer, shorter)) / parseFloat(longerLength);\n}", "function vers_compare(a, b) {\n a = a.split('.');\n b = b.split('.');\n for (var i = 0; i < 3; i++) {\n var d = parseInt(a[i] || '0') - parseInt(b[i] || '0');\n if (d != 0) {\n return d;\n }\n }\n return 0; // Equal\n}", "function calc_step_size(a, b) {\r\n return (a - b) / steps_total;\r\n}", "function parseCompareStats(trollOutput) {\n\n var result = {\n atLeast : {\n doubleSuccess : null,\n success : null,\n draw : null,\n failure : null,\n doubleFailure : null\n },\n group : {\n doubleSuccess : null,\n success : null,\n draw : null,\n failure : null,\n doubleFailure : null\n }\n }\n\n var pattern = /\\s*[0-9-]*\\s*:\\s*([0-9.]*)\\s*([0-9.]*)\\s*/i;\n var lines = trollOutput.split(\"\\n\");\n for (var i = 1; i < 6; i++) {\n var matches = pattern.exec(lines[i]);\n var percentage = parseFloat(matches[1]);\n var totalPercentage = parseFloat(matches[2]);\n\n switch(i) {\n case 5:\n result.group.doubleFailure = percentage;\n result.atLeast.doubleFailure = 100 - (totalPercentage - percentage);\n break;\n\n case 4:\n result.group.failure = percentage;\n result.atLeast.failure = 100 - (totalPercentage - percentage);\n break;\n\n case 3:\n result.group.draw = percentage;\n result.atLeast.draw = 100 - (totalPercentage - percentage);\n break;\n\n case 2:\n result.group.success = percentage;\n result.atLeast.success = 100 - (totalPercentage - percentage);\n break;\n\n case 1:\n result.group.doubleSuccess = percentage;\n result.atLeast.doubleSuccess = 100 - (totalPercentage - percentage);\n break;\n }\n }\n\n return result;\n}", "function compares(x, y){\n if (x /0 === y/0){\n console.log(\"Yes they are the same\");\n console.log(x / y);\n } else {\n console.log(\"no they are not equal\");\n }\n}", "function isApproximately(a, b, withinPercent) {\n let percent = a / b * 100;\n Phoenix.log(percent);\n return percent > 100 - withinPercent && percent < 100 + withinPercent \n}", "getProgressPercent() {\n const progressPercent = this.state.pastStepCount / this.state.stepGoal;\n return Math.floor(progressPercent * 100);\n }", "function compare(t,res,ans) {\n console.log(`comparing ${res} to ${ans}`);\n t.approximately(res.getValue(),ans.getValue(), 0.5);\n t.equal(res.equalUnits(ans),true);\n}", "function percentOf(num1, num2) {\n \n let percent = num1/num2 * 100 ;\n console.log(num1 + 'is' + percent + '% of' + num2);\n return percent;\n}", "function percentOf (num1, num2){\n let percentage = num1 / num2 *100;\n console.log(`${num1} is ${percentage}% of ${num2}`);\n}", "function calc(){\r\n\"use strict\";\r\nnumPFail = (numFail/numTotalRuns)*100;\r\nnumP0 = (num0/numTotalRuns)*100;\r\nnumP1 = (num1/numTotalRuns)*100;\r\nnumP2 = (num2/numTotalRuns)*100;\r\nnumP3 = (num3/numTotalRuns)*100;\r\nnumP4 = (num4/numTotalRuns)*100;\r\nnumP5 = (num5/numTotalRuns)*100;\r\nnumRatePSB = numTotalPSB/numTotalRuns;\r\nnumRateRML = numTotalRML/numTotalRuns;\r\n}", "function calc_step_size(a,b) {\r\n return (a - b) / steps_total;\r\n}", "function calculatePerc() {\n return quizMetrics.numCorrect / dataSvc.quizQuestions.length * 100;\n }", "function percentOf(num1,num2){\n\tvar percent = (num1 / num2) * 100;\n\tconsole.log( num1+ ' is ' + percent + '% of ' + num2);\n\treturn percent;\n\n}", "function percentage(a,b){\n return (a/b)*100;\n}", "function calculateAccuracy(chances){\n var falseCount = 0;\n var trueCount = 0;\n\n chances.forEach(function(chance){\n if (chance.result){\n trueCount++;\n } else {\n falseCount++;\n }\n });\n\n return chances.length === 0 ? 0 : ((trueCount/chances.length) * 100);\n}", "function calculateDiffPercent(response, cb) {\n var oldValue = JSON.stringify(response.oldValue);\n var newValue = JSON.stringify(response.newValue);\n \n var diffPercent = (Math.abs(oldValue.length - newValue.length) / ((oldValue.length + newValue.length)/2)) * 100;\n console.log(diffPercent);\n cb(diffPercent);\n}", "function scorePokemon(pokemon1, pokemon2) {\n const forwardCounter = getCounterWeight(pokemon1, pokemon2.counters); // how well pokemon1 counters pokemon2\n const backwardsCounter = getCounterWeight(pokemon2, pokemon1.counters); // how well pokemon2 coutners pokemon1\n return 0.5 * forwardCounter + (1 - backwardsCounter) * 0.5;\n}", "function compareRaw(player1, player2) {\n // Higher score first\n if (player2.points !== player1.points) {\n // console.log(\"points:\", player1.points, player2.points);\n return player2.points - player1.points;\n }\n // Higher GD first\n if (player2.gd !== player1.gd) {\n // console.log(\"gd:\", player1.gd, player2.gd);\n return player2.gd - player1.gd;\n }\n // Higher Matches Won first\n if (player2.wins !== player1.wins) {\n // console.log(\"wins:\", player1.wins, player2.wins);\n return player2.wins - player1.wins;\n }\n // Higher GF first\n if (player2.gf !== player1.gf) {\n return player2.gf - player1.gf;\n }\n return player1.name.localeCompare(player2.name);\n}", "function percentOfValue(p1, p2) {\r\n return Math.round((p1 / p2) * 100);\r\n}", "function EXPECT_NEAR(x1, x2, tolerance, stringOnFail) {\n if (isNaN(x1) || isNaN(x2)) {\n LOG('EXPECT_NEAR FAILED');\n LOG('x1: ' + x1);\n LOG('x2: ' + x2);\n LOG(stringOnFail);\n numErrors_ += 1;\n } else {\n if (Math.abs(x2 - x1) > tolerance) {\n LOG('EXPECT_NEAR FAILED');\n LOG('x1: ' + x1);\n LOG('x2: ' + x2);\n LOG('Difference of ' + Math.abs(x2 - x1) + ' exceeds tolerance of '\n + tolerance);\n LOG(stringOnFail);\n numErrors_ += 1;\n }\n }\n}", "function division(a, b) {\n\treturn printResult(parseInt(a) / parseInt(b));\n}", "function VerificationPercentage() {\n return generationPercentage.reduce(function(a, b) { return a + b; }, 0);\n}", "function calculateDelta(scores1, scores2) {\n var diff = 0;\n for (var i = 0; i < scores1.length; i++) {\n diff += Math.abs(scores1[i] - scores2[i]);\n }\n return diff;\n}", "function getScore(correct, missed, noAnswer){\n let x = (correct / (correct + missed + noAnswer)) * 100;\n return x;\n }", "function difference(a, b) {\n return Math.abs(a - b);\n }", "function similarity(s1, s2) {\r\n var longer = s1;\r\n var shorter = s2;\r\n if (s1.length < s2.length) {\r\n longer = s2;\r\n shorter = s1;\r\n }\r\n var longerLength = longer.length;\r\n if (longerLength == 0) {\r\n return 1.0;\r\n }\r\n return (longerLength - editDistance(longer, shorter)) / parseFloat(longerLength);\r\n}", "function calc_step_size(a,b) {\n\t\t return (a - b) / steps_total;\n\t\t}", "doMath() {\n // Actual capacities\n const runningCap = this.props.workerType.runningCapacity;\n const pendingCap = this.props.workerType.pendingCapacity;\n const maxCap = this.props.workerType.maxCapacity;\n // We want to make sure that if a bar is there that it's visible\n const smallestCapUnit = maxCap * 0.05;\n // Fuzz the percentages to make sure all bars are visible. If we have a\n // state with 0%, we don't fuzz at all. If we have 1-4%, we round to 5%\n // and we don't fuzz above 5%\n const fuzzedRunning = runningCap\n ? Math.max(runningCap, smallestCapUnit)\n : 0;\n const fuzzedPending = pendingCap\n ? Math.max(pendingCap, smallestCapUnit)\n : 0;\n // Determine the number which we should use to figure out our percentages.\n // When we have less than the max configured, we use that setting. When we\n // exceed that amount, we want to sum up all the capacity units\n const count = fuzzedRunning + fuzzedPending;\n const divideBy = Math.max(maxCap, count);\n // Calculate the percentages to use for the bars. These numbers are\n // invalid for other purposes\n const runPer = fuzzedRunning / divideBy;\n const pendPer = fuzzedPending / divideBy;\n\n return {\n r: runPer * 100,\n p: pendPer * 100,\n rc: runningCap,\n pc: pendingCap\n };\n }", "_getChangePercentPerMinute(currTrade, prevTrade) {\n this.logger.log(base_1.LogLevel.TRACE, `currQuote: ${currTrade.p} prevQuote: ${prevTrade.p} -- currQuote.t = ${currTrade.t} --- prevQuote.t = ${prevTrade.t}`);\n this.logger.log(base_1.LogLevel.TRACE, `Time difference in seconds: ${((currTrade.t / 1000) - (prevTrade.t / 1000))}`);\n let currTradePrice = new decimal_js_1.Decimal(currTrade.p);\n let prevTradePrice = new decimal_js_1.Decimal(prevTrade.p);\n // This gets the difference between the two quotes, and get's the % of that change of a share price. i.e (11 - 10) / 11 = 10%;\n let changePercent = new decimal_js_1.Decimal(currTradePrice.minus(prevTradePrice)).dividedBy(currTradePrice).times(100);\n console.log(`ChangePercent: ${changePercent.toString()}`);\n //Gets time difference in seconds, and translate to minutes\n let currTradeSeconds = new decimal_js_1.Decimal(currTrade.t).dividedBy(1000);\n let prevTradeSeconds = new decimal_js_1.Decimal(prevTrade.t).dividedBy(1000);\n let timeDifferenceInMinutes = new decimal_js_1.Decimal(new decimal_js_1.Decimal(currTradeSeconds).minus(prevTradeSeconds)).dividedBy(60);\n console.log(`TimeDifferenceInSeconds: ${timeDifferenceInMinutes.toString()}`);\n //Returns the rate of increase (as a percentage) per minute;\n return changePercent.dividedBy(timeDifferenceInMinutes).toNumber();\n }", "function mainCalculation(failedNow) {\n\t\n\tvar loss;\n\n\tdo {\n\t\t// At the beginning, setting that failedIndicator is failedNow.\n\t\tvar failedIndicator = failedNow;\n\t\t// Calculates what banks will fail.\n\t\tloss = failurePropagation(failedIndicator, exposures);\n\t\t// Calculattes what companies will fail.\n\t\tvar failed = PWComparison(thresholds, loss);\n\t\t// merging the new result and old result together.\n\t\tfailedNow = PWOr(failed, failedIndicator);\n\t} while(failedMore(failedIndicator, failedNow));\n\n\tif(limit_graph >= countGraph) {\n\t\t// adding a chert to html tag.\n\t\tgenerateChertH(failedNow, thresholds, loss, countGraph + 1, \"Example a Scenario Result #\");\n\t\t// count as a graph has been added.\n\t\tcountGraph++;\n\t}\n\t\n\n\tvar countloss = 0.0;\n\tfor(var i = 0; i < failedNow.length; ++i) {\n\t // if bank doesn't failed.\n\t if(failedNow[i] < 1.0) {\n\t countloss += loss[i];\n\t } \n\t // bank did failed.\n\t else {\n\t countloss += (loss[i] >= thresholds[i]? loss[i]: thresholds[i]);\n\t }\n\t}\n\n\t// return Totalloss.\n\treturn countloss;\n}", "function comparePlayerStats() {\n\tvar firstPlayerStats = $(document).find(\".player-stats-left\").find('.stat-value');\n\tvar secondPlayerStats = $(document).find(\".player-stats-right\").find('.stat-value');\n\t// Only proceed if stats are being displayedfor two players\n\tif(firstPlayerStats.length > 0 && secondPlayerStats.length > 0) {\n\t\tfor(var i = 0; i < firstPlayerStats.length; i++) {\n\t\t\tif(parseFloat($(firstPlayerStats[i]).text()) > parseFloat($(secondPlayerStats[i]).text())) {\n\t\t\t\t$(firstPlayerStats[i]).addClass(\"better-number\");\n\t\t\t} else if(parseFloat($(firstPlayerStats[i]).text()) < parseFloat($(secondPlayerStats[i]).text())) {\n\t\t\t\t$(secondPlayerStats[i]).addClass(\"better-number\");\n\t\t\t}\n\t\t}\n\t}\n}", "function calculateCoverage() {\n var numTrue = 0;\n for (var i in codeCoverage) {\n if (codeCoverage[i]) {\n numTrue++;\n }\n }\n return numTrue * 100 / codeCoverage.length\n}", "function probScenario(failureProb, failed) {\n\tif(failureProb.length != failed.length) {\n\t\tthrow('In failurePropagation, the length of both are not the same.');\n\t}\n\telse {\n\t\tvar prob = 1.0;\n\t\t// Calculating in each bank.\n\t\tfor(var i = 0; i < failureProb.length; ++i) {\n\t\t\t// if banks not failed.\n\t\t\tif(failed[i] < 1.0) {\n\t\t\t\tprob *= (1-failureProb[i]);\n\t\t\t}\n\t\t\t// if banks failed.\n\t\t\telse {\n\t\t\t\tprob *= (failureProb[i]);\t\n\t\t\t}\n\t\t}\n\t\t// How likely of this scenario.\n\t\treturn prob;\n\t}\n}", "function calculatePrecisionIncludeDescription(correct,wrong,inDescription) {\r\n let precision = ((correct+inDescription)/(correct+wrong+inDescription))*100\r\n return precision;\r\n}", "function similarity (s1, s2) {\n var longer = s1;\n var shorter = s2;\n if (s1.length < s2.length) {\n longer = s2;\n shorter = s1;\n }\n var longerLength = longer.length;\n if (longerLength == 0) {\n return 1.0;\n }\n return (longerLength - editDistance(longer, shorter)) / parseFloat(longerLength);\n}", "static _compareOutputs(o1, o2) {\n \n // compare by height\n let heightComparison = MoneroWalletRpc._compareTxsByHeight(o1.getTx(), o2.getTx());\n if (heightComparison !== 0) return heightComparison;\n \n // compare by account index, subaddress index, and output\n if (o1.getAccountIndex() < o2.getAccountIndex()) return -1;\n else if (o1.getAccountIndex() === o2.getAccountIndex()) {\n let compare = o1.getSubaddressIndex() - o2.getSubaddressIndex();\n if (compare !== 0) return compare;\n return o1.getIndex() - o2.getIndex();\n }\n return 1;\n }", "compareDna (pAequor) {\n let identicalResults = 0;\n for (let i = 0; i < 15; i++) {\n if (this.dna[i] === pAequor.dna[i]) {\n identicalResults += 1;\n } \n }\n const percentage = identicalResults / this.dna.length * 100;\n console.log(`Specimen ${this.specimenNum} and specimen ${pAequor.specimenNum} have ${percentage.toFixed \n (2)}% in common.`);\n }", "function Compare(a, b) {\n return(b.sim - a.sim);\n}", "function calculateRatio(l1, l2) {\n\t\treturn l1 > l2 ? l1 / l2 : l2 / l1;\n\t}", "function similarity(s1, s2) {\n var longer = s1;\n var shorter = s2;\n if (s1.length < s2.length) {\n longer = s2;\n shorter = s1;\n }\n var longerLength = longer.length;\n if (longerLength == 0) {\n return 1.0;\n }\n return (\n (longerLength - editDistance(longer, shorter)) / parseFloat(longerLength)\n );\n}", "function calcScore(correct, length) {\n return correct / length * 100; \n}", "function compareTwoTestRuns ({ baseline, candidate }) {\n console.log(`using ${baseline.batchName} as baseline`)\n console.log(`using ${candidate.batchName} as candidate`)\n\n const independentStats = {\n baseline: computeIndependent(baseline.tests),\n candidate: computeIndependent(candidate.tests),\n }\n\n printIndependentStats(independentStats)\n\n const mergedTests = getMergedTests({ baseline: baseline.tests, candidate: candidate.tests })\n\n computeDistributions(mergedTests)\n\n computeComparison(mergedTests)\n\n return mergedTests\n}", "function calcRatio() {\n let wins = scores.player.wins;\n let losses = scores.player.losses;\n return losses === 0\n ? Number(wins).toFixed(3)\n : Number(wins / losses).toFixed(3);\n }", "function compare(a, b)\n{\n\tif (!isArray(a) || !isArray(b) || a.length !== b.length)\n\t\treturn \"error\";\n\n\tvar wrongList = [];\n\tfor (var i = 0; i < a.length; i++)\n\t{\n var fa = parseFloat(a[i]);\n var fb = parseFloat(b[i]);\n\n // Allow for non-numeric answers\n if (isNaN(fa) || isNaN(fb))\n {\n console.log(\"One of the inputs is not a number\");\n if (a[i] != b[i])\n wrongList.push(i);\n continue;\n }\n\n trunc = truncate(fa, fb);\n// console.log(\"aTrunk = \" + trunc[0] + \"; bTrunk = \" + trunc[1] + \"; d = \" + trunc[2]);\n\n if (checkEquiv(trunc[0], trunc[1], trunc[2]) === false)\n wrongList.push(i);\n\t}\n\n\treturn {\n iscorrect: (wrongList.length === 0),\n\t\twrong: wrongList,\n equiv: (wrongList.length === 0 ? \"correct\" : \"incorrect\")\n };\n/* \n {\n\t\tequiv: (wrongList.length === 0),\n\t\twrong: wrongList\n\t};\n*/\t\n}", "function percentof(a,b){\nconsole.log(`${a} is ${a/b*100} % of ${b}.`)\nreturn a/b*100\n}", "function compare(a, b) {\n const fitA = a.getFitness();\n const fitB = b.getFitness();\n\n let comparison = 0;\n\n if (fitA > fitB) {\n comparison = 1;\n } else if (fitA < fitB) {\n comparison = -1;\n }\n if (!towardBio) {\n comparison *= -1;\n }\n return comparison;\n}", "function compareScores(state1, state2) {\n return (state1 - state2 + 5) % 3;\n }", "getExpectedValue(failureProbabilty, successScore, failScore, pass) {\n const ev =\n (1 - failureProbabilty) * (successScore + pass) +\n failureProbabilty * (failScore + pass);\n return ev;\n }", "function percentDifference(array){\r\n let temp;\r\n let state;\r\n for(let c = 0;c<array.length;c++){\r\n if(array[c].fips !== 0){\r\n temp = Math.abs(array[c].obamaVote - array[c].romneyVote);\r\n state = array[x].state;\r\n break;\r\n }\r\n }\r\n for(let x = 1;x<array.length;x++){\r\n if(array[x].fips == 0){\r\n continue;\r\n }\r\n else if(Math.abs(array[x].obamaVote - array[x].romneyVote) >= temp){\r\n temp = Math.abs(array[x].obamaVote - array[x].romneyVote);\r\n state = array[x].state;\r\n }\r\n else if(Math.abs(array[x].obamaVote - array[x].romneyVote) < temp){\r\n continue;\r\n }\r\n }\r\n return state;\r\n }", "function calculatePercentLeft() {\n for (let i = 0; i < props.rewards.length; i++) {\n // If the current index req points is great than, then use that as the next goal/threshold\n if (props.rewards[i].req_points > props.points.points)\n return Math.floor((props.points.points / props.rewards[i].req_points) * 100);\n }\n }", "timeTaken(){\n var resultTime = this._endTime - this._startTime; \n var diff = Math.ceil(resultTime / 1000); \n this._timeTaken = diff;\n return diff ;\n }", "function calcDistance(g1, s1, p1, g2, s2, p2) {\r\n\tif(p1 == p2 && s1 == s2 && g1 == g2) {\r\n\t\treturn 5\r\n\t}\r\n\telse if(s1 == s2 && g1 == g2) {\r\n\t\treturn 1000 + Math.abs(p1 - p2) * 5\r\n\t}\r\n\telse if(g1 == g2) {\r\n\t\treturn 2700 + Math.abs(s1 - s2) * 95\r\n\t}\r\n\telse {\r\n\t\treturn Math.abs(g1 - g2) * 20000\r\n\t}\r\n}", "function calculateResult() {\r\n var PRACTICALITY_RATIO = 0.7; \r\n var MARKET_RATIO = 0.3; \r\n practicalityScore = $('#results_practicality_hidden').val();\r\n marketScore = $('#results_market_hidden').val();\r\n var effectScore = (practicalityScore * PRACTICALITY_RATIO) +\r\n (marketScore * MARKET_RATIO);\r\n // we round the result to the second decimal place \r\n return effectScore;\r\n}", "function percentOf(num1, num2) {\n\treturn (num1*100)/num2 +\" of num2 \" \n\n}", "similarity(str1, str2) {\n\t\t//Check for undefined\n\t\tif(!str1||!str2) return 0\n\t\t//Set longest string\n\t\tvar longer = str1;\n\t\tvar shorter = str2;\n\t\tif (str1.length < str2.length){\n\t\t\tlonger = str2;\n\t\t\tshorter = str1;\n\t\t}\n\t\tvar longerLength = longer.length;\n\t\tif (longerLength == 0) {\n\t\t\treturn 1.0;\n\t\t}\n\t\treturn (longerLength - this.levenshtein_distance(longer, shorter)) / parseFloat(longerLength);\n\t}", "function UpdateProgressMetrics(){\n // Calculate percentage of module progress\n perbaspro = baspro/20*100;\n perpospro = pospro/20*100;\n perfol1pro = fol1pro/20*100;\n perfol2pro = fol2pro/20*100;\n perbashrqpro = bashrqpro/6*100;\n perposhrqpro = poshrqpro/6*100;\n perfol1hrqpro = fol1hrqpro/6*100;\n perfol2hrqpro = fol2hrqpro/6*100;\n perbasmitakpro = basmitakpro/37*100;\n perposmitakpro = posmitakpro/37*100;\n perfol1mitakpro = fol1mitakpro/37*100;\n perfol2mitakpro = fol2mitakpro/37*100;\n permipro = mipro/6*100;\n peroarspro = oarspro/58*100;\n pertarpro = tarpro/33*100;\n perevokpro = evokpro/100*100;\n perplanpro = planpro/11*100;\n perfullmipro = fullmipro/1*100;\n \n // Calculate percentage of skill acquisition based on correct items\n affirmcount = UpdateProgressResponseCorrect(oarsanswercorrect5) + UpdateProgressResponseCorrect(oarsanswercorrect6);\n peraffirm = affirmcount/15*100;\n \n reflectcount = UpdateProgressResponseCorrect(oarsanswercorrect4) + UpdateProgressResponseCorrect(targetanswercorrect2);\n perreflect = reflectcount/11*100;\n \n openclosecount = UpdateProgressResponseCorrect(oarsanswercorrect1) + UpdateProgressResponseCorrect(oarsanswercorrect2) + UpdateProgressResponseCorrect(oarsanswercorrect3);\n peropenclose = openclosecount/39*100;\n \n targetcount = UpdateProgressResponseCorrect(targetanswercorrect1);\n pertarget = targetcount/13*100;\n \n changetalkcount = UpdateProgressResponseCorrect(evokanswercorrect1) + UpdateProgressResponseCorrect(evokanswercorrect2) + UpdateProgressResponseCorrect(evokanswercorrect3) + UpdateProgressResponseCorrect(evokanswercorrect4) + UpdateProgressResponseCorrect(evokanswercorrect5);\n perchangetalk = changetalkcount/88*100;\n \n}", "function getTheDifference() {\t\n\tvar difference;\n\tvar leftSet = parseFloat($(\"#LR\").text());\n\tvar rightSet = parseFloat($(\"#RR\").text());\n\tif(isNaN(rightSet)) rightSet = 0;\n\tif(isNaN(leftSet)) leftSet = 0;\n\t// reset the difference counter\t\n\tclearTheDifference();\n\t// check if the sets aren't empty\t\n\tif ( leftSet==0 && rightSet==0 ) {\n\t\tresetSetSizeIndicators();\n\t\tclearTheDifference();\n\t}\n\telse { \n\t\tif( leftSet>rightSet) {\n\t\t\tdifference = leftSet-rightSet;\n\t\t\t// remove 'bigger' and 'smaller'\n\t\t\tresetSetSizeIndicators();\n\t\t\t$('#leftSubSum').append('Bigger');\n\t\t\t$('#rightSubSum').append('Smaller');\n\t\t\t\n\t\t\tif(difference < 1) {\n\t\t\t\t// display decimal places\n\t\t\t\tvar trimmedDifference = displayDecimalPlaces(difference);\n\t\t\t\t$('#result').append(trimmedDifference);\n\t\t\t\t// used for json\n\t\t\t\t$('#realDifference').append(difference);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// round up\n\t\t\t\t$('#result').append(Math.round(difference));\n\t\t\t\t// used for json\n\t\t\t\t$('#realDifference').append(difference);\n\t\t\t}\n\t\t}\n\telse if( leftSet<rightSet ) {\n\t\tdifference = rightSet-leftSet;\n\t\tresetSetSizeIndicators();\n\t\t$('#rightSubSum').append('Bigger');\n\t\t$('#leftSubSum').append('Smaller');\n\t\t\t\n\t\t\tif(difference < 1) {\n\t\t\t// display decimal places\n\t\t\tvar trimmedDifference = displayDecimalPlaces(difference);\n\t\t\t$('#result').append(trimmedDifference);\n\t\t\t// used for json\n\t\t\t$('#realDifference').append(difference);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// round up\n\t\t\t\t$('#result').append(parseInt(difference));\n\t\t\t\t// used for json\n\t\t\t\t$('#realDifference').append(difference);\n\t\t\t}\n\t}\n\t}\n}", "function compareSimilarity(a, b) {\n var score1 = similarityScores[a.name];\n var score2 = similarityScores[b.name];\n return score2 - score1\n }", "function compare_marginals(marginal_1, marginal_2)\n/* computes the sum of the absolute difference of the components of two marginals */\n{\n let sum=0\n for (const n in marginal_1)\n {\n let c = nd.zip_elems([marginal_1[n],marginal_2[n]], (a,b) => Math.abs(a-b) )\n sum+=c.reduceElems((x,y)=>x+y)\n }\n return sum\n}", "comparePrices(lastPrice, currentPrice) {\n return ((currentPrice - lastPrice) / denominator) * 100\n }", "compareDNA(pAequor) {\n\t\t\tlet curr = this.dna;\n\t\t\tlet past = pAequor.dna;\n\t\t\tlet cnt = 0;\n\t\t\tfor(let i = 0; i < curr.length; i++) {\n\t\t\t\tif(curr[i] === past[i]) {\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet perc = (cnt/(curr.length) * 100).toFixed(2);\n\t\t\tconsole.log(`specimen #1 and specimen #2 have ${perc}% DNA in common`);\n\t\t}", "function secondDiff(time1,time2,unit,returnSigned) {\r\n\tsec = time2-time1;\r\n\tif (!returnSigned) sec = Math.abs(sec);\r\n\t// Return in specified units\r\n\tif (unit == \"s\") {\r\n\t\treturn sec;\r\n\t} else if (unit == \"m\") {\t\r\n\t\treturn sec/60;\r\n\t} else if (unit == \"h\") {\t\r\n\t\treturn sec/3600;\r\n\t} else if (unit == \"d\") {\t\r\n\t\treturn sec/86400;\r\n\t} else if (unit == \"M\") {\r\n\t\treturn sec/2630016; // Use 1 month = 30.44 days\r\n\t} else if (unit == \"y\") {\r\n\t\treturn sec/31556952; // Use 1 year = 365.2425 days\r\n\t}\r\n\treturn 'NaN';\r\n}" ]
[ "0.65683204", "0.6494723", "0.6003157", "0.59573406", "0.59573406", "0.595473", "0.5934593", "0.5782212", "0.57640904", "0.5737287", "0.5689905", "0.5669492", "0.5660689", "0.56575835", "0.56283534", "0.56271887", "0.56094444", "0.5591329", "0.55909514", "0.5583373", "0.55717325", "0.55446565", "0.55349183", "0.5518433", "0.5511471", "0.550354", "0.5477428", "0.54619616", "0.5422674", "0.541763", "0.54108137", "0.5401446", "0.53933024", "0.5380261", "0.5380261", "0.53794134", "0.53726095", "0.53720963", "0.5364538", "0.5364243", "0.53521633", "0.5345604", "0.53358454", "0.5329404", "0.53206617", "0.5299528", "0.5294685", "0.5293485", "0.5283201", "0.5276688", "0.52760905", "0.5270431", "0.52687544", "0.525231", "0.52509093", "0.52465767", "0.5246225", "0.5244568", "0.5240759", "0.52302444", "0.52298313", "0.5215452", "0.5213026", "0.52084476", "0.5207875", "0.52057326", "0.5202785", "0.52009106", "0.5197678", "0.51895696", "0.5186607", "0.5186064", "0.5180667", "0.51776516", "0.5176688", "0.51760405", "0.51743716", "0.517253", "0.5165899", "0.5149349", "0.5146861", "0.514508", "0.5139619", "0.5134087", "0.5127331", "0.5120776", "0.51043284", "0.5104102", "0.5099758", "0.509421", "0.5091852", "0.5089409", "0.5085222", "0.50836825", "0.50804484", "0.50804263", "0.508034", "0.50785935", "0.5077774", "0.5077669" ]
0.75824684
0
Get a visual indicator for a difference between two results.
function getDifferenceIcon(difference: number): string { if (difference > 0) { return colors.green('✔'); } else if (difference < 0) { return colors.red('✖'); } return '✔'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function diff(a, b) {\n totalDifference += Math.abs(a - b);\n }", "function getTheDifference() {\t\n\tvar difference;\n\tvar leftSet = parseFloat($(\"#LR\").text());\n\tvar rightSet = parseFloat($(\"#RR\").text());\n\tif(isNaN(rightSet)) rightSet = 0;\n\tif(isNaN(leftSet)) leftSet = 0;\n\t// reset the difference counter\t\n\tclearTheDifference();\n\t// check if the sets aren't empty\t\n\tif ( leftSet==0 && rightSet==0 ) {\n\t\tresetSetSizeIndicators();\n\t\tclearTheDifference();\n\t}\n\telse { \n\t\tif( leftSet>rightSet) {\n\t\t\tdifference = leftSet-rightSet;\n\t\t\t// remove 'bigger' and 'smaller'\n\t\t\tresetSetSizeIndicators();\n\t\t\t$('#leftSubSum').append('Bigger');\n\t\t\t$('#rightSubSum').append('Smaller');\n\t\t\t\n\t\t\tif(difference < 1) {\n\t\t\t\t// display decimal places\n\t\t\t\tvar trimmedDifference = displayDecimalPlaces(difference);\n\t\t\t\t$('#result').append(trimmedDifference);\n\t\t\t\t// used for json\n\t\t\t\t$('#realDifference').append(difference);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// round up\n\t\t\t\t$('#result').append(Math.round(difference));\n\t\t\t\t// used for json\n\t\t\t\t$('#realDifference').append(difference);\n\t\t\t}\n\t\t}\n\telse if( leftSet<rightSet ) {\n\t\tdifference = rightSet-leftSet;\n\t\tresetSetSizeIndicators();\n\t\t$('#rightSubSum').append('Bigger');\n\t\t$('#leftSubSum').append('Smaller');\n\t\t\t\n\t\t\tif(difference < 1) {\n\t\t\t// display decimal places\n\t\t\tvar trimmedDifference = displayDecimalPlaces(difference);\n\t\t\t$('#result').append(trimmedDifference);\n\t\t\t// used for json\n\t\t\t$('#realDifference').append(difference);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// round up\n\t\t\t\t$('#result').append(parseInt(difference));\n\t\t\t\t// used for json\n\t\t\t\t$('#realDifference').append(difference);\n\t\t\t}\n\t}\n\t}\n}", "function renderScoreDifferenceLogic () {\n scoreDifferenceUpdateDelta++;\n \n if (scoreDifferenceUpdateDelta >= SI.res.ResourceLoader.getResources().game.properties.HUDScoreDifferenceUpdateMaxDelta) {\n scoreDifferenceUpdateDelta = 0;\n \n if (scoreDifferenceOpacity > 0.0) {\n var opacity;\n \n if (scoreDifferenceY > SI.res.ResourceLoader.getResources().game.properties.HUDScoreDifferenceEndY) {\n scoreDifferenceY -= SI.res.ResourceLoader.getResources().game.properties.HUDScoreDifferenceVerticalSpeed;\n \n if (scoreDifferenceY < SI.res.ResourceLoader.getResources().game.properties.HUDScoreDifferenceEndY) {\n scoreDifferenceY = SI.res.ResourceLoader.getResources().game.properties.HUDScoreDifferenceEndY;\n }\n \n opacity = scoreDifferenceOpacity + SI.res.ResourceLoader.getResources().game.properties.HUDScoreDifferenceOpacitySpeed;\n \n if (opacity > 1.0) {\n opacity = 1.0;\n }\n \n scoreDifferenceOpacity = opacity;\n } else {\n opacity = scoreDifferenceOpacity - SI.res.ResourceLoader.getResources().game.properties.HUDScoreDifferenceOpacitySpeed;\n \n if (opacity < 0.0) {\n opacity = 0.0;\n }\n \n scoreDifferenceOpacity = opacity;\n }\n }\n }\n }", "function diff(v1, v2) {\n return {\n x: v1.x - v2.x,\n y: v1.y - v2.y\n };\n}", "function showDiff(err, stats) {\n if (err) {\n console.error('Error getting stats: ' + err);\n return process.exit(1);\n }\n\n var lstats = stats[0],\n rstats = stats[1];\n\n Object.keys(lstats).forEach(function (id) {\n console.log('Diffing ' + id);\n console.dir(replicatorStatus.diff(rstats[id], lstats[id]));\n console.log('');\n });\n}", "function difference(a, b) {\n return Math.abs(a - b);\n }", "function diff(num1, num2) {\n\tconsole.log(\"2) \" + (num1 - num2));\n\n}", "function compareScenarioResults(\n result: ScenarioResult,\n previous: ScenarioResult\n): number {\n const error = Math.max(result.error, previous.error);\n const difference = (previous.time - result.time) * 100 / previous.time;\n\n if (Math.abs(difference) <= error) {\n return 0;\n }\n\n return difference;\n}", "function datediff(results){\n var created = results.created;\n var date = new Date();\n var a = moment(date);\n var b = moment(created);\n var diff = a.diff(b, 'years', true) //[days, years, months, seconds, ...]\n console.log('sadsad', diff); \n if (diff >=1){\n /*a = p(1+ r/100)^n*/\n var a = results.currentprice / results.price;\n var r = (Math.pow(a.toFixed(2), diff.toFixed(2)) * 100) - 100;\n console.log('cagr annual', r); \n results.annual = r;\n }\n else {\n var b = results.currentprice / results.price;\n console.log('das', b);\n var r = (Math.pow(b, diff * 12) * 1200) - 1200;\n console.log('cagr monthly', r);\n results.monthly = r;\n }\n return results;\n}", "function Diff() {}", "function Diff() {}", "function Diff() {}", "function Diff() {}", "function Diff() {}", "function Diff() {}", "function displayDiff(diff_results, user) {\n for (var i = 0; i < diff_results.length; i++) {\n var status = diff_results[i].status;\n var char = diff_results[i].char;\n var user = user;\n var add_char = \"\";\n if (status === \"+\") {\n add_char = \"<span class=\\\"added\" + user + \"\\\">\" + char + \"</span>\";\n if (user === 1) {\n $(\"#output1\").append(add_char);\n }\n else {\n $(\"#output2\").append(add_char);\n\n }\n }\n else if (status === \" \") {\n add_char = \"<span class=\\\"same\\\">\" + char + \"</span>\";\n if (user === 1) {\n $(\"#output1\").append(add_char);\n }\n else {\n $(\"#output2\").append(add_char);\n\n }\n }\n else if (status === '-') {\n add_char = \"<span class=\\\"deleted\" + user + \"\\\">\" + char + \"</span>\";\n if (user === 1) {\n $(\"#output1\").append(add_char);\n }\n else {\n $(\"#output2\").append(add_char);\n }\n }\n };\n\n\n}", "function showDiff(diff, textStatus, request) {\n if ((typeof diff === 'object') && (diff !== null)) {\n showDiffError(diff);\n return;\n }\n if (diff.length == 0) {\n var data = {\n 'code': 200,\n 'message': 'Diff is just white space'\n };\n showDiffError(data);\n return;\n }\n var content = $(diff);\n var height = $(window).height();\n var title = 'Diff';\n\n if (typeof request === 'object' && request !== null) {\n remainingDiffs = request.getResponseHeader('x-integrity-checker-diff-remain');\n if (remainingDiffs && remainingDiffs != '-1') {\n title = title + ' - ' + remainingDiffs + ' diff request(s) remaining';\n //title = title + ' <i class=\"fa fa-info-circle blue diff-quota-info\"></i>'\n }\n }\n\n content.dialog({\n dialogClass : 'wp-dialog',\n modal : true,\n closeOnEscape : true,\n width : $(window).width()*0.93,\n height : height*0.9,\n maxHeight : height*0.9,\n position : { my: \"top\", at: \"top\", of: $(window) },\n dialogClass : 'integrity-checker-filediff',\n buttons : {\n \"Close\": function () {\n $(this).dialog('close');\n }\n },\n 'close' : function() { content.remove(); }\n });\n\n $('.integrity-checker-filediff div span').html(title);\n var contentTop = $(content).offset().top;\n $('html, body').animate({scrollTop: contentTop - 50}, 100);\n }", "function compare(a,b){\n var x = a.totalDiff;\n var y = b.totalDiff;\n if (x < y) {return -1;}\n if (x > y) {return 1;}\n return 0;\n }", "function testDifference() {\n emptyBoxes();\n testCommon();\n $(\"#diffBox\").append(\"<h3>Test znamének diferencí</h3>\");\n\n // TEST ZNAMENEK DIFFERENCI\n var diffE = (n - 1) / 2;\n var diffD = (n + 1) / 12\n\n var diffC = 0;\n for(i = 0; i < n - 1; i++) {\n if (listNumbers[i + 1] > listNumbers[i]) {\n diffC += 1;\n }\n }\n\n var diffU = (diffC - diffE) / Math.sqrt(diffD);\n\n $(\"#diffBox\").append(\"$H_0:$ Posloupnost čísel je náhodná<br/>\");\n $(\"#diffBox\").append(\"$H_1:$ Posloupnost čísel není náhodná<br/><br/>\");\n $(\"#diffBox\").append(\"$n$ = \" + n + \"<br/>\");\n $(\"#diffBox\").append(\"$C$ = \" + diffC + \"<br/>\");\n $(\"#diffBox\").append(\"$E(C)$ = \" + diffE + \"<br/>\");\n $(\"#diffBox\").append(\"$D(C)$ = \" + diffD.toFixed(4) + \"<br/>\");\n $(\"#diffBox\").append(\"$u$ = \" + diffU.toFixed(4) + \"<br/><br/>\");\n\n var resultRejected = Math.abs(diffU) > u0975;\n if (resultRejected) {\n $(\"#diffBox\").append(\"$|u| > u_{1-{\\\\alpha / 2}}$<br/>\");\n $(\"#diffBox\").append(Math.abs(diffU).toFixed(4) + \" $>$ \" + u0975.toFixed(2) + \"<br/>\");\n $(\"#diffBox\").append(\"<span class='text-red'><b>Zamítá</b></span> se hypotéza o náhodnosti v uspořádání řady hodnot.\");\n } else {\n $(\"#diffBox\").append(\"$|u| \\\\leq u_{1-{\\\\alpha / 2}}$<br/>\");\n $(\"#diffBox\").append(Math.abs(diffU).toFixed(4) + \" $\\\\leq$ \" + u0975.toFixed(2) + \"<br/>\");\n $(\"#diffBox\").append(\"<span class='text-green'><b>Nezamítá</b></span> se hypotéza o náhodnosti v uspořádání řady hodnot.\");\n }\n\n refreshMathJax()\n}", "function diff(img1, img2) {\n return blend(img1, img2, function(a, b){\n var c = new Color();\n c.r = Math.abs(a.r - b.r);\n c.g = Math.abs(a.g - b.g);\n c.b = Math.abs(a.b - b.b);\n c.a = 255;\n return c;\n });\n}", "getDifference(other) {\n return {\n xDiff: other.x - this.x,\n yDiff: other.y - this.y,\n };\n }", "function ShowResult(difference, math, theme){\n\n switch (theme){\n case 'green':\n result.innerHTML = `Your current balance is ${difference}€/month <br>\n You are able to save ~${math}% of what you earn.`;\n break;\n \n case 'red':\n result.innerHTML = `Your current balance is ${difference}€/month! <br>\n You're spending ~${math}% over your monthly budget.`;\n break;\n\n }\n}", "function displayDifference(newID, oldID)\n{\n var itemDiff = compareItemsByID(newID, oldID);\n //console.log(itemDiff);\n\n for (var stat in itemDiff)\n {\n if (itemDiff.hasOwnProperty(stat))\n {\n var color = itemDiff[stat] > 0 ? 'green' : 'red';\n\n switch (stat)\n {\n //attack bonuses\n case \"stab-attack\":\n $('#stAtDiff').text(\"(\" + itemDiff[\"stab-attack\"] + \")\");\n $('#stAtDiff').css('color', color);\n $('#stAtDiff').css('position', 'absolute');\n $('#stAtDiff').animate({top: -100}, 3500, function(){\n $('#stAtDiff').text(\"\");\n $('#stAtDiff').css('top', 0);\n });\n break;\n case \"slash-attack\":\n $('#slAtDiff').text(\"(\" + itemDiff[\"slash-attack\"] + \")\");\n $('#slAtDiff').css('color', color);\n $('#slAtDiff').css('position', 'absolute');\n $('#slAtDiff').animate({top: -100}, 3500, function(){\n $('#slAtDiff').text(\"\");\n $('#slAtDiff').css('top', 0);\n });\n break;\n case \"crush-attack\":\n $('#cAtDiff').text(\"(\" + itemDiff[\"crush-attack\"] + \")\");\n $('#cAtDiff').css('color', color);\n $('#cAtDiff').css('position', 'absolute');\n $('#cAtDiff').animate({top: -100}, 3500, function(){\n $('#cAtDiff').text(\"\");\n $('#cAtDiff').css('top', 0);\n });\n break;\n case \"magic-attack\":\n $('#mAtDiff').text(\"(\" + itemDiff[\"magic-attack\"] + \")\");\n $('#mAtDiff').css('color', color);\n $('#mAtDiff').css('position', 'absolute');\n $('#mAtDiff').animate({top: -100}, 3500, function(){\n $('#mAtDiff').text(\"\");\n $('#mAtDiff').css('top', 0);\n });\n break;\n case \"ranged-attack\":\n $('#rAtDiff').text(\"(\" + itemDiff[\"ranged-attack\"] + \")\");\n $('#rAtDiff').css('color', color);\n $('#rAtDiff').css('position', 'absolute');\n $('#rAtDiff').animate({top: -100}, 3500, function(){\n $('#rAtDiff').text(\"\");\n $('#rAtDiff').css('top', 0);\n });\n break;\n\n //defence Bonuses\n\n case \"stab-defence\":\n $('#stDeDiff').text(\"(\" + itemDiff[\"stab-defence\"] + \")\");\n $('#stDeDiff').css('color', color);\n $('#stDeDiff').css('position', 'absolute');\n $('#stDeDiff').animate({top: -100}, 3500, function(){\n $('#stDeDiff').text(\"\");\n $('#stDeDiff').css('top', 0);\n });\n break;\n\n case \"slash-defence\":\n $('#slDeDiff').text(\"(\" + itemDiff[\"slash-defence\"] + \")\");\n $('#slDeDiff').css('color', color);\n $('#slDeDiff').css('position', 'absolute');\n $('#slDeDiff').animate({top: -100}, 3500, function(){\n $('#slDeDiff').text(\"\");\n $('#slDeDiff').css('top', 0);\n });\n break;\n\n case \"crush-defence\":\n $('#cDeDiff').text(\"(\" + itemDiff[\"crush-defence\"] + \")\");\n $('#cDeDiff').css('color', color);\n $('#cDeDiff').css('position', 'absolute');\n $('#cDeDiff').animate({top: -100}, 3500, function(){\n $('#cDeDiff').text(\"\");\n $('#cDeDiff').css('top', 0);\n });\n break;\n\n case \"magic-defence\":\n $('#mDeDiff').text(\"(\" + itemDiff[\"magic-defence\"] + \")\");\n $('#mDeDiff').css('color', color);\n $('#mDeDiff').css('width', 150);\n $('#mDeDiff').css('position', 'absolute');\n $('#mDeDiff').animate({top: -100}, 3500, function(){\n $('#mDeDiff').text(\"\");\n $('#mDeDiff').css('top', 0);\n });\n break;\n\n case \"ranged-defence\":\n $('#rDeDiff').text(\"(\" + itemDiff[\"ranged-defence\"] + \")\");\n $('#rDeDiff').css('color', color);\n $('#rDeDiff').css('position', 'absolute');\n $('#rDeDiff').animate({top: -100}, 3500, function(){\n $('#rDeDiff').text(\"\");\n $('#rDeDiff').css('top', 0);\n });\n break;\n }\n\n }\n }\n\n}", "function compare(a, b) {\n if (a.totalDifference < b.totalDifference) {\n return -1;\n }\n if (a.totalDifference > b.totalDifference) {\n return 1;\n }\n return 0;\n }", "function vdiff(img){\n var vvsubvh = img.select(['VV']).subtract(img.select(['VH'])).rename('VVsubVH')\n return img.addBands(vvsubvh);\n}", "function DiffResult(status, char, user) {\n this.status = status;\n this.char = char;\n this.user = user;\n}", "function subtracttest(v1, v2, expected) {\n results.total++;\n var r = calculator.subtraction(v1, v2);\n if (r !== expected) {\n results.bad++;\n console.log(\"Expected \" + expected +\n \", but was \" + r);\n }\n }", "function clearTheDifference() {\n\t$('#result').empty();\n\t// data for json\n\t$('#realDifference').empty();\n\t$('#result').append('Current difference: ');\n}", "function difference (num1, num2) {\r\n if (num1 > num2) {\r\n return num1 - num2\r\n } else {\r\n return num2 - num1\r\n }\r\n }", "function countResult(rate1, rate2) {\n let result =\n amount.val() + rate1.code + ' = ' +\n ((amount.val() * rate1.rate) / rate2.rate).toFixed(2) + rate2.code;\n //error message\n let error = 'Insert amount that is greater than 0!';\n\n //create a view for result\n if(amount.val() > 0) {\n let resultView = $('<span class=\"output--view\"></span>');\n resultView.text(result);\n output.empty();\n output.append(resultView);\n }\n //create a view for an error\n if(amount.val() == 0) {\n let resultError = $('<span class=\"output--amount-error\"></span>');\n resultError.text(error);\n output.empty();\n output.append(resultError);\n }\n }", "function getDiff(a, b) {\n const isBefore = a.isBefore(b)\n const later = isBefore ? b : a\n let earlier = isBefore ? a : b\n earlier = earlier.clone()\n const diff = {\n years: 0,\n months: 0,\n days: 0,\n hours: 0,\n minutes: 0,\n seconds: 0\n }\n Object.keys(diff).forEach((unit) => {\n if (earlier.isSame(later, unit)) {\n return\n }\n let max = earlier.diff(later, unit)\n earlier = earlier.add(max, unit)\n diff[unit] = max\n })\n //reverse it, if necessary\n if (isBefore) {\n Object.keys(diff).forEach((u) => {\n if (diff[u] !== 0) {\n diff[u] *= -1\n }\n })\n }\n return diff\n}", "function updateDifference() {\n // Adjust the base estimate vs adjusted estimate difference\n $scope.adjustedPercentage = (($scope.selectedEstimate - $scope.baseEstimate) / $scope.baseEstimate) * 100;\n }", "function difference(a, b){\n\t\treturn Math.max(a, b) - Math.min(a, b);\n\t}", "function differenceAccuracy(target, data1, data2) {\n\n\t}", "function displayFinalResult () {\n if (myResult > enemyResult) {\n const vs = document.getElementById('VS')\n vs.textContent = 'You won !'\n } else if (myResult < enemyResult) {\n const vs2 = document.getElementById('VS')\n vs2.textContent = 'You lost...'\n } else {\n const vs3 = document.getElementById('VS')\n vs3.textContent = 'DRAW'\n }\n}", "function f12() {\r\n\t\tif ((WO_Difference > 30) || (WO_Difference < 0)) {\r\n\t\t\treturn{\r\n\t\t\t\t\"innerHTML\":\"Either/Both Failure\",\r\n\t\t\t\t\"className\":\"text-danger\"\r\n\t\t\t};\r\n\t\t} else {\r\n\t\t\treturn{\r\n\t\t\t\t\"innerHTML\":\"Healthy\",\r\n\t\t\t\t\"className\":\"text-success\"\r\n\t\t\t};\r\n\t\t}\r\n\t}", "function percentDiff(a, b) {\n let divideBy = (a > b) ? a : b;\n return Math.abs(a - b) / divideBy * 100;\n }", "function diffByUnit(a,b,unit){return moment.duration(Math.round(a.diff(b,unit,true)),// returnFloat=true\nunit);}", "function diffSubtract(date1, date2) {\n\treturn date2 - date1;\n}", "function showDiff(acediff, editor, startLine, endLine, className) {\n var editor = acediff.editors[editor];\n\n if (endLine < startLine) { // can this occur? Just in case.\n endLine = startLine;\n }\n\n var classNames = className + ' ' + ((endLine > startLine) ? 'lines' : 'targetOnly');\n endLine--; // because endLine is always + 1\n\n // to get Ace to highlight the full row we just set the start and end chars to 0 and 1\n editor.markers.push(editor.ace.session.addMarker(new Range(startLine, 0, endLine, 1), classNames, 'fullLine'));\n }", "function diff(a, b, opts) {\n var defaults = {\n emptyHuman: ' '\n };\n var aopts = extend(opts.hexOpts, defaults);\n var bopts = extend(opts.hexOpts, defaults);\n\n if (opts.colored) {\n extendInto(aopts, render.coloredOptions);\n extendInto(bopts, render.coloredOptions);\n opts.decorateDivide = coloredDivide;\n opts.decorateDiffA = coloredDiffA;\n opts.decorateDiffB = coloredDiffB;\n }\n\n if (opts.decorateDiffA) {\n aopts.decorateHexen = highlightA;\n aopts.decorateHuman = highlightA;\n }\n\n if (opts.decorateDiffB) {\n bopts.decorateHexen = highlightB;\n bopts.decorateHuman = highlightB;\n }\n\n var adump = hex(a, aopts).split('\\n');\n var bdump = hex(b, bopts).split('\\n');\n\n return adump.map(function each(aline, i) {\n var bline = bdump[i];\n var differs = aline !== bline;\n var sep = differs ? '|' : ' ';\n if (opts.decorateDivide) {\n sep = opts.decorateDivide(sep, differs);\n }\n return aline + ' ' + sep + ' ' + bline;\n }).join('\\n');\n\n function highlightA(i, j, str) {\n if (a[i] !== b[i]) {\n str = opts.decorateDiffA(render.stripColor(str));\n }\n return str;\n }\n\n function highlightB(i, j, str) {\n if (a[i] !== b[i]) {\n str = opts.decorateDiffB(render.stripColor(str));\n }\n return str;\n }\n}", "function subtractionFunction () {\n var input1 = parseInt(document.getElementById(\"userInput1\").value);\n var input2 = parseInt(document.getElementById(\"userInput2\").value);\n var subtracted = input1 - input2;\n console.log(\"User Input1 = \", input1);\n console.log(\"User Input2 = \", input2);\n console.log(\"input1 - input2 =\", subtracted);\n resultsDiv.innerHTML = `${subtracted}`\n return subtracted;\n}", "function diff_v2(v1, v2) { return [v1[0] - v2[0], v1[1] - v2[1]]; }", "function difference(num1, num2) {\n return num1 - num2;\n}", "difference(a, b) {\n return Math.abs(a - b) % 360\n }", "function showCompareCount(){\n if(srvObj.count > 1){\n $('#compareCounter').show().text(srvObj.count);\n }else{\n $('#compareCounter').hide();\n }\n}", "function verifDifference() {\n\n\tvar du = parseFloat ( document.getElementById('frmDifference').txtDu.value );\n\tvar encaisse = parseFloat ( document.getElementById('frmDifference').txtEncaisse.value );\n\n\tif (encaisse > du) {\n\n\t\tresultat = Math.round ( (encaisse - du) * 100 ) / 100;\n\t\tdocument.getElementById('frmDifference').txtRendu.value = resultat.toFixed(2);\n\n\t} else if (encaisse == du) {\n\n\t\tdocument.getElementById('frmDifference').txtRendu.value = '0';\n\n\t} else {\n\n\t\tdocument.getElementById('frmDifference').txtRendu.value = '-';\n\n\t}\n\n}", "function compareResultScores(result1, result2) {\n return result2.score - result1.score;\n}", "function countDesc(a,b) {\n return b.value - a.value;\n}", "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}", "function isDiff(a1, a2) {\n if (a1.length != a2.length) return true;\n\n var i1 = _.map(a1, function(d) {return d.index; });\n var i2 = _.map(a2, function(d) {return d.index; });\n var d = _.difference(i1, i2);\n return d.length > 0;\n }", "function\nannotate_result(p1, p2)\n{\n\tif (!isusersymbol(p1))\n\t\treturn 0;\n\n\tif (p1 == p2)\n\t\treturn 0; // A = A\n\n\tif (p1 == symbol(I_LOWER) && isimaginaryunit(p2))\n\t\treturn 0;\n\n\tif (p1 == symbol(J_LOWER) && isimaginaryunit(p2))\n\t\treturn 0;\n\n\treturn 1;\n}", "static _compareOutputs(o1, o2) {\n \n // compare by height\n let heightComparison = MoneroWalletRpc._compareTxsByHeight(o1.getTx(), o2.getTx());\n if (heightComparison !== 0) return heightComparison;\n \n // compare by account index, subaddress index, and output\n if (o1.getAccountIndex() < o2.getAccountIndex()) return -1;\n else if (o1.getAccountIndex() === o2.getAccountIndex()) {\n let compare = o1.getSubaddressIndex() - o2.getSubaddressIndex();\n if (compare !== 0) return compare;\n return o1.getIndex() - o2.getIndex();\n }\n return 1;\n }", "function getRepDemDiff(req, res) {\n const q = `\n WITH ElectionTable AS (\n ` + util.getTable(req, 'election', req.query.year) + `\n ), TotalVotes AS (\n SELECT FIPS, SUM(CANDIDATE_VOTES) AS Total\n FROM ElectionTable\n GROUP BY FIPS\n ), RepVotes AS (\n SELECT FIPS, CANDIDATE_VOTES AS Rep\n FROM ElectionTable NATURAL JOIN Candidate\n WHERE PARTY = 'Republican'\n ), DemVotes AS (\n SELECT FIPS, CANDIDATE_VOTES AS Dem\n FROM ElectionTable NATURAL JOIN Candidate\n WHERE PARTY = 'Democrat'\n ), Result AS (\n SELECT FIPS, (((Rep - Dem) / Total) * 100) AS Z\n FROM TotalVotes NATURAL JOIN RepVotes NATURAL JOIN DemVotes\n ), Filter AS (\n ` + util.getFilterQuery(req) +\n `\n ), Filtered AS (\n SELECT * FROM Result NATURAL JOIN Filter\n )\n ` + util.getLevel(req);\n execQuery(q, res);\n}", "function subtractNumbers() {\r\n const result = document.getElementById(\"addResult\");\r\n\r\n //Calculating Subtraction\r\n const minusResult = parseInt(num1.value - num2.value);\r\n console.log(minusResult);\r\n if (isFinite(minusResult)) {\r\n result.value = minusResult;\r\n // Hide results\r\n document.getElementById(\"result\").style.display = \"block\";\r\n\r\n // Show LOader\r\n document.getElementById(\"loading\").style.display = \"none\";\r\n } else {\r\n showError(\"Please check your Numbers..\");\r\n }\r\n}", "calcAdjacentDiff() {\n this._adjacentDiff = 0;\n this._adjacentDiffStyleLeft = '';\n this._adjacentDiffStyleRight = '';\n this._adjacentDiffStyleTop = '';\n this._adjacentDiffStyleBottom = '';\n\n let top = Province.tryGet(this.row - 1, this.col);\n let bottom = Province.tryGet(this.row + 1, this.col);\n let left = Province.tryGet(this.row, this.col - 1);\n let right = Province.tryGet(this.row, this.col + 1);\n\n if (top && top.owner != this.owner) {\n this._adjacentDiff++;\n this._adjacentDiffStyleTop = '4px solid white';\n }\n if (right && right.owner != this.owner) {\n this._adjacentDiff++;\n this._adjacentDiffStyleRight = '4px solid white';\n }\n if (bottom && bottom.owner != this.owner) {\n this._adjacentDiff++;\n this._adjacentDiffStyleBottom = '4px solid white';\n }\n if (left && left.owner != this.owner) {\n this._adjacentDiff++;\n this._adjacentDiffStyleLeft = '4px solid white';\n }\n }", "function subOutput (firstValue,secondValue) {\n var output = parseInt(firstValue) - parseInt(secondValue);\n document.getElementById(\"answer\").innerHTML = output\n return output;\n}", "function drawResult(isSeated) {\n var div = document.getElementById(\"seated\");\n div.classList.value = isSeated ? successClass : failedClass;\n div.textContent = isSeated ? successContent : failedContent;\n\n drawChart();\n}", "function subtract(num1, num2) {\n return \"Subtracting Number 1 (\" + num1 + \") and Number 2 (\" + num2 + \") results in : \" +(num1 - num2); \n}", "xpDiff (swapSkater) {\n let skaterOverall = this.props.selectedSkater.edges + this.props.selectedSkater.jumps + this.props.selectedSkater.form + this.props.selectedSkater.presentation;\n let swapSkaterOverall = swapSkater.edges + swapSkater.jumps + swapSkater.form + swapSkater.presentation;\n return swapSkaterOverall - skaterOverall;\n }", "function updateResults() {\n const exprVal = $('#expr').val().trim();\n if (exprVal === \"\") {\n $('#errors').addClass(\"hidden\");\n $('#didYouMeanDiv').addClass(\"hidden\");\n $('#results').addClass(\"hidden\");\n return;\n }\n try {\n $('#errors').addClass(\"hidden\");\n $('#didYouMeanDiv').addClass(\"hidden\");\n $('#results').removeClass(\"hidden\");\n const [typeStr, rows, scaleWorkshopData] = getResults();\n if (res.symbolType === \"color\") {\n const s = exprVal.replace(\"descending\", \"desc.\");\n const ref = res.type == \"interval\" ? microtonal_utils.colorSymb(res.intv, {useExps: 1})\n : microtonal_utils.colorNote(res.intvToRef.mul(res.ref.intvToA4), {useExps: 1});\n if (s != ref) {\n $('#didYouMeanDiv').removeClass(\"hidden\");\n const refHTML = res.type == \"interval\" ? microtonal_utils.colorSymb(res.intv, {useHTMLExps: 1})\n : microtonal_utils.colorNote(res.intvToRef.mul(res.ref.intvToA4), {useHTMLExps: 1});\n if (ref != refHTML) {\n $('#didYouMeanDiv').addClass(\"hoverSwap\");\n $('#didYouMean').html($('<span>').addClass(\"hoverSwap_off\")\n .html(fmtExtExprLink(refHTML, ref).addClass(\"alt2\")));\n $('#didYouMean').append($('<span>').addClass(\"hoverSwap_on\")\n .html(fmtExtExprLink(ref).addClass(\"alt2\")));\n }\n else {\n $('#didYouMeanDiv').removeClass(\"hoverSwap\");\n $('#didYouMean').html(fmtExtExprLink(ref).addClass(\"alt2\"));\n }\n }\n }\n else if (res.symbolType === \"color (verbose)\" && res.type == \"interval\") {\n const s = exprVal.replace(\"desc.\", \"descending\")\n .replace(\"unison\", \"1sn\")\n .replace(\"octave\", \"8ve\");\n const ref = microtonal_utils.colorSymb(res.intv, {verbosity: 1});\n if (s != ref) {\n $('#didYouMeanDiv').removeClass(\"hidden\");\n $('#didYouMean').html(fmtExtExprLink(ref).addClass(\"alt2\"));\n }\n }\n else if (res.symbolType == \"Pythagorean (verbose)\" && res.type == \"interval\") {\n const s = exprVal.replace(\"desc.\", \"descending\")\n .replace(\"unison\", \"1sn\")\n .replace(\"octave\", \"8ve\");\n const ref = microtonal_utils.pySymb(res.intv, {verbosity: 1});\n if (s != ref) {\n $('#didYouMeanDiv').removeClass(\"hidden\");\n $('#didYouMean').html(fmtExtExprLink(ref).addClass(\"alt2\"));\n }\n }\n else if (res.symbolType == \"ups-and-downs\" && res.type == \"interval\") {\n const [sD,edo] = exprVal.replace(\"descending\", \"desc.\")\n .split(\"\\\\\").map(s => s.trim());\n const sDs = sD.split(\"desc. \");\n const [isDesc, s] = sDs.length == 1 ? [false, sDs[0]] : [true, sDs[1]];\n const pRes = microtonal_utils.parseFromRule(s, \"upsDnsIntvAb\")[0];\n const pyi = pRes[0] == \"!updnsSymb\" && pRes[2][0] != \"!perfPyIntv\"\n ? microtonal_utils.evalExpr(pRes[2], microtonal_utils.Interval(1)).val\n : microtonal_utils.pyInterval(pRes[2][1] || pRes[2], 0);\n const usePerfEDONotation = edo % 7 == 0 && ((pRes[0] == \"!updnsSymb\" && pRes[2][0] == \"!perfPyIntv\")\n || pRes[0] == \"!updnsPerfSymb\");\n const ref = (isDesc ? \"desc. \" : \"\") +\n microtonal_utils.fmtUpdnsSymb(pRes[1], pyi, {usePerfEDONotation: usePerfEDONotation});\n if (sD != ref) {\n $('#didYouMeanDiv').removeClass(\"hidden\");\n $('#didYouMean').html(fmtExtExprLink(ref + \"\\\\\" + edo).addClass(\"alt2\"));\n }\n }\n else if (res.symbolType == \"ups-and-downs (verbose)\" && res.type == \"interval\") {\n let [sD,edo] = exprVal.replace(\"desc.\", \"descending\")\n .replace(\"unison\", \"1sn\")\n .replace(\"octave\", \"8ve\")\n .split(\"\\\\\").map(s => s.trim());\n const sDs = sD.split(\"descending \");\n const [isDesc, s] = sDs.length == 1 ? [false, sDs[0]] : [true, sDs[1]];\n const pRes = microtonal_utils.parseFromRule(s, \"upsDnsIntvVb\")[0];\n const pyi = pRes[0] == \"!updnsSymb\" && pRes[2][0] != \"!perfPyIntv\"\n ? microtonal_utils.evalExpr(pRes[2], microtonal_utils.Interval(1)).val\n : microtonal_utils.pyInterval(pRes[2][1] || pRes[2], 0);\n const usePerfEDONotation = edo % 7 == 0 && ((pRes[0] == \"!updnsSymb\" && pRes[2][0] == \"!perfPyIntv\")\n || pRes[0] == \"!updnsPerfSymb\");\n const ref = (isDesc ? \"descending \" : \"\") +\n microtonal_utils.fmtUpdnsSymb(pRes[1], pyi, {verbosity: 1, usePerfEDONotation: usePerfEDONotation});\n // we won't correct you if you say \"neutral\" instead of \"mid\" if there are no ups or downs\n if (pRes[1] == 0) { sD = sD.replace(\"neutral\", \"mid\"); }\n // we won't correct you for omitting \"perfect\" in a perfect EDO\n if (sD != ref && (edo % 7 != 0 || pRes[0] != \"!updnsPerfSymb\" || sD != ref.replace(\"perfect \", \"\"))) {\n $('#didYouMeanDiv').removeClass(\"hidden\");\n $('#didYouMean').html(fmtExtExprLink(ref + \" \\\\ \" + edo).addClass(\"alt2\"));\n }\n }\n $('#resHeader').html(typeStr + \" results\");\n $('#resTable').empty();\n for (const [n,v] of rows) {\n let row = $('<tr>');\n row.append($('<td>').addClass(\"resLeftColumn\").html(n ? n + \":\" : n));\n if (v && (v.hoverSwap_off || v.hoverSwap_on)) {\n row.addClass(\"hoverSwap\");\n const cell = $('<td>').addClass(\"resRightColumn\");\n cell.append($('<span>').addClass('hoverSwap_off').html(v.hoverSwap_off || \"\"));\n cell.append($('<span>').addClass('hoverSwap_on').html(v.hoverSwap_on || \"\"));\n row.append(cell);\n }\n else {\n row.append($('<td>').addClass(\"resRightColumn\").html(v));\n }\n $('#resTable').append(row);\n }\n addXenWikiLink();\n $('#resAudioHeader').html(typeStr + \" audio\");\n let scaleWorkshopLink = \"http://sevish.com/scaleworkshop/\";\n scaleWorkshopLink += \"?waveform=sine&ampenv=perc-medium\";\n scaleWorkshopLink += \"&data=\" + scaleWorkshopData;\n if (res.type == \"EDO\") {\n $('#resAudio').addClass(\"hidden\");\n $('#resApproxs').addClass(\"hidden\");\n $('#resEDO').removeClass(\"hidden\");\n const baseHertz = updateEDOResults();\n scaleWorkshopLink += \"&freq=\" + baseHertz;\n $('#edoScaleWorkshopLink').attr(\"href\", scaleWorkshopLink);\n }\n else if (res.type === \"interval\") {\n $('#intervalAudioButtons').removeClass(\"hidden\");\n $('#noteAudioButtons').addClass(\"hidden\");\n $('#resAudio').removeClass(\"hidden\");\n $('#resApproxs').removeClass(\"hidden\");\n $('#resEDO').addClass(\"hidden\");\n updateRatApproxs();\n updateEDOApproxs();\n scaleWorkshopLink += \"&freq=\" + res.ref.hertz;\n $('#scaleWorkshopLink').attr(\"href\", scaleWorkshopLink);\n }\n else {\n $('#intervalAudioButtons').addClass(\"hidden\");\n $('#noteAudioButtons').removeClass(\"hidden\");\n $('#resAudio').removeClass(\"hidden\");\n $('#resApproxs').addClass(\"hidden\");\n $('#resEDO').addClass(\"hidden\");\n scaleWorkshopLink += \"&freq=\" + res.ref.hertz;\n $('#scaleWorkshopLink').attr(\"href\", scaleWorkshopLink);\n }\n }\n catch (err) {\n const showAddMulTip = err.kind == \"Parse error\" &&\n \"*/^+-xc\".indexOf(err.srcStr[err.offset]) > -1;\n if (err.kind == undefined) {\n newErr = new Error(err.name + (err.message ? \"\\n\" + err.message : \"\"));\n newErr.stack = err.stack;\n err = newErr;\n console.error(err);\n logStrs([\"e u \" + err.name]);\n }\n else {\n logStrs([\"e l \" + (showAddMulTip ? \"add/mul \" : \"\") + err.kind]);\n }\n $('#errors').removeClass(\"hidden\");\n $('#didYouMeanDiv').addClass(\"hidden\");\n $('#results').addClass(\"hidden\");\n const errStr = err.toString().replace(\"\\n\",\"<br>\").replace(\"\\\\\\\\\",\"\\\\\");\n $('#errors').html($('<pre>').addClass(\"parseError\").html(errStr));\n if (showAddMulTip) {\n let nb = $('<p>').attr(\"style\", \"font-size: 95%; text-align: left;\");\n nb.append(\"Perhaps you're trying to mix multiplicative and additive \"\n + \"expressions? See \");\n nb.append($('<a>').addClass(\"alt\").attr(\"href\", \"about.html#tipMulAddExprs\")\n .html(\"this tip\"));\n nb.append(\".\");\n $('#errors').append(nb);\n }\n }\n}", "function showRiseOverRun() {\n // draw rise and run lines\n if (riseRunDisplay && pt1.pinned && pt2.pinned && plane.getContext) {\n drawRiseRunLines();\n // change slope label to demonstrate rise/run slope calculation\n let rise = (pt2.y - pt1.y).toFixed(2);\n let run = (pt2.x - pt1.x).toFixed(2);\n let html = 'm=<span class=\"riseRun\">'\n + rise + '</span>/<span class=\"riseRun\">' + run + '</span>';\n if (document.getElementById(\"slopeLabel\").innerHTML != html) {\n document.getElementById(\"slopeLabel\").innerHTML = html;\n }\n // display labels for rise and run\n }\n}", "function delta(a, b) {\r\n return a - b;\r\n}", "function displayIndicators() {\n // Indicator formulas\n var totalPopInd = upgrade.ship.number * upgrade.ship.rate;\n var redCoatInd = (((population.colonist.number * population.colonist.rate) - event.FIW.fundRate) + (((population.colonist.number * population.colonist.rate) - event.FIW.fundRate) / 10) + (upgrade.military.warShipGB.number * upgrade.military.warShipGB.rate)) * upgrade.military.allies.nativeAmerican.multiplier;\n var SDInd = (population.merchant.rate2 * population.merchant.mult2 * (1 - taxRate));\n var CNInd = currency.colonialNotes.rate;\n var goodsInd0 = (((population.colonist.number * population.colonist.rate) + ((population.slave.number / population.slave.increment) * population.slave.rate)) - (population.merchant.rate1 * population.merchant.mult1));\n var goodsInd1 = (((population.slave.number / population.slave.increment) * population.slave.rate) - (population.merchant.rate1 * population.merchant.mult1));\n var silverInd1 = (population.colonist.number * population.colonist.rate) - event.FIW.fundRate;\n var silverInd2 = population.colonist.number * population.colonist.rate;\n var goldInd1 = (population.colonist.number * population.colonist.rate) - event.FIW.fundRate;\n var goldInd2 = population.colonist.number * population.colonist.rate;\n \n // Population indicators\n if ((totalPopInd > 0) && (periodCount !== 3)) {\n document.getElementById(\"popInd\").innerHTML = \"(+\" + totalPopInd + \")\";\n $(\"#popInd\").removeClass(\"negative\").addClass(\"positive\");\n }\n if (document.getElementById(\"redCoatDiv\") !== null) {\n if (redCoatInd > 0) {\n document.getElementById(\"redCoatInd\").innerHTML = \"(+\" + numFormat(redCoatInd) + \")\";\n $(\"#redCoatInd\").removeClass(\"negative\").addClass(\"positive\");\n }\n else if (redCoatInd < 0) {\n document.getElementById(\"redCoatInd\").innerHTML = \"(\" + numFormat(redCoatInd) + \")\";\n $(\"#redCoatInd\").removeClass(\"positive\").addClass(\"negative\");\n }\n else {\n document.getElementById(\"redCoatInd\").innerHTML = \"(\" + numFormat(redCoatInd) + \")\";\n $(\"#redCoatInd\").removeClass(\"positive\").removeClass(\"negative\");\n }\n }\n \n // Currency indicators\n if (document.getElementById(\"SDDiv\") !== null) {\n if (SDInd > 0) {\n document.getElementById(\"SDInd\").innerHTML = \"(+\" + numFormat(SDInd) + \")\";\n $(\"#SDInd\").removeClass(\"negative\").addClass(\"positive\");\n }\n else if (SDInd < 0) {\n document.getElementById(\"SDInd\").innerHTML = \"(\" + numFormat(SDInd) + \")\";\n $(\"#SDInd\").removeClass(\"positive\").addClass(\"negative\");\n }\n else {\n document.getElementById(\"SDInd\").innerHTML = \"(\" + numFormat(SDInd) + \")\";\n $(\"#SDInd\").removeClass(\"positive\").removeClass(\"negative\");\n }\n }\n \n if (document.getElementById(\"CNDiv\") !== null) {\n if (CNInd > 0) {\n document.getElementById(\"CNInd\").innerHTML = \"(+\" + CNInd.toLocaleString() + \")\";\n $(\"#CNInd\").removeClass(\"negative\").addClass(\"positive\");\n }\n else if (CNInd < 0) {\n document.getElementById(\"CNInd\").innerHTML = \"(\" + CNInd.toLocaleString() + \")\";\n $(\"#CNInd\").removeClass(\"positive\").addClass(\"negative\");\n }\n else {\n document.getElementById(\"CNInd\").innerHTML = \"(\" + CNInd.toLocaleString() + \")\";\n $(\"#CNInd\").removeClass(\"positive\").removeClass(\"negative\");\n }\n }\n \n // Goods indicator\n if (periodCount === 0) {\n if (goodsInd0 > 0) {\n document.getElementById(\"goodsInd\").innerHTML = \"(+\" + numFormat(goodsInd0) + \")\";\n $(\"#goodsInd\").removeClass(\"negative\").addClass(\"positive\");\n }\n else if (goodsInd0 < 0) {\n document.getElementById(\"goodsInd\").innerHTML = \"(\" + numFormat(goodsInd0) + \")\";\n $(\"#goodsInd\").removeClass(\"positive\").addClass(\"negative\");\n }\n else {\n document.getElementById(\"goodsInd\").innerHTML = \"(\" + numFormat(goodsInd0) + \")\";\n $(\"#goodsInd\").removeClass(\"positive\").removeClass(\"negative\");\n }\n }\n else if ((periodCount > 0) && (periodCount !== 3)) {\n if (goodsInd1 > 0) {\n document.getElementById(\"goodsInd\").innerHTML = \"(+\" + numFormat(goodsInd1) + \")\";\n $(\"#goodsInd\").removeClass(\"negative\").addClass(\"positive\");\n }\n else if (goodsInd1 < 0) {\n document.getElementById(\"goodsInd\").innerHTML = \"(\" + numFormat(goodsInd1) + \")\";\n $(\"#goodsInd\").removeClass(\"positive\").addClass(\"negative\");\n }\n else {\n document.getElementById(\"goodsInd\").innerHTML = \"(\" + numFormat(goodsInd1) + \")\";\n $(\"#goodsInd\").removeClass(\"positive\").removeClass(\"negative\");\n }\n }\n \n // Silver indicator\n if (periodCount > 0) {\n if (document.getElementById(\"FIW\") !== null) {\n if (silverInd1 > 0) {\n document.getElementById(\"silverInd\").innerHTML = \"(+\" + numFormat(silverInd1) + \")\";\n $(\"#silverInd\").removeClass(\"negative\").addClass(\"positive\");\n }\n else if (silverInd1 < 0) {\n document.getElementById(\"silverInd\").innerHTML = \"(\" + numFormat(silverInd1) + \")\";\n $(\"#silverInd\").removeClass(\"positive\").addClass(\"negative\");\n }\n else {\n document.getElementById(\"silverInd\").innerHTML = \"(\" + numFormat(silverInd1) + \")\";\n $(\"#silverInd\").removeClass(\"positive\").removeClass(\"negative\");\n }\n }\n else if (periodCount !== 3) {\n if (silverInd2 > 0) {\n document.getElementById(\"silverInd\").innerHTML = \"(+\" + numFormat(silverInd2) + \")\";\n $(\"#silverInd\").removeClass(\"negative\").addClass(\"positive\");\n }\n else if (silverInd2 < 0) {\n document.getElementById(\"silverInd\").innerHTML = \"(\" + numFormat(silverInd2) + \")\";\n $(\"#silverInd\").removeClass(\"positive\").addClass(\"negative\");\n }\n else {\n document.getElementById(\"silverInd\").innerHTML = \"(\" + numFormat(silverInd2) + \")\";\n $(\"#silverInd\").removeClass(\"positive\").removeClass(\"negative\");\n }\n }\n } \n \n // Gold indicator\n if (periodCount > 0) {\n if (document.getElementById(\"FIW\") !== null) {\n if (goldInd1 > 0) {\n document.getElementById(\"goldInd\").innerHTML = \"(+\" + numFormat(goldInd1) + \")\";\n $(\"#goldInd\").removeClass(\"negative\").addClass(\"positive\");\n }\n else if (goldInd1 < 0) {\n document.getElementById(\"goldInd\").innerHTML = \"(\" + numFormat(goldInd1) + \")\";\n $(\"#goldInd\").removeClass(\"positive\").addClass(\"negative\");\n }\n else {\n document.getElementById(\"goldInd\").innerHTML = \"(\" + numFormat(goldInd1) + \")\";\n $(\"#goldInd\").removeClass(\"positive\").removeClass(\"negative\");\n }\n }\n else if (periodCount !== 3) {\n if (goldInd2 > 0) {\n document.getElementById(\"goldInd\").innerHTML = \"(+\" + numFormat(goldInd2) + \")\";\n $(\"#goldInd\").removeClass(\"negative\").addClass(\"positive\");\n }\n else if (goldInd2 < 0) {\n document.getElementById(\"goldInd\").innerHTML = \"(\" + numFormat(goldInd2) + \")\";\n $(\"#goldInd\").removeClass(\"positive\").addClass(\"negative\");\n }\n else {\n document.getElementById(\"goldInd\").innerHTML = \"(\" + numFormat(goldInd2) + \")\";\n $(\"#goldInd\").removeClass(\"positive\").removeClass(\"negative\");\n }\n }\n }\n}", "function subtract (num1, num2) {\n answer.innerHTML = num1 - num2;\n}", "function computeMarkerDiffSeverity(d0, d1, ca) {\n if (ca.getMarkerYear(d0) !== ca.getMarkerYear(d1)) {\n return 5;\n }\n\n if (ca.getMarkerMonth(d0) !== ca.getMarkerMonth(d1)) {\n return 4;\n }\n\n if (ca.getMarkerDay(d0) !== ca.getMarkerDay(d1)) {\n return 2;\n }\n\n if (marker_1.timeAsMs(d0) !== marker_1.timeAsMs(d1)) {\n return 1;\n }\n\n return 0;\n }", "function diffByUnit(a, b, unit) {\n return moment.duration(\n Math.round(a.diff(b, unit, true)), // returnFloat=true\n unit\n );\n }", "getDiff(start, end, mode) {\n\t\treturn end.diff(start, mode);\n\t}", "function diffText (previous, current, el) {\n if (current.data !== previous.data) el.data = current.data\n return el\n }", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function _VirtualDom_diff(x, y)\n{\n\tvar patches = [];\n\t_VirtualDom_diffHelp(x, y, patches, 0);\n\treturn patches;\n}", "function difference(a, b) {\n // console.log(Math.abs(a - b))\n a = parseInt(a)\n b = parseInt(b)\n return Math.abs(a - b);\n}", "function calcular_resta() {\n var num1 , num2;\n num1=document.getElementsByName(\"res_num1\")[0].value;\n num2=document.getElementsByName(\"res_num2\")[0].value;\n document.getElementsByName(\"res_total\")[0].innerHTML=(Number(num1)-Number(num2));\n}", "function get_tr_diff_us (tr1, tr2)\n{\n\tvar diff;\n\n\tif (tr1.sample > tr2.sample)\n\t{\n\t\tdiff = (((tr1.sample - tr2.sample) * 1000000) / sample_rate);\n\t}\n\telse\n\t{\n\t\tdiff = (((tr2.sample - tr1.sample) * 1000000) / sample_rate);\n\t}\n\n\treturn diff\n}", "function diff(elem) {\n let currentScore = elem.children[2].innerHTML;\n currentScore = Number.parseInt(currentScore);\n let par = elem.children[1].innerHTML;\n par = Number.parseInt(par);\n elem.children[3].innerHTML = currentScore - par;\n}", "function diff(a, b) {\n if (a == null || b == null || isNaN(a) || isNaN(b))\n return undefined;\n else if (a<b)\n return undefined; // int rolled over, ignore the value\n else\n return a - b;\n}", "function diffByUnit(a, b, unit) {\n\t\treturn moment.duration(\n\t\t\tMath.round(a.diff(b, unit, true)), // returnFloat=true\n\t\t\tunit\n\t\t);\n\t}", "function computeMarkerDiffSeverity(d0, d1, ca) {\n if (ca.getMarkerYear(d0) !== ca.getMarkerYear(d1)) {\n return 5;\n }\n\n if (ca.getMarkerMonth(d0) !== ca.getMarkerMonth(d1)) {\n return 4;\n }\n\n if (ca.getMarkerDay(d0) !== ca.getMarkerDay(d1)) {\n return 2;\n }\n\n if (timeAsMs(d0) !== timeAsMs(d1)) {\n return 1;\n }\n\n return 0;\n }", "get Diffuse() {}", "function diffByUnit(a, b, unit) {\n\treturn moment.duration(\n\t\tMath.round(a.diff(b, unit, true)), // returnFloat=true\n\t\tunit\n\t);\n}", "function diffByUnit(a, b, unit) {\n\treturn moment.duration(\n\t\tMath.round(a.diff(b, unit, true)), // returnFloat=true\n\t\tunit\n\t);\n}", "function diffByUnit(a, b, unit) {\n\treturn moment.duration(\n\t\tMath.round(a.diff(b, unit, true)), // returnFloat=true\n\t\tunit\n\t);\n}", "function diffByUnit(a, b, unit) {\n\treturn moment.duration(\n\t\tMath.round(a.diff(b, unit, true)), // returnFloat=true\n\t\tunit\n\t);\n}", "function diffByUnit(a, b, unit) {\n\treturn moment.duration(\n\t\tMath.round(a.diff(b, unit, true)), // returnFloat=true\n\t\tunit\n\t);\n}", "function diffByUnit(a, b, unit) {\n\treturn moment.duration(\n\t\tMath.round(a.diff(b, unit, true)), // returnFloat=true\n\t\tunit\n\t);\n}", "function diffByUnit(a, b, unit) {\n\treturn moment.duration(\n\t\tMath.round(a.diff(b, unit, true)), // returnFloat=true\n\t\tunit\n\t);\n}" ]
[ "0.6146608", "0.60133755", "0.5944041", "0.5884003", "0.5822823", "0.5772532", "0.5735793", "0.5732453", "0.56814563", "0.5656507", "0.5656507", "0.5656507", "0.5656507", "0.5656507", "0.5656507", "0.56245327", "0.5588091", "0.54990417", "0.5477331", "0.54626036", "0.5457383", "0.54564536", "0.54408836", "0.5400927", "0.5397836", "0.53897935", "0.5377643", "0.52956146", "0.5284818", "0.52719474", "0.52397746", "0.522652", "0.5214267", "0.51862544", "0.5177702", "0.5176328", "0.5174766", "0.51685303", "0.5164636", "0.51623964", "0.51620835", "0.5145791", "0.51392365", "0.51375186", "0.51114976", "0.5108013", "0.5095244", "0.5088531", "0.5085443", "0.5084793", "0.50794286", "0.5078559", "0.5066027", "0.50641704", "0.5051756", "0.50479895", "0.5041923", "0.50248766", "0.50243556", "0.5004915", "0.49901563", "0.49874213", "0.4985937", "0.49857953", "0.4984006", "0.4980455", "0.4978868", "0.4966108", "0.49653774", "0.49639675", "0.49639675", "0.49639675", "0.49639675", "0.49639675", "0.49639675", "0.49639675", "0.49639675", "0.49639675", "0.49639675", "0.49639675", "0.49639675", "0.49639675", "0.49639675", "0.49639675", "0.49639675", "0.49597788", "0.4951836", "0.49503648", "0.49469998", "0.4946863", "0.49442834", "0.49398667", "0.49358398", "0.49311656", "0.49311656", "0.49311656", "0.49311656", "0.49311656", "0.49311656", "0.49311656" ]
0.5723793
8
Generate a summary string for some stats.
function getStatsSummary(stats: BenchmarkStats): string { const parts = []; if (stats.improved > 0) { parts.push(colors.green.bold(`${stats.improved} improved`)); } if (stats.regressed > 0) { parts.push(colors.red.bold(`${stats.regressed} regressed`)); } parts.push(`${stats.total} total`); return parts.join(', '); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function summarize(summary)\n {\n var seconds = summary.seconds;\n var usage = summary.usage;\n var yields = summary.yields;\n\n log.debug('Summary', [seconds, usage, yields]);\n }", "renderSummary() {\n return ''; // @todo\n }", "function generateSummaryOutput(result) {\n var responses = [];\n var delimiter = '';\n if (result.total > 0) {\n if (result.total === 1) {\n responses = [];\n if (result.successes) responses.push(successFmt('ok'));\n if (result.failures) responses.push(failureFmt('failed'));\n if (result.skipped) responses.push(skipFmt('skipped'));\n delimiter = ' ';\n } else {\n responses = [];\n if (result.successes) responses.push(successFmt(result.successes + ' ok'));\n if (result.failures) responses.push(failureFmt(result.failures + ' failed'));\n if (result.skipped) responses.push(skipFmt(result.skipped + ' skipped'));\n delimiter = ', ';\n }\n return responses.join(delimiter);\n }\n\n return chalk.magenta('no tests');\n }", "function showStats() {\n var infoName = '\\n' + pet.name.toUpperCase() + \"'s life: \";\n var infoParameters = \"Happiness: \" + pet.happiness + \", Food: \" + pet.food + \", Energy: \" + pet.energy;\n var stats = infoName + infoParameters;\n return stats;\n }", "function produce_summary(parsed_file) {\n \"use strict\";\n var appendpart = '', total, blocker, crit, maj, min, info;\n\n //Get counts:\n total = count_map_el(parsed_file['by-id']);\n maj = count_map_el(parsed_file['by-sev']['major']);\n min = count_map_el(parsed_file['by-sev']['minor']);\n\n //Create the text\n //appendpart += '<p>A quick summary of the analysis.<br/>';\n appendpart += '<p class=\"Summary\"><b>' + total + '</b> Potential problems found, of which:</p>';\n appendpart += '<p class=\"Summary\"><img src=ico/severity/major.png /> <b>Major:</b> ' + maj + '</p>';\n appendpart += '<p class=\"Summary\"><img src=ico/severity/minor.png /> <b>Minor:</b> ' + min + '</p>';\n $('.details').append(appendpart);\n\n}", "getDisplayString(stat) {\n let isArtifactBoost = stat.id.search(\"PIP_Artifact_\") > -1\n let isTalentBoost = stat.id.search(\"PIP_Talent\") > -1\n\n // if a single stat source is passed instead of a total'd one, use the single value\n stat.amount = stat.amount != null ? stat.amount : stat.value;\n\n if (isArtifactBoost) {\n // artifact boosts use the Artifact's description\n let artifactId = stat.id.replace(\"PIP_Artifact_\", \"\").toLowerCase()\n return game.artifacts[artifactId].description\n }\n else if (isTalentBoost) {\n // talent boosts use the talent's description\n let talentId = stat.id.replace(\"PIP_Talent_\", \"\").toLowerCase()\n return miscData.talents[talentId].description\n }\n else if (stat.type in miscData.stats && stat.id in miscData.stats[stat.type]) {\n // strings defined by us, for generic stats like +movement.\n let displayInfo = miscData.stats[stat.type][stat.id]\n\n // manually defined strings for each possible value of a stat. Used by the summon capacity boost for example.\n if (displayInfo && displayInfo.strings != null) {\n return displayInfo.strings[Math.min(stat.amount, displayInfo.strings.length-1)]\n }\n else if (displayInfo && displayInfo.bool)\n return utils.format(miscData.stats[stat.type][stat.id].display, utils.capitalize((stat.amount > 0).toString()))\n\n return utils.format(miscData.stats[stat.type][stat.id].display, stat.amount)\n }\n else if (miscData.statTypesWithGameStrings.includes(stat.type)) {\n // stat types that use strings from the game if we have not defined a replacement for them.\n return game.ascension.specialStrings[stat.refString]\n }\n\n return \"STAT WITH NO STRING: \" + stat.type + \" \" + stat.id\n }", "function runningStatStr(stat) {\n\t return `Last: ${stat.last.toFixed(2)}ms | ` +\n\t `Avg: ${stat.mean.toFixed(2)}ms | ` +\n\t `Avg${stat.maxBufferSize}: ${stat.bufferMean.toFixed(2)}ms`;\n\t}", "function getSummonerStatsSummary(){\n\n}", "function generateSummary() {\n // Add .repeat method for padEnd method\n if (!String.prototype.repeat) {\n String.prototype.repeat = function(count) {\n 'use strict';\n if (this == null)\n throw new TypeError('can\\'t convert ' + this + ' to object');\n\n var str = '' + this;\n // To convert string to integer.\n count = +count;\n // Check NaN\n if (count != count)\n count = 0;\n\n if (count < 0)\n throw new RangeError('repeat count must be non-negative');\n\n if (count == Infinity)\n throw new RangeError('repeat count must be less than infinity');\n\n count = Math.floor(count);\n if (str.length == 0 || count == 0)\n return '';\n\n // Ensuring count is a 31-bit integer allows us to heavily optimize the\n // main part. But anyway, most current (August 2014) browsers can't handle\n // strings 1 << 28 chars or longer, so:\n if (str.length * count >= 1 << 28)\n throw new RangeError('repeat count must not overflow maximum string size');\n\n var maxCount = str.length * count;\n count = Math.floor(Math.log(count) / Math.log(2));\n while (count) {\n str += str;\n count--;\n }\n str += str.substring(0, maxCount - str.length);\n return str;\n }\n }\n\n // Add .padEnd() method to better format strings\n String.prototype.padEnd = function padEnd(targetLength,padString) {\n targetLength = targetLength>>0; //floor if number or convert non-number to 0;\n padString = String((typeof padString !== 'undefined' ? padString : ' '));\n if (this.length > targetLength) {\n return String(this);\n }\n else {\n targetLength = targetLength-this.length;\n if (targetLength > padString.length) {\n padString += padString.repeat(targetLength/padString.length); //append to original to ensure we are longer than needed\n }\n return String(this) + padString.slice(0,targetLength);\n }\n };\n\n // Important PPMG worksheet add-on to change disclaimer based on who is signing out\n var pathologist = this.getField(\"Casestatus\").valueAsString;\n var ppmd = \"\";\n if (pathologist == \"Chandra Krishnan\") {\n ppmd = \"PROFESSIONAL INTERPRETATION PERFORMED BY CLINICAL PATHOLOGY ASSOCIATES (3445 Executive Center Drive, Suite 250, Austin, TX 78731. CLIA#45D2052154)\\n\\n\";\n } else if (pathologist == \"Michael Cascio\") {\n ppmd = \"PROFESSIONAL INTERPRETATION PERFORMED BY PENNINSULA PATHOLOGISTS MEDICAL GROUP LABORATORY (383 East Grand Ave, Suite A, South San Francisco, CA 94080. Ph. 650-616-2951. CLIA#05D1029487)\\n\\n\";\n } else {\n ppmd = \"\";\n }\n\n var viability = this.getField(\"Viability\").valueAsString;\n var lymphs = this.getField(\"Diff#1\").valueAsString;\n var blym = this.getField(\"CD19 LYMPHS\").valueAsString;\n var tlym = this.getField(\"CD3 or CD2\").valueAsString;\n var mono = this.getField(\"Diff#2\").valueAsString;\n var gran = this.getField(\"Diff#3\").valueAsString;\n var blast = this.getField(\"Diff#4\").valueAsString;\n var debris = this.getField(\"Diff#5\").valueAsString;\n var plratio = getField(\"Plasma cell K/L\").valueAsString;\n\n \n var bioCD19 = this.getField(\"bioCD19\").valueAsString;\n var bioCD20 = this.getField(\"bioCD20\").valueAsString;\n var bioCD22 = this.getField(\"bioCD22\").valueAsString;\n var bioCD33 = this.getField(\"bioCD33\").valueAsString;\n var bioCD38 = this.getField(\"bioCD38\").valueAsString;\n\n var wild1 = this.getField(\"Wildcard1\").valueAsString;\n var wild2 = this.getField(\"Wildcard2\").valueAsString;\n var wild3 = this.getField(\"Wildcard3\").valueAsString;\n \n var abnorm = '';\n var abnorm2 = '';\n var abnorm3 = '';\n if (wild1 == \"Abnormal cells\"){abnorm = this.getField(\"Diff#6\").value}; \n if (wild2 == \"Abnormal cells #2\"){abnorm2 = this.getField(\"Diff#7\").value};\n if (wild3 == \"Abnormal cells #3\"){abnorm3 = this.getField(\"Diff#8\").value};\n \n var baso = '';\n if (wild1 == \"Basophils\"){baso = this.getField(\"Diff#6\").value} \n else if (wild2 == \"Basophils\"){baso = this.getField(\"Diff#7\").value} \n else if (wild3 == \"Basophils\"){baso = this.getField(\"Diff#8\").value};\n \n var hemat = '';\n if (wild1 == \"Hematogones\"){hemat = this.getField(\"Diff#6\").value} \n else if (wild2 == \"Hematogones\"){hemat = this.getField(\"Diff#7\").value} \n else if (wild3 == \"Hematogones\"){hemat = this.getField(\"Diff#8\").value};\n \n var plasma = '';\n if (wild1 == \"Plasma cells\"){plasma = this.getField(\"Diff#6\").value} \n else if (wild2 == \"Plasma cells\"){plasma = this.getField(\"Diff#7\").value} \n else if (wild3 == \"Plasma cells\"){plasma = this.getField(\"Diff#8\").value};\n \n var other = '';\n if (wild1 == \"Other\"){other = this.getField(\"Diff#6\").value} \n else if (wild2 == \"Other\"){other = this.getField(\"Diff#7\").value} \n else if (wild3 == \"Other\"){other = this.getField(\"Diff#8\").value};\n \n var nk = '';\n if (wild1 == \"NK-cells\"){nk = this.getField(\"Diff#6\").value} \n else if (wild2 == \"NK-cells\"){nk = this.getField(\"Diff#7\").value} \n else if (wild3 == \"NK-cells\"){nk = this.getField(\"Diff#8\").value};\n \n var nonheme = '';\n if (wild1 == \"Non-heme\"){nonheme = this.getField(\"Diff#6\").value} \n else if (wild2 == \"Non-heme\"){nonheme = this.getField(\"Diff#7\").value} \n else if (wild3 == \"Non-heme\"){nonheme = this.getField(\"Diff#8\").value};\n \n var s = \n \"Flow cytometry differential (excluding unclassified events)\\n\\n\"+\n \"Viability:\".padEnd(24)+ viability +\"%\\n\"+\n \"Lymphocytes:\".padEnd(24)+ lymphs +\"%\\n\"+\n \" B-cells:\".padEnd(24)+ blym +\"%\\n\"+\n \" T-cells:\".padEnd(24)+ tlym +\"%\\n\"+\n \"Monocytes:\".padEnd(24)+ mono +\"%\\n\"+\n \"Granulocytes:\".padEnd(24)+ gran +\"%\\n\"+\n \"Blasts:\".padEnd(24)+ blast +\"%\\n\"+\n \"CD45-neg/Debris:\".padEnd(24)+ debris +\"%\\n\";\n \n if (abnorm != ''){\n s = s+\"Abnormal:\".padEnd(24)+abnorm+\"%\\n\"};\n if (abnorm2 != ''){\n s = s+\"Abnormal #2:\".padEnd(24)+abnorm2+\"%\\n\"};\n if (abnorm3 != ''){\n s = s+\"Abnormal #3:\".padEnd(24)+abnorm3+\"%\\n\"};\n if (baso != ''){\n s = s+\"Basophils:\".padEnd(24)+baso+\"%\\n\"};\n if (hemat != ''){\n s = s+\"Hematogones:\".padEnd(24)+hemat+\"%\\n\"};\n if (plasma != ''){\n s = s+\"Plasma cells:\".padEnd(24)+plasma+\"% (K:L ratio = \"+plratio+\") \\n\"};\n if (other != ''){\n s = s+\"Others:\".padEnd(24)+other+\"%\\n\"};\n if (nk != ''){\n s = s+\"NK-cells:\".padEnd(24)+nk+\"%\\n\"};\n if (nonheme != ''){\n s = s+\"Non-hematolymphoid:\".padEnd(24)+nonheme+\"%\\n\"};\n\n var b = \"Biomarker Status (% of abnormal cells expressing therapeutic targets): \\n\";\n if (bioCD19 != ''){\n b = b+\"CD19 expression:\".padEnd(24)+bioCD19+\"%\\n\"};\n if (bioCD20 != ''){\n b = b+\"CD20 expression:\".padEnd(24)+bioCD20+\"%\\n\"};\n if (bioCD22 != ''){\n b = b+\"CD22 expression:\".padEnd(24)+bioCD22+\"%\\n\"};\n if (bioCD33 != ''){\n b = b+\"CD33 expression:\".padEnd(24)+bioCD33+\"%\\n\"};\n if (bioCD38 != ''){\n b = b+\"CD38 expression:\".padEnd(24)+bioCD38+\"%\\n\"};\n if ((bioCD19 == '') && (bioCD20 == '') && (bioCD22 == '') && (bioCD33 == '') && (bioCD38 == '')){\n b = \"\"\n }; \n \n s = s + \"\\nResults:\\n\"+this.getField(\"Finaldx\").valueAsString+\"\\n\\n\"+\n b+\"\\n\"+\n \"Interpretation: \" + this.getField(\"Interp text\").valueAsString+ \" \\n\\n\"+ \n \"Antibodies tested: Total, \" + this.getField(\"Abtotal\").valueAsString + \": \" + this.getField(\"AbList\").valueAsString+\"\\n\\nTECHNICAL WORK PERFORMED BY PENNINSULA PATHOLOGISTS MEDICAL GROUP LABORATORY (383 East Grand Ave, Suite A, South San Francisco, CA 94080. Ph. 650-616-2951. CLIA#05D1029487). Flow cytometry testing was developed and the performance characteristics determined by PPMG Flow cytometry laboratory. They have not been cleared or approved by the U.S. Food and Drug Administration. The FDA has determined that such clearance or approval is not necessary. These tests are used for clinical purposes. They should not be regarded as investigational or for research. This laboratory is certified under the Clinical Laboratory Improvement Amendments of 1988 (CLIA-88) as qualified to perform high complexity clinical laboratory testing.\\n\\n\"+\n ppmd+\n \"Some antigens evaluated by flow cytometry may also be evaluated by immunohistochemistry when deemed medically necessary. Concurrent evaluation by IHC on tissue sections is indicated in some cases in order to further characterize or categorize tumors. IHC may also be necessary to correlate immunophenotype with cell morphology and determine extent of involvement, spatial pattern, and focality of potential disease distribution.\";\n\n \n \n console.clear();\n console.println(s);\n console.show();\n //app.alert(s);\n }", "describe() {\n return `${this.name} has ${this.health} health points, ${this\n .strength} as strength and ${this.xp} XP points`;\n }", "function summaryDetail(a, b) {\n return \"<details><summary>\" + a + \"</summary>\" + b + \"</details>\";\n}", "describe() {\n return `${this.name} has ${this.health} health points, \n ${this.strength} as strength and ${this.xp} XP points`;\n }", "updateSummary(summary, stat, character) {\n let propertyName = statTypeMap[stat.displayType];\n\n if (!summary.hasOwnProperty(stat.displayType)) {\n let statType =\n // We only include a '%' if the stat is NOT in percentTypes, because those are the only stats that will always\n // display as a percentage\n Stat.percentTypes.includes(stat.displayType) ?\n stat.displayType :\n stat.displayType + '%';\n summary[stat.displayType] = new Stat(statType, '0');\n }\n if (stat.isPercent) {\n summary[stat.displayType].value += stat.value * character.baseStats[propertyName] / 100;\n } else {\n summary[stat.displayType].value += stat.value;\n }\n }", "function _showStats(stats) {\n\t\tfor(var k in stats) {\n\t\t\t_showNumber(k, stats[k]);\n\t\t}\n\t}", "genDataSummaryText()\n\t{\t\n\n let target = this.state.searchTarget;\n\n let summary = genSummary(target)\n\n\t\treturn summary === \"Entire Corpus\" ? \"No Data Selected\" : summary\n\n\t}", "function buildHumanSummary(config) {\n var summary = \"# Logstash configuration summary\\n\"\n\n summary += \"\\n## Input\\n\"\n\n summary += \"\\n### Data sample\\n\"\n if(config.input_data.trim().length == 0) {\n summary += \"\\n> No data provided\\n\"\n } else {\n summary += \"\\n```\\n\"\n summary += config.input_data.split('\\n').slice(0, 10).join(\"\\n\")\n summary += \"\\n```\\n\"\n }\n if(config.custom_codec.trim().length != 0) {\n summary += \"\\n### Codec\\n\"\n summary += \"\\n```\\n\"\n summary += config.custom_codec\n summary += \"\\n```\\n\"\n }\n if(config.input_fields.length != 0) {\n summary += \"\\n### Input fields\\n\"\n summary += \"\\n| Attribute | Value |\\n\"\n summary += \"|-----------|-------|\\n\"\n for(var i = 0 ; i < config.input_fields.length ; i++) {\n element = config.input_fields[i]\n summary += \"|\" + escapeHtml(element['attribute']) + \"|\" + escapeHtml(element['value']) + \"|\\n\"\n }\n }\n\n summary += \"\\n## Filter\\n\"\n\n if(config.logstash_filter.trim().length == 0) {\n summary += \"\\n> No data provided\\n\"\n } else {\n summary += \"\\n```ruby\\n\"\n summary += config.logstash_filter\n summary += \"\\n```\\n\"\n }\n\n summary += \"\\n## Output\\n\"\n\n var output_launched = false\n var summary_append = \"\"\n\n if(typeof fields_characteristics !== 'undefined' && fields_characteristics.length != 0) {\n output_launched = true\n summary_append += \"\\n### Output characteristics\\n\"\n summary_append += \"\\n| Field | Type | In % of events | Sample |\\n\"\n summary_append += \"|-------|------|----------------|--------|\\n\"\n for(var field in fields_characteristics) {\n field_characteristic = fields_characteristics[field]\n field_presence = \"?\"\n if(typeof totalRealEventNumber !== 'undefined') {\n field_presence = parseFloat(field_characteristic[\"occurence\"]/totalRealEventNumber*100).toFixed(2)\n }\n mostPresentValues = createTopXValues(field_characteristic[\"values_occurences\"], 1)\n value = \"undefined\"\n if (mostPresentValues[0] != undefined) {\n value = String(mostPresentValues[0][0]).substring(0, 100)\n }\n summary_append += \"|\" + escapeHtml(field) + \"|\" + escapeHtml(field_characteristic[\"types\"].join(\", \")) + \"|\" + escapeHtml(field_presence) + \"|\" + escapeHtml(value) + \"|\\n\"\n }\n }\n\n logstash_output_json = getLogstashOutputJson()\n if (logstash_output_json.trim() != \"\") {\n output_launched = true\n logstash_output_json = logstash_output_json.split('\\n').slice(0, 5)\n summary_append += \"\\n### First 5 events parsed\\n\"\n summary_append += \"\\n```json\\n\"\n for(var i in logstash_output_json) {\n event = logstash_output_json[i]\n eventBeautiful = JSON.stringify(JSON.parse(event), null, 4);\n summary_append += eventBeautiful + \"\\n\"\n }\n summary_append += \"\\n```\\n\"\n }\n\n if (!output_launched) {\n summary += \"\\n> No launch was done, can't provide output details\\n\"\n } else {\n summary += \"\\n**Logstash version**: \" + $('#logstash_version :selected').text() + \"\\n\"\n }\n\n summary += summary_append\n\n return summary\n}", "function GenStats(props) {\n return (\n <Tooltip title={props.description} color=\"#323776\">\n <div className=\"new-stats\">\n <h2 className=\"new-stats-title\">{props.title}</h2>\n <h2 className=\"new-stats-data\">{props.data}%</h2>\n </div>\n </Tooltip>\n );\n}", "function summarizeUser(userName, userAge, userHasHobby){\n return (\n 'Name is ' + userName +\n ', age is ' + userAge +\n ', and the user has hobbies : ' + userHasHobby\n );\n}", "showStats(){\n console.log(\"Name:\", this.name, \"\\nStrength:\", this.strength, \"\\nSpeed:\", this.speed, \"\\nHealth:\", this.health);\n }", "function formatStats(attack, defense) {\n return \"(<span class='attack'>\" + attack + \"</span>\" + \"/\" + \"<span class='defense'>\" + defense + \"</span>\" + \")\";\n}", "function summaryReport (allScores) {\n\tlet outputString = \"\";\n\tconst inconsistencyCounts = {};\n\n\tfor (const userId in allScores) {\n\t\tif (allScores.hasOwnProperty(userId)) {\n\t\t\tconst userData = allScores[userId];\n\t\t\tconst scoresForThisUser = userData.scores;\n\t\t\tlet userComments = (userData.missingAnswers > 0) ? ` *** ${userData.missingAnswers} missing answers` : \"\";\n\t\t\tuserComments += userData.suspiciousDuration ? ` *** Completed too quickly - ${userData.suspiciousDuration} seconds.` : \"\";\n\t\t\tuserComments += (!userData.age || !userData.sex) ? \" *** age or sex not specified\" : \"\";\n\t\t\tconst inconsistencyCount = userData.inconsistencies.bad + userData.inconsistencies.minor;\n\t\t\tif (inconsistencyCount > 0) {\n\t\t\t\tuserComments += ` *** inconsistencies: bad ${userData.inconsistencies.bad}, minor ${userData.inconsistencies.minor}, total ${inconsistencyCount}`;\n\t\t\t}\n\t\t\tinconsistencyCounts[inconsistencyCount] = (inconsistencyCounts[inconsistencyCount] || 0) + 1;\n\t\t\tconst time = moment(new Date(userData.time)).format(\"M/D/YY H:mm\");\n\t\t\tconst minutes = Math.round(userData.elapsedSeconds / 60);\n\t\t\toutputString += `\\n\\n\\n${userData.respondentId} ${userId} ${time} ${minutes} minutes ${userData.sex} ${userData.age} ${userComments}\\n\\n${userData.image}\\n`;\n\n\t\t\t// Fetch the template which contains a list of all the domains and facets, including their human-readable names.\n\t\t\t// The order of items in the template defines the order of the report.\n\t\t\tconst template = getTemplate();\n\n\t\t\t// Iterate over the domains in the template\n\t\t\tfor (let i = 0; i < template.length; i++) {\n\t\t\t\tconst domain = template[i];\n\t\t\t\tconst scoresForThisDomain = scoresForThisUser[domain.domain] || {};\n\t\t\t\tconst domainScore = scoresForThisDomain.score || {score: 0, count: 0, rating: \"average\"};\n\t\t\t\tconst facetScores = scoresForThisDomain.facets || {};\n\n\t\t\t\t// Print the domain summary line\n\t\t\t\toutputString += `\\n ${domain.domain}. ${domain.title}: ${domainScore.percentileScore} ${domainScore.rating} (${domainScore.score} / ${domainScore.count * 5})\\n`;\n\n\t\t\t\t// Iterate over facets and print a line for each facet.\n\t\t\t\tfor (let k = 0; k < domain.facets.length; k++) {\n\t\t\t\t\tconst facet = domain.facets[k];\n\t\t\t\t\tconst facetScore = facetScores[facet.facet] || {score: 0, count: 0, scores: [], inconsistency: \"none\", rating: \"average\"};\n\t\t\t\t\tconst scoreString = facetScore.inconsistency !== \"none\"\n\t\t\t\t\t\t? `*** ${facetScore.inconsistency} inconsistency; scores are ${facetScore.scores}` : \"\";\n\t\t\t\t\toutputString +=\n\t\t\t\t\t\t` ${facet.facet}. ${facet.title}: ${facetScore.percentileScore} ${facetScore.rating} (${facetScore.score} / ${facetScore.count * 5}) ${scoreString}\\n`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\toutputString += `\\n<Inconsistency count>:<number of users> - `;\n\tfor (const count in inconsistencyCounts) {\n\t\tif (inconsistencyCounts.hasOwnProperty(count)) {\n\t\t\toutputString += `\\n${count}: ${inconsistencyCounts[count]}`;\n\t\t}\n\t}\n\toutputString += `\\n`;\n\treturn outputString;\n}", "formatTestSummary(executedMessage, failuresPerSuite) {\n const failures = this.formatFailures(failuresPerSuite);\n let finalMessage = '';\n if (!failures) {\n finalMessage = chalk_1.default.green(executedMessage);\n }\n else {\n finalMessage = chalk_1.default.red(executedMessage);\n }\n const text = [failures, finalMessage].join('\\n\\n\\n').trim();\n return `\\n\\n${text}`;\n }", "function formatSummary(errors, warnings) {\n const summaryColor = errors > 0 ? \"red\" : \"yellow\";\n const summary = [];\n if (errors > 0) {\n summary.push(`${errors} ${pluralize(\"error\", errors)}`);\n }\n if (warnings > 0) {\n summary.push(`${warnings} ${pluralize(\"warning\", warnings)}`);\n }\n return kleur_1.default[summaryColor]().bold(`${summary.join(\" and \")} found.`);\n}", "function getSummary(summaryName, record) {\n\tvar summary = '';\n\n\tif (record) {\n\t\tif (summaryName) {\n\t\t\tsummary = summaryName;\n\t\t}\n\n\t\tif (_.isString(record.uid)) {\n\t\t\tsummary += '{uid=\\'' + record.uid + '\\'}';\n\t\t}\n\t\telse {\n\t\t\tsummary += '{uid=\\'\\'}';\n\t\t}\n\t}\n\n\treturn summary;\n}", "function formatSummary(errors, warnings) {\n const summaryColor = errors > 0 ? \"red\" : \"yellow\";\n const summary = [];\n if (errors > 0) {\n summary.push(`${errors} ${pluralize(\"error\", errors)}`);\n }\n if (warnings > 0) {\n summary.push(`${warnings} ${pluralize(\"warning\", warnings)}`);\n }\n return kleur__default[\"default\"][summaryColor]().bold(`${summary.join(\" and \")} found.`);\n}", "function writeGameStats() {\n\tconst timeStat = $('.timeStat');\n\tconst clockTime = $('span.timer').html();\n\tconst movesStat = $('.movesStat');\n\tconst starsStat = $('.starsStat')\n\n\ttimeStat.html(`Time = ${clockTime}`);\n\tmovesStat.html(`Moves = ${moves}`);\n\tstarsStat.html(`Stars = ${stars}`);\n}", "function printStatistics() {\n var textP;\n var defxo = 0.1, //default x offset\n defwo = 1, //default width offset\n wo = 0.8 //another width offset\n deftp = 0.05; // default text percentage\n textP = \"Statistics\";\n printText(0, 0.25, defwo, textP, deftp, \"center\");\n\n //Longest Time Alive Statistic\n textP = \"Longest time alive:\";\n printText(defxo, 0.35, defwo, textP, deftp, \"left\");\n textP = calculateLongestPlayerAliveTime() + \"s\";\n printText(defxo, 0.35, wo, textP, deftp, \"right\");\n\n //Number of Deaths Statistic\n textP = \"Number of deaths:\";\n printText(defxo, 0.45, defwo, textP, deftp, \"left\");\n textP = metrics.get(\"playerHit\");\n printText(defxo, 0.45, wo, textP, deftp, \"right\");\n\n //Enemies Destroyed Statistic\n textP = \"Enemies Destroyed:\";\n printText(defxo, 0.55, defwo, textP, deftp, \"left\");\n textP = metrics.get(\"enemiesKilled\");\n printText(defxo, 0.55, wo, textP, deftp, \"right\");\n\n //Bonuses Collected Statistic\n textP = \"Bonuses collected:\";\n printText(defxo, 0.65, defwo, textP, deftp, \"left\");\n textP = metrics.get(\"bonusCollected\");\n printText(defxo, 0.65, wo, textP, deftp, \"right\");\n\n //Final Score Statistic\n textP = \"Final Score:\";\n printText(defxo, 0.75, defwo, textP, deftp, \"left\");\n textP = Crafty(\"Score\")._score;\n printText(defxo, 0.75, wo, textP, deftp, \"right\");\n}", "function summary(iRuntime, oTest) {\n\t\t\tvar oElement, iMinutes, iSeconds, sText;\n\n\t\t\tfunction count(iCount, sWhat) {\n\t\t\t\treturn iCount ? \", \" + iCount + \" \" + sWhat : \"\";\n\t\t\t}\n\n\t\t\tif (oTest) {\n\t\t\t\toTotal.testCounts.failed += oTest.testCounts.failed;\n\t\t\t\toTotal.testCounts.skipped += oTest.testCounts.skipped;\n\t\t\t\toTotal.testCounts.todo += oTest.testCounts.todo;\n\t\t\t\toTotal.testCounts.total += oTest.testCounts.total;\n\t\t\t} else {\n\t\t\t\toTest = oTotal;\n\t\t\t}\n\t\t\tiRuntime = Math.round(iRuntime / 1000);\n\t\t\tiMinutes = Math.floor(iRuntime / 60);\n\t\t\tiSeconds = iRuntime - iMinutes * 60;\n\t\t\tsText = \": \" + oTest.testCounts.total + \" tests in \"\n\t\t\t\t+ (iMinutes ? iMinutes + \" min \" : \"\")\n\t\t\t\t+ iSeconds + \" sec\"\n\t\t\t\t+ count(oTest.testCounts.failed, \"failed\")\n\t\t\t\t+ count(oTest.testCounts.skipped, \"skipped\")\n\t\t\t\t+ count(oTest.testCounts.todo, \"todo\")\n\t\t\t\t+ \" \";\n\n\t\t\toTest.infoNode.data = sText;\n\n\t\t\tif (oTest.url) {\n\t\t\t\toElement = document.createElement(\"a\");\n\t\t\t\toElement.setAttribute(\"href\", oTest.url);\n\t\t\t\toElement.setAttribute(\"target\", \"_blank\");\n\t\t\t\toElement.appendChild(document.createTextNode(\"Rerun\"));\n\t\t\t\toTest.element.appendChild(oElement);\n\t\t\t}\n\t\t}", "getSummary(character) {\n let summary = {\n 'Health': new Stat('Health', '0'),\n 'Protection': new Stat('Protection', '0'),\n 'Speed': new Stat('Speed', '0'),\n 'Critical Damage': new Stat('Critical Damage %', '0'),\n 'Critical Chance': new Stat('Critical Chance %', '0'),\n 'Potency': new Stat('Potency', '0'),\n 'Tenacity': new Stat('Tenacity', '0'),\n 'Offense': new Stat('Offense', '0'),\n 'Defense': new Stat('Defense', '0'),\n 'Accuracy': new Stat('Accuracy %', '0'),\n 'Critical Avoidance': new Stat('Critical Avoidance %', '0')\n };\n let setCounts = new WeakMap();\n\n for (let slot of ModSet.slots) {\n let mod = this[slot];\n if (null === mod) {\n continue;\n }\n let set = mod.set;\n\n // Update the summary for each stat on each mod\n this.updateSummary(summary, mod.primaryStat, character);\n for (let secondaryStat of mod.secondaryStats) {\n this.updateSummary(summary, secondaryStat, character);\n }\n\n // Get a count of how many mods are in each set\n let currentCount = setCounts.get(set) || 0;\n if (set) {\n setCounts.set(set, currentCount + 1);\n }\n }\n\n // Update the summary for each stat from each complete mod set\n for (let setKey in setBonuses) {\n let setDescription = setBonuses[setKey];\n let setMultiplier = Math.floor((setCounts.get(setDescription) || 0) / setDescription.numberOfModsRequired);\n\n for (let i = 0; i < setMultiplier; i++) {\n this.updateSummary(summary, setDescription.bonus, character);\n }\n }\n\n // Update the summary to mark the stats that should always be displayed as percentages\n // Also update all stats to be the correct precision\n Object.values(summary).forEach(stat => {\n if (!Stat.percentTypes.includes(stat.displayType)) {\n stat.value = Math.floor(stat.value * 100) / 100;\n stat.displayModifier = '%';\n } else {\n stat.value = Math.trunc(stat.value);\n }\n stat.updateDisplayValue();\n });\n\n return summary;\n }", "stats() {\n const packets = this.getDataPackets();\n \n const sampleTimes = packets.map(p => p._sampleTime);\n const timings = _.isEmpty(sampleTimes) ? [0] : sampleTimes;\n\n return {\n name: this.name,\n label: this.label,\n address: this.node.getBoltAddress(),\n lastObservation: this.state && this.state.data ? this.state.data[0] : null,\n query: this.query,\n packets: packets.length,\n stdev: math.std(...timings),\n mean: math.mean(...timings),\n median: math.median(...timings),\n mode: math.mode(...timings),\n min: math.min(...timings),\n max: math.max(...timings),\n augFns: this.augmentFns.length,\n aliases: this.aliases.length,\n timings,\n };\n }", "function summarize(desc) {\n\tif (typeof desc != \"undefined\")\n\t\treturn desc.match(/([\\w\\W]+?\\.)[^a-z0-9_$]/i)? RegExp.$1 : desc;\n}", "function generateSummary(rule,localeObject,locale,calendarType){if(calendarType===void 0){calendarType='Gregorian';}var ruleObject=extractObjectFromRule(rule);var summary=localeObject.getConstant(EVERY)+' ';var cldrObj;var cldrObj1;var calendarMode=calendarType.toLowerCase();if(locale==='en'||locale==='en-US'){var nameSpace1=sf.base.isBlazor()?'months.abbreviated':'months.stand-alone.abbreviated';var nameSpace=sf.base.isBlazor()?'days.abbreviated':'days.stand-alone.abbreviated';cldrObj1=sf.base.getValue(nameSpace1,sf.base.getDefaultDateObject(calendarMode));cldrObj=sf.base.getValue(nameSpace,sf.base.getDefaultDateObject(calendarMode));}else{var nameSpace1=sf.base.isBlazor()?locale+'.dates.months.abbreviated':'main.'+locale+'.dates.calendars.'+calendarMode+'.months.stand-alone.abbreviated';var nameSpace=sf.base.isBlazor()?locale+'.dates.days.abbreviated':'main.'+locale+'.dates.calendars.'+calendarMode+'.days.stand-alone.abbreviated';cldrObj1=sf.base.getValue(nameSpace1,sf.base.cldrData);cldrObj=sf.base.getValue(nameSpace,sf.base.cldrData);}if(ruleObject.interval>1){summary+=ruleObject.interval+' ';}switch(ruleObject.freq){case'DAILY':summary+=localeObject.getConstant(DAYS);break;case'WEEKLY':summary+=localeObject.getConstant(WEEKS)+' '+localeObject.getConstant(ON)+' ';ruleObject.day.forEach(function(day,index){summary+=capitalizeFirstWord(sf.base.getValue(DAYINDEXOBJECT[day],cldrObj),'single');summary+=ruleObject.day.length-1===index?'':', ';});break;case'MONTHLY':summary+=localeObject.getConstant(MONTHS)+' '+localeObject.getConstant(ON)+' ';summary+=getMonthSummary(ruleObject,cldrObj,localeObject);break;case'YEARLY':summary+=localeObject.getConstant(YEARS)+' '+localeObject.getConstant(ON)+' ';summary+=capitalizeFirstWord(sf.base.getValue(ruleObject.month[0].toString(),cldrObj1),'single')+' ';summary+=getMonthSummary(ruleObject,cldrObj,localeObject);break;}if(ruleObject.count){summary+=', '+ruleObject.count+' '+localeObject.getConstant(TIMES);}else if(ruleObject.until){var tempDate=ruleObject.until;summary+=', '+localeObject.getConstant(UNTIL)+' '+tempDate.getDate()+' '+capitalizeFirstWord(sf.base.getValue((tempDate.getMonth()+1).toString(),cldrObj1),'single')+' '+tempDate.getFullYear();}return summary;}", "function updateSummary() {\n summary.innerHTML = `${summaryCountChecked} / ${summaryCountTotal} Completed`;\n}", "getReport()\r\n\t{\r\n\t\tlet report = '';\r\n\r\n\t\tmembers.forEach( (member, duration) => s += member.username + '\\t\\t' + duration + ' seconds\\n' );\r\n\t\treturn report;\r\n\t}", "function outputSummaryReport(cli, phaseResultsFormatted) {\n cli.log(`\\n${utils_1.chalkScheme.blackBgBlue(` ${utils_1.chalkScheme.white('Benchmark Results Summary')} `)}`);\n cli.log(`\\n${chalk_1.default.red('Red')} color means there was a regression.`);\n cli.log(`${chalk_1.default.green('Green')} color means there was an improvement.\\n`);\n phaseResultsFormatted.forEach(phaseData => {\n const { phase, hlDiff, isSignificant, ciMin, ciMax } = phaseData;\n let msg = `${chalk_1.default.bold(phase)} phase `;\n if (isSignificant && Math.abs(hlDiff)) {\n let coloredDiff;\n msg += 'estimated difference ';\n if (hlDiff < 0) {\n coloredDiff = chalk_1.default.red(`+${Math.abs(hlDiff)}ms [${ciMax * -1}ms to ${ciMin * -1}ms]`);\n }\n else {\n coloredDiff = chalk_1.default.green(`-${Math.abs(hlDiff)}ms [${ciMax * -1}ms to ${ciMin * -1}ms]`);\n }\n msg += `${coloredDiff}`;\n }\n else {\n msg += `${chalk_1.default.grey('no difference')}`;\n }\n cli.log(msg);\n });\n}", "summary() {\n return this.content.substring(0, 200);\n }", "function formatSummary(card_data) {\n\tif (card_data.currentlySummary !== undefined) {\n\t\tvar currently = formatCurrentlySummary(card_data.currentlySummary);\n\t} else {\n\t\tvar currently = '';\n\t}\n\n\tif (card_data.dailySummary !== undefined) {\n\t\tvar daily = card_data.dailySummary;\n\t} else {\n\t\tvar daily = '';\n\t}\n\n\tif (card_data.currentlySummary == undefined && card_data.dailySummary == undefined) {\n\t\treturn 'Weekly forecast summary not available.';\n\t} else {\n\t\treturn currently + daily;\n\t}\n}", "function TEST_SUMMARY() {\n var ownName = arguments.callee.caller.toString();\n // Trim off \"function \".\n ownName = ownName.substr('function '.length);\n // Trim off everything after the function name.\n ownName = ownName.substr(0, ownName.indexOf('('));\n if (0 == numErrors_) {\n LOG('');\n LOG(ownName + ' <font color=\"green\">SUCCEEDED</font>');\n } else {\n LOG('');\n LOG(ownName + ' <font color=\"red\">FAILED</font> with ' + numErrors_\n + ' errors.');\n }\n numErrors_ = 0;\n}", "getSummary() {\n return getSubjectSummary(this._subject, this._school, this._degree, this._course);\n }", "get summary() {\n return this._results\n }", "getUsageStats() {\n return `Buffer: ${bytes(this.recentBuffer.length)}, lrErrors: ${this.lrErrors}`;\n }", "getOneLineSummary() {\n const result = super.getOneLineSummary();\n return (result === this.constructor.LabelSingular) ? '' : result;\n }", "function summarize(desc) {\n\tif (typeof desc != \"undefined\")\n\t\treturn desc.match(/([\\w\\W]+?\\.)[^a-z0-9]/i)? RegExp.$1 : desc;\n}", "async function getSummary () {\n try {\n return (await axios.get(`${backendAPI}/tracker/summary`)).data;\n } catch (error) {\n throw generateError(error);\n }\n }", "getSummary() {\n return {\n uuid: this.uuid,\n downloadPath: this.downloadPath,\n type: this.type,\n name: this.name,\n size: this.size,\n completeSize: this.completeSize,\n count: this.count,\n finishCount: this.finishCount,\n restTime: this.restTime,\n finishDate: this.finishDate,\n trsType: this.trsType,\n state: this.state,\n pause: this.pause,\n speed: this.speed\n }\n }", "function getSummary(artwork){\n return `<li>${artwork.name} by ${artwork.artist}</li>`;\n}", "fetchSummary() {\n return this.makeRequest('summary')\n }", "function summary(iRuntime, oTest) {\n\t\t\tvar oElement, iMinutes, iSeconds, sText;\n\n\t\t\tfunction count(iCount, sWhat) {\n\t\t\t\treturn iCount ? \", \" + iCount + \" \" + sWhat : \"\";\n\t\t\t}\n\n\t\t\tif (oTest) {\n\t\t\t\toTotal.testCounts.failed += oTest.testCounts.failed;\n\t\t\t\toTotal.testCounts.skipped += oTest.testCounts.skipped;\n\t\t\t\toTotal.testCounts.todo += oTest.testCounts.todo;\n\t\t\t\toTotal.testCounts.total += oTest.testCounts.total;\n\t\t\t} else {\n\t\t\t\toTest = oTotal;\n\t\t\t}\n\t\t\tiRuntime = Math.round(iRuntime / 1000);\n\t\t\tiMinutes = Math.floor(iRuntime / 60);\n\t\t\tiSeconds = iRuntime - iMinutes * 60;\n\t\t\tsText = \": \" + oTest.testCounts.total + \" tests in \"\n\t\t\t\t+ (iMinutes ? iMinutes + \" min \" : \"\")\n\t\t\t\t+ iSeconds + \" sec\"\n\t\t\t\t+ count(oTest.testCounts.failed, \"failed\")\n\t\t\t\t+ count(oTest.testCounts.skipped, \"skipped\")\n\t\t\t\t+ count(oTest.testCounts.todo, \"todo\")\n\t\t\t\t+ \" \";\n\n\t\t\toTest.infoNode.data = sText;\n\n\t\t\tif (oTest.url) {\n\t\t\t\toTest.icon.appendChild(\n\t\t\t\t\tdocument.createTextNode(oTest.testCounts.failed ? \"\\u2716\" : \"\\u2714\"));\n\t\t\t\toElement = document.createElement(\"a\");\n\t\t\t\toElement.setAttribute(\"href\", oTest.url);\n\t\t\t\toElement.setAttribute(\"target\", \"_blank\");\n\t\t\t\toElement.appendChild(document.createTextNode(\"Rerun\"));\n\t\t\t\toTest.element.appendChild(oElement);\n\t\t\t\tif (!oTest.testCounts.failed || !mLastRun[oTest.text]) {\n\t\t\t\t\tmLastRun[oTest.text] = iRuntime;\n\t\t\t\t}\n\t\t\t}\n\t\t}", "getAsString() { \r\n if(!Lang.isNull(this.staging)) { \r\n if((Lang.isNull(this.staging.tumorSize) || Lang.isUndefined(this.staging.tumorSize)) &&\r\n (Lang.isNull(this.staging.nodeSize) || Lang.isUndefined(this.staging.nodeSize)) &&\r\n (Lang.isNull(this.staging.metastasis) || Lang.isUndefined(this.staging.metastasis)))\r\n {\r\n return `#staging`;\r\n } else { \r\n const tString = this.getTumorSizeString(this.staging);\r\n const nString = this.getNodeSizeString(this.staging);\r\n const mString = this.getMetastasisString(this.staging);\r\n // Don't put any spaces -- the spaces should be dictated by the current reason and date\r\n return `#staging[T${tString}N${nString}M${mString}]`;\r\n }\r\n }\r\n }", "function logstat(statistic) {\n let txt='';\n Log(\"Шел год \" + generation,\"gen\"); // \"Generation \"\n txt+=statTxt(`На планете всего было существ`,`начало`, allCreatures.length,statistic.female,statistic.male);\n if (allCreatures.length>0) txt+=`Из них: `\n txt+=statTxt(`Деревянн`,``,statistic.wood,statistic.woodFem,statistic.woodMale);\n txt+=statTxt(`Стальн`,``,statistic.steel,statistic.steelFem,statistic.steelMale);\n txt+=statTxt(`Духовн`,``,statistic.spirit,statistic.spiritFem,statistic.spiritMale);\n if ((statistic.water>statistic.waterIce&&statistic.waterIce>0)||\n (statistic.water>statistic.waterLiquid&&statistic.waterLiquid>0)||\n (statistic.water>statistic.waterSream&&statistic.waterSream>0)) \n {txt+=statTxt(`Водян`,``,statistic.water,statistic.waterFem,statistic.waterMale); txt+` А из водяных существ:`}\n else if (statistic.water>0) {txt+=`Водно-`}\n txt+=statTxt(`Ледян`,``,statistic.waterIce,statistic.waterIceFem,statistic.waterIceMale);\n txt+=statTxt(`Жидк`,``,statistic.waterLiquid,statistic.waterLiquidFem,statistic.waterLiquidMale);\n txt+=statTxt(`Парообразн`,``,statistic.waterSream,statistic.waterSreamFem,statistic.waterSreamMale);\n Log(txt,\"stat\"); \n/* `All-${allCreatures.length} f-${statistic.female}/m-${statistic.male}\nWood-${statistic.wood} f-${statistic.woodFem}/m-${statistic.woodMale}\nSteel-${statistic.steel} f-${statistic.steelFem}/m-${statistic.steelMale}\nSpirit-${statistic.spirit} f-${statistic.spiritFem}/m-${statistic.spiritMale}\nWater-${statistic.water} f-${statistic.waterFem}/m-${statistic.waterMale}\nIce water-${statistic.waterIce} f-${statistic.waterIceFem}/m-${statistic.waterIceMale}\nLiquid water-${statistic.waterLiquid} f-${statistic.waterLiquidFem}/m-${statistic.waterLiquidMale}\nWaterSream-${statistic.waterSream} f-${statistic.waterSreamFem}/m-${statistic.waterSreamMale}\n`*/\n}", "getInfo() {\n return `${super.getInfo()} Their average grade is ${this.getAverageGrades()}`\n }", "describeKimfer() {\n return `Meet ${this.name}! He has ${this.health} health points and a strength of ${this.strength}. He have ${this.xp} experience points`;\n }", "function printFighter1Stats(x){\n let fighterStats = `<div style=\"border: 1px dotted black; border-radius: 25px; padding: 10px; margin-top:10px; background-color: lightgrey;\">${x.name} the ${x.title} weighs ${x.weight} pounds, would rather be ${x.preferences}, and, like all tiny sociopaths who poop in a box, always has a ${x.attitude} attitude. ${x.name} commands an indentured servant named ${x.indenturedServant}, who has kindly provided ${x.name} with <span style=\"color:red; font-weight: bolder\">${x.hasCans}</span> cans.</div>`\n $(\"#fighter1stats\").html(fighterStats);\n $('#fighter1pic').removeClass('hidden').attr('src', x.image);\n }", "function tooltipString(d) {\n strHtml = \"<strong class='title'> \" + d.data.name + \"</strong>\" +\n \"<hr /> \" +\n \"<span class='funds'> $\" + cashFormat(d.data.funds) +\n \"</span> <br/>\" +\n \"<span class='percent'> \" + percentFormat(d.data.percent*100) +\n \"% of taxes paid.</span>\"\n return strHtml;\n}", "printScore() {\n if (this.gameOver()) {\n return `${this.getLeadingPlayer()} wins the game`;\n }\n if (this.deuce()) {\n return 'Deuce';\n }\n if (this.inAdvantage()) {\n return `${this.getLeadingPlayer()} has the advantage`;\n }\n return `Score is ${this.scoreNames[this.playerOneScore]} - ${this.scoreNames[this.playerTwoScore]}`;\n }", "function summary() {\n resetTimer();\n TEXTAREA.setAttribute(\"disabled\", \"true\");\n var result = \"Misspelled words = \" + misspelledWordsCount + \" WPM = \" + wpm;\n SUMMARY.querySelector(\"#statistics\").innerHTML = result;\n SUMMARY.style.display = \"block\";\n}", "function GGTRCC_RenderBattingSummary (aPLSO, aBattingGraphInfo)\r\n{\r\n\tvar lRet=\"\";\r\n\t\r\n\tlRet += \"<span class='GadgetStatsHeading'>Career Batting Summary</span>\";\r\n\t\t\r\n\tif (0 == aBattingGraphInfo.length)\r\n\t{\r\n\t\tlRet += \"<br>There is no Batting record for this player<br><br>\";\r\n\t}\r\n\telse\r\n\t{\r\n\t\t//\r\n\t\t// Do we have enough entries to warrent a graph?\r\n\t\t//\r\n\t\tif (1 < aBattingGraphInfo.length)\r\n\t\t{\r\n\t\t\tlRet += GGTRCC_PlayerLTGraph_MakeBattingGraphHTML (aBattingGraphInfo) + \"<br><br>\";\r\n\t\t}\r\n\t\t\t\r\n\t\tlRet += GGTRCC_RenderBattingTotals (aPLSO.mLifetimeBattingTotals) + \"<br><br><br>\";\r\n\t}\r\n\r\n\treturn (lRet);\r\n}", "getFullReviewedStats() {\n if (this.state.reviewStats === undefined) {\n return '';\n }\n // Map each review stat to a formatted line.\n let reviews = Object.keys(this.state.reviewStats).map((reviewer) =>\n <p key={reviewer}>{reviewer}: {this.state.reviewStats[reviewer].totalReviewed} / {this.state.reviewStats[reviewer].totalAssigned}</p>);\n reviews.push(<p key='total'>\n Total: {Object.values(this.state.reviewStats).reduce((total, review) => total + review.totalReviewed, 0)} / {Object.values(this.state.reviewStats).reduce((total, review) => total + review.totalAssigned, 0)}\n </p>)\n return reviews\n }", "function profileInfo(object) {\nlet string = `${capitalizeWord(object.name)} is a ${capitalizeWord(object.species)}`;\nreturn string;\n}", "function createSummary(summary) {\n summary.toString()\n if(summary != \"\") {\n var first = true;\n var endIndex = 0;\n for(let i = 0; i < summary.length; i++) {\n \n // Find the first sentence and stop\n if(summary.charAt(i) == \".\") {\n \n // All corporations will have an initial . in their corporation name hence we can skip it to get to the first sentence\n if(first != true) {\n endIndex = i;\n break;\n }\n \n // Replacing the , will remove the commas used in the listed corporation name\n summary = summary.substr(0,i).replace(\",\",\"\").concat(summary.substr(i));\n first = false;\n }\n }\n summary = summary.substr(0,endIndex).concat(\".\");\n }\n return summary;\n}", "function summary(s) {\n var max = getMax(s);\n var min = getMin(s);\n document.getElementById(\"cloud_stat\").innerHTML =\"Summary: \" + \"<br><br><br>\" + \"Maximum number of occurence: \" + max + \"<br>\" + \"Minimim number of occurence: \" + min;\n}", "@computed\n get stat() {\n const { valueName, decimals = 0, format: unitFormat } = this.config\n const { metrics } = this\n const metricsLength = this.metrics.length\n\n if (metricsLength > 1) {\n return 'Only queries that return single series/table is supported'\n }\n\n if (metricsLength === 0) {\n return 'No Data'\n }\n\n /**\n * values: number[]\n */\n const values = get(metrics, '0.values', []).map(([, value]) =>\n Number(value)\n )\n\n const handler = NAME_VALUE_HANDLE_MAP[valueName] || avgs\n const number = handler(values) || 0\n const format = unitTransformMap[unitFormat] || unitTransformMap.none\n return format(number, decimals)\n }", "function renderedStatsHTML(rcReport) {\n var stats = rcReport.stats;\n var finalHTML = \"\";\n Object.keys(stats).forEach(function(key) {\n finalHTML += STAT_RENDERERS[key](stats[key]);\n });\n return finalHTML;\n}", "function generateStatOptionsString() {\n for (let arr in statList) {\n let full = statList[arr][0];\n statOptionsString += `<option>${full}</option>`;\n }\n}", "function printMessage(summary) {\n var message = \"The weather is currently \" + summary;\n console.log(message);\n}", "function getSummaryReport() {\n var result;\n result = {\n table: {\n widths: ['*'],\n body: [\n [{\n text: 'DILAPIDATION SURVEY REPORT SUMMARY',\n style: 'tableHeader'\n }],\n [{\n text: getIt('surveyReportSummary'),\n style: 'tableText'\n }]\n ]\n }\n };\n return result;\n}", "function showTextSummary(data) {\n var paragraphs = [\n assembleTraits(data.tree.children[0]),\n assembleFacets(data.tree.children[0]),\n assembleNeeds(data.tree.children[1]),\n assembleValues(data.tree.children[2])\n ];\n var div = $('.summary-div');\n div.empty();\n paragraphs.forEach(function(sentences) {\n sentences = pluralize(sentences.join(' '));\n $('<p></p>').text(sentences).appendTo(div);\n });\n}", "function sendStats() {\n client.publish(\"/internal/meta/statistics\", {\n source: sourceId,\n stats: {\n connections: connections,\n wsConnections: wsConnections\n }\n });\n }", "function ShowStats($element) {\n switch ($element.data('health')) {\n case 150: $element.find('.DEFstats').text('DEF: +1')\n break;\n case 100: $element.find('.DEFstats').text('DEF: +0')\n break;\n case 50: $element.find('.DEFstats').text('DEF: -1')\n break;\n }\n switch ($element.data('counter')) {\n case 15: $element.find('.ATKstats').text('ATK: +1')\n break;\n case 10: $element.find('.ATKstats').text('ATK: +0')\n break;\n case 5: $element.find('.ATKstats').text('ATK: -1')\n break;\n }\n}", "getInfo() {\n return `${super.getInfo()} Their average students grade is ${this.getAverageGrades()}`\n \n }", "function formatSummary(summary) {\n if (summary) {\n summary = summary.replace('<p>', '').replace('</p>', '').replace('<b>', '').replace('</b>', '');\n return `${summary.substring(0, 283)}...`;\n }\n\n }", "function generateStats(schema, opts) {\n opts = opts || {};\n\n let type = avro.parse(schema, {wrapUnions: opts.wrapUnions});\n return [DecodeSuite, EncodeSuite].map((Suite) => {\n let stats = [];\n let suite = new Suite(type, opts)\n .on('start', () => { console.error(Suite.key_ + ' ' + type); })\n .on('cycle', (evt) => { console.error('' + evt.target); })\n .run();\n stats.push({\n value: suite.getValue(),\n stats: suite.map((benchmark) => {\n let stats = benchmark.stats;\n return {\n name: benchmark.name,\n mean: stats.mean,\n rme: stats.rme\n };\n })\n });\n return {name: Suite.key_, stats};\n });\n}", "static buildFooter(item) {\n let stats = [];\n for (let statName in item.stats) {\n let statValue = item.stats[statName];\n stats.push(`${statName}: ${statValue}`);\n }\n return stats.join(', ');\n }", "function profileInfo (obj) {\n\n \n return capitalizeWord(obj.name) + ' is a ' + capitalizeWord(obj.species);\n \n}", "addStats(currentStat) {\n let score = 0;\n let topItemsForSlots = this.props.topItemsForSlots;\n let slotTitles = [\"head\", \"cape\", \"neck\", \"weapon\", \"body\", \"shield\", \"legs\", \"hands\", \"feet\", \"ring\"];\n for (let i = 0; i < slotTitles.length; i++) {\n let currentItem = topItemsForSlots[slotTitles[i]][0];\n if (!currentItem) {\n continue;\n }\n score += currentItem.stats[currentStat.statCategory][currentStat.attackStyle];\n }\n return score.toString();\n }", "function peopleStats(){\n\n\t//Categories: alone, core, acquaintances, strangers, colleagues [for starters, let's group singular and plural instances - eg: colleague and colleagues to see what that data looks like]\n\n\t//Most frequently w/: \n\n\t//Greatest happiness on avg. for time range with, if available, must be 3 times to ensure that it isn't an outlier, when user is with...\n\n\t//Lowest aliveness w/\n\n}", "function getStats() {\n let timestamp = new Date(Date.now());\n let dateTime = timestamp.toDateString() + \" \" + timestamp.toLocaleTimeString()\n return dateTime;\n}", "function populateTestSummary( locator, response ) {\n var content = '<span id=\"summary\">';\n content += '<span id=\"scenarioCount\" class=\"summary\">' + response.summary.total + ' Scenarios</span>';\n content += ' (<span id=\"scenarioCount\" class=\"summary pass\">' + response.summary.passed + ' Passed</span>';\n content += ', <span id=\"scenarioCount\" class=\"summary fail\">' + response.summary.failed + ' Failed</span>';\n content += ', <span id=\"scenarioCount\" class=\"summary skip\">' + response.summary.skipped + ' Skipped</span>)';\n content += '</span>';\n $(locator).html(content);\n}", "get unitFormatted() {\r\n\t\treturn this.count > 1 ? this.unit + 's' : this.unit;\r\n\t}", "function outputDeviceSummary(){\n console.log(\"============================\");\n console.log(\"Power: \" + pCurrent);\n console.log(\"Mode: \" + mCurrent);\n console.log(\"============================\");\n}", "quickFacts(){\n console.log(`${this.name} educates ${this.numberOfStudents} students at the ${this.level} level.`);\n }", "function Stats(props) {\n return (\n <table id=\"Stats-table\">\n <tr>\n <td>Name:</td>\n <td>{props.Name}</td>\n </tr>\n <tr>\n <td>Level:</td>\n <td>2</td>\n </tr>\n <tr>\n <td>Job:</td>\n <td>Dog Walker</td>\n </tr>\n <tr>\n <td>Balance:</td>\n <td>$65.70</td>\n </tr>\n </table>\n );\n}", "function stringCPUData(latestCPUEvent) {\n var content = '';\n content += '# HELP os_cpu_used_ratio The ratio of the systems CPU that is currently used (values are 0-1)\\n';\n content += '# TYPE os_cpu_used_ratio gauge\\n';\n content += 'os_cpu_used_ratio ' + latestCPUEvent.system + '\\n';\n content += '# HELP process_cpu_used_ratio The ratio of the process CPU that is currently used (values are 0-1)\\n';\n content += '# TYPE process_cpu_used_ratio gauge\\n';\n content += 'process_cpu_used_ratio ' + latestCPUEvent.process;\n return content;\n}", "toHumanString() {\n if (this.amount === 0) {\n return fmtUnit(0, this.unit);\n }\n if (constructs_1.Token.isUnresolved(this.amount)) {\n return `<token> ${this.unit.label}`;\n }\n let millis = convert(this.amount, this.unit, TimeUnit.Milliseconds, { integral: false });\n const parts = new Array();\n for (const unit of [TimeUnit.Days, TimeUnit.Hours, TimeUnit.Hours, TimeUnit.Minutes, TimeUnit.Seconds]) {\n const wholeCount = Math.floor(convert(millis, TimeUnit.Milliseconds, unit, { integral: false }));\n if (wholeCount > 0) {\n parts.push(fmtUnit(wholeCount, unit));\n millis -= wholeCount * unit.inMillis;\n }\n }\n // Remainder in millis\n if (millis > 0) {\n parts.push(fmtUnit(millis, TimeUnit.Milliseconds));\n }\n // 2 significant parts, that's totally enough for humans\n return parts.slice(0, 2).join(' ');\n function fmtUnit(amount, unit) {\n if (amount === 1) {\n // All of the labels end in 's'\n return `${amount} ${unit.label.substring(0, unit.label.length - 1)}`;\n }\n return `${amount} ${unit.label}`;\n }\n }", "function summarizeExample(example) {\n return example.tweet_input.substring(0, 60);\n}", "getSummary() {\n return this.request.get('tenants-summary');\n }", "function generateMessage() {\n return Object.keys(attacks).map(name => {\n const attack = attacks[name];\n return `**${name}**\\nDamage: \\`${attack.damage.min}-${attack.damage.max}\\`\\nAccuracy: \\`${Math.floor(attack.attackChance * 100)}%\\``;\n }).join('\\n\\n');\n}", "function toText(inst){\n var shownText = inst[\"value\"][\"shortName\"] + \" - \" + inst[\"value\"][\"fullName\"] + \n \"\\nTotal Launches: \"+inst[\"value\"][\"Total\"] + \n \"\\nSuccess: \"+inst[\"value\"][\"Success\"] + \n \"\\nFailure: \"+inst[\"value\"][\"Failure\"]+\n \"\\nUnknown: \"+inst[\"value\"][\"Unknown\"]+\n \"\\nPad Explosion: \"+inst[\"value\"][\"Pad Explosion\"]\n return shownText\n}", "build() {\n\n\t\tlet evString = '';\n\t\tObject.keys(this.evs).forEach(stat => {\n\t\t\tif(this.evs[stat] > 0) {\n\t\t\t\tevString += this.evs[stat] + ' ' + stat + ' / '\n\t\t\t}\n\t\t});\n\n\t\tlet ivString = '';\n\t\tObject.keys(this.ivs).forEach(stat => {\n\t\t\tif(this.ivs[stat] < 31) {\n\t\t\t\tivString += this.ivs[stat] + ' ' + stat + ' / '\n\t\t\t}\n\t\t});\n\n\t\treturn this.name + ' @ ' + this.item + '\\n' +\n\t\t\t'Ability: ' + this.ability + '\\n' +\n\t\t\t'Level: ' + this.level + '\\n' + \n\t\t\t'EVs: ' + evString + '\\n' + \n\t\t\tthis.nature + ' Nature\\n' +\n\t\t\t'IVs: ' + ivString + '\\n' +\n\t\t\t'- ' + this.moves[0] + '\\n' + \n\t\t\t'- ' + this.moves[1] + '\\n' + \n\t\t\t'- ' + this.moves[2] + '\\n' + \n\t\t\t'- ' + this.moves[3] + '\\n';\n\t\t\t\n\t}", "setSearchResultsSummaryMsg() {\n if (this.searchResultsGenes.length === 0 && this.searchResultsStudies.length === 0) {\n this.searchResultsSummary = \"\";\n }\n else {\n if (this.searchResultsStudies.length === 1) {\n this.searchResultsSummary = this.searchResultsStudies.length + \" matching study found.\";\n }\n else if (this.searchResultsStudies.length > 1) {\n this.searchResultsSummary = this.searchResultsStudies.length + \" matching studies found.\";\n }\n else {\n this.searchResultsSummary = \"\";\n }\n }\n }", "function updateSummaryContent(mostCritViolated, mostNonCritViolated, totalCritViolations, totalNonCritViolations, totalItems) {\n $(\"#mostcritical\").html(mostCritViolated.name + \" (\" + mostCritViolated.inspections[0][\"critical-violations\"] + \")\");\n $(\"#mostnoncritical\").html(mostNonCritViolated.name + \" (\" + mostNonCritViolated.inspections[0][\"non-critical-violations\"] + \")\");\n $(\"#avgcritviolations\").html((totalCritViolations / totalItems).toFixed(2));\n $(\"#avgnoncritviolations\").html((totalNonCritViolations / totalItems).toFixed(2));\n\n}", "function buildSeriesInfoString(dataSeries) {\n return (dataSeries.name ? dataSeries.name + ', ' : '') +\n 'series ' + (dataSeries.index + 1) + ' of ' + (dataSeries.chart.series.length) + '. ' +\n (chartTypes.length > 1 && dataSeries.type ? dataSeries.type + ' series with ' : '') +\n (dataSeries.points.length + ' points. ') +\n (dataSeries.description ? dataSeries.description : '') +\n (numYAxes > 1 && dataSeries.yAxis ? 'Y axis = ' + getAxisLabel(dataSeries.yAxis) : '') +\n (numXAxes > 1 && dataSeries.xAxis ? 'X axis = ' + getAxisLabel(dataSeries.xAxis) : '');\n }", "renderSummary() {\n return null;\n }", "function showTextSummary(data) {\n console.log('showTextSummary()');\n var paragraphs = [\n assembleTraits(data.tree.children[0]),\n assembleFacets(data.tree.children[0]),\n assembleNeeds(data.tree.children[1]),\n assembleValues(data.tree.children[2])\n ];\n var div = $('.summary-div');\n div.empty();\n paragraphs.forEach(function(sentences) {\n $('<p></p>').text(sentences.join(' ')).appendTo(div);\n });\n }", "function summary(kcal, price) {\n return {\n type: 'SUMMARY',\n payload: { kcal, price },\n };\n}", "constructStats() {\n\t\tlet pstats = document.querySelector(\".player-stats\");\n\n\t\tlet statsArea = document.querySelector(\".stat-area\");\n\t\tlet dmg = document.createElement(\"div\");\n\t\tdmg.classList.add(\"dmg\");\n\t\tdmg.innerHTML = \"Damage Dealt: \" + this.dmgDealt;\n\t\tstatsArea.insertBefore(dmg, pstats.nextSibling);\n\n\t\tlet mone = document.createElement(\"div\");\n\t\tmone.classList.add(\"mone\");\n\t\tmone.innerHTML = \"Total Earned: \" + this.moneyEarned + \"gp\";\n\t\tstatsArea.insertBefore(mone, dmg.nextSibling);\n\n\t\tlet numK = document.createElement(\"div\");\n\t\tnumK.classList.add(\"numK\");\n\t\tnumK.innerHTML = \"Killed: \" + this.numKilled;\n\t\tstatsArea.insertBefore(numK, mone.nextSibling);\n\n\t\tlet setUpUpgradeStats = document.createElement(\"div\");\n\t\tsetUpUpgradeStats.classList.add(\"upgrade-stats\");\n\t\tsetUpUpgradeStats.innerHTML = \"Your Upgrades\";\n\t\tstatsArea.insertBefore(setUpUpgradeStats, numK.nextSibling);\n\t}", "ToString() {\n console.log(`date: ${this.timeStamp}, temp: ${this.temperature}, direction: ${this.windDirection}, speed: ${this.windSpeed}, cloudCover: ${this.cloudCover}.`);\n }", "printStudentInfo(){\n console.log(`Student ${this.name} has an average grade of ${this.averageGrade} `);\n }", "toString() {\n\t\tlet difference;\n\t\tif (this.options && this.options.ms) {\n\t\t\tdifference = this.toMs(this.difference);\n\t\t} else {\n\t\t\tdifference = `${this.difference} ms`;\n\t\t}\n\t\treturn `Timer took ${difference}`;\n\t}", "function formatCurrentlySummary(currently_summary) {\n\t// Makes just the first letter of the currently summary uppercase\n\tvar currently_summary = currently_summary.toLowerCase();\n\t\n\treturn currently_summary.charAt(0).toUpperCase() + currently_summary.slice(1) + '. ';\n}" ]
[ "0.6924805", "0.6710903", "0.66036415", "0.6552633", "0.65403825", "0.6505533", "0.649645", "0.6466235", "0.6238974", "0.61482453", "0.6139148", "0.6127768", "0.6111689", "0.6081211", "0.6080632", "0.6036702", "0.6016276", "0.60069704", "0.59935814", "0.5946005", "0.5912547", "0.5888442", "0.58821625", "0.587203", "0.58544534", "0.5850199", "0.5839743", "0.57974553", "0.57954025", "0.5792797", "0.5791388", "0.5780899", "0.5764673", "0.57298654", "0.57148206", "0.57102865", "0.57055074", "0.57027316", "0.569895", "0.56777793", "0.5669313", "0.56489503", "0.5636316", "0.5635279", "0.561912", "0.5607452", "0.560202", "0.5581746", "0.5557254", "0.5553726", "0.55139834", "0.55092424", "0.54986656", "0.54972184", "0.54938823", "0.5490131", "0.54800326", "0.5476578", "0.5465335", "0.54641414", "0.54623485", "0.54541177", "0.5440487", "0.5434837", "0.5424862", "0.54209", "0.5414384", "0.5392374", "0.5389006", "0.53675824", "0.5364763", "0.5354359", "0.535171", "0.53455085", "0.5344287", "0.5315138", "0.53145254", "0.5296441", "0.52905196", "0.5281782", "0.5281099", "0.52782637", "0.5271908", "0.526427", "0.5262809", "0.5261332", "0.5260912", "0.5250851", "0.5242979", "0.5238782", "0.52244127", "0.52123696", "0.5212325", "0.52111644", "0.5209587", "0.52080595", "0.5206118", "0.5191717", "0.5181818", "0.51768714" ]
0.7833077
0
vuerouter v3.0.1 (c) 2017 Evan You
function i(t,e){0}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jj(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"source.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function TM(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function vT(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"layer.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "vampireWithName(name) {\n \n }", "function Uk(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function BO(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function Es(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function VI(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"layer.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function iP(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"source.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function Qw(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function fyv(){\n \n }", "function Vt(){this.__data__=[]}", "function VO(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};VO.installed||(VO.installed=!0,t.use(i,e),t.use(r,e),t.use(o,e),t.use(a,e),t.use(s,e),t.use(u,e),t.use(l,e),t.use(c,e),t.use(d,e),t.use(h,e),t.use(f,e),t.use(p,e),t.use(m,e),t.use(v,e),t.use(g,e),t.use(_,e),t.use(y,e),t.use(b,e),t.use(x,e),t.use(w,e),t.use(A,e),t.use(M,e),t.use(S,e),t.use(T,e),t.use(k,e),t.use(O,e),t.use(C,e),t.use(L,e),t.use(E,e),t.use(D,e),t.use(j,e),t.use(I,e),t.use(P,e),t.use(Y,e),t.use(F,e),t.use(R,e),t.use(N,e),t.use(B,e),t.use($,e),t.use(z,e),t.use(H,e),t.use(V,e),t.use(G,e))}", "function Ak(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function cO(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function Wx(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function version(){ return \"0.13.0\" }", "function SigV4Utils() { }", "function Rb(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function yh(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"graticule.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function jx(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function ow(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function Ek(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function uf(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"layer.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "private public function m246() {}", "added(vrobject){}", "function PD(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function dp(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function Mv(){var t=this;ci()(this,{$source:{enumerable:!0,get:function(){return t.$olObject}},$map:{enumerable:!0,get:function(){return t.$services&&uu()(t.$services)}},$view:{enumerable:!0,get:function(){return t.$services&&t.$services.view}},$sourceContainer:{enumerable:!0,get:function(){return t.$services&&t.$services.sourceContainer}}})}", "function vI(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"style.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "InitVsaEngine() {\n\n }", "upgrade() {}", "function vinewx(t=\"untitled\",s=!1){return new class{constructor(t,s){this.name=t,this.debug=s,this.isQX=\"undefined\"!=typeof $task,this.isLoon=\"undefined\"!=typeof $loon,this.isSurge=\"undefined\"!=typeof $httpClient&&!this.isLoon,this.isNode=\"function\"==typeof require,this.isJSBox=this.isNode&&\"undefined\"!=typeof $jsbox,this.node=(()=>this.isNode?{request:\"undefined\"!=typeof $request?void 0:require(\"request\"),fs:require(\"fs\")}:null)(),this.cache=this.initCache(),this.log(`INITIAL CACHE:\\n${JSON.stringify(this.cache)}`),Promise.prototype.delay=function(t){return this.then(function(s){return((t,s)=>new Promise(function(e){setTimeout(e.bind(null,s),t)}))(t,s)})}}get(t){return this.isQX?(\"string\"==typeof t&&(t={url:t,method:\"GET\"}),$task.fetch(t)):new Promise((s,e)=>{this.isLoon||this.isSurge?$httpClient.get(t,(t,i,o)=>{t?e(t):s({status:i.status,headers:i.headers,body:o})}):this.node.request(t,(t,i,o)=>{t?e(t):s({...i,status:i.statusCode,body:o})})})}post(t){return this.isQX?(\"string\"==typeof t&&(t={url:t}),t.method=\"POST\",$task.fetch(t)):new Promise((s,e)=>{this.isLoon||this.isSurge?$httpClient.post(t,(t,i,o)=>{t?e(t):s({status:i.status,headers:i.headers,body:o})}):this.node.request.post(t,(t,i,o)=>{t?e(t):s({...i,status:i.statusCode,body:o})})})}initCache(){if(this.isQX)return JSON.parse($prefs.valueForKey(this.name)||\"{}\");if(this.isLoon||this.isSurge)return JSON.parse($persistentStore.read(this.name)||\"{}\");if(this.isNode){const t=`${this.name}.json`;return this.node.fs.existsSync(t)?JSON.parse(this.node.fs.readFileSync(`${this.name}.json`)):(this.node.fs.writeFileSync(t,JSON.stringify({}),{flag:\"wx\"},t=>console.log(t)),{})}}persistCache(){const t=JSON.stringify(this.cache);this.log(`FLUSHING DATA:\\n${t}`),this.isQX&&$prefs.setValueForKey(t,this.name),(this.isLoon||this.isSurge)&&$persistentStore.write(t,this.name),this.isNode&&this.node.fs.writeFileSync(`${this.name}.json`,t,{flag:\"w\"},t=>console.log(t))}write(t,s){this.log(`SET ${s} = ${JSON.stringify(t)}`),this.cache[s]=t,this.persistCache()}read(t){return this.log(`READ ${t} ==> ${JSON.stringify(this.cache[t])}`),this.cache[t]}delete(t){this.log(`DELETE ${t}`),delete this.cache[t],this.persistCache()}notify(t,s,e,i){const o=\"string\"==typeof i?i:void 0,n=e+(null==o?\"\":`\\n${o}`);this.isQX&&(void 0!==o?$notify(t,s,e,{\"open-url\":o}):$notify(t,s,e,i)),this.isSurge&&$notification.post(t,s,n),this.isLoon&&$notification.post(t,s,e),this.isNode&&(this.isJSBox?require(\"push\").schedule({title:t,body:s?s+\"\\n\"+e:e}):console.log(`${t}\\n${s}\\n${n}\\n\\n`))}log(t){this.debug&&console.log(t)}info(t){console.log(t)}error(t){console.log(\"ERROR: \"+t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){this.isQX||this.isLoon||this.isSurge?$done(t):this.isNode&&!this.isJSBox&&\"undefined\"!=typeof $context&&($context.headers=t.headers,$context.statusCode=t.statusCode,$context.body=t.body)}}(t,s)}", "function r(t,e,n){if(a(t,e))return void(t[e]=n);if(t._isVue)return void r(t._data,e,n);var i=t.__ob__;if(!i)return void(t[e]=n);if(i.convert(e,n),i.dep.notify(),i.vms)for(var s=i.vms.length;s--;){var o=i.vms[s];o._proxy(e),o._digest()}return n}", "function $S(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function EN(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"layer.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function iT(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"layer.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function Bv(e){let{basename:t,children:n,window:r}=e,l=X.exports.useRef();l.current==null&&(l.current=gv({window:r}));let o=l.current,[i,u]=X.exports.useState({action:o.action,location:o.location});return X.exports.useLayoutEffect(()=>o.listen(u),[o]),X.exports.createElement(Fv,{basename:t,children:n,location:i.location,navigationType:i.action,navigator:o})}", "function WD(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "constructor() { \n \n Souvenir.initialize(this);\n }", "function i(t,e,n){if(o(t,e))return void(t[e]=n);if(t._isVue)return void i(t._data,e,n);var r=t.__ob__;if(!r)return void(t[e]=n);if(r.convert(e,n),r.dep.notify(),r.vms)for(var s=r.vms.length;s--;){var a=r.vms[s];a._proxy(e),a._digest()}return n}", "function zC(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"layer.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function Visitor(q,v){function y(a){function c(a,d,c){c=c?c+=\"|\":c;return c+(a+\"=\"+encodeURIComponent(d))}for(var b=\"\",e=0,f=a.length;e<f;e++){var g=a[e],h=g[0],g=g[1];g!=i&&g!==t&&(b=c(h,g,b))}return function(a){var d=(new Date).getTime(),a=a?a+=\"|\":a;return a+(\"TS=\"+d)}(b)}if(!q)throw\"Visitor requires Adobe Marketing Cloud Org ID\";var a=this;a.version=\"1.9.1\";var m=window,l=m.Visitor;l.version=a.version;m.s_c_in||(m.s_c_il=[],m.s_c_in=0);a._c=\"Visitor\";a._il=m.s_c_il;a._in=m.s_c_in;a._il[a._in]=a;m.s_c_in++;a.ja={Fa:[]};var u=m.document,i=l.Cb;i||(i=null);var E=l.Db;E||(E=void 0);var j=l.Oa;j||(j=!0);var k=l.Ma;k||(k=!1);a.fa=function(a){var c=0,b,e;if(a)for(b=0;b<a.length;b++)e=a.charCodeAt(b),c=(c<<5)-c+e,c&=c;return c};a.s=function(a,c){var b=\"0123456789\",e=\"\",f=\"\",g,h,i=8,k=10,l=10;c===n&&(w.isClientSideMarketingCloudVisitorID=j);if(1==a){b+=\"ABCDEF\";for(g=0;16>g;g++)h=Math.floor(Math.random()*i),e+=b.substring(h,h+1),h=Math.floor(Math.random()*i),f+=b.substring(h,h+1),i=16;return e+\n\"-\"+f}for(g=0;19>g;g++)h=Math.floor(Math.random()*k),e+=b.substring(h,h+1),0==g&&9==h?k=3:(1==g||2==g)&&10!=k&&2>h?k=10:2<g&&(k=10),h=Math.floor(Math.random()*l),f+=b.substring(h,h+1),0==g&&9==h?l=3:(1==g||2==g)&&10!=l&&2>h?l=10:2<g&&(l=10);return e+f};a.Ra=function(){var a;!a&&m.location&&(a=m.location.hostname);if(a)if(/^[0-9.]+$/.test(a))a=\"\";else{var c=a.split(\".\"),b=c.length-1,e=b-1;1<b&&2>=c[b].length&&(2==c[b-1].length||0>\",ac,ad,ae,af,ag,ai,al,am,an,ao,aq,ar,as,at,au,aw,ax,az,ba,bb,be,bf,bg,bh,bi,bj,bm,bo,br,bs,bt,bv,bw,by,bz,ca,cc,cd,cf,cg,ch,ci,cl,cm,cn,co,cr,cu,cv,cw,cx,cz,de,dj,dk,dm,do,dz,ec,ee,eg,es,et,eu,fi,fm,fo,fr,ga,gb,gd,ge,gf,gg,gh,gi,gl,gm,gn,gp,gq,gr,gs,gt,gw,gy,hk,hm,hn,hr,ht,hu,id,ie,im,in,io,iq,ir,is,it,je,jo,jp,kg,ki,km,kn,kp,kr,ky,kz,la,lb,lc,li,lk,lr,ls,lt,lu,lv,ly,ma,mc,md,me,mg,mh,mk,ml,mn,mo,mp,mq,mr,ms,mt,mu,mv,mw,mx,my,na,nc,ne,nf,ng,nl,no,nr,nu,nz,om,pa,pe,pf,ph,pk,pl,pm,pn,pr,ps,pt,pw,py,qa,re,ro,rs,ru,rw,sa,sb,sc,sd,se,sg,sh,si,sj,sk,sl,sm,sn,so,sr,st,su,sv,sx,sy,sz,tc,td,tf,tg,th,tj,tk,tl,tm,tn,to,tp,tr,tt,tv,tw,tz,ua,ug,uk,us,uy,uz,va,vc,ve,vg,vi,vn,vu,wf,ws,yt,\".indexOf(\",\"+\nc[b]+\",\"))&&e--;if(0<e)for(a=\"\";b>=e;)a=c[b]+(a?\".\":\"\")+a,b--}return a};a.cookieRead=function(a){var a=encodeURIComponent(a),c=(\";\"+u.cookie).split(\" \").join(\";\"),b=c.indexOf(\";\"+a+\"=\"),e=0>b?b:c.indexOf(\";\",b+1);return 0>b?\"\":decodeURIComponent(c.substring(b+2+a.length,0>e?c.length:e))};a.cookieWrite=function(d,c,b){var e=a.cookieLifetime,f,c=\"\"+c,e=e?(\"\"+e).toUpperCase():\"\";b&&\"SESSION\"!=e&&\"NONE\"!=e?(f=\"\"!=c?parseInt(e?e:0,10):-60)?(b=new Date,b.setTime(b.getTime()+1E3*f)):1==b&&(b=new Date,f=b.getYear(),b.setYear(f+2+(1900>f?1900:0))):b=0;return d&&\"NONE\"!=e?(u.cookie=encodeURIComponent(d)+\"=\"+encodeURIComponent(c)+\"; path=/;\"+(b?\" expires=\"+b.toGMTString()+\";\":\"\")+(a.cookieDomain?\" domain=\"+a.cookieDomain+\";\":\"\"),a.cookieRead(d)==c):0};a.h=i;a.J=function(a,c){try{\"function\"==typeof a?a.apply(m,c):a[1].apply(a[0],c)}catch(b){}};a.Xa=function(d,c){c&&(a.h==i&&(a.h={}),a.h[d]==E&&(a.h[d]=[]),a.h[d].push(c))};a.r=function(d,c){if(a.h!=i){var b=a.h[d];if(b)for(;0<b.length;)a.J(b.shift(),c)}};a.v=function(a,c,b,e){b=encodeURIComponent(c)+\"=\"+encodeURIComponent(b);c=x.vb(a);a=x.mb(a);if(-1===a.indexOf(\"?\"))return a+\"?\"+b+c;var f=a.split(\"?\"),a=f[0]+\"?\",e=x.$a(f[1],b,e);return a+e+c};a.Qa=function(a,c){var b=RegExp(\"[\\\\?&#]\"+c+\"=([^&#]*)\").exec(a);if(b&&b.length)return decodeURIComponent(b[1])};a.Wa=function(){var d=i,c=m.location.href;try{var b=a.Qa(c,r.Z);if(b)for(var d={},e=b.split(\"|\"),c=0,f=e.length;c<f;c++){var g=e[c].split(\"=\");d[g[0]]=decodeURIComponent(g[1])}return d}catch(h){}};a.ba=function(){var d=a.Wa();if(d&&d.TS&&!(((new Date).getTime()-d.TS)/6E4>r.Ka||d[I]!==q)){var c=d[n],b=a.setMarketingCloudVisitorID;c&&c.match(r.u)&&b(c);a.j(s,-1);d=d[p];c=a.setAnalyticsVisitorID;d&&d.match(r.u)&&c(d)}};a.Va=function(d){function c(d){x.pb(d)&&a.setCustomerIDs(d)}function b(d){d=d||{};a._supplementalDataIDCurrent=d.supplementalDataIDCurrent||\"\";a._supplementalDataIDCurrentConsumed=d.supplementalDataIDCurrentConsumed||{};a._supplementalDataIDLast=d.supplementalDataIDLast||\"\";a._supplementalDataIDLastConsumed=d.supplementalDataIDLastConsumed||{}}d&&d[a.marketingCloudOrgID]&&(d=d[a.marketingCloudOrgID],c(d.customerIDs),b(d.sdid))};a.l=i;a.Ta=function(d,c,b,e){c=a.v(c,\"d_fieldgroup\",d,1);e.url=a.v(e.url,\"d_fieldgroup\",d,1);e.m=a.v(e.m,\"d_fieldgroup\",d,1);w.d[d]=j;e===Object(e)&&e.m&&\"XMLHttpRequest\"===a.la.C.D?a.la.ib(e,b,d):a.useCORSOnly||a.ia(d,c,b)};a.ia=function(d,c,b){var e=0,f=0,g;if(c&&u){for(g=0;!e&&2>g;){try{e=(e=u.getElementsByTagName(0<g?\"HEAD\":\"head\"))&&0<e.length?e[0]:0}catch(h){e=0}g++}if(!e)try{u.body&&(e=u.body)}catch(k){e=0}if(e)for(g=0;!f&&2>g;){try{f=u.createElement(0<g?\"SCRIPT\":\"script\")}catch(l){f=0}g++}}!c||!e||!f?b&&b():(f.type=\"text/javascript\",f.src=c,e.firstChild?e.insertBefore(f,e.firstChild):e.appendChild(f),e=a.loadTimeout,o.d[d]={requestStart:o.o(),url:c,ta:e,ra:o.ya(),sa:0},b&&(a.l==i&&(a.l={}),a.l[d]=setTimeout(function(){b(j)},e)),a.ja.Fa.push(c))};a.Pa=function(d){a.l!=i&&a.l[d]&&(clearTimeout(a.l[d]),a.l[d]=0)};a.ga=k;a.ha=k;a.isAllowed=function(){if(!a.ga&&(a.ga=j,a.cookieRead(a.cookieName)||a.cookieWrite(a.cookieName,\"T\",1)))a.ha=j;return a.ha};a.b=i;a.c=i;var F=l.Ub;F||(F=\"MC\");var n=l.ac;n||(n=\"MCMID\");var I=l.Yb;I||(I=\"MCORGID\");var H=l.Vb;H||(H=\"MCCIDH\");var L=l.Zb;L||(L=\"MCSYNCS\");var J=l.$b;J||(J=\"MCSYNCSOP\");var K=l.Wb;K||(K=\"MCIDTS\");var B=l.Xb;B||(B=\"MCOPTOUT\");var D=l.Sb;D||(D=\"A\");var p=l.Pb;p||(p=\"MCAID\");var C=l.Tb;C||(C=\"AAM\");var A=l.Rb;A||(A=\"MCAAMLH\");var s=l.Qb;s||(s=\"MCAAMB\");var t=l.bc;t||(t=\"NONE\");a.L=0;a.ea=function(){if(!a.L){var d=a.version;a.audienceManagerServer&&(d+=\"|\"+a.audienceManagerServer);a.audienceManagerServerSecure&&(d+=\"|\"+a.audienceManagerServerSecure);a.L=a.fa(d)}return a.L};a.ka=k;a.f=function(){if(!a.ka){a.ka=j;var d=a.ea(),c=k,b=a.cookieRead(a.cookieName),e,f,g,h,l=new Date;a.b==i&&(a.b={});if(b&&\"T\"!=b){b=b.split(\"|\");b[0].match(/^[\\-0-9]+$/)&&(parseInt(b[0],10)!=d&&(c=j),b.shift());1==b.length%2&&b.pop();for(d=0;d<b.length;d+=2)if(e=b[d].split(\"-\"),f=e[0],g=b[d+1],1<e.length?(h=parseInt(e[1],10),e=0<e[1].indexOf(\"s\")):(h=0,e=k),c&&(f==H&&(g=\"\"),0<h&&(h=l.getTime()/1E3-60)),f&&g&&(a.e(f,g,1),0<h&&(a.b[\"expire\"+f]=h+(e?\"s\":\"\"),l.getTime()>=1E3*h||e&&!a.cookieRead(a.sessionCookieName))))a.c||(a.c={}),a.c[f]=j}c=a.loadSSL?!!a.trackingServerSecure:!!a.trackingServer;if(!a.a(p)&&c&&(b=a.cookieRead(\"s_vi\")))b=b.split(\"|\"),1<b.length&&0<=b[0].indexOf(\"v1\")&&(g=b[1],d=g.indexOf(\"[\"),0<=d&&(g=g.substring(0,d)),g&&g.match(r.u)&&a.e(p,g))}};a.Za=function(){var d=a.ea(),c,b;for(c in a.b)!Object.prototype[c]&&a.b[c]&&\"expire\"!=c.substring(0,6)&&(b=a.b[c],d+=(d?\"|\":\"\")+c+(a.b[\"expire\"+c]?\"-\"+a.b[\"expire\"+c]:\"\")+\"|\"+b);a.cookieWrite(a.cookieName,d,1)};a.a=function(d,c){return a.b!=i&&(c||!a.c||!a.c[d])?a.b[d]:i};a.e=function(d,c,b){a.b==i&&(a.b={});a.b[d]=c;b||a.Za()};a.Sa=function(d,c){var b=a.a(d,c);return b?b.split(\"*\"):i};a.Ya=function(d,c,b){a.e(d,c?c.join(\"*\"):\"\",b)};a.Jb=function(d,c){var b=a.Sa(d,c);if(b){var e={},f;for(f=0;f<b.length;f+=2)e[b[f]]=b[f+1];return e}return i};a.Lb=function(d,c,b){var e=i,f;if(c)for(f in e=[],c)Object.prototype[f]||(e.push(f),e.push(c[f]));a.Ya(d,e,b)};a.j=function(d,c,b){var e=new Date;e.setTime(e.getTime()+1E3*c);a.b==i&&(a.b={});a.b[\"expire\"+d]=Math.floor(e.getTime()/1E3)+(b?\"s\":\"\");0>c?(a.c||(a.c={}),a.c[d]=j):a.c&&(a.c[d]=k);b&&(a.cookieRead(a.sessionCookieName)||a.cookieWrite(a.sessionCookieName,\"1\"))};a.da=function(a){if(a&&(\"object\"==typeof a&&(a=a.d_mid?a.d_mid:a.visitorID?a.visitorID:a.id?a.id:a.uuid?a.uuid:\"\"+a),a&&(a=a.toUpperCase(),\"NOTARGET\"==a&&(a=t)),!a||a!=t&&!a.match(r.u)))a=\"\";return a};a.k=function(d,c){a.Pa(d);a.i!=i&&(a.i[d]=k);o.d[d]&&(o.d[d].Ab=o.o(),o.I(d));w.d[d]&&w.Ha(d,k);if(d==F){w.isClientSideMarketingCloudVisitorID!==j&&(w.isClientSideMarketingCloudVisitorID=k);var b=a.a(n);if(!b||a.overwriteCrossDomainMCIDAndAID){b=\"object\"==typeof c&&c.mid?c.mid:a.da(c);if(!b){if(a.B){a.getAnalyticsVisitorID(i,k,j);return}b=a.s(0,n)}a.e(n,b)}if(!b||b==t)b=\"\";\"object\"==typeof c&&((c.d_region||c.dcs_region||c.d_blob||c.blob)&&a.k(C,c),a.B&&c.mid&&a.k(D,{id:c.id}));a.r(n,[b])}if(d==C&&\"object\"==typeof c){b=604800;c.id_sync_ttl!=E&&c.id_sync_ttl&&(b=parseInt(c.id_sync_ttl,10));var e=a.a(A);e||((e=c.d_region)||(e=c.dcs_region),e&&(a.j(A,b),a.e(A,e)));e||(e=\"\");a.r(A,[e]);e=a.a(s);if(c.d_blob||c.blob)(e=c.d_blob)||(e=c.blob),a.j(s,b),a.e(s,e);e||(e=\"\");a.r(s,[e]);!c.error_msg&&a.A&&a.e(H,a.A)}if(d==D){b=a.a(p);if(!b||a.overwriteCrossDomainMCIDAndAID)(b=a.da(c))?b!==t&&a.j(s,-1):b=t,a.e(p,b);if(!b||b==t)b=\"\";a.r(p,[b])}a.idSyncDisableSyncs?z.za=j:(z.za=k,b={},b.ibs=c.ibs,b.subdomain=c.subdomain,z.wb(b));if(c===Object(c)){var f;a.isAllowed()&&(f=a.a(B));f||(f=t,c.d_optout&&c.d_optout instanceof Array&&(f=c.d_optout.join(\",\")),b=parseInt(c.d_ottl,10),isNaN(b)&&(b=7200),a.j(B,b,j),a.e(B,f));a.r(B,[f])}};a.i=i;a.t=function(d,c,b,e,f){var g=\"\",h,k=x.ob(d);if(a.isAllowed()&&(a.f(),g=a.a(d,M[d]===j),a.disableThirdPartyCalls&&!g&&(d===n?(g=a.s(0,n),a.setMarketingCloudVisitorID(g)):d===p&&!k&&(g=\"\",a.setAnalyticsVisitorID(g))),(!g||a.c&&a.c[d])&&(!a.disableThirdPartyCalls||k)))if(d==n||d==B?h=F:d==A||d==s?h=C:d==p&&(h=D),h){if(c&&(a.i==i||!a.i[h]))a.i==i&&(a.i={}),a.i[h]=j,a.Ta(h,c,function(c,b){if(!a.a(d))if(o.d[h]&&(o.d[h].timeout=o.o(),o.d[h].nb=!!c,o.I(h)),b===Object(b)&&!a.useCORSOnly)a.ia(h,b.url,b.G);else{c&&w.Ha(h,j);var e=\"\";d==n?e=a.s(0,n):h==C&&(e={error_msg:\"timeout\"});a.k(h,e)}},f);if(g)return g;a.Xa(d,b);c||a.k(h,{id:t});return\"\"}if((d==n||d==p)&&g==t)g=\"\",e=j;b&&(e||a.disableThirdPartyCalls)&&a.J(b,[g]);return g};a._setMarketingCloudFields=function(d){a.f();a.k(F,d)};a.setMarketingCloudVisitorID=function(d){a._setMarketingCloudFields(d)};a.B=k;a.getMarketingCloudVisitorID=function(d,c){if(a.isAllowed()){a.marketingCloudServer&&0>a.marketingCloudServer.indexOf(\".demdex.net\")&&(a.B=j);var b=a.z(\"_setMarketingCloudFields\");return a.t(n,b.url,d,c,b)}return\"\"};a.Ua=function(){a.getAudienceManagerBlob()};l.AuthState={UNKNOWN:0,AUTHENTICATED:1,LOGGED_OUT:2};a.w={};a.ca=k;a.A=\"\";a.setCustomerIDs=function(d){if(a.isAllowed()&&d){a.f();var c,b;for(c in d)if(!Object.prototype[c]&&(b=d[c]))if(\"object\"==typeof b){var e={};b.id&&(e.id=b.id);b.authState!=E&&(e.authState=b.authState);a.w[c]=e}else a.w[c]={id:b};var d=a.getCustomerIDs(),e=a.a(H),f=\"\";e||(e=0);for(c in d)Object.prototype[c]||(b=d[c],f+=(f?\"|\":\"\")+c+\"|\"+(b.id?b.id:\"\")+(b.authState?b.authState:\"\"));a.A=a.fa(f);a.A!=e&&(a.ca=j,a.Ua())}};a.getCustomerIDs=function(){a.f();var d={},c,b;for(c in a.w)Object.prototype[c]||(b=a.w[c],d[c]||(d[c]={}),b.id&&(d[c].id=b.id),d[c].authState=b.authState!=E?b.authState:l.AuthState.UNKNOWN);return d};a._setAnalyticsFields=function(d){a.f();a.k(D,d)};a.setAnalyticsVisitorID=function(d){a._setAnalyticsFields(d)};a.getAnalyticsVisitorID=function(d,c,b){if(a.isAllowed()){var e=\"\";b||(e=a.getMarketingCloudVisitorID(function(){a.getAnalyticsVisitorID(d,j)}));if(e||b){var f=b?a.marketingCloudServer:a.trackingServer,g=\"\";a.loadSSL&&(b?a.marketingCloudServerSecure&&(f=a.marketingCloudServerSecure):a.trackingServerSecure&&(f=a.trackingServerSecure));var h={};if(f){var f=\"http\"+(a.loadSSL?\"s\":\"\")+\"://\"+f+\"/id\",e=\"d_visid_ver=\"+\na.version+\"&mcorgid=\"+encodeURIComponent(a.marketingCloudOrgID)+(e?\"&mid=\"+encodeURIComponent(e):\"\")+(a.idSyncDisable3rdPartySyncing?\"&d_coppa=true\":\"\"),i=[\"s_c_il\",a._in,\"_set\"+(b?\"MarketingCloud\":\"Analytics\")+\"Fields\"],g=f+\"?\"+e+\"&callback=s_c_il%5B\"+a._in+\"%5D._set\"+(b?\"MarketingCloud\":\"Analytics\")+\"Fields\";h.m=f+\"?\"+e;h.oa=i}h.url=g;return a.t(b?n:p,g,d,c,h)}}return\"\"};a._setAudienceManagerFields=function(d){a.f();a.k(C,d)};a.z=function(d){var c=a.audienceManagerServer,b=\"\",e=a.a(n),f=a.a(s,j),g=a.a(p),g=g&&g!=t?\"&d_cid_ic=AVID%01\"+encodeURIComponent(g):\"\";a.loadSSL&&a.audienceManagerServerSecure&&(c=a.audienceManagerServerSecure);if(c){var b=a.getCustomerIDs(),h,i;if(b)for(h in b)Object.prototype[h]||(i=b[h],g+=\"&d_cid_ic=\"+encodeURIComponent(h)+\"%01\"+encodeURIComponent(i.id?i.id:\"\")+(i.authState?\"%01\"+i.authState:\"\"));d||(d=\"_setAudienceManagerFields\");c=\"http\"+(a.loadSSL?\"s\":\"\")+\"://\"+c+\"/id\";e=\"d_visid_ver=\"+a.version+\"&d_rtbd=json&d_ver=2\"+(!e&&a.B?\"&d_verify=1\":\"\")+\"&d_orgid=\"+encodeURIComponent(a.marketingCloudOrgID)+\n\"&d_nsid=\"+(a.idSyncContainerID||0)+(e?\"&d_mid=\"+encodeURIComponent(e):\"\")+(a.idSyncDisable3rdPartySyncing?\"&d_coppa=true\":\"\")+(f?\"&d_blob=\"+encodeURIComponent(f):\"\")+g;f=[\"s_c_il\",a._in,d];b=c+\"?\"+e+\"&d_cb=s_c_il%5B\"+a._in+\"%5D.\"+d;return{url:b,m:c+\"?\"+e,oa:f}}return{url:b}};a.getAudienceManagerLocationHint=function(d,c){if(a.isAllowed()&&a.getMarketingCloudVisitorID(function(){a.getAudienceManagerLocationHint(d,j)})){var b=a.a(p);b||(b=a.getAnalyticsVisitorID(function(){a.getAudienceManagerLocationHint(d,j)}));if(b)return b=a.z(),a.t(A,b.url,d,c,b)}return\"\"};a.getLocationHint=a.getAudienceManagerLocationHint;a.getAudienceManagerBlob=function(d,c){if(a.isAllowed()&&a.getMarketingCloudVisitorID(function(){a.getAudienceManagerBlob(d,j)})){var b=a.a(p);b||(b=a.getAnalyticsVisitorID(function(){a.getAudienceManagerBlob(d,j)}));if(b){var b=a.z(),e=b.url;a.ca&&a.j(s,-1);return a.t(s,e,d,c,b)}}return\"\"};a._supplementalDataIDCurrent=\"\";a._supplementalDataIDCurrentConsumed={};a._supplementalDataIDLast=\"\";a._supplementalDataIDLastConsumed={};a.getSupplementalDataID=function(d,c){!a._supplementalDataIDCurrent&&!c&&(a._supplementalDataIDCurrent=a.s(1));var b=a._supplementalDataIDCurrent;a._supplementalDataIDLast&&!a._supplementalDataIDLastConsumed[d]?(b=a._supplementalDataIDLast,a._supplementalDataIDLastConsumed[d]=j):b&&(a._supplementalDataIDCurrentConsumed[d]&&(a._supplementalDataIDLast=a._supplementalDataIDCurrent,a._supplementalDataIDLastConsumed=a._supplementalDataIDCurrentConsumed,a._supplementalDataIDCurrent=b=!c?a.s(1):\"\",a._supplementalDataIDCurrentConsumed={}),b&&(a._supplementalDataIDCurrentConsumed[d]=j));return b};l.OptOut={GLOBAL:\"global\"};a.getOptOut=function(d,c){if(a.isAllowed()){var b=a.z(\"_setMarketingCloudFields\");return a.t(B,b.url,d,c,b)}return\"\"};a.isOptedOut=function(d,c,b){return a.isAllowed()?(c||(c=l.OptOut.GLOBAL),(b=a.getOptOut(function(b){a.J(d,[b==l.OptOut.GLOBAL||0<=b.indexOf(c)])},b))?b==l.OptOut.GLOBAL||0<=b.indexOf(c):i):k};a.appendVisitorIDsTo=function(d){var c=r.Z,b=y([[n,a.a(n)],[p,a.a(p)],[I,a.marketingCloudOrgID]]);try{return a.v(d,c,b)}catch(e){return d}};var r={q:!!m.postMessage,La:1,aa:864E5,Z:\"adobe_mc\",u:/^[0-9a-fA-F\\-]+$/,Ka:5};a.Eb=r;a.na={postMessage:function(a,c,b){var e=1;c&&(r.q?b.postMessage(a,c.replace(/([^:]+:\\/\\/[^\\/]+).*/,\"$1\")):c&&(b.location=c.replace(/#.*$/,\"\")+\"#\"+ +new Date+e++ +\"&\"+a))},U:function(a,c){var b;try{if(r.q)if(a&&(b=function(b){if(\"string\"===typeof c&&b.origin!==c||\"[object Function]\"===Object.prototype.toString.call(c)&&!1===c(b.origin))return!1;a(b)}),window.addEventListener)window[a?\"addEventListener\":\"removeEventListener\"](\"message\",b,!1);else window[a?\"attachEvent\":\"detachEvent\"](\"onmessage\",b)}catch(e){}}};var x={M:function(){if(u.addEventListener)return function(a,c,b){a.addEventListener(c,function(a){\"function\"===typeof b&&b(a)},k)};if(u.attachEvent)return function(a,c,b){a.attachEvent(\"on\"+c,function(a){\"function\"===typeof b&&b(a)})}}(),map:function(a,c){if(Array.prototype.map)return a.map(c);if(void 0===a||a===i)throw new TypeError;var b=Object(a),e=b.length>>>0;if(\"function\"!==typeof c)throw new TypeError;for(var f=Array(e),g=0;g<e;g++)g in b&&(f[g]=c.call(c,b[g],g,b));return f},va:function(a,c){return this.map(a,function(a){return encodeURIComponent(a)}).join(c)},vb:function(a){var c=a.indexOf(\"#\");return 0<c?a.substr(c):\"\"},mb:function(a){var c=a.indexOf(\"#\");return 0<c?a.substr(0,c):a},$a:function(a,c,b){a=a.split(\"&\");b=b!=i?b:a.length;a.splice(b,0,c);return a.join(\"&\")},ob:function(d,c,b){if(d!==p)return k;c||(c=a.trackingServer);b||(b=a.trackingServerSecure);d=a.loadSSL?b:c;return\"string\"===typeof d&&d.length?0>d.indexOf(\"2o7.net\")&&0>d.indexOf(\"omtrdc.net\"):k},pb:function(a){return Boolean(a&&a===Object(a))}};a.Kb=x;var N={C:function(){var a=\"none\",c=j;\"undefined\"!==typeof XMLHttpRequest&&XMLHttpRequest===Object(XMLHttpRequest)&&(\"withCredentials\"in new XMLHttpRequest?a=\"XMLHttpRequest\":(new Function(\"/*@cc_on return /^10/.test(@_jscript_version) @*/\"))()?a=\"XMLHttpRequest\":\"undefined\"!==typeof XDomainRequest&&XDomainRequest===Object(XDomainRequest)&&(c=k),0<Object.prototype.toString.call(window.Bb).indexOf(\"Constructor\")&&(c=k));return{D:a,Nb:c}}(),jb:function(){return\"none\"===this.C.D?i:new window[this.C.D]},ib:function(d,c,b){var e=this;c&&(d.G=c);try{var f=this.jb();f.open(\"get\",d.m+\"&ts=\"+(new Date).getTime(),j);\"XMLHttpRequest\"===this.C.D&&(f.withCredentials=j,f.timeout=a.loadTimeout,f.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\"),f.onreadystatechange=function(){if(4===this.readyState&&200===this.status)a:{var a;try{if(a=JSON.parse(this.responseText),a!==Object(a)){e.n(d,i,\"Response is not JSON\");break a}}catch(c){e.n(d,c,\"Error parsing response as JSON\");break a}try{for(var b=d.oa,f=window,g=0;g<b.length;g++)f=f[b[g]];f(a)}catch(j){e.n(d,j,\"Error forming callback function\")}}});f.onerror=function(a){e.n(d,a,\"onerror\")};f.ontimeout=function(a){e.n(d,a,\"ontimeout\")};f.send();o.d[b]={requestStart:o.o(),url:d.m,ta:f.timeout,ra:o.ya(),sa:1};a.ja.Fa.push(d.m)}catch(g){this.n(d,g,\"try-catch\")}},n:function(d,c,b){a.CORSErrors.push({Ob:d,error:c,description:b});d.G&&(\"ontimeout\"===b?d.G(j):d.G(k,d))}};a.la=N;var z={Na:3E4,$:649,Ja:k,id:i,T:[],Q:i,xa:function(a){if(\"string\"===typeof a)return a=a.split(\"/\"),a[0]+\"//\"+a[2]},g:i,url:i,kb:function(){var d=\"http://fast.\",c=\"?d_nsid=\"+a.idSyncContainerID+\"#\"+encodeURIComponent(u.location.href);this.g||(this.g=\"nosubdomainreturned\");a.loadSSL&&(d=a.idSyncSSLUseAkamai?\"https://fast.\":\"https://\");d=d+this.g+\".demdex.net/dest5.html\"+c;this.Q=this.xa(d);this.id=\"destination_publishing_iframe_\"+this.g+\"_\"+a.idSyncContainerID;return d},cb:function(){var d=\"?d_nsid=\"+a.idSyncContainerID+\"#\"+encodeURIComponent(u.location.href);\"string\"===typeof a.K&&a.K.length&&(this.id=\"destination_publishing_iframe_\"+(new Date).getTime()+\"_\"+a.idSyncContainerID,this.Q=this.xa(a.K),this.url=a.K+d)},za:i,ua:k,W:k,F:i,cc:i,ub:i,dc:i,V:k,H:[],sb:[],tb:[],Ba:r.q?15:100,R:[],qb:[],pa:j,Ea:k,Da:function(){return!a.idSyncDisable3rdPartySyncing&&(this.ua||a.Gb)&&this.g&&\"nosubdomainreturned\"!==this.g&&this.url&&!this.W},O:function(){function a(){e=document.createElement(\"iframe\");e.sandbox=\"allow-scripts allow-same-origin\";e.title=\"Adobe ID Syncing iFrame\";e.id=b.id;e.style.cssText=\"display: none; width: 0; height: 0;\";e.src=b.url;b.ub=j;c();document.body.appendChild(e)}function c(){x.M(e,\"load\",function(){e.className=\"aamIframeLoaded\";b.F=j;b.p()})}this.W=j;var b=this,e=document.getElementById(this.id);e?\"IFRAME\"!==e.nodeName?(this.id+=\"_2\",a()):\"aamIframeLoaded\"!==e.className?c():(this.F=j,this.Aa=e,this.p()):a();this.Aa=e},p:function(d){var c=this;d===Object(d)&&(this.R.push(d),this.xb(d));if((this.Ea||!r.q||this.F)&&this.R.length)this.I(this.R.shift()),this.p();!a.idSyncDisableSyncs&&this.F&&this.H.length&&!this.V&&(this.Ja||(this.Ja=j,setTimeout(function(){c.Ba=r.q?15:150},this.Na)),this.V=j,this.Ga())},xb:function(a){var c,b,e;if((c=a.ibs)&&c instanceof Array&&(b=c.length))for(a=0;a<b;a++)e=c[a],e.syncOnPage&&this.qa(e,\"\",\"syncOnPage\")},I:function(a){var c=encodeURIComponent,b,e,f,g,h;if((b=a.ibs)&&b instanceof Array&&(e=b.length))for(f=0;f<e;f++)g=b[f],h=[c(\"ibs\"),c(g.id||\"\"),c(g.tag||\"\"),x.va(g.url||[],\",\"),c(g.ttl||\"\"),\"\",\"\",g.fireURLSync?\"true\":\"false\"],g.syncOnPage||(this.pa?this.N(h.join(\"|\")):g.fireURLSync&&this.qa(g,h.join(\"|\")));this.qb.push(a)},qa:function(d,c,b){var e=(b=\"syncOnPage\"===b?j:k)?J:L;a.f();var f=a.a(e),g=k,h=k,i=Math.ceil((new Date).getTime()/r.aa);f?(f=f.split(\"*\"),h=this.yb(f,d.id,i),g=h.gb,h=h.hb,(!g||!h)&&this.wa(b,d,c,f,e,i)):(f=[],this.wa(b,d,c,f,e,i))},yb:function(a,c,b){var e=k,f=k,g,h,i;for(h=0;h<a.length;h++)g=a[h],i=parseInt(g.split(\"-\")[1],10),g.match(\"^\"+c+\"-\")?(e=j,b<i?f=j:(a.splice(h,1),h--)):b>=i&&(a.splice(h,1),h--);return{gb:e,hb:f}},rb:function(a){if(a.join(\"*\").length>this.$)for(a.sort(function(a,b){return parseInt(a.split(\"-\")[1],10)-parseInt(b.split(\"-\")[1],10)});a.join(\"*\").length>this.$;)a.shift()},wa:function(d,c,b,e,f,g){var h=this;if(d){if(\"img\"===c.tag){var d=c.url,b=a.loadSSL?\"https:\":\"http:\",j,k,l;for(e=0,j=d.length;e<j;e++){k=d[e];l=/^\\/\\//.test(k);var m=new Image;x.M(m,\"load\",function(b,c,d,e){return function(){h.T[b]=i;a.f();var g=a.a(f),j=[];if(g){var g=g.split(\"*\"),k,l,m;for(k=0,l=g.length;k<l;k++)m=g[k],m.match(\"^\"+c.id+\"-\")||j.push(m)}h.Ia(j,c,d,e)}}(this.T.length,c,f,g));m.src=(l?b:\"\")+k;this.T.push(m)}}}else this.N(b),this.Ia(e,c,f,g)},N:function(d){var c=encodeURIComponent;this.H.push((a.Hb?c(\"---destpub-debug---\"):c(\"---destpub---\"))+d)},Ia:function(d,c,b,e){d.push(c.id+\"-\"+(e+Math.ceil(c.ttl/60/24)));this.rb(d);a.e(b,d.join(\"*\"))},Ga:function(){var d=this,c;this.H.length?(c=this.H.shift(),a.na.postMessage(c,this.url,this.Aa.contentWindow),this.sb.push(c),setTimeout(function(){d.Ga()},this.Ba)):this.V=k},U:function(a){var c=/^---destpub-to-parent---/;\"string\"===typeof a&&c.test(a)&&(c=a.replace(c,\"\").split(\"|\"),\"canSetThirdPartyCookies\"===c[0]&&(this.pa=\"true\"===c[1]?j:k,this.Ea=j,this.p()),this.tb.push(a))},wb:function(d){if(this.url===i||d.subdomain&&\"nosubdomainreturned\"===this.g)this.g=\"string\"===typeof a.ma&&a.ma.length?a.ma:d.subdomain||\"\",this.url=this.kb();d.ibs instanceof Array&&d.ibs.length&&(this.ua=j);this.Da()&&(a.idSyncAttachIframeOnWindowLoad?(l.Y||\"complete\"===u.readyState||\"loaded\"===u.readyState)&&this.O():this.ab());\"function\"===typeof a.idSyncIDCallResult?a.idSyncIDCallResult(d):this.p(d);\"function\"===typeof a.idSyncAfterIDCallResult&&a.idSyncAfterIDCallResult(d)},bb:function(d,c){return a.Ib||!d||c-d>r.La},ab:function(){function a(){c.W||(document.body?c.O():setTimeout(a,30))}var c=this;a()}};a.Fb=z;a.timeoutMetricsLog=[];var o={fb:window.performance&&window.performance.timing?1:0,Ca:window.performance&&window.performance.timing?window.performance.timing:i,X:i,P:i,d:{},S:[],send:function(d){if(a.takeTimeoutMetrics&&d===Object(d)){var c=[],b=encodeURIComponent,e;for(e in d)d.hasOwnProperty(e)&&c.push(b(e)+\"=\"+b(d[e]));d=\"http\"+(a.loadSSL?\"s\":\"\")+\"://dpm.demdex.net/event?d_visid_ver=\"+a.version+\"&d_visid_stg_timeout=\"+a.loadTimeout+\"&\"+c.join(\"&\")+\"&d_orgid=\"+b(a.marketingCloudOrgID)+\"&d_timingapi=\"+this.fb+\"&d_winload=\"+this.lb()+\"&d_ld=\"+this.o();(new Image).src=d;a.timeoutMetricsLog.push(d)}},lb:function(){this.P===i&&(this.P=this.Ca?this.X-this.Ca.navigationStart:this.X-l.eb);return this.P},o:function(){return(new Date).getTime()},I:function(a){var c=this.d[a],b={};b.d_visid_stg_timeout_captured=c.ta;b.d_visid_cors=c.sa;b.d_fieldgroup=a;b.d_settimeout_overriden=c.ra;c.timeout?c.nb?(b.d_visid_timedout=1,b.d_visid_timeout=c.timeout-c.requestStart,b.d_visid_response=-1):(b.d_visid_timedout=\"n/a\",b.d_visid_timeout=\"n/a\",b.d_visid_response=\"n/a\"):(b.d_visid_timedout=0,b.d_visid_timeout=-1,b.d_visid_response=c.Ab-c.requestStart);b.d_visid_url=c.url;l.Y?this.send(b):this.S.push(b);delete this.d[a]},zb:function(){for(var a=0,c=this.S.length;a<c;a++)this.send(this.S[a])},ya:function(){return\"function\"===typeof setTimeout.toString?-1<setTimeout.toString().indexOf(\"[native code]\")?0:1:-1}};a.Mb=o;var w={isClientSideMarketingCloudVisitorID:i,MCIDCallTimedOut:i,AnalyticsIDCallTimedOut:i,AAMIDCallTimedOut:i,d:{},Ha:function(a,c){switch(a){case F:c===k?this.MCIDCallTimedOut!==j&&(this.MCIDCallTimedOut=k):this.MCIDCallTimedOut=c;break;case D:c===k?this.AnalyticsIDCallTimedOut!==j&&(this.AnalyticsIDCallTimedOut=k):this.AnalyticsIDCallTimedOut=c;break;case C:c===k?this.AAMIDCallTimedOut!==j&&(this.AAMIDCallTimedOut=k):this.AAMIDCallTimedOut=c}}};a.isClientSideMarketingCloudVisitorID=function(){return w.isClientSideMarketingCloudVisitorID};a.MCIDCallTimedOut=function(){return w.MCIDCallTimedOut};a.AnalyticsIDCallTimedOut=function(){return w.AnalyticsIDCallTimedOut};a.AAMIDCallTimedOut=function(){return w.AAMIDCallTimedOut};a.idSyncGetOnPageSyncInfo=function(){a.f();return a.a(J)};a.idSyncByURL=function(d){var c,b=d||{};c=b.minutesToLive;var e=\"\";a.idSyncDisableSyncs&&(e=e?e:\"Error: id syncs have been disabled\");if(\"string\"!==typeof b.dpid||!b.dpid.length)e=e?e:\"Error: config.dpid is empty\";if(\"string\"!==typeof b.url||!b.url.length)e=e?e:\"Error: config.url is empty\";if(\"undefined\"===typeof c)c=20160;else if(c=parseInt(c,10),isNaN(c)||0>=c)e=e?e:\"Error: config.minutesToLive needs to be a positive number\";c={error:e,ec:c};if(c.error)return c.error;var e=d.url,f=encodeURIComponent,b=z,g,e=e.replace(/^https:/,\"\").replace(/^http:/,\"\");g=x.va([\"\",d.dpid,d.dpuuid||\"\"],\",\");d=[\"ibs\",f(d.dpid),\"img\",f(e),c.ttl,\"\",g];b.N(d.join(\"|\"));b.p();return\"Successfully queued\"};a.idSyncByDataSource=function(d){if(d!==Object(d)||\"string\"!==typeof d.dpuuid||!d.dpuuid.length)return\"Error: config or config.dpuuid is empty\";d.url=\"//dpm.demdex.net/ibs:dpid=\"+d.dpid+\"&dpuuid=\"+d.dpuuid;return a.idSyncByURL(d)};0>q.indexOf(\"@\")&&(q+=\"@AdobeOrg\");a.marketingCloudOrgID=q;a.cookieName=\"AMCV_\"+q;a.sessionCookieName=\"AMCVS_\"+q;a.cookieDomain=a.Ra();a.cookieDomain==m.location.hostname&&(a.cookieDomain=\"\");a.loadSSL=0<=m.location.protocol.toLowerCase().indexOf(\"https\");a.loadTimeout=3E4;a.CORSErrors=[];a.marketingCloudServer=a.audienceManagerServer=\"dpm.demdex.net\";var M={};M[A]=j;M[s]=j;if(v&&\"object\"==typeof v){for(var G in v)!Object.prototype[G]&&(a[G]=v[G]);a.idSyncContainerID=a.idSyncContainerID||0;a.ba();a.f();N=a.a(K);G=Math.ceil((new Date).getTime()/\nr.aa);!a.idSyncDisableSyncs&&z.bb(N,G)&&(a.j(s,-1),a.e(K,G));a.getMarketingCloudVisitorID();a.getAudienceManagerLocationHint();a.getAudienceManagerBlob();a.Va(a.serverState)}else a.ba();if(!a.idSyncDisableSyncs){z.cb();x.M(window,\"load\",function(){l.Y=j;o.X=o.o();o.zb();var a=z;a.Da()&&a.O()});try{a.na.U(function(a){z.U(a.data)},z.Q)}catch(O){}}}", "function vh(){}", "function hA(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "drive() {\n\t\tconsole.log('vroom vroom');\n\t}", "private internal function m248() {}", "function Rv(){var t=this;ci()(this,{$interaction:{enumerable:!0,get:function(){return t.$olObject}},$map:{enumerable:!0,get:function(){return t.$services&&uu()(t.$services)}},$view:{enumerable:!0,get:function(){return t.$services&&t.$services.view}},$interactionsContainer:{enumerable:!0,get:function(){return t.$services&&t.$services.interactionsContainer}}})}", "function VNode() {}", "transient private internal function m185() {}", "function tC(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"layer.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function JV(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function Vf(a,b,c){Vf.s.constructor.call(this,a);this.ab=a.ab||Wf;this.wf=a.wf||Xf;var e=[];e[w.Va]=new pe;e[w.Ug]=new pe;e[w.Ia]=new pe;e[w.Lf]=new pe;this.gm=e;b&&(this.$a=b);c&&(this.Lg=c);this.El=this.Lg&&w.h.cf();this.Ii=[];this.Wc=new Kf(a.Hc);this.cd=this.options.gq?new nf(a.gq,a.fq):null;w.I&&w.I.Se&&Yf(this,w.Mo,w.I.Se);w.Uc&&w.Uc.Se&&Yf(this,w.Ps,w.Uc.Se);w.Ta&&w.Ta.Se&&Yf(this,w.Jo,w.Ta.Se)}", "function Fv(){var t=this;ci()(this,{$style:{enumerable:!0,get:function(){return t.$olObject}},$map:{enumerable:!0,get:function(){return t.$services&&uu()(t.$services)}},$view:{enumerable:!0,get:function(){return t.$services&&t.$services.view}},$stylesContainer:{enumerable:!0,get:function(){return t.$services&&t.$services.stylesContainer}}})}", "function DI(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"layer.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "ready() {\n window.plugin = new window.Vue( {\n el : this.shadowRoot,\n created() {\n Editor.log( \"成功初始化\" );\n },\n data : {\n uuid : \"bae4f6b4-7d1e-4612-99b7-ab5239576cc1\",\n scriptUrl: \"\",\n uuidObj : {},\n isFind : false,\n isFindAll: true,\n },\n methods: {\n _setOpenUrl() {\n let path = Editor.url( 'db://assets' );\n let files = Editor.Dialog.openFile( {\n defaultPath: path,\n properties : [ 'openDirectory' ]\n } );\n if ( files ) {\n path = files[0];\n }\n this.scriptUrl = path;\n },\n onSelectJSPath() {\n this._setOpenUrl();\n let assetUrl = Editor.remote.assetdb.fspathToUrl( this.scriptUrl );\n if ( this.scriptUrl === assetUrl ) {\n Editor.warn( \"请选择项目目录哦\" );\n return;\n }\n this._analyzeUUIDInfo( assetUrl, \"javascript\" );\n },\n\n onSelectSFPath() {\n this._setOpenUrl();\n let assetUrl = Editor.remote.assetdb.fspathToUrl( this.scriptUrl );\n if ( this.scriptUrl === assetUrl ) {\n Editor.warn( \"请选择项目目录哦\" );\n return;\n }\n this._analyzeUUIDInfo( assetUrl, \"sprite-frame\" );\n },\n\n onSelectFontPath() {\n this._setOpenUrl();\n let assetUrl = Editor.remote.assetdb.fspathToUrl( this.scriptUrl );\n if ( this.scriptUrl === assetUrl ) {\n Editor.warn( \"请选择项目目录哦\" );\n return;\n }\n this._analyzeUUIDInfo( assetUrl, [ \"label-atlas\", \"bitmap-font\" ] );\n },\n\n _analyzeUUIDInfo( url, type ) {\n let self = this;\n self.uuidObj = {};\n Editor.assetdb.queryAssets( url + \"/**/*\", type, function ( err, results ) {\n if ( err ) return;\n let len = results.length;\n for (let i = 0; i < len; i++) {\n let uuid = results[i].uuid;\n if ( type === \"javascript\" ) uuid = Editor.Utils.UuidUtils.compressUuid( results[i].uuid );\n self.uuidObj[uuid] = results[i];\n }\n } );\n },\n onCheckUUID() {\n Editor.log( 'check uuid', this.uuid );\n },\n onFindUUID() {\n // Editor.assetdb.queryUuidByUrl( url, function ( err, uuid ) {\n // Editor.log( \"uuid\", uuid );\n // } );\n if ( this.isFind ) {\n Editor.log( \"正在查找中.........\" );\n return;\n }\n this.isFind = true;\n let self = this;\n let objs = Object.values( this.uuidObj );\n if ( objs.length > 0 ) {\n Editor.log( objs[0].type );\n this._findInfo( objs[0].type, this.uuidObj );\n return;\n }\n if ( !this._isUUID() ) {\n Editor.log( \"uuid 无效\" );\n return;\n }\n let url = Editor.remote.assetdb.uuidToUrl( this.uuid );\n Editor.log( \"开始查找!!!!!!!\", this.uuid, url );\n Editor.assetdb.queryInfoByUuid( this.uuid, function ( err, info ) {\n Editor.log( \"当前查找的文件信息\", info, self.uuid );\n if ( err ) return;\n self._findInfo( info.type );\n } );\n // Editor.assetdb.queryUrlByUuid( this.uuid, function ( err, url ) {\n // Editor.log( \"info1\", url );\n // } );\n },\n _isUUID() {\n let isUUID = Editor.Utils.UuidUtils.isUuid( this.uuid );\n return isUUID;\n },\n\n _findInfo( type, uuidOrObj ) {\n let self = this;\n Editor.log( \"find \" + type );\n if ( type === \"sprite-frame\" || type === \"label-atlas\" || type === \"bitmap-font\" ) {\n Editor.assetdb.queryAssets( \"db://assets/resources/prefab/**/*\", [ 'prefab', 'scene' ], function ( err, results ) {\n Editor.log( \"查找 prefab 文件数量:\", results.length );\n self._analyze( results, type, uuidOrObj || self.uuid );\n } );\n } else if ( type === \"javascript\" ) {\n Editor.assetdb.queryAssets( \"db://assets/resources/prefab/**/*\", [ 'prefab', 'scene' ], function ( err, results ) {\n Editor.log( \"查找 prefab 文件数量:\", results.length );\n let uuid = uuidOrObj || Editor.Utils.UuidUtils.compressUuid( self.uuid );\n self._analyze( results, type, uuid );\n } );\n }\n },\n\n _analyze( list, type, uuidOrObj ) {\n let uuidObj = uuidOrObj;\n if ( typeof uuidOrObj === \"string\" ) {\n uuidObj = { [uuidOrObj]: { uuid: uuidOrObj } };\n }\n let len = Array.isArray( list ) ? list.length : 0;\n let result = \"\";\n for (let i = 0; i < len; i++) {\n let template = Fs.readFileSync( list[i].path, 'utf-8' );\n let json = JSON.parse( template ) || [];\n let num = json.length;\n Editor.log( \"正在查找当前文件:\", list[i].path );\n for (let j = 0; j < num; j++) {\n let obj = json[j];\n if ( !obj ) continue;\n let uObj = null;\n if ( type === \"sprite-frame\" ) {\n uObj = this._getSpriteFrame( obj, uuidObj );\n } else if ( type === \"javascript\" ) {\n uObj = this._getSpriteScript( obj, uuidObj );\n } else if ( type === \"label-atlas\" || type === \"bitmap-font\" ) {\n uObj = this._getSpriteFont( obj, uuidObj );\n }\n if ( !uObj ) continue;\n if ( uObj.isExist && !this.isFindAll ) continue;\n uObj.isExist = true;\n let path = uObj.path ? \"<\" + uObj.path + \">\" : uObj.uuid;\n result = result + path + list[i].path + \"\\n\";\n }\n }\n //查找玩家\n Editor.log( \"----------以下文件暂时没有找到引用---------------\" );\n let values = Object.values( uuidObj );\n let count = values.length;\n let sum = 0;\n for (let i = 0; i < count; i++) {\n if ( values[i].isExist ) continue;\n let path = values[i].path ? values[i].path : values[i].uuid;\n Editor.log( path );\n sum++;\n }\n Editor.log( \"总计有\", sum, \"个类型\", type, \"文件未被引用\" );\n this.uuidObj = {};\n this.isFind = false;\n Editor.log( \"----------查找到以下文件以及在那个预制文件下引用---------------\" );\n Editor.log( result );\n Editor.log( \"----------complete---------------\" );\n },\n _getSpriteFrame( obj, uuidObj ) {\n let result = null;\n do {\n if ( obj[\"__type__\"] !== \"cc.Sprite\" ) break;\n if ( !obj[\"_spriteFrame\"] ) break;\n let uObj = uuidObj[obj[\"_spriteFrame\"][\"__uuid__\"]];\n if ( !uObj ) break;\n result = uObj;\n } while ( 0 );\n return result;\n },\n\n _getSpriteScript( obj, uuidObj ) {\n let result = null;\n do {\n let uObj = uuidObj[obj[\"__type__\"]];\n if ( uObj ) {\n result = uObj;\n break;\n }\n let componentId = obj[\"_componentId\"];\n if ( !componentId ) break;\n uObj = uuidObj[componentId];\n if ( !uObj ) break;\n result = uObj;\n } while ( 0 );\n return result;\n },\n _getSpriteFont( obj, uuidObj ) {\n let result = null;\n do {\n if ( obj[\"__type__\"] !== \"cc.Label\" ) break;\n if ( !obj[\"_N$file\"] ) break;\n let uObj = uuidObj[obj[\"_N$file\"][\"__uuid__\"]];\n if ( !uObj ) break;\n result = uObj;\n } while ( 0 );\n return result;\n },\n }\n } );\n }", "ready() {\n this.vue = createVUE(this[\"$mainDiv\"]);\n Editor.log(\"ConvertHelper view ready\");\n }", "function UserGallerie()\n{\n var Video=deserialize(\"Video\",{});\n // Vorschauliste bunt\n var VideoLinks=$x(\"//a[contains(@href,'watch?v=')]\")\n .map(function (a) { return { link:a.href, elem:('user'==Kategorie?$xs(\"ancestor::div[@class='video yt-tile-visible'] | ancestor::li[@class='channels-content-item']\",a):'channel'==Kategorie?$xs('../..',a):a.parentNode)||a }; })\n .map(function (vid) { vid.id=((vid.link||\"\").match(/v=([a-zA-Z0-9-_]*)/)||[\"\",\"\"])[1]; return vid; });\n //alert(uneval(VideoLinks));\n VideoLinks.forEach(function (vid) { if (Video[vid.id]) /*vid.elem.className=\"w\"+Video[vid.id].qualitaet;*/ vid.elem.style.backgroundColor={ \"gut\":\"green\", \"schlecht\":\"red\", undefined:\"yellow\" }[Video[vid.id].qualitaet]; });\n //showmsg({ text:\"aaa\" });\n $x(\"//a[contains(@href,'v=')]\").forEach(function (a) { a.addEventListener(\"click\",function(event){\n //if (event.ctrlKey) // && event.altKey)\n //{\n var e=event.target;\n while (!e || !e.href) e=e.parentNode;\n var VideoID=e.href.match(/v=([a-zA-Z0-9-_]*)/)[1];\n var Video=deserialize(\"Video\",{});\n if (!Video[VideoID])\n {\n Video[VideoID]={ id:VideoID, anz:0, lastseen:new Date() };\n serialize(\"Video\",Video);\n var ColorNode=$xs(\"ancestor::div[@class='video yt-tile-visible'] | ancestor::li[@class='channels-content-item']\",a)||a;\n ColorNode.style.color=\"lightgray\";\n ColorNode.style.backgroundColor=\"darkgray\";\n event.stopPropagation();\n event.preventDefault();\n }\n //}\n }, true); });\n}", "function getVersion(){return _VERSION}", "function Bevy() {}", "function __vue_normalize__(a,b,c,d,e){var f=(\"function\"==typeof c?c.options:c)||{};// For security concerns, we use only base name in production mode.\nreturn f.__file=\"/Users/hadefication/Packages/vue-chartisan/src/components/Pie.vue\",f.render||(f.render=a.render,f.staticRenderFns=a.staticRenderFns,f._compiled=!0,e&&(f.functional=!0)),f._scopeId=d,f}", "function Jb(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"style.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function vB_PHP_Emulator()\n{\n}", "init() {\n }", "function qv() {}", "install(Vue, options) {\n Vue.VERSION = 'v0.0.1';\n\n let userOptions = {...defaultOptions, ...options};\n // console.log(userOptions)\n\n // create a mixin\n Vue.mixin({\n // created() {\n // console.log(Vue.VERSION);\n // },\n\n\n });\n Vue.prototype.$italicHTML = function (text) {\n return '<i>' + text + '</i>';\n }\n Vue.prototype.$boldHTML = function (text) {\n return '<b>' + text + '</b>';\n }\n\n // define a global filter\n Vue.filter('preview', (value) => {\n if (!value) {\n return '';\n }\n return value.substring(0, userOptions.cutoff) + '...';\n })\n\n Vue.filter('localname', (value) => {\n if (!value) {\n return '';\n }\n var ln = value;\n if(value!= undefined){\n if ( value.lastIndexOf(\"#\") != -1) { ln = value.substr(value.lastIndexOf(\"#\")).substr(1)}\n else{ ln = value.substr(value.lastIndexOf(\"/\")).substr(1) }\n ln = ln.length == 0 ? value : ln\n }\n return ln\n })\n\n // add a custom directive\n Vue.directive('focus', {\n // When the bound element is inserted into the DOM...\n inserted: function (el) {\n // Focus the element\n el.focus();\n }\n })\n\n }", "function fl_outToLevivot ()\n\t\t{if(freez==\"false\"){\n\t\t\tconsole.log(\"hit\")\n\t\t\tthis.rimon.alpha=1\n\t\t\tthis.sufgania.alpha=1\n\t\t\tthis.selek.alpha=1\n\t\t\tthis.tamar.alpha=1\n\t\t\tthis.karpas.alpha=1\n\t\t\tthis.haroset.alpha=1\n\t\t\tthis.maza.alpha=1\n\t\t\tthis.hasa.alpha=1\n\t\t\tthis.beiza.alpha=1\n\t\t\tthis.hazeret.alpha=1\n\t\t\tthis.mamtak.alpha=1\n\t\t\tthis.gvina.alpha=1\n\t\t\tthis.oznei_aman.alpha=1\n\t\t\tthis.dvash.alpha=1\n\t\t\tthis.dag.alpha=1\n\t\t\tthis.sumsum.alpha=1\n\t\t\tthis.perot.alpha=1\n\t\t\tthis.mishloah.alpha=1\n\t\t\tthis.of.alpha=1\n\t\t this.tu_btn.alpha=1\n\t\t this.purim_btn.alpha=1\n\t\t this.pesach_btn.alpha=1\n\t\t this.shavuot_btn.alpha=1\n\t\t this.rosh_ha_shana_btn.alpha=1\n\t\t this.modern_btn.alpha=1\n\t\t\t\t\t this.arrow_btn.alpha=0\n\t\tthis.arrowAside_mc.alpha=0\n\t\tthis.gvina_explain.alpha=0\n\t\tthis.mishloah_explain.alpha=0\n\t\tthis.sufgania_explain.alpha=0\n\t\tthis.perot_explain.alpha=0\n\t\tthis.tapuah_explain.alpha=0\n\t\tthis.maza_explain.alpha=0\n\t\t\n\t\t}}", "function Ok(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"layer.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function version() {\n outlet(2, 249);\n}", "function v77(v78,v79,v80,v81,v82) {\n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }" ]
[ "0.60790557", "0.6060641", "0.5880747", "0.58640015", "0.5862688", "0.58372855", "0.5818145", "0.57850385", "0.57455677", "0.57246846", "0.5636216", "0.5615896", "0.56157297", "0.5607327", "0.5604924", "0.55964965", "0.5583291", "0.5577483", "0.5564155", "0.5559062", "0.5557601", "0.5540597", "0.552945", "0.5524327", "0.55134606", "0.5502386", "0.54859924", "0.548276", "0.54699725", "0.5463328", "0.5435568", "0.5434251", "0.5396488", "0.53957516", "0.53927565", "0.53870404", "0.5364897", "0.5358704", "0.53525203", "0.5348942", "0.53414106", "0.5338949", "0.5319488", "0.53171045", "0.5300986", "0.5269394", "0.5265286", "0.5257032", "0.52431214", "0.5238672", "0.5227331", "0.5216871", "0.52099794", "0.5200515", "0.5198879", "0.5189041", "0.51886666", "0.51872426", "0.5172543", "0.5171557", "0.5169194", "0.5165046", "0.5159017", "0.515684", "0.5148262", "0.5147817", "0.5141087", "0.5126207", "0.5116508", "0.5115094", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334", "0.51124334" ]
0.0
-1
! vuei18n v7.8.1 (c) 2018 kazuya kawaguchi Released under the MIT License.
function i(t,e){"undefined"!==typeof console&&(console.warn("[vue-i18n] "+t),e&&console.warn(e.stack))}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function JV(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function en(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function i(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function i(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function p(e,t){if(typeof console!==\"undefined\"){console.warn(\"[vue-i18n] \"+e);if(t){console.warn(t.stack)}}}", "function i(e,t){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function i(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function Yt(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function la(e,t){if(typeof console!==\"undefined\"){console.warn(\"[vue-i18n] \"+e);if(t){console.warn(t.stack)}}}", "function Kn(n,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+n),e&&console.warn(e.stack))}", "function n(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function n(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function n(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function n(t,e){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function Cn(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function n(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function bn(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function Ht(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function Eu(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function _i(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function wl(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function a(e,t){'undefined'!=typeof console&&(console.warn('[vue-i18n] '+e),t&&console.warn(t.stack))}", "function _r(t,e){if(typeof console!==\"undefined\"){console.warn(\"[vue-i18n] \"+t);if(e){console.warn(e.stack)}}}", "function e(t,n){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+t),n&&console.warn(n.stack))}", "function Hr(e,t){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function i(A,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+A),t&&console.warn(t.stack))}", "function l(e,t){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function a(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function a(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function Fn(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function ll(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function o(t,e){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function r(e,t){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function r(e,t){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function r(e,t){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function r(e,t){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "constructor() {\n this.languages = {\n EN: 'en',\n IT: 'it',\n };\n\n this.loadedLanguages = [this.languages.EN]; // our default language that is preloaded\n this.i18n = new VueI18n({\n locale: this.languages.EN, // set locale\n fallbackLocale: this.languages.EN,\n messages // set locale messages\n });\n }", "function r(t,e){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function r(t,e){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function r(t,e){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function r(t,e){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function Rs(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function r(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function r(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function r(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function r(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function r(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function q(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function r(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function r(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function r(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function r(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function r(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function r(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function r(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function r(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function r(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function r(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function Gt(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function translations (lang = 'en') {\n let text = {\n daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],\n limit: 'Limit reached ({{limit}} items max).',\n loading: 'Loading...',\n minLength: 'Min. Length',\n months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n notSelected: 'Nothing Selected',\n required: 'Required',\n search: 'Search'\n }\n return window.VueStrapLang ? window.VueStrapLang(lang) : text\n}", "function translations (lang = 'en') {\n let text = {\n daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],\n limit: 'Limit reached ({{limit}} items max).',\n loading: 'Loading...',\n minLength: 'Min. Length',\n months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n notSelected: 'Nothing Selected',\n required: 'Required',\n search: 'Search'\n }\n return window.VueStrapLang ? window.VueStrapLang(lang) : text\n}", "function r(t,n){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+t),n&&console.warn(n.stack))}", "function TI18n() {}", "function TI18n() {}", "function TI18n() {}", "function Bl(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function n(e,t){window.console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function ne(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function Un(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function TI18n() { }", "function TI18n() { }", "function _e(t,e){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function TI18n(){}", "function translations(lang) {\n\t\t lang = lang || 'en';\n\t\t var text = {\n\t\t daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],\n\t\t limit: 'Limit reached ({{limit}} items max).',\n\t\t loading: 'Loading...',\n\t\t minLength: 'Min. Length',\n\t\t months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n\t\t notSelected: 'Nothing Selected',\n\t\t required: 'Required',\n\t\t search: 'Search'\n\t\t };\n\t\t return window.VueStrapLang ? window.VueStrapLang(lang) : text;\n\t\t}", "function Vn(e, t) {\n \"undefined\" != typeof console && (console.warn(\"[vue-i18n] \" + e), t && console.warn(t.stack))\n }", "data() {\n return {\n saludo: '¡Hola! Soy Desiré, te saludo desde un componente'\n }\n }", "function r(e,t){window.console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function r(e,t){window.console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "extend (config, ctx) {\n // inject `compilerModules` to vue-loader options\n config.module.rules.forEach(rule => {\n if (rule.loader === 'vue-loader') {\n rule.options.compilerModules = [i18nExtensions.module(i18n)]\n }\n })\n }", "function i(e, t) {\n \"undefined\" != typeof console && (console.warn(\"[vue-i18n] \" + e), t && console.warn(t.stack))\n }", "onTranslation() {\n }", "static get definition() {\n return {\n i18n: {\n default: 'Table'\n }\n };\n }", "function add_i18n()\n {\n var i18n = {};\n\n i18n[I18N.LANG.EN] = {};\n i18n[I18N.LANG.EN][MODULE_NAME + '_short_desc'] = 'Directly enable the good escort options';\n i18n[I18N.LANG.EN][MODULE_NAME + '_full_desc'] = 'When the escort mode is enabled, you can directly be taken further away and your rucksack objects can be manipulated.';\n\n i18n[I18N.LANG.FR] = {};\n i18n[I18N.LANG.FR][MODULE_NAME + '_short_desc'] = 'Activer les bonnes options d\\'escorte automatiquement';\n i18n[I18N.LANG.FR][MODULE_NAME + '_full_desc'] = 'Quand le mode escorte est activé, vous pouvez automatiquement être éloigné de la ville et les objets de votre sac peuvent être manipulés.';\n\n I18N.set(i18n);\n }", "@computed('i18n.locale')\n get loadingMessage() {\n return this.i18n.t('selects.loading');\n }", "setupTranslations () {\n const localeSetup = formatMessage.setup();\n if (localeSetup && localeSetup.translations[localeSetup.locale]) {\n Object.assign(\n localeSetup.translations[localeSetup.locale],\n // eslint-disable-next-line no-use-before-define\n extensionTranslations[localeSetup.locale]\n );\n }\n }", "install (Vue, options) {\n Vue.prototype.$format = {\n // money (num) {\n // return num.toLocaleString()\n // },\n precisionRound (number, precision) {\n var factor = Math.pow(10, precision)\n return Math.round(number * factor) / factor\n }\n }\n }", "function TM(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function $gettext (msg) {\n return msg\n}", "function MyComponent() {\n return (\n <Trans i18nKey=\"description.part1\">\n To get started, edit <code>src/App.js</code> and save to reload.\n </Trans>\n );\n}", "function MyComponent() {\n return (\n <Trans i18nKey=\"description.part1\">\n To get started, edit <code>src/App.js</code> and save to reload.\n </Trans>\n );\n}", "function add_i18n()\n {\n var i18n = {};\n\n i18n[I18N.LANG.EN] = {};\n i18n[I18N.LANG.EN][MODULE_NAME + '_short_desc'] = 'Fold Twinoid bar';\n i18n[I18N.LANG.EN][MODULE_NAME + '_full_desc'] = 'Fold the Twinoid black bar at the top of the screen. Put your mouse near the top of the screen to show it again.';\n\n i18n[I18N.LANG.FR] = {};\n i18n[I18N.LANG.FR][MODULE_NAME + '_short_desc'] = 'Replier la barre Twinoid';\n i18n[I18N.LANG.FR][MODULE_NAME + '_full_desc'] = 'Permet de gagner de la place en repliant la barre Twinoid. Rapprochez votre souris du bord supérieur de l\\'écran pour l\\'afficher de nouveau.';\n\n I18N.set(i18n);\n }", "install (Vue, options) {\r\n //ES6 way of const job = options.job\r\n //const { job } = options\r\n \r\n // Add $plugin instance method directly to Vue components\r\n //Vue.prototype.$myInfo = (name, age) => info(name, age, job)\r\n \r\n // Add $surname instance property directly to Vue components\r\n //Vue.prototype.$surname = 'Smith'\r\n\r\n Vue.prototype.$noti_warn = (text) => {\r\n Vue.prototype.$notify({\r\n \tgroup: 'common',\r\n /*title: 'Validation warnning',*/\r\n text: text,\r\n type: 'warn'\r\n });\r\n }\r\n\r\n Vue.prototype.$noti_succ = (text) => {\r\n Vue.prototype.$notify({\r\n \tgroup: 'common',\r\n /*title: 'Validation warnning',*/\r\n text: text,\r\n type: 'success'\r\n });\r\n }\r\n\r\n Vue.prototype.$noti_info = (text) => {\r\n Vue.prototype.$notify({\r\n \tgroup: 'common',\r\n /*title: 'Validation warnning',*/\r\n text: text,\r\n type: 'info'\r\n });\r\n }\r\n }", "install(Vue, options) {\n Vue.VERSION = 'v0.0.1';\n\n let userOptions = {...defaultOptions, ...options};\n // console.log(userOptions)\n\n // create a mixin\n Vue.mixin({\n // created() {\n // console.log(Vue.VERSION);\n // },\n\n\n });\n Vue.prototype.$italicHTML = function (text) {\n return '<i>' + text + '</i>';\n }\n Vue.prototype.$boldHTML = function (text) {\n return '<b>' + text + '</b>';\n }\n\n // define a global filter\n Vue.filter('preview', (value) => {\n if (!value) {\n return '';\n }\n return value.substring(0, userOptions.cutoff) + '...';\n })\n\n Vue.filter('localname', (value) => {\n if (!value) {\n return '';\n }\n var ln = value;\n if(value!= undefined){\n if ( value.lastIndexOf(\"#\") != -1) { ln = value.substr(value.lastIndexOf(\"#\")).substr(1)}\n else{ ln = value.substr(value.lastIndexOf(\"/\")).substr(1) }\n ln = ln.length == 0 ? value : ln\n }\n return ln\n })\n\n // add a custom directive\n Vue.directive('focus', {\n // When the bound element is inserted into the DOM...\n inserted: function (el) {\n // Focus the element\n el.focus();\n }\n })\n\n }", "get i18n() {\n return i18n;\n }", "ADD_LOCALE(state, { locale, translations }) {\n // reduce the given translations to a single-depth tree\n state.translations[locale] = flattenTranslations(translations)\n\n // make sure to notify vue of changes (this might break with new vue versions)\n try {\n if (state.translations.__ob__) state.translations.__ob__.dep.notify()\n } catch (ex) {}\n }", "function yh(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"graticule.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "getLanguageName() {\n return \"YAML\";\n }" ]
[ "0.7467622", "0.7418666", "0.7364661", "0.7364661", "0.7349065", "0.7299573", "0.72792786", "0.7276468", "0.7240656", "0.7231128", "0.72183836", "0.72183836", "0.72183836", "0.7209951", "0.7208506", "0.7204524", "0.72034055", "0.71914756", "0.71875226", "0.71333563", "0.71288735", "0.7128783", "0.71224666", "0.71163774", "0.7095786", "0.70517236", "0.70399874", "0.70318514", "0.70318514", "0.70162135", "0.6975058", "0.69411975", "0.6923781", "0.6923781", "0.6923781", "0.6923781", "0.691877", "0.6914927", "0.6914927", "0.6914927", "0.6914927", "0.69098365", "0.6894448", "0.6894448", "0.6894448", "0.6894448", "0.6894448", "0.6892875", "0.68596697", "0.68596697", "0.68596697", "0.68596697", "0.68596697", "0.68596697", "0.68596697", "0.68596697", "0.68596697", "0.68596697", "0.6823359", "0.6818256", "0.6818256", "0.67500705", "0.6711652", "0.6711652", "0.6711652", "0.6672916", "0.66727746", "0.6670578", "0.6644917", "0.65913576", "0.65913576", "0.65881896", "0.65762377", "0.64949954", "0.62753993", "0.6255549", "0.6228733", "0.6228733", "0.57144624", "0.5696744", "0.5665215", "0.5580124", "0.5553823", "0.55496347", "0.5536605", "0.5491305", "0.54801804", "0.5445921", "0.5440451", "0.5440451", "0.5435759", "0.5414641", "0.53608394", "0.5358928", "0.53544587", "0.5336492", "0.53344387" ]
0.7388992
5
Need URL to reflect which chatroom you joined
function ChatComponent() { const [message_list, setMessage_list] = useState([]); const [userMessage, setUserMessage] = useState(''); const [username] = useState(Cookies.get('name')); const [isVoiceChat, setVoiceChat] = useState(false); // const [roomID, setRoomID] = useState('TEST_ROOM_ID') let { room } = useParams(); useEffect(() => { socket.emit('joined room', {room: room, username: username}); }, []); // async load chatroom info from db useEffect(() => { async function onLoad(){ } onLoad(); }, []); const submitHandler = () => { if (userMessage !== ''){ console.log('User Typed: ' + userMessage); setMessage_list([...message_list, userMessage]); // Send the message to the server socket.emit('message', {'username': username, 'message': userMessage, 'room': room}); setUserMessage(''); } } const handleKeyDown = (event) => { if (event.key === 'Enter' && event.shiftKey === false) { event.preventDefault(); submitHandler(); } }; const toggleVoice = (event) => { event.preventDefault(); setVoiceChat(!isVoiceChat); console.log(isVoiceChat); } return ( <Container className='main flex-column' fluid> <SocketIO/> <Row noGutters> <Col xs={1} className="left-Col"> <div className="left-panel userlist text-white"> <h2> {room} </h2> <UserListComponent/> {/* <div className='voiceTab'> {isVoiceChat ? <Button onClick={toggleVoice}>Leave Chat</Button> : <Button onClick={toggleVoice}>Join Chat</Button>} </div> */} </div> </Col> <Col className="right-Col"> <div className="right-panel"> <MessageListComponent/> <Form className="message-form" onSubmit={submitHandler}> <Form.Control value={userMessage} onChange={e => setUserMessage(e.target.value)} className="message-box" placeholder="Send Message" onKeyDown={e => handleKeyDown(e)}/> </Form> </div> </Col> </Row> </Container> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getRoomURL() {\n return location.protocol + \"//\" + location.host + (location.path || \"\") + \"?room=\" + this.getRoom();\n }", "function getRoomURL() {\n\treturn location.protocol + \"//\" + location.host + (location.pathname || \"\") + \"?room=\" + getRoom();\n}", "function goChatRoomList(id){\n $(location).attr(\"href\",\"/chat/chatRoomList/\"+id);\n }", "goToChat(roomId, title, active, trainerPic, opponentId) {\n if (this.props.connectedToSendBird)\n this.props.gotoChatView({\n roomId,\n title,\n active,\n trainerPic,\n opponentId\n });\n }", "function load_chatroom( label, uname ){\n\tlink('chatroom', function(){\n\t\tselect_performer( label, uname )\n\t});\n}", "function joinedRoom( room ) {\n}", "render() {\n return (\n <Router> \n <Route exact path=\"/\" render = {\n (props) => {\n if (!this.state.nick) {\n return (\n <Login \n onNickChange = {this.onNickChange} \n onNickSubmit = {this.onSubmitLogin}\n />\n )\n } else {\n //create chatroom & past socket.id to window.location.pathname as unique identificator\n //copy result of address bar and send your friend for invite him to chatroom\n return <Redirect to={`/${socket.id}`} />;\n }\n }\n }/>\n \n <Route path=\"/:id\" render = {\n (props) => {\n if (!this.state.nick) {\n return (\n <Login \n onNickChange = {this.onNickChange} \n onNickSubmit = {this.onNickSubmit}\n />\n )\n } \n return (\n <div className = \"video-chat\">\n <Chat \n onTextChange = {this.onTextChange} \n onMessageSubmit = {this.onMessageSubmit} \n state = {this.state} \n renderChat = {this.renderChat} \n users = {this.state.users} \n renderOnline = {this.renderOnline}\n /> \n </div>\n )\n } \n }/>\n </Router>\n );\n }", "function setChatroom(room) {\n $('#chatroom h1').append(room);\n}", "function joinChatRoom(player) {\n\n var sessionID = player.sessionID;\n var room = player.params.map;\n\n io.sockets.sockets[sessionID].join(room);\n console.log(getTime() + ' ' + player.params.name + '[' + player.playerID + '] ENTERED ' + room);\n}", "function showRoomURL(roomid) {\n var roomQueryStringURL = '?roomid=' + roomid +'&password=' + document.getElementById('room-password').value;\n var html = 'Unique URL for your room:';\n html += '<a style=\"color: #E0E0E0; text-decoration: underline;\" href=\"' + roomQueryStringURL + '\" target=\"_blank\">' + roomQueryStringURL + '</a>';\n var roomURLsDiv = document.getElementById('room-urls');\n roomURLsDiv.innerHTML = html;\n roomURLsDiv.style.display = 'inline';\n roomURLsDiv.style.color = 'white';\n}", "function cO(id){\n\tvar url = 'chat/shicho.php?id=' + id;\n\twindow.open(url,\"memberChat\");\n}", "function joinPersonalRoom() {\n const roomName = createPrivateRoomName(drone.clientId);\n const myRoom = drone.subscribe(roomName);\n myRoom.on('open', error => {\n if (error) {\n return console.error(error);\n }\n console.log(`Successfully joined room ${roomName}`);\n });\n\n myRoom.on('message', message => {\n const {data, clientId} = message;\n const member = members.find(m => m.id === clientId);\n if (member) {\n addMessageToRoomArray(createPrivateRoomName(member.id), member, data);\n if (selectedRoom === createPrivateRoomName(clientId)) {\n DOM.addMessageToList(data, member);\n }\n } else {\n /* Message is sent from golang using the REST API.\n * You can handle it like a regular message but it won't have a connection\n * session attached to it (this means no member argument)\n */\n }\n });\n}", "function view (room) {\r\n const page = `\r\n\r\n <!DOCTYPE html>\r\n <html>\r\n <head>\r\n <meta charset=\"utf-8\"/>\r\n <title>Chat room '${room}'</title>\r\n </head>\r\n <body>\r\n <textarea id=\"log\" cols=\"100\" rows=\"20\" readonly></textarea><br>\r\n <input id=\"input\" type=\"text\" size=\"100\"><br>\r\n <input id=\"submit\" type=\"button\" value=\"Send\"> to room '${room}'\r\n \r\n <script>\r\n const ws = new WebSocket(\r\n 'ws://' + window.location.host + '/ws/' + '${room}'\r\n )\r\n\r\n ws.onmessage = function(e) {\r\n const data = JSON.parse(e.data);\r\n document.querySelector('#log').value += (data.message + '\\\\n')\r\n }\r\n\r\n ws.onclose = function(e) {\r\n console.error('socket closed')\r\n }\r\n\r\n document.querySelector('#input').focus();\r\n document.querySelector('#input').onkeyup = function(e) {\r\n if (e.keyCode === 13) {\r\n document.querySelector('#submit').click()\r\n }\r\n }\r\n\r\n document.querySelector('#submit').onclick = function(e) {\r\n const inputElem = document.querySelector('#input')\r\n ws.send(JSON.stringify({ 'message': inputElem.value }))\r\n inputElem.value = ''\r\n }\r\n </script>\r\n </body>\r\n </html>\r\n `\r\n return page\r\n}", "function showRoomURL(roomid) {\n var roomHashURL = '#' + roomid;\n var roomQueryStringURL = '?roomid=' + roomid;\n var html = '<h2>Unique URL for your room:</h2><br>';\n html += 'Hash URL: <a href=\"' + roomHashURL + '\" target=\"_blank\">' + roomHashURL + '</a>';\n html += '<br>';\n html += 'QueryString URL: <a href=\"' + roomQueryStringURL + '\" target=\"_blank\">' + roomQueryStringURL + '</a>';\n var roomURLsDiv = document.getElementById('room-urls');\n roomURLsDiv.innerHTML = html;\n roomURLsDiv.style.display = 'block';\n}", "function _joinRoom() {\n roomId = rooms[0].id;\n // Join the room\n socketInstance.post('/room/' + roomId + '/onlineUsers', { id: myChatId });\n }", "function getChat(roomNum){\n var chatRm = {\n room : roomNum\n };\n\n ajaxCall('POST', {a:'chat',method:'getChat', data:chatRm}, getChatCallback);\n}", "function showRoomURL(roomid) {\n var roomHashURL = '#' + roomid;\n var roomQueryStringURL = '?roomid=' + roomid;\n var html = '';\n html += 'Hash URL: <a href=\"' + roomHashURL + '\" target=\"_blank\">' + roomHashURL + '</a>';\n html += '<br>';\n html += 'QueryString URL: <a href=\"' + roomQueryStringURL + '\" target=\"_blank\">' + roomQueryStringURL + '</a>';\n var roomURLsDiv = document.getElementById('room-urls');\n roomURLsDiv.innerHTML = html;\n roomURLsDiv.style.display = 'block';\n}", "function showRoomList(data) {\n\tvar $room = $(data).find(\"room\");\n\n\tvar roomlist = \"\";\n\n\t$room.each(function () {\n\t\troomlist += \"<div><a href='#' onclick='joinroom(\" + $(this).find(\"id\").text() + \n\t\t \");'>Room: \" + $(this).find(\"roomname\").text() + \n\t\t \", Players: \" + $(this).find(\"players\").text() + \"</a></div>\";\n\t});\n\t\n\tif (roomlist == \"\") { roomlist = \"Ei aktiivisia huoneita.\"; }\n\t\n\t$(\"#roomlist\").html(roomlist);\n}", "function loadChatroomOnStart(chatroom) {\n $.post(\"/chatroom/joinedRooms\",{username: username}, function (rooms) {\n //Load general or show no room message if user not in General chat.\n let lowestId = null;\n rooms.forEach(function (room) {\n if (lowestId == null) {\n lowestId = room.id;\n } else if (room.id < lowestId) {\n lowestId = room.id;\n }\n });\n chatroom = lowestId;\n\n loadChatroom(chatroom);\n }, \"json\");\n}", "function joinUserRoom(name) {\r\n divHome.hide();\r\n divRoom.show();\r\n socket.emit(\"joinRoom\", name);\r\n currentRoom = name;\r\n}", "function getRoom(){\n\tvar chatName = document.getElementById(\"chatName\");\n\tif(!chatName)\n\t\treturn null;\n\treturn chatName.innerText;\n}", "function getRoomId() {\n var roomId = window.location.href.split('#')[1];\n if(!roomId) {\n roomId = Math.floor(Math.random() * 1000000);\n window.location.href += '#' + roomId;\n }\n return roomId;\n}", "function joinRoom(channel) {\n document.getElementById(\"channelHeader\").innerHTML = channel;\n localStorage.setItem('channel', channel)\n socket.emit(\"join\", {\"channel\": channel, \"username\": username})\n }", "function memberJoined( member, room ) {\n}", "function joinToChannel() {\n console.log(\"join to channel\", roomId);\n \n // store the room info to my meetings\n // if room does not exist set the whole info\n // if room exists update timestamp and date (to track for the recent call made) \n const mymeetings = firestore.collection(`${myName}`).doc(`${roomId}`);\n const snapshot = mymeetings.get();\n let timestamp = Date.now();\n let date = new Date().toString().slice(0,-34);\n if (!snapshot.exists) {\n try {\n mymeetings.set({ roomId, timestamp, date, roomName, createdBy });\n } catch (err) {\n console.log(err);\n }\n }\n else{\n try {\n mymeetings.update({'timestamp':timestamp, 'date':date });\n } catch (err) {\n console.log(err);\n }\n }\n socket.emit(\"join\", { channel: roomId, peerName: myName, });\n}", "function join(msg)\r\n{\r\n console.log(\"----> Client joining \" + msg[\"room\"]);\r\n web.io.emit(\"servermessage\", {\r\n \"room\": msg[\"room\"],\r\n \"command\": \"send_room\",\r\n \"data\": getRoom(msg[\"room\"])\r\n });\r\n}", "function joinRoom(event){\n \tvar x = $(event.target).text();\n if(x == roomIn){\n\n } else {\n socketio.emit(\"join_room\", {roomName:x, password:\"\"});\n }\n }", "function viewers(room) {\n const sockets = io.sockets.clients(room);\n const data = sockets.map(function(socket) { return socket.id; });\n if (data.length) io.sockets.in(room).emit('viewers', data);\n}", "function joinRoomListener (e) {\r\n displayChatMessage(\"Chat ready!\");\r\n displayChatMessage(\"Number of people now online: \" + chatRoom.getNumOccupants());\r\n displayChatMessage(\"Number of people now online: \" + chatRoom.getNumOccupants());\r\n}", "function TextContainer({ users,room}){\n\n function linkGenerate(){\n // var { name,room } = queryString.parse(location.url);\n var link=\"http://localhost:4000/video/\";\n\n window.location.href = link+encodeURI(room);\n\n }\n\n\n return(\n <div className=\"textContainer\">\n \n\n <button className=\"button mt-20\" onClick={linkGenerate}>Video call</button>\n <div>\n\n </div>\n {\n users\n ? (\n <div>\n <h1>People currently Online:</h1>\n <div className=\"activeContainer\">\n <h2>\n {users.map(({name}) => (\n <div key={name} className=\"activeItem\">\n {name}\n <img alt=\"Online Icon\" src={onlineIcon}/>\n </div>\n ))}\n </h2>\n </div>\n </div>\n )\n : null\n }\n </div>\n);\n}", "function loadLobby(){\n window.location.href = \"/lobby\";\n}", "createPoll(req, res){ \n let roomID = req.params.roomId;\n\n //idea: to have only one link use session and store in object {session id: room id} if curr session and room found in object render\n res.render('./teacher/create_poll', {roomID: roomID});\n }", "function joinToChannel() {\n console.log(\"join to channel\", roomId);\n \n // store the room info to my meetings\n // if room does not exist set the whole info\n // if room exists update timestamp and date (to track for the recent call made) \n const mymeetings = firestore.collection(`${myName}`).doc(`${roomId}`);\n const snapshot = mymeetings.get();\n let date = new Date().toString().slice(0,-34);\n let timestamp = Date.now();\n if (!snapshot.exists) {\n try {\n mymeetings.set({ roomId, timestamp, date, roomName, createdBy });\n } catch (err) {\n console.log(err);\n }\n }\n else{\n try {\n mymeetings.update({'timestamp':timestamp, 'date':date });\n } catch (err) {\n console.log(err);\n }\n }\n socket.emit(\"join\", { channel: roomId, peerName: myName, peerVideo: myVideoStatus, peerAudio: myAudioStatus, peerHand: myHandStatus, });\n}", "function renderRoom(req, res) {\n res.render('pages/room', {connectedUsers: connectedUsers});\n}", "updateRoomInfo() {\n const state = store.getState();\n if (this.props.location.pathname === Routes.Host) {\n this.props.setRoomId(state.user.roomId);\n }\n else {\n this.props.setRoomId(state.chat.inviteId);\n }\n }", "get roomId() {\n\t\treturn browser.element('.messages-container.flex-tab-main-content').getAttribute('id').replace('chat-window-', '');\n\t}", "async function showroom(){\n\n let list = await fetch ('/api/rooms').then(r=>r.text());\n list = JSON.parse(list);\n if (list !== null){\n list.forEach(el=>{\n console.log(el);\n let g = document.createElement('div')\n g.innerHTML = `<div class=\"chat\" id=\"3\"><a href=\"#\">\n <i class=\"far fa-comments fa-5x\"></i>\n <p class=\"chatroomName\">Chatroom</p>\n </a></div>`\n g.addEventListener('click',function(e){\n console.log(el.roomname)\n chooseroom(el.roomname)\n window.location = 'chatroom.html'\n })\n $('.chatroom').append(g)\n\n })\n }\n}", "function join ( room, username ) {\n \n var id = getRoomId ( room );\n \n mapUserRooms ( id, username );\n \n return id;\n}", "function joinRoom() {\n var u = document.getElementById(\"username\").value;\n if(u === \"\") {\n setJoinError(\"Please choose a username\");\n return;\n }\n var r = document.getElementById(\"room\").value;\n if(r === \"\") {\n setJoinError(\"Please enter a room\");\n return;\n }\n var c = document.getElementById(\"color\").value;\n if(c === \"\") {\n setJoinError(\"Please choose a color\");\n return;\n }\n r = r.replace(/\\s+/g, ''); // Remove whitespace from room name\n r = r.toLowerCase();\n var join_message = {username: u, room: r, color: c};\n Game = new MultiplayerGame(u, r);\n socket.emit('join', join_message)\n}", "function openNewChatWindow(nickname, id_dest)\n{\n // Calcule a size window\n var size = $( \".chat-window:last-child\" ).css(\"margin-left\");\n size_total = parseInt(size) + 400;\n\n // Make a new convers\n var newRoomID = randomStr(); \n socket.emit('room', newRoomID, nickname); // Ask to join a new room\n createChatWindow(nickname, newRoomID); // make a div in template\n}", "function joinRoom(socket, room) {\n //Each socket is related to each individual user\n //join user into a room\n\n socket.join(room);\n currentRoom[socket.id] = room;\n //Tell the users they are joined into a specific room\n socket.emit('joinResult', {room: room});\n\n //Tell to averyone in a room that a new user has joined\n socket.broadcast.to(room).emit('message', {\n text: nickNames[socket.id] + ' has joined ' + room + '.'\n });\n\n //Get all of other users in a room\n //var usersInRoom = io.sockets.clients(room); //does not work anymore\n var usersInRoom = io.sockets.adapter.rooms[room];\n\n if(usersInRoom.length > 1) { //If there was somebody\n //Summarizer which users are in the room\n var usersInRoomSummary = \"Users currently in \" + room + \": \";\n //Loop through all users in a room\n for (var userId in usersInRoom.sockets) {\n //To everyone else but the proper user, summarize them\n if (userId != socket.id ) {\n usersInRoomSummary += nickNames[userId] + \" \";\n }\n }\n\n //finish the summarization\n usersInRoomSummary += '.';\n //Tell to everyone who are joined to a room\n socket.emit('message', {text:usersInRoomSummary});\n }\n}", "function joinRoom() {\r\n let roomID = $(\"#joinRoomID\").val();\r\n socket.emit(\"joinByRoomID\", roomID);\r\n}", "function goToRoom(e) {\n\te.preventDefault();\n\n\tvar roomName = $.trim($('#roomName').val());\n\n\tif(!roomName){ return; } \n\n window.location.href = '/covert/room/' + roomName;\n}", "connectToRoom() {\n const activeRoom = get(this, 'roomId');\n if (activeRoom) {\n const sessionManager = get(this, 'webrtc');\n sessionManager.joinRoom(activeRoom);\n }\n }", "function video_chat_lobby()\n{\n\ttrace(\"video_chat_lobby()\");\n\tif ( $('#room-list').length ) {\n\t\tchat_room_list();\n\t}\n}", "function setRoom(name) {\n $('form').remove();\n $('h1').text(name);\n $('#subTitle').text('Link to join: ' + location.href);\n $('body').addClass('active');\n }", "function inviteParticipants() {\n if (roomUrl === null)\n return;\n\n var sharedKeyText = \"\";\n if (sharedKey && sharedKey.length > 0) {\n sharedKeyText =\n \"This conference is password protected. Please use the \" +\n \"following pin when joining:%0D%0A%0D%0A\" +\n sharedKey + \"%0D%0A%0D%0A\";\n }\n\n var conferenceName = roomUrl.substring(roomUrl.lastIndexOf('/') + 1);\n var subject = \"Invitation to a Jitsi Meet (\" + conferenceName + \")\";\n var body = \"Hey there, I%27d like to invite you to a Jitsi Meet\" +\n \" conference I%27ve just set up.%0D%0A%0D%0A\" +\n \"Please click on the following link in order\" +\n \" to join the conference.%0D%0A%0D%0A\" +\n roomUrl +\n \"%0D%0A%0D%0A\" +\n sharedKeyText +\n \"Note that Jitsi Meet is currently\" +\n \" only supported by Chromium,\" +\n \" Google Chrome and Opera, so you need\" +\n \" to be using one of these browsers.%0D%0A%0D%0A\" +\n \"Talk to you in a sec!\";\n\n if (window.localStorage.displayname) {\n body += \"%0D%0A%0D%0A\" + window.localStorage.displayname;\n }\n\n window.open(\"mailto:?subject=\" + subject + \"&body=\" + body, '_blank');\n }", "function linkChatRoomsToMessages(chatRoomLink) {\n\n const chatRoom = chatRoomLink.innerText;\n\n // remove all messages of old chat room\n const messageContainer = document.querySelector('#message-container');\n while (messageContainer.firstChild) {\n messageContainer.removeChild(messageContainer.lastChild)\n }\n\n loadMessages(chatRoom);\n\n // change backgroundColors of actual chat and cliked link\n const actualChatRoomId = '#' + localStorage.getItem('actual-chat-room').split(' ').join('-');\n document.querySelector(actualChatRoomId).style.backgroundColor = 'hotpink';\n localStorage.setItem('actual-chat-room', chatRoom);\n chatRoomLink.style.backgroundColor = '#80EAFF';\n\n}", "function joinRoom(roomName){\n //SEND THIS ROOM NAME TO THE SERVER, SO THE SERVER CAN JOIN IT\n nsSocket.emit('joinRoom', roomName, (numMembers)=>{\n //UPDATE ROOM MEMBER TOTAL NOW THAT WE'VE JOINED\n console.log(roomName);\n document.querySelector('.curr-room-num-users').innerHTML = `${numMembers} <span class=\"glyphicon glyphicon-user\"></span>`;\n });\n\n //WHEN THE HISTORY IS PUSHED, LOAD IT\n nsSocket.on('historyLoad',(history)=>{\n //UPDATE THE DOM WITH ALL CHAT HISTORY\n const messagesUL = document.querySelector('#messages');\n messagesUL.innerHTML = \"\";\n history.forEach((msg)=>{\n const newMsg = buildHTMLMessage(msg);\n messagesUL.innerHTML += newMsg;\n });\n //WANT NEWEST MESSAGES AT BOTTOM TO BE SCROLLED TO\n messagesUL.scrollTo(0,messagesUL.scrollHeight);\n\n\n });\n //UPDATE NUMBER OF MEMBERS IN THE ROOM\n nsSocket.on('updateMembers',(numMembers)=>{\n //WHEN SOMEONE JOINS/LEAVES A ROOM, UPDATE NUMBER COUNT\n document.querySelector('.curr-room-num-users').innerHTML = `${numMembers} <span class=\"glyphicon glyphicon-user\"></span>`;\n //WHEN SOMEONE JOINS A ROOM, UPDATE ROOM NAME\n document.querySelector('.curr-room-text').innerHTML = `${roomName}`;\n\n });\n\n \n /*************************************************** */\n // ALLOW FOR SEARCHING OF MESSAGES\n /*************************************************** */\n let searchBox = document.querySelector('#search-box');\n searchBox.addEventListener('input',(e)=>{\n //console.log(e.target.value);\n let messagesTxt = Array.from(document.getElementsByClassName('message-text'));\n let messageUsers = Array.from(document.getElementsByClassName('user-message'));\n let messageIMGs = Array.from(document.getElementsByClassName('user-image'));\n //NOW CHECK IF MATCHES MESSAGE CONTENTS\n messagesTxt.forEach((msg,i)=>{\n if(msg.innerText.toLowerCase().indexOf(e.target.value.toLowerCase()) === -1){\n //THE MESSAGE DOESNT CONTAIN THE USER SEARCH TERMS\n msg.style.display = \"none\";\n messageUsers[i].style.display = \"none\";\n messageIMGs[i].style.display = \"none\";\n }\n else{\n msg.style.display = \"block\";\n messageUsers[i].style.display = \"block\";\n messageIMGs[i].style.display = \"block\";\n }\n });\n });\n\n}", "function onRoomLinkHandler(link) {\r\n\tlinkUrl = link;\r\n\tconnList = {};\r\n\t//chat = [];\r\n}", "function listRooms(connection) {\n\tconnection.socket.emit('server/listRooms', {\n\t\trooms: roomRepository.getAll(),\n\t\tjoined: userRoomRepository.getRooms(connection.socket.decoded_token.id)\n\t});\n}", "function getRoom(request, response) {\n let roomName = request.params.roomName;\n // Chatroom.find({chatroom_name: roomName}, function (err, docs) {\n // if (err) {\n // console.log(err);\n // } else {\n // let roomId;\n // // If a chatroom with that name exists get it, else create one\n // if (docs.length > 0) {\n // roomId = docs[0].chatroom_id;\n // } else {\n // roomId = roomGenerator.roomIdGenerator()\n // const newChatroom = new Chatroom ({\n // chatroom_id: roomId,\n // chatroom_name: roomName\n // });\n\n // newChatroom\n // .save()\n // .then(item => console.log(item))\n // .catch(err => console.log(err));\n // }\n\n // TODO: Get the messages and submit to room.hbs\n Messages.find({ chatroom_name: roomName })\n .lean()\n .then((items) => {\n response.render(\"room\", {\n title: \"chatroom\",\n roomName,\n messages: items,\n isAvailable: true,\n // newRoomId: roomId\n });\n });\n}", "getRoom() {\n var query = location.search && location.search.split(\"?\")[1];\n\n if (query) {\n return (location.search && decodeURIComponent(query.split(\"=\")[1]));\n }\n\n return \"no-id\"\n }", "function joinRoom(room)\r\n{\r\n //TODO erase... Name must be known previously\r\n var name = '';\r\n while(name == '')\r\n {\r\n name = prompt(\"Wie heißt du?\");\r\n }\r\n\r\n socket.emit('requestRoom', room, name);\r\n document.getElementById(\"chooseRoom\").classList.add('hidden');\r\n \r\n //TODO: maybe show loading icon...\r\n}", "function joinRoom(socket, room) {\n socket.join(room);\n // Count the number of connected users to the room\n var active_connections = io.sockets.manager.rooms['/' + room].length;\n io.sockets.in(room).emit(\"user:connect\", active_connections);\n}", "function connectToRoom() {\n let roomId = $(\"#joinedRooms\").find('input[name=\"joined-room\"]:checked').val();\n if(!checkElement(roomId)) return;\n\n startChatArea();\n\n $.post(\"/chatroom/connect\", {username: username, chatroomId: roomId}, function (data) {\n chatroomId = roomId;\n chatroomType = data.type;\n chatroomName = data.name;\n adminList = data.admins;\n $(\"#chatRoomName\").html(data.name + \" (\" + data.type + \")\");\n $(\"#chatRoomDescription\").html(data.description);\n\n loadUser();\n\n displayMessages(roomId);\n getChatRoomUsers();\n\n //Clear unread notification\n let unread = $(\"#joined-room\" + chatroomId + \" + span .badge-danger\");\n unread.addClass(\"d-none\");\n unread.html(0);\n\n $('#collapseTwo').removeClass('show');\n $('#collapseOne').addClass('show');\n $(\"#joinedRooms\").find('input[name=\"joined-room\"]:checked').prop(\"checked\", false);\n }, \"json\");\n}", "function i(e){return(0,w.default)(e.participants,{state:\"JOINED\"})}", "function roomID(type){\n var matchRoomRequest;\n //urls for express sessions and normal sessions \n //are not the same \n if(type==\"workspace\"){\n matchRoomRequest = /.*\\/workspace\\/(.+)/;\n }\n else{\n matchRoomRequest = /.*\\/express\\/(.{32})/;\n }\n var match = matchRoomRequest.exec(document.URL);\n\n if(match){\n return match[1];\n }\n}", "function setJoinCallBtn() {\n joinCallBtn.addEventListener(\"click\", async (e) => {\n window.location.href='/join/' + roomId;\n });\n}", "function dial (room){\n if (room !== '') {\n socket.emit('create or join', room);\n console.log('Attempted to create or join room', room);\n }\n}", "function joinedCall(socket, socketId, username, path) {\n\tsocketIdToUsernameObj[socketId] = username; \n\tconsole.log('joined-call', { socketId, username, path }, socketIdToUsernameObj);\n\t// socket.data.username = username; // https://socket.io/docs/v4/server-socket-instance/#Socket-data\n\tif (connections[path] === undefined) {\n\t\tconnections[path] = []\n\t}\n\tconnections[path].push(socket.id);\n\ttimeOnline[socket.id] = new Date();\n\n\tconnections[path].forEach(connection => {\n\t\tio.to(connection).emit(\"other-participant-joined\", socket.id, connections[path], socketIdToUsernameObj);\n\t});\n\n\tif (messages[path] !== undefined) { // When a new participant joins, send all the messages that already existed in the room.\n\t\tmessages[path].forEach(message => {\n\t\t\tio.to(socket.id).emit(\"chat-message\", message['data'], message['sender'], message['socket-id-sender']);\n\t\t});\n\t}\n\n\tconsole.log(path, connections[path]);\n}", "joindreGroupe(socket,channel,username){\n $(\"#listDesMessages\").empty();\n $(\"#msgBox\").focus();\n var msg = new Message(\"onJoinChannel\", channel.id , null , username, null );\n socket.send(JSON.stringify(msg));\n document.getElementById(\"current_group_name\").innerHTML = channel.name;\n }", "joinRoom(data) {\n socket.emit('join-room', data);\n }", "function localLink(location) {\n const threadUrlParts = location.split(/[\\/&=]/);\n const channelId = threadUrlParts[4];\n const threadId = threadUrlParts[6];\n let threadUrl = 'https://app.slack.com/client/' + workspaceId + '/' + channelId\n\n if (threadId) {\n threadUrl += '/thread/' + channelId + '-' + threadId;\n }\n\n return threadUrl;\n }", "switchChat(){\n this.props.fetchMessages(this.props.friendship.room_id, 1)\n this.page = 1\n this.bottom.current.scrollIntoView()\n }", "function joinRoom(e, roomAlreadyCreated) {\n e.preventDefault();\n if (roomAlreadyCreated) {\n if (!document.getElementById(\"username_shareableRoom\").value.length < 1) {\n userName = document.getElementById(\"username_shareableRoom\").value;\n socket.open();\n var enteredRoomName = document.getElementById(\"roomToJoin\").value;\n userName = document.getElementById(\"username_shareableRoom\").value;\n socket.emit(\"joinRoom\", enteredRoomName, userName);\n currentRoom = enteredRoomName;\n MicroModal.close(\"shareableRoomCreatedModal\");\n // showStartGameButton();\n } else {\n document.getElementById(\"username_shareableRoom\").style.border =\n \"2px solid red\";\n setTimeout(function () {\n document.getElementById(\"username_shareableRoom\").style.border =\n \"2px solid black\";\n }, 3000);\n }\n } else {\n if (username()) {\n socket.open();\n var enteredRoomName = document.getElementById(\"enteredRoomName\").value;\n userName = document.getElementById(\"userName\").value;\n socket.emit(\"joinRoom\", enteredRoomName, userName);\n currentRoom = enteredRoomName;\n }\n }\n}", "function openPersonalChat(\n msginfo // Message Information Object.\n)\n{\n /*\n * Transition effect. */\n var jqMask = $('#mask'),\n jqWin, id, jqO, cY, cX, winW, winH,\n wcW, wcH,\n item;\n /*\n * Set position based on nick id. */\n id = app.str2id(msginfo.nick);\n jqO = $('#meeting > #streams > #scarousel div#' + id);\n\n if (jqO.length === 0 && msginfo.nick === \"overseer\") // from user not found, check if overseer\n {\n item = app.carousel.getItem(1);\n if (!item)\n {\n return;\n }\n jqO = $(item.object);\n }\n jqMask.fadeIn(500, activateWindow('#personalChat'));\n jqMask.fadeTo('fast', 0.3);\n /*\n * Set message. */\n jqWin = $('#boxes > div#personalChat');\n $('p.msg', jqWin).text('').html(decodeURI(msginfo.body));\n cY = jqO.offset().top;\n cX = jqO.offset().left;\n winW = $(window).width();\n winH = $(window).height();\n wcW = jqWin.outerWidth();\n wcH = jqWin.outerHeight();\n if ((cY + wcH) > winH) {\n jqWin.css('top', winH - wcH);\n }\n else {\n jqWin.css('top', cY);\n }\n if ((cX + wcW) > winW) {\n jqWin.css('left', winW - wcW);\n }\n else {\n jqWin.css('left', cX);\n }\n /*\n * Transition effect for Personal Chat Window.*/\n jqWin.fadeIn(700);\n /*\n * Add class active. */\n jqWin.addClass('active');\n return false;\n}", "function goToChat() {\n origin;\n jQuery(\".chat_banner\").hide();\n jQuery(\".banner-modal-box\").slideDown();\n jQuery(\"#history_div\").mCustomScrollbar({\n theme: \"dark-thick\",\n });\n document.getElementById('input_area').focus();\n chat();\n}", "function newZajChat(){\n\tzajajax.addGetRequest('zajprofile.php?chat=newchat', '', openZajChat);\n}", "function viewChat(instance_id, url)\n{\n props = 'toolbar=0,scrollbars=0,location=0,status=0,resizable=1,menubar=0,width=584,height=410';\n win = window.open('','Chat',props);\n win.document.writeln('<html>');\n win.document.writeln('<head><title>' + ICtxgopub.pe_txt11 +'</title></head>');\n win.document.writeln('<body>');\n win.document.writeln('<applet codebase=\"'+url+'\" archive=\"../download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0/multichat.jar\" CODE=\"GUIClient.class\" width=\"562\" height=\"385\" align=\"BOTTOM\">');\n win.document.writeln('<param name=\"CABBASE\" value=\"multichat.cab\">');\n win.document.writeln('<param name=\"roomid\" value=\"'+instance_id+'\">');\n win.document.writeln('</applet>');\n win.document.writeln('</body></html>');\n}", "componentWillMount() {\n const joinText\n = this.props._room ? 'Join the conversation' : 'Start a conference';\n\n // If the user installed the app while this Component was displayed\n // (e.g. the user clicked the Download the App button), then we would\n // like to open the current URL in the mobile app. The only way to do it\n // appears to be a link with an app-specific scheme, not a Universal\n // Link.\n const joinURL = `org.jitsi.meet:${window.location.href}`;\n\n this.setState({\n joinText,\n joinURL\n });\n }", "socketsJoin(room) {\r\n this.adapter.addSockets({\r\n rooms: this.rooms,\r\n except: this.exceptRooms,\r\n }, Array.isArray(room) ? room : [room]);\r\n }", "function getTalkId() {\n var talkId = window.location.href.replace('http://localhost:3000/talk/', '');\n return talkId;\n}", "function connect(room) {\n // Handle a chat connection.\n $('#text').focus();\n const chatbox = $('<div></div>').addClass('connection').addClass('active').attr('id', room.name);\n const roomName = room.name.replace('sfu_text_', '');\n const header = $('<h1></h1>').html('Room: <strong>' + roomName + '</strong>');\n const messages = $('<div><em>Peer connected.</em></div>').addClass('messages');\n chatbox.append(header);\n chatbox.append(messages);\n // Select connection handler.\n chatbox.on('click', () => {\n chatbox.toggleClass('active');\n });\n\n $('.filler').hide();\n $('#connections').append(chatbox);\n\n room.getLog();\n room.once('log', logs => {\n for (let i = 0; i < logs.length; i++) {\n const log = JSON.parse(logs[i]);\n\n switch (log.messageType) {\n case 'ROOM_DATA':\n messages.append('<div><span class=\"peer\">' + log.message.src + '</span>: ' + log.message.data + '</div>');\n break;\n case 'ROOM_USER_JOIN':\n if (log.message.src === peer.id) {\n break;\n }\n messages.append('<div><span class=\"peer\">' + log.message.src + '</span>: has joined the room </div>');\n break;\n case 'ROOM_USER_LEAVE':\n if (log.message.src === peer.id) {\n break;\n }\n messages.append('<div><span class=\"peer\">' + log.message.src + '</span>: has left the room </div>');\n break;\n }\n }\n });\n\n room.on('data', message => {\n if (message.data instanceof ArrayBuffer) {\n const dataView = new Uint8Array(message.data);\n const dataBlob = new Blob([dataView]);\n const url = URL.createObjectURL(dataBlob);\n messages.append('<div><span class=\"file\">' +\n message.src + ' has sent you a <a target=\"_blank\" href=\"' + url + '\">file</a>.</span></div>');\n } else {\n messages.append('<div><span class=\"peer\">' + message.src + '</span>: ' + message.data + '</div>');\n }\n });\n\n room.on('peerJoin', peerId => {\n messages.append('<div><span class=\"peer\">' + peerId + '</span>: has joined the room </div>');\n });\n\n room.on('peerLeave', peerId => {\n messages.append('<div><span class=\"peer\">' + peerId + '</span>: has left the room </div>');\n });\n }", "function showRoomURL(adminId) {\n var roomHashURL = '#' + adminId;\n var roomQueryStringURL = '?cam=' + adminId;\n const base_url = location.origin + '/demos/'\n\n var html = '<h2>Endereço único da sua sala: ';\n html += '<a href=\"' + roomQueryStringURL + '\" target=\"_blank\">' + roomQueryStringURL.replace(`?cam=`, ``) + '</a></h2>';\n\n // html += 'Hash URL: <a href=\"' + roomHashURL + '\" target=\"_blank\">' + roomHashURL + '</a>';\n // html += '<br>';\n html += '<input class=\"input is-expanded\" value=\"' + base_url + roomQueryStringURL + '\" type=\"text\"> <br>';\n\n var roomURLsDiv = document.getElementById('room-urls');\n roomURLsDiv.innerHTML = html;\n\n roomURLsDiv.style.display = 'block';\n}", "viewconference(conference){\n\n }", "joinRoom({state}, { roomId }) {\n return state.currentUser.joinRoom({ roomId });\n }", "function updateThread() {\r\n var message_text = $('#message_text').val();\r\n if ($.trim(message_text) == '') {\r\n return false;\r\n }\r\n var url = $(location).attr('href'),\r\n parts = url.split(\"/\"),\r\n thread_id = parts[parts.length-1];\r\n\r\n var data = {\r\n message_text: message_text,\r\n room: thread_id,\r\n thread_id: thread_id\r\n };\r\n socket.emit('server-message', data);\r\n }", "joinRoom(roomId) {\n this.socket.emit('create or join', roomId)\n console.log(`joinRoom ${roomId}`)\n this.roomId = roomId\n }", "function generateURL(){\n\tbroadcastURL.innerHTML = baseURL+senderID;\n}", "function joinPublicRoom() {\n const publicRoom = drone.subscribe(PUBLIC_ROOM_NAME);\n publicRoom.on('open', error => {\n if (error) {\n return console.error(error);\n }\n console.log(`Successfully joined room ${PUBLIC_ROOM_NAME}`);\n });\n\n // Received array of members currently connected to the public room\n publicRoom.on('members', m => {\n members = m;\n me = members.find(m => m.id === drone.clientId);\n DOM.updateMembers();\n });\n\n // New member joined the public room\n publicRoom.on('member_join', member => {\n members.push(member);\n DOM.updateMembers();\n });\n\n // Member left public room (closed browser tab)\n publicRoom.on('member_leave', ({id}) => {\n const index = members.findIndex(member => member.id === id);\n members.splice(index, 1);\n DOM.updateMembers();\n });\n\n // Received public message\n publicRoom.on('message', message => {\n const {data, member} = message;\n if (member && member !== me) {\n addMessageToRoomArray(PUBLIC_ROOM_NAME, member, data);\n if (selectedRoom === PUBLIC_ROOM_NAME) {\n DOM.addMessageToList(data, member);\n }\n }\n });\n}", "function go() {\r\n\tvar name = document.getElementById(\"roomName\").value;\r\n\tif(name !== \"\") {\r\n\t\twindow.location.replace(\"/?\" + name);\r\n\t}\r\n}", "function openChat(userID){\n if(page_type=='profile'){\n if($('#TenTimes-Modal .modal-title').text().search('Mutual')>-1){\n $('#TenTimes-Modal').modal('hide');\n }\n }\n showloading();\n channelChat.push(function() {\n channelizeUI.openChatBox(userID);\n });\n channelizeInit.callChannelize();\n}", "static get PATH() {\n return \"/beta/conversations/{conversation_uuid}/members\";\n }", "function joinroom(data) {\n\tvar tmproom = data;\n\tif (player != \"\" && passcode != \"\" && tmproom >= 0) {\n\n\t\tvar geturl = \"/sanaruudukko/rest/sr/process?func=joinroom&player=\" + player + \"&passcode=\" + passcode + \"&room=\" + tmproom;\n\t\t$.ajax({\n\t\t\tcache: false,\n\t\t\tdataType : 'xml',\n\t\t\ttype : 'GET',\n\t\t\turl : geturl,\n\t\t\tsuccess : function(data) {\n\t\t\t\tstartRoom(data);\n\t\t\t},\n\t\t});\n\t}\n}", "function startNewChat()\n\n\t{\n\t\tlocation.reload();\n\t}", "async function clickedChat(l) {\n // //console.log(\"userToken\", String(userToken).length);\n \n // var userToken = await AsyncStorage.getItem('userToken');\n // if(token!=null){\n\n // navigation.navigate(\"ChatSpecificScreenFinal\", {\n // name: l.uservisibility.name,\n // profilePic: l.uservisibility.profilePic,\n // jid: l.jid_main,\n // });\n // // return (<LoginToAccessScreen></LoginToAccessScreen>)\n // } else {\n // Login.current.open();\n // }\n if (token!=null) {\n var found =false;\n chat_roster_main.forEach(list=>{\n //console.log('sdsdsd',list.jid,l.jid)\n if(list.jid == l.jid){\n found = true;\n }\n })\n\n if(found){\n navigation.navigate(\"ChatSpecificScreen\", {\n // name: l.uservisibility.name.substr(0, 15),\n // profilePic: l.uservisibility.profilePic,\n // jid: l.jid_main,\n\n name: l.uservisibility.name.substr(0, 15),\n profilePic: l.uservisibility.profilePic,\n jid: l.jid,\n xmpp: null,\n messages: [],\n media: []\n });\n }else{\n alert('Sorry')\n }\n \n // return (<LoginToAccessScreen></LoginToAccessScreen>)\n } else {\n Login.current.open();\n }\n }", "function joinRoom() {\n\tif (state == null) {\n\t\t// var campname = document.querySelector('#incoming').value;\n\t\tvar campname = 'dgnby';\n\t\t// TODO: check name is valid, alert() if not\n\t\tdatabase.ref('hosts/' + campname + '/').update({\n\t\t\t// add client signal data to database\n\t\t\tjoinData: signalClient,\n\t\t});\n\n\t\tvar hostData = firebase.database().ref('hosts/' + name + '/hostData');\n\t\t// wait for host to respond to client signal data\n\t\thostData.on('value', function(snapshot) {\n\t\t\tif(state == \"client\"){\n\t\t\t\tsetTimeout(function(){ readAnswer(campname); }, 200);\n\t\t\t}\n\t\t});\n\t\tstate = \"client\";\n\t}\n\tdocument.getElementById('hostbox').style.animation='0.2s fadeOut forwards';\n}", "function joinPage(req, res) {\n\tres.render('join', {\n\t\tpopularSubjects: JSON.stringify(data.findPopularSubjects())\n\t});\n}", "function leaveRoom() {\n socketRef.current.emit(\"user clicked leave meeting\", socketRef.current.id);\n props.history.push(\"/\");\n }", "function join() {\n var roomName = roomField.value\n , userName = userField.value\n\n roomStore.set(\"room-name\", roomName)\n roomStore.set(\"user-name\", userName)\n\n roomField.value = \"\"\n userField.value = \"\"\n\n room.emit(\"join\", roomName, userName)\n}", "function onConferenceJoined(){\n\t\t console.log(\"conference joined!\");\n\t\t \n\t\t isJoined = true;\n\t\t for(var i = 0; i < _localTracks.length; i++)\n\t\t { \n\t\t \t_room.addTrack(_localTracks[i]);\n\t\t }\n\t\t console.log(\"tracks ::: \"+ _localTracks[0]);\n\t\t _myTrack = _localTracks[0];\n\t\t \n\t\t _room.setDisplayName(myDisplayName);\n\t\t \n\t\t localId = _room.myUserId();\n\t\t var isModerator = _room.isModerator();\n\t\t \n\t\t console.log(\"localId ::: \" + localId);\n\t\t console.log(\"isModerator ::: \" + _room.isModerator());\n\t\t \n\t\t var participents = _room.participants;\n\t\t console.info(\"Participents onConferenceJoined ::: \"+ participents);\n\t\t console.info(participents);\n\t\t \n\t\t _roomJoinResponse.isRoomJoined = true;\n\t\t _roomJoinResponse.room = _room;\n\t\t _roomConnectDeferred.resolve(_roomJoinResponse);\n\t\t \n\t\t}", "getHref() {\n switch (this.type) {\n case \"room\":\n return \"room.html?\" + this.id + \"+\" + this.title.split(' ').join('_');\n case \"device\":\n return \"device.html?\" + this.id + \"+\" + this.title.split(' ').join('_');\n default:\n return \"home.html\";\n }\n }", "function showPersonalChat(event)\n{\n var spot = $(event.currentTarget).parent();\n showPersonalChatWithSpot(spot.get(0));\n $(\"#msgBoard > input.chatTo\", spot).focus();\n}", "function activateChat() {\n $('#helpandchatimg').attr('alt', 'Chat');\n $('#helpandchatimg').attr('src', '/sites/all/themes/corvusbie/images/comment-discussion.svg');\n $('#helpandchattext').text('Ask a Librarian');\n $('#helpandchatlink').attr('href', '#');\n $('#helpandchatlink').click(function( event ) {\n event.preventDefault();\n window.open(\"https://ca.libraryh3lp.com/chat/carleton@chat.ca.libraryh3lp.com?skin=15653\", \"AskUs\", \"resizable=1,width=375,height=350\");\n });\n }", "async function createFriendLink() {\n\tlatestChatLink = await iris.Channel.createChatLink(\n\t\tgun,\n\t\tkey,\n\t\t\"https://letsvibe.io/\"\n\t);\n}", "function handleJoinRoom(room_name){\n clearErrors();\n socket.emit(\"join_room\", room_name);\n }", "joinRoom(room, hostExist, listensers) {\n trace(`Entering room '${room}'...`);\n this.socket.emit('join', room, hostExist, listensers);\n }", "function joinAndConnectRoom (roomId) {\n $.post(\"/chatroom/joinedRooms\", {username:username}, function(data) {\n let joinedRoomsGroup = $(\"#joinedRooms\");\n joinedRoomsGroup.empty();\n if (data == null) return;\n for(let i = 0; i < data.length ;i++) {\n let room = data[i];\n let type = room.type;\n let roomTemp = templateJoinedRoom;\n roomTemp = roomTemp.replace('ROOM-NAME', room.name);\n roomTemp = roomTemp.replace('ROOM-ID',room.id);\n roomTemp = roomTemp.replace('all-room-ROOM-ID','joined-room' + room.id);\n if(type === \"Public\") {\n if(room.name === \"General\") {\n roomTemp = roomTemp.replace('ROOM-STYLE',\"list-group-item-success\");\n } else {\n roomTemp = roomTemp.replace('ROOM-STYLE',\"list-group-item-primary\");\n }\n } else if (type === \"Private\") {\n roomTemp = roomTemp.replace('ROOM-STYLE',\"list-group-item-secondary\");\n } else {\n return null;\n }\n roomTemp = roomTemp.replace('ROOM-GROUP-NAME',\"joined-room\");\n joinedRoomsGroup.append(roomTemp);\n }\n $('#joined-room' + roomId).prop(\"checked\", true);\n connectToRoom();\n },\"json\");\n}", "function goToRoomURL(){\n \tvar number = $.trim($(\"#roomNameInput\").val());\n\t\t$( \"#link\" ).html(\"Calling Room Created\");\n\t\t//window.location = \"https://appr.tc/r/\" + number;\n document.getElementById(\"videobox\").innerHTML = \"<iframe src=\\\"https://appr.tc/r/\" + number + \"\\\" id=\\\"appr\\\"></iframe>\";\n //$( \"#videobox\" ).innerHTML = \"<iframe src=\\\"https://appr.tc/r/\" + number + \"\\\" id=\\\"appr\\\"></iframe>\";\n }", "function leaveroom(room) {\n document.querySelector('.chat').innerHTML = '';\n socket.emit('leave', { \"user\": user, \"room\": curr_room })\n}" ]
[ "0.7066661", "0.706312", "0.67175996", "0.6548493", "0.64780474", "0.6311561", "0.624417", "0.62141675", "0.6209262", "0.61767095", "0.6121753", "0.6104321", "0.6098796", "0.60917544", "0.6036749", "0.6029682", "0.60183376", "0.6017449", "0.5991532", "0.59879243", "0.5968742", "0.596464", "0.5918473", "0.5902047", "0.58940476", "0.588954", "0.58730507", "0.58686143", "0.58544207", "0.5853247", "0.5851121", "0.58505327", "0.5839386", "0.5833475", "0.58180904", "0.5812438", "0.57855916", "0.57768375", "0.5760086", "0.57561314", "0.5707184", "0.5700428", "0.5692656", "0.5691294", "0.5690185", "0.5663524", "0.5661705", "0.565869", "0.5626636", "0.56131226", "0.56086767", "0.5601515", "0.56005406", "0.5596601", "0.558857", "0.5586416", "0.5576149", "0.5574136", "0.55706656", "0.55679715", "0.55644196", "0.555795", "0.5551004", "0.5549672", "0.5541687", "0.5539113", "0.5536573", "0.5533286", "0.5532435", "0.55317986", "0.5530745", "0.552763", "0.55259347", "0.5520279", "0.5513639", "0.55129284", "0.55108577", "0.5510829", "0.5510773", "0.550985", "0.5499674", "0.54994243", "0.5491995", "0.54848176", "0.54787177", "0.5468071", "0.5466985", "0.5463806", "0.54636896", "0.5461635", "0.5454758", "0.54481417", "0.54422736", "0.54337335", "0.54221666", "0.54165345", "0.54114467", "0.54099745", "0.5398169", "0.5395323", "0.5390818" ]
0.0
-1
BROADCAST / EMIT / ON FUNCTION
function initEventListener() { //$scope.$on(vm.controllerId + '.action.refresh', function (event, data) { // getPage(_tableState); //}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Emiter() {}", "function justForward(call) {\n engine.on(call, function() {\n sio.sockets.emit.apply(sio.sockets, _.flatten([call, arguments]));\n });\n }", "function Emitter () {}", "function sink() {}", "function sink() {}", "function emit(msg){\n\tconsole.log(msg);\n}", "function emitEvent(fn) {\n if (typeof fn != 'function') return\n\n var args = [].slice.call(arguments, 1)\n return fn.apply(null, args)\n}", "function sink(a) { }", "_emit(subject, predicate, object, graph) {\n this._callback(null, this._quad(subject, predicate, object, graph || this.DEFAULTGRAPH));\n }", "_emit(subject, predicate, object, graph) {\n this._callback(null, this._quad(subject, predicate, object, graph || this.DEFAULTGRAPH));\n }", "on(ev, fn) {\n this.emitter.on(ev, fn);\n }", "emit(...args){\n let emitter = privateMembers.get(this).emitter;\n emitter.emit(...args);\n }", "emit(...args){\n let emitter = privateMembers.get(this).emitter;\n emitter.emit(...args);\n }", "function _emit(funcParamObj,onExecuteComplete){\r\n\r\n /** default object content of an operation */\r\n var operationObj = funcParamObj.operationRef;\r\n var data = funcParamObj.payload;\r\n\r\n try {\r\n\r\n _getWebSocketService().emit();\r\n onExecuteComplete(null,funcParamObj);\r\n\r\n }catch(error){\r\n\r\n /** dispatch the error to the next op in chain */\r\n onExecuteComplete(error,funcParamObj);\r\n }\r\n}", "on(event, fn) {\n\t\tthis.emitter.on(event, fn);\n\t}", "function emitNone(handler,isFn,self){if(isFn)handler.call(self);else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i<len;++i){listeners[i].call(self);}}}", "function emitNone(handler,isFn,self){if(isFn)handler.call(self);else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i<len;++i){listeners[i].call(self);}}}", "function foo(x) {\n x.sink(1,2,3)\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n }", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n }", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n }", "emit() {\n\t\t\tlet currentListeners = listeners;\n\t\t\tfor (let i=0; i<currentListeners.length; i++) {\n\t\t\t\tcurrentListeners[i].apply(null, arguments);\n\t\t\t}\n\t\t}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n }", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n }", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n }", "function emitNone(handler, isFn, self) {\n if (isFn) handler.call(self);else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n\n for (var i = 0; i < len; ++i) listeners[i].call(self);\n }\n }", "broadcast(funcName, args){\n for(let {name,component} of this.#components){\n if(typeof component[funcName] === \"function\"){\n component[funcName](args);\n }\n }\n }", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n }", "function sink(x,y,z) {}", "function emitNone(handler, isFn, self) {\n\t if (isFn)\n\t handler.call(self);\n\t else {\n\t var len = handler.length;\n\t var listeners = arrayClone(handler, len);\n\t for (var i = 0; i < len; ++i)\n\t listeners[i].call(self);\n\t }\n\t}", "function emitNone(handler, isFn, self) {\n\t if (isFn)\n\t handler.call(self);\n\t else {\n\t var len = handler.length;\n\t var listeners = arrayClone(handler, len);\n\t for (var i = 0; i < len; ++i)\n\t listeners[i].call(self);\n\t }\n\t}", "function emitNone(handler, isFn, self) {\n\t if (isFn)\n\t handler.call(self);\n\t else {\n\t var len = handler.length;\n\t var listeners = arrayClone(handler, len);\n\t for (var i = 0; i < len; ++i)\n\t listeners[i].call(self);\n\t }\n\t}", "function emitNone(handler, isFn, self) {\n\t if (isFn)\n\t handler.call(self);\n\t else {\n\t var len = handler.length;\n\t var listeners = arrayClone(handler, len);\n\t for (var i = 0; i < len; ++i)\n\t listeners[i].call(self);\n\t }\n\t}", "function emitNone(handler, isFn, self) {\n\t if (isFn)\n\t handler.call(self);\n\t else {\n\t var len = handler.length;\n\t var listeners = arrayClone(handler, len);\n\t for (var i = 0; i < len; ++i)\n\t listeners[i].call(self);\n\t }\n\t}", "function emitNone(handler, isFn, self) {\n\t if (isFn)\n\t handler.call(self);\n\t else {\n\t var len = handler.length;\n\t var listeners = arrayClone(handler, len);\n\t for (var i = 0; i < len; ++i)\n\t listeners[i].call(self);\n\t }\n\t}", "function emitNone(handler, isFn, self) {\n\t if (isFn)\n\t handler.call(self);\n\t else {\n\t var len = handler.length;\n\t var listeners = arrayClone(handler, len);\n\t for (var i = 0; i < len; ++i)\n\t listeners[i].call(self);\n\t }\n\t}", "emit(eventName,param,next) {\n if (!this._events[eventName]) throw new Error(`${eventName} is not registered`);\n this._events[eventName](param);\n if (typeof next == 'function') next();\n }", "emitChange() {\n this.changeEmitters.forEach(func => func.call(null));\n }", "onMarketDepth100Event(fn) {\n\n this.eventEmitter.on(settings.socket.marketDepth100Event, (data) => {\n\n fn(data);\n\n });\n }", "function Main(func){\n\t\tTone = func();\n\t}", "function Main(func){\n\t\tTone = func();\n\t}", "function Main(func){\n\t\tTone = func();\n\t}", "function Main(func){\n\t\tTone = func();\n\t}", "function Main(func){\n\t\tTone = func();\n\t}", "function Main(func){\n\t\tTone = func();\n\t}", "function Main(func){\n\t\tTone = func();\n\t}", "onJoined(fn) {\n\n this.eventEmitter.on(settings.socket.joined, (data) => {\n\n fn(data)\n });\n }", "on(...args){\n let emitter = privateMembers.get(this).emitter;\n emitter.on(...args);\n }", "on(...args){\n let emitter = privateMembers.get(this).emitter;\n emitter.on(...args);\n }", "async broadcast(rawtx) {\n console.log('broadcasting')\n }", "function DataEmitter() {\n}", "function int(){\n socket.emit(\"int\") // send a message to server\n}", "on() {\n socket.emit('OUTPUT', { index: this.index, method: 'on' });\n }", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}", "function emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}" ]
[ "0.6712139", "0.6387208", "0.61682653", "0.608522", "0.608522", "0.60508585", "0.6013302", "0.57759196", "0.576958", "0.576958", "0.5760716", "0.573627", "0.573627", "0.57170767", "0.571421", "0.5688087", "0.5688087", "0.5658897", "0.5652307", "0.5652307", "0.5652307", "0.56340426", "0.5606777", "0.5606777", "0.5606777", "0.5595603", "0.5594522", "0.55894583", "0.55759346", "0.55745995", "0.55745995", "0.55745995", "0.55745995", "0.55745995", "0.55745995", "0.55745995", "0.55728066", "0.5543506", "0.5541174", "0.5530038", "0.5530038", "0.5530038", "0.5530038", "0.5530038", "0.5530038", "0.5530038", "0.5524977", "0.5524312", "0.5524312", "0.5515883", "0.55001575", "0.54806983", "0.5477397", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326", "0.5473326" ]
0.0
-1
Group columns by table and sort them by name (longest first). After that sort tables in same manner (longest table first)
static groupByTableAndSortByLength(columns) { columns = columns.sort((a, b) => b.name.length - a.name.length); let tables = _.groupBy( columns, 'tableName' ); return Object.keys(tables).sort((a, b) => b.length - a.length).reduce((result, key) => { result.set(key, tables[key]); return result; }, new Map()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function columnate(...columnGroupOpts) {\n const columnGroups = columnGroupOpts.map(([label, list]) => ({\n label,\n width: 0,\n list: list.reverse(),\n columns: [],\n }))\n\n while (!columnGroups.every(group => !group.list.length)) {\n columnGroups.forEach(group => {\n while (group.list.length) {\n const column = {\n width: 0,\n rows: [],\n }\n group.columns.push(column)\n\n // HEADER + SPACE\n for (let rowIndex = 0; rowIndex < tableHeight - 1 - PADDING_V; rowIndex++) {\n if (!group.list.length) break\n const item = group.list.pop()\n column.rows.push(item)\n if (item.length > column.width) column.width = item.length\n }\n\n group.width += column.width + PADDING_H\n }\n })\n }\n\n // print headers\n columnGroups.forEach(group => {\n // if label is wider than all this group's columns, add some space to the last column\n const labelOverhang = group.label.length + PADDING_H - group.width\n if (labelOverhang > 0) {\n group.width += labelOverhang\n group.columns[group.columns.length - 1].width += labelOverhang\n }\n\n // print label\n process.stdout.write(group.label)\n let remainingSpace = group.width - group.label.length\n while (remainingSpace-- > 0) process.stdout.write(' ')\n })\n const headerHeight = PADDING_V + 1\n for (let i = 0; i < headerHeight; i++) process.stdout.write('\\n')\n\n // print content\n for (let rowIndex = 0; rowIndex < tableHeight - headerHeight; rowIndex++) {\n columnGroups.forEach(group => group.columns.forEach((column, columnIndex) => {\n let remainingSpace = column.width + PADDING_H\n const cell = column.rows[rowIndex]\n if (cell) {\n process.stdout.write(cell || '')\n remainingSpace -= cell.length\n }\n while (remainingSpace-- > 0) process.stdout.write(' ')\n }))\n process.stdout.write('\\n')\n }\n}", "function sortColumns(columns) {\n function sortFunction(a, b) {\n return (a.useCount < b.useCount) - (a.useCount > b.useCount);\n }\n\n columns.sort(sortFunction);\n }", "function sortTable(column){\n\n}", "function set_column_tool_order() {\n $('#showColumnList').each(function() {\n var col_array = data_local;\n var tr = $(this);\n for(var b = col_array.length-1; b >= 1; b--){\n var a = b-1;\n var tda = tr.find($('.'+col_array[a]));\n var tdb = tr.find($('.'+col_array[b]));\n tda.detach().insertBefore(tdb);\n }\n });\n set_column_short_order();\n}", "sortColumns(columns) {\n return Object.keys(columns).sort((a, b) => {\n const aName = columns[a].column.name,\n bName = columns[b].column.name;\n if (aName.slice(0, 4) === bName.slice(0, 4)) {\n return seasonMap[aName.slice(5)] > seasonMap[bName.slice(5)]? 1:-1;\n }\n return aName > bName? 1:-1;\n });\n }", "function sortTable(table, col) {\n var tb = table.tBodies[0];\n var tr = Array.prototype.slice.call(tb.rows, 0);\n var i;\n global_col = col;\n tr = tr.sort(compare);\n for (i = 0; i < tr.length; ++i){\n tb.appendChild(tr[i]);\n }\n}", "function sortTable() {\n const col = this.dataset.colname;\n const order = this.dataset.order;\n const nameCapi = col.charAt(0).toUpperCase() + col.slice(1);\n\n if (col == 'birthdate') {\n // for date sorting\n\n if (order == 'desc') {\n this.dataset.order = 'asc';\n this.innerHTML = `${nameCapi} &#9660`;\n tableData = tableData.sort((a, b) =>\n new Date(a[col]) > new Date(b[col]) ? 1 : -1\n );\n } else {\n this.dataset.order = 'desc';\n this.innerHTML = `${nameCapi} &#9650`;\n tableData = tableData.sort((a, b) =>\n new Date(a[col]) < new Date(b[col]) ? 1 : -1\n );\n }\n }\n // string & number sorting\n else if (order == 'desc') {\n this.dataset.order = 'asc';\n this.innerHTML = `${nameCapi} &#9660`;\n tableData = tableData.sort((a, b) => (a[col] > b[col] ? 1 : -1));\n } else {\n this.dataset.order = 'desc';\n this.innerHTML = `${nameCapi} &#9650`;\n tableData = tableData.sort((a, b) => (a[col] < b[col] ? 1 : -1));\n }\n\n buildTable(tableData);\n}", "function col_sort(m) {\n lesser = !lesser\n // Swaps two columns of the table\n jQuery.moveColumn = function (table, from, to) {\n var rows = jQuery('tr', table);\n\n var hidden_child_row = table.find('tr.tablesorter-childRow');\n\n hidden_child_row.each(function () {\n inner_table = jQuery(this).find('table.tbl_questlist')\n hidden_table = inner_table.eq(0).find('tr')\n\n\n hidden_table.eq(from - 1).detach().insertBefore(hidden_table.eq(to - 1));\n if (from - to > 1) {\n hidden_table.eq(to - 1).detach().insertAfter((hidden_table.eq(from - 2)));\n\n }\n\n });\n\n\n var cols;\n rows.each(function () {\n cols = jQuery(this).children('th, td');\n cols.eq(from).detach().insertBefore(cols.eq(to));\n if (from - to > 1) {\n cols.eq(to).detach().insertAfter((cols.eq(from - 1)));\n\n }\n });\n }\n\n // Gets all the table with the class \"tbl_heat\"\n var tables = $(\"table.tbl_heat\");\n // Get all the rows with the class accordion-toggle\n var tbr = tables.eq(m).find('tr.accordion-toggle');\n // Get the cells from the last row of the table\n var columns = tbr.eq(tbr.length - 1).find('td');\n // Init an array to hold the review total\n var sum_array = [];\n // iterate through the rows and calculate the total of each review\n for (var l = 2; l < columns.length - 2; l++) {\n var total = 0;\n for (var n = 0; n < tbr.length; n++) {\n var row_slice = tbr.eq(n).find('td');\n if (parseInt(row_slice[l].innerHTML) > 0) {\n total = total + parseInt(row_slice[l].innerHTML)\n }\n }\n sum_array.push(total)\n }\n\n // The sorting algorithm\n for (var i = 3; i < columns.length - 2; i++) {\n var j = i;\n while (j > 2 && compare(sum_array[j - 2], sum_array[j - 3], lesser)) {\n var tmp\n tmp = sum_array[j - 3]\n sum_array[j - 3] = sum_array[j - 2]\n sum_array[j - 2] = tmp\n jQuery.moveColumn($(\"table.tbl_heat\").eq(m), j, j - 1);\n // This part is repeated since the table is updated\n tables = $(\"table.tbl_heat\")\n tbr = tables.eq(m).find('tr.accordion-toggle');\n columns = tbr.eq(tbr.length - 1).find('td')\n j = j - 1;\n\n }\n }\n}", "function alignTables()\n{\n\n var largest = 0;\n $('table.print_table').each(function() {\n var width = $(this)[0].offsetWidth;\n if(width > largest) {\n largest = width;\n }\n }).width(largest);\n\n}", "function sortFunc() {\n let table = container.querySelector('.table');\n let headers = table.querySelectorAll('th');\n let tableBody = table.querySelector('tbody');\n let rows = tableBody.querySelectorAll('.table__row_visible');\n\n // Sort direction.\n let directions = Array.from(headers).map(function (header) {\n return '';\n });\n\n // Changing td contents in the approptiate column.\n let transform = function (index, content) {\n // Getting the data-type of the column.\n let type = headers[index].getAttribute('data-type');\n switch (type) {\n case 'number':\n return parseFloat(content);\n case 'string':\n default:\n return content;\n }\n };\n\n function sortColumn(index) {\n\n // Get the current diretion.\n let direction = directions[index] || 'asc';\n\n // Direction.\n let multiplier = (direction === 'asc') ? 1 : -1;\n let rows = tableBody.querySelectorAll('.table__row_visible');\n let newRows = Array.from(rows);\n newRows.sort(function (rowA, rowB) {\n\n let cellA = rowA.querySelectorAll('td')[index].innerHTML;\n let cellB = rowB.querySelectorAll('td')[index].innerHTML;\n\n let a = transform(index, cellA);\n let b = transform(index, cellB);\n\n switch (true) {\n case a > b: return 1 * multiplier;\n case a < b: return -1 * multiplier;\n case a === b: return 0;\n }\n });\n\n // Delete old rows.\n [].forEach.call(rows, function (row) {\n tableBody.removeChild(row);\n });\n\n // Change the direction.\n directions[index] = direction === 'asc' ? 'desc' : 'asc';\n\n // Add new rows.\n newRows.forEach(function (newRow) {\n tableBody.appendChild(newRow);\n });\n\n let allArrows = container.querySelectorAll(\".table__arrow\");\n let currArrow = event.currentTarget.querySelector(\".table__arrow\");\n for (let arrow of allArrows) {\n if (arrow !== currArrow) {\n arrow.classList = \"\";\n arrow.classList.add(\"table__arrow\");\n arrow.classList.add(\"table__arrow_default\");\n }\n }\n if (currArrow.classList.contains(\"table__arrow_default\")) {\n currArrow.classList.remove(\"table__arrow_default\");\n currArrow.classList.add(\"table__arrow_asc\");\n } else if (currArrow.classList.contains(\"table__arrow_asc\")) {\n currArrow.classList.remove(\"table__arrow_asc\");\n currArrow.classList.add(\"table__arrow_desc\");\n } else if (currArrow.classList.contains(\"table__arrow_desc\")) {\n currArrow.classList.remove(\"table__arrow_desc\");\n currArrow.classList.add(\"table__arrow_asc\");\n }\n };\n\n [].forEach.call(headers, function (header, index) {\n header.addEventListener('click', function () {\n sortColumn(index);\n });\n });\n }", "function set_table_order() {\n $('table tr').each(function() {\n var col_array = data_local;\n var tr = $(this);\n for(var b = col_array.length-1; b >= 1; b--){\n var col_a = $('.'+col_array[b-1]);\n var col_b = $('.'+col_array[b]);\n\n var tda = tr.find(col_a);\n var tdb = tr.find(col_b);\n tda.detach().insertBefore(tdb);\n }\n });\n}", "function combineColumns(){\n //group all selected columns\n var colGroups = groupSelectedColumns();\n //combine columns horizontaly\n combineColumnsHorizontal(colGroups);\n\n}", "function sortRows(){\n sortRowsAlphabeticallyUpwards();\n}", "function sortCodaTableCols(sourceRows) {\n var headerCodaTable = sourceRows[0]['cells'].map(function(row) { return row['column'] });\n var sheetsColOrder = [];\n \n headerRow.map(function(col) {\n sheetsColOrder.push(headerCodaTable.indexOf(col))\n })\n \n var sortedSourceRows = sourceRows.map(function(row) {\n var cells = sheetsColOrder.map(function(col) {\n if (col == -1) {\n return { \n column: null,\n value: null,\n }\n } \n else {\n return {\n column: headerCodaTable[col], \n value: row['cells'][col]['value'],\n } \n }\n });\n return {cells: cells}\n })\n return sortedSourceRows;\n}", "function sortTable()\r\n\t{\r\n\t\tvar\t\tj;\r\n\r\n\t\tvar\t\tcolumn = 1;\r\n\t\tvar\t\tcolumnFound = false;\r\n\r\n\r\n\t\ttry\r\n\t\t{\r\n\t\t\tchangeSort = false;\r\n\r\n\t\t\tfor ( j = 0; j < class_columnDefinitionArray.length; j++ )\r\n\t\t\t{\r\n\t\t\t\tif ( undefined !== class_sortColumn.match( class_columnDefinitionArray[j].GetColName() ) )\r\n\t\t\t\t{\r\n\t\t\t\t\tclass_columnDefinitionArray[j].class_sortTableCol( false );\r\n\t\t\t\t\tcolumnFound = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif ( !columnFound )\r\n\t\t\t{\r\n\t\t\t\t//\r\n\t\t\t\t// We were given an invalid column to sort on, sort on what is in column 2,\r\n\t\t\t\t// which is the name column in a standard browse view\r\n\t\t\t\t//\r\n\t\t\t\tif ( class_columnDefinitionArray.length >= 2 )\r\n\t\t\t\t{\r\n\t\t\t\t\tcolumn = 2;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tclass_sortColumn = class_columnDefinitionArray[column].GetColName();\r\n\t\t\t\tclass_columnDefinitionArray[column].class_sortTableCol( false );\r\n\t\t\t}\r\n\r\n\t\t\tchangeSort = true;\r\n\t\t}\r\n\t\tcatch(e)\r\n\t\t{\r\n\t\t\texceptionAlert( e, \"Issue occured in classbrowse.js/sortTable. An issue has occured in sorting the browse table. sort - \" + class_sortColumn );\r\n\t\t}\r\n\t}", "function sortTable(n, tableName) {\n\t var table,\n\t rows,\n\t switching,\n\t i,\n\t x,\n\t y,\n\t shouldSwitch,\n\t dir,\n\t switchcount = 0;\n\t table = document.getElementById(tableName);\n\t switching = true;\n\t dir = \"asc\";\n\t while (switching) {\n\t switching = false;\n\t rows = table.getElementsByTagName(\"TR\");\n\t for (i = 1; i < rows.length - 1; i++) {\n\t shouldSwitch = false;\n\t x = rows[i].getElementsByTagName(\"TD\")[n];\n\t y = rows[i + 1].getElementsByTagName(\"TD\")[n];\n\t if (dir == \"asc\") {\n\t if (parseInt(x.innerHTML) < parseInt(y.innerHTML)) {\n\t shouldSwitch = true;\n\t break;\n\t }\n\t } else if (dir == \"desc\") {\n\t if (parseInt(x.innerHTML) > parseInt(y.innerHTML)) {\n\t shouldSwitch = true;\n\t break;\n\t }\n\t }\n\t }\n\t if (shouldSwitch) {\n\t rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);\n\t switching = true;\n\t switchcount++;\n\t } else {\n\t if (switchcount == 0 && dir == \"asc\") {\n\t dir = \"desc\";\n\t switching = true;\n\t }\n\t }\n\t }\n\t}", "function sortTable(header, columnIndex, columns) {\n var container = header.parentElement;\n var descending = header.classList.contains(sortAsc);\n container.querySelectorAll(\"div.table-header\").forEach(\n function(header) {\n header.classList.remove(sortAsc);\n header.classList.remove(sortDesc);\n }\n )\n var cells = container.children;\n var rows = [];\n for (var i = columns; i < cells.length; i += columns) {\n rows.push(Array.prototype.slice.call(cells, i, i + columns));\n }\n var comparator = function(a, b) {\n var ka = makeComparable(a[columnIndex].textContent);\n var kb = makeComparable(b[columnIndex].textContent);\n if (ka < kb)\n return descending ? 1 : -1;\n if (ka > kb)\n return descending ? -1 : 1;\n return 0;\n };\n var sorted = rows.sort(comparator);\n var visible = 0;\n sorted.forEach(function(row) {\n if (row[0].style.display !== 'none') {\n var isEvenRow = visible++ % 2 === 0;\n }\n row.forEach(function(cell) {\n toggleStyle(cell.classList, isEvenRow, evenRowColor, oddRowColor);\n container.appendChild(cell);\n })\n });\n toggleStyle(header.classList, descending, sortDesc, sortAsc);\n}", "function sortTable(n) {\n console.log(n);\n let res = [];\n let heading = document.querySelectorAll(\"th\");\n let title = [];\n for (let i = 0; i < heading.length; i++) {\n title.push(heading[i].innerText);\n }\n console.log(title);\n let rows = document.querySelectorAll(\"tr\");\n console.log(rows);\n for (let i = 0; i < rows.length; i++) {\n let column = [];\n let cells = rows[i].querySelectorAll(\"td\");\n for (let j = 0; j < cells.length; j++) {\n column.push(cells[j].innerText);\n }\n res.push(column);\n }\n\n res = sortByColumn(res, n);\n let table = document.getElementById(\"table\");\n let tableData = \"\";\n tableData += \"<tr>\";\n for (let i = 0; i < title.length; i++) {\n tableData += `<th onclick=\"sortTable(${i})\">${title[i]}</th>`;\n }\n tableData += `</tr>`;\n for (let i = 1; i < res.length; i++) {\n tableData += '<tr class=\"items\">';\n for (let j = 0; j < res[i].length; j++) {\n tableData += `<td>${res[i][j]}</td>`;\n }\n tableData += `</tr>`;\n }\n table.innerHTML = tableData;\n}", "function multisort(table, sortList) {\n\t\t\t\tvar dynamicExp, col, mx = 0, dir = 0, tc = table.config,\n\t\t\t\tl = sortList.length, bl = table.tBodies.length,\n\t\t\t\tsortTime, i, j, k, c, cache, lc, s, e, order, orgOrderCol;\n\t\t\t\tif (tc.debug) { sortTime = new Date(); }\n\t\t\t\tfor (k = 0; k < bl; k++) {\n\t\t\t\t\tdynamicExp = \"var sortWrapper = function(a,b) {\";\n\t\t\t\t\tcache = tc.cache[k];\n\t\t\t\t\tlc = cache.normalized.length;\n\t\t\t\t\tfor (i = 0; i < l; i++) {\n\t\t\t\t\t\tc = sortList[i][0];\n\t\t\t\t\t\torder = sortList[i][1];\n\t\t\t\t\t\t// fallback to natural sort since it is more robust\n\t\t\t\t\t\ts = /n/i.test(getCachedSortType(tc.parsers, c)) ? \"Numeric\" : \"Text\";\n\t\t\t\t\t\ts += order === 0 ? \"\" : \"Desc\";\n\t\t\t\t\t\te = \"e\" + i;\n\t\t\t\t\t\t// get max column value (ignore sign)\n\t\t\t\t\t\tif (/Numeric/.test(s) && tc.strings[c]) {\n\t\t\t\t\t\t\tfor (j = 0; j < lc; j++) {\n\t\t\t\t\t\t\t\tcol = Math.abs(parseFloat(cache.normalized[j][c]));\n\t\t\t\t\t\t\t\tmx = Math.max( mx, isNaN(col) ? 0 : col );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// sort strings in numerical columns\n\t\t\t\t\t\t\tif (typeof(tc.string[tc.strings[c]]) === 'boolean') {\n\t\t\t\t\t\t\t\tdir = (order === 0 ? 1 : -1) * (tc.string[tc.strings[c]] ? -1 : 1);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdir = (tc.strings[c]) ? tc.string[tc.strings[c]] || 0 : 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdynamicExp += \"var \" + e + \" = sort\" + s + \"(table,a[\" + c + \"],b[\" + c + \"],\" + c + \",\" + mx + \",\" + dir + \"); \";\n\t\t\t\t\t\tdynamicExp += \"if (\" + e + \") { return \" + e + \"; } \";\n\t\t\t\t\t\tdynamicExp += \"else { \";\n\t\t\t\t\t}\n\t\t\t\t\t// if value is the same keep orignal order\n\t\t\t\t\torgOrderCol = (cache.normalized && cache.normalized[0]) ? cache.normalized[0].length - 1 : 0;\n\t\t\t\t\tdynamicExp += \"return a[\" + orgOrderCol + \"]-b[\" + orgOrderCol + \"];\";\n\t\t\t\t\tfor (i=0; i < l; i++) {\n\t\t\t\t\t\tdynamicExp += \"}; \";\n\t\t\t\t\t}\n\t\t\t\t\tdynamicExp += \"return 0; \";\n\t\t\t\t\tdynamicExp += \"}; \";\n\t\t\t\t\teval(dynamicExp);\n\t\t\t\t\tcache.normalized.sort(sortWrapper); // sort using eval expression\n\t\t\t\t}\n\t\t\t\tif (tc.debug) { benchmark(\"Sorting on \" + sortList.toString() + \" and dir \" + order+ \" time\", sortTime); }\n\t\t\t}", "async function tableAggregator(tableAggObj) {\n const findNumberOfColumns = (table) => {\n return Object.keys(table[0]).length;\n };\n\n const generateSelectQueriesFromTableName = async () => {\n const getArrOfTableNames = () => {\n const tableNames = [];\n\n tableNames.push(tableAggObj.tableName);\n\n let newTableName = tableAggObj.tableName;\n\n do {\n let num;\n\n const pos = newTableName.search(/_\\d+/);\n if (pos !== -1) {\n num = newTableName.slice(pos + 1, newTableName.length);\n\n if (parseInt(num) - 1 > 1) {\n num = newTableName.replace(/_\\d+/, '_' + String(parseInt(num) - 1));\n } else {\n num = newTableName.replace(/_\\d+/, '');\n }\n } else {\n num = null;\n }\n\n newTableName = num;\n if (newTableName !== null) {\n tableNames.push(newTableName);\n }\n } while (newTableName !== null);\n\n return tableNames;\n };\n\n const getColumnSchemaQuery = (tableNames) => {\n let COLUMN_SCHEMA_QUERY = `\n SELECT column_name, data_type\n FROM information_schema.columns\n WHERE\n `;\n\n for (let i = 0; i < tableNames.length; i++) {\n COLUMN_SCHEMA_QUERY += `table_name = '${tableNames[i]}'`;\n\n if (i !== tableNames.length - 1) {\n COLUMN_SCHEMA_QUERY += ' OR ';\n }\n }\n\n COLUMN_SCHEMA_QUERY += ';';\n\n return COLUMN_SCHEMA_QUERY;\n };\n\n const getNewTableNames = (tableNames, i) => {\n let dataTableName;\n let styleTableName;\n\n if (!/style/.test(tableNames[i])) {\n dataTableName = tableNames[i];\n styleTableName = tableNames[i];\n\n const pos = styleTableName.search(/_\\d+/);\n if (pos !== -1) {\n const num = styleTableName.slice(pos + 1, styleTableName.length);\n\n styleTableName = styleTableName.slice(0, pos) + '_style_' + num;\n } else {\n styleTableName += '_style';\n }\n } else {\n dataTableName = tableNames[i];\n styleTableName = tableNames[i];\n\n let pos = dataTableName.search(/_\\d+/);\n if (pos !== -1) {\n const num = dataTableName.slice(pos + 1, dataTableName.length);\n\n pos = 0;\n pos = dataTableName.search(/style_\\d+/);\n if (pos !== -1) {\n dataTableName = dataTableName.slice(0, pos) + num;\n }\n } else {\n pos = 0;\n pos = dataTableName.search(/style_\\d+/);\n if (pos !== -1) {\n dataTableName = dataTableName.slice(0, pos);\n }\n }\n }\n\n return [dataTableName, styleTableName];\n };\n\n const getOrderByString = (j) => {\n const thisSortModel = tableAggObj.sortModel[j];\n const sort = thisSortModel.sort;\n const colId = thisSortModel.colId;\n\n let SELECT_QUERY = '';\n\n SELECT_QUERY += ` COALESCE(to_date(SUBSTRING(TRIM(${colId}) FROM '\\\\d{1,2}/\\\\d{1,2}/\\\\d{2,4}'), 'MM/DD/YYYY'), to_date('12/30/99', 'MM/DD/YYY'))`;\n SELECT_QUERY += sort === 'desc' ? ' DESC, \\n' : ', \\n';\n\n SELECT_QUERY += ` SUBSTRING(TRIM(${colId}) FROM '^-')`;\n SELECT_QUERY += sort === 'desc' ? ' DESC, \\n' : ', \\n';\n\n SELECT_QUERY += ` COALESCE(SUBSTRING(TRIM(${colId}) FROM '^(\\\\d+)')::INTEGER, 99999999)`;\n SELECT_QUERY += sort === 'desc' ? ' DESC, \\n' : ', \\n';\n\n SELECT_QUERY += ` SUBSTRING(TRIM(${colId}) FROM '^\\\\d* *(.*?)( \\\\d+)?$')`;\n SELECT_QUERY += sort === 'desc' ? ' DESC, \\n' : ', \\n';\n\n SELECT_QUERY += ` COALESCE(SUBSTRING(TRIM(${colId}) FROM ' (\\\\d+)$')::INTEGER, 0)`;\n SELECT_QUERY += sort === 'desc' ? ' DESC, \\n' : ', \\n';\n\n SELECT_QUERY += ` TRIM(${colId})`;\n SELECT_QUERY += sort === 'desc' ? ' DESC \\n' : ' \\n';\n\n return SELECT_QUERY;\n };\n\n try {\n const tableNames = getArrOfTableNames();\n\n let SELECT_QUERY;\n let LAST_ROW_QUERY;\n\n SELECT_QUERY = `\n SELECT *\n FROM (\n SELECT *, row_number() over () as row_number\n FROM (\n SELECT *\n FROM\n ${tableNames[tableNames.length - 1]}\n INNER JOIN\n ${tableNames[tableNames.length - 1]}_style USING (${COSMETIC_ID}, ${ID})\n `;\n\n LAST_ROW_QUERY = `\n SELECT\n FROM\n ${tableNames[tableNames.length - 1]}\n INNER JOIN\n ${tableNames[tableNames.length - 1]}_style USING (${COSMETIC_ID}, ${ID})\n `;\n\n if (tableAggObj.filterPattern !== '') {\n const COLUMN_SCHEMA_QUERY = getColumnSchemaQuery(tableNames);\n const columns = await db.query(COLUMN_SCHEMA_QUERY);\n if (!columns) throw 'No columns in data table';\n\n const appendFilterPart = () => {\n SELECT_QUERY += ' WHERE \\n';\n LAST_ROW_QUERY += ' WHERE \\n';\n\n const filter = tableAggObj.filter;\n const filterPattern = tableAggObj.filterPattern;\n\n if (filter) {\n if (filter.length !== undefined) {\n for (let i = 0; i < filter.length; i++) {\n SELECT_QUERY += ` ${filter[i].clause} AND \\n`;\n LAST_ROW_QUERY += ` ${filter[i].clause} AND \\n`;\n }\n } else {\n SELECT_QUERY += ` (${filter.clause}) AND \\n`;\n LAST_ROW_QUERY += ` (${filter.clause}) AND \\n`;\n }\n }\n\n SELECT_QUERY += ' (\\n';\n LAST_ROW_QUERY += ' (\\n';\n\n for (let i = 0; i < columns.length; i++) {\n const columnName = columns[i].column_name;\n\n if (columnName !== COSMETIC_ID && columnName !== ID && columns[i].data_type === 'character varying') {\n SELECT_QUERY += ` ${columnName} ILIKE '%${filterPattern}%' `;\n LAST_ROW_QUERY += ` ${columnName} ILIKE '%${filterPattern}%' `;\n\n if (i !== columns.length - 1) {\n SELECT_QUERY += 'OR \\n';\n LAST_ROW_QUERY += 'OR \\n';\n }\n }\n }\n\n // This is needed when COSMETIC_ID or ID is at the end of the column table.\n // It generally shouldn't be, but just in case.\n if (/OR \\n$/.test(SELECT_QUERY)) {\n SELECT_QUERY = SELECT_QUERY.substring(0, SELECT_QUERY.length - 4);\n LAST_ROW_QUERY = LAST_ROW_QUERY.substring(0, LAST_ROW_QUERY.length - 4);\n }\n\n SELECT_QUERY += '\\n )';\n LAST_ROW_QUERY += '\\n )';\n\n return [SELECT_QUERY, LAST_ROW_QUERY];\n };\n\n const appendOrderPart = () => {\n const sortModel = tableAggObj.sortModel;\n\n if (sortModel !== undefined && sortModel.length > 0) {\n SELECT_QUERY += '\\n ORDER BY \\n';\n\n for (let j = 0; j < sortModel.length; j++) {\n SELECT_QUERY += getOrderByString(j);\n\n if (j < sortModel.length - 1) {\n SELECT_QUERY = SELECT_QUERY.slice(0, -2) + ',\\n';\n } else if (j === sortModel.length - 1) {\n SELECT_QUERY = SELECT_QUERY.slice(0, -2);\n }\n }\n } else {\n SELECT_QUERY += `\\n ORDER BY ${COSMETIC_ID} \\n`;\n }\n\n return [SELECT_QUERY, LAST_ROW_QUERY];\n };\n\n if (tableNames.length >= 2) {\n for (let i = tableNames.length - 2; i >= 0; i--) {\n const [dataTableName, styleTableName] = getNewTableNames(tableNames, i);\n\n SELECT_QUERY += `\n INNER JOIN\n ${dataTableName} USING (${COSMETIC_ID}, ${ID})\n INNER JOIN\n ${styleTableName} USING (${COSMETIC_ID}, ${ID})\n `;\n\n LAST_ROW_QUERY += `\n INNER JOIN\n ${dataTableName} USING (${COSMETIC_ID}, ${ID})\n INNER JOIN\n ${styleTableName} USING (${COSMETIC_ID}, ${ID})\n `;\n }\n\n [SELECT_QUERY, LAST_ROW_QUERY] = appendFilterPart();\n\n for (let i = tableNames.length - 2; i >= 0; i--) {\n if (i === 0) {\n [SELECT_QUERY, LAST_ROW_QUERY] = appendOrderPart();\n }\n }\n } else {\n [SELECT_QUERY, LAST_ROW_QUERY] = appendFilterPart();\n [SELECT_QUERY, LAST_ROW_QUERY] = appendOrderPart();\n }\n\n SELECT_QUERY += `\n ) as inner_temp\n ) as temp\n WHERE temp.row_number > ${tableAggObj.startRow} AND temp.row_number <= ${tableAggObj.endRow};\n `;\n\n return [SELECT_QUERY, LAST_ROW_QUERY];\n } else {\n const appendLastTablePart = () => {\n const filter = tableAggObj.filter;\n const sortModel = tableAggObj.sortModel;\n\n if (filter) {\n SELECT_QUERY += ' WHERE \\n';\n LAST_ROW_QUERY += ' WHERE \\n';\n\n if (filter.length !== undefined) {\n for (let i = 0; i < filter.length; i++) {\n SELECT_QUERY += ` ${filter[i].clause}`;\n LAST_ROW_QUERY += ` ${filter[i].clause}`;\n\n if (i < filter.length - 1) {\n SELECT_QUERY += ' AND \\n';\n LAST_ROW_QUERY += ' AND \\n';\n }\n }\n } else {\n SELECT_QUERY += ` (${filter.clause}) \\n`;\n LAST_ROW_QUERY += ` (${filter.clause}) \\n`;\n }\n }\n\n if (sortModel !== undefined && sortModel.length > 0) {\n SELECT_QUERY += '\\n ORDER BY \\n';\n\n for (let j = 0; j < sortModel.length; j++) {\n SELECT_QUERY += getOrderByString(j);\n\n if (j < sortModel.length - 1) {\n SELECT_QUERY = SELECT_QUERY.slice(0, -2) + ',\\n';\n } else if (j === sortModel.length - 1) {\n SELECT_QUERY = SELECT_QUERY.slice(0, -2);\n }\n }\n } else {\n SELECT_QUERY += `\\n ORDER BY ${COSMETIC_ID} \\n`;\n }\n\n return [SELECT_QUERY, LAST_ROW_QUERY];\n };\n\n if (tableNames.length >= 2) {\n for (let i = tableNames.length - 2; i >= 0; i--) {\n const [dataTableName, styleTableName] = getNewTableNames(tableNames, i);\n\n SELECT_QUERY += `\n INNER JOIN\n ${dataTableName} USING (${COSMETIC_ID}, ${ID})\n INNER JOIN\n ${styleTableName} USING (${COSMETIC_ID}, ${ID})\n `;\n\n LAST_ROW_QUERY += `\n INNER JOIN\n ${dataTableName} USING (${COSMETIC_ID}, ${ID})\n INNER JOIN\n ${styleTableName} USING (${COSMETIC_ID}, ${ID})\n `;\n\n if (i === 0) {\n [SELECT_QUERY, LAST_ROW_QUERY] = appendLastTablePart();\n }\n }\n } else {\n [SELECT_QUERY, LAST_ROW_QUERY] = appendLastTablePart();\n }\n\n SELECT_QUERY += `\n ) as inner_temp\n ) as temp\n WHERE temp.row_number > ${tableAggObj.startRow} AND temp.row_number <= ${tableAggObj.endRow};\n `;\n\n return [SELECT_QUERY, LAST_ROW_QUERY];\n }\n } catch (err) {\n return util.errorHandler({err: err, context: 'generateSelectQueriesFromTableName'});\n }\n };\n\n const createNewTables = async () => {\n const generateBrokenUpTables = async (tableName, maxCharacters) => {\n const incrementTableName = (tableName) => {\n const pos = tableName.search(/_\\d+/);\n if (pos !== -1) {\n let num = tableName.slice(pos + 1, tableName.length);\n num = String(parseInt(num) + 1);\n tableName = tableName.replace(/_\\d+/, '_' + num);\n } else {\n tableName += '_2';\n }\n\n return tableName;\n };\n\n const decrementTableName = (tableName) => {\n const pos = tableName.search(/_\\d+/);\n if (pos !== -1) {\n let num = tableName.slice(pos + 1, tableName.length);\n if (num !== '2') {\n num = String(parseInt(num) - 1);\n tableName = tableName.replace(/_\\d+/, '_' + num);\n } else {\n tableName = tableName.replace(/_\\d+/, '');\n }\n } else {\n console.log(`Shouldn't be able to get here`);\n }\n\n return tableName;\n };\n\n const generateTableCreationQuery = async (tableName, results, maxCharacters) => {\n try {\n debug.log('generateTableCreationQuery');\n\n debug.log('Create Data Table');\n let query = 'CREATE TABLE ' + tableName + ' \\n' +\n '(\\n' +\n `${ID} serial PRIMARY KEY, \\n` +\n `${COSMETIC_ID} integer NOT NULL UNIQUE, \\n`;\n\n for (let i = MAX_COLUMNS_PER_TABLE, keys = Object.keys(results[0]); i < keys.length; i++) {\n const key = keys[i];\n\n query += `${key} character varying(${maxCharacters}) COLLATE pg_catalog.\"default\" DEFAULT ''::character varying, \\n`;\n }\n\n query += `\n )\n WITH (\n OIDS = FALSE\n )\n TABLESPACE pg_default;\n\n ALTER TABLE ${tableName}\n OWNER to ${postgresqlOwner};\n `;\n\n await db.query(query);\n\n debug.log('Insert Queries');\n\n let insertQueryStarter = `INSERT INTO ${tableName} (${COSMETIC_ID}, ${ID}`;\n\n for (let j = MAX_COLUMNS_PER_TABLE, keys = Object.keys(results[0]); j < keys.length; j++) {\n const key = keys[j];\n\n insertQueryStarter += key;\n\n if (j !== keys.length - 1) {\n insertQueryStarter += ', ';\n }\n }\n\n insertQueryStarter += ') \\nVALUES ';\n query = insertQueryStarter;\n\n let batchCounter = 0;\n\n for (let i = 0; i < results.length; i++) {\n query += `\\n\\t(${results[i][COSMETIC_ID]}, ${results[i][ID]}`;\n\n for (let j = MAX_COLUMNS_PER_TABLE, keys = Object.keys(results[i]); j < keys.length; j++) {\n const key = keys[j];\n\n if (results[i][key] !== null) {\n query += `'` + results[i][key].replace(/'/, `''`) + `'`;\n } else {\n query += results[i][key];\n }\n\n if (j !== keys.length - 1) {\n query += ', ';\n }\n }\n\n if (i % 5 === 0 && i !== 0) {\n query += '); ';\n console.log('batch insert query');\n console.log(query);\n await db.query(query);\n console.log('Batch ' + batchCounter + ' completed.');\n batchCounter++;\n query = insertQueryStarter;\n } else {\n query += '), ';\n }\n }\n\n query = query.substring(0, query.length - 3);\n query += '); ';\n await db.query(query);\n\n debug.log('FINAL QUERY');\n console.log(query);\n\n debug.log('Update Queries');\n\n query = '';\n for (let j = MAX_COLUMNS_PER_TABLE, keys = Object.keys(results[0]); j < keys.length; j++) {\n const key = keys[j];\n\n query += `UPDATE ${columnTableName} SET table_name = '${tableName}' WHERE column_name = '${key}';`;\n }\n\n console.log('update queries');\n console.log(query);\n await db.query(query);\n\n return true;\n } catch (err) {\n return util.errorHandler({err: err, context: 'generateTableCreationQuery'});\n }\n };\n\n try {\n if (!await checkTableExists(tableName)) throw tableName + ' not found.';\n\n const query = `SELECT * FROM ${tableName} ORDER BY ${COSMETIC_ID};`;\n let results = await db.query(query);\n\n const numberOfColumns = findNumberOfColumns(results);\n if (numberOfColumns <= MAX_COLUMNS_PER_TABLE) {\n console.log('numberOfColumns <= MAX_COLUMNS_PER_TABLE');\n return true;\n }\n debug.log('numberOfColumns > MAX_COLUMNS_PER_TABLE');\n\n tableName = incrementTableName(tableName);\n\n await generateTableCreationQuery(tableName, results, maxCharacters);\n\n let columnDeletionQuery = '';\n const columnDeletionTableName = decrementTableName(tableName);\n\n for (let i = MAX_COLUMNS_PER_TABLE, keys = Object.keys(results[0]); i < keys.length; i++) {\n const key = keys[i];\n\n columnDeletionQuery += `ALTER TABLE ${columnDeletionTableName} DROP COLUMN ${key}; `;\n }\n\n results = await db.query(columnDeletionQuery);\n\n const result = await generateBrokenUpTables(tableName, maxCharacters);\n return result;\n } catch (err) {\n return util.errorHandler({err: err, context: 'generateBrokenUpTables'});\n }\n };\n\n try {\n debug.log('create new table');\n\n let result = await generateBrokenUpTables(tableAggObj.tableName, MAX_CHARACTERS_PER_DATA);\n if (!result) throw 'generateBrokenUpTables for data errored out';\n debug.log('data tables broken up');\n\n result = await generateBrokenUpTables(tableAggObj.tableName + '_style', MAX_CHARACTERS_PER_STYLE);\n if (!result) throw 'generateBrokenUpTables for style errored out';\n debug.log('style tables broken up');\n\n result = await tableAggregator(tableAggObj);\n\n if (result) {\n debug.log('completed aggregation');\n return result;\n } else {\n throw 'Something went wrong in tableAggregator';\n }\n } catch (err) {\n util.errorHandler(err, 'createNewTables');\n }\n };\n\n try {\n const tableName = tableAggObj.tableName;\n const suppressTableSplit = tableAggObj.suppressTableSplit;\n\n if (!await checkTableExists(tableName)) throw `No table named: ${tableName}`;\n\n const query = `SELECT * FROM ${tableName} LIMIT 1;`;\n const results = await db.query(query);\n if (!results) throw 'No data in table';\n\n if (results.length === 0) { // Why is this being done instead of throwing an error?\n const [select, lastRow] = await generateSelectQueriesFromTableName();\n return [select, lastRow];\n }\n\n const numberOfColumns = findNumberOfColumns(results);\n\n if (!suppressTableSplit && numberOfColumns > MAX_COLUMNS_PER_TABLE) {\n debug.log('numberOfColumns > MAX_COLUMNS_PER_TABLE');\n\n return await createNewTables();\n } else if (!suppressTableSplit && numberOfColumns === MAX_COLUMNS_PER_TABLE) {\n const matchTableNumber = tableName.match(/_(\\d+)/);\n if (matchTableNumber) {\n let num = matchTableNumber[1];\n num = String(parseInt(num) + 1);\n\n const newTableAggObj = JSON.parse(JSON.stringify(tableAggObj));\n newTableAggObj.tableName = tableName.replace(/_\\d+/, '_' + num);\n\n const result = await tableAggregator(newTableAggObj);\n if (result) return result;\n\n const [select, lastRow] = await generateSelectQueriesFromTableName();\n return [select, lastRow];\n } else {\n const newTableAggObj = JSON.parse(JSON.stringify(tableAggObj));\n newTableAggObj.tableName = `${tableName}_2`;\n\n const result = await tableAggregator(newTableAggObj);\n if (result) return result;\n\n const [select, lastRow] = await generateSelectQueriesFromTableName();\n return [select, lastRow];\n }\n } else {\n // number of columns is below threshold\n const matchTableNumber = tableName.match(/_(\\d+)/);\n if (matchTableNumber) {\n let num = matchTableNumber[1];\n num = String(parseInt(num) + 1);\n const nextTableName = tableName.replace(/_\\d+/, `_` + num);\n\n if (await checkTableExists(nextTableName)) {\n const newTableAggObj = JSON.parse(JSON.stringify(tableAggObj));\n newTableAggObj.tableName = nextTableName;\n\n const result = await tableAggregator(newTableAggObj);\n if (result) return result;\n\n const [select, lastRow] = await generateSelectQueriesFromTableName();\n return [select, lastRow];\n } else {\n const [select, lastRow] = await generateSelectQueriesFromTableName();\n return [select, lastRow];\n }\n } else {\n if (await checkTableExists(`${tableName}_2`)) {\n const newTableAggObj = JSON.parse(JSON.stringify(tableAggObj));\n newTableAggObj.tableName = `${tableName}_2`;\n\n const result = await tableAggregator(newTableAggObj);\n if (result) return result;\n\n const [select, lastRow] = await generateSelectQueriesFromTableName();\n return [select, lastRow];\n } else {\n const [select, lastRow] = await generateSelectQueriesFromTableName();\n return [select, lastRow];\n }\n }\n }\n } catch (err) {\n util.errorHandler({err: err, context: 'tableAggregator', isLast: true});\n return false;\n }\n}", "function sorttable(p) {\n let table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;\n table = document.getElementById(\"record_contant\");\n switching = true;\n dir = \"asc\";\n while (switching) {\n switching = false;\n rows = table.rows;\n for (i = 1; i < (rows.length - 1); i++) {\n shouldSwitch = false;\n x = rows[i].getElementsByTagName(\"TD\")[p];\n y = rows[i + 1].getElementsByTagName(\"TD\")[p];\n if (dir == \"asc\") {\n if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {\n shouldSwitch = true;\n break;\n }\n } else if (dir == \"desc\") {\n if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {\n shouldSwitch = true;\n break;\n }\n }\n }\n if (shouldSwitch) {\n rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);\n switching = true;\n switchcount++;\n } else {\n if (switchcount == 0 && dir == \"asc\") {\n dir = \"desc\";\n switching = true;\n }\n }\n }\n}", "function sortFruitMarketTableByFruitNameAndPrice() {\n\n}", "function sortTable(tableId, cellId) {\n let table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0\n table = document.getElementById(tableId)\n switching = true\n dir = 'asc'\n while (switching) {\n switching = false\n rows = table.rows\n for (i = 0; i < (rows.length - 1); i++) {\n shouldSwitch = false\n x = rows[i].getElementsByTagName('TD')[cellId]\n y = rows[i + 1].getElementsByTagName('TD')[cellId]\n let nameCell = rows[i + 1].getElementsByTagName('TD')[1]\n if (dir == 'asc') {\n if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase() && nameCell.innerHTML != '') {\n shouldSwitch = true\n break\n }\n } else if (dir == 'desc') {\n if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase() && nameCell.innerHTML != '') {\n shouldSwitch = true\n break\n }\n }\n }\n if (shouldSwitch) {\n rows[i].parentNode.insertBefore(rows[i + 1], rows[i])\n switching = true\n switchcount++\n } else {\n if (switchcount == 0 && dir == 'asc') {\n dir = 'desc'\n switching = true\n }\n }\n }\n}", "sortData(type, column) {\n if (type !== \"none\" && type !== false) {\n let temp = this.tbody.slice();\n for (let i = 0; i < temp.length; i++) {\n temp[i].unshift(temp[i][column]);\n }\n if (type === \"asc\") {\n temp.sort();\n } else {\n temp.reverse();\n }\n for (let i = 0; i < temp.length; i++) {\n this.set(\"tbody.\" + i, []);\n this.set(\"tbody.\" + i, temp[i].slice(1));\n }\n } else {\n let temp = this.tbody.slice();\n for (let i = 0; i < temp.length; i++) {\n this.set(\"data.\" + (i + 1), []);\n this.set(\"data.\" + (i + 1), temp[i].slice());\n }\n }\n }", "function prepareSorting(tableRef) {\n var columnElements = tableRef.find('tr:first-child td');\n columnElements.each(\n function (index) {\n if (!$(this).hasClass('functionTd')) {\n //Add title\n $(this).attr(\"title\", \"Click to sort\");\n //Add click-event to sort\n $(this).click(\n function () {\n var tbl = $(this).closest('table');\n var trArr = tbl.find('tr').toArray();\n //Remove the top record\n\n\n trArr.shift();\n trArr.sort(\n function (tr1, tr2) {\n var val1 = $(tr1.getElementsByTagName('td')[index]).text().toUpperCase();\n var val2 = $(tr2.getElementsByTagName('td')[index]).text().toUpperCase();\n if (val1.length === 0 && val2.length === 0) return 0;\n if (val1.length === 0) return 1;\n if (val2.length === 0) return -1;\n return (val1 < val2 ? -1 : 1);\n }\n );\n //Push all records to the table element in sorted order\n for (var i = 0; i < trArr.length; i++) {\n $(trArr[i]).appendTo(tbl);\n }\n tbl.find('tr').removeClass('filteredIn');\n makeOddRows(tbl);\n //Clear filter fields\n columnElements.find('input.filter').val('');\n columnElements.find('span.matchSpan').html('');\n }\n );\n //Append column filters\n var filter = $(\"<input type='text' title='Enter filter' class='filter'/>\");\n var span = $(\"<span></span>\");\n span.append(filter).append(\"<span class='matchSpan'></span>\").append(\"<br/>\");\n $(this).prepend(span);\n filter.click(\n function () {\n return false;\n /*Stop propagating to prevent sorting*/\n }\n );\n filter.change(\n function () {\n var filterStr = $(this).val().toLowerCase();\n var tableRef = $(this).closest('table');\n var tdRef = $(this).closest('td');\n //Run through all table rows, pushing those to the top which contain the filter Str\n var matches = tableRef.find('tr').filter(\n function () {\n var tdEl = $(this).find('td:eq(' + index + ')');\n if (tdEl.text().toLowerCase().indexOf(filterStr) > -1) return true;\n else return false;\n }\n );\n var header = tableRef[0].getElementsByTagName('tr')[0];\n var tbody = tableRef[0].getElementsByTagName('tbody');\n var root = (tbody ? $(tbody) : tableRef);\n root.prepend(matches);\n tdRef.find('span.matchSpan').html(\"<br/>Count: \" + matches.size());\n root.prepend(header);\n makeOddRows(tableRef);\n matches.addClass('filteredIn');\n }\n );\n }\n }\n );\n}", "render(table) {\n console.log('Applying 3rd partys better sort.');\n }", "function sortTable(n) {\n var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;\n table = document.getElementById(\"reportsTable\");\n switching = true;\n //Set the sorting direction to ascending:\n dir = \"asc\";\n while (switching) {\n switching = false;\n rows = table.getElementsByTagName(\"tr\");\n\n for (i = 1; i < (rows.length - 1); i++) {\n shouldSwitch = false;\n x = rows[i].getElementsByTagName(\"TD\")[n];\n y = rows[i + 1].getElementsByTagName(\"TD\")[n];\n // it is not a number\n\n if (isNaN(x.innerHTML) || isNaN(y.innerHTML)) {\n if (dir == \"asc\") {\n if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {\n shouldSwitch = true;\n break;\n }\n } else if (dir == \"desc\") {\n if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {\n shouldSwitch = true;\n break;\n }\n }\n } else {\n if (dir == \"asc\") {\n if (parseInt(x.innerHTML) > parseInt(y.innerHTML)) {\n shouldSwitch = true;\n break;\n }\n } else if (dir == \"desc\") {\n if (parseInt(x.innerHTML) < parseInt(y.innerHTML)) {\n shouldSwitch = true;\n break;\n }\n }\n }\n }\n if (shouldSwitch) {\n rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);\n switching = true;\n switchcount++;\n } else {\n if (switchcount == 0 && dir == \"asc\") {\n dir = \"desc\";\n switching = true;\n }\n }\n }\n}", "function sortTable(n) {\n var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;\n table = document.getElementById(\"stockDataTable\");\n switching = true;\n dir = \"asc\";\n\n while (switching) {\n switching = false;\n rows = table.getElementsByTagName(\"TR\");\n\n for (i = 0; i < rows.length - 1; i++) { \n shouldSwitch = false;\n x = rows[i].getElementsByTagName(\"TD\")[n];\n y = rows[i + 1].getElementsByTagName(\"TD\")[n];\n if (dir == \"asc\") {\n if (x.innerHTML > y.innerHTML) {\n shouldSwitch = true;\n break;\n }\n } \n else if (dir == \"desc\") {\n if (x.innerHTML < y.innerHTML) {\n shouldSwitch = true;\n break;\n }\n }\n }\n if (shouldSwitch) {\n rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);\n switching = true;\n switchcount++;\n } else {\n if (switchcount == 0 && dir == \"asc\") {\n dir = \"desc\";\n switching = true;\n }\n }\n }\n}", "function sort(column_index) {\n var table, rows, switchcount = 0;\n var switching = true, shouldSwitch;\n var asc_sort_direction = true;\n table = document.getElementById('files_list');\n while (switching) {\n switching = false;\n rows = table.getElementsByTagName('tr');\n var curr_row;\n for (curr_row = 1; curr_row < (rows.length - 1); curr_row++) {\n shouldSwitch = false;\n var curr_row_creteria_value = (rows[curr_row].getElementsByTagName('td')[column_index]).innerHTML.toLowerCase();\n var next_row_creteria_value = (rows[curr_row + 1].getElementsByTagName('td')[column_index]).innerHTML.toLowerCase();\n if (asc_sort_direction) {\n if (column_index == 2) {\n if (curr_row_creteria_value.length > next_row_creteria_value.length || \n (curr_row_creteria_value.length == next_row_creteria_value.length && curr_row_creteria_value > next_row_creteria_value)) {\n shouldSwitch = true;\n break;\n }\n }\n else if (curr_row_creteria_value > next_row_creteria_value) {\n shouldSwitch = true;\n break;\n }\n } \n else { // descending order\n if (column_index == 2) {\n if (curr_row_creteria_value.length < next_row_creteria_value.length || \n (curr_row_creteria_value.length == next_row_creteria_value.length && curr_row_creteria_value < next_row_creteria_value)) {\n shouldSwitch = true;\n break;\n }\n }\n else if (curr_row_creteria_value < next_row_creteria_value) {\n shouldSwitch = true;\n break;\n }\n }\n }\n if (shouldSwitch) {\n rows[curr_row].parentNode.insertBefore(rows[curr_row + 1], rows[curr_row]);\n switching = true;\n switchcount ++;\n } \n else {\n if (switchcount == 0 && asc_sort_direction) {\n asc_sort_direction = false;\n switching = true;\n }\n }\n }\n}", "function sortData(col) {\r\n\tconsole.log('sortData', col);\r\n\t\r\n\tvar column = tableColumns[col];\r\n\tvar field = dataFields[column.name];\r\n\t\r\n\t// Reverse sort if column is already sorted\r\n\tsortOrder = column == sortColumn ? -sortOrder : 1;\r\n\tsortColumn = column;\r\n\tconsole.log('sortData', sortColumn, sortOrder, field);\r\n\t\r\n\t// Store current order to produce a stable sort\r\n\t$.each(data, (index, record) => record.__index = index);\r\n\tconsole.log('sortData', data);\r\n\t\r\n\t// Sort data\r\n\tdata.sort(function(a, b) {\r\n\t\t\r\n\t\t// Check for missing records\r\n\t\tif (column.set >= 0) {\r\n\t\t\tif (!a[column.set] && !b[column.set]) return a.__index - b.__index;\r\n\t\t\tif (!a[column.set]) return +1;\r\n\t\t\tif (!b[column.set]) return -1;\r\n\t\t}\r\n\t\t\r\n\t\t// Get values\r\n\t\tvar aValue = column.set >= 0 ? a[column.set][column.name] : a[0] ? a[0][column.name] : a[1][column.name];\r\n\t\tvar bValue = column.set >= 0 ? b[column.set][column.name] : b[0] ? b[0][column.name] : b[1][column.name];\r\n\t\t\r\n\t\t// Check for blank values\r\n\t\tif (isNull(aValue) && isNull(bValue)) return a.__index - b.__index;\r\n\t\tif (isNull(aValue)) return +1;\r\n\t\tif (isNull(bValue)) return -1;\r\n\t\t\r\n\t\t// Don't sort abbreviation fields\r\n\t\tif (column.has) return a.__index - b.__index;\r\n\t\t\r\n\t\t// If values are the same, keep in current order\r\n\t\tif (aValue == bValue) return a.__index - b.__index;\r\n\t\t\r\n\t\t// Sort numbers and strings correctly\r\n\t\tif (field.sort == '#') {\r\n\t\t\treturn sortOrder * (aValue - bValue);\r\n\t\t} else {\r\n\t\t\treturn sortOrder * aValue.localeCompare(bValue, {'sensitivity': 'base', 'ignorePunctuation': true});\r\n\t\t}\r\n\t\t\r\n\t});\r\n\t\r\n\tfunction isNull(value) {\r\n\t\treturn value === null || value === '' || (column.has && value === false);\r\n\t}\r\n\t\r\n\t// Remove the temporary index column\r\n\t$.each(data, (index, record) => delete record.__index);\r\n\t\r\n\t// Update the column header\r\n\tupdateSortIcon();\r\n\t\r\n}", "function fixWidth() {\n\t\tlet group;\n\t\tlet html = \"\";\n\t\tconst table = $(\"table.files\");\n\t\tconst tableWidth = getWidth(table);\n\t\tconst cells = $$(\"tbody:last-child tr:last-child td\", table);\n\t\tif (table && cells.length > 1 && !$(\"colgroup\", table)) {\n\t\t\tgroup = document.createElement(\"colgroup\");\n\t\t\ttable.insertBefore(group, table.childNodes[0]);\n\t\t\tcells.forEach(el => {\n\t\t\t\t// Keep two decimal point accuracy\n\t\t\t\tconst width = parseInt(getWidth(el) / tableWidth * 1e4, 10) / 100;\n\t\t\t\thtml += `<col style=\"width:${width}%\">`;\n\t\t\t});\n\t\t\tgroup.innerHTML = html;\n\t\t}\n\t}", "function sortTableAlphabeticallyAscending(){\n sortAlphabeticallyAscending();\n}", "function sortTable_by_jan(table_bodys, jan_code, coll_num) {\n var rows = $('.' + table_bodys + ' tr').get();\n rows.sort(function(a, b) {\n\n var A = $(a).children('td').eq(coll_num).text();\n A = A.substr(A.length - 13);\n if (A == jan_code) {\n return -1;\n }\n return 0;\n\n });\n $.each(rows, function(index, row) {\n $('.' + table_bodys).append(row);\n });\n}", "function sortTable()\n{\n // snippet of code from https://stackoverflow.com/questions/8231310/convert-table-to-an-array\n // store table data into array\n var array = [];\n var headers = [];\n var i;\n \n // get table headers into array\n $('#activityTable th').each(function(index, item) {\n headers[index] = $(item).html();\n });\n\n // store table body by correct column\n $('#activityTable tr').has('td').each(function() {\n var arrayItem = {};\n $('td', $(this)).each(function(index, item) {\n arrayItem[headers[index]] = $(item).html();\n });\n array.push(arrayItem);\n });\n\n // sort array by date desc\n array.sort(function(a,b){\n return new Date(b.date) - new Date(a.date);\n });\n\n // console.log(array);\n \n // display array as table sorted by date if entries exist\n if (array[0] != null)\n {\n // only show the 10 latest activities\n if (array.length > 10)\n {\n var activityArray = [];\n for (i = 0; i < 10; i++)\n {\n activityArray[i] = array[i];\n }\n\n document.getElementById(\"sortedActivities\").style.display = \"block\";\n var sortedTable = document.getElementById(\"sortedTable\");\n generateTable(sortedTable, activityArray);\n }\n else\n {\n document.getElementById(\"sortedActivities\").style.display = \"block\";\n var sortedTable = document.getElementById(\"sortedTable\");\n generateTable(sortedTable, array);\n }\n }\n}", "function groupByColumn(events){\n\t//sort events by start date\n\tvar events = events.sort(function(a,b){\n\t\treturn \ta.start < b.start ? -1 : \n\t\t\t\ta.start > b.start ? 1 :\n\t\t\t\t0;\n\t});\n\n\tvar columns = [[]]; //will keep track of events as they are added\n\t\n\tfor (var i = 0; i < events.length; i++) {\n\t\tvar event = events[i];\n\t\tvar colNum = 0;\n\t\t//find the first empty column or one where this event could fit\n\t\twhile(columns[colNum] &&\n\t\t\t columns[colNum].length && \n\t\t\t columns[colNum][columns[colNum].length-1].end > event.start )\n\t\t{\n\t\t\tcolNum++;\n\t\t}\n\n\t\t//column doesn't exist yet, start a new one\n\t\tif(!columns[colNum])\n\t\t\tcolumns.push([]);\n\n\t\tevent.myColumn = colNum+1;\n\t\tcolumns[colNum].push(event);\n\t}\n\treturn columns;\n}", "function sortCountry(n) {\n var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;\n table = document.querySelector(\".tbl-list\");\n switching = true;\n dir = \"asc\"; \n while (switching) {\n switching = false;\n rows = table.rows;\n for (i = 1; i < (rows.length - 1); i++) {\n shouldSwitch = false;\n x = rows[i].getElementsByTagName(\"td\")[n];\n y = rows[i + 1].getElementsByTagName(\"td\")[n];\n if (dir == \"asc\") {\n if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {\n shouldSwitch= true;\n break;\n }\n } else if (dir == \"desc\") {\n if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {\n shouldSwitch = true;\n break;\n }\n }\n }\n if (shouldSwitch) {\n rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);\n switching = true;\n switchcount ++; \n } else {\n if (switchcount == 0 && dir == \"asc\") {\n dir = \"desc\";\n switching = true;\n }\n }\n }\n}", "function sortRenderOrder() {\n \n var sortBy = function(field, reverse, primer){\n var key = primer ? function(x) {return primer(x[field])} : function(x) {return x[field]};\n reverse = [-1, 1][+!!reverse];\n return function (a, b) {\n\treturn a = key(a), b = key(b), reverse * ((a > b) - (b > a));\n } \n }\n \n gadgetRenderOrder.sort(sortBy(\"tabPos\", true, parseInt));\n gadgetRenderOrder.sort(sortBy(\"paneId\", true, parseInt));\n gadgetRenderOrder.sort(sortBy(\"parentColumnId\", true, parseInt));\n }", "function createSortSummaryTable(){\n // Extract the value property of from the restriction object\n var table_name = tabsFrame.restriction.clauses[0].value;\n var view = tabsFrame.newView;\n var index = view.tableGroups.length - tabsFrame.selectedTableGroup - 1;\n resetTable('sortOrderSummary');\n var table = $('sortOrderSummary');\n var tBody = table.tBodies[0];\n var pattern = tabsFrame.patternRestriction;\n \n var fieldProperties = [\"field_name\", \"ml_heading\", \"primary_key\", \"data_type\", \"afm_type\", \"table_name\", \"ml_heading_english\"];\n //var fieldProperties = [\"field_name\", \"ml_heading\", \"primary_key\", \"data_type\", \"afm_type\", \"table_name\"];\n //var dateOptions = ['', getMessage('year'), getMessage('yearQuarter'), getMessage('yearMonth'), getMessage('yearMonthDay'), getMessage('yearWeek')];\n // var dateValues = ['', 'year', 'quarter', 'month', 'day', 'week'];\n var curTgrp = view.tableGroups[index];\n var fields = curTgrp.fields;\n var sortFields = curTgrp.sortFields;\n \n // var groupByDate = '';\n // var groupByTable = '';\n // var groupByField = '';\n \n if (hasGroupByDate(curTgrp)) { \t \n if (pattern.match(/summary|paginated/)) {\n $('groupDates').style.display = \"\";\n }\n }\n \n // For each field within the tablegroup, create a row \n if (fields == undefined) {\n alert(getMessage(\"noFields\"));\n tabsFrame.selectTab('page4');\n }\n else {\n for (var k = 0; k < fields.length; k++) {\n var new_tr = document.createElement('tr');\n new_tr.id = \"row\" + k;\n var fieldObj = fields[k];\n var hasDate = false;\n \n // Loop through the field object, and extract its relevant properties (ie. Field Name, Heading, Primary Key) to fill in table cell\t\t\t\n for (p in fieldProperties) {\n \n //if ((fieldObj[fieldProperties[p]] != undefined) && (!fieldProperties[p].toString().match(/function/gi)) && (fieldObj[fieldProperties[p]] != \"stats\")) {\n if ((fieldObj[fieldProperties[p]] != undefined) && (!fieldProperties[p].toString().match(/function/gi)) && (fieldObj[fieldProperties[p]] != \"stats\") && (fieldProperties[p] != \"ml_heading_english\")) {\n var new_td = document.createElement('td');\n new_td.innerHTML = fieldObj[fieldProperties[p]];\n new_td.is_virtual = fieldObj['is_virtual'];\n new_td.sql = fieldObj['sql'];\n new_tr.appendChild(new_td); \n }\n \n if (fieldObj['data_type'] == 'Date') {\n //\t $('groupDates').style.display = \"\";\n hasDate = true;\n }\n \n }\n \n new_tr.ml_heading_english = fieldObj['ml_heading_english'];\n\n\t\t\t// create cell for ascending/descending\n var new_td = document.createElement('td');\n var id = 'sort_' + fieldObj['table_name'] + '.' + fieldObj['field_name'];\n new_td.innerHTML = '<input type=\"checkbox\" id=\"' + id + '\" onclick=\"setAscending(this, ' + k + ')\" value=\"false\"/>';\n new_tr.appendChild(new_td);\n\t\t\t \n // Create a cell for the \"Sort Order\" column \n var new_td = document.createElement('td');\n new_tr.appendChild(new_td);\n \n // Create a cell for the column with a \"Set\" button \t\t\t \t\t\t\n var new_td = document.createElement('td');\n // if (stat == ''){\n createButton(\"set\", \"setSort\", getMessage(\"set\"), \"row\" + k, new_td);\n // }\t\t\t\n new_tr.appendChild(new_td);\n \n // If date field, insert \"Group Dates By\" column\n var new_td = document.createElement('td');\n if ((hasDate == true) && (pattern.match(/summary|paginated/))) {\n \tnew_td = fillGroupByDateCell(new_td, curTgrp, fields[k]);\n\n \n /* \n if ((groupByTable == fields[k].table_name) && (groupByField == fields[k].field_name) && ((groupByDate == 'year') || (groupByDate == 'month') || (groupByDate == 'quarter') || (groupByDate == 'day') || (groupByDate == 'week'))) {\n // var oOption = document.createElement(\"OPTION\");\n // oOption.appendChild( document.createTextNode( dateOptions[dateValues.indexOf(stat)] ));\n // oOption.value = stat;\n \n // newSelect.appendChild(oOption);\n new_td.innerHTML = dateOptions[dateValues.indexOf(groupByDate)];\n }\n else {\n var newSelect = document.createElement('select');\n newSelect.name = \"groupBy\";\n newSelect.disabled = false;\n for (var x = 0; x < dateOptions.length; x++) {\n var oOption = document.createElement(\"OPTION\");\n oOption.appendChild(document.createTextNode(dateOptions[x]));\n oOption.value = dateValues[x];\n \n newSelect.appendChild(oOption);\n \n }\n \n var parameters = [];\n parameters[\"select_box\"] = newSelect;\n parameters[\"field\"] = fieldObj;\n YAHOO.util.Event.addListener(newSelect, \"change\", onChangeGroupDate, parameters);\n new_td.appendChild(newSelect);\n }\n*/ \n }\n new_tr.appendChild(new_td);\n tBody.appendChild(new_tr);\n \n // Create empty cell in last column \n var new_td = document.createElement('td');\n new_tr.appendChild(new_td);\n tBody.appendChild(new_tr);\n // \t \talert(tBody.innerHTML);\n }\n }\n\t\n\t// check checkbox if descending order was set\n\tif (sortFields != undefined){\n\t\tfor (var m = 0; m < sortFields.length; m++) {\n\t\t\tif (sortFields[m].isAscending == false) {\n\t\t\t\tvar id = 'sort_' + sortFields[m].table_name + '.' + sortFields[m].field_name;\n\t\t\t\t$(id).checked = true;\n\t\t\t}\n\t\t}\n\t}\n}", "function sortColumn1_step4() {\n var ss = SpreadsheetApp.getActiveSpreadsheet();\n var sheet = ss.getSheets()[2];\n var lastRow = sheet.getLastRow();\n var lastCol = sheet.getLastColumn();\n var range = sheet.getRange(2, 1, lastRow, lastCol);\n range.sort({column: 1, ascending: true});\n}", "function ordenarTabela(n) {\n var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;\n table = document.getElementById(\"tabela\");\n switching = true;\n dir = \"asc\";\n while (switching) {\n switching = false;\n rows = table.rows;\n for (i = 1; i < (rows.length - 1); i++) {\n shouldSwitch = false;\n x = rows[i].getElementsByTagName(\"TD\")[n];\n y = rows[i + 1].getElementsByTagName(\"TD\")[n];\n if (dir == \"asc\") {\n if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {\n shouldSwitch = true;\n break;\n }\n } else if (dir == \"desc\") {\n if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {\n shouldSwitch = true;\n break;\n }\n }\n }\n if (shouldSwitch) {\n rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);\n switching = true;\n switchcount ++;\n } else {\n if (switchcount == 0 && dir == \"asc\") {\n dir = \"desc\";\n switching = true;\n }\n }\n }\n }", "function groupTable($rows, startIndex, total){\n\n if (total === 0) { return; }\n\n var currentIndex = startIndex;\n var count = 1;\n var lst = [];\n var tds = $rows.find('td:eq('+ currentIndex +')');\n var ctrl = $(tds[0]);\n\n lst.push($rows[0]);\n\n var i;\n\n for (i=1; i<=tds.length; i++) {\n\n if (\n ctrl.text() == $(tds[i]).text() &&\n// ctrl.text() != \"\" &&\n // we don't want to merge column cells between different network interfaces\n $(tds[i]).closest('tr').attr('interface') == undefined\n ) {\n console.log(ctrl.text())\n console.log(ctrl.closest('tr').attr('interface'))\n count++;\n $(tds[i]).addClass('deleted');\n lst.push($rows[i]);\n } else {\n if (count>1) {\n ctrl.attr('rowspan',count);\n groupTable($(lst),startIndex+1,total-1)\n }\n count=1;\n lst = [];\n ctrl=$(tds[i]);\n lst.push($rows[i]);\n }\n }\n }", "function sortTable() {\n\n var rows = $('.mytable tbody tr').get();\n rows.sort(function(a, b) {\n\n var A = $(a).children('td').eq(0).text().toUpperCase();\n var B = $(b).children('td').eq(0).text().toUpperCase();\n console.log(A);\n\n if (A > B) {\n return -1;\n }\n\n if (A < B) {\n return 1;\n }\n\n return 0;\n\n });\n\n $.each(rows, function(index, row) {\n $('.mytable').children('tbody').append(row);\n });\n\n }", "groupedColumns(type) {\n return this._cache('groupedColumns', () => {\n const _groupColumns = (columns, currentRow = 0, parentColumn = {}, rows = []) => {\n // track how many rows we got\n rows[currentRow] = rows[currentRow] || [];\n const grouped = [];\n const setRowSpan = column => {\n const rowSpan = rows.length - currentRow;\n if (column &&\n !column.children && // parent columns are supposed to be one row\n rowSpan > 1 &&\n (!column.rowSpan || column.rowSpan < rowSpan)\n ) {\n column.rowSpan = rowSpan;\n }\n };\n columns.forEach((column, index) => {\n let defaultOpt= {\n ifshow:true\n }\n if(!this.originWidth){\n defaultOpt.width = 200\n }\n //获取非固定列\n if(type=='nofixed' && column.fixed){\n return false;\n }\n const newColumn = { ...defaultOpt,...column };\n rows[currentRow].push(newColumn);\n parentColumn.colSpan = parentColumn.colSpan || 0;\n if (newColumn.children && newColumn.children.length > 0) {\n newColumn.children = _groupColumns(newColumn.children, currentRow + 1, newColumn, rows);\n parentColumn.colSpan = parentColumn.colSpan + newColumn.colSpan;\n } else {\n parentColumn.colSpan++;\n }\n // update rowspan to all same row columns\n for (let i = 0; i < rows[currentRow].length - 1; ++i) {\n setRowSpan(rows[currentRow][i]);\n }\n // last column, update rowspan immediately\n if (index + 1 === columns.length) {\n setRowSpan(newColumn);\n }\n grouped.push(newColumn);\n });\n return grouped;\n };\n return _groupColumns(this.columns);\n });\n }", "function foldGroupTable() { doGroupTableOperations('fold'); }", "function sortit(e)\n{\n var exp;\n if (typeof e == \"string\") {\n exp = e.split(\",\");\n last_sort = e;\n } else {\n exp = e.sortedlist.split(\",\");\n last_sort = e.sortedlist;\n }\n\n var sorter = [];\n var order=[];\n for(var i=0;i<exp.length;i++) {\n if (exp[i] === \"0\") continue;\n if (exp[i] === \"1\") {\n sorter.push(i);\n order.push(1);\n }\n else if (exp[i] == \"2\") {\n sorter.push(i);\n order.push(-1);\n }\n }\n\n var data;\n if (filtered_data == null) {\n data = raw_data.slice();\n } else {\n data = filtered_data.slice();\n }\n\n if (sorter.length == 0) {\n var dta = new async_emulator(data);\n views.view('table').data(dta);\n return;\n }\n\n // Do the Sort\n data.sort(function(a,b) {\n for(var i=0;i<sorter.length;i++) {\n var s = sorter[i];\n if ((a[s] == null && b[s] != null) || a[s] < b[s]) {\n if (order[i] > 0) return (-1)\n else return (1);\n } else if ((b[s] == null && a[s] != null) || a[s] > b[s]) {\n if (order[i] > 0) return (1);\n else return (-1);\n }\n }\n return (0);\n });\n\n var dta = new async_emulator(data);\n views.view('table').data(dta);\n}", "function makeTableSortable(table, skip_last)\n{\n table.find(\"th\").css(\"cursor\", \"pointer\");\n table.find(\"th\").click(event =>\n {\n let th = event.target;\n let table = th.closest('table');\n let rows = Array.from(table.querySelectorAll('tr:nth-child(n+2)'));\n let last;\n if (skip_last)\n last = rows.pop();\n console.log(rows);\n rows.sort(__tableCellComparer(Array.from(th.parentNode.children).indexOf(th), this.asc = !this.asc));\n \n if (skip_last)\n rows.push(last);\n rows.forEach(tr => table.appendChild(tr) );\n });\n}", "function smartOrder() {\n\torderClues();\n\tfor (var q=0;q<=Math.ceil(.04*Math.pow($(\"#mainTbl td.question\").length,2)-1.3*$(\"#mainTbl td.question\").length+30);q++) {\n\t\t$(\"#mainTbl td.question\").addClass(\"notsorted\");\n\t\t$(\"#mainTbl td.question\").each(function() {\n\t\t\t$(this).removeClass(\"notsorted\");\n\t\t\telemwords=this.mywords;\n\t\t\tvar max={\"elem\":null,\"counter\":0};\n\t\t\t$(\"#mainTbl td.question.notsorted\").each(function() {\n\t\t\t\tif (this.mywords==elemwords) return;\n\t\t\t\tvar counter=0;\n\t\t\t\tfor (i in this.mywords) {\n\t\t\t\t\tif (~elemwords.indexOf(this.mywords[i])) {counter++;}\n\t\t\t\t}\n\t\t\t\tif (counter>max[\"counter\"]) {\n\t\t\t\t\tmax[\"counter\"]=counter;\n\t\t\t\t\tmax[\"elem\"]=this;\n\t\t\t\t}\n\t\t\t});\n\t\t\t$(max[\"elem\"]).removeClass(\"notsorted\");\n\t\t\t//$(max[\"elem\"]).siblings(\"td.mover\").text(max[\"counter\"]);\n\t\t\t$(max[\"elem\"]).parent(\"tr\").detach().insertAfter($(this).parent(\"tr\"));\n\t\t});\n\t}\n}", "function sortTable(column, type) {\n //Sort the table\n $('.table tbody tr').sort(function(a, b) {\n // a and b are the 2 parameters being compared. \n // Since you are sorting rows, a and b are <tr> \n\n //Find the <td> using the column number and get the text value.\n //Now, the a and b are the text of the <td>\n a = $(a).find('td:eq(' + column + ')').text();\n b = $(b).find('td:eq(' + column + ')').text();\n\n switch (type) {\n case 'text':\n //Proper way to compare text in js is using localeCompare\n //If order is ascending you can - a.localeCompare(b)\n //If order is descending you can - b.localeCompare(a);\n return b.localeCompare(a);\n break;\n case 'number':\n //You can use deduct to compare if number.\n //If order is ascending you can -> a - b. \n //Which means if a is bigger. It will return a positive number. b will be positioned first\n //If b is bigger, it will return a negative number. a will be positioned first\n return b - a;\n break;\n }\n }).appendTo('.table tbody');\n}", "function CombineTableColumns(colsToCombine, colsToCombineBlankSeparatorLine, tableContainerDiv, hiddenClassName)\r\n{\r\n // If column array contains less than one column, nothing to do\r\n if((!colsToCombine) || (colsToCombine.length < 2)) {\r\n return;\r\n }\r\n \r\n var curJTable = $(tableContainerDiv).children('.jtable-main-container').children('.jtable');\r\n var destColIdx = $(curJTable).find('th:contains(\"' + colsToCombine[0] + '\")').eq(0).index();\r\n \r\n // For each displayed row\r\n $(curJTable).children('tbody').children('tr').each(function() {\r\n var stackedTextCol = $(this).children('td').eq(destColIdx);\r\n var stackedText = $(stackedTextCol).text();\r\n \r\n // Apply \"white-space:pre\" style to stack column, to allow separator line between\r\n // the text values of each column\r\n $(stackedTextCol).addClass('multiLineTableColumn');\r\n \r\n for(var i = 1; i < colsToCombine.length; i++) {\r\n // Get current index of this column\r\n var colIdx = $(curJTable).find('th:contains(\"' + colsToCombine[i] + '\")').eq(0).index();\r\n\r\n // Get text of this column\r\n var newLinesToAdd = \"\\n\";\r\n if(colsToCombineBlankSeparatorLine[colsToCombine[i]]) {\r\n newLinesToAdd += \"\\n\";\r\n }\r\n \r\n var col = $(this).children('td').eq(colIdx);\r\n var colText = newLinesToAdd + $(col).text();\r\n\r\n // Add to stack\r\n stackedText += colText;\r\n\r\n // Hide this column\r\n $(col).addClass(hiddenClassName);\r\n \r\n // Hide this column header\r\n if(i === 1) {\r\n var colHdr = $(curJTable).find('th:contains(\"' + colsToCombine[i] + '\")').eq(0);\r\n $(colHdr).addClass(hiddenClassName);\r\n }\r\n }\r\n \r\n // Set text of stack column to combined text of other columns\r\n stackedTextCol.text(stackedText);\r\n });\r\n}", "function sortTable(type) {\r\n let data = window.value.data;\r\n data = sortData(data, type);\r\n populateDataSource(data);\r\n}", "function tableSort(e) {\n\t\tvar $clickedLink = $(e.target).closest('a');\n\t\tvar $niftyTable = $clickedLink.closest('table');\n\t\tvar $tableRows = $niftyTable.find('tr').has('td');\n\t\tvar SORT_ASCENDING_CLASS = 'sort-ascending';\n\t\tvar SORT_DESCENDING_CLASS = 'sort-descending';\n\t\tvar linkText = $(e.target).text();\n\t\tvar type = linkText && $(e.target).text().toLowerCase() === 'time' ? 'time' : '';\n\n\t\tcolumnIndex = $clickedLink.closest('th').index();\n\n\t\tshouldSortAscending = !($clickedLink.hasClass(SORT_ASCENDING_CLASS)\n\t\t\t|| $clickedLink.hasClass(SORT_DESCENDING_CLASS))\n\t\t\t|| $clickedLink.hasClass(SORT_DESCENDING_CLASS);\n\n\t\tif (shouldSortAscending) {\n\t\t\t$clickedLink.removeClass(SORT_DESCENDING_CLASS).addClass(SORT_ASCENDING_CLASS);\n\t\t} else {\n\t\t\t$clickedLink.removeClass(SORT_ASCENDING_CLASS).addClass(SORT_DESCENDING_CLASS);\n\t\t}\n\n\t\t$clickedLink.closest('tr').find('a').not($clickedLink).removeClass(SORT_ASCENDING_CLASS)\n\t\t\t.removeClass(SORT_DESCENDING_CLASS);\n\n\t\t$tableRows.detach();\n\t\t$tableRows.sort(function sortColumns(a, b) {\n\t\t\treturn clickedColumnSorter(a, b, type);\n\t\t});\n\t\t$niftyTable.append($tableRows);\n\n\t\tresetTableStripes($tableRows, 'tr:visible:even', '#ebebeb');\n\t\tresetTableStripes($tableRows, 'tr:visible:odd', '#fff');\n\t}", "function sortTable(whichRows){\n getTablesForATM();\n let rowsToSort = whichRows == \"affils\" ? affilRows_atm : whichRows == \"orgs\" ? orgRows_atm : topicRows_atm;\n for (var x = 2; x < rowsToSort.length; x++){\n if (rowsToSort.length == 1){ return; }\n if (x == 2){ continue; }\n\n var currentIndex = x;\n\n while ( currentIndex > 2){\n \n let topRow = rowsToSort[currentIndex-1];\n let bottomRow = rowsToSort[currentIndex];\n\n let topRowCols = topRow.querySelectorAll(\"td.confluenceTd\");\n let bottomRowCols = bottomRow.querySelectorAll(\"td.confluenceTd\");\n\n let topRowValue = topRowCols[0].innerHTML;\n let bottomRowValue = bottomRowCols[0].innerHTML;\n\n let compare = topRowValue.localeCompare(bottomRowValue);\n \n if (compare > 0){\n swapRows(topRowCols, bottomRowCols);\n } else if (compare == 0) {\n let topRowValue2 = topRowCols[1].innerHTML;\n let bottomRowValue2 = bottomRowCols[1].innerHTML;\n let compare2 = topRowValue2.localeCompare(bottomRowValue2);\n if (compare2 > 0){\n swapRows(topRowCols, bottomRowCols);\n }\n }\n\n currentIndex--;\n } \n }\n }", "function askaron_sort(){\n\t$(\".sort__abc, sort__cba\").click(function(){\n\t\tvar ths = $(this);\n\t\tvar c = ths.closest(\".sort\");\n\t\tvar inx_col = ths.index();\n\t\tvar list = c.find(\".sort__list > td:nth-child(\"+(inx_col+1)+\")\").get();\n\t\t\n\t\t// Arrows\n\t\tths.toggleClass(\"sort__abc\").toggleClass(\"sort__cba\");\n\t\t\n\t\t// Sort\n\t\tlist.sort(function(a, b) {\n\t\t var compA = $(a).text().toUpperCase();\n\t\t var compB = $(b).text().toUpperCase();\n\t\t \n\t\t if(ths.hasClass(\"sort__abc\")){\n\t\t\t\treturn (compA < compB) ? -1 : (compA > compB) ? 1 : 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn (compA > compB) ? -1 : (compA < compB) ? 1 : 0;\n\t\t\t}\n\t\t \n\t\t});\n\t\t\n\t\t// Output\n\t\tvar prev_tr = false;\n\t\t$.each(list, function(idx, itm){\n\t\t\tvar tr_n = c.find(\".sort__list\").length;\n\t\t\tvar q = 0;\n\t\t\twhile(tr_n >= q){\n\t\t\t\tvar tr_c = c.find(\".sort__list:nth-child(\"+(q+2)+\")\");\n\t\t\t\tif(itm == tr_c.find(\"td\").get(inx_col)){\n\t\t\t\t\tif (prev_tr.length>0) {\n\t\t\t\t\t\tprev_tr.after(tr_c); \n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tc.find(\"th:last\").closest(\"tr\").after(tr_c); \n\t\t\t\t\t}\n\t\t\t\t\tprev_tr = tr_c;\n\t\t\t\t}\n\t\t\t\tq++;\n\t\t\t}\n\t\t});\n\t});\n}", "function sortTableview(type,index){\r\n var rows=$('#result_2 #'+type).find('tr').has('td').get();\r\n //alert(rows);\r\n rows.sort(function(a,b){\r\n var key_a=$(a).children('td').eq(index-1).text();\r\n key_a=$.trim(key_a);\r\n var key_b=$(b).children('td').eq(index-1).text();\r\n key_b=$.trim(key_b);\r\n if(key_a > key_b) return 1;\r\n if(key_a < key_b) return -1;\r\n return 0\r\n });\r\n $.each(rows,function(i,e){\r\n $('#result_2 #'+type).append(e);\r\n // if(i%2==1){\r\n // $(e).css('background','#ECECEC');\r\n // }else{\r\n // $(e).css('background','#FFFFFF'); \r\n // }\r\n });\r\n //setStyle(type); \r\n var page=$('#'+type).attr('index');\r\n $('#'+type+' tr').show();\r\n $('#'+type+' tr:lt('+parseInt((page-1)*50+1)+')').hide();\r\n $('#'+type+' tr:gt('+parseInt(page*50)+')').hide();\r\n $('#'+type+' tr:eq(0)').show();\r\n}", "function sortTable(col) {\n\n\t//for the todo table\n\tif (col < 3) {\n\n\t\tvar All_title = document.getElementById(\"todo\").getElementsByTagName(\"th\");\n\t\tvar title_size = All_title.length;\n\t\tfor (var i = 0; i < title_size; i++) {\n\t\t\tAll_title[i].style.background =\"blue\";\n\t\t}\n\t\tif (whichDirectionToPointForTodo) {\n\t\t\tevent.target.style.background = \"no-repeat right bottom url('ascend.png')\";\n\t\t\twhichDirectionToPointForTodo = 0;\n\t\t} else {\n\t\t\twhichDirectionToPointForTodo = 1;\n\t\t\tevent.target.style.background = \"no-repeat right bottom url('descend.png')\";\n\t\t}\n\t\tevent.target.style.backgroundColor = \"#6699FF\";\n\n\n\t\t\t// document.getElementById(\"todo\").rows[2].parentNode.insertBefore(table.rows[3], table.rows[2]);\n\t\tvar tr_size = document.getElementById(\"todo\").getElementsByTagName(\"tr\").length, table = document.getElementById(\"todo\");\n\t\tvar str_to_sort = [],after_sort = [];\n\t\tfor (var i = 1; i < tr_size; i++) {\n\t\t\tstr_to_sort[i - 1] = table.rows[i].cells[col % 3].innerHTML; //remember the precious\n\t\t\tafter_sort[i - 1] = table.rows[i].cells[col % 3].innerHTML;\n\t\t}\n\n\t\t//if whichDirecttopointfortoodo is 1 then asend\n\t\tif (whichDirectionToPointForTodo)\n\t\t\tafter_sort.sort();\n\t\telse\n\t\t\tafter_sort.reverse();\n\n\t\t\n\t\tfor (var i = 1; i < tr_size; i++) {\n\t\t\tvar j;\n\t\t\tfor (j = 1; j < tr_size; j++) { //find which to move to\n\t\t\t\tif (str_to_sort[j - 1] == after_sort[i -1]) //then it is j\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t//because the movement so the str in str_to_sort should make some adjust\n\t\t\tvar temp = str_to_sort[j - 1];\n\t\t\tfor (var u = j - 1; u > i - 1; u--)\n\t\t\t\tstr_to_sort[u] = str_to_sort[u - 1];\n\t\t\tstr_to_sort[i - 1] = temp; //move the str in str_to_sort that has been mmoved to the location where it just been moved\n\t\t\ttable.rows[i].parentNode.insertBefore(table.rows[j], table.rows[i]);\n\t\t}\n\t} else { //for the staff table\n\n\t\tvar All_title = document.getElementById(\"staff\").getElementsByTagName(\"th\");\n\t\tvar title_size = All_title.length;\n\t\tfor (var i = 0; i < title_size; i++) {\n\t\t\tAll_title[i].style.background =\"blue\";\n\t\t}\n\t\tif (whichDirectionToPointForStaff) {\n\t\t\tevent.target.style.background = \"no-repeat right bottom url('ascend.png')\";\n\t\t\twhichDirectionToPointForStaff = 0;\n\t\t} else {\n\t\t\twhichDirectionToPointForStaff = 1;\n\t\t\tevent.target.style.background = \"no-repeat right bottom url('descend.png')\";\n\t\t}\n\t\tevent.target.style.backgroundColor = \"#6699FF\";\n\n\n\t\t\t// document.getElementById(\"todo\").rows[2].parentNode.insertBefore(table.rows[3], table.rows[2]);\n\t\tvar tr_size = document.getElementById(\"staff\").getElementsByTagName(\"tr\").length, table = document.getElementById(\"staff\");\n\t\tvar str_to_sort = [],after_sort = [];\n\t\tfor (var i = 1; i < tr_size; i++) {\n\t\t\tstr_to_sort[i - 1] = table.rows[i].cells[col % 3].innerHTML; //remember the precious\n\t\t\tafter_sort[i - 1] = table.rows[i].cells[col % 3].innerHTML;\n\t\t}\n\n\t\tif (whichDirectionToPointForStaff)\n\t\t\tafter_sort.sort();\n\t\telse\n\t\t\tafter_sort.reverse();\n\t\t\n\t\tfor (var i = 1; i < tr_size; i++) {\n\t\t\tvar j;\n\t\t\tfor (j = 1; j < tr_size; j++) {\n\t\t\t\tif (str_to_sort[j - 1] == after_sort[i -1])\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\n\t\t\tvar temp = str_to_sort[j - 1];\n\t\t\tfor (var u = j - 1; u > i - 1; u--)\n\t\t\t\tstr_to_sort[u] = str_to_sort[u - 1];\n\t\t\tstr_to_sort[i - 1] = temp;\n\n\t\t\ttable.rows[i].parentNode.insertBefore(table.rows[j], table.rows[i]);\n\t\t}\n\t}\n}", "function saveSort(){\n var table_name = \"sortOrderSummary\";\n var table = $(table_name);\n var tBody = table.tBodies[0];\n var ssArray = new Array();\n ssArray = [getMessage('x20th'), getMessage('x19th'), getMessage('x18th'), getMessage('x17th'), getMessage('x16th'), getMessage('x15th'), getMessage('x14th'), getMessage('x13th'), getMessage('x12th'), getMessage('x11th'), getMessage('x10th'), getMessage('x9th'), getMessage('x8th'), getMessage('x7th'), getMessage('x6th'), getMessage('x5th'), getMessage('x4th'), getMessage('x3rd'), getMessage('x2nd'), getMessage('x1st')];\n \n // var objRegExp = /<font color=navy><b>(.*)<\\/b><\\/font>/i;\n var sortFldsArray = new Array();\n var view = tabsFrame.newView;\n var numRows = tBody.rows.length;\n var index = view.tableGroups.length - tabsFrame.selectedTableGroup - 1;\n var curTgrp = view.tableGroups[index];\n\n for (i = 1; i < numRows; i++) {\n var aOrder = ssArray[ssArray.length - i];\n for (k = 1; k < numRows; k++) {\n var row = tBody.rows[k];\n var tOrder = row.cells[7].innerHTML;\n var sortFldObj = new Object();\n if (aOrder == tOrder) {\n sortFldObj.field_name = row.cells[0].innerHTML;\n sortFldObj.ml_heading = row.cells[1].innerHTML;\n sortFldObj.primary_key = row.cells[2].innerHTML;\n sortFldObj.data_type = row.cells[3].innerHTML;\n sortFldObj.afm_type = row.cells[4].innerHTML;\n sortFldObj.table_name = row.cells[5].innerHTML;\n sortFldObj.is_virtual = row.cells[1].is_virtual;\n sortFldObj.sql = row.cells[1].sql;\n var desc = $('sort_' + row.cells[5].innerHTML + '.' + row.cells[0].innerHTML);\n if (desc.checked){\n \tsortFldObj.isAscending = false;\t\n } else {\n \tsortFldObj.isAscending = true;\n }\n \n if ((row.cells[3].innerHTML == 'Date') && pattern.match(/summary|paginated/gi)){\n \tvar groupByDateObj = $('groupByDate_' + row.cells[5].innerHTML + '.' + row.cells[0].innerHTML);\n \tsortFldObj.groupByDate = groupByDateObj.value;\n }\n sortFldObj.ml_heading_english = row.ml_heading_english; \n sortFldsArray.push(sortFldObj);\n\n }\n }\n }\n var view = tabsFrame.newView;\n curTgrp.sortFields = sortFldsArray;\t\n view.tableGroups[index] = curTgrp;\t\n tabsFrame.newView = view;\n}", "function sortTable(tabla,n){\n\tvar table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;\n\ttable = document.getElementById(tabla);\n\tswitching = true;\n\t// Set the sorting direction to ascending:\n\tdir = \"asc\";\n\t/* Make a loop that will continue until\n\tno switching has been done: */\n\twhile(switching){\n\t\t// Start by saying: no switching is done:\n\t\tswitching = false;\n\t\trows = table.rows;\n\t\t/* Loop through all table rows (except the\n\t\tfirst, which contains table headers): */\n\t\tfor(i = 1; i < (rows.length - 1); i++){\n\t\t // Start by saying there should be no switching:\n\t\t shouldSwitch = false;\n\t\t /* Get the two elements you want to compare,\n\t\t one from current row and one from the next: */\n\t\t x = rows[i].getElementsByTagName(\"TD\")[n];\n\t\t y = rows[i + 1].getElementsByTagName(\"TD\")[n];\n\t\t /* Check if the two rows should switch place,\n\t\t based on the direction, asc or desc: */\n\t\t if(dir == \"asc\"){\n\t\t\tif(x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()){\n\t\t\t // If so, mark as a switch and break the loop:\n\t\t\t shouldSwitch = true;\n\t\t\t break;\n\t\t\t}\n\t\t }else if(dir == \"desc\"){\n\t\t\tif(x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()){\n\t\t\t // If so, mark as a switch and break the loop:\n\t\t\t shouldSwitch = true;\n\t\t\t break;\n\t\t\t}\n\t\t }\n\t\t}\n\t\tif(shouldSwitch){\n\t\t /* If a switch has been marked, make the switch\n\t\t and mark that a switch has been done: */\n\t\t rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);\n\t\t switching = true;\n\t\t // Each time a switch is done, increase this count by 1:\n\t\t switchcount ++;\n\t\t}else{\n\t\t /* If no switching has been done AND the direction is \"asc\",\n\t\t set the direction to \"desc\" and run the while loop again. */\n\t\t if(switchcount == 0 && dir == \"asc\"){\n\t\t\tdir = \"desc\";\n\t\t\tswitching = true;\n\t\t }\n\t\t}\n\t}\n}", "function sortTable(sTableID, iCol, sDataType) { \n\t\treturn function(){\n\t\t\tvar oTable = document.getElementById(sTableID); \n\t\t\tvar oTBody = oTable.tBodies[0]; \n\t\t\tvar colDataRows = oTBody.rows; \n\t\t\tvar aTRs = new Array; \n\n\t\t\tfor (var i = 0; i < colDataRows.length; i++) aTRs[i] = colDataRows[i]; \n\t\t\tif (oTable.getAttribute(\"sortCol\") == iCol) aTRs.reverse(); \n\t\t\telse aTRs.sort(generateCompareTRs(iCol, sDataType)); \n\n\t\t\tvar oFragment = document.createDocumentFragment(); \n\t\t\tfor (var i = 0; i < aTRs.length; i++) oFragment.appendChild(aTRs[i]); \n\n\t\t\toTBody.appendChild(oFragment); \n\t\t\toTable.setAttribute(\"sortCol\", iCol); \n\t\t};\n\t}", "function clickedColumnSorter(aTableRow, bTableRow, type) {\n\t\tvar aContent = getFirstTextFromCell(aTableRow, columnIndex).toLowerCase();\n\t\tvar bContent = getFirstTextFromCell(bTableRow, columnIndex).toLowerCase();\n\n\t\tvar aExtractedContent = numericStringTools.extractNumbersIfPresent(aContent);\n\t\tvar bExtractedContent = numericStringTools.extractNumbersIfPresent(bContent);\n\n\t\tif (type === 'time') {\n\t\t\tvar now = new Date();\n\n\t\t\tvar aFullDate = now.toDateString() + ' ' + aContent.slice(0, 5) + ' ' + aContent.slice(-2);\n\t\t\tvar bFullDate = now.toDateString() + ' ' + bContent.slice(0, 5) + ' ' + bContent.slice(-2);\n\n\t\t\taExtractedContent = Date.parse(aFullDate);\n\t\t\tbExtractedContent = Date.parse(bFullDate);\n\t\t}\n\t\tvar directionComparer = shouldSortAscending ? ascendingComparer : descendingComparer;\n\n\t\treturn comparer(directionComparer, aExtractedContent, bExtractedContent);\n\t}", "function sortByCol(a, b) {\n a = a[0]\n b = b[0]\n return (a === b) ? 0 : (a < b) ? -1 : 1\n}", "function sortMe() {\n var ss = SpreadsheetApp.getActiveSpreadsheet(); \n var cList = ss.getSheetByName('Card List');\n var range = cList.getRange(2,1,cList.getMaxRows()-1,cList.getMaxColumns());\n // sort by sort and name\n range.sort([findColumn('Sort')+1,findColumn('Name')+1]);\n}", "_sortBy(array, selectors) {\n return array.concat().sort((a, b) => {\n for (let selector of selectors) {\n let reverse = selector.order ? -1 : 1;\n\n a = selector.value ? JP.query(a, selector.value)[0] : JP.query(a,selector)[0];\n b = selector.value ? JP.query(b, selector.value)[0] : JP.query(b,selector)[0];\n\n if (a.toUpperCase() > b.toUpperCase()) {\n return reverse;\n }\n if (a.toUpperCase() < b.toUpperCase()) {\n return -1 * reverse;\n }\n }\n return 0;\n });\n }", "function columnGroupWidths(groups, all, tableWidth) {\n var result = {\n left: columnTotalWidth(groups.left),\n center: columnTotalWidth(groups.center),\n right: columnTotalWidth(groups.right),\n total: Math.floor(columnTotalWidth(all)),\n };\n if (tableWidth > result.total) {\n result.center += tableWidth - result.total;\n result.total = tableWidth;\n }\n return result;\n}", "function sortTeams(tableName) {\n var teams = Object.keys(data.scores);\n\n sortedTeams = teams.sort(function(teamA, teamB) {\n achievement_diff = Number(data.scores[teamA][tableName]['achievements']) - Number(data.scores[teamB][tableName]['achievements']);\n //console.log(data.scores[teamA][tableName]['Achievements'])\n //console.log(data.scores[teamB][tableName]['Achievements'])\n if(achievement_diff != 0) {\n return -achievement_diff;\n }\n\n penalty_diff = Number(data.scores[teamA][tableName]['penalties']) - Number(data.scores[teamB][tableName]['penalties']);\n if(penalty_diff != 0) {\n return penalty_diff;\n }\n\n time_diff = Number(data.scores[teamA][tableName]['time']) - Number(data.scores[teamB][tableName]['time']);\n if(time_diff != 0) {\n return time_diff;\n }\n\n return 0;\n });\n\n console.log('sorted teams: ' + sortedTeams);\n\n return sortedTeams;\n}", "function sortTable() {\n let i, shouldSwitch;\n const table = document.getElementById('results');\n let switching = true;\n while (switching) {\n switching = false;\n let rows = table.rows;\n\n for (i = 1; i < (rows.length - 1); i++) {\n shouldSwitch = false;\n let x = rows[i].getElementsByTagName('td')[2];\n let y = rows[i + 1].getElementsByTagName('td')[2];\n\n if (parseInt(x.innerHTML) < parseInt(y.innerHTML)) {\n shouldSwitch = true;\n break;\n }\n }\n if (shouldSwitch) {\n rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);\n switching = true;\n }\n }\n}", "function sortTable(sTableID, iCol, sDataType) { \r\n\t\treturn function(){\r\n\t\t\tvar oTable = document.getElementById(sTableID); \r\n\t\t\tvar oTBody = oTable.tBodies[0]; \r\n\t\t\tvar colDataRows = oTBody.rows; \r\n\t\t\tvar aTRs = new Array; \r\n\r\n\t\t\tfor (var i = 0; i < colDataRows.length; i++) aTRs[i] = colDataRows[i]; \r\n\t\t\tif (oTable.getAttribute(\"sortCol\") == iCol) aTRs.reverse(); \r\n\t\t\telse aTRs.sort(generateCompareTRs(iCol, sDataType)); \r\n\r\n\t\t\tvar oFragment = document.createDocumentFragment(); \r\n\t\t\tfor (var i = 0; i < aTRs.length; i++) oFragment.appendChild(aTRs[i]); \r\n\r\n\t\t\toTBody.appendChild(oFragment); \r\n\t\t\toTable.setAttribute(\"sortCol\", iCol); \r\n\t\t};\r\n\t}", "function tabularNestHeader(element) {\n var head = element.querySelectorAll(\"thead\")[0];\n var row = head.querySelectorAll(\"tr\")[0];\n var hth = row.querySelectorAll(\"th\");\n\n var colons = 0;\n var i;\n for (i = 0; i < hth.length; i++) {\n var n = hth[i].textContent.split(\":\").length;\n if (n > colons) colons = n;\n }\n\n for (i = 0; i < 2*colons; i++) {\n var tr = document.createElement(\"tr\");\n var td = document.createElement(\"td\");\n tr.appendChild(td);\n\n for (var j = 0; j < hth.length; j++) {\n var text = hth[j].textContent.split(\":\");\n var k = Math.floor(i/2);\n var th = document.createElement(\"th\");\n if (k < text.length) {\n th.textContent = text[k].split(\"/\")[i % 2];\n } else {\n th.textContent = \"\";\n }\n tr.appendChild(th);\n }\n head.appendChild(tr);\n }\n\n row.parentElement.removeChild(row);\n row = head.querySelectorAll(\"tr\");\n for (i = 0; i < row.length; i++) {\n var rth = row[i].querySelectorAll(\"th\");\n var curn = 0;\n var cur = rth[curn].textContents;\n var colspan = 1;\n for (j = 0; j < rth.length; j++) {\n if (rth[j].textContent === cur && rth[j].textContent !== \"\") {\n rth[j].parentElement.removeChild(rth[j]);\n colspan++;\n rth[curn].setAttribute(\"colspan\", colspan);\n } else {\n colspan = 1;\n curn = j;\n cur = rth[curn].textContent;\n }\n }\n }\n}", "function sorterTabell(tabellen) {\n var table = 0;\n var rader =0;\n var bytte= 0;\n var i= 0;\n var x= 0;\n var y= 0;\n var shouldSwitch= 0;\n var vei= 0;\n var switchcount = 0;\n table = document.getElementById(\"rapportTable\");\n vei = \"asc\";\n bytte = true;\n\n while (bytte) {\n bytte = false;\n rader = table.rows;\n for (i = 1; i < (rader.length - 1); i++) {\n shouldSwitch = false;\n y = rader[i + 1].getElementsByTagName(\"td\")[tabellen];\n x = rader[i].getElementsByTagName(\"td\")[tabellen];\n if (vei == \"asc\") {\n if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {\n shouldSwitch = true;\n break;\n }\n\n } else if (vei == \"desc\") {\n if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {\n shouldSwitch = true;\n break;\n }\n }\n }\n if (shouldSwitch) {\n rader[i].parentNode.insertBefore(rader[i + 1], rader[i]);\n bytte = true;\n switchcount ++;\n } else {\n if (switchcount == 0 && vei == \"asc\") {\n vei = \"desc\";\n bytte = true;\n }\n\n }\n\n\n }\n }", "function sortTable() {\n var table, rows, switching, i, x, y, shouldSwitch;\n table = document.getElementById(\"course-table\");\n switching = true;\n /*Make a loop that will continue until\n no switching has been done:*/\n while (switching) {\n //start by saying: no switching is done:\n switching = false;\n rows = $( \".c\" );\n /*Loop through all table rows (except the\n first, which contains table headers):*/\n for (i = 0; i < (rows.length - 1); i++) {\n //start by saying there should be no switching:\n shouldSwitch = false;\n /*Get the two elements you want to compare,\n one from current row and one from the next:*/\n x = rows[i].getElementsByTagName(\"TD\")[0];\n y = rows[i + 1].getElementsByTagName(\"TD\")[0];\n //check if the two rows should switch place:\n if (x.getElementsByTagName(\"a\")[0].innerHTML.toLowerCase() > y.getElementsByTagName(\"a\")[0].innerHTML.toLowerCase()) {\n //if so, mark as a switch and break the loop:\n shouldSwitch= true;\n break;\n }\n }\n if (shouldSwitch) {\n /*If a switch has been marked, make the switch\n and mark that a switch has been done:*/\n //$(rows[i]).after($(rows[i+1]));\n var i1 = $(rows[i+1]).attr('id');\n var d1 = document.getElementById(i1+\"-desc\");\n rows[i].parentNode.insertBefore(rows[i+1], rows[i]);\n rows[i].parentNode.insertBefore(d1, rows[i]);\n //rows[i].parentNode.insertBefore(rows[i+3], rows[i]);\n switching = true;\n }\n }\n}", "function onClickLastNameTableHeader(event)\n{\n document.isAscendingOrder = !document.isAscendingOrder;\n sortTableElementsBy(\"last_name\");\n}", "function tabularSelect(element, column) {\n var order = {};\n var head = element.querySelectorAll(\"thead\")[0]\n .querySelectorAll(\"tr\")[0];\n var hth = head.querySelectorAll(\"th\");\n for (var i = 0; i < hth.length; i++)\n order[hth[i].textContent] = i;\n\n for (var i = 0; i < column.length; i++) {\n var th = document.createElement(\"th\");\n var loc = order[column[i]];\n th.textContent = hth[loc].textContent;\n head.appendChild(th);\n hth[loc].parentElement.removeChild(hth[loc]);\n }\n\n var body = element.querySelectorAll(\"tbody\")[0];\n var row = body.querySelectorAll(\"tr\");\n\n for (var i = 0; i < row.length; i++) {\n var btd = row[i].querySelectorAll(\"td\");\n for (var j = 0; j < column.length; j++) {\n var td = document.createElement(\"td\");\n var loc = order[column[j]];\n td.textContent = btd[loc].textContent;\n row[i].appendChild(td);\n btd[loc].parentElement.removeChild(btd[loc]);\n }\n }\n}", "function sortTableAsc() {\r\n var rows, switching, i, x, y, shouldSwitch;\r\n var switching = true;\r\n /* Make a loop that will continue until no switching has been done: */\r\n \r\n while (switching == true) { // while switching is true --> execute the next code until switching is false\r\n // Start by saying: no switching is done:\r\n switching = false;\r\n var rows = table.rows;\r\n /* Loop through all table rows (except the first, which contains table headers): */\r\n for (i = 1; i < (rows.length-1); i++) {\r\n // Start by saying there should be no switching:\r\n var shouldSwitch = false;\r\n /* Get the two elements you want to compare,one from current row and one from the next: */\r\n x = rows[i].getElementsByTagName(\"TD\")[0];\r\n y = rows[i + 1].getElementsByTagName(\"TD\")[0];\r\n // console.log(x)\r\n //console.log(y)\r\n // Check if the two rows should switch place:\r\n if (x.innerHTML > y.innerHTML) {\r\n // If so, mark as a switch and break the loop:\r\n shouldSwitch = true;\r\n break;\r\n }\r\n }\r\n if (shouldSwitch == true) {\r\n /* If a switch has been marked, make the switch and mark that a switch has been done: */\r\n rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);\r\n switching = true;\r\n }\r\n }\r\n }", "function tableOrders()\n\t\t{\n\t\t\tTable.print(data, Table.ORDER_FOUND);\n\t\t\tTable.print(data, Table.ORDER_ALPHA);\n\t\t\tTable.print(data, Table.ORDER_COLUMN);\n\t\t\tTable.print(data, Table.ORDER_ROW);\n\t\t\tTable.print(data, Table.ORDER_FIRST);\n\t\t}", "function renderSorted(sortedData){\n table.innerHTML = \"\"\n sortedData.forEach((group) => {\n const newGroup = new aCappellaGroup(group)\n table.innerHTML += newGroup.render()\n })\n console.log('sorted the table');\n }", "function _fnColumnOrdering(oSettings) {\n\t\t\tvar sNames = '';\n\t\t\tfor (var i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n\t\t\t\tsNames += oSettings.aoColumns[i].sName + ',';\n\t\t\t}\n\t\t\tif (sNames.length == iLen) {\n\t\t\t\treturn \"\";\n\t\t\t}\n\t\t\treturn sNames.slice(0, -1);\n\t\t}", "function standardizeCols(columns) {\n\n\t/**\n\t * Gets the default column name\n\t */\n\tfunction getDefaultFormatter(colName) {\n\t\treturn function(o) {\n\t\t\treturn o[colName];\n\t\t};\n\t}\n\n\t/**\n\t * Gets the default column sorter\n\t */\n\tfunction getDefaultSorter(colName) {\n\t\treturn function(a, b, dir){\n\n\t\t\tvar \n\t\t\t\tfirstRec = dir == 'asc' ? a : b,\n\t\t\t\tsecondRec = dir == 'asc' ? b : a,\n\n\t\t\t\tfA = firstRec[colName].toLowerCase(),\n\t\t\t\tfB = secondRec[colName].toLowerCase();\n\n\t\t\t// Handle numbers\n\t\t\tif (fA<fB) return -1\n\t\t\tif (fA>fB) return +1\n\t\t\treturn 0\n\t\t};\n\t}\n\n\n\tfor (var i in columns) {\n\t\tvar column = columns[i];\n\n\t\tif (typeof column == \"string\") {\n\t\t\tcolumn = {name: column};\n\t\t}\n\n\t\tcolumn.dir = column.sortDir || 'asc';\n\t\tcolumn.formatter = column.formatter || getDefaultFormatter(column.key || column.name);\n\t\tcolumn.sorter = column.sorter || getDefaultSorter(column.key || column.name);\n\n\t\tcolumns[i] = column;\n\t}\n\treturn columns;\n}", "function sortTable(sTableID, iCol, sDataType) {\r\n\t\treturn function(){\r\n\t\t\tvar oTable = document.getElementById(sTableID);\r\n\t\t\tvar oTBody = oTable.tBodies[0];\r\n\t\t\tvar colDataRows = oTBody.rows;\r\n\t\t\tvar aTRs = new Array;\r\n\r\n\t\t\tfor (var i = 0; i < colDataRows.length; i++) aTRs[i] = colDataRows[i];\r\n\t\t\tif (oTable.getAttribute(\"sortCol\") == iCol) aTRs.reverse();\r\n\t\t\telse aTRs.sort(generateCompareTRs(iCol, sDataType));\r\n\r\n\t\t\tvar oFragment = document.createDocumentFragment();\r\n\t\t\tfor (var i = 0; i < aTRs.length; i++) oFragment.appendChild(aTRs[i]);\r\n\r\n\t\t\toTBody.appendChild(oFragment);\r\n\t\t\toTable.setAttribute(\"sortCol\", iCol);\r\n\t\t};\r\n\t}", "function sort() {\n \n // source: https://gist.github.com/sco-tt/b3f07c1882ac698afc74\n \n /** Variables for customization:\n \n Each column to sort takes two variables: \n 1) the column index (i.e. column A has a colum index of 1\n 2) Sort Asecnding -- default is to sort ascending. Set to false to sort descending\n \n **/\n\n //Variable for column to sort first\n \n var sortFirst = 2; //index of column to be sorted by; 1 = column A, 2 = column B, etc.\n var sortFirstAsc = true; //Set to false to sort descending\n \n //Variables for column to sort second\n \n var sortSecond = 3;\n var sortSecondAsc = false;\n \n //Number of header rows\n \n var headerRows = 1; \n\n /** End Variables for customization**/\n \n /** Begin sorting function **/\n\n var activeSheet = SpreadsheetApp.getActiveSheet();\n var sheetName = activeSheet.getSheetName(); //name of sheet to be sorted\n var sheet = SpreadsheetApp.getActive().getSheetByName(sheetName);\n var range = sheet.getRange(headerRows+1, 1, sheet.getMaxRows()-headerRows, sheet.getLastColumn());\n range.sort([{column: sortFirst, ascending: sortFirstAsc}, {column: sortSecond, ascending: sortSecondAsc}]);\n}", "function loadByDate(sortcol) {\r\nvar sort_by = sortcol;\r\nfor (var i=0; i < data_array.length; i+=1) {\r\nvar j_var = [];\r\nfor (var j=0; j <= total_col_count; j+=1) {\r\n\r\n\r\nif (sort_by === 9) { // If sorting by date stamp\r\nif (j === sort_by) {\r\nj_var.unshift(data_array[i][j]);\r\n} else {\r\nj_var.push(data_array[i][j]);\r\n}\r\n} else { // If not sorting by date stamp\r\nj_var.push(data_array[i][j]);\r\n}\r\n\r\n} // end for j\r\nworking_array.push(j_var);\r\n} // end for i\r\nworking_array.sort();\r\nworking_array.reverse();\r\n\r\nvar tableHTML = '<table class=\"table table-hover\"><thead><tr>';\r\n\r\nvar tableHTML = '<table class=\"table table-hover table-bordered\"><thead><tr>';\r\nfor (var i=0; i < cell_title_array.length; i+=1) { // Populate table headers\r\ntableHTML += '<th>' + cell_title_array[i] + '</th>';\r\n}\r\ntableHTML += '</tr></thead><tbody>';\r\n\r\nfor (var i=0; i < working_array.length; i+=1) { // Populate default table body\r\ntableHTML += '<tr>';\r\nfor (var j=0; j < 10; j+=1) {\r\n\r\nif (sort_by === 9) { // If sorting by date stamp\r\nif (j > 0) { // excludes the time stamp from the table\r\ntableHTML += '<td>';\r\ntableHTML += working_array[i][j];\r\ntableHTML += '</td>';\r\n}\r\n} else { // If not sorting by date stamp\r\ntableHTML += '<td>';\r\ntableHTML += working_array[i][j];\r\ntableHTML += '</td>';\r\n}\r\n\r\n\r\n} // end for j\r\ntableHTML += '</tr>';\r\n}\r\ntableHTML += '</tbody></table>';\r\n\r\ndocument.getElementById('infoDiv').innerHTML = tableHTML;\r\ndocument.getElementById('description_jumbotron').style.display = 'none';\r\n\r\n\r\n} // end load by date function", "function sortTable() {\r\n\tvar table, rows, switching, i, x, y, shouldSwitch;\r\n \ttabley = document.getElementById(\"customers\");\r\n \tswitching = true;\r\n \twhile (switching) {\r\n \tswitching = false;\r\n \trows = tabley.rows;\r\n \tfor (i = 1; i < (rows.length - 1); i++) {\r\n \t\tshouldSwitch = false;\r\n \t\tx = rows[i].getElementsByTagName(\"td\")[2];\r\n \t\ty = rows[i + 1].getElementsByTagName(\"td\")[2];\r\n \t\tif (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {\r\n \t\tshouldSwitch = true;\r\n \t\tbreak;\r\n \t}\r\n }\r\n if (shouldSwitch)\r\n {\r\n \trows[i].parentNode.insertBefore(rows[i + 1], rows[i]);\r\n \tswitching = true;\r\n }\r\n }\r\n}", "function transform(column, updatedSortInfo = \"\") {\n if (typeof updatedSortInfo === \"object\") sortInfo = updatedSortInfo;\n\n d3.select(\"tbody\").selectAll(\"tr\").remove();\n d3.select(\"thead\").selectAll(\"tr\").remove();\n\n // Table Header\n d3.select(\"thead\").append('tr')\n .attr(\"class\", \"table-heading\")\n .selectAll(\"th\")\n .data(CodingProgressTableController.jsonToArray(data[0]))\n .enter()\n .append(\"th\")\n .on(\"click\", (event, d) => {\n CodingProgressTableController.saveSortInfo(d[0]);\n let latestSortInfo = CodingProgressTableController.sortInfoArray.slice(-1)[0];\n transform(d[0], latestSortInfo);\n })\n .text((d) => d[0]);\n\n // Table Rows\n let tr = d3.select(\"tbody\").selectAll(\"tr\")\n .data(data)\n .enter().append(\"tr\")\n .sort((a, b, order = sortInfo.order) => a == null || b == null ? 0 : \n typeof a[column] === \"string\" && typeof b[column] === \"string\" ? \n CodingProgressTableController.stringCompare(a[column], b[column], order) :\n CodingProgressTableController.sortingTieBreakers(\n a[column], b[column], a[\"Dataset\"], b[\"Dataset\"], order)\n );\n\n // Table Cells\n let td = tr.selectAll(\"td\")\n .data(d => CodingProgressTableController.jsonToArray(d, \"td\"))\n .enter().append(\"td\")\n \n // Filter Dataset column from columns & append text to td\n td.filter((d, i) => d[0] !== \"Dataset\" && i !== 0)\n .attr('class', d => Number.isInteger(d[1]) ? \"integer\" : \n Math.ceil(d[1]) === d[1] ? \"float\" : \"dash\")\n .text(d => Number.isNaN(d[1]) ? \"-\" : \n Number.isInteger(d[1]) ? [\"Done\", \"WS %\", \"NC %\"].includes(d[0]) ? `${d[1]}%` : d[1].toLocaleString() :\n [\"Done\", \"WS %\", \"NC %\"].includes(d[0]) ? `${d[1].toFixed(2)}%` : d[1].toFixed(2))\n\n // Select Dataset Column, create a link & append text to td\n td.filter((d, i) => d[0] === \"Dataset\" && i === 0)\n .append(\"a\")\n .attr(\"href\", d => `https://web-coda.firebaseapp.com/?dataset=${d[1]}`)\n .attr(\"target\", \"_blank\")\n .text((d) => d[1]);\n\n // Filter table to remain with \"Done\" column\n td.filter((d, i) => d[0] === \"Done\").each((d, i, n) => {\n // Select Table Row\n let parentNode = d3.select(n[i].parentNode);\n // Select Table Data and access data bound to the node\n let tableData = d3.select(n[i]).data()[0][1];\n if (parseFloat(tableData) === 0) {\n parentNode.attr(\"class\", \"coding-notstarted\");\n } else if (parseFloat(tableData) > 0 && parseFloat(tableData) <= 25) {\n parentNode.attr(\"class\", \"coding-below25\");\n } else if (parseFloat(tableData) > 25 && parseFloat(tableData) <= 50) {\n parentNode.attr(\"class\", \"coding-above25\");\n } else if (parseFloat(tableData) > 50 && parseFloat(tableData) <= 75) {\n parentNode.attr(\"class\", \"coding-above50\");\n } else if (parseFloat(tableData) > 75 && parseFloat(tableData) < 100) {\n parentNode.attr(\"class\", \"coding-above75\");\n } else {\n parentNode.attr(\"class\", \"coding-complete\");\n }\n });\n\n // Attach event listeners to columns' checkbox & ability to filter table\n d3.selectAll(\"input[type=checkbox]\").on(\"change\", (event, d) => {\n if (d3.select(event.currentTarget).property(\"checked\")) {\n CodingProgressTableController.selectedColumns = CodingProgressTableController.selectedColumns.filter(\n e => e !== event.currentTarget.nextElementSibling.innerText.trim());\n transform(column, sortInfo.order)\n } else {\n CodingProgressTableController.selectedColumns.push(event.currentTarget.nextElementSibling.innerText.trim())\n transform(column, sortInfo.order)\n }\n });\n\n // Enable the ability to filter table by selected keyword in dropdown menu \n d3.select(\"#keyword\").on(\"change\", (event, d) => {\n CodingProgressTableController.keyword = event.currentTarget.options[event.currentTarget.selectedIndex].innerText.trim(); \n transform(column, sortInfo.order);\n });\n\n // Enable the ability to filter table by user's keyword input\n let searchInputNode = document.getElementById(\"input-keyword\");\n d3.select(\"button#search\").on(\"click\", () => {\n let value = searchInputNode.value.trim();\n if (value) {\n CodingProgressTableController.keyword = value;\n transform(column, sortInfo.order);\n } else {\n alert(\"Enter keyword...\");\n }\n });\n searchInputNode.addEventListener(\"keydown\", function onEvent(event) {\n if (event.key === \"Enter\") {\n let value = searchInputNode.value.trim();\n if (value) {\n CodingProgressTableController.keyword = value;\n transform(column, sortInfo.order);\n } else {\n alert(\"Enter keyword...\");\n }\n }\n });\n\n // View all datasets on clicking `view all` button\n d3.select(\"button#reset\").on(\"click\", () => {\n CodingProgressTableController.keyword = \"\";\n transform(column, sortInfo.order);\n // Reset select value to default\n let options = document.querySelectorAll(\"#keyword option\");\n for (const option of options) {\n option.selected = option.defaultSelected;\n }\n });\n\n // Hide `view all` button if all datasets are being displayed\n if (CodingProgressTableController.keyword) {\n d3.select(\"button#reset\").style(\"display\", \"block\");\n } else if (CodingProgressTableController.keyword == \"\") {\n d3.select(\"button#reset\").style(\"display\", \"none\");\n }\n }", "function fixColumnWidth(table) {\n if (table.config.widthFixed && $(table).find('colgroup').length === 0) {\n var colgroup = $('<colgroup>'),\n overallWidth = $(table).width();\n // only add col for visible columns - fixes #371\n $(table.tBodies[0]).find(\"tr:first\").children(\":visible\").each(function() {\n colgroup.append($('<col>').css('width', parseInt(($(this).width()/overallWidth)*1000, 10)/10 + '%'));\n });\n $(table).prepend(colgroup);\n }\n }", "function fixColumnWidth(table) {\n\t\t\t\tvar colgroup, overallWidth,\n\t\t\t\t\tc = table.config;\n\t\t\t\tif (c.widthFixed && c.$table.children('colgroup').length === 0) {\n\t\t\t\t\tcolgroup = $('<colgroup>');\n\t\t\t\t\toverallWidth = $(table).width();\n\t\t\t\t\t// only add col for visible columns - fixes #371\n\t\t\t\t\t$(table.tBodies).not('.' + c.cssInfoBlock).find(\"tr:first\").children(\":visible\").each(function() {\n\t\t\t\t\t\tcolgroup.append($('<col>').css('width', parseInt(($(this).width()/overallWidth)*1000, 10)/10 + '%'));\n\t\t\t\t\t});\n\t\t\t\t\tc.$table.prepend(colgroup);\n\t\t\t\t}\n\t\t\t}", "function makeAllTablesSortable(table) {\n\n th = document.getElementsByTagName(\"th\");\n\n th[0].onclick = function() {\n sortTable(0);\n }\n th[1].onclick = function() {\n sortTable(1);\n }\n th[2].onclick = function() {\n sortTable(2);\n }\n th[3].onclick = function() {\n sortTable(3);\n }\n th[4].onclick = function() {\n sortTable(4);\n }\n th[5].onclick = function() {\n sortTable(5);\n }\n\n}", "function sorted(sheet){\n sheet.sort(masterCols.end_time+1).sort(masterCols.start_time+1).sort(masterCols.date+1);\n}", "function sortTable(isRefresh) {\n ctrl.originalSortedFunctions =\n lodash.orderBy(ctrl.functions, [ctrl.sortedColumnName], ctrl.isReverseSorting ? ['desc'] : ['asc']);\n\n paginateFunctions(isRefresh);\n }", "function _fnColumnOrdering ( oSettings )\n\t\t{\n\t\t\tvar sNames = '';\n\t\t\tfor ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )\n\t\t\t{\n\t\t\t\tsNames += oSettings.aoColumns[i].sName+',';\n\t\t\t}\n\t\t\tif ( sNames.length == iLen )\n\t\t\t{\n\t\t\t\treturn \"\";\n\t\t\t}\n\t\t\treturn sNames.slice(0, -1);\n\t\t}", "function _fnColumnOrdering ( oSettings )\n\t\t{\n\t\t\tvar sNames = '';\n\t\t\tfor ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )\n\t\t\t{\n\t\t\t\tsNames += oSettings.aoColumns[i].sName+',';\n\t\t\t}\n\t\t\tif ( sNames.length == iLen )\n\t\t\t{\n\t\t\t\treturn \"\";\n\t\t\t}\n\t\t\treturn sNames.slice(0, -1);\n\t\t}", "async function TopologicalSort(){}", "function sortRows(){\n\t//grab all header rows\n\t$('thead th').each(function(column) {\n\t $(this).addClass('sortable').click(function(){\n\t var findSortKey = function($cell) {\n\t return $cell.find('.sort-key').text().toUpperCase() + ' ' + $cell.text().toUpperCase();\n\t };\n\t var sortDirection = $(this).is('.sorted-asc') ? -1 : 1;\n\t \n\t //step back up the tree and get the rows with data\n\t //for sorting\n\t var $rows = $(this).parent().parent().parent().find('tbody tr').get();\n\t \n\t //loop through all the rows and find \n\t $.each($rows, function(index, row) {\n\t row.sortKey = findSortKey($(row).children('td').eq(column));\n\t });\n\t \n\t //compare and sort the rows alphabetically\n\t $rows.sort(function(a, b) {\n\t if (a.sortKey < b.sortKey) return -sortDirection;\n\t if (a.sortKey > b.sortKey) return sortDirection;\n\t return 0;\n\t });\n\t \n\t //add the rows in the correct order to the bottom of the table\n\t $.each($rows, function(index, row) {\n\t $('tbody').append(row);\n\t row.sortKey = null;\n\t });\n\t \n\t //identify the column sort order\n\t $('th').removeClass('sorted-asc sorted-desc');\n\t var $sortHead = $('th').filter(':nth-child(' + (column + 1) + ')');\n\t sortDirection == 1 ? $sortHead.addClass('sorted-asc') : $sortHead.addClass('sorted-desc');\n\t \n\t //identify the column to be sorted by\n\t $('td').removeClass('sorted')\n\t .filter(':nth-child(' + (column + 1) + ')')\n\t .addClass('sorted');\n\t \n\t $('.visible td').removeClass('odd');\n\t zebraRows('.visible:even td', 'odd');\n\t });\n\t});\n}", "function sortTable(num) {\n\tvar table, rows, switching, i, x, y, ascend, shouldSwitch;\n\ttable = document.getElementById(\"tblList\");\n\tswitching = true;\n\n\tif (sortArray[num]) {\n\t\tsortArray[num] = false;\n\t\tascend = false;\n\t} else {\n\t\tsortArray[num] = true;\n\t\tascend = true;\n\t}\n\n\twhile (switching) {\n\t\tswitching = false;\n\t\trows = table.rows;\n\n\t\tfor (i = 1; i < (rows.length - 2); i++) {\n\t\t\tshouldSwitch = false;\n\t\t\tx = rows[i].getElementsByTagName(\"TD\")[num];\n\t\t\ty = rows[i + 1].getElementsByTagName(\"TD\")[num];\n\t\t\tif (ascend) {\n\t\t\t\tif (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {\n\t\t\t\t\tshouldSwitch = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()){\n\t\t\t\t\tshouldSwitch = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (shouldSwitch) {\n\t\t\trows[i].parentNode.insertBefore(rows[i + 1], rows[i]);\n\t\t\tswitching = true;\n\t\t}\n\t}\n\tsortText(num);\n}", "function sortRecords() {\r\n let rows, switching, i, x, y, shouldSwitch;\r\n switching = true\r\n while (switching) {\r\n switching = false;\r\n rows = recordTable.rows;\r\n for (i = 0; i < (rows.length - 1); i++) {\r\n shouldSwitch = false;\r\n x = rows[i].getElementsByTagName(\"td\")[0];\r\n y = rows[i + 1].getElementsByTagName(\"td\")[0];\r\n if (x.textContent > y.textContent) {\r\n shouldSwitch = true;\r\n break;\r\n }\r\n }\r\n if (shouldSwitch) {\r\n rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);\r\n switching = true;\r\n }\r\n }\r\n}", "function return_table_columns(table_type){\n var tmp_table = []\n\n if(table_type == \"Season\"){\n for(var i = 0; i < table_columns.length; i++) {\n var column = table_columns[i];\n\n if(column.title != \"Game.ID\" && column.title != \"Date\" && column.title != \"Opponent\"\n && column.title!=\"Venue\"){\n tmp_table.push(column);\n }\n }\n }else if(table_type == \"Cumulative\"){\n for(var i = 0; i < table_columns.length; i++) {\n var column = table_columns[i];\n\n if(column.title!=\"Game.ID\" && column.title!=\"Date\" && column.title!=\"Opponent\"\n && column.title!=\"Season\" && column.title!=\"Venue\"){\n tmp_table.push(column);\n }\n }\n }else if(table_type == \"Game\"){\n for(var i = 0; i < table_columns.length; i++) {\n var column = table_columns[i];\n\n if(column.title!=\"GP\"){\n tmp_table.push(column);\n }\n }\n }\n return tmp_table\n }", "function prepareForSort() {\r\n\tvar node = this;\r\n\twhile (node.nodeName.toLowerCase() != 'table') node = node.parentNode;\r\n\tvar eid = Number(node.id.split(\"episode\")[1].split(\"files\")[0]);\r\n\tvar episode = episodes[eid];\r\n\tif (!episode) return;\r\n\tvar tBody = node.tBodies[0];\r\n\tfor (var i = 0; i < tBody.rows.length; i++) {\r\n\t\tvar row = tBody.rows[i];\r\n\t\tif (row.id.indexOf('_relftHolder') < 0) continue; //not interested\r\n\t\tvar fid = Number(row.id.split('_')[1]);\r\n\t\tvar parentRow = document.getElementById('fid_'+fid);\r\n\t\tif (!parentRow) { if (seeDebug) alert('Error while preparing for sort at fid: '+fid); continue; }\r\n\t\trow.parentNode.removeChild(row);\r\n\t\tvar cell = getElementsByClassName(parentRow.getElementsByTagName('td'),'file expand',true)[0];\r\n\t\tif (cell) {\r\n\t\t\tvar span = cell.getElementsByTagName('span')[0];\r\n\t\t\tif (span && span.className.indexOf('i_minus') >= 0) span.className = span.className.replace('i_minus','i_plus');\r\n\t\t}\r\n\t}\r\n\tsortcol(this);\r\n}", "function sortByProcName(a, b) {//sort by name(display_as) ascending only\n\t\tif (a.DISPLAY_AS.toUpperCase() > b.DISPLAY_AS.toUpperCase()) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (a.DISPLAY_AS.toUpperCase() < b.DISPLAY_AS.toUpperCase()) {\n\t\t\treturn -1;\n\t\t}\n\t\treturn 0;\n\t}", "function addAllColumnHeaders(arr, table) {\n var columnSet = [];\n var _tr = tr.cloneNode(false);\n\n for (var i = 0, l = arr.length; i < l; i++) {\n for (var key in arr[i]) {\n if (arr[i].hasOwnProperty(key) && columnSet.indexOf(key) === -1) {\n columnSet.push(key);\n\n var _th = th.cloneNode(false);\n\n _th.appendChild(document.createTextNode(key));\n _tr.appendChild(_th);\n }\n }\n }\n table.appendChild(_tr);\n return columnSet;\n }", "_sortRows(colId, dir) {\n this.rows.sort((a, b) => {\n const sign = dir === 'asc' ? 1 : -1;\n if (a[colId] < b[colId]) {\n return -1 * sign;\n }\n if (a[colId] > b[colId]) {\n return sign;\n }\n return 0;\n });\n }", "makeColumns(columns) {\n let cols = [];\n columns.forEach((name, index)=>{\n let colmap = {};\n colmap.field = name;\n colmap.title = name;\n colmap.sortable = true;\n if (name.match('plateifu|mangaid')) {\n colmap.formatter = this.linkformatter;\n }\n cols.push(colmap);\n });\n return cols;\n }", "function sorte ( i ){\n return function(){\n if(scope.sorting.obj){\n //var index = _.findIndex(scope.viewer, scope.sorting.obj);\n }\n var key = scope.headers[i].field;\n if(scope.sorting.field === key){\n scope.sorting.direction = scope.sorting.direction * -1;\n }else{\n scope.sorting.field = key;\n scope.sorting.direction = 1;\n }\n sorter(key,scope.sorting.direction);\n scope.sorting.obj = scope.headers[i];\n scope.buildTable();\n\n };\n }", "function sorte ( i ){\n return function(){\n if(scope.sorting.obj){\n //var index = _.findIndex(scope.viewer, scope.sorting.obj);\n }\n var key = scope.headers[i].field;\n if(scope.sorting.field === key){\n scope.sorting.direction = scope.sorting.direction * -1;\n }else{\n scope.sorting.field = key;\n scope.sorting.direction = 1;\n }\n sorter(key,scope.sorting.direction);\n scope.sorting.obj = scope.headers[i];\n scope.buildTable();\n\n };\n }" ]
[ "0.6177032", "0.60958934", "0.59636444", "0.59164596", "0.5854542", "0.5831138", "0.58213437", "0.57851994", "0.569424", "0.5690779", "0.56834596", "0.56746453", "0.5655727", "0.56286114", "0.5617816", "0.55980444", "0.55895203", "0.55857456", "0.55586255", "0.55270123", "0.5494361", "0.54911083", "0.5487449", "0.5474914", "0.5471253", "0.54086876", "0.54071164", "0.5406096", "0.5388818", "0.53870386", "0.538536", "0.5383708", "0.5381661", "0.5363611", "0.53512716", "0.53397894", "0.5323213", "0.52819103", "0.5279808", "0.52724165", "0.5256113", "0.5236623", "0.5221055", "0.5193218", "0.51896614", "0.51805633", "0.517968", "0.5160126", "0.5157512", "0.5150955", "0.51483893", "0.51462036", "0.5136589", "0.5134126", "0.51314324", "0.51304436", "0.51288354", "0.5110511", "0.50899965", "0.50872236", "0.50768566", "0.5067302", "0.50669986", "0.50669676", "0.50626147", "0.5053484", "0.5053464", "0.5051226", "0.5038969", "0.5036143", "0.5033876", "0.5023809", "0.50202984", "0.5016178", "0.5014795", "0.5011348", "0.5007221", "0.50057745", "0.5005265", "0.50017184", "0.4996675", "0.49926344", "0.49844256", "0.49787915", "0.49750832", "0.49707618", "0.49706593", "0.49706593", "0.49696425", "0.49654466", "0.4958336", "0.4956413", "0.49529088", "0.49527988", "0.4940901", "0.49371108", "0.4935964", "0.4930497", "0.49270812", "0.49270812" ]
0.73409885
0
Guardar y validar nombre
function nombreValid(nombre){ do { nombre = prompt("Ingrese su nombre"); if(nombre.trim() == ""){ alert("Ingrese datos validos"); }else{return localStorage.setItem("nombre", nombre);} } while (nombre=="" || nombre!==undefined); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validarNombre (nombre) {\n if(nombre.length === 0){\n return 'Este campo no debe estar vacío';\n }\n\n if (!/^[a-z]+$/i.test(nombre)) {\n return 'Este campo puede contener únicamente letras'\n }\n\n if(nombre.length >= 50){\n return 'Este campo debe tener menos de 50 caracteres';\n }\n\n return '';\n\n}", "function validaNombre(nombre){\n var nombre1 = nombre.value; //asigno el valor de la variable nombre a una nueva variable\n var primeraLetra = nombre1.charAt(0); //asigno el valor de la primera letra a una variable nueva\n var patron=/[A-Z]/g; //se crea un patron\n \n if( nombre1==''||primeraLetra.match(patron)==null)//si el nombre esta vacio o no se encuentra una coincidencia de la primera letra con el patron devuelve el mensaje con setCustomValidity\n {\n nombre.setCustomValidity(\"Tiene que iniciar con mayuscula\");\n return false;\n }\n nombre.setCustomValidity(''); //se resetea el setCustomValidity en caso de haber ocurrido alguna ocurrencia en el if\n}", "function nombre(){\n\t\tvar nombre = $('#name').val();\n\t\tif (nombre === null || nombre.length === 0){\n\t\t\t$('.name-container').append('<span>¡Error! El campo nombre no debe estar vacío</span>'); //llamo a la clase del contenedor y le paso el span con el texto\n\t\t\treturn false;\n\t\t}else if(nombre.substring(0,1) !== nombre.substring(0,1).toUpperCase()){\n\t\t\t$('.name-container').append('<span>¡Error! El primer caracter del campo nombre debe ser mayúscula</span>');\n\t\t\treturn false;\n\t\t}else if( /[0-9]/.test(nombre)){ \n\t\t\t$('.name-container').append('<span>¡Error! Sólo debe ingresar letras en el campo nombre</span>');\n\t\t\treturn false;\n\t\t}else{\n\t\t\treturn true;\n\t\t}\n\t}", "function validateName(nombre) {\r\n\t\r\n\tvar error = \"\";\r\n\t// var illegalChars = /\\W/; // permite letras, números y guiones bajos\r\n\tif (nombre.value == \"\" || nombre.value == null || (/^\\s+$/.test(nombre.value))) {\r\n\t\tnombre.style.background = 'red';\r\n\t\terror=\"La caja para nombre no contiene nada...\\n\";\r\n\t\tnombre.focus();\r\n\t}else if ((nombre.length < 3) || (nombre.length > 30)) {\r\n\t\tnombre.style.background = 'red';\r\n\t\terror = \"El nombre tiene una longitud incorrecta...\\n\";\r\n\t\tnombre.focus();\r\n\t}else {\r\n\t\t\tnombre.style.background = 'White';\r\n\t\t}\r\n\t// } else if (illegalChars.test(nombre.value)) {\r\n\t// \tnombre.style.background = 'red';\r\n\t// \terror = \"El nombre ingresado contiene caracteres ilegales.\\n\";\r\n\t// \tnombre.focus();\r\n\t// } \r\n\treturn error;\r\n}", "function afficherNom() {\n return isValidNom(nom.value);\n}", "function isValidNombre(formname){\n \n var varNombre = document.forms[formname][\"nombre\"].value;\n \n if(varNombre.length == 0){\n var x= document.getElementById(\"nombre\");\n x.innerHTML=\"Campo vacio\";\n return false;\n }\n \n var x= document.getElementById(\"nombre\");\n if(/^[a-zA-Z ]{2,40}$/.test(varNombre) == false){ //palabara compuesta de letras del alfabeto de 2 a 40 carácteres\n x.innerHTML=\"Error: nombre inválido solamente se aceptan carácteres del alfabeto. Longitud 2-40 carácteres.\";\n return false; \n }\n x.innerHTML=\"\";\n varNombre= varNombre.trim();\n varNombre= varNombre.replace(/\\s+/g, ' '); //una vez que hemos eliminado los espacios en blanco sobrantes actualizamos el input\n document.forms[formname][\"nombre\"].value= varNombre;\n return true;\n}", "function validarNombre() {\n\n var nombre = document.getElementById(\"nombre\").value;\n var txtNombre = document.getElementById(\"nombre\");\n\n //Test campo obligatorio\n if (nombre == null || nombre.length == 0 || /^\\s+$/.test(nombre)) {\n alert('ERROR: El campo nombre no debe ir vacío o lleno de solamente espacios en blanco');\n txtNombre.classList.add('error');\n } else {\n txtNombre.classList.remove('error');\n }\n}", "function validarNombre() {\n // expresion regular que nos comprobara si el nombre solo tiene caracteras y un tamaño de 3 a 20.\n var exp = /[A-Za-z ]{3,20}$/g;\n if (exp.test(document.getElementById(\"nombre\").value))\n\t{\n // Si lo tecleado cumple el patron, retornaremos true\n document.getElementById(\"nombre\").className=\"\";\n document.getElementById(\"errores\").innerHTML = \"\";\n return true;\n\t}\n else {\n // si el patron es incorrecto retorna false, focaliza el campo y muestra un error.\n document.getElementById(\"nombre\").value = \"error!\";\n document.getElementById(\"nombre\").focus();\n document.getElementById(\"nombre\").className=\"error\";\n document.getElementById(\"errores\").innerHTML = \"Error en el campo nombre. <br/> Tiene que tener una longitud de 3 a 20 caracteres y solo incluir letras.\";\n return false;\n }\n}", "function validarNombre(pNombre) {\n //Si bien no es solicitado, utilizamos un largo minimo superior a un caracter\n return pNombre.trim().length > 1;\n}", "function validateNameInNewTramite( cadena ) {\n var patron = /^[a-zñA-ZÑ\\s]*$/;\n if(cadena.search(patron))\n {\n vm.name = cadena.substring(0, cadena.length-1);\n }\n }", "set name(nuevoNombrecito) {\n // Evitar nombres al ser llamado / Condicional => Validar que no puedan cambiar el nombre.\n if (nuevoNombrecito === \"Curso Malito de Programación Básica\") {\n console.error(\"Web... no!\");\n } else {\n this._name = nuevoNombrecito;\n }\n }", "function validanombreEmpresa(){\r\n\t\tvar nombreem = document.getElementById('nombreempresa');\r\n\t\tlimpiarError(nombreem);\r\n\t\tif (nombreem.value ==''){\r\n\t\t\talert ('Completa el campo nombre');\r\n\t\t\terror(nombreem);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse if(!isNaN(nombreem.value)){\r\n\t\t\talert('Formato del nombre debe ser letras');\r\n\t\t\terror(nombreem);\r\n\t\t\treturn false;\t\r\n\t\t}return true\r\n\t}", "function check_nombre() {\n\t\n\t\tvar username_length = $(\"#idnombre\").val().length;\n\t\t\n\t\tif(username_length < 5 || username_length > 20) {\n\t\t\t$(\"#errornombre\").html(\" Debe tener entre 10 y 40 caracteres \");\n\t\t\t$(\"#errornombre\").show();\n\t\t\terror_username = true;\n\t\t} else {\n\t\t\t$(\"#errornombre\").hide();\n\t\t}\n\t\n\t}", "processFullName() {\n if (this.fullName.value.length < 2) {\n this.fullName.err = true\n this.fullName.errMsg = 'نام نمی تواند کمتر از 3 حرف باشد'\n this.valid = false\n } else if (isLetter(this.fullName)) {\n this.valid = false\n } else {\n this.fullName.err = false\n }\n\n\n }", "function regExpLastName() {\n // Récupération des données saisies\n const lastNameValid = contact.lastName;\n // Injection du HTML\n const checklastName = document.querySelector(\"#lastNameErrorMsg\");\n\n // Indication de la bonne saisie ou l'erreur dans le HTML\n if (/^([A-Za-z]{3,20})?([-]{0,1})?([A-Za-z]{3,20})$/.test(lastNameValid)) {\n checklastName.innerHTML = \"<i class='fas fa-check-circle form'></i>\";\n return true;\n } else {\n checklastName.innerHTML = \"<i class='fas fa-times-circle form'></i> format incorrect\";\n }\n }", "function validarNombre(dato){\n if (dato.trim() == null || (dato.trim().length < 3 || dato.trim().length > 80)) {\n alert(\"El nombre y el apellido deben contener entre 3 y 80 caracteres\");\n return false;\n } \n return true;\n}", "validateBankerName() {\n let bankerName = this.loby.bankerName;\n bankerName = bankerName.trim();\n let error = false;\n let message = '';\n\n if (bankerName) {\n if (bankerName.length < 3) {\n error = true;\n message = \"El nombre es demasiado corto\";\n }\n } else {\n error = true;\n message = \"Este campo es obligatorio\";\n }\n\n this.loby.bankerNameState.hasError = error;\n this.loby.bankerNameState.message = message;\n }", "function lastNameValidator() {\n const divParent = lastName.parentNode\n if (lastName.value.length < 2) { // Minimum de 2 caractères\n divParent.setAttribute('data-error-visible', 'true')\n divParent.setAttribute('data-error', 'Vous devez entrer votre nom')\n return false\n } else {\n divParent.setAttribute('data-error-visible', 'false')\n return true\n }\n}", "function isValidName(nome) {\n return nome.trim() !== '' && nome.trim().length > 3\n}", "function validarNombre(fr_nombre) {\n\t\tvar expresionRegularNombreUsuario = /^[a-zA-Zà-ú]{1,32}$/;\n\t\tif( !(expresionRegularNombreUsuario.test(fr_nombre)) ) {\n\t\t\treturn false;\n \t} else {\n \t\treturn true;\n\t\t}\n}", "function validarNombre() {\r\n var result = true;\r\n var nombre = document.getElementById('nombre');\r\n\r\n if (nombre.value == '') {\r\n result = false;\r\n nombre.className = 'error';\r\n nombre.focus();\r\n document.getElementById('errores').innerHTML = 'El nombre no puede estar en blanco';\r\n } else {\r\n if (nombre.value.length < 3) {\r\n result = false;\r\n nombre.className = 'error';\r\n nombre.focus();\r\n document.getElementById('errores').innerHTML = 'El nombre es demasiado corto';\r\n } else {\r\n nombre.className = '';\r\n document.getElementById('errores').innerHTML = '';\r\n }\r\n }\r\n return result;\r\n}", "function checkName() {\n let name = document.querySelector('.nameField').value;\n let texte = document.querySelector('.texte');\n \n if ((name.length == 0) || (name.length > 10) ) {\n window.alert(\"Saisie incorrecte\");\n } else {\n console.log(name);\n texte.innerHTML = '';\n var h2 = document.createElement(\"h2\");\n h2.innerHTML = \"Bonjour \" + name;\n texte.appendChild(h2);\n }\n}", "function validateName(fields, data, errors) {\n var re = /^[a-zA-Záéíóäëiöúàèììù_ ]{2,}$/;\n if (!(re.test(data[\"nom\"].value)) || !(re.test(data[\"prenom\"].value))) {\n errors.push(\"Les noms et prénoms doivent contenir uniquement des\" +\n \" lettres, espaces, tirets et au minimum 2 caractères.\");\n }\n}", "function nameValidate() {\r\n const nameRegex = /^([A-Z][a-z]{2,9})(\\s?[a-zA-Z]{3,10})?$/;\r\n wrongInp.classList.replace(\"d-block\", \"d-none\");\r\n rightInp.classList.replace(\"d-block\", \"d-none\");\r\n\r\n if (nameRegex.test(suNameInput.value) == true && suNameInput.value != \"\") {\r\n suNameInput.classList.add(\"is-valid\");\r\n suNameInput.classList.remove(\"is-invalid\");\r\n suNameAlert.classList.replace(\"d-block\", \"d-none\");\r\n return true;\r\n } else {\r\n suNameInput.classList.add(\"is-invalid\");\r\n suNameInput.classList.remove(\"is-valid\");\r\n suNameAlert.classList.replace(\"d-none\", \"d-block\");\r\n return false;\r\n }\r\n }", "validarCadena(propiedad, valor){ //validación para strings \n //recibirá la propiedad a evaluar (id, titulo...) y el valor\n if(!valor) return console.warn(`${propiedad} \"${valor}\" está vacío`)\n if(typeof valor !== \"string\") return console.error(`${propiedad} \"${valor}\" NO es un texto`)\n \n return true //si ninguna validación se ha activado, devulve un true\n }", "function firstNameValidator() {\n const divParent = firstName.parentNode\n if (firstName.value.length < 2) { // Minimum de 2 caractères\n divParent.setAttribute('data-error-visible', 'true')\n divParent.setAttribute('data-error', 'Vous devez entrer votre prénom')\n return false\n } else {\n divParent.setAttribute('data-error-visible', 'false')\n return true\n }\n}", "function validoEntrada(apellido, dni, nombre){\r\n if(dni && apellido){\r\n //expresion regular para comprobar que lo ingresado corresponda a una cadena\r\n let cad = new RegExp(\"^[A-Za-z]+$\");\r\n if(!cad.test(apellido) || (nombre && !cad.test(nombre))){\r\n return false;\r\n }\r\n\r\n let dniString = dni.toString();\r\n //me aseguro que el dni no tenga mas de 10 caracteres.\r\n if(dniString.length > 10){\r\n return false;\r\n }\r\n \r\n return true;\r\n }\r\n else\r\n return false;\r\n}", "function checkName() {\n vmAddPermission.formData.role = bzUtilsSvc.textToSlug(vmAddPermission.formData.role);\n }", "function validarTamNome(nome){\r\n\tif (nome.value.length >= 4){\r\n\t\treturn true;\r\n\t}else{\t\t\r\n return alert(\"Informe ao menos 4 caracteres\");\r\n\t}\r\n}", "function validar(){\n\tvar valNom = valNombre(); \n\tvar valApe = valApellido();\n\tvar valTel = valNumero();\n\tvar valMayor = valEdad();\n\tvar email = valEmail();\n\tvar ident = identificador();\n}", "function checkFirstname(firstname) {\n\n if (!firstname.match(nameReg)) {\n firstnameError.textContent = 'Le champ ne doit pas contenir de chiffres ou de caractères spéciaux et contenir au moins 2 caractères.';\n formSub.firstname.classList.add('invalid');\n firstnameValid = false;\n } else {\n firstnameError.textContent = '';\n formSub.firstname.classList.remove('invalid');\n formSub.firstname.classList.add('valid');\n firstnameValid = true;\n }\n}", "function ValidateRisultatiAutore() {\n\tvar value = document.getElementsByName('first_name')[0].value;\n\tif (!/^\\s*$/.test(value)) {\n\t\treturn true;\n\t}\n\tvalue = document.getElementsByName('last_name')[0].value;\n\tif (!/^\\s*$/.test(value)) {\n\t\treturn true;\n\t}\n\n\talert(\"Devi inserire almeno il nome o il cognome dell'autore che vuoi cercare\");\n\treturn false; \n}", "function validateFirstName (){\r\n var nameExpression = /^([A-ZÁÉÍÓÚ]{1}[a-zñáéíóú]+[\\s]*)+$/;\r\n if(form.clientName.value == \"\" && document.getElementById(\"clientNameSpanWhiteSpace\") == null){\r\n var span = document.createElement(\"span\");\r\n span.setAttribute(\"id\",\"clientNameSpanWhiteSpace\");\r\n span.setAttribute(\"class\",\"spanErrors\");\r\n span.innerHTML=\"Nombre incompleto\";\r\n $(\"#clientNameLabel\").appendChild(span);\r\n validated = false;\r\n }else if(!nameExpression.test(form.clientName.value)){\r\n form.clientName.classList.add(\"error\");\r\n form.clientName.focus();\r\n validated = false;\r\n if(document.getElementById(\"clientNameSpan\") == null && document.getElementById(\"clientNameSpanWhiteSpace\") == null){\r\n var span = document.createElement(\"span\");\r\n span.setAttribute(\"id\",\"clientNameSpan\");\r\n span.setAttribute(\"class\",\"spanErrors\");\r\n span.innerHTML=\"Nombre incorrecto\";\r\n $(\"#clientNameLabel\").appendChild(span);\r\n }\r\n } else {\r\n validated = true;\r\n }\r\n return validated;\r\n}", "validateName() {\n const name = this.state.newName;\n return !NewRecipe.validInput(name) || name.length > 80 ? 'error' : null;\n }", "function validateName () {\n let username = nameInput.value;\n\n if (username.length > 0) {\n isValid(nameInput);\n isNameValid = true;\n } else {\n isInvalid(nameInput);\n isNameValid = false;\n }\n}", "processUsername() {\n let regex = new RegExp('^[A-Za-z0-9_-]*$')\n\n if (this.username.value === '') {\n\n this.username.err = true\n this.usernameErr.seen = true\n this.usernameErr.text = \"نام کاربری نمی تواند خالی باشد\"\n this.valid = false\n\n } else if (!regex.test(this.username.value)) {\n this.username.err = true\n this.usernameErr.seen = true\n this.usernameErr.text = \"کاراکتر غیر مجاز\"\n this.valid = false\n } else {\n // resetting the styles to no error\n this.username.err = false\n this.usernameErr.seen = false\n }\n }", "function nameValidator() {\n const nameValue = nameInput.value;\n const validName = /.+/.test(nameValue); \n return validName;\n}", "function checkName(element) {\n var value = element.value.trim();\n if ( validator.isEmpty(value) ) {\n element.setCustomValidity('This is a required field, please fill it.');\n } else if ( !validator.isOfLength(value, 2) ) {\n element.setCustomValidity('The length of the name must be at least two characters long.');\n } else if ( !validator.isCharacterSet(value, charSetsLatin) && !validator.isCharacterSet(value, charSetsCyr) ) {\n element.setCustomValidity('Wrong characters! Use english and serbian latin, or serbian cyrillic.');\n } else {\n element.setCustomValidity('');\n }\n }", "function checkName() {\n vmEditPermission.formData.role = bzUtilsSvc.textToSlug(vmEditPermission.formData.role);\n }", "function validaCampoVacio(Nombre, _G_ID_) {\n /* Es de tipo select */\n if ($(_G_ID_ + '_txt_' + Nombre).is('select')) {\n if ($(_G_ID_ + '_txt_' + Nombre).val() == -1) {\n redLabel_Space(Nombre, 'Este campo es obligatorio', _G_ID_);\n ShowAlertM(_G_ID_, null, null, true);\n return false;\n } else {\n return true;\n }\n } else /* de tipo input*/\n if ($(_G_ID_ + '_txt_' + Nombre).is('input')) {\n if ($(_G_ID_ + '_txt_' + Nombre).val() == '') {\n redLabel_Space(Nombre, 'Este campo es obligatorio', _G_ID_);\n ShowAlertM(_G_ID_, null, null, true);\n return false;\n } else {\n return true;\n }\n }\n}", "somenteletras(input) {\n\n let re = /^[A-Za-z]+$/;\n\n let inputValue = input.value;\n\n let mensagem_error = `Este campo não aceita números nem caracteres especiais`;\n\n if (!re.test(inputValue)) {\n this.imprimirMensagem(input, mensagem_error);\n }\n\n }", "function controleprenom(){\n\n\n //controling the validation of the prenom\n const Prénom = formValues.Prénom;\n //console.log(nom);\n if(regexNomPrenom(Prénom)){\n document.querySelector(\"#prenom_manque\").textContent = \"\";\n \n return true;\n }else{\n document.querySelector(\"#prenom_manque\").textContent = \"Veuillez correctement replir ce champ\";\n alert(textAlert(Prénom));\n return false;\n }\n \n }", "function checkValidLastName() {\n let validDiv = '#validLastName'\n const lastName = $('#validationCustom02').val()\n let input = document.getElementById('validationCustom02')\n let invalidDiv = '#invalidLastName'\n let regPattern = /^(?=.{1,50}$)[a-zZäöåÄÖÅ]+(?:['_.\\s][a-zZäöåÄÖÅ]+)*$/i\n\n if (lastName.trim() == '') {\n $(validDiv).hide()\n $(invalidDiv).text('Efternamn krävs')\n $(validDiv).text('')\n $(invalidDiv).show()\n $(input).addClass('is-invalid').removeClass('is-valid')\n\n return false\n } else if (!regPattern.test(lastName)) {\n $(validDiv).hide()\n $(invalidDiv).css('color', 'red')\n $(invalidDiv).text('Ogiltig! Endast karaktärer tack')\n $(validDiv).text('')\n $(invalidDiv).show()\n $(input).addClass('is-invalid').removeClass('is-valid')\n return false\n } else {\n $(invalidDiv).hide()\n $(validDiv).text('Giltig')\n $(validDiv).show()\n $(input).removeClass('is-invalid').addClass('is-valid')\n return true\n }\n}", "function validarCampos () {\n\tif (!vacio($(\"#titulo\").val(), $(\"#titulo\").attr(\"placeholder\"))) {\n\t\tsave();\n\t}\n}", "function checknom(){\n var nom = document.forms[\"formulaire_contact\"][\"lname\"].value;\n if (nom.trim() == \"\") {\n document.getElementById(\"lnameHelp\").innerHTML = \"Attention, vous avez oublié de saisir votre nom!\";\n document.getElementById(\"lname\").focus();\n return false;\n }else {\n var filtrenom = new RegExp(\"^[A-Za-zéêè' -]+$\");\n var resultatnom = filtrenom.test(nom);\n if (resultatnom == false){\n document.getElementById(\"lnameHelp\").innerHTML = \"Saisie invalide! Vérifiez votre saisie!\";\n return false;\n }else {\n document.getElementById(\"lnameHelp\").innerHTML = '<span class=\"text-success\">Nom OK!</span>';\n return true;\n }\n }\n}", "function validForm() {\n\n //recuperer le formulaire\n let form=document.querySelector('form')\n\n //Ecouter le champ pour le prenom\n form.firstName.addEventListener('change' , function(){\n validFirstName(this)\n })\n\n //creation de la fonction pour valider la valeur du champ\n let validFirstName=function(inputFirstName) {\n //creation de la regexp\n let firstNameRegexp=new RegExp(`^[a-zA-Z]+[a-zA-Z]+[a-zA-Z0-9]+[\\ \\s\\:\\,\\''\\-\\é\\è\\î]*$`);\n\n //recuperation de la balise small\n let small=inputFirstName.nextElementSibling;\n\n let testFirstName=firstNameRegexp.test(inputFirstName.value);\n\n if(testFirstName){\n small.textContent='Prenom valide'\n small.classList.remove('noValid');\n small.classList.add('valid');\n return true;\n }else{\n small.textContent='Prenom invalide'\n small.classList.remove('valid');\n small.classList.add('noValid');\n return false;\n }\n }//fin*****************************************\n\n\n //ecouter le champ pour le nom\n form.secondName.addEventListener('change' , function(){\n validSecondName(this)\n })\n\n let validSecondName=function(inputSecondName) {\n //creation de la regexp\n let secondNameRegexp=new RegExp(`^[a-zA-Z]+[a-zA-Z]+[a-zA-Z0-9]+[\\ \\s\\:\\,\\''\\-\\é\\è\\î]*$`)\n \n //recuperation de la balise small\n let small=inputSecondName.nextElementSibling;\n\n let testSecondName=secondNameRegexp.test(inputSecondName.value);\n\n if(testSecondName){\n small.textContent='Nom valide'\n small.classList.remove('noValid');\n small.classList.add('valid');\n return true;\n }else{\n small.textContent='Nom invalide'\n small.classList.remove('valid');\n small.classList.add('noValid');\n return false;\n }\n\n }//fin******************************\n\n\n //ecouter le champ pour l'email\n form.email.addEventListener('change' , function(){\n validEmail(this)\n })\n\n let validEmail=function(inputEmail) {\n //creation de la regexp\n let EmailRegexp=new RegExp('^[a-zA-Z0-9.-_]+[@]{1}[a-zA-Z0-9.-_]+[.]{1}[a-z]{2,10}$','g')\n \n //recuperation de la balise small\n let small=inputEmail.nextElementSibling;\n\n let testEmail=EmailRegexp.test(inputEmail.value);\n\n if(testEmail){\n small.textContent='Email valide'\n small.classList.remove('noValid');\n small.classList.add('valid');\n return true;\n }else{\n small.textContent='Email invalide'\n small.classList.remove('valid');\n small.classList.add('noValid');\n return false;\n }\n }//fin*************************************\n\n \n //ecouter le champ pour la ville\n form.city.addEventListener('change' , function(){\n validCity(this)\n })\n\n let validCity=function(inputCity) {\n //creation de la regexp\n let cityRegexp=new RegExp(`^[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[\\ \\s\\:\\,\\''\\-\\é\\è\\î]*$`)\n \n //recuperation de la balise small\n let small=inputCity.nextElementSibling;\n\n let testCity=cityRegexp.test(inputCity.value);\n\n if(testCity){\n small.textContent=`ville valide`\n small.classList.remove('noValid');\n small.classList.add('valid');\n return true;\n }else{\n small.textContent=`${inputCity.value} n'est pas une ville`\n small.classList.remove('valid');\n small.classList.add('noValid');\n return false;\n }\n }//fin*******************\n\n\n //ecouter le champ pour l'adresse\n form.adresse.addEventListener('change' , function(){\n validAdresse(this)\n })\n\n let validAdresse=function(inputAdresse) {\n let adresseRegexp=new RegExp(`^[a-zA-Z0-9]+[a-zA-Z0-9]+[a-zA-Z0-9]+[\\ \\s\\:\\,\\''\\-\\é\\è\\î]*$`)\n //recuperation de la balise small\n let small=inputAdresse.nextElementSibling;\n\n let testAdresse=adresseRegexp.test(inputAdresse.value);\n \n if(testAdresse){\n small.textContent=`adresse valide`\n small.classList.remove('noValid');\n small.classList.add('valid');\n return true\n }else{\n small.textContent=`${inputAdresse.value} n'est pas une adresse`\n small.classList.remove('valid');\n small.classList.add('noValid');\n return false;\n }\n }//fin********************** \n\n\n //ecouter le bouton submit\n form.addEventListener('submit' , function (e) {\n e.preventDefault();\n \n //verifier si les valeurs entrees dans les champs sont correctes\n if( validFirstName(form.firstName)&&validSecondName(form.secondName)&&\n validEmail(form.email)&&validCity(form.city)&&validAdresse(form.adresse)){\n //creation d'un objet contact qui regroupe les differentes valeur du formulaire \n let contact={\n firstName:form.firstName.value,\n lastName:form.secondName.value,\n address:form.adresse.value,\n city:form.city.value,\n email:form.email.value,\n } \n\n //recuperation des produits dans le panier\n productAdded=localStorage.getItem('productAdded');\n productAdded=JSON.parse(productAdded);\n\n //tranferer les produits sous un autre nom dans le localStorage pour recuperer une commande \n localStorage.setItem('LastCommande' , JSON.stringify(productAdded))\n\n //recuperer l'id de item price qui correspond au nom du produit\n //dans le localStorage\n let articles=document.querySelectorAll('.item-price');\n products=[];\n for(article of articles){\n //verifier si l'id des articles de trouve dans le localStorage\n if(article.id in productAdded){\n //mettre l'id des produits dans un tableau product\n products.push(productAdded[article.id]._id);\n }\n }\n \n //mettre les id et contact dans un obket aEnvoyer\n let aEnvoyer={\n contact : contact,\n products : products,\n }\n aEnvoyer=JSON.stringify(aEnvoyer)\n\n //creation d'une promesse pour envoyer l'objet aenvoyer dans le serveur\n const promise=fetch(\"http://localhost:3000/api/cameras/order\",{\n method:'POST',\n body:aEnvoyer,\n headers:{\n 'Content-Type':'application/json',\n } \n })\n\n //recuperer la reponse du serveur dans le localStorage\n promise.then(async(response)=>{\n try{\n let contenu= await response.json();\n contenu=JSON.stringify(contenu)\n localStorage.setItem('response' , contenu)\n form.submit(); \n window.location.replace('commande_valide.html');\n localStorage.removeItem('productAdded')\n localStorage.removeItem('quantity') \n }catch(e){\n console.log('erreur' + e);\n }\n })\n\n }//*************fin de la condition */\n })//*********fin de l'ecoute sur le bouton */\n\n}", "function validarName() {\n var text = $('#nombre').val();\n var exprText = new RegExp(\"^[^A-Za-z\\s]+\");\n // if (text.search(exprText)==true)\n if ((text !==\"\")&&(text.search(exprText))) \n {\n $(\"#ErrorName\").text(\"\");\n return true;\n }\n else {\n $(\"#ErrorName\").text(\"Error. Nombre Invalido\");\n $(\"#ErrorName\").css('color','#d32e12');\n return false;\n }\n}", "function valida() /* OK */\r\n{\r\n //valido el nombre\r\n\tif ((document.index.user.value.length==0)||(document.index.user.value.length<4))\r\n\t {\r\n alert(\"Tiene que escribir su nombre o su nombre es demasiado corto!!!\")\r\n document.index.user.focus();\r\n return false;\r\n }\r\n\tif ((document.index.pass.value.length==0)||(document.index.pass.value.length<4))\r\n\t {\r\n alert(\"Tiene que escribir su contraseņa o su contraseņa no tiene la cantidad de caracteres requeridos!!!\")\r\n document.index.pass.focus();\r\n return false;\r\n }\r\n\t \r\n\t document.index.oper.value=\"V\";//Operacion Validar Usuario en BD\r\n\t //document.index.submit();\r\n\r\n}", "function validateName(name){\n if( name.value == null || name.value.length == 0 || /^\\s+$/.test(name.value) ) {\n document.querySelector('.name-error').style.display = \"inline\";\n return false;\n };\n document.querySelector('.name-error').style.display = \"none\";\n return true;\n}", "function checkLastname(lastname) {\n\n if (!lastname.match(nameReg)) {\n lastnameError.textContent = 'Le champ ne doit pas contenir de chiffres ou de caractères spéciaux et contenir au moins 2 caractères.';\n formSub.lastname.classList.add('invalid');\n lastnameValid = false;\n } else {\n lastnameError.textContent = '';\n formSub.lastname.classList.remove('invalid');\n formSub.lastname.classList.add('valid');\n lastnameValid = true;\n }\n}", "function validLastName() {\r\n\r\n var lastName = $lastName.val();\r\n\r\n if (lastName.length < 2 || lastName.length > 30) {\r\n $lastName.addClass('is-invalid');\r\n } else {\r\n $lastName.removeClass('is-invalid');\r\n }\r\n }", "function afficherPrenom() {\n return isValidPrenom(prenom.value);\n}", "function checkInput(tab) {\n \"use strict\";\n /*VARIABILI DI CONTROLLO*/\n var check_1 = false;\n var check_2 = false;\n var check_3 = false;\n var check_4 = false;\n /*POS = VARIABILE CHE TIENE IL RISULTATO DEL MATCH DELL'INPUT CON LA REGEX*/\n var pos = 0;\n /*SALVA SPAZIO*/\n var voidField = \"Non puoi lasciare vuoto questo campo\";\n var onlyLetter = \" deve contenere solo lettere\";\n if (tab === 0) {\n //NOME\n //SE VUOTO -> ERRORE\n if (nome.value === \"\") {\n //STAMPA MESSAGGIO D'ERRORE\n errorName.innerHTML = voidField;\n //IL CAMPO DIVENTA ROSSO (INVALIDO)\n nome.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_1 = false;\n } else {\n //L'INPUT MATCHA LA REGEX?\n pos = nome.value.search(/[^a-zA-Z|\\s|']/g);\n //SE SEARCH >= 0, L'INPUT IMMESSO NON E'CORRETTO\n if (pos >= 0) {\n //STAMPA MESSAGGIO D'ERRORE\n errorName.innerHTML = \"Il nome\" + onlyLetter;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n nome.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_1 = false;\n } else { //ALTRIMENTI OK\n //CANCELLA MESSAGGIO D'ERRORE\n errorName.innerHTML = \"\";\n //IL CAMPO DIVENTA VALIDO (VERDE)\n nome.className = \"valid\";\n //CONTROLLO -> VERO\n check_1 = true;\n }\n }\n //COGNOME\n //SE VUOTO -> ERRORE\n if (cognome.value === \"\") {\n //STAMPA MESSAGGIO D'ERRORE\n errorSurname.innerHTML = voidField;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n cognome.className = \"invalid\";\n check_2 = false;\n } else {\n //L'INPUT MATCHA LA REGEX?\n pos = cognome.value.search(/[^a-zA-Z|\\s|']/g);\n //SE SEARCH >= 0, L'INPUT IMMESSO NON E'CORRETTO\n if (pos >= 0) {\n //STAMPA MESSAGGIO D'ERRORE\n errorSurname.innerHTML = \"Il cognome\" + onlyLetter;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n cognome.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_2 = false;\n } else {\n //CANCELLA MESSAGGIO D'ERRORE\n errorSurname.innerHTML = \"\";\n //IL CAMPO DIVENTA VALIDO (VERDE)\n cognome.className = \"valid\";\n //CONTROLLO -> FALSO\n check_2 = true;\n }\n }\n //CODICE FISCALE\n //SE VUOTO -> ERRORE\n if (cf.value === \"\") {\n //STAMPA MESSAGGIO D'ERRORE\n errorCf.innerHTML = voidField;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n cf.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_3 = false;\n } else {\n //L'INPUT MATCHA LA REGEX?\n pos = cf.value.search(/^[A-Z]{6}\\d{2}[A-Z]{1}\\d{2}[A-Z]{1}\\d{3}[A-Z]$/);\n //SE SEARCH != 0, L'INPUT IMMESSO NON E'CORRETTO\n if (pos !== 0) {\n //STAMPA MESSAGGIO D'ERRORE\n errorCf.innerHTML = \"Codice Fiscale Errato\";\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n cf.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_3 = false;\n } else {\n //CANCELLA MESSAGGIO D'ERRORE\n errorCf.innerHTML = \"\";\n //IL CAMPO DIVENTA VALIDO (VERDE)\n cf.className = \"valid\";\n //CONTROLLO -> VERO\n check_3 = true;\n }\n }\n //DATA\n //SE VUOTA -> ERRORE\n if (data.value === \"\") {\n //STAMPA MESSAGGIO D'ERRORE\n errorData.innerHTML = voidField;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n data.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_4 = false;\n } else {\n var regs = data.value.match(/^(\\d{4})\\-(\\d{1,2})\\-(\\d{1,2})$/);\n //SE L'ANNO INSERITO SUPERA LE 4 CIFRE\n if(regs === null) {\n //STAMPA MESSAGGIO D'ERRORE\n errorData.innerHTML = \"Inserisci un anno compreso tra il 1900 ed il 2001\";\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n data.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_4 = false;\n } else if (regs[1] < 1900 || regs[1] > 2001) { //CONTROLLA SE L'ANNO E' COMPRESO TRA IL 1900 E IL 2001\n //STAMPA MESSAGGIO D'ERRORE\n errorData.innerHTML = \"Inserisci un anno compreso tra il 1900 ed il 2001\";\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n data.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_4 = false;\n } else {\n //CANCELLA MESSAGGIO D'ERRORE\n errorData.innerHTML = \"\";\n //IL CAMPO DIVENTA VALIDO (VERDE)\n data.className = \"valid\";\n //CONTROLLO -> VERO\n check_4 = true;\n }\n }\n //SE TUTTI I CAMPI SONO VALIDI RITORNA VERO\n if (check_1 && check_2 && check_3 && check_4) {\n return true;\n } else {\n return false;\n }\n }\n if (tab === 1) {\n //INDIRIZZO\n //SE VUOTO -> ERRORE\n if (indirizzo.value === \"\") {\n //STAMPA MESSAGGIO D'ERRORE\n errorAddress.innerHTML = voidField;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n indirizzo.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_1 = false;\n } else {\n //L'INPUT MATCHA LA REGEX?\n pos = indirizzo.value.search(/[^a-zA-Z|\\s|\\/.|,|']/g);\n //SE SEARCH >= 0, L'INPUT IMMESSO NON E'CORRETTO\n if (pos >= 0) {\n //STAMPA MESSAGGIO D'ERRORE\n errorAddress.innerHTML = \"L'indirizzo\" + onlyLetter;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n indirizzo.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_1 = false;\n } else {\n //CANCELLA MESSAGGIO D'ERRORE\n errorAddress.innerHTML = \"\";\n //IL CAMPO DIVENTA VALIDO (VERDE)\n indirizzo.className = \"valid\";\n //CONTROLLO -> VERO\n check_1 = true;\n }\n }\n //CIVICO\n //SE VUOTO -> ERRORE\n if (civico.value === \"\") {\n //STAMPA MESSAGGIO D'ERRORE\n errorCivico.innerHTML = voidField;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n civico.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_2 = false;\n } else {\n //L'INPUT MATCHA LA REGEX?\n pos = civico.value.search(/[0-9][\\\\]*[\\/]*[a-zA-Z]*/g);\n //SE SEARCH >= 0, L'INPUT IMMESSO NON E'CORRETTO\n if (pos !== 0) {\n //STAMPA MESSAGGIO D'ERRORE\n errorCivico.innerHTML = \"Il civico deve contenere solo numeri\";\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n civico.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_2 = false;\n } else {\n //CANCELLA MESSAGGIO D'ERRORE\n errorCivico.innerHTML = \"\";\n //IL CAMPO DIVENTA VALIDO (VERDE)\n civico.className = \"valid\";\n //CONTROLLO -> VERO\n check_2 = true;\n }\n }\n //COMUNE\n //SE VUOTO -> ERRORE\n if (paese.value === \"\") {\n errorPaese.innerHTML = voidField;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n paese.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_3 = false;\n } else {\n //L'INPUT MATCHA LA REGEX?\n pos = paese.value.search(/[^a-zA-Z\\s\\/.,']/g);\n //SE SEARCH >= 0, L'INPUT IMMESSO NON E'CORRETTO\n if (pos >= 0) {\n //STAMPA MESSAGGIO D'ERRORE\n errorPaese.innerHTML = \"Il campo\" + onlyLetter;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n paese.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_3 = false;\n } else {\n //CANCELLA MESSAGGIO D'ERRORE\n errorPaese.innerHTML = \"\";\n //IL CAMPO DIVENTA VALIDO (VERDE)\n paese.className = \"valid\";\n //CONTROLLO -> VERO\n check_3 = true;\n }\n }\n //PROVINCIA\n //SE VUOTO -> ERRORE\n if (provincia.value === \"\") {\n //STAMPA MESSAGGIO D'ERRORE\n errorProv.innerHTML = voidField;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n provincia.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_4 = false;\n } else {\n //L'INPUT MATCHA LA REGEX?\n pos = provincia.value.search(/[^a-zA-Z\\s\\/.,']/g);\n //SE SEARCH >= 0, L'INPUT IMMESSO NON E'CORRETTO\n if (pos >= 0) {\n //STAMPA MESSAGGIO D'ERRORE\n errorProv.innerHTML = \"Il campo\" + onlyLetter;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n provincia.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_4 = false;\n } else {\n //CANCELLA MESSAGGIO D'ERRORE\n errorProv.innerHTML = \"\";\n //IL CAMPO DIVENTA VALIDO (VERDE)\n provincia.className = \"valid\";\n //CONTROLLO -> VERO\n check_4 = true;\n }\n }\n //SE TUTTI I CAMPI SONO VALIDI RITORNA VERO\n if (check_1 && check_2 && check_3 && check_4) {\n return true;\n \n } else { //ALTRIMENTI C'E' UN ERRORE NELL'INPUT\n return false;\n }\n }\n if (tab === 2) {\n //TELEFONO\n //IL CAMPO PUO' ESSERE VUOTO\n //SE IMMESSO CONTROLLA CHE SIA VALIDO\n if (telefono.value !== \"\") {\n //L'INPUT MATCHA LA REGEX?\n pos = telefono.value.search(/[^0-9]/);\n //SE POS >= 0 L'INPUT IMMESSO E' ERRATO\n if (pos >= 0) {\n //STAMPA MESSAGGIO DI ERRORE\n errorTel.innerHTML = \"Inserisci un numero di telefono valido\";\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n telefono.className = \"valid\";\n //CONTROLLO -> FALSO\n check_1 = false;\n } else {\n //CANCELLA MESSAGGIO D'ERRORE\n errorTel.innerHTML = \"\";\n //IL CAMPO DIVENTA VALIDO (VERDE)\n telefono.className = \"valid\";\n //CONTROLLO -> VERO\n check_1 = true;\n }\n } else { //SE NON VIENE IMMESSO NESSUN NUMERO METTI CONTROLLO A VERO\n check_1 = true;\n }\n //CELLULARE\n //SE VUOTO -> ERRORE\n if (cellulare.value === \"\") {\n //STAMPA MESSAGGIO D'ERRORE\n errorCell.innerHTML = voidField;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n cellulare.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_2 = false;\n } else {\n //L'INPUT MATCHA LA REGEX?\n pos = cellulare.value.search(/[^0-9]/);\n //SE SEARCH >= 0, L'INPUT IMMESSO NON E'CORRETTO\n if (pos >= 0) {\n //STAMPA MESSAGGIO D'ERRORE\n errorCell.innerHTML = \"Inserisci un numero di cellulare valido\";\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n cellulare.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_2 = false;\n } else {\n //CANCELLA MESSAGGIO D'ERRORE\n errorCell.innerHTML = \"\";\n //IL CAMPO DIVENTA VALIDO (VERDE)\n cellulare.className = \"valid\";\n //CONTROLLO -> VERO\n check_2 = true;\n }\n }\n //EMAIL\n //SE VUOTO -> ERRORE\n if (email.value === \"\") {\n //STAMPA MESSAGGIO D'ERRORE\n errorEmail.innerHTML = voidField;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n email.className = \"invalid\";\n check_3 = false;\n } else {\n //L'INPUT MATCHA LA REGEX?\n pos = email.value.search(/^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\,.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/);\n //SE SEARCH >= 0, L'INPUT IMMESSO NON E'CORRETTO\n if (pos !== 0) {\n //STAMPA MESSAGGIO D'ERRORE\n errorEmail.innerHTML = \"Inserisci una email valida\";\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n email.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_3 = false;\n } else {\n //CANCELLA MESSAGGIO D'ERRORE\n errorEmail.innerHTML = \"\";\n //IL CAMPO DIVENTA VALIDO (VERDE)\n email.className = \"valid\";\n //CONTROLLO -> VERO\n check_3 = true;\n }\n }\n //SE TUTTI I CAMPI SONO VALIDI RITORNA VERO\n if (check_1 && check_2 && check_3) {\n return true;\n } else { //ALTRIMENTI C'E' UN ERRORE NELL'INPUT\n return false;\n }\n }\n if (tab === 3) {\n //USERNAME\n //SE VUOTO -> ERRORE\n if (regUsername.value === \"\") {\n //STAMPA MESSAGGIO D'ERRORE\n errorUser.innerHTML = voidField;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n regUsername.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_1 = false;\n } else { //CONTROLLA SE IL NOME UTENTE ESISTE\n var xmlhttp = new XMLHttpRequest();\n //ID DEL TIPO RICERCA PER \"liveSearch.php\"\n var queryId = \"&queryId=user\";\n xmlhttp.onreadystatechange = function () {\n //SE LA RICHIESTA E' STATA ELABORATA\n if (this.readyState === 4 && this.status === 200) {\n //SE IL NOME UTENTE E' GIA' PRESENTE RITORNA FALSO\n if (this.responseText === \"0\") {\n //STAMPA MESSAGGIO D'ERRORE\n errorUser.innerHTML = \"Questo nome utente non &egrave; disponibile\";\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n regUsername.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_1 = false;\n } else {\n //CANCELLA MESSAGGIO D'ERRORE\n errorUser.innerHTML = \"\";\n //IL CAMPO DIVENTA VALIDO (VERDE)\n regUsername.className = \"valid\";\n //CONTROLLO -> VERO\n check_1 = true;\n }\n }\n };\n //PREPARA LA RICHIESTA\n xmlhttp.open(\"GET\", \"../php/script/liveSearch.php?query=\" + regUsername.value + queryId, true);\n //INVIA\n xmlhttp.send();\n }\n //PASSWORD\n //SE VUOTO -> ERRORE\n if (regPassword.value === \"\") {\n //STAMPA MESSAGGIO D'ERRORE\n errorPwd.innerHTML = voidField;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n regPassword.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_2 = false;\n } else {\n //MESSAGGIO PASSWORD INVALIDA\n var invalidPwd = \"La password deve avere una lunghezza minima di 8, \\\n contenere almeno una lettera maiuscola, una minuscola, \\\n un numero e un carattere speciale\";\n //L'INPUT MATCHA LA REGEX?\n pos = regPassword.value.search(/(^(?=.*[a-z])|(?=.*[A-Z]))(?=.*\\d)(?=.*[^\\da-zA-Z]).{8,32}$/gm);\n //SE SEARCH >= 0, L'INPUT IMMESSO NON E'CORRETTO\n if (pos !== 0) {\n //STAMPA MESSAGGIO D'ERRORE\n errorPwd.innerHTML = invalidPwd;\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n regPassword.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_2 = false;\n } else {\n //CANCELLA MESSAGGIO D'ERRORE\n errorPwd.innerHTML = \"\";\n //IL CAMPO DIVENTA VALIDO (VERDE)\n regPassword.className = \"valid\";\n //CONTROLLO -> VERO\n check_2 = true;\n }\n }\n //CONFERMA PASSWORD\n //SE VUOTO -> ERRORE\n if (cofPassword.value === \"\") {\n //STAMPA MESSAGGIO D'ERRORE\n errorCofPwd.innerHTML = \"Non puoi lasciare vuoto questo campo\";\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n cofPassword.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_3 = false;\n } else {\n if (cofPassword.value !== regPassword.value) {\n //STAMPA MESSAGGIO D'ERRORE\n errorCofPwd.innerHTML = \"Le password non combaciano\";\n //IL CAMPO DIVENTA INVALIDO (ROSSO)\n cofPassword.className = \"invalid\";\n //CONTROLLO -> FALSO\n check_3 = false;\n } else {\n //CANCELLA MESSAGGIO D'ERRORE\n errorCofPwd.innerHTML = \"\";\n //IL CAMPO DIVENTA VALIDO (VERDE)\n cofPassword.className = \"valid\";\n //CONTROLLO -> VERO\n check_3 = true;\n }\n }\n //SE TUTTI I CAMPI SONO VALIDI RITORNA VERO\n if (check_1 && check_2 && check_3) {\n return true;\n } else { //ALTRIMENTI C'E' UN ERRORE NELL'INPUT\n return false;\n }\n }\n}", "function vacio(){\n\t var c_na = /^([a-z]|[A-Z]|├í|├ę|├*|├│|├║|├▒|├╝|\\s)+$/\n if(!c_na.test(solicitar.nombre.value)){\n alert('Escriba su nombre y apellido respetando may˙sculas, min˙sculas y acentos.');\n\t\t solicitar.nombre.focus();\n return false;\n }\n return true;\n }", "function validarNomeDeUsuario(nomeDeUsuario) {\n if (trim(nomeDeUsuario.value) != '') {\n document.formFuncionario.nomeDeUsuario.value = retirarAcentos(trim(document.formFuncionario.nomeDeUsuario.value)).toLowerCase();\n }\n}", "set modificarNombre(nuevoNombre) {\n this.nombre = nuevoNombre;\n }", "function validateName(nameVal) {\n if(nameVal === \"\") {\n $(\"#title\").removeClass(\"valid\");\n $(\"#title\").addClass(\"invalid\");\n campground.name = \"\";\n } else if(nameVal.length < 3) {\n $(\"#title\").removeClass(\"valid\");\n $(\"#title\").addClass(\"invalid\");\n campground.name = \"\";\n } else {\n $(\"#title\").removeClass(\"invalid\");\n $(\"#title\").addClass(\"valid\");\n campground.name = nameVal;\n }\n }", "validateName() {\n // Do not delete this internal method.\n this.name = this.name.replace(/[^a-z0-9]/gi, '_').toLowerCase();\n }", "function validateMName()\n {\n var letters = /^[A-Za-z]+$/;\n var nam = document.forms[\"register\"][\"mname\"].value;\n console.log(nam);\n document.getElementById(\"errmotname\").innerHTML = \"\";\n if (nam == null || nam == \"\")\n {\n console.log(nam);\n var d = document.getElementById(\"motname\");\n d.className += \" has-error\";\n document.getElementById(\"errmotname\").innerHTML = \"Please Enter Name\";\n }\n else if (nam.match(letters))\n {\n var el = document.getElementById(\"motname\");\n\n el.classList.remove(\"has-error\");\n\n return true;\n }\n else\n {\n var d = document.getElementById(\"motname\");\n d.className += \" has-error\";\n document.getElementById(\"errmotname\").innerHTML = \"invalid name.\";\n }\n }", "function validateName(row) {\n\t\t\tvar value = row.entity.name;\n\t\t\tvar result =\n\t\t\t{\n\t\t\t\tisSuccess: false,\n\t\t\t\tmessage: []\n\t\t\t};\n\t\t\tvar num = _.parseInt(value);\n//\t\t\tresult.message = \"Test. \" + \"<br/>\";\n\t\t\tresult.message.push(\"Test.\");\n\t\t\tif (num > 0) {\n\t\t\t\tresult.isSuccess = false;\n\t\t\t\tresult.message.push(\"Name cannot be a number.\");\n//\t\t\t\tresult.message += \"Numbers not allowed in name. \";\n\t\t\t}\n\t\t\telse if (check(value)) {\n\t\t\t\tresult.isSuccess = false;\n\t\t\t\tresult.message.push(\"Only alphanumeric characters allowed in name.\");\n//\t\t\t\tresult.message.push(\"This is a test.\");\n//\t\t\t\tresult.message += \"Please enter valid name without special characters. \";\n\t\t\t}\n\t\t\telse {\n\t\t\t\tresult.isSuccess = true;\n\t\t\t}\n\t\t\treturn result;\n\t\t}", "function validaceldalugar(){\n\tvar sitio=document.getElementById(\"lugar\").value ;\n if(sitio==\"\")\n\t{\n\tdocument.trabajo.lugar.className=\"error\";\t\n\tdocument.trabajo.lugar.focus();\n\t}\n\telse{ document.trabajo.lugar.className=\"correcto\";\n\t}\n }", "function validateNames(object)\r\n{\r\n object.value = object.value.replace(/[^a-zA-Z]+/g,\"\"); // Erase all the non-alphabetic chars.\r\n if(object.value.length > 30)\r\n object.setCustomValidity(\"A name must be of at most 30 characters!\");\r\n else\r\n object.setCustomValidity(\"\");\r\n}", "function validacionx(){\n var x = document.forms['formulario']['nombre'].value;\n if (x !== '') {\n return true\n }\n }", "function checkValidFirstName() {\n let inputId = '#validFirstName'\n const firstName = $('#validationCustom01').val()\n // let firstName = document.getElementById(\"validationCustom01\");\n let invalid = '#invalidFirstName'\n let regPattern = /^(?=.{1,50}$)[a-zZäöåÄÖÅ]+(?:['_.\\s][a-zZäöåÄÖÅ]+)*$/i\n if (firstName.trim() == '') {\n $(inputId).hide()\n $(invalid).text('Förnamn krävs')\n $(invalid).show()\n $(inputId).text('')\n $(firstName).addClass('is-invalid').removeClass('is-valid')\n return false\n } else if (!regPattern.test(firstName)) {\n $(inputId).hide()\n $(invalid).text('Ogiltig! Ange endast bokstäver')\n $(invalid).show()\n $(inputId).text('')\n $(firstName).addClass('is-invalid').removeClass('is-valid')\n return false\n } else {\n $(invalid).hide()\n $(inputId).text('Giltig')\n $(inputId).show()\n $(firstName).removeClass('is-invalid').addClass('is-valid')\n return true\n }\n}", "function validate_name(){\n name_outcome = validate.validateStr(name); //bool\n checkForm();\n }", "function proposerUnNombre () {\n var monNombreSecret = 0;\n var nombreSaisi = document.getElementById('nombreSaisi').value;\n if (1 < 0) { // ... A TOI DE JOUER !\n erreur(\"Ce puzzle n'est pas fini !\");\n } else {\n erreur(\"Ce puzzle n'est pas fini !\");\n }\n}", "function validateName() {\n let regName = /^[a-zA-Z ]{2,30}$/;\n let name = $('fullNameB').value;\n if(!regName.test(name)) {\n $('fullNameB').nextElementSibling.textContent = \"This field is required, please enter your full name.\";\n $('fullNameB').value = \"\";\n $('fullNameB').focus();\n return false;\n } else {\n $('fullNameB').nextElementSibling.textContent = \"\";\n return true;\n }\n}", "function validaFormRegistro(){\n \n //cogemos los valores de los inputs\n var nombreValue = nombre.value.trim();\n var apellidosValue = apellidos.value.trim();\n var emailValue = email.value.trim();\n var usuarioValue = user.value.trim();\n var passValue = pass.value.trim();\n \n\n //Comprueba que el campo nombre no esté vacío\n if (nombreValue == '' || nombreValue== null) {\n \n //Salta una alerta en el navegador\n alert(\"El nombre no puede estar vacío\");\n return false;\n \n //Comprueba que se corresponda con la cantidad y los caracteres válidos\n } else if(!/^[a-zA-ZàáâäãåąčćęèéêëėįìíîïłńòóôöõøùúûüųūÿýżźñçčšžÀÁÂÄÃÅĄĆČĖĘÈÉÊËÌÍÎÏĮŁŃÒÓÔÖÕØÙÚÛÜŲŪŸÝŻŹÑßÇŒÆČŠŽ∂ð ,.'-]{2,48}$/.test(nombreValue)){\n\n //Salta una alerta en el navegador\n alert(\"El nombre debe ser válido\");\n return false;\n \n //Comprueba que el campo apellido no esté vacío \n } else if (apellidosValue == '' || apellidosValue== null) {\n \n //Salta una alerta en el navegador\n alert(\"Los apellidos no pueden estar vacíos\");\n return false;\n\n //Comprueba que se corresponda con la cantidad y los caracteres válidos\n }else if(!/^[a-zA-ZàáâäãåąčćęèéêëėįìíîïłńòóôöõøùúûüųūÿýżźñçčšžÀÁÂÄÃÅĄĆČĖĘÈÉÊËÌÍÎÏĮŁŃÒÓÔÖÕØÙÚÛÜŲŪŸÝŻŹÑßÇŒÆČŠŽ∂ð ,.'-]{2,64}$/.test(apellidosValue)){\n\n //Salta una alerta en el navegador\n alert(\"Los apellidos deben ser válidos\");\n return false;\n\n //Comprueba que el correo electrónico no esté vacío\n }else if(emailValue == '' || emailValue== null ){\n \n //Salta una alerta en el navegador\n alert(\"El correo electrónico no puede estar vacío\");\n return false;\n \n \n //Comprueba que se corresponda con la cantidad y los caracteres válidos\n }else if (!/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(emailValue)) {\n \n //Salta una alerta en el navegador\n alert(\"El correo electrónico debe ser válido\");\n return false;\n \n //Comprueba que el nombre de usuario no esté vacío y que se corresponda con la cantidad y los caracteres válidos\n }else if (usuarioValue == '' || usuarioValue== null || usuarioValue < 5 || usuarioValue > 15 || !/^[a-zA-Z0-9_-]{5,15}$/.test(usuarioValue)) {\n \n //Si se cumple la condición salta una alerta en el navegador\n alert(\"El nombre de usuario debe tener entre 5 y 15 caracteres válidos\");\n return false;\n \n //Comprueba que la contraseña no está vacía, que la longitud y la forma sea la indicada\n } else if (passValue == '' || passValue== null ||passValue < 8 || !/^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&_-])[A-Za-z\\d@$!%*?&_-]{8,}$/.test(passValue)){\n \n //Si se cumple la condición salta una alerta en el navegador\n alert(\"La contraseña debe tener más de 8 caracteres, disponer de una letra minúscula, mayúscula, un número y un carácter especial\");\n return false;\n }\n\n //Si no hay errores se envía el formulario\n return true;\n}", "validateName() {\n const name = this.state.note_name.trim();\n if(name.length === 0) {\n return 'Name is required'\n }\n }", "function validateNames (el) {\n if(el.value == 0 || el.value.length <= 2) {\n\n setError(el, errorMessages.names);\n return false;\n }\n else { \n removeError(el);\n return true;\n }\n}", "function validFirstName() {\r\n\r\n var firstName = $firstName.val();\r\n\r\n if (firstName.length < 2 || firstName.length > 30) {\r\n $firstName.addClass('is-invalid');\r\n } else {\r\n $firstName.removeClass('is-invalid');\r\n }\r\n }", "function nameValidation()\n {\n if (nameText == password) \n {\n navigation.navigate(\"AdminAuth\");\n }\n else{\n let re = /^[\\u0590-\\u05FF]*$/;\n if(re.test(nameText)==false)\n {\n setErrorName(\"שם לא תקין (אנא הזן שם בעברית)\");\n setValidName(false);\n }\n else\n {\n setErrorName(\"\");\n setValidName(true);\n } \n }\n }", "function validateName(value) {\n const digits = /^\\d+$/giu;\n\n if (!value) {\n return 'Name field is required';\n }\n\n if (digits.test(value)) {\n return 'Name field cannot be a number';\n }\n\n return '';\n }", "function check(name) {\n var new_name = name.value;\n\n if (!isNaN(new_name)) {\n new_name = new_name.substring(0, (new_name.length - 1));\n name.value = new_name;\n }\n}", "function formName(inputValue){\n const nameOfInput = document.getElementById(inputValue +'-err');\n if(e.target.value === ''){\n nameOfInput.innerHTML = `*** Please write ${inputValue} Name`;\n }\n else if(e.target.value.length < 2 || e.target.value.length >= 20){\n nameOfInput.innerHTML = `*** Please write ${inputValue} Name between 3 to 20 letters`;\n }\n else if(!isNaN(e.target.value)){\n nameOfInput.innerHTML = \"*** Only letter is allowed\";\n }else{\n isFormValid = e.target.value;\n nameOfInput.innerHTML = \"\";\n }\n }", "function imprimirNombreMayuscula({ nombre }) { //entre las llaves colocamos el nombre de la propiedad a la cual queremos acceder\n console.log(nombre.toUpperCase());\n}", "function validate_name(){\n name_outcome = validate.validateStr(name); //bool\n \n if(!name_outcome){ //if incorrect data - inform user\n $('#name_error').text('* please enter a valid name');\n }else{\n $('#name_error').text('');\n }\n checkForm();\n }", "function verifier(nombre){\n\n //on crée un element qui va encapsuler notre message\n let instruction =document.createElement('p');\n\n if (nombre < alea){\n instruction.className = 'alert alert-danger';\n instruction.textContent = 'coup n°${nbcoup} [${nombre}], c est plus grand';\n\n }else if (nombre > alea){\n instruction.className = 'alert alert-danger';\n instruction.textContent = 'coup n°${nbcoup} [${nombre}], c est plus petit';\n }else{\n instruction.className = 'alert alert-danger';\n instruction.textContent = 'coup n°${nbcoup} [${nombre}], bravo c est le nombre trouvé';\n }\n}", "function validateName(value,data,name,form)\n{\n var message = \"\";\n if(value === \"\")\n message = \"* Required\";\n else if (!value.match(/^[a-zA-Z ]+$/))\n message = \"* Must be alphabets characters only\";\n\n if(message) {\n form.elements[name].define(\"invalidMessage\", message);\n return false\n }\n return true;\n}", "function validateName(element) {\n\n\t\tvar value = element.value;\n\t\tconsole.log(value);\n\n\t if ( checkFullName(value) ) {\n\t \telement.setCustomValidity(\"\");\n\t } else {\n\t \telement.setCustomValidity(\"Please enter a your full name including your last.\");\n\t }\n }", "function ValidaCorreo(nombre, _G_ID_) {\n var p = $(_G_ID_ + '_txt_' + nombre).val();\n var errors = [];\n if (!p.includes('.')) {\n errors.push('Menor');\n redLabel_Space(nombre, 'El correo es incorrecto', _G_ID_);\n }\n if (!p.includes('@')) {\n errors.push('Menor');\n redLabel_Space(nombre, 'El correo es incorrecto', _G_ID_);\n }\n if (errors.length > 0) {\n return false;\n }\n return true;\n}", "function validateName() {\r\n //validation for empty\r\n if (name.val() == \"\" ) {\r\n name.addClass(\"error\");\r\n nameInfo.text(\"Names cannot be empty!\");\r\n nameInfo.addClass(\"msg\");\r\n return false;\r\n } else {\r\n name.removeClass(\"error\");\r\n nameInfo.text(\"*\");\r\n nameInfo.removeClass(\"msg\");\r\n }\r\n\r\n //if it's NOT valid\r\n if (name.val().length < 2) {\r\n name.addClass(\"error\");\r\n nameInfo.text(\"Names with more than 2 letters!\");\r\n nameInfo.addClass(\"msg\");\r\n return false;\r\n }\r\n //if it's valid\r\n else {\r\n name.removeClass(\"error\");\r\n nameInfo.text(\"*\");\r\n nameInfo.removeClass(\"msg\");\r\n }\r\n \r\n \r\n }", "function validateName(e){\n\tif($name.val()===''){\n\t\te.preventDefault();\n\t\t$( \"<p class='error no-name'>Please enter a name.</p>\" ).insertBefore($name);\n\t}\n}", "validateEditPlayerName(idPlayer, newName)\n {\n if (this.hasAnyPlayerName(idPlayer, newName))\n {\n throw new Error(\"ERROR DE EDICION: Ya existe un jugador con el nombre \" + newName);\n } \n }", "function verificaNome(nome) {\n const regex = new RegExp('^[ 0-9a-zA-Zàèìòùáéíóúâêîôûãõ\\b]+$');\n if (nome <= 0 || !regex.test(nome)) {\n erroNome();\n return true;\n }\n }", "function validarFormulario(){\n var txtNombre = document.getElementById('provNombre').value;\n var txtRut = document.getElementById('provRut').value;\n //Test campo obligatorio\n if(txtNombre == null || txtNombre.length == 0 || /^\\s+$/.test(txtNombre)){\n alert('ERROR: El campo nombre no debe ir vacío o con espacios en blanco');\n document.getElementById('provNombre').focus();\n return false;\n }\n if(txtRut == null || txtRut.length == 0 || /^\\s+$/.test(txtRut)){\n alert('ERROR: El campo Rut no debe ir vacío o con espacios en blanco');\n document.getElementById('provRut').focus();\n return false;\n } \n return true;\n }", "function lastNameVal() {\n const lastNameVal = lastNameInput.value;\n if (lastNameVal.length < 2 && lastNameVal.length >= 1) {\n lastNameInputErr.innerHTML = 'Minimum surname length must be 2 characters';\n lastNameInput.style.border = '1px solid #E91414';\n } else if (lastNameVal.length > 26) {\n lastNameInputErr.innerHTML = 'Maximum surname length must be 26 characters';\n lastNameInput.style.border = '1px solid #E91414';\n } else {\n lastNameInputErr.innerHTML = '';\n lastNameInput.style.border = '';\n }\n}", "function ValidateRisultatiArticolo() {\n\tvar value = document.getElementsByName('parole')[1].value;\n\tif (!/^\\s*$/.test(value)) {\n\t\treturn true;\n\t}\n\n\talert(\"Devi inserire almeno una parola da cercare\");\n\treturn false;\n}", "function validate_name() \n\t{\n\t\t\n\t\tif(name.val().length < 3)\n\t\t\t{\n\t\t\tname_detail.text(\" * Name must be atleast 3 charachters long!\");\n\t\t\tname_detail.css(\"color\", \"red\");\n\t\t\t\n\t\t\treturn false;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tname_detail.css(\"color\", \"green\");\n\t\t\tname_detail.html(\"<span class='glyphicon glyphicon-ok' aria-hidden='true'></span>\");\n\t\t\treturn true;\n\t\t\t}\n\t\t\n\t}", "function Validacion_Create(e){\n //Esta linea detiene el envio al POST para validarlo\n e.preventDefault();\n try{\n console.log('Validando formulario Insumos!');\n if(this.querySelector('[name=Descripcion]').value == '') { \n console.log('La Descripcion esta vacía');\n ejecutaAlertaError(\"Descripcion\");\n // alert(\"Error! La Descripcion esta vacía, por favor complete el campo\")\n return;\n }\n if(this.querySelector('[name=DescripcionAbre]').value == '') { \n console.log('La DescripcionAbre esta vacía');\n ejecutaAlertaError(\"Descripcion Abreviada\");\n return;\n }\n\n this.submit();\n\n }\n catch{\n ejecutaAlertaError();\n }\n\n \n }", "function validateLName()\n {\n var letters = /^[A-Za-z]+$/;\n var nam = document.forms[\"register\"][\"lname\"].value;\n console.log(nam);\n document.getElementById(\"errlname\").innerHTML = \"\";\n if (nam == null || nam == \"\")\n {\n console.log(nam);\n var d = document.getElementById(\"lastname\");\n d.className += \" has-error\";\n document.getElementById(\"errlname\").innerHTML = \"Please Enter Name\";\n }\n else if (nam.match(letters))\n {\n var el = document.getElementById(\"lastname\");\n\n el.classList.remove(\"has-error\");\n\n return true;\n }\n else\n {\n var d = document.getElementById(\"lastname\");\n d.className += \" has-error\";\n document.getElementById(\"errlname\").innerHTML = \"invalid name.\";\n }\n }", "function myVerifName(){\n let errorName = document.getElementById(\"errorName\")//variable creer pour paramete ma fonction errorFact\n let errorNameCaratere = document.getElementById(\"errorNameCaractere\")\n if ((name.value.trim().length === 0 )) {\n errorFact(errorNameCaratere)\n errorFact(errorName)//appel de la fonction \"errorFact\" en lui donnant le param a traité\n name.style.border =\" 2px solid red\"\n let span = document.createElement(\"div\");\n span.id = \"errorName\";//ajout d'un id pour definir une variable errorName\n span.innerHTML = \"<strong>Le nom n'est pas valide</strong>\";//Integrer HTML au CDom a l'interieur de l'element ciblé\n let msg = document.getElementById(\"verif_nom\");\n msg.appendChild(span);//Ajouter un enfant a l'element cibler\n } else if(name.value.trim().length > 3) {\n errorFact(errorNameCaratere)\n errorFact(errorName)//appel de la fonction \"errorFact\" en lui donnant le param a traité\n let error = document.createElement(\"span\");\n error.id = \"errorNameCaractere\";\n error.innerHTML = \"<span>limite de caractére dépassée</span>\";\n document.getElementById(\"verif_nom\").appendChild(error);\n name.style.border = \"2px solid red\"\n } else {\n errorFact(errorNameCaratere)//appel de la fonction \"errorFact\" en lui donnant le param a traité\n errorFact(errorName)//appel de la fonction \"errorFact\" en lui donnant le param a traité\n name.style.border = \"2px solid green\";\n console.log(name.value.trim().length)\n }\n}", "function checkName(name) {\n if (name.length > 1) {\n return name;\n } else {\n $('#name').focus();\n $('form').append('<label class=\"wow shake\">Please Enter Valid Name</label>');\n return false;\n }\n }", "function onNameChange(e) {\n\n if (e.target.value.length > 0) {\n if (document.querySelector(\"#name-error\")) {\n document.querySelector(\"#name-error\").remove();\n e.target.classList.remove(\"not-valid\");\n e.target.classList.add(\"valid\");\n }\n \n }\n}", "function checkValiditeTitre() {\n var valide = null;\n var titre = $(\"#inputTitreCreation\").val();\n var titreEstUnique = false;\n if (titre.length === 0 || titre === \"\") {\n msg = \"Vous devez saisir un titre de projet.\";\n $(\"#inputTitreCreation\").addClass(\"is-invalid\");\n $(\"input_titre\").append($(\"#inputTitreError\").text(msg).addClass(\"invalid-feedback\"));\n valide = false;\n } else if (titre === \"PAS UNIQUE\") {\n msg = \"Ce titre de projet est déjà pris.\";\n $(\"#inputTitreCreation\").addClass(\"is-invalid\");\n $(\"input_titre\").append($(\"#inputTitreError\").text(msg).addClass(\"invalid-feedback\"));\n valide = false;\n } else {\n $(\"#inputTitreCreation\").removeClass(\"is-invalid\");\n $(\"#inputTitreCreation\").addClass(\"is-valid\");\n valide = true;\n }\n return valide;\n}", "function nameVerify() {//name verification\n $(form[0]).css({\"border-color\": \"#ced4da\"});\n let patt = /^[a-z\\sA-Z0-9]+$/;\n if (name.length > 0 && patt.test(name)) {\n show.style.visibility = \"hidden\";\n return true;\n } else {\n console.log($(form[0]));\n $(form[0]).css({\"border-color\": \"red\"});\n show.innerHTML = \"Name must any Alphabetical char without Symbal\";\n show.style.visibility = \"visible\";\n return false;\n }\n }", "function controleNom(){\nconst nom = formValues.Nom;\n\nif(regexNomPrenom(nom)){\n document.querySelector(\"#nom_manque\").textContent = \"\";\n\n return true;\n}else{\n document.querySelector(\"#nom_manque\").textContent = \"Veuillez correctement replir ce champ\";\n alert(textAlert(nom));\n return false;\n }\n \n}", "function validateName() {\n var name = document.getElementById('name')\n //SHOW THE ERROR MESSAGE\n var nameErrorMessage = document.getElementById('name-error')\n if(name.value == \"\" || name.value == undefined)\n {\n nameErrorMessage.classList.remove('is-invisible')\n }\n else{\n nameErrorMessage.classList.add('is-invisible')\n }\n}", "function valNombre(){\n\tvar nombre = document.getElementById('nombre').value;\n\tif(nombre != ''){\n\t\tdocument.getElementById('nombreError').innerHTML = '';\n\t\tconsole.log(nombre);\n\t\treturn nombre;\n\t}else{\n\t\tdocument.getElementById('nombreError').innerHTML = msjErrVacio;\n\t\treturn false; \n\t}\n}", "function formato_nombre_apellido(campo,span){\n\tformato_aceptado= /^[a-zA-ZñÑáéíóú\\s]+$/;\n\t\n\tif(campo.value == ''){\n\t\tval = false;\n\t\tspan.style.color = 'red';\n\t\tspan.innerHTML = 'campo vacio';\n\t\t}else if(! campo.value.match(formato_aceptado) && campo.value != ''){\n\t\t\tval = false;\n\t\t\tspan.style.color ='blue';\n\t\t\tspan.innerHTML = 'Solo son validas letras';\n\t\t\t}else{\n\t\t\tspan.innerHTML = '';\n\t\t\t}\n}" ]
[ "0.7609393", "0.74344754", "0.7390659", "0.7336258", "0.72030246", "0.7164892", "0.711631", "0.69687206", "0.69157916", "0.6907554", "0.68776804", "0.67767733", "0.67554736", "0.67465276", "0.6664473", "0.6662381", "0.66245776", "0.6576604", "0.65397805", "0.651212", "0.6505322", "0.65046084", "0.64375246", "0.6408032", "0.64076823", "0.6399849", "0.6394871", "0.63880426", "0.63703275", "0.63573736", "0.6356852", "0.6316587", "0.62650996", "0.6260396", "0.6258761", "0.6252651", "0.6248423", "0.62466615", "0.62452376", "0.6236547", "0.6231582", "0.62295", "0.62235135", "0.6215211", "0.6211885", "0.6207841", "0.62067914", "0.618882", "0.6180251", "0.61792314", "0.61780393", "0.6168651", "0.6160504", "0.61570877", "0.6156611", "0.6150115", "0.61455464", "0.614161", "0.61370045", "0.6136663", "0.61342674", "0.6124622", "0.6119618", "0.6100855", "0.60970324", "0.60958165", "0.60909724", "0.6090013", "0.608812", "0.6083636", "0.6081575", "0.60761863", "0.6071806", "0.6070499", "0.60682285", "0.6064606", "0.606357", "0.6062084", "0.6057284", "0.6055617", "0.6055273", "0.6054202", "0.6048247", "0.60471904", "0.6046048", "0.60454625", "0.6031366", "0.60297203", "0.60277665", "0.6020959", "0.60151", "0.60116243", "0.60079247", "0.60039777", "0.6001155", "0.6001002", "0.6000422", "0.6000182", "0.5997983", "0.5991334" ]
0.64153135
23
Guardar y validar email
function guardarEmail(email) { email = prompt("Ingrese su email"); let arrEmail = email.split(""); if (arrEmail.includes("@") && arrEmail.includes(".")) { localStorage.setItem("email", email); enviarMail(mailTo); } else { alert("Datos invalidos"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "validate(value) {\n if (!validator.isEmail(value)) {\n throw new Error(\"Email tidak valid\")\n }\n }", "function validarEmail(email){expr=/^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;if(!expr.test(email)) return false;else return true;}", "validator(va) {\n if (!validator.isEmail(val)) {\n throw new Error(\"Invalid Email\");\n }\n }", "function email(){\n var emailReg =/[a-z].*(@)[a-z]*(.)[a-z]{2,}$/;\n var validEmail = document.getElementById('email').value;\n if (emailReg.test(validEmail) === false)\n {\n throw \"invalid email address\";\n }\n }", "function validarEmail(email) {\n\n expr = /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\n if ( !expr.test(email) )\n swal(\"Error: Correo Incorrecto\", \"\", \"info\");\n \n\n }//end function validarEmail", "validate(value){\n if (!validator.isEmail(value)){\n throw new Error('Email invalid')\n }\n }", "function validate_email() {\n if (!valid_email(vm.email_address)) {\n vm.error_message = 'Please enter a valid email address';\n return;\n }\n reset_password();\n }", "function afficherEmail() {\n return isValidEmail(email.value);\n}", "function regExpEmail() {\n // Récupération des données saisies\n const emailValid = contact.email;\n // Injection du HTML\n const checkEmail = document.querySelector(\"#emailErrorMsg\");\n\n // Indication de la bonne saisie ou l'erreur dans le HTML\n if (/^[a-zA-Z0-9.-_]+[@]{1}[a-zA-Z0-9.-_]+[.]{1}[a-z]{2,10}$/.test(emailValid)) {\n checkEmail.innerHTML = \"<i class='fas fa-check-circle form'></i>\";\n return true;\n } else {\n checkEmail.innerHTML = \"<i class='fas fa-times-circle form'></i> format incorrect\";\n }\n }", "function emailValidation()\n {\n let re = /\\S+@\\S+\\.\\S+/;\n if (re.test(emailText)==false)\n {\n setErrorEmail(\"אנא הזן אימייל תקין\");\n setValidEmail(false);\n }\n else\n {\n setErrorEmail(\"\");\n setValidEmail(true);\n } \n }", "function checkEmail() {\n return validator.isEmail(this.email);\n}", "function validateEmail(){\n\tvar re = /^([\\w-]+(?:\\.[\\w-]+)*)@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)$/i;\n var result = re.test($.txtfieldMail.value);\n if(result == 0){\n \t$.txtfieldMail.value = \"\";\n \tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.invalidmail,function(){});\n }\n}", "function validacionEmail(valor) {\n emailRegex = /^[-\\w.%+]{1,64}@(?:[A-Z0-9-]{1,63}\\.){1,125}[A-Z]{2,63}$/i;\n if (emailRegex.test(valor)) {\n return true;\n } else {\n toastr.error(\"Formato de email no es valido\", \"Aviso!\");\n $('#txtemailed').focus();\n return false;\n }\n}", "emailvalidade(input) {\n\n // utilizar rejex para validar email\n\n // ex: email@email.com\n let re = /\\S+@\\S+\\.\\S/;\n let email = input.value;\n let errorMessage = `Insira um email no padrão mateus@email.com`;\n // \"!\"= se nao for ()\n if (!re.test(email)) {\n this.printMessage(input, errorMessage);\n\n }\n\n }", "function checkEmail() {\r\n const emailValue = email.value.trim();\r\n\r\n var mailformat = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$/;\r\n if (emailValue === '' || !emailValue.match(mailformat)) {\r\n isValid &= false;\r\n setErrorFor(email, 'Email not valid');\r\n return;\r\n }\r\n\r\n isValid &= true;\r\n}", "function checkEmail() {}", "function checkEmail() {\n if (validateEmail(this.value) === true) {\n setAccepted('email-validated');\n } else {\n setUnaccepted('email-validated');\n }\n}", "validate(val) {\n if (!validator.isEmail(val)) {\n throw new Error(\"Invalid email address\");\n }\n }", "validate(value) {\n if (!validator.isEmail(value)) {\n // The validator npm can check if email is correct\n throw new Error('Email is invalid');\n }\n }", "function validateEmail(){\n if (!formValue.email) {\n setErrors({...errors,email:'Email is required'})\n } else if (!/^[\\w-.]+@([\\w-]+.)+[\\w-]{2,4}$/.test(formValue.email)) {\n setErrors({...errors,email:'Email address is invalid'})\n }\n \n else setErrors({...errors,email:undefined}); \n \n }", "function validar_email(valor) \n{\n\tif (/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/.test(valor))\n\t{\n\t\t//alert(\"La dirección de email \" + valor + \" es correcta.\") \n\t\treturn (true)\n\t} \n\telse \n\t{\n\t\t//alert(\"La dirección de email es incorrecta.\");\n\t\treturn (false);\n\t}\n}", "function emailValid(){\n if(/\\S+@\\S+\\.\\S+/g.test(email)){\n setErrors('')\n return true\n }else{\n setErrors('Email is not valid!')\n }\n return false\n }", "function validateEmail() {\n $scope.errorEmail = false;\n\t\t\tif(!/^([\\da-z_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})$/.test($scope.email)) {\n\t\t\t\t$scope.errorEmail = true;\n $scope.messageEmail = 'E-mail address has a wrong format.';\n\t\t\t}\n\t\t\telse {\n\t\t\t\tvar data = {\n\t\t\t\t\taction: \"validateEmail\",\n\t\t\t\t\temail: $scope.email\n\t\t\t\t};\n\n // Calls the validate e-mail method in the registration factory.\n RegistrationFactory.validateEmail(data)\n .then(function(response) {\n if(typeof(response) == 'string') {\n $scope.errorEmail = true;\n $scope.messageEmail = 'An unexpected error occurred while e-mail address is validated. Please try again.';\n }\n else if (response[0]) {\n $scope.errorEmail = true;\n $scope.messageEmail = 'E-mail address is already registered.';\n }\n });\n\t\t\t}\n }", "function ValidateEmail(email) {\n $('.text-error').remove();\n // Проверка e-mail\n\n let reg = /^\\w+([\\.-]?\\w+)*@(((([a-z0-9]{2,})|([a-z0-9][-][a-z0-9]+))[\\.][a-z0-9])|([a-z0-9]+[-]?))+[a-z0-9]+\\.([a-z]{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/i;\n let inputEmail = email;\n let valEmail = (inputEmail.val()) ? inputEmail.val() : false;\n\n if (!valEmail) {\n inputEmail.after('<span class=\"text-error for-booking\">Поле должно быть заполненно</span>');\n $('.for-booking').css({ top: inputEmail.position().top + inputEmail.outerHeight() + 2 });\n return valEmail;\n }\n inputEmail.toggleClass('error', valEmail);\n\n if (!reg.test(valEmail)) {\n valEmail = false;\n inputEmail.after('<span class=\"text-error for-email\">Вы указали недопустимый e-mail</span>');\n $('.for-email').css({ top: inputEmail.position().top + inputEmail.outerHeight() + 2 });\n } else valEmail = true;\n inputEmail.toggleClass('error', valEmail);\n\n return valEmail;\n }", "function emailValidator() {\n const divParent = email.parentNode\n const emailReg = new RegExp('^[a-zA-Z0-9.-_]+[@]{1}[a-zA-Z0-9.-_]+[.]{1}[a-z]{2,10}$', 'g') // Expression régulière à respecter\n if (!emailReg.test(email.value)) { // On teste l'email sur la base de la RegExp\n divParent.setAttribute('data-error-visible', 'true')\n divParent.setAttribute('data-error', 'Vous devez entrer votre email')\n return false\n } else {\n divParent.setAttribute('data-error-visible', 'false')\n return true\n }\n}", "function validarEmail(email) {\n\n var patronArroba = /[@]/;\n\n if (patronArroba.test(email)) { //reviso que exista una @\n\n var dominio = email.split(\"@\")[1]; //divido donde halla una @\n if (dominio == 'gmail.com') {\n return 'success';\n } else {\n return 'dominio';\n }\n\n } else {\n return 'formato';\n }\n\n}", "function email_checker() {\n const email_value = email.value;\n\n if (validateEmail(email_value)) {\n errorMessageEmail.innerText = \"\";\n register.removeAttribute(\"disabled\");\n\n } else {\n errorMessageEmail.innerText = \"Invalid Email address.\";\n register.setAttribute(\"disabled\", \"disabled\");\n }\n}", "function validarEmail(email) {\n if (usuariosList.find(function(item){\n return item[2] == email;\n }) !== undefined) return false;\n if (/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.([a-zA-Z]{2,4})+$/.test(email)){\n return true;\n } else {\n return false;\n }\n\n }", "function validar_email(campo){\nvar email = /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\nreturn email.test(campo);\n}", "function validarEmail(valor) {\n var patron = /^(([^<>()[\\]\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@(([^<>()[\\]\\.,;:\\s@\\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\\"]{2,})$/i;\n if (patron.test(valor)){\n $('#2').text('');\n \n } else {\n $('#2').attr('class','text-danger');\n $('.email').css('border-style','solid');\n $('.email').css('border-color','red');\n $('#2').text(\"La dirección de email es incorrecta.\");\n }\n }", "function validarEmail() {\n // usaremos una expresion regular para que el mail cumpla un patron\n // \\S+ que comience con una secuencia de caracteres\n // seguido de una @exp\n // para terminar dos secuencias de caracteres con un punto entre ellas: \\S+\\.\\S+\n var exp = /\\S+@\\S+\\.\\S+/g;\n if (!exp.test(document.getElementById(\"email\").value)){\n document.getElementById(\"email\").value = \"error!\";\n document.getElementById(\"email\").focus();\n document.getElementById(\"email\").className=\"error\";\n document.getElementById(\"errores\").innerHTML = \"Error en el mail, formato no correcto.\";\n return false;\n }\n else {\n document.getElementById(\"email\").className=\"\";\n document.getElementById(\"errores\").innerHTML = \"\";\n return true;\n }\n}", "function valida_email(email){\n if(!valida_campo(email,'email','erro_email')) return false;\n else if(email.indexOf('@') == -1 || email.indexOf('.com') == -1){\n document.getElementById('erro_email').innerHTML = \"E-mail inválido!\" ;\n formulario.email.focus();\n return false;\n }\n document.getElementById('erro_email').innerHTML = \"\" ; //limpar mensagem\n return true;\n}", "function ValidarCampoEmail(mail) {\n expr = /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\n if (!expr.test(mail)) return false;\n else return true;\n}", "validateEmail(val) {\n\t\tconst email = _.trim(val);\n\t\tif (_.isEmpty(email)) {\n\t\t\treturn new Error('Email cannot be empty');\n\t\t}\n\t\tif (!email.includes('@')) {\n\t\t\treturn new Error('Please enter a valid email');\n\t\t}\n\t}", "validateEmail(value) {\n let error;\n if (!value) {\n error = 'Required';\n } else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i.test(value)) {\n error = 'Invalid email address';\n }\n return error;\n }", "function check_email() {\n\n\t\tvar pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/i);\n\t\n\t\tif(pattern.test($(\"#email\").val())) {\n\t\t\t$(\"#erroremail\").hide();\n\t\t} else {\n\t\t\t$(\"#erroremail\").html(\"Direccion inválida\");\n\t\t\t$(\"#erroremail\").show();\n\t\t\terror_email = true;\n\t\t}\n\t\n\t}", "function validate() {\n if (validateEmail(email)) {\n $error.fadeOut();\n } else {\n $error.fadeIn();\n $error.text(email + \" E-mail не корректен\");\n }\n }", "function validiraj_mail(){\n\n var pattern = /^[a-zA-Z0-9]+@[a-z]{2,10}\\.[a-z]{2,4}$/;\n var tekst = document.getElementById(\"forma\").mail_input.value;\n var test = tekst.match(pattern);\n\n if (test == null) {\n document.getElementById(\"mail_error\").classList.remove(\"hidden\");\n valid_test = false;\n } else{\n console.log(\"validiran mail\");\n document.getElementById(\"mail_error\").classList.add(\"hidden\");\n }\n }", "function validateEmail() {\r\n var re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\r\n return re.test(email.val());\r\n}", "function validarEmail(mail)\n{\n\tif (mail==\"\" || ( mail.indexOf ('@', 0) != -1 && mail.indexOf ('.', 0) != -1 ))\n\t\treturn (true);\n\telse {\n\t\talert(\"Escriba una dirección de correo válida.\"); \n \treturn (false);\n\t}\n}", "function validate(a) {\n var email = a.value;\n var email_invalid = false;\n if (!validateEmail(email)) {\n return true;\n }\n return false;\n}", "function checkEmail(email) {\n\n if (!email.match(emailRegex)) {\n emailError.textContent = 'Veuillez entrer une adresse mail valide.';\n formSub.email.classList.add('invalid');\n emailValid = false;\n } else {\n emailError.textContent = '';\n formSub.email.classList.remove('invalid');\n formSub.email.classList.add('valid');\n emailValid = true;\n }\n}", "function emailOnChange() {\n const pattern = \"^[_a-zA-Z0-9-\\\\+-]+(\\\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\\\.[a-zA-Z0-9-]+)*(\\\\.[a-zA-Z]{2,20})$\";\n validate(this, pattern);\n}", "validate(value) {\n // Using validator npm package. There are many more validations with npm validator:\n // as documented on their site: https://www.npmjs.com/package/validator\n if (!validator.isEmail(value)) {\n throw new Error('Please enter valid email address!')\n }\n }", "validate(value) {\n // Using validator npm package. There are many more validations with npm validator:\n // as documented on their site: https://www.npmjs.com/package/validator\n if (!validator.isEmail(value)) {\n throw new Error('Please enter valid email address!')\n }\n }", "function validateEmail(email) {\r\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\r\n if(re.test(String(email).toLowerCase())){\r\n //alert(\"Validacija email adrese izvrsena\" + email)\r\n \r\n } else {\r\n alert(\"Niste unijeli validan email, molimo pokušajte ponovo!\");\r\n }\r\n}", "function validEmail(check){\n return /^\\w+@\\w+(\\.(\\w)+)$/i.test(check.value);\n}", "function validEmail(value) {\n const addy = /\\S+@\\S+\\.\\S+/;\n if (value.match(addy)) return true;\n else return \"Please enter a valid email address.\";\n}", "function email() {\n var errors = document.querySelector(\"#errors\");\n var email = document.querySelector(\"#email\");\n var string = email.value.trim();\n var patt = /^[a-z0-9_\\-\\.]+\\@[a-z]+\\.[a-z]{2,4}$/i;\n if(!patt.test(string)) {\n errorMessage(\"<p>Please enter a valid Email address</p>\");\n return false;\n } else {\n return true;\n }\n}", "handleEmailCheck(email){\n return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$/.test(email)\n }", "function validar_email(email) {\r\n var patron = /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\r\n return patron.test(email) ? true : false;\r\n }", "function validateEmail(){\n var regex = /([a-z]*|[A-Z]*)(@)([a-z]*|[A-Z]*)(.com)$/;\n if(regex.test(signUpEmail.value) == true){\n return true;\n }else{\n return false;\n }\n}", "function checkEmail() {\n var pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/i);\n \n if (pattern.test(emailInput.val())) {\n emailInput.removeClass(\"error\");\n $(\"#email_error_message\").hide();\n }\n else {\n $(\"#email_error_message\").html(\"Enter valid email address\");\n $(\"#email_error_message\").show();\n emailInput.addClass(\"error\");\n error_email = true;\n }\n }", "function validateMail() {\r\n\t// empty field\r\n\tif (email.value == \"\") {\r\n\t\talertEmail.textContent = \"Email cannot be blank.\";\r\n\t\temail.focus();\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// valid email\r\n\tif (!(/^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/.test(email.value))) {\r\n\t\talertEmail.textContent = \"Enter a valid email address.\";\r\n\t\temail.focus();\r\n\t\treturn false;\r\n\t}\r\n}", "function validEmail(field, name){\n\tvar value_field = $(field).val().trim();\n\tvar retorno;\n if ((/^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/.test(value_field)) || (!value_field)) {\n retorno=true;\n } else {\n $('.alert.bg-danger span').html('O campo ' + name + ' deve ser um email válido.');\n\t\t$('.alert.bg-danger').show('fast');\n $(field).focus();\n retorno=false;\n\t}\n\treturn retorno;\n}", "function simpleEmailValidation(emailAddress) {\n\n}", "function validateMail(){\n\t\tvar x=document.getElementById('email');\n\t\tvar atpos = x.indexOf(\"@\");\n\t\tvar dotpos = x.lastIndexOf(\".\");\n\t\tif (atpos < 1 || dotpos < atpos+2 || dotpos+2 >= x.length){\n\t\t alert(\"Not a valid e-mail address\");\n\t\t x.focus();\n\t\t return false;\n\t\t }\n\t}", "validateRequestResetPasswordEmail(request, response) {\n request\n .checkBody(\"email\", \"Please enter a valid email.\")\n .isEmail();\n }", "function validaEmail(valor) {\n const re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return re.test(String(valor).toLowerCase());\n}", "function ValidEmail(field)\n{\n\t\t\t\tif(field.value == \"\")\n\t\t\t\t\t return true;\n\t\tif ((field.value.indexOf(\"@\") < 1) || (field.value.indexOf(\".\") < 1))\n\t\t{\n\t\t\t\t\tDspAlert(field,Message[29]);\n\t\t\t\t\treturn false;\n\n\t\t}\n\t\treturn true;\n\n}", "function pruebaemail(valor) {\n\tre = /^([\\da-z_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})$/\n\tif (!re.exec(valor)) {\n\t\talert('Formato de correo electónico erróneo, revíselo.');\n\t} else return;\n}", "function checkEmail(input){\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if(re.test(input.value.trim())){\nshowSuccess(input);\n }else{\nshowError(input,\"Email is not valid\");\n }\n}", "function validarEmail(fr_correo) {\n\t\tvar expresionRegularEmail = /^([\\w-]+(?:\\.[\\w-]+)*)@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)$/i; \n\t\tif( !(expresionRegularEmail.test(fr_correo)) || (fr_correo.length > 64) ) {\n\t\t\treturn false;\n \t} else {\n \t\treturn true;\n\t\t}\n}", "function validateEmail(e) { \n\t\texpr = /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/; //This is a regular expression that help us validate e-mail format//\n\t\tif (email.value == \"\" || email.value == null) {\n\t\t\tconsole.log(\"Empty e-mail\");\n\t\t\terrors.push(\"<li>Please write your email correctly</li>\");\n\t\t\te.preventDefault();\n\t\t}else {\n\t\t\tif (!expr.test(email.value)) {\n\t\t\t\tconsole.log(\"Invalid e-mail format\");\n\t\t\t\terrors.push(\"<li>Please write your email correctly</li>\");\n\t\t\t\te.preventDefault();\n\t\t\t}else{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n \n} //End validateEmail//", "function validar() {\n var expresion2 = /\\w+@\\w+\\.+[a-z]/;\n var NU = document.getElementById(NU).value;\n var NC = document.getElementById(NC).value;\n var CC = document.getElementById(CC).value;\n var CE = document.getElementById(CE).value;\n if (NU === \"\" || NC === \"\" || CC === \"\" || CE === \"\") {\n alert(\"Todos los campos son obligatorios\");\n return false;\n } else if (!expresion2.test(CE)) {\n alert(\"El correo no es válido. Ej: nombre@hotmail.com\");\n return false;\n }\n\n}", "function validationMailValidator(element) {\n\n\tif (element.value == '')\n\t\treturn true;\n\n\treturn validateField(element, 'email');\n\n}", "function validateEmail(fields, data, errors) {\n var re = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;\n if (!(re.test(data[\"courriel\"].value))) {\n errors.push(\"Courriel invalide.\");\n }\n}", "function checkEmail(cl, form) {\n var userEmail = form.getElementsByClassName(cl)[0].value,\n email_pattern = /[0-9a-z_]+@[0-9a-z]+\\.[a-z]{2,5}/i;\n\n if (!email_pattern.test(userEmail) && userEmail !== \"\") {\n showError(cl, \"Email is not valid\", form);\n }\n }", "function validarEmail(inp) {\n expr = /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\n \n if ( !expr.test(inp) ){\n \n inp.val('');\n return inp;\n }else{\n return inp;\n }\n\n \n }", "function validar_email(email) {\n var regex = /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\n return regex.test(email) ? true : false;\n}", "function validateEmail(email) {\n email.value == null ? email.value = \" \" : email.value\n var atpos = email.value.indexOf(\"@\");\n var dotpos = email.value.lastIndexOf(\".\");\n if (atpos<1 || dotpos<atpos+2 || dotpos+2>=email.value.length) {\n document.querySelector('.email-error').style.display = \"inline\";\n return false;\n }\n document.querySelector('.email-error').style.display = \"none\";\n return true;\n}", "function validate_email() {\n return email.length > 0 && email.length < 50;\n }", "function validem (){\r\n var em = document.getElementById(\"ema\").value;\r\n // can not use . directly \r\n // use of +\r\n var regexemail = /^([a-z A-Z 0-9\\.-]+)@([a-z A-Z 0-9] +).([a-z]{2-10})$/;\r\n\r\n if (regexemail.test(em)){\r\n alert(\"valid email\");\r\n }\r\n\r\n else {\r\n alert (\"invalid email \")\r\n }\r\n\r\n}", "validateEmail(value) {\n var re = /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return re.test(value);\n}", "function validarEmail(nodo){\n \n var email = nodo.val();\n var correcto = true;\n \n nodo.next().text('');\n \n if ( email === '' ){\n correcto = false;\n nodo.next().text('El campo email no puede estar vacio.');\n } else {\n var expr = /[\\w-\\.]{2,}@([\\w-]{2,}\\.)*([\\w-]{2,}\\.)[\\w-]{2,4}/;\n \n if ( !expr.test( email ) ){\n correcto = false;\n nodo.next().text('El formato del email introducido no es correcto.');\n }\n }\n return correcto;\n }", "function checkEmail(input){\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if(re.test(input.value.trim())){\n showSuccess(input);\n }\n else{\n showError(input, \"Email is not valid\");\n }\n}", "function validarEmail(email){\n var regex = /^\\w+([\\.\\+\\-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,4})+$/.test(email); \n return regex;\n }", "function validate_email(field,alerttxt)\r\n{\r\n\tif (/^\\w+([\\+\\.-]?\\w+)*@\\w+([\\+\\.-]?\\w+)*(\\.\\w{2,6})+$/.test(field.value))\r\n\t{\r\n\t\treturn true;\r\n\t}\r\n\telse \r\n\t{\r\n\t\tshow_it(field,alerttxt)\r\n\t\treturn false;\r\n\t}\r\n}", "function validarEmail(email) {\n var expr = /^\\w+([\\.+-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/;\n\n if(email.search(expr) == -1) {\n return false;\n }\n\n return true;\n}", "function isEmailValid (body) {\n if ('email' in body &&\n validator.isEmail(body['email'] + '') &&\n validator.isLength(body['email'] + '', { min: 5, max: parseInt(maxEmailVarcharAmount) })) {\n console.log('email ' + body['email'] + ' pass')\n return true\n } else {\n console.log('email ' + body['email'] + ' fail')\n return false\n }\n}", "function validateEmail() {\n var email = document.getElementById(\"email\").value;\n if (/\\S+@\\S+\\.\\S+/.test(email)) {\n return true;\n }\n alert(\"Email inválido!\")\n return false;\n}", "function validateEmail(e){\n\tvar validEmail = re.test($email.val());\n\tif($email.val()===''){\n\t\te.preventDefault();\n\t\t$( \"<p class='error no-email'>Please enter an email address.</p>\" ).insertBefore($email);\n\t}else if(!validEmail){\n\t\te.preventDefault();\n\t}\n}", "function validEmail() {\n // Se declara la variable email que toma el valor email de la forma\n var email = $('#email_id').val();\n // Se delcara la variable de la expresion regular con la que se va a comparar\n var reg_email = /^[a-zA-Z0-9\\._-]+@[a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,4}$/;\n // .match es un metodo que se aplica al email y lo compara on la expresion regular, cuando no hace match regresa null sino regresa un arreglo con el email\n if (email.match(reg_email) == null) { \n var email_error = \"Debes escribir una dirección de email valida\"\n // con append mandas la informacion al id selecionado\n $(\"#display_error\").append(email_error);\n }\n \n}", "function ValidEmail(field)\n{\n\n \tif ((field.value.indexOf(\"@\") < 1) || (field.value.indexOf(\".\") < 1))\n \t{\n\t DspAlert(field,Message[29]);\n\t return false;\n \t\t\n \t}\n \treturn true;\n \n}", "function checkEmail(email) {\n var re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if(re.test(email.value.trim())){\n showSuccess(email);\n } else {\n showError(email, 'Email is not valid');\n }\n\n}", "function validateEmail() {\n var pattern = /^([a-zA-Z])+([0-9a-zA-Z_\\.\\-])+\\@+(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,5}$)$/;\n var user_email = document.getElementById(\"user_email\");\n\n if (user_email.value === \"\") {\n document.getElementById(\"alert_email\").innerHTML =\n \"this field cannot be empty\";\n\n return false;\n } else if (!user_email.value.match(pattern)) {\n document.getElementById(\"alert_email\").innerHTML =\n \"please enter valid email address\";\n\n return false;\n }\n document.getElementById(\"alert_email\").innerHTML = \"\";\n return true;\n}", "function ValidateEmail()\n {\n var uemail = document.registration.email;\n var mailformat = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/;\n if(uemail.value.match(mailformat))\n {\n document.registration.address.focus();\n return true;\n }\n else\n {\n alert(\"You have entered an invalid email address!\");\n uemail.focus();\n return false;\n }\n }", "function validateEmail(email) {\r\n var filter = /^[\\w\\-\\.\\+]+\\@[a-zA-Z0-9\\.\\-]+\\.[a-zA-z0-9]{2,4}$/;\r\n if (filter.test(email)) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }", "function validate_Email(sender_email) {\n var expression = /^[\\w\\-\\.\\+]+\\@[a-zA-Z0-9\\.\\-]+\\.[a-zA-z0-9]{2,4}$/;\n if (expression.test(sender_email)) {\n return true;\n }\n else {\n return false;\n }\n }", "function validate_Email(sender_email) {\n var expression = /^[\\w\\-\\.\\+]+\\@[a-zA-Z0-9\\.\\-]+\\.[a-zA-z0-9]{2,4}$/;\n if (expression.test(sender_email)) {\n return true;\n }\n else {\n return false;\n }\n }", "function validarMail(mail){ \n cadena=/^([a-zA-Z0-9\\._-]+)@([a-zA-Z0-9\\._-]+)\\.([a-zA-Z0-9\\._-]+)$/; \n\tif(cadena.test(mail))\n return 1;\n else\n return 0;\n}", "function checkmail(){\r\n\tif((/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/.test(email.val())))\r\n\t\treturn true;\r\n\treturn false;\r\n}", "function validateEmail (event) {\n var node = event.target\n\n if (node.value && node.value.indexOf('@') !== -1 && node.value.indexOf('.') !== -1) {\n console.log('Email correcto')\n node.classList.remove('is-invalid')\n node.classList.add('is-valid')\n } else {\n console.log('Email incorrecto')\n node.classList.remove('is-valid')\n node.classList.add('is-invalid')\n }\n}", "function validateEmail(mail)\n{\n return (/^\\w+([.-]?\\w+)*@\\w+([.-]?\\w+)*(\\.\\w{2,3})+$/.test(mail))\n}", "function validationEmail() {\n\n if (expressionReguliere.test(email.value)) {\n\n formulaire.submit();\n \n }\n else\n {\n \n error.innerHTML = \"L'adresse mail n'est pas valide\";\n error.style.color = 'red';\n \n } \n}", "function checkEmail() {\n\t\tvar email=document.sform.eml.value;\n\t\tif (email==\"\") {\n\t\t\talert (\"Please enter a valid email.\");\n\t\t\tdocument.sform.eml.focus();\n\t\t\treturn false;\n\t\t} \n\t\telse if (!(email.includes(\"@\"))) {\n\t\t\talert (\"Please enter a valid email.\");\n\t\t\tdocument.sform.eml.value=\"\";\n\t\t\tdocument.sform.eml.focus();\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "function validateEmail(email){\n $('#user_email_error').html('');\n var email = email;\n var regEx = /.*@.*/\n if (regEx.test(email)) {\n return true;\n } else {\n var span = $('<span>').attr('id', 'user_email_error')\n .html(\" Email must be valid!\")\n $('#user_email').after(span);\n return false;\n }\n}", "validateEmail(mail) {\n if (/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/.test(mail)) {\n return (true)\n }\n alert(\"You have entered an invalid email address!\")\n return (false)\n }", "function EmailValidation(getEmail) {\n var regExp = /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*.[a-zA-Z]{2,3}$/i;\n if (regExp.test(getEmail)) return true;\n else return false;\n}", "function checkEmail(input){\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if( re.test(input.value.trim())) {\n showSuccess(input.value);\n } else {\n showError(input, 'Email is not Valid');\n }\n}", "function validarEmail(email)\n{\n var res= /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return res.test(email);\n}" ]
[ "0.7876787", "0.78224754", "0.7777101", "0.7729202", "0.7728618", "0.7593715", "0.7592074", "0.7556102", "0.74932945", "0.7470817", "0.746091", "0.7460481", "0.74505764", "0.7436092", "0.7431703", "0.7389254", "0.7387517", "0.7376607", "0.7374087", "0.73700637", "0.73502135", "0.73485804", "0.7338456", "0.7335005", "0.73175186", "0.7281858", "0.7280754", "0.7279376", "0.7275843", "0.72580737", "0.72492856", "0.72414595", "0.72401434", "0.7237947", "0.7211015", "0.7205556", "0.72035825", "0.72003037", "0.71873", "0.7183149", "0.71623504", "0.71517414", "0.71488655", "0.71377075", "0.71377075", "0.7130579", "0.7126729", "0.7124471", "0.71243334", "0.7113457", "0.708522", "0.7083284", "0.70626193", "0.7035255", "0.70041496", "0.7002879", "0.69942266", "0.6973937", "0.69711155", "0.695596", "0.6955017", "0.6950283", "0.69392794", "0.69324017", "0.69241166", "0.6923681", "0.6923223", "0.6920056", "0.69160736", "0.6915913", "0.69137895", "0.69104177", "0.69045883", "0.68887585", "0.68819904", "0.6881838", "0.6881304", "0.68760246", "0.68677986", "0.68646383", "0.6862468", "0.6850134", "0.68497044", "0.6847322", "0.68446445", "0.6844246", "0.6844237", "0.6840327", "0.68353677", "0.68353677", "0.68316543", "0.6829793", "0.68296033", "0.6828923", "0.68239313", "0.6818589", "0.6808736", "0.680035", "0.67994833", "0.6798116", "0.6796939" ]
0.0
-1
Preguntar para enviar mail
function enviarMail(mail) { mail = confirm("Desea recibir mails con novedades?"); if (mail == true) { alert( "Estaremos enviandole las ultimas novedades a " + localStorage.getItem("email") ); localStorage.setItem("mail", mail); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sendMail(options) {}", "sendEmail() {\n email([EMAIL], null, null, null, null);\n }", "async function EnviarEmail(email, asunto, destinatario, html, texto, archivos) {\n let data = {\n from: \"'GRUPO ELITE' <info@grupoelitefincaraiz.co>\",\n to: email,\n subject: asunto\n };\n html ? (data.html = texto) : (data.text = destinatario + ' ' + texto);\n if (Array.isArray(archivos) && archivos.length) {\n data.attachments = archivos.map((e, i) => {\n return {\n // file on disk as an attachment\n filename: e.fileName,\n path: e.ruta // stream this file\n };\n });\n }\n console.log(data);\n envio = await transpoter.sendMail(data);\n //console.log(envio)\n}", "function sendMail(name, mail, mesaj) {\n //create transport as SMTP with gmail service\n var transporter = nodemailer.createTransport({\n service: 'gmail',\n auth: {\n user: 'medicalcheck.application',\n pass: 'medicalparola'\n }\n });\n var mailOptions = {\n from: name,\n to: 'cristinafotonea@gmail.com',\n subject: mail,\n text: mesaj,\n };\n transporter.sendMail(mailOptions, function (error, info) {\n if (error) {\n console.log(error);\n }\n else {\n console.log('Email:' + info.response);\n }\n });\n}", "function sendmail(){\t\n\n\tvar mailOptions = {\n\t from: 'Fred Foo ✔ <kontakt@zdf.de>', // sender address\n\t to: 'adams.r@zdf.de', // list of receivers\n\t subject: 'Hello ✔', // Subject line\n\t text: 'Hello world ✔', // plaintext body\n\t html: '<b>Hello world ✔</b>' // html body\n\t};\n\n\t// send mail with defined transport object\n\ttransporter.sendMail(mailOptions, function(error, info){\n\t if(error){\n\t console.log(error);\n\t }else{\n\t console.log('Message sent: ' , info);\n\t }\n\t});\n}", "function sendmail(to,subject,content) {\n from = 'no-reply@test.com'\n var mailOptions = {\n from: from,\n to: to,\n subject: subject,\n html: content\n };\n\n transporter.sendMail(mailOptions, function(error, info){\n if (error) {\n console.log(error);\n } else {\n //console.log('Email sent: ' + info.response);\n }\n }); \n\n}", "async register(firstName, lastName, email) {\n const termo = strTermo.termo();\n const mail = strEmail.registerEmail(firstName);\n let transporter = nodemailer.createTransport({\n host: \"smtp.gmail.com\",\n port: 465,\n ignoreTLS: false,\n secure: true, // true for 465, false for other ports\n auth: {\n user: \"getpetcc@gmail.com\", \n pass: \"getpet1123\" \n },\n tls:{ rejectUnauthorized: false} //localhost\n });\n let info = transporter.sendMail({\n from: '\"GetPet 🐶🐭\" <getpetcc@gmail.com>',\n to: `${email}, larachernandes@gmail.com, getpetcc@gmail.com`,\n subject: `Bem-vindo(a), ${firstName} ${lastName}!`,\n text: \"Mensagem de confirmação de registro\", \n html: `${mail}`, // salvo em src/mail templates\n attachments : [{ filename: 'termo.txt', content: termo }] //salvo em src/files\n });\n return mail;\n }", "function gmailSend(mensaje, nombre){\n const transporter = nodemailer.createTransport({\n service: 'gmail',\n auth:{\n user:'davidmercado5772@gmail.com',\n pass:'58385772y'\n }\n });\n\n var mailOption = {\n from: 'davidmercado5772@gmail.com',\n to:'miltonmercado92@gmail.com',\n subject: nombre,\n text: mensaje\n };\n\n transporter.sendMail(mailOption, (error, infor)=>{\n if(error){\n console.log(\"error\");\n }else{\n console.log('Email sent' + infor.response);\n }\n });\n}", "function sendEmail (body) {\n var smtpTransport = nodemailer.createTransport(\"SMTP\",{\n service: \"Gmail\",\n auth: {\n user: \"jorge.ulecia.actor@gmail.com\",\n pass: \"contacto!\"\n }\n });\n\n mailOptions.text = body;\n\n \tsmtpTransport.sendMail(mailOptions, function(error, response){\n if(error){\n console.log(error);\n }else{\n console.log(\"Message sent: \" + response.message);\n }\n\n smtpTransport.close();\n });\n}", "async function mail(mailSubject, time) {\n // Generate test SMTP service account from ethereal.email\n // Only needed if you don't have a real mail account for testing\n // let testAccount = await nodemailer.createTestAccount();\n\n // create reusable transporter object using the default SMTP transport\n let transporter = mailer.createTransport({\n // host: \"smtp.ethereal.email\",\n service: \"gmail\",\n port: 587,\n secure: false, // true for 465, false for other ports\n auth: {\n user: process.env.EMAIL, // generated ethereal user\n pass: process.env.PASSWORD // generated ethereal password\n }\n });\n\n // send mail with defined transport object\n let info = await transporter.sendMail({\n from: '\"Fred Foo 👻\" mateteuszw@gmail.com', // sender address\n to: \"mateuszwojcik.ofc@gmail.com\", // list of receivers\n subject: mailSubject, // Subject line\n text: \"Hello world?\", // plain text body\n html: `<b>Czas wykonywania zapytania: ${time} sekund.</b>`, // html body\n attachments: [{ filename: \"wynik.csv\", path: \"files/wynik.csv\" }]\n });\n\n console.log(\"Message sent: %s\", info.messageId);\n // Message sent: <b658f8ca-6296-ccf4-8306-87d57a0b4321@example.com>\n\n // Preview only available when sending through an Ethereal account\n console.log(\"Preview URL: %s\", mailer.getTestMessageUrl(info));\n // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...\n\n transporter\n .sendMail(info)\n .then(resp => {\n console.log(`Wysłano emiala. ${resp}`);\n console.log(file);\n })\n .catch(err => {\n console.log(`Błąd wysłki. ${err.message}`);\n });\n}", "function sendEmail(toEmail,subject,body) {\n Email.send({\n Host: \"smtp.gmail.com\",\n Username: \"stubank2021@gmail.com\",\n Password: \"NclStubank2021\",\n To: toEmail,\n From: \"stubank2021@gmail.com\",\n Subject: subject,\n Body: body,\n })\n .then(function (message) {\n alert(\"Recovery email sent\");\n });\n}", "function sendMail(e){\n\te.preventDefault()\n\tconst receiver = document.querySelector(\"#receiverName\").value\n\tconst content = document.querySelector(\"#inputContent\").value\n\t//const appendMail = new Mail(receiver.value, content)\n\t//auser.send.push(newMail)\n\n const newMail = {\n \"receiver\":receiver,\n \"content\":content\n }\n RequestModule.sendmail(newMail, function(newmail){\n sent.insertBefore(mailHTML(newmail), sent.children[1])\n if(receiver === currentUser){\n inbox.insertBefore(mailHTML(newmail), inbox.children[1])\n }\n })\n\n // Server side funtions will be added below in phase2.\n}", "Mailing(orderNb) {\r\n const to = [\"admin@admin.com\"];\r\n email(to, {\r\n subject: \"Commande numéro : \" + orderNb,\r\n body:\r\n \" Veuillez détailler le problème que vous rencontrez au sujet de la commande numéro :\" +\r\n orderNb,\r\n }).catch(console.error);\r\n }", "function sendMail() {\n var link = \"mailto:\" + encodeURIComponent(document.getElementById('correo_D').value)\n + \"?cc=\" \n + \"&subject=\" + encodeURIComponent(document.getElementById('asunto').value)\n + \"&body=\" + encodeURIComponent(document.getElementById('mensaje').value)\n ;\n \n window.location.href = link;\n}", "sendMail() {\n return __awaiter(this, void 0, void 0, function* () {\n var contra = this.generateRandomString(10);\n var mensaje = \"hola tu usuario es \" +\n this.nombre +\n this.apellido +\n \" y tu contrasena es \" +\n contra +\n \"\\n esperamos sea util\";\n var mailOptions = {\n from: \"proyectoarchivos37@gmail.com\",\n to: this.correo,\n subject: \"credenciales\",\n text: mensaje,\n };\n yield this.transporter.sendMail(mailOptions, (error, info) => {\n if (error) {\n console.log(error);\n }\n else {\n console.log(\"email enviado: \", info.response);\n }\n });\n return contra;\n });\n }", "function enviarEmail(e) {\n //Spiner al presionar enviar\n const spinerGif = document.querySelector(\"#spinner\");\n spinerGif.style.display = \"block\";\n\n // gif que envia email (simulacion)\n const enviado = document.createElement(\"img\");\n enviado.src = \"img/mail.gif\";\n enviado.style.display = \"block\";\n\n //ocultar spinner y mostrar dif de enviado\n setTimeout(function() {\n spinerGif.style.display = \"none\";\n\n document.querySelector(\"#loaders\").appendChild(enviado);\n\n setTimeout(function() {\n enviado.remove();\n formularioEnviar.reset();\n }, 4000);\n }, 3000);\n e.preventDefault();\n}", "function send(to, from, cc, subject, body, attch) {\n\n\t//build the mail options\n\tvar mailOptions = _defineMailOptions(to, from, cc, subject, body, attch);\n\n\t//return async work\n\treturn new Promise(function(resolve, reject) {\n\n\t\tconsole.log('sending mail');\n\n\t\t//send mail with the defined transport object\n\t\tTRANSPORTER.sendMail(mailOptions, function results(error, info){\n\n\t\t\t//if there was an error notify the user\n\t\t\tif(error) reject(info);\n\t\t\telse resolve('Message sent: ' + info.response);\n\t\t\t//if not send a positive response\n\n\t\t});\n\n\t});\n\n}", "function sendEmail(email) {\n console.log(\"into email: \" + email);\n var smtpConfig = {\n host: 'smtp.gmail.com',//'mucsmtp3.amadeus.net',\n port: 465,\n secure: true,\n auth: {\n user: '',\n pass: ''\n } // use SSL\n };\n var transporter = nodemailer.createTransport(smtpConfig);\n\n var mailData = {\n from: 'remi.pourtier@gmail.com',\n to: 'remi.pourtier@amadeus.com',\n subject: 'Message title',\n text: 'Plaintext version of the message',\n html: 'HTML version of the message'\n };\n // send mail with defined transport object\n transporter.sendMail(mailData, function (error, info) {\n if (error) {\n return console.log(error);\n }\n console.log('Message sent: ' + info.response);\n });\n}", "envoyerMail(objet, contenu){\r\n\r\n console.log(\"envoyer un email a \" +\r\n this.mail+\" objet : \" +\r\n objet + \"contenu : \" + contenu );\r\n\r\n\r\n\r\n\r\n\r\n\r\n }", "function sendEmail(e) {\n e.preventDefault();\n emailjs.sendForm('gmail', 'template_pz4qfec', e.target, 'user_HYImqyNA2H0p8YsBrLgBT')\n .then((result) => {\n console.log(result.text);\n setMail('success')\n }, (error) => {\n console.log(error.text);\n setMail('error')\n });\n setEmail('')\n setMessage('')\n setName('')\n \n }", "function sendmail(email, ts) {\n var link = `http://ibm.bankconnect:5000/route/confirm/${ts}/${email}`;\n var transporter = nodemailer.createTransport({\n service: 'gmail',\n auth: {\n // user: process.env.GMAIL_USER,\n // pass: process.env.GMAIL_PASS\n user: 'ibm.bankconnect@gmail.com',\n pass: 'Modified@2017'\n }\n });\n\n var mailOptions = {\n from: 'ibm.bankconnect@gmail.com',\n to: `${email}`,\n subject: 'Email confirmation for Bank Connect',\n text: 'That was easy!',\n html: `${link}`\n };\n\n transporter.sendMail(mailOptions, function (error, info) {\n if (error) {\n console.log(error);\n } else {\n console.log('Email sent: ' + info.response);\n }\n });\n}", "function mailConfirmation(user, info, form, mail, callback) {\n var msg = \"Dear \" + form.firstName + \" \" + form.lastName + \"\\n\\n\";\n msg += \"Thank you for your purchase of \" + form.shares + \" shares on Pool Play.\\n\";\n msg += \"You've been charged $\" + info.price + \".00 for this purchase.\\n\";\n msg += \"If you have any questions, don't hesitate to contact us!\\n\\n\";\n msg += \"Thanks,\\n\";\n msg += \" The Pool Play team\";\n console.log(\"mailto: \" + form.email);\n var mailInfo = {\n from: \"Pool Play <gtechpoolplay@gmail.com>\",\n to: form.email,\n subject: \"Confirmation of your Pool Play purchase\",\n text: msg\n };\n \n var smtpTransport = mail.createTransport(\"SMTP\", {\n service: \"Gmail\",\n auth: {\n user: \"gtechpoolplay@gmail.com\",\n pass: \"165198795\"\n }\n });\n smtpTransport.sendMail(mailInfo, function(error, response) {\n if (error) {\n console.log(error);\n } else {\n console.log(\"Message sent: \" + response.message);\n }\n callback();\n });\n}", "mailOptions(moneda, texto, mails) {\n return {\n from: '\"Fred Foo 👻\" <mail@mail.com>', // sender address //todo sender\n to: mails.join(', '), // list of receivers\n subject: `Alerta ${moneda}`, // Subject line\n text: texto, // plain text body\n };\n }", "sendTextEmail() {\n email([EMAIL], null, null, null, this.state.text);\n }", "async send() {\n // create reusable transporter object using the default SMTP transport\n let transporter = nodemailer.createTransport({\n host: this.HOST,\n port: this.PORT,\n secure: true, // true for 465, false for other ports\n auth: {\n user: this.auth.user, // generated ethereal user\n pass: this.auth.pass, // generated ethereal password\n },\n });\n\n // send mail with defined transport object\n let info = await transporter.sendMail({\n from: '\"Rexford Nana 👻\" <teemag2020@gmail.com>', // sender address\n to: this.to, // list of receivers\n subject: 'Hello ✔', // Subject line\n text: 'Hello world?', // plain text body\n html: '<b>Hello world?</b>', // html body\n });\n\n this.log('Message sent: %s', info.messageId);\n }", "function sendEmail(user, password){\n\n server.send({\n text: \"Hello \" + user.name + \", as per your request, here is your temporary password: \" + password,\n from: \"mongo.mango.dbhosting@gmail.com\",\n to: email,\n subject: \"Password reseted\"\n }, function (err, message) {\n if(err){\n response.errorInternalServer(res, err);\n }\n else{\n response.successOK(res, \"Message sent\");\n console.log(message);\n }\n });\n}", "function test(){\n server.send({\n text: \"i hope this works\", \n from: \"pspalavesam@gmail.com\", \n to: \"pspalavesam@gmail.com\",\n // cc: \"else <else@your-email.com>\",\n subject: \"testing emailjs\"\n }, function(err, message) { console.log(err || message); });\n console.log(\"ok\");\n }", "function SeamonkeyImportMail() {}", "function sendMail(to){\n if((vm.subject.trim().length > 0) && (vm.name.trim().length > 0) && (vm.comment.trim().length > 0)\n && (vm.mail != undefined && vm.mail.trim().length > 0)) {\n //Valida que el mail ingresado sea valido\n if(validateEmail(vm.mail.trim())) {\n cleanErrorMessage();\n vm.mail_error = '';\n vm.mailError = 0;\n vm.mailWarning = 0;\n\n acAngularContactoService.sendMail(to, vm.subject.trim(), vm.comment.trim(), vm.mail.trim(), function(data){\n vm.showMessage = 1;\n if(data) {\n vm.message = 'Su consulta fue enviada';\n $timeout(hideMessage, 3000);\n }\n else {\n vm.message = 'Se produjo un error al enviar su consulta';\n }\n });\n }\n else {\n cleanErrorMessage();\n vm.mail_error = 'Ingrese un mail valido';\n vm.mailWarning = 2;\n }\n }\n else {\n validateMail();\n validateName();\n validateSubject();\n validateComment();\n }\n }", "function mailIt(options) {\n /**\n * We only send email if the host field is defined\n */\n if (svmp.config.get(\"smtp:host\")) {\n smtpTransport.sendMail(options, function (error, responseStatus) {\n if (error) {\n console.log(\"Error sending email to user: \", error);\n }\n });\n }\n}", "function sendEmail(email, subject, html){\n const msg ={\n to: email,\n from : process.env.SENDGRID_EMAIL,\n subject,\n html\n };\n sgMail.send(msg).then((sent) => {\n console.log(\"success\");\n })\n .catch(error =>{\n console.log(\"failed\");\n })\n}", "function sendMail(){\n async function main() {\n // Generate test SMTP service account from ethereal.email\n // Only needed if you don't have a real mail account for testing\n // let testAccount = await nodemailer.createTestAccount();\n \n // create reusable transporter object using the default SMTP transport\n let transporter = nodemailer.createTransport({\n host: \"gmail\", // true for 465, false for other ports\n auth: {\n user: 'rai.peter2@gmail.com', // generated ethereal user\n pass: '*peter319645296@', // generated ethereal password\n },\n });\n \n // send mail with defined transport object\n let info = await transporter.sendMail({\n from: '\"rai.peter2@gmail.com', // sender address\n to: \"rahulrouth100@gmail.com\", // list of receivers\n subject: \"Hello ✔\", // Subject line\n text: \"Hello world!\", // plain text body\n // html body\n });\n \n console.log(\"Message sent: %s\", info.messageId);\n // Message sent: <b658f8ca-6296-ccf4-8306-87d57a0b4321@example.com>\n \n // Preview only available when sending through an Ethereal account\n console.log(\"Preview URL: %s\", nodemailer.getTestMessageUrl(info));\n // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...\n }\n}", "function enviarAyuda(correoUser, asunto, motivo, mensaje) {\n if (validarMail(correoUser.toUpperCase())) {\n enviarCorreo(\"notif.ajebask@gmail.com\", \"ayuda\", \"Ayuda: \" + motivo + \" - \" + asunto, mensaje);\n enviarCorreo(correoUser, \"ayuda\", \"Ayuda: \" + motivo + \" - \" + asunto, mensaje);\n } else {\n alert(\"Email no válido\");\n }\n}", "function SendEmail() {\n emailjs\n .send('gmailAdmin', 'template_3WsqlJYJ', {\n from_name: document.getElementById('name').value,\n message_html: document.getElementById('message').value,\n from_email: document.getElementById('email').value,\n })\n .then(\n // Handle email send successfully\n function(response) {\n console.log('SUCCESS!', response.status, response.text);\n alert('Mensaje enviado');\n setTimeout(function() {\n window.location = '/';\n }, 1000);\n },\n // Handle email send error\n function(error) {\n console.log('FAILED...', error);\n alert('Error al enviar el mensaje');\n setTimeout(function() {\n window.location = '/about';\n }, 2000);\n },\n );\n}", "sendMail(message) {\r\n return this.clone(User, \"sendMail\").postCore({\r\n body: jsS(message),\r\n });\r\n }", "async function main() {\r\n let transporter = nodemailer.createTransport({\r\n host: `${keys.host}`, // Make sure to set up these in the config file.\r\n port: `${keys.port}`, // Refer to your email provider for your mail provider's configuration.\r\n secure: false,\r\n auth: {\r\n user: `${keys.user}`,\r\n pass: `${keys.password}`,\r\n },\r\n });\r\n\r\n let subject = date.getMonth + \" \" + date.getDate\r\n\r\n let info = await transporter.sendMail({\r\n from: `${keys.from}`,\r\n to: `${keys.to}`,\r\n subject: subject,\r\n text: \"Hello, Email World.\",\r\n html: undefined, // none, we are using text\r\n });\r\n\r\n console.log(\"Message Sent: %s\", info.subject);\r\n}", "async function main() {\n // create reusable transporter object using the default SMTP transport\n var transporter = nodemailer.createTransport({\n host: \"smtp.gmail.com\", // hostname\n auth: {\n user: \"moonstarcodemail@gmail.com\",\n pass: \"Moon_2021!\",\n },\n });\n\n // send mail with defined transport object\n let info = await transporter.sendMail({\n from: email, // sender address\n to: \"support@moonstar.biz\", // list of receivers\n subject: email, // Subject line\n text: message, // plain text body\n html: message, // html body\n });\n\n console.log(\"Message sent: %s\", info.messageId);\n // Message sent: <b658f8ca-6296-ccf4-8306-87d57a0b4321@example.com>\n }", "function SendEmailToUser(OtpString,email){\n\n //Step 1\nlet transporter=nodemailer.createTransport(\n {\n service:'gmail',\n auth:{\n user: process.env.EMAIL,\n pass: process.env.PASSWORD\n }\n }\n);\n\n//Step 2\nlet mailOptions={\n from:'bytpphyte@gmail.com',\n to: email,\n cc:'bytpphyte@gmail.com',\n subject:'Regarding Registration as assured doctor in PRANKS',\n text: 'Use this OTP at the time of Registration '+OtpString\n}\n\n//Step 3\ntransporter.sendMail(mailOptions,function(err,data){\n if(err){\n console.log(\"Error Occurs\"+err);\n }\n else{\n console.log(\"Email Sent!!!\");\n }\n});\n\n\n}", "function sendEMail(emailTo, ccTo, bccTo, subject, emailBody) {\n //separated as two lines, for debug\n var mailParamStr =\n 'mailto:' + emailTo + \"?\" +\n (ccTo ? ('cc=' + ccTo + \"&\") : \"\") +\n (bccTo ? ('bcc=' + bccTo + \"&\") : \"\") +\n 'subject=' + subject + \"&\" +\n 'body=' + emailBody;\n\n window.location = encodeURI(mailParamStr);\n}", "function obMail(a, b) {\n window.location.href = \"mail\" + \n \"to:\" + \n window.atob(a) +\n \"?subject=\" + \n escape(\"Mask Request from Mutual Aid Arlington\") +\n \"&body=\" + \n escape(b)\n ;\n}", "function sendMail() {\n let mailTransporter = nodemailer.createTransport({\n service: \"gmail\",\n auth: {\n user: \"prakharagarwal70@gmail.com\",\n pass: \"prakhar2121\"\n }\n });\n \n // Setting credentials\n let mailDetails = {\n from: \"prakharagarwal70@gmail.com\",\n to: \"sugam.agarwal1995@gmail.com\",\n subject: \"Test mail using Cron job\",\n text: \"Node.js cron job email\"\n + \" testing for GeeksforGeeks\"\n };\n \n \n // Sending Email\n mailTransporter.sendMail(mailDetails, \n function(err, data) {\n if (err) {\n console.log(\"Error Occurs\", err);\n } else {\n console.log(\"Email sent successfully\");\n }\n });\n}", "async function sendMail(req, res) {\n const transporter = nodemailer.createTransport({\n host: process.env.HOSTMAIL,\n port: process.env.PORTMAIL,\n secure: false,\n auth: {\n user: process.env.USERMAIL,\n pass: process.env.PASSMAIL,\n },\n tls: {\n rejectUnauthorized: false,\n },\n });\n\n try {\n const respostaAdmin = await transporter.sendMail({\n from: `${req.body.nome} <${req.body.email}>`,\n to: [process.env.USERMAIL],\n replyTo: req.body.email,\n subject: \"Novo cadastro - Newsletter Fortuna Digital\",\n text: \"\",\n html: `\n <strong>Nome:</strong> ${req.body.nome}\n <br />\n <strong>Email:</strong> ${req.body.email}`,\n });\n\n const respostaCliente = await transporter.sendMail({\n from: `Fortuna Digital <${process.env.USERMAIL}>`,\n to: [req.body.email],\n replyTo: process.env.USERMAIL,\n subject: \"Ebook Fortuna Digital\",\n text: \"\",\n html: `\n <div style=\"display: flex; align-items: center; justify-content: center;\">\n <img style=\"width: 40px; height: 40px; margin: 10px;\" src=\"http://fortunadigitalacademy.com.br/images/globo.png\" />\n <h1>FORTUNA DIGITAL</h1>\n </div>\n <h2><strong>Olá, ${req.body.nome}!</strong></h2>\n <p>Obrigado por se cadastrar em nossa newsletter.</p>\n <p><strong><a href=\"https://www.fortunadigitalacademy.com.br/ebook/EBOOK_FORTUNA_DIGITAL.pdf\">Clique aqui e baixe seu ebook gratuitamente.</a></strong></p>`,\n });\n\n console.log(respostaAdmin);\n console.log(respostaCliente);\n res.send(respostaAdmin);\n } catch (error) {\n res.send(error);\n }\n}", "async send(template, subject) {\n const html = pug.renderFile(`${__dirname}/email/${template}.pug`, {\n url: this.url,\n inviteCode: this.inviteCode,\n subject,\n });\n\n const mailOptions = {\n from: this.from,\n to: this.to,\n subject,\n html,\n text: htmlToText(html),\n };\n\n // This will be used when sending out invitation\n const mailOptions2 = {\n from: this.from,\n to: this.InviteEmail,\n subject,\n html,\n text: htmlToText(html),\n };\n\n if (this.InviteEmail !== '')\n await this.newTransport().sendMail(mailOptions2);\n else {\n await this.newTransport().sendMail(mailOptions);\n }\n }", "function sendEmail (obj) {\n return transporter.sendMail(obj);\n}", "function mail(options, extension=app.root)\n {\n if (typeof options !== 'object') {\n throw new TypeError('options object required for mail function');\n }\n return new Promise((resolve,reject) =>\n {\n var callback = (err,info) => {\n return err ? reject(err) : resolve(info);\n };\n if (options.view) {\n return extension.express.render(options.view, options.data || {}, function(err,html) {\n if (err) return reject(err);\n options.html = html;\n transport.sendMail(options,callback);\n });\n }\n return transport.sendMail(options,callback);\n });\n }", "function SendMail(options) {\n transporter.sendMail({...mailOptions, ...options}, function (error, info) {\n if (error) {\n console.log(error);\n } else {\n console.log('Email sent: ' + info.response);\n }\n });\n}", "function sendMailMotificationToUsers(emails, adId, adTitle, categoryName, expirationDate) {\n let toEmails = \"\";\n for (var i = 0; i < emails.length; i++) {\n toEmails += emails[i];\n if (i < emails.length - 1) {\n toEmails += \", \";\n }\n }\n\n var transporter = nodemailer.createTransport({\n service: 'gmail',\n auth: {\n user: 'sibiu.servicii.ro@gmail.com',\n pass: 'servicii.ro'\n }\n });\n\n var options = {\n viewEngine : {\n extname: '.hbs',\n layoutsDir: 'public/mail-templates/',\n defaultLayout : 'new-ad-template',\n partialsDir: 'public/mail-templates/'\n },\n viewPath: 'public/mail-templates',\n extName: '.hbs'\n };\n\n transporter.use('compile', hbs(options));\n\n var mailOptions = {\n from: 'sibiu.servicii.ro@gmail.com',\n // to: toEmails,\n to: toEmails + ', catacrisan_catacrsn@yahoo.com',\n subject: 'Au aparut noi cereri in zona ta',\n template: 'new-ad-template',\n context: {\n adId: adId,\n adTitle: adTitle,\n categoryName: categoryName,\n expirationDate: new Date(expirationDate).toLocaleString()\n }\n };\n\n transporter.sendMail(mailOptions, function (error, info) {\n if (error) {\n console.log(error);\n } else {\n console.log('Email sent: ' + info.response);\n }\n });\n}", "function sendMail(req, res, account, text, subject) {\r\n // Not the movie transporter!\r\n var transporter = nodemailer.createTransport(smtpTransport({\r\n host: \"mail.oitc.com.tw\",\r\n port: 25,\r\n auth: {\r\n user: smtp_username,\r\n pass: smtp_password\r\n }\r\n }));\r\n var text = text;\r\n var mailOptions = {\r\n\t from: smtp_username, // sender address\r\n\t to: account, // list of receivers\r\n\t subject: subject, // Subject line\r\n\t html: text //, // plaintext body\r\n\t // html: '<b>Hello world ✔</b>' // You can choose to send an HTML body instead\r\n\t};\r\n transporter.sendMail(mailOptions, function(error, info){\r\n if(error){\r\n console.log(error);\r\n res.json({\"state\": false});\r\n }else{\r\n console.log('Message sent: ' + info.response);\r\n res.json({\"state\": true});\r\n };\r\n\t});\r\n}", "function sendEmail(mailOptions, res){\n\n var smtpTransport = nodemailer.createTransport({\n service: \"\", //Set here the email service to use. E.g.: Gmail\n auth: {\n user: \"\", //Set here the email account of the selected service above. E.g.: A Gmail email address.\n pass: \"\" //Set here the password for the selected user account\n }\n });\n smtpTransport.sendMail(mailOptions,function(error,response){\n if(error){\n console.log(error);\n res.status(500).send({\n \"success\": false,\n \"message\": \"Error al enviar el email de confirmación\"\n });\n }\n else{\n res.status(200).send({\n \"success\": true,\n \"message\": \"Ruta enviada correctamente\"\n });\n }\n });\n\n }", "function sendEmail({html, onError, onSuccess, text, to, subject}) {\n const data = {from: secrets.emailUser, to, subject, html, text};\n transporter.sendMail(data, err => {\n if (err) {\n console.error('server.js sendEmail: err =', err);\n onError(JSON.stringify(err));\n } else {\n onSuccess();\n }\n });\n}", "sendEmail(email) {\n const transporter = nodemailer.createTransport({\n host: \"smtp.mailtrap.io\",\n port: 2525,\n auth: {\n user: \"72f2d0d5718ee1\",\n pass: \"0e2182e1ef430b\",\n },\n });\n\n const mailOptions = {\n from: \"french.bambin.library@gmail.com\",\n to: email.receiverEmail,\n subject: email.subject,\n text: \"That was easy!\",\n html:\n \"<b>Hey there! </b><br>\" +\n email.userMessage +\n \"<br /><br>To get in touch with \" +\n email.first_name +\n \", reply to: \" +\n email.senderEmail +\n \"<br />\",\n };\n\n transporter.sendMail(mailOptions, function (error, info) {\n if (error) {\n console.log(error);\n } else {\n console.log(\"Email sent: \" + info.response);\n }\n });\n }", "function sendEmail(body) {\n // note: be sure mail is configured properly\n // send an email with all possible infos\n var mail = require('child_process').spawn('mail', [\n '-s',\n '[testardo] ' + FULL_HOST,\n EMAIL\n ], {\n cwd: process.cwd(),\n env: process.env,\n detached: true,\n stdio: [\n 'pipe', 'pipe', 'pipe'\n ]\n });\n // what to do once the email has been sent\n mail.on('close', function(code) {\n // show something in the console\n if (code) {\n console.log('[WARNING] unable to send email via ' + EMAIL);\n } else if (SHOW_SUCCESS) {\n console.log('notification sent to ' + EMAIL);\n }\n // in case it should not loop ...\n if (DONT_LOOP) {\n // ... simply exit\n process.exit(1);\n }\n });\n // detach this process ...\n mail.unref();\n // ... and write the content\n mail.stdin.write(\n body, null, mail.stdin.end.bind(mail.stdin)\n );\n}", "async send(data) {\n const from = data.username;\n // 1) Render HTML based on a pug template\n if (!data.template) data.template = \"general\";\n\n const html = pug.renderFile(`${__dirname}/../views/email/${data.template}.pug`, {\n message: data.message,\n title: data.title \n });\n\n // 2) Define email options\n const msg = {\n to: data.email,\n from: email,\n subject: data.subject,\n text: data.message,\n html,\n text: htmlToText.fromString(html)\n };\n \n // 3) Create a transport and send email\n await sgMail.send(msg);\n }", "function useMail(s){\r\n s = s.replace(/\\s+/g, ''); // .replace(/\\[dot\\]/g,\".\")\r\n this.location.href = \"mailto://\" + s + \"?subject=link from fbt-mechatronik.de\" + iAM;\r\n} // useMail", "function sendMail(){ \n\tlogincontroller.logincheck(name,password,(err,data)=>{\n \tif(err) throw err;\n \telse{\n \t\tconsole.log(\"\\n------------------------------Compose Mail---------------------------------\\n\\n\")\n \t\tconsole.log(\"------------------------------------------------------------------------------\")\n \t\tconsole.log(\"Sender Name=> \"+data[0].name+\" ---------Sender Email ID => \"+data[0].emailid);\n \t\tconsole.log(\"------------------------------------------------------------------------------\")\n \t\tvar reciever = readline.question(\"Reciever Email Id => \");\n \t\tconsole.log(\"------------------------------------------------------------------------------\")\n \t\tvar subject = readline.question(\"Subject => \");\n \t\tconsole.log(\"------------------------------------------------------------------------------\")\n \t\tvar message = readline.question(\"Message = >\")\n \t\tconsole.log(\"------------------------------------------------------------------------------\\n\")\n\t\tmailcontroller.sendmail(data[0].emailid,reciever,subject,message,(err)=>{\n\t\t\tif(err) throw err;\n\t\t\telse{\n\t\t\t\tconsole.log(\"\\n---------Mail Sent Successfully---------\");\n\t\t\t\tconsole.log(\"\\n---------------------------Welcome \"+data[0].name+\"------------------------\");\n\t\t\t\thomeUI();\n\t\t\t}\n\t\t});\t\n\t\n \t}\n\n });\n\n}", "function sendMail(token, to, subject, content){\n getOAuth2ClientFromToken(token, function(err, oauth2Client) {\n if (err) {\n console.log('err:', err);\n } else {\n sendEmail(oauth2Client, to, subject, content, function(err, results) {\n if (err) {\n console.log('err:', err);\n } else {\n console.log(results);\n }\n });\n }\n });\n}", "function email(name){\n window.location.assign(\"mailto: \" + name);\n }", "function mail(firstName, lastName, email) { \n //use predefined auth variables to send email with Habitack gmail\n return transporter.sendMail({\n from: 'Habitack Team <habitack2020@gmail.com>', // sender address\n to: email, // list of receivers\n subject: \"Welcome to Habitack!\", // Subject line\n //body\n html: `<h1>Hello ${firstName} ${lastName},</h1> <br /> \n <p>Welcome to your journey towards self improvement! Below is an introduction guide to help get you started</p><br />\n <p>Habitack is a habit tracker designed to facilitate users with tracking goals that can change your life for the better. <br />\n Our job is to calculate your progress and show you results. Your job is to attack daily challenges with the help of habitack. </p> <br />\n <p>Pages: </p> <br />\n <ol> \n <li>Goals Page</li>\n <ul>\n <li>List goals for the user</li>\n <li>Add new goal</li>\n <li>Delete goal</li>\n <li>Add photo to goal</li>\n </ul>\n <li>Stats Page</li>\n <ul>\n <li>Display the stats for a current goal</li>\n </ul>\n <li>Account Page</li>\n <ul>\n <li>Change account information</li>\n </ul>\n </ol>`\n })\n .then(r => console.log(r))\n .catch(e => console.log(e))\n}", "function notify(data) {\n var mailOptions = {\n from: config.from,\n to: config.to, // comma separated list of receivers\n subject: config.subject, // Subject line\n html: '<b>' + data + '</b>' // html body};\n }\n smtpTransport.sendMail(mailOptions, function(err) {\n if (err)\n console.log(\"ohhh\", err);\n else\n \tconsole.log('Message sent.');\n\t});\n}", "function sendMail() {\n document.getElementById('contact-form').addEventListener('submit', async function (event) {\n event.preventDefault();\n const output = `\n <p>You have a new contact request</p>\n <h3>Contact Details</h3>\n <ul>\n <li>Name: ${this.name.value}</li>\n <li>Fone: ${this.fone.value}</li>\n <li>Email: ${this.email.value}</li>\n </ul>\n <h3>Message</h3>\n <p>${this.textMessage.value}</p>\n `;\n const nome = this.name.value;\n await Email.send({\n SecureToken: \"a1f72705-1616-4b97-adbc-332baa92ee34\",\n To: 'emporiosaudecuritiba@gmail.com',\n From: \"emporiosaudecuritiba@gmail.com\",\n\n Subject: this.subject.value,\n Body: output\n }).then(\n /* message => alert(`Obrigado pela visita Sr(a) ${nome}, entrarei em contato o mais breve possível!`) */\n message => modalSet('modal-confirm', `Obrigado pela visita Sr(a) ${nome}, entrarei em contato o mais breve possível! Tenha um excelente dia.`)\n );\n document.getElementById('contact-form').reset();\n });\n}", "async function sendRegisterationWelcomeMail(emailId){\n\n // Generate test SMTP service account from ethereal.\n console.log(\"yaha par dekhte hai : \"+__dirname);\n console.log(\"yaha par dekhte hai : \"+process.cwd());\n \n const file = await fs.readFile( path.join(process.cwd(),\"/public/html_mail/welcome.html\"),{\"encoding\":\"utf-8\"}).then((data)=>{\n \n console.log(\"parsing message file \");\n // console.log(data);\n return data;\n });\n\n const transporter = nodemailer.createTransport({\n // host: \"gmail\",\n service:\"gmail\",\n // port: 587,\n // secure: false, // true for 465, false for other ports\n auth: {\n user: process.env.OFFICIAL_MAIL_ID, \n pass: process.env.OFFICIAL_MAIL_PWD\n }\n });\n\n\n let info = await transporter.sendMail({\n from: process.env.OFFICIAL_MAIL_ID, // sender address\n to: emailId, // list of receivers\n subject: \" Welcome to community of blogsaw\", // Subject line\n html: file\n });\n}", "function sendEmail(to, subject, body, attachments, cb) {\n let transporter = nodemailer.createTransport({\n service: 'gmail',\n auth: {\n user: process.env.NODEMAILER_EMAIL,\n pass: process.env.NODEMAILER_PASSWORD\n }\n });\n\n transporter.sendMail({\n from: process.env.NODEMAILER_EMAIL,\n to: to,\n subject: subject,\n html: body,\n attachments: attachments\n }, (err, info) => {\n cb(err, info);\n });\n}", "async function main() {\r\n // Generate test SMTP service account from ethereal.email\r\n // Only needed if you don't have a real mail account for testing\r\n let testAccount = await nodemailer.createTestAccount();\r\n\r\n // create reusable transporter object using the default SMTP transport\r\n const transporter = nodemailer.createTransport({\r\n host: 'smtp.ethereal.email',\r\n port: 587,\r\n auth: {\r\n user: 'rey.kreiger36@ethereal.email',\r\n pass: 'MME2hAbsDsUvDVJ2e3'\r\n }\r\n});\r\n\r\n // send mail with defined transport object\r\n let info = await transporter.sendMail({\r\n from: 'Audiovideo@gmail.com', // sender address\r\n to: \"Usermail\" , // list of receivers\r\n subject: \"confirmatiom email\", // Subject line\r\n text: \"You have subscribed successfully\", // plain text body\r\n html: \"<b>Hello world?</b>\", // html body\r\n });\r\n\r\n console.log(\"Message sent: %s\", info.messageId);\r\n // Message sent: <b658f8ca-6296-ccf4-8306-87d57a0b4321@example.com>\r\n\r\n // Preview only available when sending through an Ethereal account\r\n console.log(\"Preview URL: %s\", nodemailer.getTestMessageUrl(info));\r\n // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...\r\n}", "function sendMail(from, toEmail, subject, body){\n\tvar ss = new com.ibm.cio.sendemail.MailBean();\n\tvar content =ss.sendMail(from,toEmail,subject,body);\n\treturn {\n\t\tresult : content\n\t};\n}", "function EnvoyerMail(Commentaire){\n Pool.then(Connection => {\n Connection.query('SELECT T_UTILISATEUR.UTI_MAIL FROM T_UTILISATEUR WHERE T_UTILISATEUR.STA_ID = 2', []).then(RowsUtilisateur => {\n for(let i in RowsUtilisateur){\n var SMTPTransport = Mailer.createTransport(\"SMTP\", {\n host: 'smtp.gmail.com',\n port: 465,\n secure: true, // use SSL\n auth: {\n user: \"adress2.essaye@gmail.com\",\n pass: \"tutur2408\"\n }\n });\n console.log(RowsUtilisateur[0][0]['UTI_MAIL']);\n var Mail = {\n from: \"adress2.essaye@gmail.com\",\n to: RowsUtilisateur[0][0]['UTI_MAIL'],\n subject: \"Signaler\"+ Commentaire +\" :\",\n html: \"Nous vous signalons que \"+ Commentaire +\" a été signalé.\"\n }\n SMTPTransport.sendMailt(Mail, (Erreur, Reponse) => {\n if(Erreur){\n return Reponse.status(500).json({Status: 500, Message: \"Le mail n'a pas été envoyé.\"});\n }else{\n return Reponse.status(500).json({Status: 500, Message: \"Le mail a été envoyé.\"});\n }\n SMTPTransport.close();\n });\n }\n });\n });\n}", "sendMail(options, msg) {\n\t\tthis.transporter.sendMail(options, (error) => {\n\t\t\tif (error) {\n\t\t\t\tconsole.log(error);\n\t\t\t} else {\n\t\t\t\tconsole.log(msg);\n\t\t\t}\n\t\t});\n\t}", "async function dispatchEmail(email) {\n const transporter = await nodemailer.createTransport({\n service: 'gmail',\n auth: {\n user: 'new.4049@gmail.com', // your email\n pass: '' // your email password\n }\n });\n const mailOptions = await {\n from: 'new.4049@gmail.com', // sender\n to: email.email, // list of receivers\n subject: 'ระบบยื่นคำร้องเข้าพบอาจารย์', // Mail subject\n html: '<b>สวัสดีนี่เป็นระบบตอบรับอัตโนมัติจากระบบยื่นคำร้องเข้าพบอาจารย์รหัสชองคุณคือ ' + email.code + '</b>' // HTML body\n };\n return transporter.sendMail(mailOptions);\n}", "async function main() {\n // Generate test SMTP service account from ethereal.email\n // Only needed if you don't have a real mail account for testing\n let testAccount = await nodemailer.createTestAccount();\n\n // create reusable transporter object using the default SMTP transport\n let transporter = nodemailer.createTransport({\n service: \"Gmail\",\n\n auth: {\n user: \"yuval2604\", // generated ethereal user\n pass: \"Yuval15230\" // generated ethereal password\n }\n });\n\n // send mail with defined transport object\n let info = await transporter.sendMail({\n from: from, // sender address\n to: to, // list of receivers\n subject: \"פגישה עם רופא\", // Subject line\n text: text // plain text body\n });\n\n console.log(\"Message sent: %s\", info.messageId);\n // Message sent: <b658f8ca-6296-ccf4-8306-87d57a0b4321@example.com>\n\n // Preview only available when sending through an Ethereal account\n console.log(\"Preview URL: %s\", nodemailer.getTestMessageUrl(info));\n // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...\n }", "async function sendUserDetails(){\nvar transporter = nodemailer.createTransport({\n host: \"smtp-mail.outlook.com\", // hostname\n secureConnection: false, // TLS requires secureConnection to be false\n port: 587, // port for secure SMTP\n tls: {\n ciphers:'SSLv3'\n },\n auth: {\n user: 'manu.kapoor@outlook.com',\n pass: 'Kapoor@91'\n }\n});\n// const emailCreated = myMod.emailCreated\n console.log(`email is from nodemailer ${myMod}`)\n const mailOptions = {\n from: 'manu.kapoor@outlook.com',\n to : 'manu.kapoor91@gmail.com',\n subject: 'Login credentials for Chatttel',\n text: \"Hello world? Manu\", // plain text body\n html: \"<div><label>Username:</div>\" // html body\n};\n\n // send mail with defined transport object\n\n let info = await transporter.sendMail(mailOptions, function(error, info){\n if (error) {\n console.log(error);\n } else {\n console.log('Email sent: ' + info.response);\n res.redirect('/');\n }\n });\n\n}", "function sendEmail(toEmailAddress, emailSubject, emailHtmlContent) {\n\n let mailOptions = {\n from: functions.config().gmail.email,\n to: toEmailAddress ? toEmailAddress : 'leminhtuan2015@gmail.com',\n subject: emailSubject ? emailSubject : 'Invite Email',\n text: 'Hello world',\n html: emailHtmlContent ? emailHtmlContent : '<b>Hello world?</b>'\n };\n\n console.log(\"mailTransport starting\")\n\n mailTransport.sendMail(mailOptions, (error, info) => {\n if (error) {\n console.log(\"mailTransport error\")\n\n return console.log(error);\n }\n });\n}", "function SendMail(object){\n\n\tconsole.log(\"Reached sendMail\");\n\n\t mailOptions = {\n\t from: '\"Statusphere Team\" <random12394123@gmail.com>', // sender address\n\t to: object.emailid, // list of receivers\n\t subject: object.subject,\n\t text: 'Your action is due!',\n\t html: object.message\n\t};\n\n\ttransporter.sendMail(mailOptions, (error, info) => {\n\t if (error) {\n\t return console.log(error);\n\t }\n\t console.log('Message %s sent: %s', info.messageId, info.response);\n\t});\n}", "async function main () {\n // send mail with defined transport object\n transporter.sendMail({\n from: email, // sender address\n to: 'melphelps@live.co.uk', // list of receivers\n subject: 'Client Enquiry', // Subject line\n html: message\n }, function (err) {\n if (err) {\n console.log(err)\n res.render('error')\n } else {\n console.log('Message sent successfully:')\n res.render('confirmation')\n }\n })\n }", "function postEmail(req, res, next) {\n var to = req.params.to;\n var subject = req.params.subject;\n var message = req.params.message;\n mail.sendMail(to, subject, message, false);\n return next();\n }", "function sendResetPassword(to, id,string){\r\n\r\n let link = \"https://wcu-surveytool.herokuapp.com/setPassword/\" + string ;\r\n //let link = \"http://localhost:3000/confirm/\" + randomString;\r\n //console.log(link);\r\n \r\n const msg = {\r\n to: to,\r\n from:\"wcu.SurveyTool@gmail.com\",\r\n subject: \"Password Reset\",\r\n text: \"Hello,\\nYou are recieving this email because you have requested a password reset \" + \r\n \"for wcu-surveytool website.\\n\\n\" +\r\n \"\\nLogin with this your new password here:\\t\" +link +\r\n \"\\n\\n--WCU-SurveyTool\"\r\n }\r\n \r\n sgMail.send(msg)\r\n .then(()=>{\r\n console.log(\"Email sent\")\r\n return true;\r\n })\r\n .catch(error=>{\r\n console.log(error);\r\n return false;\r\n })\r\n}", "function sendVerificationMail(token, email) {\n var mail = \"<body style='direction:rtl;'><a href='http://www.mh2.co.il/#/verify?string=\" + token + \"'>להפעלת המנוי לחץ כאן</a></body>\";\n var transporter = nodemailer.createTransport({\n service: 'Gmail',\n auth: {\n user: 'mhashekel@gmail.com', // Your email id\n pass: 'zflp6g43' // Your password\n }\n });\n var mailOptions = {\n from: 'mhashekel@gmail.com', // sender address\n to: email, // list of receivers\n subject: 'מייל אימות משתמש ממחצית השקל', // Subject line\n html: mail //, // plaintext body\n // html: '<b>Hello world ✔</b>' // You can choose to send an HTML body instead\n };\n transporter.sendMail(mailOptions, function (error, info) {\n if (error) {\n console.log(error);\n res.json({yo: 'error'});\n } else {\n //console.log('Message sent: ' + info.response);\n res.json({yo: info.response});\n }\n });\n }", "async function contactus(msg) {\n let transporter = nodemailer.createTransport(smtpTransport({\n host: \"mail.hiltonparkerng.com\",\n tls:{\n rejectUnauthorized: false\n },\n port: 465,\n secure: true,\n auth: {\n user: 'support@hiltonparkerng.com',\n pass: process.env.MAIL_PASSWORD \n },\n }));\n\n\n let info = await transporter.sendMail({\n from: '\"Hilton Parker Services\" <support@hiltonparkerng.com>',\n to: 'support@hiltonparkerng.com', \n subject: 'Contact us form',\n html: ` \n <!doctype html>\n <html>\n <head>\n <meta name=\"viewport\" content=\"width=device-width\">\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n <title>Simple Transactional Email</title>\n <style>\n /* -------------------------------------\n INLINED WITH htmlemail.io/inline\n ------------------------------------- */\n /* -------------------------------------\n RESPONSIVE AND MOBILE FRIENDLY STYLES\n ------------------------------------- */\n @media only screen and (max-width: 620px) {\n table[class=body] h1 {\n font-size: 28px !important;\n margin-bottom: 10px !important;\n }\n table[class=body] p,\n table[class=body] ul,\n table[class=body] ol,\n table[class=body] td,\n table[class=body] span,\n table[class=body] a {\n font-size: 16px !important;\n }\n table[class=body] .wrapper,\n table[class=body] .article {\n padding: 10px !important;\n }\n table[class=body] .content {\n padding: 0 !important;\n }\n table[class=body] .container {\n padding: 0 !important;\n width: 100% !important;\n }\n table[class=body] .main {\n border-left-width: 0 !important;\n border-radius: 0 !important;\n border-right-width: 0 !important;\n }\n table[class=body] .btn table {\n width: 100% !important;\n }\n table[class=body] .btn a {\n width: 100% !important;\n }\n table[class=body] .img-responsive {\n height: auto !important;\n max-width: 100% !important;\n width: auto !important;\n }\n }\n\n /* -------------------------------------\n PRESERVE THESE STYLES IN THE HEAD\n ------------------------------------- */\n @media all {\n .ExternalClass {\n width: 100%;\n }\n .ExternalClass,\n .ExternalClass p,\n .ExternalClass span,\n .ExternalClass font,\n .ExternalClass td,\n .ExternalClass div {\n line-height: 100%;\n }\n .apple-link a {\n color: inherit !important;\n font-family: inherit !important;\n font-size: inherit !important;\n font-weight: inherit !important;\n line-height: inherit !important;\n text-decoration: none !important;\n }\n #MessageViewBody a {\n color: inherit;\n text-decoration: none;\n font-size: inherit;\n font-family: inherit;\n font-weight: inherit;\n line-height: inherit;\n }\n .btn-primary table td:hover {\n background-color: #34495e !important;\n }\n .btn-primary a:hover {\n background-color: #34495e !important;\n border-color: #34495e !important;\n }\n }\n </style>\n </head>\n <body class=\"\" style=\"background-color: #f6f6f6; font-family: sans-serif; -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.4; margin: 0; padding: 0; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;\">\n <span class=\"preheader\" style=\"color: transparent; display: none; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;\">Contact us Mail</span>\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"body\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background-color: #f6f6f6;\">\n <tr>\n <td style=\"font-family: sans-serif; font-size: 14px; vertical-align: top;\">&nbsp;</td>\n <td class=\"container\" style=\"font-family: sans-serif; font-size: 14px; vertical-align: top; display: block; Margin: 0 auto; max-width: 580px; padding: 10px; width: 580px;\">\n <div class=\"content\" style=\"box-sizing: border-box; display: block; Margin: 0 auto; max-width: 580px; padding: 10px;\">\n\n <!-- START CENTERED WHITE CONTAINER -->\n <table class=\"main\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background: #ffffff; border-radius: 3px;\">\n\n <!-- START MAIN CONTENT AREA -->\n <tr>\n <td class=\"wrapper\" style=\"font-family: sans-serif; font-size: 14px; vertical-align: top; box-sizing: border-box; padding: 20px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;\">\n <tr>\n <td style=\"font-family: sans-serif; font-size: 14px; vertical-align: top;\">\n <p style=\"font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;\">Hi there,</p>\n <p style=\"font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;\">This is a contact us message.<br>\n Find the contact information below:<br>\n\n NAME : ${msg.name},<br>\n EMAIL: ${msg.email},<br>\n MESSAGE: ${msg.message}<br>\n\n \n <p style=\"font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;\">Kindly act upon...</p>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n\n <!-- END MAIN CONTENT AREA -->\n </table>\n\n <!-- START FOOTER -->\n <div class=\"footer\" style=\"clear: both; Margin-top: 10px; text-align: center; width: 100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;\">\n <tr>\n <td class=\"content-block\" style=\"font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; font-size: 12px; color: #999999; text-align: center;\">\n <span class=\"apple-link\" style=\"color: #999999; font-size: 12px; text-align: center;\">1 Rahman Adeboyejo St, Lekki Phase I, Lagos</span>\n </td>\n </tr>\n <tr>\n <td class=\"content-block powered-by\" style=\"font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; font-size: 12px; color: #999999; text-align: center;\">\n <a href=\"www.hiltonparkerng.com\" style=\"color: #999999; font-size: 12px; text-align: center; text-decoration: none;\">www.hiltonparkerng.com</a>.\n </td>\n </tr>\n </table>\n </div>\n <!-- END FOOTER -->\n\n <!-- END CENTERED WHITE CONTAINER -->\n </div>\n </td>\n <td style=\"font-family: sans-serif; font-size: 14px; vertical-align: top;\">&nbsp;</td>\n </tr>\n </table>\n </body>\n </html>\n `\n });\n\n}", "function sendEmail(err, html, text) {\n if (err) { return res.send(err.status_code, err); }\n if (!transport) { return res.send(500, { error: 'transport is not configured!'}); }\n transport.sendMail({\n from: config.email.from,\n to: user.email,\n subject: config.app.name + ': Reset Password Request',\n html: html,\n text: text }, done);\n }", "function pruebaemail(valor) {\n\tre = /^([\\da-z_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})$/\n\tif (!re.exec(valor)) {\n\t\talert('Formato de correo electónico erróneo, revíselo.');\n\t} else return;\n}", "async function main(){\r\n\r\n // Generate test SMTP service account from ethereal.email\r\n // Only needed if you don't have a real mail account for testing\r\n\r\n\r\n // create reusable transporter object using the default SMTP transport\r\n let transporter = nodemailer.createTransport({\r\n host: \"some host\",\r\n port: 465,\r\n secure: true, // true for 465, false for other ports\r\n auth: {\r\n user:\"some user\", // generated ethereal user\r\n pass:\"some password\" // generated ethereal password\r\n }\r\n });\r\n\r\n // setup email data with unicode symbols\r\n let mailOptions = {\r\n from: \"some user\",\r\n to: myMail, // list of receivers\r\n subject: myTask, // Subject line\r\n text: myTekst, // plain text body\r\n html: myTekst // html body\r\n\r\n };\r\n\r\n // send mail with defined transport object\r\n let info = await transporter.sendMail(mailOptions)\r\n\r\n console.log(\"Message sent: %s\", info.messageId);\r\n // Preview only available when sending through an Ethereal account\r\n console.log(\"Preview URL: %s\", nodemailer.getTestMessageUrl(info));\r\n\r\n // Message sent: <r.duga@concepts.hr>\r\n // Preview URL: Status change from 1 to 0\r\n}", "async function sendEmail(req, res, email_content, mail, updated){\n /* Set the email content */\n const mailDetails = {\n from: 'tabcore@outlook.com',\n to: mail,\n subject: 'Changes in Profile',\n text: email_content.text_content,\n html: email_content.html_content,\n attachments: [{\n filename: 'TABCORE_FOOTER.png',\n path: __dirname + '/../views/assets/img/email/TABCORE_FOOTER.png',\n cid: 'tabcore_attach.png'\n }]\n };\n /* Send the email */\n transpo.sendMail(mailDetails, async function(err, result){\n if(err){\n req.session.message = email_content.error_mess;\n goMessage(req, res);\n }else{\n req.session.message = email_content.success_mess;\n goMessage(req, res);\n }\n });\n}", "async function main(mailId,Id,pass){\n\n const cryptr = new Cryptr(pass);\n decrptionkey=pass; \n console.log(\"decryption key is \"+decrptionkey)\n let crptID=cryptr.encrypt(Id);\n\n \n let transporter=nodemailer.createTransport({\n service:'gmail',\n auth:{\n user:'lokhandeabhijeet11187@gmail.com',\n pass:\"Abhi@11187\"\n }\n });\n var mailOptions={\n from:'lokhandeabhijeet11187@gmail.com',\n to:mailId,\n subject:'Reset Password Link',\n text:`Click below link to Reset Your password\n\n http://localhost:4200/auth/reset/`+crptID\n }\n transporter.sendMail(mailOptions,function(error,info){\n if(error){\n console.log(error);\n }\n else{\n console.log(\"Mail send \"+info.response);\n }\n });\n\n // let testAccount = await nodemailer.createTestAccount();\n // let transporter = nodemailer.createTransport({\n // host: \"smtp.ethereal.email\",\n // port: 587,\n // secure: false, \n // auth: {\n // user: testAccount.user, \n // pass: testAccount.pass \n // }\n // });\n\n // let info = await transporter.sendMail({\n // from: '\"Fred Foo 👻\" <foo@example.com>', // sender address\n // to: \"bar@example.com, baz@example.com\", // list of receivers\n // subject: \"Hello ✔\", // Subject line\n // text: \"Hello world?\", // plain text body\n // html: \"<b>Hello world?</b>\" // html body\n // });\n\n}", "function sendMail(Email, whatTOsend) {\n\n let transporter = nodemailer.createTransport({\n service: 'Gmail',\n auth: {\n user: process.env.email_USER, // generated user\n pass: process.env.email_Pass // generated password\n }\n });\n\n // setup email data with unicode symbols\n let mailOptions = {\n from: '\"Beer Project\" <' + process.env.email_USER + '>', // sender address\n to: Email, // list of receivers\n subject: 'Beer Blog ✔', // Subject line\n text: whatTOsend.text, // plain text body\n html: whatTOsend.html // html body\n };\n\n // send mail with defined transport object\n transporter.sendMail(mailOptions, function (error, info) {\n if (error) {\n console.log(error);\n } else {\n console.log('Email sent: ' + info.response);\n console.log('Email address: ' + mailOptions.to);\n\n }\n });\n\n}", "function sendMail(txt) {\n var MAIL_INFO = {\n from: gmailconfig.auth.user,\n to: gmailconfig.auth.user, // send to myself\n subject: 'Twitter Bot Here!',\n text: txt\n };\n transporter.sendMail(MAIL_INFO, emailSent)\n}", "function sendMail(name, email, message) {\n const transporter = nodemailer.createTransport({\n service: \"Yahoo\",\n host: \"smtp.mail.yahoo.com\",\n port: 465,\n secure: false,\n auth: {\n user: process.env.EMAILUSER,\n pass: process.env.EMAILPWD\n },\n debug: false,\n logger: true\n });\n\n return transporter.sendMail({\n from: `Contact Page <${process.env.EMAILUSER}@yahoo.com>`,\n to: process.env.TARGETEMAIL,\n subject: `Portfolio contact from ${name}`,\n text: `${message}\n \n Email: ${email}`\n });\n}", "function mailSend(emailVal){\r\n console.log(emailVal)\r\n var mailOptions = {\r\n\r\n from: process.env.mail_userName,\r\n to: emailVal,\r\n subject: process.env.mail_sub,\r\n text: process.env.mail_txt\r\n };\r\n mailChain.sendMail(mailOptions, function (error, info) {\r\n if (error) {\r\n errorCatch(error, \"ConfigurationError\",\"Pending\");\r\n }\r\n else {\r\n console.log('Email sent: ' + info.response);\r\n }\r\n });\r\n console.log('running a task every 1 minute');\r\n}", "function enviar_email(){\n\t\n\tvar ta= $(\".texemail\").val();\n\t\n\t\t$.ajax({\n\t\t\turl:\"enviar_correo.php\",\n\t\t\ttype:\"post\",\n\t\t\tdata:\"correo=\"+$(\"#selectmultiple\").val()+\"&mens=\"+ta+\"&info=\"+2,\n\t\t\tbeforeSend:function(){\n\t\t\t\t$(\"#enviar_email\").attr(\"disabled\",\"disabled\");\n\t\t\t\t$('.validar').html(\"<span class='mensajes_info_correo'>Enviando...</span>\");\n\t\t\t},\n\t\t\tsuccess:function(data){\n\t\t\t\t$('.validar').html(data);\n\t\t\t\t$(\"#enviar_email\").removeAttr(\"disabled\");\n\t\t\t}\n\t\t});\n}", "function sendMail(fromMailAddress,subject, message,attachments) {\n\n\tvar port = MFP.Server.getPropertyValue(\"drivers_and_vehicles_mail_port\");\n\tvar host = MFP.Server.getPropertyValue(\"drivers_and_vehicles_mail_host\");\n\tvar toMailAddress = MFP.Server.getPropertyValue(\"drivers_and_vehicles_mail_toMailAddress\");\n\tvar user = null;\n\ttry {user = MFP.Server.getPropertyValue(\"drivers_and_vehicles_mail_user\");} catch(ex){}\n\tvar pass = null;\n\ttry {pass = MFP.Server.getPropertyValue(\"drivers_and_vehicles_mail_pass\");} catch(ex){}\n\tvar sendEmail = new com.ibm.drivers_and_vehicles.MailSender();\n\tvar sendNewEmail= sendEmail.sendNewEmail(host,port,toMailAddress,user,pass,fromMailAddress,subject, message,JSON.stringify(attachments));\n\treturn {isSent : sendNewEmail};\n}", "function email(owner){\n var transporter = nodemailer.createTransport({\n service: 'gmail',\n auth: {\n user: 'yogita.uc@gmail.com', // your email here\n pass: 'urbanclap' // your password here\n }\n });\n\n /**\n * @param {JSON} owner captures the JSON named postData\n * in the admin.controller.js file of client end\n */\n\n var filePath = path.join(__dirname, '../../views/mail.html');\n fs.readFile(filePath, 'utf-8', (error, data) => {\n /**\n * Read the sample file that serves as a skeleton for the mail\n */\n\n var keys = Object.keys(owner);\n keys.forEach(function(key){\n data = data.replace(new RegExp('owner.' + key, \"g\"), owner[key]);\n });\n\n var mailFrom = 'yogita.uc@gmail.com'\n var mailOptions = {\n to: owner.email, // your email here\n subject: 'Registeration with gabfest',\n from: mailFrom,\n sender: mailFrom,\n html: data\n };\n\n transporter.sendMail(mailOptions, function(err, info){\n if (err) {\n \n }else{\n\n }\n });\n\n });\n\n}", "function sendEmail(to, text){\n client.send(\n {\n text,\n from : 'Ethereum ethereumblockchain@gmail.com',\n to: `Customer ${to}`,\n subject: 'Booking With Blockchain BWB',\n },\n (err,msg) => {\n console.log(err);\n console.log(msg);\n }\n );\n}", "async function sendMailToUser(user, token, type) {\n let transporter = nodemailer.createTransport({\n host: \"smtp.gmail.com\",\n port: 587,\n secure: false, // true for 465, false for other ports\n auth: {\n user: mail.user, // generated ethereal user\n pass: mail.psw // generated ethereal password\n }\n });\n console.log(type);\n const front_end_endpoint = \"http://localhost:3000/reset?token=\"\n const back_end_endpoint = \"http://localhost:5000/api/emailservice/confirm?token=\"\n // send mail with defined transport object\n if (type == RESETPSW) {\n let info = await transporter.sendMail({\n from: '\"Hiệu trưởng Quân\" <serverlibraryute@gmail.com>', // sender address\n to: user.email, // list of receivers\n subject: \"Reset Pasword\", // Subject line\n text: \"Click the below link to reset password\", // plain text body\n html: \"<b>Remember don't share this link to another people</b><br/>Link: \" + front_end_endpoint + token // html body\n })\n }\n if (type == VERIFY) {\n let info = await transporter.sendMail({\n from: '\"Hiệu trưởng Quân\" <serverlibraryute@gmail.com>', // sender address\n to: user.email, // list of receivers\n subject: \"Verify Mail\", // Subject line\n text: \"Thank you for using our service\", // plain text body\n html: \"<b>Click the link below to verify</b><br>Link: \"+ back_end_endpoint+token\n })\n }\n}", "send ( tplName, subject, data ) {\n var email = this._tpl( tplName, data );\n\n return {\n to: ( to_address ) => {\n return this._email({\n Destination: {\n ToAddresses: [ to_address ]\n },\n Message: {\n Body: {\n Html: {\n Data: email.html\n },\n Text: {\n Data: email.text\n }\n },\n Subject: {\n Data: subject\n }\n },\n Source: this._fromAddress\n });\n }\n };\n }", "function sendEmail(e) {\n e.preventDefault();\n emailjs\n .sendForm(\n \"service_detp45p\",\n \"template_23zv4dw\",\n e.target,\n \"user_hV8uzE2oGvxy4MCE4JnvA\"\n )\n .then(\n (result) => {\n console.log(\"email sent\");\n },\n (error) => {\n console.log(error.text);\n }\n );\n }", "function sendMail(to,user,tempPassword){\r\n let randomString;\r\n if(user == null){\r\n const slash = /\\//gi;\r\n const period =/\\./gi\r\n randomString = bcrypt.hashSync(to, bcrypt.genSaltSync(9));\r\n randomString = randomString.replace(slash,\"\");\r\n randomString = randomString.replace(period,\"\");\r\n }\r\n else{\r\n //console.log(\"getting from user\")\r\n randomString = user.confirmCode;\r\n }\r\n let link = \"https://wcu-surveytool.herokuapp.com/confirm/\" + randomString;\r\n //let link = \"http://localhost:3000/confirm/\" + randomString;\r\n //console.log(link);\r\n \r\n var msg = {\r\n to: to,\r\n from:\"wcu.SurveyTool@gmail.com\",\r\n subject: \"Confirmation\",\r\n text: \"Hello,\\nYou are recieving this email because you have been registered \" + \r\n \"for wcu-surveytool website.\\n\\n\" +\r\n \"Please verify your email address using this link below \"+ link +\r\n \"\\n\\n--WCU-SurveyTool\"\r\n }\r\n if(tempPassword != null){\r\n link = \"https://wcu-surveytool.herokuapp.com/setPassword/\" + tempPassword;\r\n msg = {\r\n to: to,\r\n from: \"wcu.SurveyTool@gmail.com\",\r\n subject: \"Confirmtion\",\r\n text: \"Hello,\\nYou are recieving this email because you have been registered \" + \r\n \"for wcu-surveytool website.\\n\\n\" +\r\n \"Please verify your email address using this link below \"+ link +\r\n \"\\n\\n--WCU-SurveyTool\"\r\n }\r\n }\r\n sgMail.send(msg)\r\n .then(()=>{\r\n console.log(\"Email sent\")\r\n })\r\n .catch(error=>{\r\n console.log(error);\r\n })\r\n if(user == null){\r\n return randomString;\r\n }\r\n}", "async send(options) {\n // 1) Parse HTML\n const html = await util.promisify(fs.readFile)(\n `${__dirname}/../mail_templates/${options.templateName}.html`,\n {\n encoding: 'utf-8',\n }\n );\n\n let ParsedHtml = html.replace('{%URL%}', this.url);\n\n if (options.organization) {\n ParsedHtml = ParsedHtml.replace('{%ORG_NAME%}', options.organization.name);\n ParsedHtml = ParsedHtml.replace(\n '{%ORG_PROFILE__PICTURE%}',\n options.organization.profilePicture\n );\n }\n\n // 2) Define email options\n const mailOptions = {\n from: this.from,\n to: this.to,\n subject: options.subject,\n html: ParsedHtml,\n text: options.plainText,\n };\n\n // 3) Create a transport and send email\n await this.newTransport().sendMail(mailOptions, function (error, info) {\n if (error) {\n console.log('Email error: ' + error.message);\n } else {\n console.log('Email sent to: ' + mailOptions.to);\n }\n });\n }", "async function sendEmail(details, receiver) {\n console.log(receiver, 'RECEIVER EMAIL')\n // create reusable transporter object using the default SMTP transport\n let transporter = nodemailer.createTransport({\n pool: true,\n host: 'cmail01.mc-host24.de',\n port: 25,\n secure: false, // true for 465, false for other ports\n auth: {\n user: drgnNoreplyEmail.user, // generated ethereal user\n pass: drgnNoreplyEmail.password // generated ethereal password\n }\n });\n\n const username = await getUserByToken(details.dragonflyToken)\n\n // setup email data with unicode symbols\n let mailOptions = {\n from: `\"Dragonfly Store\" ${drgnNoreplyEmail.user}`, // sender address\n // bcc: `${receiver}, admin@inceptioncloud.net`, list of receivers\n to: receiver,\n subject: 'Order confirmation', // Subject line\n text: `Hey ${username}, thank you for purchasing ${details.itemName} from our Shop.`,\n html: `\n<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Document</title>\n</head>\n<style>\n @import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700&display=swap');\n\n * {\n font-family: Rubik;\n }\n\n * {\n font-size: 1rem;\n }\n\n a[href] {\n color: #15c;\n }\n\n b,\n strong {\n font-weight: 500;\n }\n</style>\n\n<body>\n <div>\n\n <table cellpadding=\"0\" cellspacing=\"0\" style=\"border-radius:4px;border:1px #ccc solid;font-size:12.8px\"\n border=\"0\" align=\"center\">\n <tbody>\n <tr>\n <td colspan=\"3\" height=\"20\"></td>\n </tr>\n <tr style=\"line-height:0px;\">\n <td width=\"100%\" style=\"font-size:0px;\" align=\"center\" height=\"1\">\n <img width=\"40px\" style=\"max-height:73px;width:160px\" alt=\"\"\n src=\"https://playdragonfly.net/assets/Dragon.png\" class=\"CToWUd hoverZoomLink\">\n </td>\n </tr>\n <tr>\n <td>\n <table cellpadding=\"0\" cellspacing=\"0\" style=\"line-height:25px\" border=\"0\" align=\"center\">\n <tbody>\n <tr>\n <td colspan=\"3\" height=\"20\"></td>\n </tr>\n <tr>\n <td width=\"36\"></td>\n <td width=\"454\" align=\"left\" valign=\"top\">\n <p>Hey <b>${username}</b>,</p>\n <p><span>Thank you for your purchase! This email confirms that we have received\n your\n payment and you should receive your items soon. If you do not receive\n your\n items within the next hour, please contact our support. Please do not\n email\n Mojang.</span></p>\n\n <p>\n <strong>Order summary: </strong>\n </p>\n <p>\n </p>\n <ul>\n <li>1 <b>x</b> ${details.itemName}</li>\n </ul>\n <div><b>Total</b>: <b>${convertToEuros(details.receivedAmount).toFixed(2)} ${(details.receivedCurrency).toUpperCase()}</b></div>\n <p>For further questions we are available on our <a href=\"https://icnet.dev/discord\">Discord</a> server and by <a href=\"mailto:support@playdragonfly.net\">email</a>.\n </p>\n <a href=\"https://store.playdragonfly.net/?utm_source=store&utm_medium=email&utm_campaign=purchase_confirmation\" target=\"_blank\">Store</a> - <a href=\"https://ideas.playdragonfly.net/?utm_source=store&utm_medium=email&utm_campaign=purchase_confirmation\" target=\"_blank\">Ideas</a> - <a href=\"https://playdragonfly.net/releasenotes?utm_source=store&utm_medium=email&utm_campaign=purchase_confirmation\" target=\"_blank\">Updates</a>\n </td>\n <td width=\"36\"></td>\n </tr>\n <tr>\n <td colspan=\"3\" height=\"36\"></td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n</body>\n\n</html>\n` // html body\n };\n\n // send mail with defined transport object\n transporter.sendMail(mailOptions, (error, info) => {\n if (error) {\n return console.log(error);\n }\n console.log('EMAIL SENT')\n console.log(moment().format('MMMM Do YYYY, h:mm:ss a') + \" | \" + `Message sent! Accepted Emails: ${info.accepted}, Rejected Emails: ${info.rejected}, Message time: ${info.messageTime}`);\n });\n}", "async function sendEmail(request) {\n const { email, id } = request;\n // console.log('useremail and id', email,id);\n console.log('jasEmailjasEmailjasEmailjasEmailjasEmailjasEmailjasEmail');\n console.log(jasEmail);\n\n // Generate test SMTP service account from ethereal.email\n // Only needed if you don't have a real mail account for testing\n // let testAccount = await nodemailer.createTestAccount();\n\n // create reusable transporter object using the default SMTP transport\n let transporter = nodemailer.createTransport({\n service: 'gmail',\n auth: {\n user: jasEmail.email, // generated ethereal user\n pass: jasEmail.password // generated ethereal password\n }\n });\n\n // send mail with defined transport object\n let info = await transporter.sendMail({\n from: jasEmail.email, // sender address\n to: email, // list of receivers\n subject: \"Jas-Team Reset Password\", // Subject line\n text: \"\", // plain text body\n html: `<p>To reset your password please click on this link : <a href=\"http://localhost:3000/reset/${id}\">Reset LINK</a> </p>` // html body\n });\n\n console.log(\"Message sent: %s\", info.messageId);\n // Message sent: <b658f8ca-6296-ccf4-8306-87d57a0b4321@example.com>\n\n // Preview only available when sending through an Ethereal account\n console.log(\"Preview URL: %s\", nodemailer.getTestMessageUrl(info));\n // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...\n}", "function sendEmail(from, to, subject, body){\n\n var email_lines = [];\n email_lines.push('From: \"' + from + '\" <support@etdrisk.com>');\n email_lines.push('To: ' + to);\n email_lines.push('Content-type: text/html;charset=iso-8859-1');\n email_lines.push('MIME-Version: 1.0');\n email_lines.push('Subject: ' + subject);\n email_lines.push('');\n email_lines.push(body);\n\n var email = email_lines.join('\\r\\n').trim();\n\n var base64EncodedEmail = new Buffer(email).toString('base64');\n base64EncodedEmail = base64EncodedEmail.replace(/\\+/g, '-').replace(/\\//g, '_');\n\n let auth = oAuth2Client\n const gmail = google.gmail({\n version: 'v1',\n auth\n });\n\n gmail.users.messages.send({\n userId: 'me',\n resource: {raw: base64EncodedEmail}\n }, (err,res) => {\n if(err){\n console.log(err);\n }\n else{\n console.log(res);\n }\n });\n}", "function emailsentPOST(req,res){\n\n var transport = nodemailer.createTransport({\n service: 'Gmail',\n auth: {\n user: 'cs.carikosidaman@gmail.com',\n pass: 'bisnissukses'\n }\n });\n\n var html = \"\";\n html = html + \"Name : \" + req.body.name + \" (\"+req.body.email+\")<br>\";\n html = html + \"Date : \" + Date.now().toString() + \"<br>\";\n html = html + \"Subject : \" + req.body.subj + \"<br><br>\";\n html = html + \"-- Message -- <br><br>\" + req.body.subj + \"<br><br>\";\n html = html + req.body.msg;\n\n var mailOptionsAdmin = {\n from : 'cs.carikosidaman@gmail.com',\n to : 'helena_nt@live.com',\n subject : 'Cari Kos Idaman - Contact Form',\n html : html\n };\n var mailOptionsAdminDar = {\n from : 'cs.carikosidaman@gmail.com',\n to : 'darwan318@gmail.com',\n subject : 'Cari Kos Idaman - Contact Form',\n html : html\n };\n var mailOptionsSender = {\n from : 'cs.carikosidaman@gmail.com',\n to : req.body.email,\n subject : 'Cari Kos Idaman - Contact Form',\n html : \"Thank you for contacting us. We've received your email. Here's a copy of your mail: <br><br><br>\" + html\n };\n\n transport.sendMail(mailOptionsAdmin, function(err,info){ // ni buat ngirim ke email elu\n if(err) throw err;\n \n transport.sendMail(mailOptionsSender, function(err,i){ // bakal ngirim ke (sesuai dengan inputan di form nya) :te\"st) test local dlu aja ba\n if (err) throw err;\n res.redirect(\"/\");\n });\n\n });\n \n}", "preparingEmailSending() {\n const url = 'mailto:' + this.state.email + '?subject=Your Storj mnemonic&body=' + this.state.mnemonic;\n Linking.openURL(url); \n }", "async function sendMail() {\r\n try{\r\n //Generating the access token\r\n const accessToken = await oAuth2Client.getAccessToken()\r\n //Using the nodemailer to transport the mail\r\n const transport = nodemailer.createTransport({\r\n service: 'gmail',\r\n //Auth Object\r\n auth: {\r\n type: 'OAuth2',\r\n user: 'jatingautam1999@gmail.com',\r\n clientId: CLIENT_ID,\r\n clientSecret : CLIENT_SECRET,\r\n refreshToken: REFRESH_TOKEN,\r\n accessToken: accessToken\r\n }\r\n })\r\n\r\n//Options for the email\r\n const mailOptions = {\r\n from: 'jatingautam1999@gmail.com>',\r\n to: 'jatin.gautam.16.11.99@gmail.com',\r\n subject: \"Hello from gmail using API\",\r\n text: \"Hello from gmail, sending mail using API.\",\r\n html: '<h1>Hello from gmail, sending mail using API</h1>'\r\n };\r\n\r\n const result = await transport.sendMail(mailOptions);\r\n return result;\r\n\r\n }\r\n catch (error) {\r\n return error;\r\n }\r\n}" ]
[ "0.7406498", "0.735994", "0.72295904", "0.717204", "0.69913733", "0.69899565", "0.69208515", "0.6917294", "0.68351334", "0.6826788", "0.6814951", "0.68142515", "0.6793635", "0.6778371", "0.6769644", "0.67521346", "0.67255914", "0.6719065", "0.6702579", "0.66970706", "0.6693941", "0.6689913", "0.66889334", "0.6665383", "0.6653011", "0.66472197", "0.6646648", "0.66339403", "0.66333944", "0.6633331", "0.66307044", "0.65982944", "0.65908134", "0.6584587", "0.6577914", "0.6564517", "0.6563604", "0.6552717", "0.65417457", "0.6525105", "0.6514153", "0.6512513", "0.65103304", "0.65063226", "0.6501179", "0.650068", "0.64906347", "0.64640874", "0.64639586", "0.6462449", "0.64612836", "0.6459613", "0.6453989", "0.6448434", "0.6441595", "0.64293", "0.64279443", "0.6427855", "0.642667", "0.6422324", "0.64217925", "0.6418103", "0.6411532", "0.6408028", "0.6406164", "0.6402158", "0.64007324", "0.63908905", "0.6386853", "0.63847834", "0.6371209", "0.6369105", "0.63685346", "0.6366569", "0.6360699", "0.6354863", "0.63535357", "0.6350407", "0.6349456", "0.63453186", "0.6341901", "0.6337981", "0.63373023", "0.6332829", "0.63161695", "0.63137186", "0.6310401", "0.6307234", "0.6302884", "0.6300443", "0.6297601", "0.629674", "0.6295426", "0.6292192", "0.6285939", "0.62843555", "0.6280993", "0.6280936", "0.628087", "0.62775606" ]
0.6984253
6
function to show notes according to user id
function showNotesById(userid) { let notesElem = document.getElementById("notes"); let html = ""; let userObj = { userid: userid, }; var data = Object.keys(userObj) .map(function (key) { return key + "=" + userObj[key]; }) .join("&"); fetch("http://localhost:8081/php-notes-app/show-notes-by-id.php", { method: "POST", body: data, headers: { "Content-Type": "application/x-www-form-urlencoded" } }) .then((response) => response.json()) .then((data) => { for (let i = 0; i < data.length; i++) { if (data[i].userid == userid) { // let result; let description = data[i].text; console.log(description); let maxLength = 40; let result = description.length > 40 ? description.substring(0, maxLength) + "..." : description; html += `<div class="noteCard card col-md-3" style="margin: 7px 7px";> <div class="card-body rounded"> <div class="texts"> <h6 class="card-title text-white text-wrap">${data[i].title} </h6> <p class="card-text text-white">${result}</p> </div> <button id="${data[i].id}" class="btns delete text-center" onclick="deleteNote(this.id)" ><i class="fa fa-trash-o" aria-hidden="true"></i> </button> <button id="${data[i].id}" class="btns edits text-center" onclick="editNote(this.id)" data-toggle="modal" data-target="#exampleModalCenter"><i class="fa fa-pencil" aria-hidden="true"></i> </button> </div> </div>`; notesElem.innerHTML = html; } } if (data.length == 0) { notesElem.innerHTML = `<div class="col-md-6 alert alert-warning container-fluid mx-auto" role="alert"> Nothing to show. Please use <a href="#" class="alert-link">'Add a Note'</a> button to add notes!' </div>`; } }) .catch((error) => { console.log("error: ", error); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getnotes(userid) {\n\n $.get(\"/api/usernotes/\" + userId, function(data) {\n console.log(\"notes\", data);\n notes = data;\n if (!notes || !notes.length) {\n displayEmpty(userid);\n }\n else {\n initializeRows();\n }\n });\n }", "function getNotes(userId) {\n console.log(userId);\n const userRef = firebase.database().ref(`users/${userId}`);\n userRef.on('value', snapshot => {\n writeNotestoHTML(snapshot.val());\n });\n}", "function getAllNotes(userId) {\n return Note.find({ creator_id: userId }).exec();\n}", "function renderNotes(user) {\n db.collection('notes').where('UID', '==', user.uid).orderBy('created').get().then((snapshot) => {\n\n snapshot.docs.forEach(doc => {\n\n data = doc.data();\n subject = data.subject;\n pinned = data.pinned\n note = data.note\n id = doc.id\n\n // console.log(\"Rendering notes: \" + id, subject, note, pinned);\n\n if (pinned == true) {\n generatePinnedNoteTemplate(note, id)\n }\n generateNoteTemplate(note, subject, id);\n })\n })\n}", "function showNote() {\n $('#note').empty();\n let id = this.id;\n let note = createDiv(\"noteDiv\", data.players[id - 1].note)\n $('#note').append(note);\n }", "function edit_notes_show_report(userid, notes_id, notes_type) \n\t\t\t{\n\t\t\t\tjQuery(\"#message\").html(\"\");\n\t\t\t\tjQuery(\"#edit_notes_div\").html(\"\");\n\t\t\t\tjQuery(\"#edit_notes_div\").html(\"<img src='../images/ajax-loader.gif'/>\");\n\t\t\t\tjQuery.get('edit_notes_show_report.php?userid='+userid+'&notes_id='+notes_id+'&notes_type='+notes_type, function(html){\n\t\t\t\t\t\n\n\t\t\t\t\t// console.log(html);exit();\n\t\t\t\t\t//console.log(html);exit();\n\t\t\t\t\tjQuery(\"#edit_notes_div\").html(html);\n\t\t\t\t\t$('textarea').summernote({\n\t\t\t\t\t\t toolbar: [\n\t\t\t\t\t\t //[groupname, [button list]]\n\t\t\t\t\t\t ['style', ['bold', 'italic', 'underline']],\n\t\t\t\t\t\t ['fontsize', ['fontsize']],\n\t\t\t\t\t\t ['para', ['ul', 'ol', 'paragraph']],\n\t\t\t\t\t\t ],\n\t\t\t\t\t\t height:200\n\t\t\t\t\t\t});\n\t\t\t\t\tsync_to_v2();\n\t\t\t\t});\n\t\t\t\t\n\t\t\t}", "function showNotes() {\r\n let notes = localStorage.getItem(\"notes\");\r\n if (notes == null) {\r\n notesObj = [];\r\n } else {\r\n notesObj = JSON.parse(notes);\r\n }\r\n let html = \"\";\r\n notesObj.forEach(function(element, index) {\r\n html += `<div id=\"note\" class=\"noteCard\">\r\n <h3 class=\"note-title\">${element.title}</h3>\r\n <p class=\"note-text\"> ${element.text}</p>\r\n <p class=\"card-textone\">${element.textone}</p>\r\n <button id=\"${index}\"onclick=\"deleteNote(this.id)\" class=\"btn btn-primary\" id=\"addBtn\">Delete Note</button>\r\n\t\t\t <button id=\"${index}\"onclick=\"editNote(this.id)\" class=\"btn btn-primary\" id=\"addBtn\" >Edit Note</button>\r\n </div> `;\r\n });\r\n let notesElm = document.getElementById(\"notes\");\r\n if (notesObj.length != 0) {\r\n notesElm.innerHTML = html\r\n\t} else {\r\n notesElm.innerHTML = `Nothing to show! Use \"Add a Note\" section above to add notes.`;\r\n }\r\n \r\n}", "function getNotesForReportee(userId){\n\tvar success = function(data){ addNotesToReporteeList(data); }\n\tvar error = function(error){}\n\t\n\tgetNotesAction(userId, success, error);\n}", "function showNotes() {\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n let html = \"\";\n notesObj.forEach(function(element, index) {\n html += `\n <div class=\"note\">\n <p class=\"note-counter\">Note ${index + 1}</p>\n <h3 class=\"note-title\"> ${element.title} </h3>\n <p class=\"note-text\"> ${element.text}</p>\n <button id=\"${index}\"onclick=\"deleteNote(this.id)\" class=\"note-btn\">Delete Note</button>\n <button id=\"${index}\"onclick=\"editNote(this.id)\" class=\"note-btn edit-btn\">Edit Note</button>\n </div>\n `;\n });\n let notesElm = document.getElementById(\"notes\");\n if (notesObj.length != 0) {\n notesElm.innerHTML = html;\n } else {\n notesElm.innerHTML = `No Notes Yet! Add a note using the form above.`;\n }\n}", "function showNotes() {\r\n let notes = localStorage.getItem(\"notes\");\r\n if(notes == null){\r\n notesObj = [];\r\n }\r\n else{\r\n notesObj = JSON.parse(notes);\r\n }\r\n let html = \"\";\r\n notesObj.forEach(function(element, index) {\r\n html += `\r\n <div class=\"noteCard my-2 mx-2 card\" style=\"width: 18rem;\">\r\n <div class=\"card-body\">\r\n <h4 class=\"card-title\">NOTE ${index + 1}</h4>\r\n <p class=\"card-text\"> ${element}</p>\r\n <button id=\"${index}\" onclick=\"deleteNote(this.id)\" class=\"btn btn-primary\">Delete Note</button>\r\n </div>\r\n </div> `;\r\n //<button id=\"${index}\" onclick=\"editNote(this.id)\" class=\"btn btn-primary\">Edit Note</button>\r\n });\r\n let notesElm = document.getElementById('notes');\r\n if(notesObj.length != 0){\r\n notesElm.innerHTML = html;\r\n }\r\n else {\r\n notesElm.innerHTML = `<h1 style= \"color: #FFF;\">Nothing To Show! Use \"Add A Note\" section above to add notes.</h1>`;//Clear prevoius notes as it will show after refresh too.By using localstorage.clear() command in console in inspect tool.\r\n }\r\n}", "function showNotes() {\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n let html = \"\";\n notesObj.forEach(function(element, index) {\n html += `\n <div class=\"noteCard my-2 mx-2 card\" style=\"width: 18rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\" style=\"color: red;\">Note ${index + 1}</h5>\n <h3 class=\"card-title\" style=\"color: black;\"> ${element.title} </h3>\n <h3 style=\"color:black;\">--------------------------------------</h3>\n <p class=\"card-text\"> ${element.text}</p>\n \n </div>\n <div>\n <form>\n \n <button id=\"${index}\"onclick=\"deleteNote(this.id)\" class=\"card-title\" style=\"color: black;\">Delete Note</button>\n <button id=\"${index}\"onclick=\"editNote(this.id)\" class=\"card-title\" style=\"color: black;\">Edit Note</button>\n \n </form>\n \n </div>\n\n\n\n </div>`;\n });\n let notesElm = document.getElementById(\"notes\");\n\n if (notesObj.length != 0) {\n notesElm.innerHTML = html;\n \n\n } else {\n notesElm.innerHTML = `Nothing to show! Use \"Add a Note\" section above to add notes.`;\n }\n}", "function getBusinessNotes(user_id) {\n const query = {\n text:'SELECT body FROM admin_notes WHERE noteable_id IN (SELECT business_id FROM business_membership WHERE user_id = $1)',\n values: [user_id],\n };\n\n client.query(query, (err, res) => {\n if(err){\n throw err;\n }\n else{\n SetBusinessNotes(res);\n }\n client.end()\n })\n}", "list(user) {\r\n if (typeof user !== \"undefined\") {\r\n return this.init() \r\n .then(() => {\r\n return this.read();\r\n })\r\n .then(() => {\r\n if (typeof this.notes[user] === \"undefined\") { //we have if causes to return either an empty array or the user's notes\r\n return [];\r\n } else {\r\n return this.notes[user];\r\n }\r\n });\r\n } else { \r\n return this.init().then(() => {\r\n return this.read();\r\n });\r\n }\r\n }", "function showNotes() {\n let notes = localStorage.getItem(\"notes\")\n if (notes == null) {\n notesObj = [];\n }\n else {\n notesObj = JSON.parse(notes);\n }\n let html = \"\";\n notesObj.forEach(function (element, index) {\n html += ` <div class=\"card note-card mb-5\" style=\"width: 18rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\" id=\"title\">${element.title}</h5>\n <p class=\"card-text\" id=\"text\">${element.text}</p>\n <button class=\"btn btn-danger remove-btn\" id=\" ${index}\" onclick=\"deleteNote(this.id)\">Remove<i class=\"fas fa-trash\"></i></button>\n <button class=\"btn btn-success edit-btn\" id=\" ${index}\" onclick=\"editNote(this.id)\">Edit <i class=\"fas fa-pen\"></i></button>\n </div> </div>`;\n\n });\n let notesElm = document.getElementById(\"notes\");\n if (notesObj.length != 0) {\n notesElm.innerHTML = html;\n }\n else {\n notesElm.innerHTML = `No Notes Yet! Add a note using the form above.`;\n }\n\n}", "function showNotes() {\n let notes = localStorage.getItem('notes');\n\n if (notes == null) {\n notesObj = [];\n }\n else {\n notesObj = JSON.parse(notes);\n }\n let html = \"\";\n notesObj.forEach(function (element, index) {\n html +=\n `<div class=\"container\">\n <div class=\"draggable \" draggable=\"true\">\n <h5 style=\" margin:0px 12px; word-wrap: break-word;\" >${index + 1 + \".\" + element.title}</h5>\n <p style=\"word-wrap: break-word; margin:0px 14px;\" >${element.text}</p>\n <Button id=\"${index}\" onclick=\"deleteNote(this.id)\" class=\"btn deletebtn\" style=\"border: 2px solid rgb(95, 91, 91);\n border-radius: 23px;\"0>Delete</button>\n </div>\n </div>`\n });\n\n // when there are no notes then we need to show something\n let notesElm = document.getElementById('notes');\n if (notesObj.length != 0) {\n notesElm.innerHTML = html;\n }\n else {\n notesElm.innerHTML = `Nothing to Show! Use \"Add Task\" to add New Quick Note`\n }\n}", "function displayNotes(notes) {\n\tvar el = document.getElementById('notes-played');\n\tel.innerHTML = notes; \n}", "function showNotes(){\n let notes = localStorage.getItem(\"notes\");\n if (notes == null){\n notesObj = [];\n }\n else{\n notesObj = JSON.parse(notes);\n }\n let html = \"\";\n notesObj.forEach(function(element, index){\n html += `\n <div class=\"notes-div\">\n <h1 class=\"notes-head\">${element[0]}</h1>\n <div class=\"notes-content\">\n <p>${element[1]}</p>\n <button id=\"${index}\" onclick=\"deleteNote(this.id)\" class=\"btn\">Delete Note</button>\n </div>\n </div>`\n });\n let notesElm = document.getElementById(\"notes\");\n if (notesObj.length != 0){\n notesElm.innerHTML = html;\n }\n else{\n notesElm.innerHTML = `Nothing to show! Use \"Add a Note\" section above to add notes.`;\n }\n}", "function logOutNotesFormatted(id) {\n for(let i=0;i<notes.length;i++){\n const id =notes[i].id;\n const content =notes[i].content;\n \n console.log(\"The note with id:\" + id + \" , has the following note text:\" + content);\n }\n \n }", "function showNotes(){\n let notes=localStorage.getItem('notes');\n let titles = localStorage.getItem('title');\n if(notes==null){\n notesObj=[];\n }\n else{\n notesObj=JSON.parse(notes);\n }\n if (titles == null) {\n titlesObj = [];\n }\n else {\n titlesObj = JSON.parse(titles);\n }\n let html=\"\";\n notesObj.forEach( function(value,index){\n html+=`\n <div class=\"noteCard mx-2 my-2 card\" style=\"width: 18rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${titlesObj[index]}</h5>\n <p class=\"card-text\"> ${value}</p>\n <a onclick=\"deleteNote(${index})\" class=\"btn btn-primary\">Delete Note</a>\n </div>\n </div>\n `\n });\n let notesSpace=document.querySelector('#notes');\n if(notesObj.length!=0){\n notesSpace.innerHTML=html;\n }\n else{\n notesSpace.innerHTML=`Nothing to show here! Add your notes by clicking on add notes button`;\n }\n\n}", "function showNotes() {\n var notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n }\n else {\n notesObj = JSON.parse(notes)\n }\n\n let html = \"\";\n notesObj.forEach(function (element, index) {\n \n html += ` \n <div class=\"noteCard my-2 mx-2 card\" style=\"width: 18rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${element.title}<i style=\"color : #d0e1e1;\">${element.status}</i></h5>\n <p class=\"card-text\" id=\"text\"> ${element.text}</p>\n <p style=\"color : #d0d0e1;\" class=\"name\"><i>${\"~By \"+element.name}</i></p>\n <button id=\"${index}\"onclick=\"deleteNote(this.id)\" class=\"btn btn-primary\">Delete Note</button>\n </div>\n </div>`;\n });\n var notesElm = document.getElementById(\"notes\");\n if (notesObj.length != 0) {\n notesElm.innerHTML = html;\n } else {\n notesElm.innerHTML = `Nothing to show! Use \"Add a Note\" section above to add notes.`;\n }\n}", "function getNote(id) {\n $.getJSON('/notes/' + id)\n .done((note) => {\n simplemde.value(note.content);\n });\n}", "function displayNotes(note){\n return `<p>title: ${note.title}</p><p style=\"display:none\">note: ${note.body}</p>`\n }", "function showNotes() {\r\n let notes = localStorage.getItem(\"notes\");\r\n if(notes == null){\r\n notesObj = [];\r\n }\r\n else{\r\n notesObj = JSON.parse(notes);\r\n }\r\n let html = \"\";\r\n notesObj.forEach(function(element, index) {\r\n html += `\r\n <div class=\"notecard my-2 mx-2 card\" style=\"width: 18rem;\">\r\n <div class=\"card-body\">\r\n <h4 class=\"card-title\">NOTE ${index + 1}</h4>\r\n <p class=\"card-text\"> ${element}</p>\r\n <button id=\"${index}\" onclick=\"deleteNote(this.id)\" class=\"btn btn-primary\">Delete Note</button>\r\n </div>\r\n </div> `;\r\n //<button id=\"${index}\" onclick=\"editNote(this.id)\" class=\"btn btn-primary\">Edit Note</button>\r\n });\r\n let notesElm = document.getElementById('notes');\r\n if(notesObj.length != 0){\r\n notesElm.innerHTML = html;\r\n }\r\n else {\r\n notesElm.innerHTML = `<h1 style= \"color: #FFF;\">Nothing To Show! Use \"Add A Note\" section above to add notes.</h1>`;//Clear prevoius notes as it will show after refresh too.By using localstorage.clear() command in console in inspect tool.\r\n }\r\n}", "function showNotes() {\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n let html = \"\";\n notesObj.forEach(function (element, index) {\n html += `\n <div class=\"noteCard my-3 mx-3\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${element.title}</h5>\n <p class=\"card-text\">${element.text}</p>\n <div class=\"btn-Container\" style=\"border-radius: 15px;\">\n <button id=\"${index}\" onclick=\"deleteNote(this.id)\"class=\"btn btn-primary\" style=\"border-radius: 15px;\">Delete</button>\n </div>\n </div>\n </div>`;\n })\n let notesElm = document.getElementById(\"notes\");\n if (notesObj.length != 0) {\n notesElm.innerHTML = html;\n } else {\n notesElm.innerHTML = `Nothing to show! Use \"Add Note\" to add a note.`;\n notesElm.style.fontWeight = 1;\n }\n}", "function showNotes(){\r\n let notes=localStorage.getItem(\"notes\");\r\n if(notes == null){\r\n notesobj=[];\r\n\r\n }\r\n else{\r\n notesobj=JSON.parse(notes);\r\n }\r\n let html=\"\";\r\n notesobj.forEach(function(element,index) {\r\n \r\n \r\n html+=`<div class=\"noteCard my-2 mx-2 card\" style=\"width: 18rem;\">\r\n <div class=\"card-body\">\r\n <h5 class=\"card-title\"> Note ${index + 1}</h5>\r\n <hr>\r\n <p class =\"card-text\" id=\"gr\">${element}</p>\r\n <button id=\"${index}\" onclick=\"deleteNotes(this.id)\" class=\"bttnprim\">Delete</button>\r\n </div>\r\n </div>`;\r\n });\r\n let noteselem=document.getElementById(\"notes\");\r\n if(notesobj.length!=0)\r\n {\r\n noteselem.innerHTML=html;\r\n }\r\n else\r\n {\r\n noteselem.innerHTML=`Nothing to show! Use \"Add a Note\" section above to add notes.`;\r\n }\r\n}", "function displayNotes(data) {\n //clear the notes\n $(\"#notesBody\").empty();\n //if a note array exists\n if (data.note.length !== 0) {\n for (var i = 0; i < data.note.length; i++) {\n // get the body of the note and the associated x that will allow you to delete the note\n let noteP = $(\"<h6>\").text(data.note[i].body);\n let span = $(\"<span>\");\n span.addClass(\"deleteNote\");\n span.addClass(\"float-right\");\n span.html(\"&times;\");\n span.attr(\"data-id\", data.note[i]._id);\n noteP.append(span);\n $(\"#notesBody\").append(noteP);\n }\n } else {\n $(\"#notesBody\").text(\"No new notes for this article yet.\");\n }\n}", "function displayNotes(id){\n\tvar notesHoverID = \"hover_new_notes_\" + id;\n\t//alert(notesHoverID);\n\t\n\tvar notes = document.getElementById(notesHoverID);\n\tnotes.style.zIndex = \"100\";\n\tnotes.style.display = \"block\";\n\t\n\t//new method\n\tvar el, x, y;\n\n\tel = document.getElementById(notesHoverID);\n\tif (window.event) {\n\t\tx = window.event.clientX + document.documentElement.scrollLeft\n\t\t+ document.body.scrollLeft;\n\t\ty = window.event.clientY + document.documentElement.scrollTop +\n\t\t+ document.body.scrollTop;\n\t}\n\telse {\n\t\tx = event.clientX + window.scrollX;\n\t\ty = event.clientY + window.scrollY;\n\t}\n\tx -= 2; y -= 2;\n\ty = y+15\n\tel.style.left = x + \"px\";\n\tel.style.top = y + \"px\";\n\tel.style.display = \"block\";\n\tdocument.getElementById('PopUpText').innerHTML = notesHoverID.innerHTML;\n\t\n}", "function getNoteByNoteId(userId, noteId, done){\n\tlogger.info(\"Inside service method - get note by noteId\");\n notesDao.getNote(userId, noteId, done);\n}", "function showNotes() {\n let notes = localStorage.getItem('notes');\n if (notes == null) {\n notesObj = [];\n }\n else {\n notesObj = JSON.parse(notes);\n }\n\n let html = '';\n\n notesObj.forEach(function (element, index) {\n html += `\n <div class=\"noteCard my-2 mx-2 card\" style=\"width: 18rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${element.title}</h5>\n <p class=\"card-text\">${element.text}</p>\n <button id=\"${index}\" onClick=\"deleteNote(this.id)\" class=\"btn btn-primary\" id=\"deleteBtn\">Delete Note</button>\n </div>\n </div>\n `;\n });\n\n let notesElement = document.getElementById('notes');\n if (notesObj.length != 0) {\n notesElement.innerHTML = html;\n }\n else {\n notesElement.innerHTML = `Nothing to show! Use \"Add a Note\" section above to add notes.`;\n }\n}", "userNotes(){\n const instance = Template.instance();\n if (instance.state.get('sortBy') == 'date') {\n return Notes.find({userId: Meteor.userId()},{sort:{createdAt: -1}});\n }\n if (instance.state.get('sortBy') == 'priority') {\n return Notes.find({userId: Meteor.userId()},{sort:{priority: -1}});\n }\n // Return all notes otherwise\n return Notes.find({userId: Meteor.userId()});\n }", "function showNotes() {\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesobj = [];\n }\n else {\n notesobj = JSON.parse(notes);\n }\n\n let html = \"\";\n notesobj.forEach(function (element, index) {\n html += ` <div class=\"notescard my-2 mx-2 card\" style=\"width: 18rem;\">\n \n <div class=\"card-body\">\n <div class=\"mark\" ><i id=\"${index}\" class=\"far fa-star fa-2x\"></i></div>\n <h5 class=\"card-title\">${element.title}</h5>\n <p class=\"card-text\">${element.text}</p>\n <button id=\"${index}\" onclick=\"deleteNote(this.id)\" class=\"btn btn-danger\">Delete Note</button>\n <button class=\"btn btn-primary\" data-bs-toggle=\"modal\" data-bs-target=\"#EditNote\" onclick=\"editnote(${index})\">Edit Note</button>\n </div>\n </div>`\n var imp = index;\n\n });\n let notesElm = document.getElementById('notes');\n if (notesobj.length != 0) {\n notesElm.innerHTML = html;\n \n }\n else {\n notesElm.innerHTML = `<h5 class=\"text-white\">Nothing to show Use \"Add a note section\" to above add notes</h5>`;\n }\n // markupdate();\n\n}", "function view_notes_show_report(userid, notes_id, notes_type) \n\t\t\t{\n\t\t\t\tedit_notes_obj.open('get', 'view_notes_show_report.php?userid='+userid+'&notes_id='+notes_id+'&notes_type='+notes_type)\n\t\t\t\tedit_notes_obj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')\n\t\t\t\tedit_notes_obj.onreadystatechange = view_notes_show_report_loader \n\t\t\t\tedit_notes_obj.send(1)\n\t\t\t}", "function showNotes() {\n //Fetch notes from local storage.\n let notes = localStorage.getItem('notes');\n if (notes == null) {\n notesObj = [];\n }\n else {\n notesObj = JSON.parse(notes);\n };\n\n //Fetch Notes title from local storage.\n let notesTitle = localStorage.getItem('notesTitle');\n if (notesTitle == null) {\n titleObj = [];\n }\n else {\n titleObj = JSON.parse(notesTitle);\n };\n\n\n let html = \"\";\n notesObj.forEach(function (element, index) {\n let today = new Date().toLocaleDateString() \n html += `\n <div class=\"noteCard my-2 mx-2 card\" style=\"width: 18rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${index+1}-${titleObj[index]}</h5>\n <h6 class=\"card-title\">Note Create Date:${today}</h6>\n <p class=\"card-text\">${element}</p>\n <button id=\"${index}\" onclick=\"deleteNote(this.id)\" class=\"btn btn-primary\"\n style=\"background-color:#9c4949\">Delete Note</button>\n </div>\n </div>`;\n });\n \n let notesElm = document.getElementById('notes');\n if (notesObj.length != 0) {\n notesElm.innerHTML = html;\n notesElm.style.color = 'black';\n }\n else {\n notesElm.innerHTML = `<h4>Nothing to Show! Use \"Add a Note\" section above to add Notes</h4>`;\n notesElm.style.color = 'green';\n }\n}", "function showNotes() {\r\n\r\n let notes = localStorage.getItem('notes');\r\n\r\n if(notes == null){\r\n notesObj = [];\r\n }\r\n else{\r\n notesObj = JSON.parse(notes);\r\n }\r\n let html='';\r\n notesObj.forEach(function(element , index) {\r\n html+=`\r\n <div class=\"noteCard my-2 mx-3 card\" style=\"width:18rem\">\r\n <div class=\"card-body\">\r\n <h3 class=\"card-title\">${element.title}</h3>\r\n <p class=\"card-text\">${element.text}</p>\r\n <button id=\"${index}\" onclick=\"deleteNote(this.id)\" class=\"btn btn-primary\" id=\"dltBtn\">Delete Note</button>\r\n </div>\r\n </div>\r\n `;\r\n });\r\n let notesElm=document.getElementById('notes');\r\n if(notesObj.length !=0 ){\r\n notesElm.innerHTML = html;\r\n }\r\n else{\r\n notesElm.innerHTML = `Nothing to show. Use add Note section to add a note.`;\r\n }\r\n}", "function showNotes() {\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n\n\n let title = localStorage.getItem(\"title\");\n if (title == null) {\n titleObj = []\n }\n else {\n titleObj = JSON.parse(title)\n }\n\n let html = \"\";\n notesObj.forEach(function (element, index) {\n html += `\n <div class=\"noteCard my-2 mx-2 card\" style=\"width: 18rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">Note <br>${titleObj[index]}</h5>\n <p class=\"card-text\"> ${element}</p>\n <button id=\"${index}\"onclick=\"deleteNote(this.id)\" class=\"btn btn-outline-primary my-2 btn-block btn-md\" style=\"display:block\">Delete Note</button>\n\n <button id=\"${index}\"onclick=\"markImportant(this.id)\" class=\"btn btn-outline-primary my-2\" style=\"display:inline-block\">MARK</button>\n <button id=\"${index}\"onclick=\"unmark(this.id)\" class=\"btn btn-outline-primary my-2\" style=\"display:inline-block\">UNMARK</button>\n </div>\n </div>`;\n });\n let notesElm = document.getElementById(\"notes\");\n if (notesObj.length != 0) {\n notesElm.innerHTML = html;\n }\n else {\n notesElm.innerHTML = `<h2>Nothing to show! Use \"Add a Note\" section above to add notes.</h2>`;\n }\n showMarked(); // showing marking on cards\n}", "function showNotes() {\r\n let notes = localStorage.getItem('notes');\r\n if (notes == null) {\r\n notesObj = [];\r\n } else {\r\n notesObj = JSON.parse(notes);\r\n }\r\n\r\n let title = localStorage.getItem('title')\r\n\r\n if (title == null) {\r\n tObj = [];\r\n } else {\r\n tObj = JSON.parse(title);\r\n }\r\n // var date = new Date()\r\n\r\n let time = localStorage.getItem('time')\r\n\r\n if (time == null) {\r\n timeObj = []\r\n } else {\r\n timeObj = JSON.parse(time)\r\n }\r\n let important = localStorage.getItem('important')\r\n\r\n if (important == null) {\r\n timeObj = []\r\n } else {\r\n importantObj = JSON.parse(important)\r\n }\r\n\r\n let html = '';\r\n notesObj.forEach(function(element, index) {\r\n\r\n\r\n html += `\r\n <div class=\"noteCard my-2 mx-2 card\" style=\"width: 18rem;margin:10px 20px\">\r\n <div class=\"card-body\" style='height:auto;'>\r\n <h5 class=\"card-title titleSearch\">${tObj[index]}</h5>\r\n <p class=\"card-text notes-search edit-element\">${element}</p>\r\n <button href=\"\" id=\"${index}\" onclick='deleteNote(this.id)' type='button' style='margin:10px 0px;display:block;'class=\"btn btn-outline-primary container\">Delete Note</button>\r\n <button href=\"\" id=\"${index}\" onclick='edit(this.id)' type='button' style='margin:10px auto;width:110px;'class=\"btn btn-outline-warning\" >Edit Note</button>\r\n <button href=\"\" id=\"${index}\" onclick='save(this.id)' type='button' style='margin:10px auto;width:110px;'class=\"btn btn-outline-success\">Save Note</button>\r\n <button href=\"\" id=\"${index}\" onclick='important(this.id)' type='button' style='display:block;margin:0px 0px;'class='btn ${importantObj[index]} container'>Mark as Important</button>\r\n </div>\r\n <div class=\"card-footer text-muted\">\r\n ${timeObj[index]}\r\n </div>\r\n </div>\r\n `\r\n });\r\n let notesElm = document.getElementById('notes');\r\n // \r\n let noteChecker = document.getElementById('noteContent')\r\n if (notesObj.length != 0) {\r\n notesElm.innerHTML = html;\r\n\r\n noteChecker.innerHTML = '<i>Here are your added notes</i>'\r\n } else {\r\n noteChecker.innerHTML = '<i>You have nothing here! Add Notes</i>'\r\n }\r\n}", "function display(notes) {\r\n let i = 1;\r\n let html = \"\";\r\n Object.keys(notes).forEach(function (k, i) {\r\n if (notes[k].title != undefined) {\r\n html += `\r\n <div class=\"noteCard my-2 mx-2 card\" content=\"centre\" style=\"width:100%;\" >\r\n <div class=\"card-body\" id=\"note-card\">\r\n <h5 class=\"card-title\">${notes[k].title}</h5>\r\n <p class=\"card-text\" > ${notes[k].content}</p>\r\n <button id=\"${k}\" onclick=\"deleteNote(this.id)\" class=\"btn btn-danger\">Delete Note</button>\r\n <button id=\"${k}\" onclick=\"editNote(this.id)\" class=\"btn btn-info\">Edit Note</button>\r\n </div>\r\n <div class=\"card-footer text-muted\" style=\"font: italics;\">\r\n Last Updated: ${notes[k].lastUpdated}\r\n </div>\r\n </div>`;\r\n }\r\n else {\r\n html += `\r\n <div class=\"noteCard my-2 mx-2 card\" content=\"centre\" style=\"width:100%;\" >\r\n <div class=\"card-body\" id=\"note-card\">\r\n <h5 class=\"card-title\">Note ${i + 1} (You can Now edit Title)</h5>\r\n <p class=\"card-text\" > ${notes[k]}</p>\r\n <button id=\"${k}\" onclick=\"deleteNote(this.id)\" class=\"btn btn-danger\">Delete Note</button>\r\n <button id=\"${k}\" onclick=\"editNote(this.id)\" class=\"btn btn-info\">Edit Note</button>\r\n </div>\r\n </div>`;\r\n }\r\n i++\r\n });\r\n let notesElm = document.getElementById(\"notes\");\r\n if (i > 0)\r\n notesElm.innerHTML = html;\r\n else\r\n notesElm.innerHTML = `Nothing to show! Use \"Add a Note\" section above to add notes.`;\r\n return;\r\n}", "function showNotes(){\n let notes = localStorage.getItem('notes');\n let notesObj;\n\n if(notes == null){\n notesObj = [];\n }\n else{\n notesObj = JSON.parse(notes); \n }\n\n let addNote = \"\";\n\n notesObj.forEach((element, index) => {\n addNote += `\n <div class=\"noteCard m-2 card\" style=\"width: 18rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${element[0]}</h5>\n <p class=\"card-text\">${element[1]}</p>\n <button id=\"${index}\" onclick=\"deleteNote(this.id)\" class=\"btn btn-primary\">Delete Note</button>\n <button onclick=\"editNote(${index})\" class=\"btn btn-primary\">Edit Note</button>\n </div>\n </div>`\n });\n\n let notesEle = document.getElementById('notes');\n if(notesObj.length != 0){\n notesEle.innerHTML = addNote;\n }\n else{\n notesEle.innerHTML = `You haven't add any note yet. Try to to add some note using above section and then press \"Add Note\" button.`\n }\n \n}", "async getAllNotesById(userId) {\n console.log(userId)\n const { rows } = await user_notes.findAndCountAll({\n where: {\n \"user_user_id\": userId\n },\n });\n return rows;\n }", "function showNotes(){\n let html=\" \";\n let notes=localStorage.getItem(\"notes\");\n if(notes==null){\n notesobj=[];\n }\n else{\n notesobj=JSON.parse(notes);\n }\n \n notesobj.forEach(function (element,index) {\n\n html+=`<div class=\"noteCard mx-2 my-2 card \" style=\"width: 18rem;\">\n \n <div class=\"card-body\">\n <h5 class=\"card-title\">Note ${index + 1}</h5>\n <p class=\"card-text\">${element}</p>\n <button id=\"${index}\" onclick=\"deleteNote(this.id)\" class=\"btn btn-primary\">Delete note</button>\n </div>\n </div>`;\n\n\n \n \n \n });\n\n let notesElm=document.getElementById('Notes');\n if(notesobj.length != 0)\n {\n notesElm.innerHTML=html;\n }\n else{\n notesElm.innerHTML=`Nothing to show! Use \"Add a Note\" section above to add notes.`; }\n}", "function showNotes() {\n let notes = localStorage.getItem(\"notes\");\n let dateItem = localStorage.getItem(\"dateItem\");\n let starItem = localStorage.getItem(\"starItem\");\n if (notes == null) {\n notesObj = [];\n dateObj = [];\n starObj = [];\n }\n else {\n notesObj = JSON.parse(notes);\n dateObj = JSON.parse(dateItem);\n starObj = JSON.parse(starItem);\n }\n\n notesObj = notesObj.reverse();\n dateObj = dateObj.reverse();\n starObj = starObj.reverse();\n\n let html = \"\";\n notesObj.forEach(function (element, index) {\n html += `\n <div class=\"noteCard my-2 mx-2 card\" style=\"width: 21rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${dateObj[index]}</h5>\n <p class=\"card-text\"> ${element}</p>\n <button id=\"${index}\"onclick=\"deleteNote(this.id)\" class=\"btn btn-primary\">Delete Note</button>\n <button id=\"${index}\"onclick=\"starNode(this.id)\" class=\"btn btn-primary\">Star Note</button>\n </div>\n </div>`;\n });\n\n\n let notesElm = document.getElementById(\"notes\");\n if (notesObj.length != 0) {\n notesElm.innerHTML = html;\n } else {\n notesElm.innerHTML = `You have not created any notes yet`;\n }\n}", "function userNote(savedNoteSearch) {\n\n var inlineHtml =\n '<div class=\"form-group container reviewaddress_section\">';\n inlineHtml += '<div class=\"row\">';\n inlineHtml +=\n '<div class=\"col-xs-3 create_note\"><input type=\"button\" value=\"CREATE USER NOTE\" class=\"form-control btn btn-primary\" id=\"create_note\" /></div>';\n\n inlineHtml += '</div>';\n inlineHtml += '</div>';\n\n if (!isNullorEmpty(savedNoteSearch)) {\n\n inlineHtml += '<div class=\"form-group container contacts_section\">';\n inlineHtml += '<div class=\"row\">';\n inlineHtml += '<div class=\"col-xs-12 address_div\">';\n inlineHtml +=\n '<table border=\"0\" cellpadding=\"15\" id=\"address\" class=\"table table-responsive table-striped address tablesorter\" cellspacing=\"0\" style=\"width: 100%;font-size: 10px;\"><thead style=\"color: white;background-color: #607799;\"><tr><th style=\"vertical-align: middle;text-align: center;\"><b>CREATED DATE</b></th><th style=\"vertical-align: middle;text-align: center;\"><b>ORGANISER</b></th><th style=\"vertical-align: middle;text-align: center;\"><b>MESSAGE</b></th></tr></thead><tbody>';\n\n savedNoteSearch.each(function (searchResult) {\n\n var note_date = searchResult.getValue('notedate');\n\n var author = searchResult.getText(\"author\");\n\n var message = searchResult.getValue('note');\n\n inlineHtml += '<tr><td>' + note_date + '</td><td>' + author +\n '</td><td>' + message + '</td></tr>';\n\n return true;\n });\n\n inlineHtml += '</tbody></table>';\n inlineHtml += '</div>';\n inlineHtml += '</div>';\n inlineHtml += '</div>';\n }\n\n return inlineHtml;\n }", "function displayNotes(notes) {\n $(\"#todo-list\").empty();\n for (var key in notes) {\n var classes = '';\n if(notes[key].status === 'completed') classes += ' strike';\n else if(notes[key].status === 'archived') continue;\n \n var note = $(`\n <li id='toDoListItem' data-uid=\"${key}\">\n <label class=${classes}>\n <input \n type='checkbox' \n name='todo-item-done' \n class='filled-in todo-item-done' \n value='${notes[key].text}'\n data-uid=\"${key}\" />\n ${notes[key].text}\n <button \n class='todo-item-delete waves-effect waves-light btn deleteItemBtn'\n data-uid=\"${key}\">\n Remove\n </button>\n </label>\n </li>\n `);\n $(\"#todo-list\").append(note);\n }\n }", "function showNotes(ID){\n \n $http.post(\"backendPHP/retrieveNotes.php?ID=\"+ID).success(function(data){\n \n console.log('notes: ',data);\n \n $.each(data, function(i, notes){\n\n var rows = $('<tr>'+'<td>'+ notes.id +' </td> <td>'+ notes.note +' </td>'+'</tr>');\n rows.hide();\n \n setTimeout(function(){\n \n $('tr:last-child').after(rows);\n rows.delay(1000).fadeIn(1000);\n }, i * 1500);\n \n \n });\n \n });\n\n }", "function displayNote(noteid, title, note, completed) {\n\tvar idTag, htmlTag;\n\tif (completed == \"0\" || completed == 0){\n\t\tidTag = \"#notCompletedList\";\n\t\thtmlTag = \"<button class='btn btn-info btn-xs' onclick='toggle(\\\"\"+noteid+\"\\\")'>Mark as Complete</button>\";\n\t}else if(completed == \"1\" || completed == 1){\n\t\tidTag = \"#completedList\";\n\t\thtmlTag = \"<button class='btn btn-info btn-xs' onclick='toggle(\\\"\"+noteid+\"\\\")'>Mark as Not Complete</button>\";\n\t}else\n\t\treturn;\n\n\t$(idTag).append(\n\t\t\"<tr id='\"+noteid+\"'>\"+\n\t\t\t\"<td id='title\"+noteid+\"'>\"+title+\"</td>\"+\n\t\t\t\"<td id='note\"+noteid+\"'>\"+note+\"</td>\"+\n\t\t\t\"<td id='completed\"+noteid+\"' value='\"+completed+\"' style='text-align:center;'>\"+\n\t\t\thtmlTag +\n\t\t\t\" <button class='btn btn-default btn-xs' onclick='editNote(\\\"\"+noteid+\"\\\")'><span title='Edit' class='glyphicon glyphicon-pencil' aria-hidden='true'></span></button>\"+\n\t\t\t\" <button class='btn btn-danger btn-xs' onclick='deleteNote(\\\"\"+noteid+\"\\\")'><span title='Remove' class='glyphicon glyphicon-remove' aria-hidden='true'></span></button></td>\"+\n\t\t\"</tr>\");\n}", "function showNotes(event) {\n event.preventDefault();\n\n // Hide the tooltip for this element so that they don't hang\n // around (Resolves display issues with tooltips after showing\n // the notes modal).\n $(this).tooltip('hide');\n\n // Get the article id so we can find any existing notes.\n const article = $(this).parents('.card').data();\n\n // Ask for any existing notes from the backend.\n $.get(`/api/notes/${article.id}`).done((response) => {\n // Construct the interior of the modal.\n const contentWrap = $('<div>').addClass('container-fluid');\n const existingNotes = $('<ul>').addClass(\n 'list-group list-group-flush note-container'\n );\n const contentBreak = $('<hr>').addClass('my-2');\n const newNoteBox = $('<textarea>').addClass('form-control').attr({\n placeholder: 'Write your notes here...',\n rows: 4,\n cols: 50,\n });\n\n contentWrap.append(existingNotes, contentBreak, newNoteBox);\n\n // Use bootbox.js to build and display the bootstrap modal.\n bootbox.dialog({\n closeButton: true,\n onEscape: true,\n show: true,\n title: `<strong>Notes:</strong><br>${article.title}...`,\n message: contentWrap,\n backdrop: true,\n buttons: {\n save: {\n /* eslint-disable max-len */\n label: '<span class=\"fa fa-pencil-alt\"></span>&nbsp;&nbsp;Save Note',\n /* eslint-enable max-len */\n className: 'btn-primary save-note',\n callback: saveNote,\n },\n close: {\n /* eslint-disable max-len */\n label: '<span class=\"fas fa-times\"></span>&nbsp;&nbsp;Close',\n /* eslint-enable max-len */\n className: 'btn-outline-warning',\n callback: function () {\n bootbox.hideAll();\n },\n },\n },\n });\n\n const notes = {\n id: article.id,\n notes: response || [],\n };\n\n // Attach the existing notes and article id to the save button.\n $('.save-note').data('article', notes);\n\n // Populate the list of existing notes or the message that\n // none have been created yet.\n createNoteList(notes);\n });\n }", "function shownotes() {\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n }\n else {\n notesObj = JSON.parse(notes);\n }\n\n if (notesObj.length == 0) {\n let notesContainer = document.getElementById('notes');\n notesContainer.innerHTML = `No notes to show!`\n }\n else {\n let notesContainer = document.getElementById('notes');\n notesContainer.innerHTML = '';\n }\n\n notesObj.forEach((element, index) => {\n htmlText = `\n <div class=\"forsearch alert alert-primary\" width = \"screen-width\" style=\"inline\" name=\"savedNotes\" float=\"left\" >\n <p id=${index + 1}> Note-<em> ${getMyDate(index)} </em>:<strong> <i>${getTitle(index)} <i>: ${element}</strong></p>\n \n <input id = ${index} class=\"alert alert-primary\" type=\"button\" value=\"Delete\" onclick=\"deteleNote(this.id)\">\n </div>\n `\n let notesContainer = document.getElementById('notes');\n notesContainer.innerHTML += htmlText;\n });\n}", "function getNote(thisRef) {\n var note_id = thisRef.attr(\"data-noteid\");\n $.getJSON('/notes/note/', {note_id: note_id}, function (data) {\n $('.note-info').attr('id', note_id);\n if (data.title === \"Untitled note\") {\n $('#title').empty();\n } else {\n $('#title').html(data.title);\n }\n $('.editor').html(data.body);\n });\n }", "function showNotes() {\r\n let notes = localStorage.getItem(\"notes\");\r\n if (notes == null) {\r\n notesObj = [];\r\n }\r\n else {\r\n notesObj = JSON.parse(notes); //string to array\r\n }\r\n let html = \"\";\r\n notesObj.forEach(function (element, index) {\r\n html += `\r\n <div class=\"card my-2 mx-2\" style=\"width: 18rem;\">\r\n <div class=\"card-body\">\r\n <h5 class=\"card-title\"> ${element.title}</h5>\r\n <p class=\"card-text\">${element.text}</p>\r\n <button id=${index} onclick=\"deleteNote(this.id)\" class=\"btn btn-primary\">Delete Note</button>\r\n </div>\r\n </div>`;\r\n });\r\n let notesElm = document.getElementById('notes');\r\n if (notesObj.length != 0) {\r\n notesElm.innerHTML = html;\r\n }\r\n else {\r\n notesElm.innerHTML = `<p><strong>Nothing to show! Use \"Add a note\" section to add notes</strong></p>`\r\n }\r\n}", "function showNotes() {\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n let html = \"\";\n notesObj.forEach((element, index) => {\n html += `\n <div class=\"noteCard my-2 mx-2 card\" style=\"width: 18rem\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">Note ${index + 1}</h5>\n <p class=\"card-text\">${element}</p>\n <button id=\"${index}\" onclick=\"deleteNode(this.id)\" class=\"btn btn-primary\">Delete Note</button>\n </div>\n </div>\n `;\n });\n\n let notesElement = document.getElementById(\"notes\");\n if (notesObj.length != 0) {\n notesElement.innerHTML = html;\n } else {\n notesElement.innerHTML = `Nothing to show! Please use \"Add Note\" button above to add a note.`;\n }\n}", "function showNotes() {\r\n let notes = localStorage.getItem(\"notes\");\r\n if (notes == null) {\r\n notesObj = [];\r\n }\r\n else {\r\n notesObj = JSON.parse(notes);\r\n }\r\n\r\n //9. Create html blank.\r\n let html = \"\";\r\n notesObj.forEach(function (element, index) {\r\n //10. Using for append.\r\n html += ` <div id=\"notes\" class=\"row container-fluid\">\r\n\r\n <div class=\"noteCard my-2 mx-2 card\" style=\"width: 18rem;\">\r\n <div class=\"card-body\">\r\n <h5 class=\"card-title\">Note ${index + 1}</h5>\r\n <p class=\"card-text\">${element}</p>\r\n <button id=\"${index}\" onclick = \"deleteNote(this.id)\" class=\"btn btn-primary\">Delete Note</button>\r\n </div>\r\n </div>\r\n\r\n </div>`;\r\n\r\n });\r\n\r\n let notesElm = document.getElementById(\"notes\");\r\n if (notesObj.length != 0) {\r\n notesElm.innerHTML = html;\r\n }\r\n else {\r\n notesElm.innerHTML = \"Nothing to show here, please use add notes section to Add Notes.\"\r\n }\r\n\r\n}", "function showNotes() {\n let notes = localStorage.getItem(\"notes\");\n\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n let html = \"\";\n // let heading = document.getElementById('noteHead').innerText;\n // console.log(heading);\n notesObj.forEach(function(element, index) {\n html += `\n <div class=\"noteCard mx-2 my-2 card\" style=\"width: 18rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">Note ${index+1}</h5>\n <p class=\"card-text\">${element}</p>\n <button id=\"${index}\" onclick=\"deleteNote(this.id)\" class=\"btn btn-primary\">Delete</button>\n </div>\n </div>`;\n\n\n });\n let notesElm = document.getElementById(\"notes\");\n if (notesObj.length != 0) {\n notesElm.innerHTML = `${html}`;\n } else {\n notesElm.innerHTML = `No notes here. Add a new from above section`;\n }\n}", "function shownote(event) {\n\tevent.preventDefault();\n\tvar id = $(this).attr(\"value\");\n\t$(\"#addnote\").fadeIn(300).css(\"display\", \"flex\");\n\t$(\"#add-note\").attr(\"value\", id);\n\t$.get(\"/\" + id, function(data) {\n\t\t$(\"#article-title\").text(data.title);\n\t\t$.get(\"/note/\" + id, function(data) {\n\t\t\tif (data) {\n\t\t\t\t$(\"#note-title\").val(data.title);\n\t\t\t\t$(\"#note-body\").val(data.body);\n\t\t\t}\n\t\t});\n\t});\n}", "function showNoteList(notes) {\n\tif(notes.length === 0) return \"You don\\'t have notes yet...\"\n\tlet result = '';\n\tnotes.map((note)=>{\n\t\tresult += `Title: ${note.title} Body: ${note.body}\\n`;\n\t});\n\treturn result;\n}", "function displayNotesDetails(note){\n return `<p>title: ${note.title}</p><p style=\"display:block\">note: ${note.body}</p>`\n }", "function loadNote(req, res, username){\n\n // sends error message in response if not in database\n if(db.get('posts').find({username: username}).value() === undefined){\n res.write(JSON.stringify({message: \"This account does not have a saved note!\"}))\n }\n else{\n const note = {\n noteTitle: db.get('posts').find({username: username}).get('title').value(),\n noteBody: db.get('posts').find({username: username}).get('body').value()\n }\n\n res.write(JSON.stringify(note))\n }\n}", "function renderNotes() {\n noteArray = JSON.parse(localStorage.getItem(\"dayNotes\")) || [];\n $(noteArray).each(function () {\n $(\"#\" + this.id).find(\"textarea\").text(this.note)\n });\n}", "function showNotes() {\r\n let notes = localStorage.getItem(\"notes\");\r\n let title = localStorage.getItem(\"title\");\r\n if (notes === null && title === null)\r\n{\r\n notesObj = [];\r\n titleObj = [];\r\n}\r\nelse\r\n{\r\n notesObj = JSON.parse(notes);\r\n titleObj = JSON.parse(title);\r\n}\r\n\r\nlet html =\"\";\r\nnotesObj.forEach(function(element,index){\r\n\r\nhtml = html + `\r\n<div class=\"noteCard card mx-2 my-2\" style=\"width: 18rem;\">\r\n<div class=\"card-body\">\r\n <h5 class=\"card-title\">${titleObj[index]}</h5> \r\n <p class=\"card-text\">${element}</p>\r\n <button id=${index} onclick=\"deleteNote(this.id)\" class=\"btn btn-primary\">Delete Note</button>\r\n</div>\r\n</div>\r\n`\r\n \r\n});\r\n\r\nlet notesElm = document.getElementById('notes');\r\nif(notesObj.length != 0 && titleObj.length !=0){\r\n notesElm.innerHTML = html;\r\n}\r\n\r\nelse {\r\n notesElm.innerHTML = `Nothing to show!! use \"Add a Note\" section to buid a note`;\r\n}\r\n\r\n}", "function buildNotes(notes) {\n\n //Loop through the notes\n notes.forEach(function(note) {\n\n\n const noteCard = `<div id=\"${note._id}\" class=\"note alert alert-primary alert-dismissible\" role=\"alert\">\n <div class=\"note-body\">\n ${note.body}\n </div>\n <button type=\"button\" class=\"close edit-note\">\n <span><i class=\"fas fa-edit\"></i></span>\n </button>\n <button type=\"button\" class=\"close delete-note\">\n <span>&times;</span>\n </button>\n </div>`\n\n $(\".notes-modal\").find(\"#article-notes\").append(noteCard)\n\n\n });\n }", "function showNotes()\n{\n let notes=localStorage.getItem(\"notes\"); \n if (notes===null)\n {\n notesObj=[];\n }\n else\n {\n notesObj=JSON.parse(notes);//converts string to objects\n }\n let html=\"\";\n notesObj.forEach(function(element,index){\n if (element.title!=\"\" || element.text!=\"\")\n {\n html += `<div class=\"notecard card mx-2 my-2\" style=\"width: 21.5rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${element.title}</h5>\n <p class=\"card-text\"> ${element.text}</p>\n <button id=\"${index}\" onclick=\"deleteNote(this.id)\" class=\"btn btn-primary\">Delete</button>\n </div>\n </div>`;\n }\n \n\n })\n let notesEle=document.getElementById(\"notes\");\n if (notesObj.length!=0)\n {\n notesEle.innerHTML=html;\n }\n else{\n notesEle.innerHTML=\"<h4>Nothing to show, add a note</h4>\";\n \n }\n}", "function show_note() {\r\n let local = localStorage.getItem('notes');\r\n let cont = document.querySelector('.cont2');\r\n let html = '';\r\n if (local == null) {\r\n notesObj = [];\r\n // show_note();\r\n // return;\r\n }\r\n else {\r\n notesObj = JSON.parse(local);\r\n }\r\n if (notesObj.length != 0) {\r\n notesObj.forEach(function (ele, index) {\r\n if (ele.state == true) {\r\n html += ` <div class=\"card btn-border border\">\r\n <h3>${ele.title}</h3>\r\n <div class=\"text\">\r\n <p id=\"note\">${ele.text}</p>\r\n </div>\r\n <div class=\"btn-class\">\r\n <button class=\"btn btn-red\" id=\"${index}\" onclick=\"delet_btn(this.id)\">Delete</button>\r\n <button class=\"btn btn-yellow\" id=\"${index}\" onclick=\"unmark_btn(this.id)\">Unmark</button>\r\n </div>\r\n </div>`;\r\n\r\n }\r\n else {\r\n\r\n html += ` <div class=\"card border\">\r\n <h3>${ele.title}</h3>\r\n <div class=\"text\">\r\n <p id=\"note\">${ele.text}</p>\r\n </div>\r\n <div class=\"btn-class\">\r\n <button class=\"btn btn-red\" id=\"${index}\" onclick=\"delet_btn(this.id)\">Delete</button>\r\n <button class=\"btn btn-yellow\" id=\"${index}\" onclick=\"mark_btn(this.id)\">Mark</button>\r\n </div>\r\n </div>`;\r\n }\r\n }\r\n )\r\n }\r\n else /*(notesObj.length != 0)*/ {\r\n html = `<div class=\"card border\" style=\"text-align:center;\">\r\n <h1>Add a Note here !</h1>\r\n <div class=\"text\">\r\n <p>No note to display here</p>\r\n </div>\r\n </div>`\r\n }\r\n cont.innerHTML = html;\r\n}", "function showNotes() {\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n let html = \"\";\n\n Array.from(notesObj).forEach(function(element, index) {\n html += `\n <div class=\"noteCard my-2 mx-2 card\" style=\"width: 20rem;\">\n <div class=\"card-body\" style=\"display: inline-block;\">\n <span style=\"display:flex;justify-content:space-between;\">\n <h5 class=\"card-title\">${element.title}</h5>\n <span id=\"star${index}\" style=\"display:none;\"><i class=\"fa fa-star\" aria-hidden=\"true\" style=\"color:#fff200;font-size:20px;\"></i></span> \n </span>\n \n <p class=\"card-text\"> ${element.text}</p>\n <button id=\"${index}\" onclick=\"deleteNote(this.id)\" class=\"btn btn-primary\" style=\"margin-right:55px;border-radius:30px;height:35px;font-size:13px;\">Delete Note</button>\n <button id=\"${index}\" onclick=\"addStarred(this.id)\" value=\"\" class=\"btn btn-primary btn1${index}\" style=\"border-radius:30px;height:35px;font-size:13px;\">Add to Starred</button>\n \n </div>\n </div> `;\n });\n\n let notesElm = document.getElementById(\"notes\");\n\n if (notesObj.length != 0) {\n notesElm.innerHTML = html;\n\n } else {\n notesElm.innerHTML = `Nothing to show! Use \"Add a Note\" section above to add notes.`;\n\n\n }\n}", "function innertNotes(data, id, status, menu_title) {\n if (menu_title == 'Edit') {\n if (data == null|| status== null || status == 1) {\n $('#note_' + id).html(\"-\")\n } else {\n $('#note_' + id).html(data)\n }\n } else {\n let text_notes = ''\n if (data !== null) {\n text_notes = $(\"#note_\" + id).val(data)\n }\n if (status == 2) {\n text_notes = $(\"#ket-\" + id).css(\"display\", \"block\");\n }\n return text_notes\n }\n\n}", "function addUserNote() {\n var result = notes.addNote()\n console.log(result)\n}", "function getNotes(){\n fetch(noteUrl) //fetch it\n .then(res => res.json()) // parse it\n .then(notes => {\n notes.forEach(note => { //retrieve each\n makeNote(note) //send each note into make note, to do do something with it\n bigTitle.dataset.id = note.user.id\n\n })\n })\n }", "function showNotes(){\r\n let note = localStorage.getItem(\"note\");\r\n if(note == null){\r\n noteobj =[]\r\n \r\n }else{\r\n noteobj=JSON.parse(note);\r\n }\r\n let text ='';\r\n noteobj.forEach(function(element,index) {\r\n text+=`\r\n <div class=\"card mx-2\" style=\"width: 18rem;\">\r\n <div class=\"card-body\">\r\n <h5 class=\"card-title\">Note ${index +1}</h5>\r\n <p class=\"card-text\"> ${element} </p>\r\n <button id=\"${index}\" onclick=\"deleteing(this.id)\" class=\"btn btn-primary\">Delete</button>\r\n </div>\r\n </div>\r\n `\r\n });\r\n let noteEle = document.getElementById('note');\r\n if(noteobj.length !=0){\r\n noteEle.innerHTML = text;\r\n }else{\r\n noteEle.innerHTML = 'No Note is available. Please write some notes';\r\n }\r\n \r\n}", "function print_note()\n {\n var list = me.notebooks[me.selected_list],\n uid = me.selected_note ? me.selected_note.uid : 0;\n\n if (list && uid) {\n rcmail.open_window(rcmail.url('print', {_uid: uid, _list: list.id}), true, true);\n }\n }", "function showNotes(){\r\n let notes = localStorage.getItem('notes');\r\n\r\n if(notes == null){\r\n notesObj = [];\r\n }else{\r\nnotesObj = JSON.parse(notes)//yaha pr string to array convert ho rha hai\r\n }\r\n\r\n let html = \"\";\r\n notesObj.forEach(function(element,index){\r\n html += `\r\n \r\n <div class=\"card notecard\" style=\"width: 18rem;\">\r\n <img class=\"card-img-top\" src=\"notes.png\" alt=\"Card image cap\">\r\n <div class=\"card-body\">\r\n <h5 class=\"card-title\">Note ${index + 1}</h5>\r\n <p class=\"card-text\">${element}.</p>\r\n <button id='${index}' onclick='deleteNote(this.id)' href=\"#\" class=\"btn btn-primary\">Delete Note</button>\r\n </div>\r\n </div>\r\n \r\n \r\n \r\n `;\r\n\r\n \r\n \r\n });\r\n\r\n let notesElem = document.getElementById('notes');\r\n if(notesObj.length != 0){\r\n notesElem.innerHTML = html;\r\n }else{\r\n notesElem.innerHTML = '<b>Nothing to show!</b> ';\r\n }\r\n}", "function listNotes(){\n var notes = getNotes();\n\n notes.forEach((note) => formatNote(note));\n}", "function getNote(id) {\n for (let i = 0; i < notes.length; i++) {\n if (i === (id - 1)) {\n return notes[i];\n };\n }\n return `There is no note with id=${id} on the list.`;\n}", "function displayNotes(){\n var notes = noteList.notes\n var result = \"\"\n for (var i = 0; i < notes.length; i++) {\n result += \" <li style='list-style: none'><a href='#\" + notes[i] + \"'>\" + notes[i].substring(0,20) + \"</a></li>\";\n }\n document.getElementById(\"note_list\").innerHTML = result\n }", "function showNotes(){\r\n let notes = localStorage.getItem('notes')\r\n if(notes==null){\r\n notesObj = [];\r\n }else{\r\n notesObj = JSON.parse(notes)\r\n\r\n }\r\nlet html = \" \";\r\nnotesObj.forEach(function(element,index) {\r\n \r\n html += ` <div class=\"noteCard my-2 mx-2 card\" style=\"width: 18rem;\">\r\n \r\n <div class=\"card-body\">\r\n <h5 class=\"card-title\">Note ${index + 1}</h5>\r\n <p class=\"card-text\">${element}</p>\r\n <button id = \"${index}\" onclick = \"deleteNote(this.id) \" class=\"btn btn-primary\">Delete Note</button>\r\n </div>\r\n </div> `\r\n});\r\nlet notesElm = document.getElementById('notes');\r\nif(notesObj.length!=0){\r\n notesElm.innerHTML = html;\r\n\r\n}else{\r\n notesElm.innerHTML= `Nothing to show ! Use \"Add note \" section above to add notes`;\r\n}\r\n}", "function listNotes({db}) { \n\tdb.collection(\"Usernote\").find().toArray()\n\t.then((res) => { \n\t\t\tif(res.length == 0) {\n\t\t\t\t\tconsole.log(\"No notes found. Create one using 'add' command\");\n\t\t\t\t\tcloseDB(db);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tconsole.log(JSON.stringify(res, undefined, 8));\n\t\t\t\tcloseDB(db);\n\t\t\t}\n\t\t},\n\t\terr => { \n\t\t\tconsole.log(err);\n\t\t\tcloseDB(db);\n\t\t});\t\n}", "function showNotes(){\n let notes = localStorage.getItem('notes');\n let notesObj;\n\n if(notes == null){\n notesObj = [];\n }\n else{\n notesObj = JSON.parse(notes); \n }\n\n let addNote = \"\";\n\n //This list contains the classes for favorite/not-favorite cards\n const favorite_class = [\"noteCard m-2 card favorite\",\"noteCard m-2 card not-favorite\"]\n\n notesObj.forEach((element, index) => {\n addNote += `<div class=\"${element.favorite ? favorite_class[0]:favorite_class[1]}\" style=\"width: 18rem;\">\n <div class=\"card-body\">\n <div class=\"row mb-3\">\n <div class=\"col\">\n <h2 class=\"card-title\" style=\"height:80px;\">${element.title}</h2>\n <img class=\"card-text\"src=\"${element.text}\" style=\"height:250px;width:240px;\" >\n </div>\n <div class=\"col-2\">\n <span class=\"iconify\" data-icon=${element.favorite ? \"bi:star-fill\":\"bi:star\"} data-inline=\"false\" data-width=\"24\" data-height=\"24\" style=${element.favorite ? \"color:gold\":\"color:black\"} onclick=favoriteNote(${index})></span>\n </div>\n </div> \n <button id=\"${index}\" onclick=\"deleteNote(this.id)\" class=\"btn btn-danger\">Delete</button>\n <button onclick=\"editNote(${index})\" class=\"btn btn-primary\">Edit</button>\n \n </div>\n </div>`\n });\n\n let notesEle = document.getElementById('notes');\n if(notesObj.length != 0){\n notesEle.innerHTML = addNote;\n }\n else{\n notesEle.innerHTML = `You haven't add any note yet. Try to to add some note using above section and then press \"Add Note\" button.`\n }\n \n}", "function noteload(data){\n $.each(data, function(i, note){\n note['time'] = [moment(note.created_at).format('MMMM Do YYYY, h:mm:ss a')]\n $('#maincontent').prepend(note_template(note))\n if (note.note_image == null){\n $('#imagecontainer').hide();\n $('.responsivecol').removeClass('col-sm-8').addClass('col-sm-12')\n }\n if (userEmail() == note.user.email ) {\n $('#noteedit').show()\n }\n })\n }", "async function show(req, res) {\n const todos = await Todo.find({\n user: req.params.userid\n });\n res.json(todos);\n}", "function addNoteToView(title,active,target, expired) {\n //we need to know the state of these variables to choose correct image\n if (active===\"true\") {\n active=true;\n } else if (active===\"false\") {\n active=false;\n }\n if (expired===\"true\") {\n expired=false;\n } else if (expired===\"false\") {\n expired=true;\n }\n //get user from storage to make sure it comes through, this can bug out\n var storedUser = sessionStorage.getItem('loggedInUser');\n \n //test every possible scenario for the note, these have to all be checked\n //since each scenario has a customized image to signify that state\n if ($(\"#noteTable tr\").length === 0) {\n if (active) {\n if (target !== storedUser && expired === true) {\n $(\"#noteTable\").append(\"<tr><td id='individualNote' class='individualNote'><p class='noteText'>\" + title + \"</p></td></tr>\");\n } else if (target !== storedUser && expired === false) {\n $(\"#noteTable\").append(\"<tr><td id='individualNoteExp' class='individualNote'><p class='noteText'>\" + title + \"</p></td></tr>\");\n } else if (target === storedUser && expired === true) {\n $(\"#noteTable\").append(\"<tr><td id='individualNotePe' class='individualNote'><p class='noteText'>\" + title + \"</p></td></tr>\");\n } else if (target === storedUser && expired === false) {\n $(\"#noteTable\").append(\"<tr><td id='individualNotePeExp' class='individualNote'><p class='noteText'>\" + title + \"</p></td></tr>\");\n }\n } else {\n if (target !== storedUser) {\n $(\"#noteTable\").append(\"<tr><td id='individualNoteCh' class='individualNote'><p class='noteText'>\" + title + \"</p></td></tr>\"); \n } else {\n $(\"#noteTable\").append(\"<tr><td id='individualNoteChPe' class='individualNote'><p class='noteText'>\" + title + \"</p></td></tr>\");\n }\n }\n \n } else {\n var lastRowLength = $(\"#noteTable tr:last td\").length;\n if (lastRowLength === 6) {\n if (active) {\n if (target !== storedUser && expired === true) {\n $('#noteTable tr:last').after(\"<tr><td id='individualNote' class='individualNote'><p class='noteText'>\" + title + \"</p></td></tr>\");\n } else if (target !== storedUser && expired === false) {\n $('#noteTable tr:last').after(\"<tr><td id='individualNoteExp' class='individualNote'><p class='noteText'>\" + title + \"</p></td></tr>\");\n } else if (target === storedUser && expired === true) {\n $('#noteTable tr:last').after(\"<tr><td id='individualNotePe' class='individualNote'><p class='noteText'>\" + title + \"</p></td></tr>\");\n } else if (target === storedUser && active === false) {\n $('#noteTable tr:last').after(\"<tr><td id='individualNotePeExp' class='individualNote'><p class='noteText'>\" + title + \"</p></td></tr>\");\n }\n } else {\n if (target !== storedUser) {\n $('#noteTable tr:last').after(\"<tr><td id='individualNoteCh' class='individualNote'><p class='noteText'>\" + title + \"</p></td></tr>\");\n } else {\n $('#noteTable tr:last').after(\"<tr><td id='individualNoteChPe' class='individualNote'><p class='noteText'>\" + title + \"</p></td></tr>\");\n }\n }\n \n } else { \n if (active) {\n if (target !== storedUser && expired === true) {\n $('#noteTable tr:last td:last').after(\"<td id='individualNote' class='individualNote'><p class='noteText'>\" + title + \"</p></td>\");\n } else if (target !== storedUser && expired === false) {\n $('#noteTable tr:last td:last').after(\"<td id='individualNoteExp' class='individualNote'><p class='noteText'>\" + title + \"</p></td>\");\n } else if (target === storedUser && expired === true) {\n $('#noteTable tr:last td:last').after(\"<td id='individualNotePe' class='individualNote'><p class='noteText'>\" + title + \"</p></td>\");\n } else if (target === storedUser && expired === false) {\n $('#noteTable tr:last td:last').after(\"<td id='individualNotePeExp' class='individualNote'><p class='noteText'>\" + title + \"</p></td>\");\n }\n } else {\n if (target !== storedUser) {\n $('#noteTable tr:last td:last').after(\"<td id='individualNoteCh' class='individualNote'><p class='noteText'>\" + title + \"</p></td>\");\n } else {\n $('#noteTable tr:last td:last').after(\"<td id='individualNoteChPe' class='individualNote'><p class='noteText'>\" + title + \"</p></td>\");\n }\n }\n\n }\n }\n //give the notes their animations and click events\n whiteBorderAnimation($('#noteTable td'));\n refreshNoteClickEvents();\n }", "function showNotes() {\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n }\n else {\n notesObj = JSON.parse(notes);\n }\n\n let html = \"\";\n notesObj.forEach(function (element, index) {\n html += \n `<div class=\"noteCard card my-2 mx-2\" style=\"width: 18rem;\">\n <div id=\"card${index}\" class=\"card-body\" onclick=\"makeNoteImportant(this.id.slice(4))\">\n <h5 class=\"card-title\">Note ${index + 1} : <em>${element.title}</em></h5>\n <p class=\"card-text\">${element.text}</p>\n <button id=\"${index}\" onclick=\"deleteNote(this.id)\" class=\"btn btn-primary\">Delete Note</button>\n </div>\n </div>`\n });\n\n let notesElm = document.getElementById(\"notes\");\n if(notesObj.length != 0){\n notesElm.innerHTML = html;\n notesObj.forEach((element,index) => {\n if(element.important == true){\n document.getElementById(\"card\"+String(index)).classList.add(\"myStyle\");\n }\n });\n }\n else{\n notesElm.innerHTML = `<p> Nothing to show! Kindly add notes </p>`\n }\n\n}", "function showNote(note, button) {\n shownNote = note;\n shownNoteButton = button;\n $(\"#noteTime\", slide.contentDocument).text(new Date(note.time).toLocaleString());\n $(\"#noteBody\", slide.contentDocument)[0].value = note.body;\n $(\"#noteBody\", slide.contentDocument)[0].focus();\n }", "function showNote(notes, str) {\n\t// in case few notes shares same title\n\tlet result = '';\n\t// parsing\n\tlet arr = str.split('note ');\n\tlet title = arr[1];\n\t// checking format\n\tif(!title) {\n\t\treturn \"Usage: Show note _title_\";\n\t}\n\tnotes.map(note=>{\n\t\tif(title===note.title) {\n\t\t\tresult += `Title: ${note.title} Body: ${note.body}\\n`\n\t\t};\n\t});\n\tif(!result) {\n\t\treturn \"Matching notes not found.\";\n\t}\n\treturn result;\n}", "function getMatterNotes() {\n self.loaderFlagStatus = false;\n self.migrate = localStorage.getItem('Migrated');\n intakeNotesDataService.getFilteredNotes(intakeId, self.selectedFilters, intakeNotesDataService.customPageNum)\n .then(function (data) {\n self.isDataAvailable = true;\n self.showMoreAll = true;\n \n //hide more and all\n if(intakeNotesDataService.customPageNum == 1 && data.notes.length < 9 ){\n self.showMoreAll = false;\n }\n\n // self.intake_name = utils.isNotEmptyVal(data.notes) ? data.notes[0].intake_name : '';\n //Store notes list\n if (data && data.notes) {\n self.notesList = data.notes;\n (data.notes.length == 0) ? self.noData = true : self.noData = false;\n self.totalNotesCount = data.totalCount;\n _.forEach(self.notesList, function (note) {\n note.text = note.text;\n if (utils.isEmptyVal(note.linked_contact) || note.linked_contact == \"null\") {\n note.first_name = \"\";\n }\n if (utils.isEmptyVal(note.linked_contact) || note.linked_contact == \"null\") {\n note.last_name = \"\";\n }\n setDisplayText(note);\n notesDataService.setSearchableData(note);\n });\n setGridHeight();\n } else {\n self.notesList = [];\n }\n self.loaderFlagStatus = true;\n });\n }", "function displayNotes(notes) {\n var oldContent = document.getElementById('script');\n var para = document.createElement(\"p\");\n para.id = 'script';\n var newContent = document.createTextNode(notes);\n para.appendChild(newContent);\n presenterNotes.replaceChild(para, oldContent);\n}", "function showNotes() {\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n let count=0;\n let html = \"\";\n //creating the card which will store the note\n notesObj.forEach(function (element, index) { \n html += `\n <div class=\"noteCard my-2 mx-2 card\" style=\"width: 18rem;\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${element.title}</h5>\n <p class=\"card-text\"> ${element.text}</p>\n \n <button id=\"${index}\" onClick=\"deleteNote(this.id)\" class=\"btn btn-primary\">Delete Note</a>\n </div>\n </div>\n `;\n });\n//displaying the notes\n let notesElm = document.getElementById(\"notes\");\n if (notesObj.length != 0) {\n notesElm.innerHTML = html;\n } else {\n notesElm.innerHTML = `<span style=\"color: red;\">Uh oh!</span>\n <span>You haven't added any notes yet!</span><br>`;\n }\n}", "function loadNotes() {\n noteId = 0;\n idx = 1;\n notes = [];\n document.getElementById('data').innerHTML = '';\n\n chrome.storage.sync.get('todos_notes', function(result) {\n notes = result.todos_notes;\n if (!notes) {\n notes = [''];\n }\n createNotes(notes, idx, 0);\n });\n }", "function _pirntMatterNotes(filterObj, noteList, user, matterinfo) {\n var newNoteList = [];\n var noteObj = {};\n var filtersForPrint = _getFiltersForPrint(filterObj, user, matterinfo);\n _.forEach(noteList, function (singleNote) {\n if (singleNote.catdes == null) {\n singleNote.catdes = 'Note';\n }\n if (utils.isEmptyVal(singleNote.fname) && singleNote.type != 'email') {\n singleNote.lname = '';\n }\n\n })\n\n var printPage = _getPrintPage(filtersForPrint, angular.copy(noteList));\n window.open().document.write(printPage);\n }", "function viewNote() {\n // increment views\n Note.get({id: $stateParams.id}).$promise.then(function(response){\n $scope.resource = response.data.resource;\n $scope.relatedResources = response.data.related_resources;\n });\n }", "function getNote () {\n\n var note = {\n owner: \"auk2@njit.edu\",\n title: \"todo\",\n items: [ \"laundry\", \"apply jobs\", \"gym\" ],\n createDate: \"1/1/2016\",\n lastModified: \"1/2/2016\",\n sharedWith: \"a.froze.ak@gmail.com\"\n }\n\n return note;\n\n } //end getNote()", "function showNotesEditor(noteId, noteTitle = '', noteContent = '') {\n\n newNoteBtn.addClass('d-none');\n let label = noteId ? 'Editar Nota' : 'Nueva Nota';\n let buttonText = noteId ? 'Actualizar Nota' : 'Guardar Nota';\n\n notesContainer.html(`\n <div style='text-align: center;'>\n <h4>${label}</h4>\n </div>\n <div class='form' style='margin: 15px'>\n <input id='note-title' type='text' class='form-control' placeholder='Título' maxlength='500' value='${noteTitle}'>\n <textarea id='note-content' class='form-control mt-3' placeholder='Contenido' id='floatingTextarea' style='height: 350px'>${noteContent}</textarea>\n </div>\n <div style='text-align: right; margin: 15px'>\n <button id='upsert-note' class='btn btn-success ms-auto'>${buttonText}</button>\n <button id='edit-note-cancel' class='btn btn-warning ms-auto'>Cancelar</button>\n </div>\n `);\n\n $('#edit-note-cancel').on('click', function () {\n loadNotes();\n });\n\n $('#upsert-note').on('click', function () {\n\n const title = $('#note-title').val().trim();\n const content = $('#note-content').val().trim();\n\n if (title === '') {\n iziToast.warning({\n message: 'Ingresa el título de la nota',\n close: true,\n timeout: 2000,\n });\n return;\n }\n\n if (content === '') {\n iziToast.warning({\n message: 'Ingresa el contenido de la nota',\n close: true,\n timeout: 2000,\n });\n return;\n }\n\n if (!noteId) {\n // Nueva Nota\n executeRequest('POST', 'notes/create', { title: title, content: content }).then(r => {\n\n iziToast.success({\n message: 'La nota se ha guardado correctamente',\n close: true,\n timeout: 1500,\n });\n\n loadNotes();\n\n }).catch(() => {\n // Se maneja en la petición\n });\n } else {\n // Actualizar Nota\n executeRequest('PATCH', 'notes/update', { id: noteId, title: title, content: content }).then(r => {\n\n iziToast.success({\n message: 'La nota se ha actualizado correctamente',\n close: true,\n timeout: 1500,\n });\n\n loadNotes();\n\n }).catch(() => {\n // Se maneja en la petición\n });\n }\n });\n\n}", "function publicGetNote(req, res) {\n if (!req.params.id) {\n res.statusCode = 400;\n return res.send('Invalid \"id\" parameter.');\n }\n notesRepository.get(req.params.id, function (err, note) {\n if (err) {\n console.log('notesController:publicGetNote: ' + err);\n res.statusCode = 500;\n return res.send('An internal server error occured. Please contact sys admin or consult the log file');\n }\n if (note == null) {\n res.statusCode = 404;\n return res.send('Note with id \"' + res.params.id + '\" not found');\n }\n return res.json(note);\n });\n}", "async function showNotesModel() {\n if (currentAdmission.notes.length != 0) {\n const editDeleteNotesModel = document.querySelector('.edit-delete-notes-model');\n editDeleteNotesModel.style.display = \"block\";\n const notesList = document.querySelector('.notes-list');\n const notesListHTML = currentAdmission.notes.map((n, index) => {\n return `<tr>\n <td style=\"padding: 10px 20px;\"><textarea class=\"filed\" id=\"edited-note\">${n}</textarea></td>\n <td style=\"padding: 10px 20px;\"><button class=\"btn action-btn green\" onclick=\"editNote(${index})\">Update</button></td>\n <td style=\"padding: 10px 20px;\"><button class=\"btn action-btn red\" onclick=\"deleteNote(${index})\">Delete</button></td>\n </tr>`\n }).join('\\n');\n notesList.innerHTML = notesListHTML;\n } else\n alert('There are no notes to be edited!')\n}", "function showNotes()\n{\n let notes = localStorage.getItem('notes');\nif (notes == null)\n{\n notesObj = [];\n}\nelse\n{\n notesObj = JSON.parse(notes);\n}\n\nlet html = '';\nnotesObj.forEach(function(element,index){\n\n html += `\n <div class=\"noteCard my-3 mx-3 card\" style=\"width: 18rem\">\n <div class=\"card-body\">\n <div class=\"cart-title\"><strong>Title: ${element.title}</strong></div>\n <p class=\"card-text\">${element.text}</p>\n <a onclick = \"deleteNote(this.id)\" id = \"${index}\" class=\"btn btn-success\">Delete Notes</a>\n </div>\n</div>`;\n\n});\n\nlet notesEle = document.getElementById('notes')\n\nif (notesObj != 0){\n\n notesEle.innerHTML = html;\n}\nelse{\n\n notesEle.innerHTML = `<strong>Nothing is show here \"Please go above and add some notes\" - Thanks </strong>`\n\n}\n\n}", "function edit_note(note_id, note_name) {\n fetch(`${note_name}/edit/${note_id}`)\n .then(response => response.json())\n .then(notes => {\n Array.prototype.forEach.call(notes.task, note => {\n document.querySelector(`#edit-note-${note.id}`).style.display == 'block'\n document.getElementById(`edit-note-${note.id}`).innerHTML = `<form id=\"edit_note\"> <textarea rows=\"5\" cols=\"45\" id=\"newnote\">${note.note}</textarea> <br> <button class=\"save_edit btn btn-dark\" type=\"submit\"> Save </button></form>`;\n\n document.querySelector('#edit_note').onsubmit = function() {\n fetch(`${note_name}/edit/${note_id}`, {\n method: 'PUT',\n body: JSON.stringify({\n note: document.querySelector('#newnote').value\n })\n })\n }\n })\n })\n }", "function edit_note(c_id, q_id){\n $('.edit_comment_class').hide();\n $('.view_comment_class').hide();\n $('.archive_comment_class').hide();\n $('#lastet_comment_div_'+ q_id).hide();\n $('#view_comment_div_'+ c_id).hide();\n $('#archive_comment_div_'+ c_id).hide();\n $('#add_comment_block_div_'+ q_id).hide();\n $('#edit_comment_div_'+ c_id).show();\n $('#add_comment_button_top_div_'+ q_id).show();\n}", "function shownotes() {\n let notes = localStorage.getItem('notes');\n\n if (notes == null) {\n notesObj = [];\n }\n else {\n notesObj = JSON.parse(notes);\n }\n\n let html = \"\"\n notesObj.forEach(function (element, index) {\n html += `\n <div class=\"container my-2 mx-2\"\n <div class=\"card\" style=\"width: 18rem; Border: 2px solid rgb(194, 152, 152);\">\n \n <div class=\"card-body\">\n <h5 class=\"card-title\">${element.title}</h5>\n <p class=\"card-text\">${element.text}</p>\n <button id=\"${index}\" onclick=\"deletenote(this.id)\" class=\"btn btn-primary\">Delete Note</button>\n </div>\n </div>\n </div>\n `;\n\n });\n let noteElm=document.getElementById('notes');\n if(notesObj.length != 0){\n noteElm.innerHTML=html;\n }\n else{\n noteElm.innerHTML=\"You do not have any notes....\"\n }\n \n \n\n}", "function getNotes(name){\n $('#edit_note').modal();\n //set title\n document.getElementById('noteTitle').innerHTML = \"Notes for \" +name;\n\n document.getElementById('name_hidden2').value = name;\n \n}", "displayNote(key, message) {\n let note = document.getElementById(key);\n // If no element with the given key exists we create a new note.\n if (!note) {\n note = document.createElement(\"sticky-note\");\n note.id = key;\n this.notesContainer.insertBefore(\n note,\n this.notesSectionTitle.nextSibling\n );\n }\n // If the message is null we delete the note.\n if (!message) {\n return note.deleteNote();\n }\n note.setMessage(message);\n }", "async function renderNotes(showDone = showDeleted, sortMethode = sortOrder) {\n const notes = await notesService.getNotes(showDone, sortMethode);\n const todoHtml = await createTodosHtml(notes);\n todoElement.innerHTML = '';\n todoElement.innerHTML = todoHtml;\n}", "function twetchUnmute(userId) {\n let posts = $(\"div[id^='post']\");\n posts.find(\"a[href='\" + userId + \"']\")\n .parent()\n .parent()\n .show();\n}", "function handlenoteEdit() {\n var currentnote = $(this).parents(\".note-panel\").data(\"id\");\n editnote(currentnote);\n }", "function printNote(note) {\n if (note === undefined) {\n console.log('Note not found!');\n return;\n }\n\n if (note.type === 'Notes') {\n console.log(\n 'title: ' +\n note.title +\n '\\n\\tfilename: ' +\n note.filename +\n '\\n\\thashtags: ' +\n note.hashtags +\n '\\n\\tmentions: ' +\n note.mentions +\n '\\n\\tcreated: ' +\n note.createdDate +\n '\\n\\tchanged: ' +\n note.changedDate,\n );\n } else {\n console.log(\n 'date: ' +\n note.date +\n '\\n\\tfilename: ' +\n note.filename +\n '\\n\\thashtags: ' +\n note.hashtags +\n '\\n\\tmentions: ' +\n note.mentions,\n );\n }\n}" ]
[ "0.75691617", "0.7261484", "0.72408557", "0.7106856", "0.69120866", "0.6826649", "0.67025614", "0.6672057", "0.66223276", "0.66200423", "0.6555716", "0.65519613", "0.65404904", "0.65312004", "0.65212363", "0.6504733", "0.6503787", "0.6500433", "0.64774144", "0.64636827", "0.64574796", "0.6456345", "0.6455836", "0.6452744", "0.6445701", "0.64408344", "0.643845", "0.6426474", "0.64189893", "0.6418205", "0.64115983", "0.64060915", "0.6387209", "0.63868153", "0.63694715", "0.6354284", "0.63525516", "0.633743", "0.6336694", "0.6334139", "0.6322905", "0.6300981", "0.6296217", "0.62840253", "0.6265415", "0.6264968", "0.6240908", "0.6220232", "0.621653", "0.6214888", "0.6206672", "0.62026787", "0.6201471", "0.61616594", "0.61605614", "0.6159688", "0.6156203", "0.61439097", "0.612232", "0.611609", "0.6113449", "0.6104338", "0.6104208", "0.6095911", "0.6088264", "0.60853666", "0.6077017", "0.6064289", "0.6058304", "0.6050709", "0.604997", "0.604854", "0.60454875", "0.6039547", "0.6038494", "0.6037082", "0.60303396", "0.6026749", "0.6016243", "0.5973866", "0.5968756", "0.59673196", "0.5949315", "0.59428203", "0.59143335", "0.5907157", "0.5906408", "0.5902308", "0.5899837", "0.5897476", "0.58896154", "0.5878065", "0.5861362", "0.5856011", "0.585522", "0.5853008", "0.5849147", "0.58428967", "0.5842247", "0.5838381" ]
0.7279055
1
function to delete note according to its id
function deleteNote(index) { let noteObj = { id: index, }; var data = Object.keys(noteObj) .map(function (key) { return key + "=" + noteObj[key]; }) .join("&"); fetch("http://localhost:8081/php-notes-app/delete-note-by-id.php", { body: data, method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" } }) .then(response => response.json()) .then(data => { if (data.message === "success") { showAlert("Note Deleted!", "danger"); showNotesById(userid.value); } }) .catch(error => { console.log('error: ', error); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deleteNote(id) {\n let index = this.jsonData().findIndex(element => parseInt(element.id) === parseInt(id));\n if (index !== -1) {\n let noteData = this.jsonData();\n noteData.splice(index, 1);\n this.storeData(noteData);\n }\n }", "function deleteNote(id) {\n\n firebase\n .firestore()\n .collection(\"NoteApp\")\n .where('id', '==' ,id)\n .get()\n .then((querySnapshot) => {\n querySnapshot.forEach((doc) => doc.ref.delete());\n });\n // To delete that item, we filter out the item we don't want\n setNotes(notes.filter((item) => item.id !== id));\n }", "function deleteNote(id) {\n setNotesList(prevList => {\n return (prevList.filter(\n (value, index) => index !== id))\n });\n }", "function deleteNote(id) {\n setNotes((prevNotes) => {\n return prevNotes.filter((noteItem, index) => {\n return index !== id;\n });\n });\n }", "deleteNote(id) {\n return this.getNotes()\n .then((notes)=>notes.filter((note)=>note.id !== id))\n .then((filteredNotes)=>this.write(filteredNotes));\n }", "deleteNote(id) {\n // This retrieves all notes, remotes the note with the specified unique ID, and finally writes the filtered notes.\n return this.retrieveNotes()\n .then((notes) => notes.filter((note) => note.id !== id))\n .then((filteredNotes) => this.writeFile(filteredNotes));\n }", "function removeNote(id) {\n // find object (note) for which id equals the argument\n const noteIndex = notes.findIndex(function(note) {\n return note.id === id;\n });\n if (noteIndex > -1) {\n // delete that one object\n notes.splice(noteIndex, 1);\n }\n}", "deleteNote(id) {\n if(this.locations.hasOwnProperty(id)) {\n delete this.locations[id];\n }\n this.dirtyNotesId.delete(id);\n\n for(let i in this.notes) {\n if(this.notes[i].id === id) {\n this.notes.splice(i,1)\n break;\n }\n }\n }", "removeNote(id) {\n // use get notes function to acess array of notes\n return this.getNotes()\n // filter through notes array to get all notes besides the one with the matching ID\n .then(notes => this.write(notes.filter(note => note.id != id)))\n }", "function deleteNote(id) {\r\n console.log(\"deleted id: \" + id);\r\n\r\n setListNote((prevList) => {\r\n return prevList.filter((note, index) => {\r\n return index !== id;\r\n });\r\n });\r\n }", "deleteNote(id) {\n // This uses the same kind of logic. It doesn't actually delete the note...\n return this.getNotes()\n // we find the note we want to delete by filtering throught notesArr by id \n .then(notesArr => notesArr.filter((note) => note.id !== id))\n // and create a NEW ARRAY with the new note inside\n .then(filteredNotesArr => this.write(filteredNotesArr))\n }", "function deleteNote(noteId) {\n Swal.fire({\n title: 'Eliminar Nota',\n text: `¿Estás seguro(a) que quieres eliminar la nota ${noteId}?, esta acción no se puede deshacer.`,\n icon: 'warning',\n showCancelButton: true,\n confirmButtonText: 'Sí, Eliminar',\n cancelButtonText: 'Cancelar'\n }).then((result) => {\n if (result.isConfirmed) {\n executeRequest('DELETE', 'notes/delete', { id: noteId }).then(r => {\n\n iziToast.success({\n message: 'Nota eliminada',\n close: true,\n timeout: 1500,\n });\n\n loadNotes();\n\n }).catch(() => {\n // Se maneja en la petición\n });\n }\n })\n}", "function deleteNote() {\n const note_id = note.id;\n axios\n .delete(`/api/deleteNote/${note_id}`)\n .then((res) => {\n // console.log(res.data);\n })\n .catch((error) => console.log(error));\n }", "function deleteNote (noteId) {\n request\n .delete(`https://notes-api.glitch.me/api/notes/${noteId}`)\n .auth('liz', 'dogsarebetterthancats')\n .then(response => {\n notesList = notesList.filter(note => note._id !== noteId)\n console.log(notesList)\n })\n}", "removeNote(id) {\n return this.getNotes()\n .then((notes) => notes.filter((note) => note.id !== id))\n .then((filteredNotes) => this.write(filteredNotes));\n }", "static dSTIdNoteNoteIdDELETE({ id, noteId }) {\n return new Promise(\n async (resolve) => {\n try {\n resolve(Service.successResponse(''));\n } catch (e) {\n resolve(Service.rejectResponse(\n e.message || 'Invalid input',\n e.status || 405,\n ));\n }\n },\n );\n }", "function deleteNote(worker, noteId) {\n if (noteId != null) {\n datastore.deleteNote(noteId);\n worker.port.emit(\"NoteDeleted\", noteId);\n }\n}", "function deletenote(id) {\n $.ajax({\n method: \"DELETE\",\n url: \"/api/notes/\" + id\n })\n .done(function() {\n getnotes(noteCategorySelect.val());\n });\n }", "removeNote(noteId) {\n //localizando el hijo y buscarlo por el id\n this.db.child(noteId).remove();\n\n }", "function DeleteNoteFromList(id){\n\t\t//this.projNotes[];\n\t\tvar noteIndex = FindProjNote(id);\n\t\t\n\t\tif(typeof noteIndex != \"boolean\"){\n\t\t\tprojNotes.splice(noteIndex, 1);\n\t\t\tnoteListChanged=true;\n\t\t}\n\t\t\n\t\t\n\t}", "function deleteNote(noteId) {\n\tif (confirm('Are you sure?')) {\n\t\t// get branch of the specific note\n\t\tvar toDelete = notesdb.child(noteId);\n\t\t// remove\n\t\ttoDelete.remove();\n\t}\n}", "deleteNote(knex, id) {\n /* return Promise.resolve({}) */\n return knex('noteful_notes')\n .where({ id })\n .delete()\n }", "function note_delete()\n {\n // grab the .data element of note to delete\n var axe_it = $(this).data(\"_id\");\n $.ajax(\n {\n url: \"/api/notes/\" + axe_it,\n method: \"DELETE\"\n }).then(function()\n {\n // on success, hide the modal\n bootbox.hideAll();\n });\n }", "function deleteNote(noteID) {\n // Retrieve the object store for the notes.\n var objectStore = database.transaction([\"notes\"], \"readwrite\").objectStore(\"notes\");\n console.log(noteID);\n \n // Remove the note from the database.\n objectStore.delete(noteID);\n\n // Remove the radio button for the note.\n var button = $('input[value=\"' + noteID + '\"]');\n $(button[0].parentElement).slideUp(\"fast\");\n}", "removeNote(id) {\n return this.getInfo()\n .then((info) => info.filter((info) => info.id !== id))\n .then((filteredInfo) => this.write(filteredInfo));\n }", "function deleteNote(event) {\n event.preventDefault();\n const element = event.target;\n\n const note = $(this).data('id');\n\n $.ajax({\n method: 'delete',\n url: `/api/notes/${note}`,\n headers: { 'X-CSRF-Token': token },\n }).done(() => {\n $(element).parents('.note').remove();\n });\n }", "function deleteNote(id) {\n // remove the note at index: id from the json array\n data.splice(id, 1);\n // Update the ids for every other note to match their updated position in the array\n for (let i = 0; i < data.length; i++) {\n data[i].id = i;\n }\n // Write the updated array to the json file\n fs.writeFile(dbPath, JSON.stringify(data), error => {\n if(error){\n throw error;\n }\n })\n}", "function deleteNote(id, notesArray) {\n let noteID = parseInt(id);\n for (let i = 0; i < notes.length; i++) {\n if (noteID === notes[i].id) {\n notes.splice(i,1);\n if (notes.length > 0) {\n notes[0].id = 0;\n for (let j = 1; j < notes.length; j++) {\n notes[j].id = notes[j-1].id + 1;\n } \n }\n fs.writeFileSync(\n path.join(__dirname, '../db/db.json'),\n JSON.stringify({ notes: notesArray }, null, 2)\n );\n }\n }\n return notes;\n}", "async delete(noteID) {\r\n let store = await this.notesAccessStore(\"readwrite\")\r\n return store.delete(Number(noteID))\r\n }", "function deleteNote(noteId) {\n $('#mainNoteDiv' + noteId).removeClass(\"note\")\n $('#deleted' + noteId).val(\"true\");\n $('#textarea' + noteId).hide();\n $('#goBackButton' + noteId).hide();\n $('#subNoteButton' + noteId).hide();\n $('#select' + noteId).hide();\n $('#delButton' + noteId).hide();\n $('#goBack' + noteId).remove();\n\n for (var i = 0; i < map.length; i++) {\n if (map[i] == noteId) {\n deleteNote(i)\n }\n }\n }", "deleteNote(id) {\n// get the notes, filter and grab out the one in the id\nreturn this.getNotes()\n.then(notes => (notes.filter(note => note.id !== parseInt(id))))\n.then(newNoteSet => asyncWriteFile(\"db/db.json\", JSON.stringify(newNoteSet)))\n }", "async function deleteNoteById(id) {\n const result = await query(\"DELETE FROM notes WHERE id = $1 RETURNING id;\", [\n id,\n ]);\n return result.rows[0].id;\n}", "function deleteNote(noteEl) {\n fetch(url + '/' + `${noteEl.id} `, {\n method: 'DELETE'\n }).then(() => noteEl.parentElement.remove())\n}", "function deleteById(id, notesArray) {\n const requiredIndex = notesArray.findIndex(el => {\n return el.id === String(id);\n });\n if (requiredIndex === -1){\n return false; \n };\n notesArray.splice(requiredIndex, 1);\n fs.writeFileSync(\n path.join(__dirname, '../db/db.json'),\n JSON.stringify({ notes: notesArray }, null, 2)\n ); \n return notesArray; \n}", "function handlenoteDelete() {\n var currentnote = $(this).parents(\".note-panel\").data(\"id\");\n deletenote(currentnote);\n }", "function delNote(){\r\n\tvar t = document.querySelector(\"#notes\");\r\n\tvar tr = t.childNodes[0];\r\n\ttr.deleteCell(tr.childElementCount-1);\r\n\tdelState();\r\n\t\r\n\trefreshNotes();\r\n}", "function delNote(d)\n{\n // get key as id, then remove that object from DB\n var keyToDel = d.id\n loc.child(keyToDel).remove()\n\n // delete from web page\n var rowToBeDel = d.parentNode.parentNode\n var ch0 = rowToBeDel.childNodes[0]\n var ch1 = rowToBeDel.childNodes[1]\n var ch2 = rowToBeDel.childNodes[2]\n rowToBeDel.removeChild(ch0)\n rowToBeDel.removeChild(ch1)\n rowToBeDel.removeChild(ch2)\n}", "removeNote(noteId) {\n var user = this.props.uid;\n const noteRef = firebase.database().ref(`users/${user}/notes/${noteId}`);\n noteRef.remove();\n }", "function deleteNoteById(id, noteArr){\n let updatedNoteArr\n // if the arr is empty then return an empty arr\n if(noteArr.length == 0) updatedNoteArr = [];\n else{\n // otherwise, return all elements that dont match that id from passed arr\n updatedNoteArr = noteArr.filter(note => id != note.id);\n // update id's post removal corresponding to the elements index\n updatedNoteArr.forEach((note, index) => {\n note.id = index;\n updatedNoteArr[index] = note;\n });\n }\n // wite\n fs.writeFileSync(path.join(__dirname, '../data/notes.json'), JSON.stringify({notes: updatedNoteArr}, null, 2));\n return updatedNoteArr;\n}", "deleteNote(privateNote) {\n privateNote.deleteRecord();\n privateNote.save();\n }", "function deleteNoteFromDB(deletedNoteId) {\n const requestOptions = {\n method: \"DELETE\",\n };\n fetch(\"/dataItems/\" + deletedNoteId + \"/delete\", requestOptions)\n .then((res) => res.json())\n //using the JSON response we'll now delete the note from the Array\n .then((deletedNote) => {\n deleteNoteFromArray(deletedNote.noteId);\n });\n }", "function deleteNote() {\n if (oSelectedNote != null) {\n oData.jsFormula.removeNote(oSelectedNote.nuNote);\n oNotesTable.row('.selected').remove().draw( false );\n initNote();\n }\n}", "delete({ note }, res) {\n console.log(\n `${dateFormat(null, \"isoUtcDateTime\")} - REQUEST delete [${note.id}]`\n );\n\n db.collection(\"notes\").deleteOne({ id: note.id }, (err, result) => {\n if (err) {\n return console.log(err);\n }\n res.sendStatus(204);\n\n db\n .collection(\"notes\")\n .find()\n .toArray(function(err, results) {\n broadcast(results);\n });\n });\n }", "function deleteNote(userId, noteId, done) {\n logger.info(\"Inside service method - delete existing note\");\n notesDao.deleteNote(userId, noteId, done);\n}", "function deleteNote(index, id, date, label) {\n if (confirm(infoErrorObj.noteDeleteQ) == true) {\n CalendarService.deleteNote(id)\n .then(function (response) {\n if (response.data.message == 'deleteOk') {\n\n var currentYear = self.activeDayObj.year,\n currentMonth = toZeroBased(self.months.indexOf(self.activeDayObj.month) + 1),\n day = toZeroBased(self.activeDayObj.num.toString()),\n noteDate;\n\n if (!currentMonth && !currentYear && !day) {\n return toastr.error(infoErrorObj.noCurrentDate);\n }\n\n noteDate = currentYear + '-' + currentMonth + '-' + day;\n\n if (date == noteDate) {\n\n // Decrement note based on which one is removed\n if (label == 'Yellow') {\n self.activeDayObj.yellow--;\n }\n if (label == 'Green') {\n self.activeDayObj.green--;\n }\n if (label == 'Blue') {\n self.activeDayObj.blue--;\n }\n if (label == 'Red') {\n self.activeDayObj.red--;\n }\n\n // Remove note from active day notes\n self.activeDayObj.notes.splice(index, 1);\n }\n\n toastr.info(infoErrorObj.deleteOk);\n\n }\n })\n .catch(function (error) {\n // do some error handling\n })\n }\n\n }", "function deleteNote(note) {\n setAllNotes(allNotes.filter(item => item !== note));\n const notesDataJson = JSON.stringify(allNotes);\n localStorage.setItem('notesData', notesDataJson);\n }", "function deleteGoalNote(worker, noteId) {\n if (noteId != null) {\n datastore.deleteNote(noteId);\n worker.port.emit(\"GoalNoteDeleted\", noteId);\n }\n}", "function removeNote(req, res) {\n Note.remove({\n _id: req.params.id\n })\n .then(dbNoteData => res.status(200).json(dbNoteData))\n .catch(err => {\n console.log(err);\n res.status(500).json(err);\n });\n}", "deleteNote(note) {\n this.notes = this.notes.filter(item => item !== note);\n }", "function deleteElementFromObject(id){\n \n for(let i=0;i<notes.length;i++){\n if(notes[i].id===id){\n notes.splice(i,1);\n }\n}\nconsole.log(notes);\n}", "removeNote(noteId){\n console.log(noteId);\n // 29) to remove the note from our database, we have to tell it from what reference-- in this case we tell it to go to the key\n //we're grabbing that location in our database and saying to remove it \n //now move on to notesCard.js to allow us to edit our cards\n\n //63) we also need to grab the userID as well again\n // part 64 starts in our notesCard which is for editing \n const userId = firebase.auth().currentUser.uid;\n\n //62) we grabbed from 61) because we tiered it and have to drill down to where the note is\n const dbRef = firebase.database().ref(`users/${userId}/notes/${noteId}`);\n dbRef.remove();\n }", "function deleteNote(index) {\r\n const uid = localStorage.getItem(\"uid\")\r\n var adaRef = firebase.database().ref('notes/' + uid + '/' + index);\r\n adaRef.remove()\r\n .then(function () {\r\n getNotesForThisUser().then(notes => display(notes)).catch(err => handleError(err))\r\n CKEDITOR.instances[\"addTxt\"].setData('');\r\n })\r\n .catch(function (error) {\r\n console.log(\"Remove failed: \" + error.message)\r\n });\r\n\r\n\r\n\r\n}", "async function delNote (noteId) {\n await utils.asyncForEach(noteId, async function (id) {\n const socket = await utils.connect(id)\n socket.on('connect', async () => {\n socket.emit('delete')\n await delHistoryNote([id])\n })\n })\n\n personalCache = await utils.getPersonal()\n const hrefList = personalCache.map(e => e.href)\n var fail = []\n noteId.forEach(id => {\n if (hrefList.indexOf(id) !== -1) fail.push(id)\n })\n\n if (fail.length > 0) return delNote(fail)\n return []\n}", "async delNote(req, res) {\n try {\n //get the users notes\n const usersNotes = await Notes.findOne({ ID: req.params.ID });\n //handle error if note doesnt exist;\n if (!usersNotes) return res.status(401).send(\"something went wrong\");\n } catch (error) {\n return res.status(400).json({ error: error.message });\n }\n }", "function deleteNote(note) {\n note.remove();\n borderedNote = null;\n}", "function deleteNote(note, bord) {\n var dragid = ($('#' + bord).attr('draggable') == 'true') ? 'true' : 'false';\n if (dragid == 'true') {\n delNote('https://localhost:44382/api/notes/', parseInt($('#link' + note.substring(4, 9)).val()));\n $('#' + note).remove();\n }\n else {\n alert('Column is locked. Please unlock Column before deleting note');\n }\n }", "function deleteNote() {\n\t$('.nota-delete').on('click', function(e) {\n\t\te.preventDefault();\n\t\tvar $this = $(this);\n\t\tvar note = $this.closest('.nota-thumb');\n\t\tnote.addClass('transparent');\n\t\tsetTimeout(function() {\n\t\t\tnote.remove();\n\t\t}, 500);\n\t\tvar key = note.attr('id');\n\t\tconsole.log(key);\n\t\tlocalStorage.removeItem(key);\n\t});\n}", "function deleteNote() {\n card_body = $(this).parent();\n card = $(this).parent().parent();\n\n text_delete_title = card_body.find($('textarea')).val();\n changeStatus(text_delete_title, \"binned\");\n\n localStorage.setItem(\"Notes\",JSON.stringify(notes));\n card.remove();\n \n $('.toast').toast(\"show\");\n}", "function deleteSingleNote() {\n $('.delete-note').each(function() {\n $(this).click(function() {\n note.delete(Number($(this).closest('.col-md-4').attr('id')));\n updateChromeNewTab();\n });\n });\n}", "function deleteNote(d) {\n var selectedListItem = noteList.options[noteList.selectedIndex];\n if (d.keyCode == 46) {\n var j = selectedListItem.id;\n var deletedNode = document.getElementById(j);\n localStorage.removeItem(j);\n var sbq = document.getElementById(\"note-\" + j);\n sbq.innerText = \"\";\n sbq.removeAttribute(\"id\");\n while (noteList.lastChild) {\n noteList.removeChild(noteList.lastChild);\n }\n displayListNotes();\n }\n}", "function deleteNote(index) {\n console.log(\"One note deleted\",\"The id is : \",index);\n\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n }\n else {\n notesObj = JSON.parse(notes);\n }\n\n //splice take the starting index from where to delete,and the number of the element\n notesObj.splice(index,1);\n localStorage.setItem(\"notes\", JSON.stringify(notesObj));\n showNotes();\n}", "function removeNoteElement(id) {\n try{\n var noteElm = getNoteElementById(id);\n if (!noteElm) {\n return;\n }\n\n// Remove parent of icnote, which is sub tag\n removeElement(noteElm.parentNode);\n } catch (e) {\n window.TextSelection.jsError(\"removeNoteElement\\n\" + e);\n }\n}", "function deleteNote(index){\n let confirmDel = confirm(\"Are you sure you want to delete this?\");\n if(confirmDel == true){\n let notes = localStorage.getItem(\"Notes\"+id);\n //if notes in localstorage is empty declare one\n if(notes == null){\n notesObj = [];\n } else{\n notesObj = JSON.parse(notes);\n }\n\n notesObj.splice(index, 1);\n localStorage.setItem(\"Notes\"+id, JSON.stringify(notesObj));\n showNotes();\n }\n }", "function deleteReminder(userId, noteId, done) {\n logger.info(\"Inside DAO method - delete reminder\");\n remindersModel.findOneAndRemove({\n userId: userId,\n noteId: noteId\n }, (err, deletedReminderObj) => {\n if (err) return done(`Error while deleting a particular Reminder ${err}.`); \n return done(null, { response: deletedReminderObj, message: \"Reminder deleted successfully.\" });\n });\n}", "function delNote(req, res) {\n Note.findByIdAndDelete(req.params.id)\n .then(function (note) {\n res.redirect(`/recipes/${req.params.recipeId}`)\n })\n .catch(function (err) {\n console.log(err)\n res.redirect('/')\n })\n}", "handler(argv) {\n notes.removeNote(argv.title)\n // console.log('Removing the note')\n }", "function deleteNote(username){\n if(db.get('posts').find({username: username}).value() !== undefined){\n // delete note\n db.get('posts').remove({username, username}).write()\n }\n else{\n // note does not exist\n }\n}", "function deleteNote(index)\n{\n//console.log(\"deleting\",index);\nlet notes=localStorage.getItem(\"notes\");\nif (notes===null)\n{\nnotesObj=[];\n}\nelse\n{\nnotesObj=JSON.parse(notes);\n}\nnotesObj.splice(index,1);\nlocalStorage.setItem(\"notes\",JSON.stringify(notesObj));\nshowNotes();\n}", "function deleteNote(index) {\n let notes_check = localStorage.getItem(\"notes\");\n if (notes_check == null) {\n notesObj = [];\n }\n else {\n notesObj = JSON.parse(notes_check);\n }\n\n /*we are deleting from the array notesObj the elemnt in which \"Delete Note\" has been clicked and the index of that element is passed here.1 indicates that we want to delete just one element from that index number.*/\n notesObj.splice(index, 1);\n\n //after deleting, we need to update the local storage and show the updated notes.\n localStorage.setItem(\"notes\", JSON.stringify(notesObj));\n\n //showing the updated notes\n showNotes();\n\n}", "function deleteNote(index) {\n \n let confirmDel = confirm(\"Are you sure want to delete this note!!\");\n\n if(confirmDel == true)\n {\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesobj = [];\n }\n else {\n notesobj = JSON.parse(notes);\n }\n notesobj.splice(index, 1);\n localStorage.setItem(\"notes\", JSON.stringify(notesobj));\n // deletemark(index);\n showNotes();\n }\n\n}", "function deleteNote(index)\n{\n console.log(\"I am clicking\" , index)\n let notes = localStorage.getItem('notes');\n if (notes == null)\n {\n notesObj = [];\n }\n else\n {\n notesObj = JSON.parse(notes);\n \n }\n\n notesObj.splice(index,1)\n localStorage.setItem(\"notes\" , JSON.stringify(notesObj));\n showNotes();\n}", "function note_delete(_noteindex){\r\n\tif(_noteindex>=0 & _noteindex<notes.length) {\r\n\t\tnotes.splice(_noteindex,1);\r\n\t\tnumnote--;\r\n\t}\r\n}", "function deleteNote(index){\n console.log(`I am deleting `,index);\n // let notes=localStorage.getItem(\"notes\");\n // if(notes==null){\n // notesobj=[];\n // }\n // else{\n // notesobj=JSON.parse(notes);\n // }\n notesobj.splice(index,1);\n localStorage.setItem(\"notes\",JSON.stringify(notesobj));\n showNotes();\n}", "async function deleteNoteHandler(event) {\n event.preventDefault();\n\n const id = window.location.toString().split('/')[\n window.location.toString().split('/').length - 1\n ];\n const response = await fetch(`/api/notes/${id}`, {\n method: 'DELETE'\n });\n\n if (response.ok) {\n document.location.replace('/dashboard');\n } else {\n alert(response.statusText);\n }\n}", "function deleteNote(index){\n console.log(\"Something deleted\");\n let notes=localStorage.getItem('notes');\n let titles = localStorage.getItem('title');\n if(notes==null){\n notesObj=[];\n }\n else{\n notesObj=JSON.parse(notes);\n }\n if (titles == null) {\n titlesObj = [];\n }\n else {\n titlesObj = JSON.parse(titles);\n }\n notesObj.splice(index,1);\n titlesObj.splice(index,1);\n notes=JSON.stringify(notesObj);\n titles=JSON.stringify(titlesObj);\n localStorage.setItem('notes',notes);\n localStorage.setItem('title',titles);\n showNotes();\n}", "function deleteNote(index) {\n // console.log(`I am Deleating the notes no :${index}`);\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesArr = [];\n }\n else {\n notesArr = JSON.parse(notes);\n }\n notesArr.splice(index, 1);\n localStorage.setItem(\"notes\", JSON.stringify(notesArr));\n showNotes();\n}", "function removeNote(e) {\n div_id = e.path[2].id;\n if (div_id !== 'data') {\n // do not delete the entire data element accidentally due to html image glitches.\n document.getElementById(div_id).remove();\n save_notes();\n loadNotes();\n }\n }", "async function deleteNote(title) {\n setRemoveItem(title)\n setNotes(() => {\n return notes.filter(el => {\n return el.title !== title;\n })\n })\n await axios.delete(\"http://localhost:4000/api/delete\", {data: {item: title}});\n\n }", "function deleteNote(index){\n // console.log('i am deleting' , index);\n let notes = localStorage.getItem(\"notes\");\n if(notes == null){\n notesObj = [];\n }\n else{\n notesObj = JSON.parse(notes);\n }\n notesObj.splice(index , 1);\n localStorage.setItem(\"notes\",JSON.stringify(notesObj));\n shownotes();\n}", "function deleteNote(index) {\r\n //console.log(\"Deleting Note\",index);\r\n let notes = localStorage.getItem(\"notes\");\r\n if(notes == null){\r\n notesObj = [];\r\n }\r\n else{\r\n notesObj = JSON.parse(notes);\r\n }\r\n notesObj.splice(index, 1);\r\n localStorage.setItem(\"notes\", JSON.stringify(notesObj));\r\n showNotes();\r\n}", "function deleteById(id) {\n id = parseInt(id)\n let exercise = findById(id);\n\n if (!exercise) \n throw new Error(`No exercise for id: ${id}`);\n\n exercises.delete(id)\n\n return exercise;\n}", "function deleteNote(index){\r\n // console.log(\"I am deleting\",index);\r\n let notes = localStorage.getItem('notes')\r\n if(notes==null){\r\n notesObj = [];\r\n }else{\r\n notesObj = JSON.parse(notes)\r\n\r\n }\r\n notesObj.splice(index,1);\r\n localStorage.setItem(\"notes\",JSON.stringify(notesObj));\r\n showNotes();\r\n}", "function deleteNote(index){\r\n\r\nlet notes = localStorage.getItem('notes');\r\n\r\n if(notes == null){\r\n notesObj = [];\r\n }\r\n else{\r\n notesObj = JSON.parse(notes);\r\n }\r\n \r\n notesObj.splice(index, 1);\r\n localStorage.setItem('notes', JSON.stringify(notesObj));\r\n showNotes();\r\n}", "function deleteNote(index) {\n let notes = localStorage.getItem('notes');\n if (notes == null) {\n notesObj = [];\n }\n else {\n notesObj = JSON.parse(notes);\n };\n notesObj.splice(index, 1);\n localStorage.setItem('notes', JSON.stringify(notesObj));\n \n \n let notesTitle = localStorage.getItem('notesTitle');\n if (notesTitle == null) {\n titleObj = [];\n }\n else {\n titleObj = JSON.parse(notesTitle);\n };\n titleObj.splice(index, 1);\n localStorage.setItem('notesTitle', JSON.stringify(titleObj));\n // localStorage.removeItem('Name2');\n showNotes();\n}", "function deleteNote(index) {\r\n// console.log(\"I am deleting\", index);\r\n\r\n let notes = localStorage.getItem(\"notes\");\r\n if (notes == null) {\r\n notesObj = [];\r\n } else {\r\n notesObj = JSON.parse(notes);\r\n }\r\n\r\n notesObj.splice(index, 1);\r\n localStorage.setItem(\"notes\", JSON.stringify(notesObj));\r\n showNotes();\r\n}", "function deleteNote(index) {\n\n\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n notesObj.splice(index, 1)\n localStorage.setItem('notes', JSON.stringify(notesObj));\n showNotes();\n}", "function deleteItem(e) {\n // retrieve the name of the task we want to delete. We need\n // to convert it to a number before trying it use it with IDB; IDB key\n // values are type-sensitive.\n let noteId = Number(e.target.parentNode.getAttribute('data-note-id'));\n\n // open a database transaction and delete the task, finding it using the id we retrieved above\n let transaction = db.transaction(['notes_os'], 'readwrite');\n let objectStore = transaction.objectStore('notes_os');\n let request = objectStore.delete(noteId);\n\n // report that the data item has been deleted\n transaction.oncomplete = function() {\n // delete the parent of the button\n // which is the list item, so it is no longer displayed\n e.target.parentNode.parentNode.removeChild(e.target.parentNode);\n console.log('Note ' + noteId + ' deleted.');\n\n // Again, if list item is empty, display a 'No notes stored' message\n if(!list.firstChild) {\n let listItem = document.createElement('li');\n listItem.textContent = 'No notes stored.';\n list.appendChild(listItem);\n }\n };\n}", "function deleteNote(index){\r\n // console.log('I am deleting', index);\r\n titleObj.splice(index, 1);\r\n notesObj.splice(index, 1);\r\n localStorage.setItem(\"notes\",JSON.stringify(notesObj));\r\n localStorage.setItem(\"title\",JSON.stringify(titleObj));\r\n\r\n\r\n showNotes();\r\n}", "function deleteNote(index) {\n\n\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n\n notesObj.splice(index, 1);\n localStorage.setItem(\"notes\", JSON.stringify(notesObj));\n showNotes();\n}", "function deleteNote(index) {\r\n // console.log(\"I am deleting\", index);\r\n\r\n let notes = localStorage.getItem(\"notes\");\r\n if (notes == null) {\r\n notesObj = [];\r\n }\r\n else {\r\n notesObj = JSON.parse(notes);\r\n }\r\n //for deleting use slice function.\r\n notesObj.splice(index, 1);\r\n localStorage.setItem(\"notes\", JSON.stringify(notesObj));\r\n showNotes();\r\n}", "function deleteNote(index) {\n // console.log(\"I am deleting\", index);\n\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n\n notesObj.splice(index, 1);\n localStorage.setItem(\"notes\", JSON.stringify(notesObj));\n showNotes();\n}", "deleteNote() {\n\n // Check if any board is selected before delete, else terminate\n var boardID = this.view.boardView.selectedBoardID;\n if (boardID !== -1) {\n\n // 1. Delete the note from the model\n var noteToBeDeleted = this.view.boardView.boardCollection[boardID].getNote();\n this.model.deleteNote(noteToBeDeleted.noteID);\n\n // 2. Delete the note from the view\n this.view.boardView.deleteNote(boardID);\n\n // 3. Update the startNoteID and endNoteID\n if (this.startNoteID === 0 && this.endNoteID === 0) {\n this.startNoteID = -1;\n this.endNoteID = -1;\n\n } else if (this.endNoteID <= this.model.noteCollection.length - 1) {\n // (a) Get the next note from the model to be displayed (if exists) from right\n var nextNote = this.model.noteCollection[this.endNoteID];\n this.view.boardView.displayNoteAtEnd(this.endNoteID, nextNote.name);\n\n } else if (this.startNoteID > 0) {\n // (a) Get the prev note from the mode to be displayed (if exists) from left\n var prevNote = this.model.noteCollection[this.startNoteID - 1];\n this.view.boardView.displayNoteAtStart(this.startNoteID - 1, prevNote.name);\n\n --this.startNoteID;\n --this.endNoteID;\n } else {\n // No note appended at start or end\n --this.endNoteID;\n }\n\n // 4. Unselect the board after delete\n this.view.boardView.unselectBoard();\n }\n }", "function removeNote(){\n\tthis.parentNode.remove();\n\tupdateNoteNumbers();\n}", "function deleteNote(index) {\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n notesObj.splice(index, 1);\n localStorage.setItem(\"notes\", JSON.stringify(notesObj));\n markedObj.splice(index, 1);\n titleObj.splice(index, 1);\n localStorage.setItem(\"marked\", JSON.stringify(markedObj));\n localStorage.setItem(\"title\", JSON.stringify(titleObj));\n showNotes();\n}", "function deleteNote(index){\n console.log('I am deleting Note no ', index);\n const notes= localStorage.getItem('notes');\n if(notes==null){\n notesObj= [];\n }\n else{\n notesObj= JSON.parse(notes);\n }\n notesObj.splice(index, 1);\n localStorage.setItem('notes', JSON.stringify(notesObj));\n showNotes();\n console.log(notesObj);\n}", "function deleteNote(index) {\n// console.log(\"I am deleting\", index);\nlet confirmDel = confirm(\"Delete this note?\");\nif (confirmDel == true) {\n \n\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n\n notesObj.splice(index, 1);\n localStorage.setItem(\"notes\", JSON.stringify(notesObj));\n showNotes();\n}\n}", "function deleteDraggedNote(oldId) {\n\t\tvar oldNote = deleteNote(oldId);//will also delete the note from json\n\t\t$('#' + oldId).remove();\n\t\t\t\t\t\t\n\t\tvar actionId = generateId('delete');//generate action id\n\n\t\tvar deleteData = {\n\t\t\tnoteId : oldNote.id,\n\t\t\tactionId : actionId,\n\t\t\ttrackId : parseInt($('.tab-pane.active').attr('id').substring(5), 10)\n\t\t};\n\n\t\t\t\t\t\t\n\t\tajaxHelper.deleteNote(pageData.songId,deleteData);\n\t\tpageData.quarantinedChanges.push({actionId : actionId, note : oldNote, time : Date.now()});\n\t}", "function deleteNote(index) {\n let confirmDel = confirm(`Delete this note?`);\n if (confirmDel == true) {\n let notes = localStorage.getItem(\"notes\")\n if (notes == null) {\n notesObj = [];\n }\n else {\n notesObj = JSON.parse(notes);\n }\n\n notesObj.splice(index,1);\n localStorage.setItem(\"notes\", JSON.stringify(notesObj));\n showNotes();\n }\n\n}", "function todo_delete_id(db, id, res) {\n db.get(\"SELECT id, subject, content, priority FROM todo WHERE id = ?\", id, (err, row) => {\n if(err) throw err\n res.json({\n \"messages\": [{\n \"buttons\": [\n {\n \"postback\": \"yes\",\n \"text\": \"YES\"\n }, {\n \"postback\": \"no\",\n \"text\": \"NO\"\n }],\n \"imageUrl\": undefined,\n \"platform\": \"facebook\",\n \"subtitle\": row.subject,\n \"title\": \"Are you sure?\",\n \"type\": 1\n }]\n })\n })\n}", "deleteNote(i) {\n const index = this.state.list.findIndex((p) => p.id === i.id);\n if (index !== -1) {\n this.state.list.splice(index, 1);\n this.props.removeItem(this.state.list);\n this.setState({ listString: JSON.stringify(this.state.list) })\n }\n }" ]
[ "0.84295213", "0.82327795", "0.8171688", "0.8155078", "0.8147998", "0.81453353", "0.8145228", "0.8120947", "0.8091709", "0.8090674", "0.8016119", "0.80126226", "0.80079734", "0.79310715", "0.7841314", "0.7763246", "0.7740046", "0.7736637", "0.76879907", "0.76869416", "0.76824665", "0.76789683", "0.767066", "0.7659113", "0.7605959", "0.7603667", "0.76014847", "0.75770456", "0.7576884", "0.7530213", "0.7523093", "0.7521577", "0.75020057", "0.7394535", "0.7373984", "0.7335822", "0.727554", "0.7259463", "0.7255821", "0.7232019", "0.7227372", "0.72171104", "0.7213523", "0.72037524", "0.7198191", "0.719814", "0.7179111", "0.71494293", "0.7145537", "0.71449465", "0.7137418", "0.71089554", "0.7106841", "0.7084968", "0.7084223", "0.7079078", "0.70660836", "0.70620424", "0.7044605", "0.7026321", "0.70172", "0.70063597", "0.6995696", "0.69862616", "0.69859004", "0.6921546", "0.691964", "0.688309", "0.6871992", "0.68580157", "0.68544805", "0.6846837", "0.6824095", "0.6822255", "0.6804614", "0.68034494", "0.67962825", "0.67896336", "0.67694294", "0.676927", "0.67648673", "0.6758254", "0.6756573", "0.67531496", "0.6752552", "0.67507833", "0.67507184", "0.6748401", "0.67351246", "0.6722901", "0.67187536", "0.6708493", "0.6703249", "0.66807795", "0.66763854", "0.6674169", "0.6670692", "0.66619486", "0.666187", "0.66579276" ]
0.72161
42
function to edit note by its id
function editNote(index) { let modalContent = document.getElementById("openModal"); let html = `<div class="form-group"> <h5 class="title text-dark">Edit title</h5> <input type="text" class="form-control" id="editTitle"> </div> <button type="button" class="close cross" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> <div class="form-group"> <h5 class="card-title text-dark">Edit your note</h5> <textarea class="form-control" id="editTxt" rows="5" required></textarea> </div> <button class="btn btn-info updateButn" id="${index}" onclick="UpdateButn(this.id)" data-dismiss="modal">Update Note</button>`; modalContent.innerHTML = html; let noteObj = { id: index, }; var data = Object.keys(noteObj) .map(function (key) { return key + "=" + noteObj[key]; }) .join("&"); fetch("http://localhost:8081/php-notes-app/edit-note-by-id.php", { body: data, method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" } }) .then(response => response.json()) .then(data => { for(let i = 0; i < data.length; i++){ if (data.length > 0) { document.getElementById("editTxt").value = (data[i].text); document.getElementById("editTitle").value = (data[i].title); } } }) .catch(error => { console.log('error: ', error); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function edit_note(note_id, note_name) {\n fetch(`${note_name}/edit/${note_id}`)\n .then(response => response.json())\n .then(notes => {\n Array.prototype.forEach.call(notes.task, note => {\n document.querySelector(`#edit-note-${note.id}`).style.display == 'block'\n document.getElementById(`edit-note-${note.id}`).innerHTML = `<form id=\"edit_note\"> <textarea rows=\"5\" cols=\"45\" id=\"newnote\">${note.note}</textarea> <br> <button class=\"save_edit btn btn-dark\" type=\"submit\"> Save </button></form>`;\n\n document.querySelector('#edit_note').onsubmit = function() {\n fetch(`${note_name}/edit/${note_id}`, {\n method: 'PUT',\n body: JSON.stringify({\n note: document.querySelector('#newnote').value\n })\n })\n }\n })\n })\n }", "function handlenoteEdit() {\n var currentnote = $(this).parents(\".note-panel\").data(\"id\");\n editnote(currentnote);\n }", "function editNote(elem_id, idx){\n console.log('I am editing the note with _id: ');\n console.log(parseInt(idx)+1);\n\n let editnote = document.getElementById(parseInt(idx));\n let html = `\n <h5 class=\"card-title\">Note ${parseInt(idx) + 1}</h5>\n <div class=\"card-body-textbox\">\n <textarea class=\"form-control\" id=\"updateTxtEdit\" rows=\"3\"></textarea>\n </div>\n <button onclick=\"deleteNote('${elem_id}')\" class=\"btn btn-primary\">Delete Note</button>\n <button onclick=\"editDone('${elem_id}', '${parseInt(idx)}')\" class=\"btn btn-primary\" id=\"updateBtn\">Update</button> \n `;\n editnote.innerHTML = html;\n}", "function editNote(id, newTitle, newBody) {\n const requestOptions = {\n method: \"PUT\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n title: newTitle,\n content: newBody,\n }),\n };\n\n //edit in the DB\n fetch(\"/dataItems/\" + id + \"/edit\", requestOptions)\n .then((res) => res.json())\n //using the JSON response we'll now update the note in the Array\n .then((updatedNote) => {\n setNotes(() => {\n return notes.map((note) => {\n return note.id === updatedNote._id\n ? {\n ...note,\n noteTitle: updatedNote.title,\n noteBody: updatedNote.content,\n }\n : note;\n });\n });\n });\n }", "editNote(e) {\n e.preventDefault();\n fetch(config.API_ENDPOINT + \"/api/notes/\" + this.state.id, {\n method: \"PATCH\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(this.state),\n })\n .then((res) => {\n if (!res.ok) {\n throw new Error(\"Something went wrong, please try again later.\");\n }\n return res;\n })\n .then((res) => {\n this.context.editNote();\n this.setState({ ...res.body, error: null });\n })\n .catch((err) => {\n this.setState({\n error: \"Unable to edit note. Please try again later.\",\n });\n });\n }", "function edit(req, res) {\n Note.findById(req.params.id)\n .then(function (note) {\n res.render('notes/edit', {\n title: `Editing ${note.content}`,\n note,\n recipeId: req.params.recipeId\n })\n })\n .catch(function (err) {\n console.log(err)\n res.redirect('/')\n })\n}", "async editNote(req, res) {\n try {\n //get the particuler user note to edit\n const notesCollection = await Notes.findOne({ ID: req.params.ID });\n //if the note doesnt exist return an error message;\n if (!notesCollection)\n return res.status(400).send(\"oops, an error occured!\");\n //get the value to be updated\n const update = {};\n } catch (error) {\n return res.status(400).json({ error: error.message });\n }\n }", "function editItem(id) {\n\t\t[...todo].map((item) => {\n\t\t\tif (item.id === id) {\n\t\t\t\tfetch(`http://127.0.0.1:3010/tasks/${id}`, {\n\t\t\t\t\tmethod: 'PUT',\n\t\t\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\t\t\tbody: JSON.stringify({ id: item.id, text: editText, completed: item.completed, tag: item.tag, lastMod: new Date().getTime(), displayDate: new Date().toLocaleString(), outOfTime: item.outOfTime, alarm: item.alarm })\n\t\t\t\t}).then((resp) => resp.json())\n\t\t\t\t\t.then((data) => { console.log(data) });\n\t\t\t\twindow.location.reload()\n\n\t\t\t}\n\t\t\treturn item\n\t\t})\n\t\tsetEdit(null)\n\t\tsetEditText('')\n\t}", "async function editNoteHandler(event) {\n event.preventDefault();\n\n const text = document.querySelector('input[name=\"note-text\"]').value.trim();\n const id = window.location.toString().split('/')[\n window.location.toString().split('/').length - 1\n ];\n const response = await fetch(`/api/notes/${id}`, {\n method: 'PUT',\n body: JSON.stringify({\n text\n }),\n headers: {\n 'Content-Type': 'application/json'\n }\n });\n\n if (response.ok) {\n document.location.replace('/dashboard');\n } else {\n alert(response.statusText);\n }\n}", "function editDone(elem_id, idx){\n let updateNote = document.getElementById(\"updateTxtEdit\");\n let editnote = document.getElementById(parseInt(idx));\n let html = `\n <h5 class=\"card-title\">Note ${parseInt(idx) + 1}</h5>\n <div class=\"card-body-textbox\">\n <p class=\"card-text\">${updateNote.value}</p>\n </div>\n <button onclick=\"deleteNote('${elem_id}')\" class=\"btn btn-primary\">Delete Note</button>\n <button onclick=\"editNote('${elem_id}' ,'${parseInt(idx)}')\" class=\"btn btn-primary\">Edit Note</button> \n `;\n console.log(editnote);\n editnote.innerHTML = html;\n\n // Updating the edit to server\n let addTxtValue = updateNote.value;\n const obj = { // Create object to be posted through axios\n addTxtValue,\n };\n\n axios // Post data from textbox to server\n .put(`https://crudcrud.com/api/${endpoint}/notesData/${elem_id}`, obj)\n .then(res => {\n console.log(\"Data has been posted to crudcrud\");\n console.log(res);\n })\n .catch(err => {\n console.log(\"Error Message: \");\n console.log(res);\n })\n\n}", "function editNote(index){\n let saveindex = document.getElementById('saveindex')\n let saveBtn = document.getElementById('saveBtn')\n let addBtn = document.getElementById('addBtn')\n saveindex.value = index;\n let notes = localStorage.getItem('notes');\n let notesObj = JSON.parse(notes);\n addTitle.value = notesObj[index][0];\n addTxt.value = notesObj[index][1];\n addBtn.style.display=\"none\";\n saveBtn.style.display=\"block\";\n }", "'change .js-editNote' (event) {\n // Get value from editNote element\n const text = event.currentTarget.value;\n note.set(text);\n }", "function editNote() {\n if (oSelectedNote != null) {\n document.getElementById('note_area').readOnly = false;\n document.getElementById('btnSaveNote').disabled = false;\n }\n}", "function editNote(index){\n let saveindex = document.getElementById('saveindex')\n let saveBtn = document.getElementById('saveBtn')\n let addBtn = document.getElementById('addBtn')\n saveindex.value = index;\n let notes = localStorage.getItem('notes');\n let notesObj = JSON.parse(notes);\n addTitle.value = notesObj[index].title;\n addTxt.value = notesObj[index].text;\n addBtn.style.display=\"none\";\n saveBtn.style.display=\"block\";\n }", "function editarNota(id, body) {\n var uri = __env.apiUrl + 'nota/editar/' + id;\n return $http({\n url: uri,\n method: \"PUT\",\n data: body,\n headers: { \"Content-Type\": \"application/json\" }\n }).then(function (response) {\n return response;\n });\n }", "function patchNote(content, id) {\n if(!content) {\n content = ' ';\n }\n\n let data = { content };\n $.ajax({\n url : `/notes/${id}`,\n data : JSON.stringify(data),\n type : 'PATCH',\n contentType : 'application/json',\n processData: false,\n dataType: 'json'\n });\n}", "async editTodo(id, todo){\n \n // update the todo in the database\n const result = await _mongoDb.collection(\"todos\").replaceOne({\n _id: ObjectId(id)\n }, {\n title: todo.title,\n date: todo.date,\n type: todo.type,\n description: todo.description\n });\n \n // return result\n return result;\n\n }", "function editNote(index) {\r\n const uid = localStorage.getItem(\"uid\")\r\n window.scrollTo(0, 0);\r\n var adaRef = firebase.database().ref('notes/' + uid + '/' + index);\r\n adaRef.get().then((snapshot) => {\r\n if (snapshot.exists()) {\r\n var crrntNote = snapshot.val();\r\n document.getElementById(\"addTitle\").value = crrntNote.title;\r\n document.getElementById(\"addTxt\").value = crrntNote.content;\r\n CKEDITOR.instances[\"addTxt\"].setData(crrntNote);\r\n replaceButtonText('addBtn', 'Update Note');\r\n flagEdit = 1;\r\n editIndex = index;\r\n\r\n }\r\n }).catch((error) => {\r\n console.error(error);\r\n });\r\n}", "function editTrack(element, id) {\n document.getElementById('edit_input').value = Data.Tracks[id-1];\n State.Editing.Set(id);\n DOM.Modal.Open('edit_modal');\n document.getElementById('edit_input').focus();\n}", "function edit(id){\n var form = $('#edit_form');\n if (form[0].line.value == id) {\n change();\n return;\n }\n \n var art = form.children('[name=artist]');\n var son = form.children('[name=song]');\n var line = $('#line_'+id).children('.info');\n \n form.insertBefore(line);\n \n form.show();\n art.show();\n son.show();\n art.focus();\n \n form[0].line.value = id;\n form[0].artist.value = line.children('.artist').text();\n art.select();\n // Trim the #location from the end of the song\n var match = line.children('.song').text().match(\"^(.+) #[^#]+$\")\n form[0].song.value = match ? match[1] : \"\";\n form[0].song_id.value = null;\n}", "function updateNote(noteEl) {\n const noteText = document.getElementById('note-text').value\n fetch(url + '/' + `${noteEl.parentElement.id} `, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n title: noteText,\n body: noteText,\n updated_at: moment().format()\n })\n })\n .then(res => res.json())\n .then(data => {\n renderNoteText(noteEl.parentElement, data)\n })\n}", "editTodo (todo, callback, table = this.table) {\n const s = 'UPDATE ' + table + ' SET =? WHERE id=?'\n\n knex.query(s, [\n todo.text, todo.id\n ], function (err, result) {\n if (err) throw err\n callback(result)\n })\n }", "function editNotes(ele){\n\t\t\tvar formContainer = document.createElement(\"div\"),\n\t\t\t\tformContent = '',\n\t\t\t\theader = '<h3>Edit Notes</h3>',\n\t\t\t\tinputArea = '<textarea placeholder=\"Jot down some notes\" autofocus></textarea>',\n\t\t\t\tsubmitButton = '<input type=\"button\" class=\"btn\" value=\"Update\" onclick=\"BNB.calendar.Notes.submitEditNotes(this)\">',\n\t\t\t\tcloseButton = '<span class=\"close\" onclick=\"BNB.calendar.Notes.removeEditNotes(this.parentNode);\">X</span>';\n\n\t\t\t// If a dialog is already open, close it\n\t\t\tif(document.getElementsByClassName(\"edit-notes-form\")[0]){\n\t\t\t\tremoveEditNotes(document.getElementsByClassName(\"edit-notes-form\")[0]);\n\t\t\t}\n\n\t\t\t// Track the clicked element\n\t\t\tcurrentStepNode = ele.parentNode;\n\n\t\t\t// Add notes to the textarea if notes exist\n\t\t\tif(currentStepNode.getAttribute(\"data-notes\") != \"There are no notes for this event.\"){\n\t\t\t\tinputArea = '<textarea autofocus>' + \n\t\t\t\tcurrentStepNode.getAttribute(\"data-notes\") + \n\t\t\t\t'</textarea>';\n\t\t\t}\n\n\t\t\t// Assemble Notes dialog box\n\t\t\tformContent = header + inputArea + submitButton + closeButton;\n\n\t\t\t// Add a new \"Edit Notes\" dialog box to the page\n\t\t\tformContainer.className = \"edit-notes-form\";\n\t\t\tformContainer.innerHTML = formContent;\n\t\t\taddEditNotes(ele, formContainer);\n\t\t}", "function editNote(key, value) {\n updateNote({\n ...activeNote, // keep what is unchanged in the activeNote object\n [key]: value, // change the values of the keys that are specified in the\n noteLastModified: Date.now(),\n });\n }", "function showTodo(id){\n\tconsole.log(\"edit todo : \" + id);\n\tvar todoArr = readTodosArray();\n\tconsole.log(todoArr);\n\tvar content_input = document.getElementById(\"content-input\");\n\tcontent_input.value = todoArr[id-1][CONTENT];\n\tvar due_input = document.getElementById(\"due-input\");\n\tdue_input.value = todoArr[id-1][DUE];\n\tvar due_input = document.getElementById(\"id-input\");\n\tdue_input.value = todoArr[id-1][ID];\n}", "function showNotesEditor(noteId, noteTitle = '', noteContent = '') {\n\n newNoteBtn.addClass('d-none');\n let label = noteId ? 'Editar Nota' : 'Nueva Nota';\n let buttonText = noteId ? 'Actualizar Nota' : 'Guardar Nota';\n\n notesContainer.html(`\n <div style='text-align: center;'>\n <h4>${label}</h4>\n </div>\n <div class='form' style='margin: 15px'>\n <input id='note-title' type='text' class='form-control' placeholder='Título' maxlength='500' value='${noteTitle}'>\n <textarea id='note-content' class='form-control mt-3' placeholder='Contenido' id='floatingTextarea' style='height: 350px'>${noteContent}</textarea>\n </div>\n <div style='text-align: right; margin: 15px'>\n <button id='upsert-note' class='btn btn-success ms-auto'>${buttonText}</button>\n <button id='edit-note-cancel' class='btn btn-warning ms-auto'>Cancelar</button>\n </div>\n `);\n\n $('#edit-note-cancel').on('click', function () {\n loadNotes();\n });\n\n $('#upsert-note').on('click', function () {\n\n const title = $('#note-title').val().trim();\n const content = $('#note-content').val().trim();\n\n if (title === '') {\n iziToast.warning({\n message: 'Ingresa el título de la nota',\n close: true,\n timeout: 2000,\n });\n return;\n }\n\n if (content === '') {\n iziToast.warning({\n message: 'Ingresa el contenido de la nota',\n close: true,\n timeout: 2000,\n });\n return;\n }\n\n if (!noteId) {\n // Nueva Nota\n executeRequest('POST', 'notes/create', { title: title, content: content }).then(r => {\n\n iziToast.success({\n message: 'La nota se ha guardado correctamente',\n close: true,\n timeout: 1500,\n });\n\n loadNotes();\n\n }).catch(() => {\n // Se maneja en la petición\n });\n } else {\n // Actualizar Nota\n executeRequest('PATCH', 'notes/update', { id: noteId, title: title, content: content }).then(r => {\n\n iziToast.success({\n message: 'La nota se ha actualizado correctamente',\n close: true,\n timeout: 1500,\n });\n\n loadNotes();\n\n }).catch(() => {\n // Se maneja en la petición\n });\n }\n });\n\n}", "function editTool(id, body) {\n return db('tools')\n .where('id', id)\n .update(body)\n}", "function addNotesEditTextField(id) {\n\t//let id = this.id;\n\tid = id.split('_').pop();\n\tlet notesEditSelectId = \"notes_edit_\" + id;\n\t\n\t//alert(id);\n\t\n\tlet notesEditTable = document.getElementById(\"notes_edit_modal_\" + id);\n\t\n\t//alert(notesEditTable.id);\n\t\n\tlet notesEditText = document.getElementById(\"notes_edit_text_\" + id);\n\t\n\t\n\tlet x = document.getElementById(notesEditSelectId);\n\t\n\tif (x.value == \"Others\"){\n\t\t\n\t\tnotesEditText.style.display = \"table-row\";\n\t\t//change size of modal\n\t\t\n\t\tvar modal = document.getElementById(\"edit_notes_\" + id);\n\t\t//alert(modal.id);\n\t\t//modal.style.width = \"200px\";\n\t\tmodal.style.height = \"155px\";\n\t}\n\telse {\n\t\tnotesEditText.style.display = \"none\";\n\t}\n\t\n\t\n}", "edit(todo) {\n this.editTodo = todo.content;\n todo.isEdited = true;\n }", "function postEdit(id) {\n updateId = id;\n axios.get(`api/posts/${id}`)\n .then((res)=> {\n editTitle.value = res.data.title;\n editDesc.value = res.data.description;\n })\n .catch(errors=> {\n console.log(errors.response);\n })\n}", "function Note(text, id) {\n this._note = text;\n this._id = id \n}", "function editNote(index){\n if(addTxt.value ===\"\" && addHeading.value ===\"\"){\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesArr = [];\n }\n else {\n notesArr = JSON.parse(notes);\n }\n // console.log(notesArr[index].heading); \n addHeading.value=notesArr[index].heading;\n addTxt.value=notesArr[index].text;\n deleteNote(index);\n\n }else{\n return alert(\"Please clear the field before Edit.\");\n }\n}", "function editJournalEntry(name, location, notes, key) {\n\tdocument.querySelector('.edit').addEventListener('click', function(){\n\t\ttrailCard.style.display = \"block\";\n\t\tupdateButton.style.display = \"inline-block\";\n\t\tsaveButton.style.display = \"none\";\n\t\t\n\t\ttrailName.value = name;\n\t\ttrailLocation.value = location;\n\t\ttrailNotes.value = notes;\n\n\t\t//update form\n\t\tupdateButton.addEventListener('click', function() {\n\t\t\tif (trailImage.files[0] == undefined) {\n\t\t\t\tupdateTrailSummary(trailName.value, trailLocation.value, trailNotes.value, undefined, key);\n\t\t\t} else {\n\t\t\t\tvar fileName = '' + Date.now();\n\t\t\t\tuploadImage(trailImage.files[0], fileName, key);\n\t\t\t}\n\t\t});\n\t});\n}", "async function updateNoteById(\n id,\n userId,\n title,\n description,\n date,\n category,\n priority,\n onAgenda\n) {\n const result = await query(\n `UPDATE notes SET \n user_id = COALESCE($2, user_id), \n title = COALESCE($3, title), \n description = COALESCE($4, description),\n date = COALESCE($5, date),\n category = COALESCE($6, category),\n priority = COALESCE($7, priority),\n on_agenda = COALESCE($8, on_agenda) \n WHERE id = $1\n RETURNING id;`,\n [id, userId, title, description, date, category, priority, onAgenda]\n );\n return result.rows[0].id;\n}", "async edit({ params, request, response, view }) {}", "function innertNotes(data, id, status, menu_title) {\n if (menu_title == 'Edit') {\n if (data == null|| status== null || status == 1) {\n $('#note_' + id).html(\"-\")\n } else {\n $('#note_' + id).html(data)\n }\n } else {\n let text_notes = ''\n if (data !== null) {\n text_notes = $(\"#note_\" + id).val(data)\n }\n if (status == 2) {\n text_notes = $(\"#ket-\" + id).css(\"display\", \"block\");\n }\n return text_notes\n }\n\n}", "async edit ({ params, request, response, view }) {\n }", "async edit ({ params, request, response, view }) {\n }", "async edit ({ params, request, response, view }) {\n }", "async edit ({ params, request, response, view }) {\n }", "async edit ({ params, request, response, view }) {\n }", "async edit ({ params, request, response, view }) {\n }", "async edit ({ params, request, response, view }) {\n }", "function putEditForm(id){\n $.ajax({\n url: index + \"notes/\" + $('#disabledinput').val(),\n type: 'PUT',\n processData: false,\n contentType: false,\n data: NoteFormData('editnoteform'),\n success: function(data){\n $('#newmodal').modal('hide');\n getindex()\n // getuserindex()\n },\n error: function(data){\n console.log(data)\n $('#userformerrors').html(\"<p class=\\\"bg-danger\\\">\" + data.responseText + \"</p>\");\n }\n })\n }", "async function editTodo(req, res) {\n await Todo.findByIdAndUpdate(req.params.id, req.body);\n show(req, res);\n}", "function todoEdit(id, todo) {\n \t// Inititate the promise to be returned.\n \tvar defer = $q.defer();\n \t// Use $http.put to put the generated API key to use, for the edit function.\n \t$http.put('http://localhost:60401/api/VSTDAs' + '/' + id, todo).then(\n \t\t// If the promise succeeds, return the data using the following code.\n \t\tfunction(response) {\n \t\t\tdefer.resolve(response.data);\n \t\t},\n \t\t// If the promise fails, reject the data using the following.\n \t\tfunction(error) {\n \t\t\tdefer.reject(error);\n \t\t}\n \t);\n \treturn defer.promise;\n }", "function Note(title, text, id) {\n this.title = title;\n this.text = text;\n this.id = id;\n}", "function setNote() {\n var row = oNotesTable.row('.selected').data();\n var oNote = oData.jsFormula.getNote(row[0]);\n oSelectedNote = oNote;\n\n document.getElementById('note_area').value = oNote.sNote;\n document.getElementById('btnEditNote').disabled = false;\n document.getElementById('btnDelNote').disabled = false;\n document.getElementById('note_area').readOnly = true;\n}", "function editnotes(){\n\t\t\tdocument.getElementById(\"notes\").readOnly = false;\n\t\t\t\n\t\t\tdocument.getElementById(\"btnEditNotes\").className += \" hidden\";\n\t\t\tdocument.getElementById(\"btnSaveNotes\").className = \"\";\n\t\t}", "function editItem() {\n todoItem = _.first(todo.where({ todo_id: todo_id }));\n log.debug('[TodoListNewEdit] : Editing todo Item', todoItem);\n\n // Set the title to Edit\n Alloy.Globals.Menu.setTitle(\"Edit Task\");\n\n $.textFieldName.value = todoItem.get('name');\n $.textFieldContent.value = todoItem.get('content');\n\n}", "function editTodoNotify(notify, id){\n\tvar count = readCount();\n\tvar listArr = readTodosArray();\n\tvar listLength = listArr.length;\n\n\tfor(index = 0; index < listLength; index++){\n\t\tif(listArr[index][ID] == id){\n\t\t\tlistArr[index][NOTIFY] = notify;\n\t\t\twriteTodosArray(count, listArr);\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\treturn -1;\n}", "function getNote(id) {\n $.getJSON('/notes/' + id)\n .done((note) => {\n simplemde.value(note.content);\n });\n}", "function editNote(note) {\n const edit = note.querySelector(\"p\");\n edit.contentEditable = true;\n edit.addEventListener(\"keydown\", function (event) {\n if (event.key === \"Enter\") {\n edit.contentEditable = false;\n }\n });\n}", "function submitEditNotes(ele){\n\t\t\tvar popup = document.getElementsByClassName(\"edit-notes-form\")[0],\n\t\t\t\tupdatedNotes = ele.parentNode.getElementsByTagName(\"textarea\")[0].value;\n\n\t\t\tif(!updatedNotes) updatedNotes = \"There are no notes for this event.\"\n\n\t\t\t// Update notes\n\t\t\tcurrentStepNode.setAttribute(\"data-notes\", updatedNotes);\n\n\t\t\t// Save notes to database\n\t\t\tsaveAction.enqueue( makeJsonFromNode(currentStepNode));\n\n\t\t\t// Remove popup\n\t\t\tremoveEditNotes(popup);\n\t\t}", "function editPost(req, res) {\n let id = req.params.id;\n Post.find({_id: id}, function(error, post) {\n if(error) res.send({message: 'Could not find post:' + error});\n if(req.body.title) post.title = req.body.title;\n post[0].save(function(error) {\n if(error) res.send({messsage: 'Could not update post:' + error});\n res.send({message: 'Post updated', post: post});\n });\n });\n} // end editPost", "async updateToEditExercise() {\n if (this.editID === null)\n this.toEditExercise = null;\n this.toEditExercise = await this.getExercise(this.editID);\n }", "function editItemById(smid) {\n THK.DB.findByVideoID(smid, function(res){\n if(res==undefined)\n return ;\n \n g_videoEditID = smid;\n \n // popup a edit window\n j_edit_window = j_edit_window || $(\"#edit_window\");\n j_edit_window.fadeIn(200);\n \n var edit_content = $(\"div#edit_content\");\n edit_content.html($(\n '<label>'+_locale[pn]['videoTitle']+'</label> <input id=\"edit_title\" value=\"'+res.title+'\"></input> <br>' +\n '<!--label>'+_locale[pn]['videoPath']+'</label> <input id=\"edit_dir\" value=\"'+res.dir+'\"></input> <br-->' +\n '<label>'+_locale[pn]['videoComment']+'</label> <textarea id=\"edit_comment\">'+res.comment+'</textarea> <br>' +\n '<input type=\"button\" class=\"submit-button\" value=\"Update\">'\n ));\n \n /* edit_window save button */\n $(\"input.submit-button\").click(function(e){ saveEditInfo(); });\n });\n}", "static dSTIdNoteNoteIdPUT({ id, noteId, dSTNote }) {\n return new Promise(\n async (resolve) => {\n try {\n resolve(Service.successResponse(''));\n } catch (e) {\n resolve(Service.rejectResponse(\n e.message || 'Invalid input',\n e.status || 405,\n ));\n }\n },\n );\n }", "function editItem(id) {\n\t// we search for the id\n\tvar _index = -1;\n\tvar _section = -1;\n\tfor (_sec in myKey.data) {\n\t\tfor (_item in myKey.data[_sec][\"content\"]) {\n\t\t\tif (myKey.data[_sec][\"content\"][_item][\"id\"] == id) {\n\t\t\t\t_section = _sec;\n\t\t\t\t_index = _item;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tvar _form = '<tr id=\"row_'+id+'\" class=\"row_form\"><form name=\"edit_'+id+'\">';\n\t_form += '<td class=\"form_title\"><input type=\"text\" name=\"title\" size=\"30\" value=\"'+htmlentities(myKey.data[_section][\"content\"][_index][\"title\"])+'\" /></td>';\n\t_form += '<td class=\"form_login\"><input type=\"text\" name=\"login\" size=\"30\" value=\"'+htmlentities(myKey.data[_section][\"content\"][_index][\"user\"])+'\" /></td>';\n\t_form += '<td class=\"form_password\"><input type=\"text\" name=\"password\" size=\"30\" value=\"'+htmlentities(myKey.data[_section][\"content\"][_index][\"password\"])+'\" onKeyPress=\"submitEnter(\\'modifyItem('+_section+','+id+')\\')\" /></td>';\n\t_form += '<td class=\"form_comment\"><input type=\"text\" name=\"comment\" size=\"60\"value=\"'+htmlentities(myKey.data[_section][\"content\"][_index][\"comment\"])+'\" onKeyPress=\"submitEnter(\\'modifyItem('+_section+','+id+')\\')\" /></td>';\n\t_form += '<td class=\"form_button\"><input type=\"button\" onClick=\"modifyItem('+_section+','+id+')\" value=\"OK\" /></td></form></tr>';\n\t\n\t$(\"#row_\"+id).replaceWith(_form); // we remplace the line by the form\n}", "function _edit(id) {\n vm.item.id;\n vm.item.userId = vm.item.id;\n //$window.location.href = \"/profile/\" + vm.item.id + \"/edit\";\n }", "async editItem(id) {\n await this.model.read(id, (data) => {\n this.view.render('editItem', { id: id, title: data[0].title });\n });\n }", "function editTask(event){\n const header = event.target.parentElement;\n const task = header.parentElement;\n const id = Number(task.getAttribute(\"data-id\"));\n const val = database.getField(id);\n val.onsuccess = () => {\n const {key, title, description} = val.result;\n var editTitle = document.getElementById(\"editTitle\");\n editTitle.setAttribute(\"value\",title);\n\n var editDescription = document.getElementById(\"editDescription\");\n editDescription.innerHTML = description;\n }\n modal.style.display = \"block\";\n var saveChange = document.querySelector(\"#btnsave\");\n saveChange.setAttribute(\"data-id\",id);\n saveChange.onclick = changeTask;\n }", "edit_task(task_id) {\n this.task_to_change = task_id;\n console.log(\"EDIT ? : \", task_id);\n }", "handleEdit(id){\n window.location = '/journalists/edit/' + id\n }", "function UpdateButn(index){\n let editTitle = document.getElementById('editTitle');\n let editTxt = document.getElementById(\"editTxt\");\n let notesObj = {\n title: editTitle.value,\n text: editTxt.value,\n id: index,\n };\n let data = Object.keys(notesObj)\n .map((key) => {\n return key + \"=\" + notesObj[key];\n })\n .join(\"&\");\n\n fetch(\"http://localhost:8081/php-notes-app/update-note.php\", {\n method: \"POST\",\n body: data,\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\"\n }\n })\n .then((response) => response.json())\n .then((data) => {\n if (data.className == \"success\") {\n showAlert(data.msg, data.className); \n }\n if (data.className == \"danger\") {\n showAlert(data.msg, data.className);\n }\n // Dismiss after 2 seconds\n setTimeout(function () {\n document.getElementById(\"alert\").remove();\n }, 2000);\n editTxt.value = \"\";\n editTitle.value = \"\";\n showNotesById(userid.value);\n })\n .catch((error) => {\n console.log(error);\n });\n }", "updateItin() {\n const { id, editItinerary } = this.props;\n\n editItinerary(id);\n }", "deleteNote(id) {\n let index = this.jsonData().findIndex(element => parseInt(element.id) === parseInt(id));\n if (index !== -1) {\n let noteData = this.jsonData();\n noteData.splice(index, 1);\n this.storeData(noteData);\n }\n }", "function editManCon(id) {\n\n\t/* Da znamo koji id trebamo promjeniti*/\n\tvar idBroj = 0;\n\tvar poslano = \"\";\n\n\tif(id)\n\t{\n\t\tidBroj = id;\n\t}\n\n\tif(this.id) {\n\t\tidBroj = this.id.slice(16);\n\t}\n\n\t/* Text koji mjenjamo */\n\tvar textId = \"editInputMan\" + idBroj;\n\tvar text = document.getElementById(textId).value;\n\n\tvar xhr = new XMLHttpRequest();\n\n\txhr.open(\"POST\", \"ajaxInj.php?editManChangeId=\" + idBroj + \"&textManChange=\" + text, true);\t\n\t\n\txhr.send();\n\t\n\t\n\t/* Ovo sam morao radi firefoxa reloadao je prije neg sto bi AJAX obavio posao */\n\txhr.onreadystatechange = function() \n\t{\n\t\tif(this.readyState == 4 && this.status == 200)\n\t\t{\n\t\t\tlocation.reload();\n\t\t}\n\t}\n\n\n}", "function callToEdit()\n{\n\tvar id = $(this).parents('tr').children('td').children('p.editId').attr('editId');\n\t//var id = $(this).children('td:eq(0)').children('p.editId').attr('editId');\n\twindow.location.href = \"media/editmedia/id/\" + id;\n}", "startEditingTodo(id) {\n TodoDispatcher.dispatch({\n type: TodoActionTypes.START_EDITING_TODO,\n id,\n })\n }", "function edit(todoId, options) {\n let state = dataHub.getState();\n let todo = state.todos.find((todo) => {\n return todo.id === todoId;\n });\n if (options.status) {\n todo.status = options.status;\n }\n dataHub.setTodos(state.todos);\n todosResource.saveTodos(state.todos);\n }", "editTodo(id, updatedText) {\r\n this.todos = this.todos.map(todo =>\r\n todo.id === id ? { id: todo.id, text: updatedText, complete: todo.complete } : todo\r\n );\r\n\r\n this._changeList(this._currentTab);\r\n }", "function toggleEdit(postDescId, editsave, titleId) {\n var postDesc = document.getElementById(postDescId);\n var buttonText = document.getElementById(editsave);\n var title = document.getElementById(titleId);\n if (postDesc.isContentEditable) {\n postDesc.contentEditable = 'false';\n title.contentEditable = 'false';\n buttonText.innerHTML = 'Edit <i class=\"fas fa-edit\"></i>';\n } else {\n postDesc.contentEditable = 'true';\n title.contentEditable = 'true';\n buttonText.innerHTML = 'Save';\n }\n}", "function saveNote(noteID, note) {\n // Open the object store where all f the notes are stored,\n var objectStore = database.transaction([\"notes\"], \"readwrite\").objectStore(\"notes\");\n \n console.log(note);\n \n var transaction = objectStore.get(noteID);\n // Wait for a success message.\n transaction.onsuccess = function(e) { \n var oldNote = e.target.result;\n oldNote.note = note;\n \n // Update the note.\n objectStore.put(oldNote);\n };\n}", "function editTodoContent(contnet, id){\n\tvar count = readCount();\n\tvar listArr = readTodosArray();\n\tvar listLength = listArr.length;\n\n\tfor(index = 0; index < listLength; index++){\n\t\tif(listArr[index][ID] == id){\n\t\t\tlistArr[index][CONTENT] = content;\n\t\t\twriteTodosArray(count, listArr);\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\treturn -1;\n}", "function editTask(e){\n ui.showEidtState();\n const id = e.target.parentElement.id.split('-')[1];\n http\n .get(`http://localhost:3000/Tasks/${id}`)\n .then(data => {\n ui.fillForm(data);\n });\n}", "function lockNote(id) {\n var dragstart = ($('#' + id).attr('ondragstart') == 'drag(event)') ? 'dragStop(event)' : 'drag(event)'; \n $('#' + id).attr('ondragstart', dragstart);\n var dragover = ($('#' + id).attr('ondragover') == 'allowDrop(event)') ? 'event.stopPropagation()' : 'allowDrop(event)';\n $('#' + id).attr('ondragover', dragover);\n var readOnly = ($('#text' + id).prop('readonly') == \"\") ? \"true\" : \"\";\n $(\"#text\" + id).prop(\"readonly\", readOnly); \n $('#delete_Note' + id).toggleClass('disable-menu-items');\n var noteLock = JSON.stringify($('#lock' + id).val());\n id = $('#link' + id).val();\n var updateString = '[{\"op\": \"add\",\"path\": \"/postit_Locked\",\"value\": ' + noteLock + '}]';\n patchNote('https://localhost:44382/api/notes/', updateString, colId, colNo, noteId, id, desc);\n}", "patch_note_content(route, nbid, update) { //#ADJUST TO NOTEBOOKS\n const url = this.baseUrl + route + \"/\" + nbid\n return client.fetch(url, {\n method: \"PATCH\",\n body: json(update)\n })\n .then(response => response.json())\n }", "function saveNote(id) {\n\t$(document).on(\"click\", \"#submit-note\", function() {\n\t\tevent.preventDefault();\n\t $.ajax({\n\t \tmethod: \"POST\",\n\t \turl: \"/articles/note/\" + id,\n\t \tdata: {\n\t \t\tbody: $(\"#note\").val().trim()\n\t \t}\n\t }).done(function(data) {\n\t \tconsole.log(data);\n\t });\n\t $(\"#note\").val(\"\");\n\t});\n}", "editPart(state, { id, edits, editType }) {\n remember(state, [editPart(state, id, edits, editType)])\n }", "function edit_note(a) {\n var tdNote = a.parentNode.parentNode.getElementsByTagName('td')[3];\n tdNote.innerHTML = tdNote.innerHTML.replace(/^\\s+|\\s+$/g, '');\n var input = document.createElement('input');\n input.type = 'text';\n input.name = 'note';\n input.value = (tdNote.innerHTML !== 'Absence justifiée') ? tdNote.innerHTML.replace('/20', '') : 'ABS';\n tdNote.replaceChild(input, tdNote.firstChild);\n tdNote.appendChild(document.createTextNode('/20'));\n a.parentNode.innerHTML = '<input type=\"hidden\" name=\"numEtudiant\" value=\"' + a.parentNode.lastChild.href.replace(document.URL + '/', '').replace('/supprimer', '') + '\" /> <input type=\"reset\" value=\"Annuler\" onClick=\"reset_edit(this);\" /> <input type=\"submit\" value=\"Modifier\" />';\n}", "function editNote(index) {\r\n // console.log(\"I am deleting\", index);\r\n \r\n let notes = localStorage.getItem(\"notes\");\r\n if (notes == null) {\r\n notesObj = [];\r\n } else {\r\n notesObj = JSON.parse(notes);\r\n }\r\n \r\n notesObj.findIndex((element,index)=> {\r\n\t\tMyTitle.value = element.title;\r\n\t\taddTxt.value = element.text;\r\n\t\t\r\n\t})\r\n\tnotesObj.splice(index, 1);\r\n localStorage.setItem(\"notes\", JSON.stringify(notesObj));\r\n showNotes();\r\n }", "function removeNote(id) {\n // find object (note) for which id equals the argument\n const noteIndex = notes.findIndex(function(note) {\n return note.id === id;\n });\n if (noteIndex > -1) {\n // delete that one object\n notes.splice(noteIndex, 1);\n }\n}", "function contentEdit(id) {\n const content = document.getElementById(id);\n content.setAttribute(\"contenteditable\", \"true\");\n}", "function getNoteElementById(id) {\n try {\n var noteElms = document.getElementsByTagName(\"icnote\");\n\n for (var i = 0, len = noteElms.length; i < len; i++) {\n var noteElm = noteElms[i];\n\n var noteId = noteElm.getAttribute(\"id\");\n if (noteId == id) {\n return noteElm;\n }\n }\n } catch (e) {\n window.TextSelection.jsError(\"getNoteElementById\\n\" + e);\n }\n}", "function openNotesEditModal(e) {\r\n e.preventDefault();\r\n\r\n dmpNotesModal.style.display = \"block\";\r\n\r\n currentEditDay = e.target.dataset.jsEditNotes;\r\n currentEditDayNumber = parseInt(\r\n currentEditDay.charAt(currentEditDay.length - 1)\r\n );\r\n currentDayDisplay = days[currentEditDayNumber - 1];\r\n\r\n dmpNotesModalHeader.textContent = `${currentDayDisplay} Notes`;\r\n dmpNotesModalInput.value = dmpContent[currentEditDay][\"notes\"];\r\n}", "function editPostbyId(req, res, next) {\n Post.findByIdAndUpdate(mongoose.Types.ObjectId(req.params.id), req.body).then((post) => {\n req.response.content = post;\n next();\n }).catch((err) => res.send(err))\n}", "function editNote(index) {\n let notes = localStorage.getItem(\"notes\");\n let addTitle = document.getElementById(\"note-title\");\n let addTxt = document.getElementById(\"addTxt\");\n\n if (addTitle.value !== \"\" ||addTxt.value !== \"\") {\n return alert(\"Please clear the form before editing a note\")\n } \n\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n console.log(notesObj);\n\n notesObj.findIndex((element, index) => {\n addTitle.value = element.title;\n addTxt.value = element.text;\n })\n notesObj.splice(index,1);\n localStorage.setItem(\"notes\", JSON.stringify(notesObj));\n showNotes();\n}", "update(newText, id){\n var notes = this.state.notes.map(\n note => (note.id !== id) ?\n note :\n {\n ...note,\n note: newText\n }\n )\n this.setState({notes})\n }", "function editNote(index) {\n let notes = localStorage.getItem(\"notes\");\n let addTitle = document.getElementById(\"note-title\");\n let addTxt = document.getElementById(\"note-text\");\n\n if (addTitle.value !== \"\" || addTxt.value !== \"\") {\n return alert(\"Please clear the form before editing a note\")\n } \n\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n console.log(notesObj);\n\n notesObj.findIndex((element, index) => {\n addTitle.value = element.title;\n addTxt.value = element.text;\n })\n notesObj.splice(index, 1);\n localStorage.setItem(\"notes\", JSON.stringify(notesObj));\n showNotes();\n}", "function update(req, res) {\n Note.findByIdAndUpdate(req.params.id, req.body, { new: true })\n .then(function (note) {\n res.redirect(`/recipes/${req.params.recipeId}`)\n })\n .catch(function (error) {\n res.render('error', {\n message: 'notes update method failed',\n error\n })\n })\n}", "function editarIndicador(id_indicador, descripcion){\n //console.log(id_indicador);\n //console.log(descripcion);\n var detalle=$('#editarDetalleIndicador');\n var id=$('#editarIdIndicador'); \n detalle.text(descripcion);\n id.val(id_indicador);\n}", "function editTask(id) {\n const updatedTasks = tasks.filter((task) => task.taskId !== id);\n const taskToEdit = tasks.filter((task) => task.taskId === id);\n\n setTaskContent(taskToEdit[0].content);\n setTasks(updatedTasks);\n }", "function editNote(index) {\n let notes = localStorage.getItem(\"notes\");\n let addTitle = document.getElementById(\"addTitle\");\n let addText = document.getElementById(\"addText\");\n\n if (addTitle.value !== \"\" || addText.value !== \"\") {\n return alert(\"Please clear the form before editing a note\")\n } \n\n if (notes == null) {\n notesObj = [];\n } else {\n notesObj = JSON.parse(notes);\n }\n console.log(notesObj);\n\n notesObj.findIndex((element, index) => {\n addTitle.value = element.title;\n addText.value = element.text;\n })\n notesObj.splice(index, 1);\n localStorage.setItem(\"notes\", JSON.stringify(notesObj));\n showNotes();\n}", "function update_note(data)\n {\n data.id = rcmail.html_identifier_encode(data.uid);\n\n var row, is_new = (notesdata[data.id] == undefined && data.list == me.selected_list);\n notesdata[data.id] = data;\n\n if (is_new || me.selected_note && data.id == me.selected_note.id) {\n render_note(data);\n update_taglist(data.tags || []);\n }\n else if (data.tags) {\n update_taglist(data.tags);\n }\n\n // add list item on top\n if (is_new) {\n noteslist.insert_row({\n id: 'rcmrow' + data.id,\n cols: [\n { className:'title', innerHTML:Q(data.title) },\n { className:'date', innerHTML:Q(data.changed || '') }\n ]\n }, true);\n\n noteslist.select(data.id);\n }\n // update list item\n else if (row = noteslist.rows[data.id]) {\n $('.title', row.obj).text(data.title);\n $('.date', row.obj).text(data.changed || '');\n // TODO: move to top\n }\n }", "edit() {\n }", "function deleteNote(id) {\n setNotes((prevNotes) => {\n return prevNotes.filter((noteItem, index) => {\n return index !== id;\n });\n });\n }", "function UpdateNoteHandler(req, res, next) {\n const vidID = req.params.vidID;\n courseModel.updateNote(vidID, req.params.course, req.body.note, req.body.user).then(data => {\n res.status(200).json(data);\n });\n}", "edit(id) {\n this.setState((state) => ({\n ...state,\n todos: state.todos.map(todo => ({ ...todo, editing: todo.editing || todo._id === id }))\n }));\n }", "function editTopic(id) {\n $.ajax({\n type: 'GET',\n url: urlToRestApi + \"/\" +id,\n dataType: 'JSON',\n // data: 'action_type=data&id=' + id,\n success: function (data) {\n $('#id').val(data.topic.id);\n $('#nom').val(data.topic.nom);\n $('#code').val(data.topic.code);\n \n }\n });\n}" ]
[ "0.8051789", "0.75677097", "0.7547705", "0.7388114", "0.7314969", "0.7244864", "0.71683246", "0.70636106", "0.69847095", "0.6952836", "0.69403124", "0.6912773", "0.69070286", "0.6881831", "0.6844277", "0.6842057", "0.6792382", "0.67920524", "0.67866945", "0.67656523", "0.6740063", "0.66925967", "0.66592383", "0.6653865", "0.6649469", "0.66442215", "0.66387415", "0.6628832", "0.66248167", "0.66096854", "0.65852374", "0.65806204", "0.6562482", "0.65595716", "0.65445036", "0.6539612", "0.65324533", "0.65324533", "0.65324533", "0.65324533", "0.65324533", "0.65324533", "0.65324533", "0.65302366", "0.65298253", "0.65289193", "0.6519365", "0.6508234", "0.64835113", "0.64735603", "0.6466671", "0.6465769", "0.6465078", "0.645876", "0.6444799", "0.6443022", "0.64396083", "0.64304876", "0.6428935", "0.6406395", "0.64044887", "0.6396417", "0.6395844", "0.639346", "0.6381733", "0.63719434", "0.6371317", "0.6362174", "0.63536006", "0.6351958", "0.63492763", "0.6347045", "0.6342093", "0.63380253", "0.6330972", "0.631992", "0.6308775", "0.6304901", "0.63044083", "0.62999934", "0.6296015", "0.6292921", "0.6292857", "0.6288778", "0.62740046", "0.6269353", "0.6266213", "0.62600565", "0.6252747", "0.6251426", "0.62500674", "0.6244142", "0.6242506", "0.62421376", "0.6240154", "0.62392414", "0.6227093", "0.622538", "0.62140954", "0.6211711" ]
0.6850143
14
function to update note
function UpdateButn(index){ let editTitle = document.getElementById('editTitle'); let editTxt = document.getElementById("editTxt"); let notesObj = { title: editTitle.value, text: editTxt.value, id: index, }; let data = Object.keys(notesObj) .map((key) => { return key + "=" + notesObj[key]; }) .join("&"); fetch("http://localhost:8081/php-notes-app/update-note.php", { method: "POST", body: data, headers: { "Content-Type": "application/x-www-form-urlencoded" } }) .then((response) => response.json()) .then((data) => { if (data.className == "success") { showAlert(data.msg, data.className); } if (data.className == "danger") { showAlert(data.msg, data.className); } // Dismiss after 2 seconds setTimeout(function () { document.getElementById("alert").remove(); }, 2000); editTxt.value = ""; editTitle.value = ""; showNotesById(userid.value); }) .catch((error) => { console.log(error); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateNote(worker, note) {\n if (note != null) {\n note = datastore.updateNote(note);\n worker.port.emit(\"NoteUpdated\", note);\n }\n}", "function updateGoalNote(worker, note) {\n if (note != null) {\n note = datastore.updateNote(note);\n worker.port.emit(\"GoalNoteUpdated\", note);\n }\n}", "async function updateTaskNote(pNote) {\r\n await taskRef.update({note: pNote});\r\n console.log(\"Note of \" + task + \"updated to \" + pNote + \".\");\r\n}", "function editNote(key, value) {\n updateNote({\n ...activeNote, // keep what is unchanged in the activeNote object\n [key]: value, // change the values of the keys that are specified in the\n noteLastModified: Date.now(),\n });\n }", "function updateNote(userId, noteId, newBody, newTitle) {\r\n var d = new Date(Date.now())\r\n var lastUpdated = d.getDate() + '.' + (d.getMonth() + 1) + '.' + d.getFullYear() + ',' + d.getHours() + ':' + d.getMinutes();\r\n let updates = {\r\n ['/notes/' + userId + '/' + noteId + '/content']: newBody,\r\n ['/notes/' + userId + '/' + noteId + '/title']: newTitle,\r\n ['/notes/' + userId + '/' + noteId + '/lastUpdated']: lastUpdated\r\n }\r\n return firebase.database().ref().update(updates, (e) => {\r\n if (e) console.log(e)\r\n })\r\n}", "function updateNote(noteEl) {\n const noteText = document.getElementById('note-text').value\n fetch(url + '/' + `${noteEl.parentElement.id} `, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n title: noteText,\n body: noteText,\n updated_at: moment().format()\n })\n })\n .then(res => res.json())\n .then(data => {\n renderNoteText(noteEl.parentElement, data)\n })\n}", "function update_note(data)\n {\n data.id = rcmail.html_identifier_encode(data.uid);\n\n var row, is_new = (notesdata[data.id] == undefined && data.list == me.selected_list);\n notesdata[data.id] = data;\n\n if (is_new || me.selected_note && data.id == me.selected_note.id) {\n render_note(data);\n update_taglist(data.tags || []);\n }\n else if (data.tags) {\n update_taglist(data.tags);\n }\n\n // add list item on top\n if (is_new) {\n noteslist.insert_row({\n id: 'rcmrow' + data.id,\n cols: [\n { className:'title', innerHTML:Q(data.title) },\n { className:'date', innerHTML:Q(data.changed || '') }\n ]\n }, true);\n\n noteslist.select(data.id);\n }\n // update list item\n else if (row = noteslist.rows[data.id]) {\n $('.title', row.obj).text(data.title);\n $('.date', row.obj).text(data.changed || '');\n // TODO: move to top\n }\n }", "function updateNote(e){\n let note = notes[e.path[1].classList[0].split(\"id\")[1]];\n switch(e.target.name){\n case \"title\":\n note.title = e.target.value;\n break;\n case \"content\":\n note.content = e.target.value;\n break;\n case \"color\":\n e.path[1].style.backgroundColor = e.target.value;\n note.color = e.target.value;\n break;\n }\n localStorage.setItem(\"notes\",JSON.stringify(notes));\n}", "function update() {\n\t\tUtil.txt.setLibraryBrowser( Util.fs.getLibraries() );\n\t\tUtil.txt.setFileBrowser( Util.fs.getNotes(currentLib) );\n\t\tUtil.txt.setInputText( Util.fs.getNoteContent(currentLib,currentNote) );\n\t}", "async update(noteObject) {\r\n let store = await this.notesAccessStore(\"readwrite\")\r\n return store.put(noteObject)\r\n }", "function editNotes()\r\n{\r\n\tvar note = GM_getValue(steam_id, \"Enter notes here\");\r\n\tvar newNote = window.prompt(\"User notes\", note);\r\n\tif (newNote != note && newNote != \"\" && newNote != null)\r\n\t\tGM_setValue(steam_id, newNote);\r\n}", "async onSubmit(note) {\n let clonedNotes = [...this.state.notes];\n for (let n of clonedNotes) {\n if (n.time === note.time) {\n n.text = note.text;\n n.title = note.title;\n n.color = note.color;\n n.lastEdited = new Date().getTime();\n break;\n }\n }\n\n // To make sure changes are stored...\n // Realm storing\n await this.storeLocal(clonedNotes);\n await this.setState({ notes: clonedNotes },\n function() {\n this.updateItem(this.state);\n }.bind(this));\n\n // We request a remote sync, because note was edited.\n await this.state.requestSync();\n }", "function edit_note(note_id, note_name) {\n fetch(`${note_name}/edit/${note_id}`)\n .then(response => response.json())\n .then(notes => {\n Array.prototype.forEach.call(notes.task, note => {\n document.querySelector(`#edit-note-${note.id}`).style.display == 'block'\n document.getElementById(`edit-note-${note.id}`).innerHTML = `<form id=\"edit_note\"> <textarea rows=\"5\" cols=\"45\" id=\"newnote\">${note.note}</textarea> <br> <button class=\"save_edit btn btn-dark\" type=\"submit\"> Save </button></form>`;\n\n document.querySelector('#edit_note').onsubmit = function() {\n fetch(`${note_name}/edit/${note_id}`, {\n method: 'PUT',\n body: JSON.stringify({\n note: document.querySelector('#newnote').value\n })\n })\n }\n })\n })\n }", "function saveNote(){\r\n if($('.notes-list-container').children('.note-item').length > 0){\r\n let content = editor.getContents();\r\n editNoteContent(editorNotebook, editorNote, editor.getContents());\r\n $('.notes-list-container .note-item.selected .note-item-title h4').text((content.ops[0].insert.length > 18) ? content.ops[0].insert.substr(0, 18) + \"...\" : content.ops[0].insert);\r\n }\r\n }", "patch_note_content(route, nbid, update) { //#ADJUST TO NOTEBOOKS\n const url = this.baseUrl + route + \"/\" + nbid\n return client.fetch(url, {\n method: \"PATCH\",\n body: json(update)\n })\n .then(response => response.json())\n }", "function addNote() {\n // formatter, to render date in polish format\n const formatter = new Intl.DateTimeFormat('pl');\n // create note object\n const note = {\n body: noteBody.value,\n img: noteImg.value,\n alt: noteAlt.value,\n date: formatter.format(new Date)\n }\n\n // create HTML node from note object\n const node = createItem(note);\n // append created node in HTML\n noteList.appendChild(node);\n // put created node in Map to match it with note\n map.set(node, note);\n // push current note to notes object\n notes.push(note);\n // overwrite notes in indexedDB with notes\n idbKeyval.set('notes', notes)\n .catch(err => console.error('submit failed: ', err));\n // reset input values\n noteBody.value = '';\n noteImg.value = '';\n noteAlt.value = '';\n }", "function UpdateNote(noteNodeObj) {\n // Prevent two facades from updating the same note\n // this can happen in the \"complete\" logic\n if (noteNodeObj.note().updating) {\n return;\n }\n noteNodeObj.note().updating = true;\n // update each save button to display loading\n ShowLoadingByClassName(\"SaveEditButton\");\n var noteContents = noteNodeObj.note().contents();\n if (noteContents == \"\") {\n HideButtonImageByClassName(\"SaveEditButton\");\n return;\n }\n var email = CacheStoreGet(\"email\");\n var authToken = CacheStoreGet(\"token\");\n var today = new Date();\n var data =\n {\n Email: email,\n AuthToken: authToken,\n NoteContents: noteContents,\n Completed: noteNodeObj.note().completed(),\n City: userCity,\n Latitude: userLat,\n Longitude: userLng,\n RowKey: noteNodeObj.note().noteId\n };\n $.ajax({\n type: \"POST\",\n url: \"../note/UpdateNote\",\n data: data,\n success: function (response) {\n if (response.Status == \"Success\") {\n cachedNotes.UpdateNote(response.Note);\n noteNodeObj.onSuccessfulUpdate();\n }\n if (response.Status == \"Expired\") {\n // Auth token has expired\n AuthUserAndSetCookie(email, CacheStoreGet(\"password\"),\n function () {\n UpdateNote(noteNodeObj);\n }, // on success\n function () {\n Redirect('Signup.html');\n showError(\"Please log in to continue\");\n }) // on failure\n }\n HideButtonImageByClassName(\"SaveEditButton\");\n }\n });\n // Unlock the note\n window.setTimeout(function () {\n noteNodeObj.note().updating = false;\n }, 1000);\n}", "newNote(note) {\n const { title, text } = note;\n // This is input validation requiring the title and note to both have at least 1 character.\n if (!title || !text) {\n throw new Error(\"Note 'title' and 'text' both have a 1 character minimum requirement!\");\n }\n\n // This adds a unique ID to the new note as well as the title and text.\n const newNote = { title, text, id: uniqueID() };\n\n // This retrives all the notes, writes all the updated notes, adds the new note, and returns the newNote.\n return this.retrieveNotes()\n .then((notes) => [...notes, newNote])\n .then((updatedNotes) => this.writeFile(updatedNotes))\n .then(() => newNote);\n }", "function saveNote(noteID, note) {\n // Open the object store where all f the notes are stored,\n var objectStore = database.transaction([\"notes\"], \"readwrite\").objectStore(\"notes\");\n \n console.log(note);\n \n var transaction = objectStore.get(noteID);\n // Wait for a success message.\n transaction.onsuccess = function(e) { \n var oldNote = e.target.result;\n oldNote.note = note;\n \n // Update the note.\n objectStore.put(oldNote);\n };\n}", "handler () {\n notes.addNote(title, body);\n }", "function UpdateNote(noteIndex, newNote) {\n var newNoteArray = [];\n if (stateVars.itemArray != null) {\n newNoteArray = stateVars.itemArray;\n }\n\n newNoteArray[noteIndex] = newNote;\n\n setStateVars((prevState) => {\n return ({\n ...prevState,\n noteArray: newNoteArray,\n promptNewNote: false,\n editNoteIndex: -1,\n newNoteText: \"\",\n requireUpdate: true\n });\n });\n }", "update() { \n if( this.state == \"play\" && this.notes.length > 0) {\n this.currentTime = millis() - this.startTime;\n this.position.x = this.starterPos - this.getPosXFromBPM(this.currentTime, this.BPM);\n }\n this.BPM = this.inputBPM.value();\n // RECORD mode\n /* if( this.state === \"record\" ) {\n this.recordingNotes();\n }*/\n }", "function saveNote() {\n var sText = document.getElementById('note_area').value;\n\n if (oSelectedNote == null) {\n note = new Note();\n note.sNote = sText;\n\n oData.jsFormula.addNote(note);\n\n oNotesTable.row.add([\n note.nuNote,\n note.iIdNote,\n note.sNote\n ]).draw( false );\n }\n else {\n oData.jsFormula.getNote(oSelectedNote.nuNote).sNote = sText;\n $('#notes_table').dataTable().fnUpdate(sText , oSelectedNote.nuNote, 2);\n }\n\n initNote();\n}", "afficher(note){\n\t\tdocument.querySelector(\"#currentNoteView\").innerHTML = this.convertir(note);\n\t}", "function addNote(newNote) {\n setNotes(prevNotes => {\n return [...prevNotes, newNote];\n });\n }", "note (control, note) {\n return this.set(0x03, control, note)\n }", "function editNote(index) {\r\n const uid = localStorage.getItem(\"uid\")\r\n window.scrollTo(0, 0);\r\n var adaRef = firebase.database().ref('notes/' + uid + '/' + index);\r\n adaRef.get().then((snapshot) => {\r\n if (snapshot.exists()) {\r\n var crrntNote = snapshot.val();\r\n document.getElementById(\"addTitle\").value = crrntNote.title;\r\n document.getElementById(\"addTxt\").value = crrntNote.content;\r\n CKEDITOR.instances[\"addTxt\"].setData(crrntNote);\r\n replaceButtonText('addBtn', 'Update Note');\r\n flagEdit = 1;\r\n editIndex = index;\r\n\r\n }\r\n }).catch((error) => {\r\n console.error(error);\r\n });\r\n}", "handleSaveNote(event) {\n const updatedNote = this.trimNote(); //* returns the selected note with the whitespace around title/text removed\n\n if (this.isValidNote(updatedNote)) {\n //* saves the changes from selectedNote into the savedNotes list\n updatedNote.lastSaved = (new Date()).toUTCString(); //* updates save timestamp\n const savedNotes = this.state.savedNotes;\n\n //* updates selected note & state\n savedNotes.set(updatedNote.id, updatedNote);\n this.setState({ savedNotes });\n }\n\n else {\n alert('COMPUTER SAYS: The note must be filled out to use it...');\n }\n }", "'change .js-editNote' (event) {\n // Get value from editNote element\n const text = event.currentTarget.value;\n note.set(text);\n }", "function setNote() {\n var row = oNotesTable.row('.selected').data();\n var oNote = oData.jsFormula.getNote(row[0]);\n oSelectedNote = oNote;\n\n document.getElementById('note_area').value = oNote.sNote;\n document.getElementById('btnEditNote').disabled = false;\n document.getElementById('btnDelNote').disabled = false;\n document.getElementById('note_area').readOnly = true;\n}", "function showNote(note, button) {\n shownNote = note;\n shownNoteButton = button;\n $(\"#noteTime\", slide.contentDocument).text(new Date(note.time).toLocaleString());\n $(\"#noteBody\", slide.contentDocument)[0].value = note.body;\n $(\"#noteBody\", slide.contentDocument)[0].focus();\n }", "function updatePreviewWithNote(sender, paeNote) {\r\n // console.log(\"key pressed is \" + paeNote)\r\n plaineEasieCodes.push(paeNote)\r\n updateNotesSVG()\r\n}", "function addNote(newNote) {\n allNotes.push(newNote);\n updateNotes(allNotes);\n}", "addNote(note) {\n const {title,text}=note;\n if (!title || !text){\n throw new Error(\"Neither text or title can be blank for the note entered\");\n }\n const newNote={title,text,id:uniqid()};\n return this.getNotes()\n .then((notes)=>[...notes,newNote])\n .then((currentNotes)=>this.write(currentNotes))\n .then(()=>newNote);\n }", "function noteChange(beatNum, noteNum) {\n notes[beatNum][noteNum] = !notes[beatNum][noteNum];\n}", "function handlenoteEdit() {\n var currentnote = $(this).parents(\".note-panel\").data(\"id\");\n editnote(currentnote);\n }", "function note_save()\n {\n var note_obj;\n // grab the note typed into the input box\n var new_note = $(\".bootbox-body textarea\").val().trim();\n\n if (new_note)\n {\n note_obj =\n {\n _id: $(this).data(\"headline\")._id,\n text: new_note\n };\n $.post(\"/api/notes\", note_obj).then(function()\n {\n // on success, close the modal\n bootbox.hideAll();\n });\n }\n }", "async updateNote ({ commit, state }, noteObj)\n { \n let req = await axios.post('/save-note', noteObj) \n }", "function addNote(){\r\n\tvar t = document.querySelector(\"#notes\");\r\n\tvar tr = t.childNodes[0];\r\n\tappendNote(tr, defaultNote);\r\n\taddState();\r\n\t\r\n\trefreshNotes();\r\n}", "function updateothernote()\n{\n var logopener=\"----entering updateothernote----\";\n console.log(logopener);\n\n //lets get the id. \n console.log(\"UniqueGuid is \" + event.target.id);\n\n //we have the id. now, we need to do a post call to update it. \n var tempbutton = event.target;\n\n apiworkothernoteupdate(tempbutton);\n \n var logcloser=\"----leaving updateothernote----\";\n console.log(logcloser);\n}", "function changeNote() {\n editor.value = window.localStorage.getItem(notes.value);\n}", "saveNote() {\n if (this.noteMessageInput.value) {\n let key = Date.now().toString();\n localStorage.setItem(key, this.noteMessageInput.value);\n this.displayNote(key, this.noteMessageInput.value);\n StickyNotesApp.resetMaterialTextfield(this.noteMessageInput);\n this.toggleButton();\n }\n }", "function addNote(){\n var noteText = document.getElementById(\"note_text\").value;\n noteList.addNote(noteText);\n displayNotes();\n }", "function addNote(note) {\n setNotes((prevNotes) => {\n return [...prevNotes, note];\n });\n }", "function NoteSave(){\n\t\tvar noteData;\n\t\tvar newNote = $(\".bootbox-body textarea\").val().trim();\n\t\tif(newNote){\n\t\t\tnoteData = {\n\t\t\t\t_id: $(this).data(\"article\")._id,\n\t\t\t\tnoteText: newNote\n\t\t\t};\n\t\t\t$.post(\"/scrape/notes\", noteData).then(function(){\n\t\t\t\tbootbox.hideAll();\n\t\t\t});\n\t\t}\n\t}", "function updateNotifications(number) {\n $(\"#notificationNumber\").text(number);\n $(\"#notificationWindow\").text(number + \" new personal notes\");\n }", "updateNoteStore(noteToChangeId, noteKeyToChange, valueToChangeTo) {\n // Grab and set new values on the note we want to change\n const noteToChange = Notebook.findNoteById(noteToChangeId, this.state.notes)\n .set(noteKeyToChange, valueToChangeTo)\n .set('dateModified', Date.now());\n\n const newNoteState = this.state.notes.map(note => (\n note.id === noteToChangeId ? noteToChange : note\n ));\n\n this.setState({\n notes: newNoteState,\n });\n }", "function playNote(note){\n MIDI.noteOn(0, note, velocity, delay);\n MIDI.noteOff(0, note, delay + 0.75);\n}", "function changeNote(responseXML) {\n //parse the needed info from XML response and change note accordingly\n var noteObject = responseXML.getElementsByTagName(\"note\")[0];\n var title = noteObject.getElementsByTagName(\"title\")[0];\n var target = noteObject.getElementsByTagName(\"targetUser\")[0];\n var author = noteObject.getElementsByTagName(\"author\")[0];\n var message = noteObject.getElementsByTagName(\"message\")[0];\n var deadline = noteObject.getElementsByTagName(\"deadline\")[0];\n var category = noteObject.getElementsByTagName(\"category\")[0];\n title = title.childNodes[0].nodeValue;\n target = target.childNodes[0].nodeValue;\n author = author.childNodes[0].nodeValue;\n message = message.childNodes[0].nodeValue;\n deadline = deadline.childNodes[0].nodeValue;\n category = category.childNodes[0].nodeValue;\n $(\"#noteTitle\").text(title);\n $(\"#noteTarget\").text(\"Targeted to: \" + target);\n $(\"#noteAuthor\").text(\"Sent by \" + author);\n $(\"#noteMessage\").text(\"Message: \" + message);\n $(\"#noteDueDate\").text(\"Due by: \" + deadline);\n $(\"#noteCategory\").text(\"Category: \" + category);\n //when tect changed, show to user\n note.show();\n }", "function changeNote(event){\n let el = event.target;\n let id=el.parentNode.id;\n let elInData=data.find(function(element){return element.id==id;});\n\n if(el.classList.contains(\"markBut\")) { \n elInData.isMark=!elInData.isMark;\n }\n else if(el.classList.contains(\"delBut\")) {\n position =data.indexOf(elInData);\n if ( ~position ) data.splice(position, 1);\n }\n else if(el.classList.contains(\"textChangeNote\")){\n return;\n }\n else if(el.classList.contains(\"penBut\")) {\n \n if( noteChanging==null)\n { \n let noteTextEl=el.parentNode.querySelector('.noteText');\n let textarea=document.createElement('textarea');\n textarea.className=\"form-control textChangeNote\";\n textarea.value=noteTextEl.innerHTML;\n noteTextEl.innerHTML=null;\n noteTextEl.appendChild(textarea);\n noteChanging=noteTextEl;\n \n el.classList.remove('btn-danger');\n el.classList.add('btn-success'); \n return;\n }\n else{\n \n elInData.text=noteChanging.querySelector('.textChangeNote').value;\n el.classList.remove('btn-success');\n el.classList.add('btn-danger');\n noteChanging=null;\n }\n\n }\n\n localStorage.setItem('arrNotes',JSON.stringify(data));\n refresh();\n}", "addNote(info) {\n const { title, text } = info;\n const newNote = { title, text, id: uuid() };\n return this.getInfo()\n .then ((info) => [...info, newNote])\n .then((updateInfo)=> this.write(updateInfo))\n .then(() => newNote);\n }", "function displayNotes(notes) {\n var oldContent = document.getElementById('script');\n var para = document.createElement(\"p\");\n para.id = 'script';\n var newContent = document.createTextNode(notes);\n para.appendChild(newContent);\n presenterNotes.replaceChild(para, oldContent);\n}", "update({ note, body }, res) {\n console.log(\n `${dateFormat(null, \"isoUtcDateTime\")} - REQUEST update [${note.id}]`\n );\n\n if (!validateNote(body)) {\n res.sendStatus(400);\n return;\n }\n\n body.id = note.id;\n body.tags = []\n .concat(getTagsInText(body.title))\n .concat(getTagsInText(body.description));\n\n db\n .collection(\"notes\")\n .updateOne({ id: body.id }, { $set: body }, (err, result) => {\n if (err) {\n return console.log(err);\n }\n res.sendStatus(204);\n\n db\n .collection(\"notes\")\n .find()\n .toArray(function(err, results) {\n broadcast(results);\n });\n });\n }", "function enterNote() {\n note = {}\n if (checkIfInputIsCorrect()) {\n // create note\n note.InputOfNote = txtArea.value;\n note.dateOfNote = dateEnterded;\n note.timeOfNote = timeEnterded;\n note.noteNum = noteNumber;\n note.secondsComp = dateEnterdedToCompare;\n noteNumber++;\n NoteArrey.push(note);\n addToLocalStorage();\n printNotes(false);\n }\n}", "function update() {}", "function submitEditNotes(ele){\n\t\t\tvar popup = document.getElementsByClassName(\"edit-notes-form\")[0],\n\t\t\t\tupdatedNotes = ele.parentNode.getElementsByTagName(\"textarea\")[0].value;\n\n\t\t\tif(!updatedNotes) updatedNotes = \"There are no notes for this event.\"\n\n\t\t\t// Update notes\n\t\t\tcurrentStepNode.setAttribute(\"data-notes\", updatedNotes);\n\n\t\t\t// Save notes to database\n\t\t\tsaveAction.enqueue( makeJsonFromNode(currentStepNode));\n\n\t\t\t// Remove popup\n\t\t\tremoveEditNotes(popup);\n\t\t}", "function newNote(gameState, text) {\n thisGameState.notes.push(text);\n socket.emit(\"save\", gameState);\n}", "updateHandler() {\n\n // 1. Check if its (a) new note to be added or (b) update the existing note based on selectedBoardID\n var selectedBoardID = this.view.boardView.selectedBoardID;\n if (selectedBoardID === -1) {\n\n // There are 3-scenarios of add/insert\n // 1. First note added\n // 2. Insert after the last board displayed\n // 3. Append at last\n\n // 1. First note added\n if (this.startNoteID === -1 && this.endNoteID === -1) {\n\n // 1. Fetch the noteID after which the note should be inserted\n var insertedNoteID = 0;\n // 2. Insert the new note to the model\n this.model.insertNote(this.noteForm.elementCollection, insertedNoteID);\n // 3. Update the view with the new note added to the empty board (if any) or the last board\n this.view.boardView.displayNoteAtEnd(insertedNoteID, this.model.noteCollection[insertedNoteID].name);\n // 4. Update the startNoteID and endNoteID\n this.startNoteID = 0;\n this.endNoteID = 0;\n\n } else {\n if (this.view.boardView.noOfNotes === this.view.boardView.maxNoBoards) {\n\n // NOTE: Board is full condition\n // 1. Fetch the noteID after which the note should be inserted\n var insertedNoteID = this.endNoteID + 1;\n // 2. Insert the new note to the model\n this.model.insertNote(this.noteForm.elementCollection, insertedNoteID);\n // 3. Update the view with the new note added to the empty board (if any) or the last board\n this.view.boardView.displayNoteAtEnd(insertedNoteID, this.model.noteCollection[insertedNoteID].name);\n // 4. Update the startNoteID and endNoteID\n ++this.endNoteID;\n ++this.startNoteID;\n\n } else if (this.view.boardView.noOfNotes < this.view.boardView.maxNoBoards) {\n\n // Still empty boards are available to be filled\n // 1. Fetch the noteID after which the note should be inserted\n var insertedNoteID = this.endNoteID + 1;\n // 2. Insert the new note to the model\n this.model.insertNote(this.noteForm.elementCollection, insertedNoteID);\n // 3. Update the view with the new note added to the end of the noteCollection\n this.view.boardView.displayNoteAtEnd(insertedNoteID, this.model.noteCollection[insertedNoteID].name);\n // 4. Update the startNoteID and endNoteID \n ++this.endNoteID;\n }\n }\n\n } else {\n\n // Update the existing note\n // 1. Update the note in the model\n var noteToBeUpdated = this.view.boardView.boardCollection[selectedBoardID].getNote();\n this.model.updateNote(noteToBeUpdated.noteID, this.noteForm.elementCollection);\n\n // 2. Update the note in the view\n var updatedNote = this.model.noteCollection[noteToBeUpdated.noteID];\n this.view.boardView.displayNoteAt(selectedBoardID, noteToBeUpdated.noteID, updatedNote.name);\n }\n }", "function updateNote(req, res) {\n Note.findByIdAndUpdate(\n req.params.id,\n {\n $set: {\n title: req.body.title,\n body: req.body.body\n }\n },\n {\n new: true\n }\n )\n .then(dbNoteData => res.status(200).json(dbNoteData))\n .catch(err => {\n console.log(err);\n res.status(500).json(err);\n });\n}", "update(newText, i) {\n\t\tconsole.log('updating item at index', i, newText)\n\t\tthis.setState(prevState => ({\n\t\t\tnotes: prevState.notes.map(\n\t\t\t\tnote => (note.id !== i) ? note : {...note, note: newText}\n\t\t\t)\n\t\t}))\n\t}", "update(newText, id){\n var notes = this.state.notes.map(\n note => (note.id !== id) ?\n note :\n {\n ...note,\n note: newText\n }\n )\n this.setState({notes})\n }", "handler(argv) {\n notes.addNote(argv.title,argv.body)\n }", "function addNote(note) {\r\n setListNote((prevNote) => {\r\n return [...prevNote, note];\r\n });\r\n }", "function changeComment() {\n var noteOne = document.getElementById('NoteOneOnHTML').value;\n var noteTwo = document.getElementById('NoteTwoOnHTML').value;\n var noteThree = document.getElementById('NoteThreeOnHTML').value;\n\n var node = findNode(commentNodeKey, globalLogicData);\n node.notes[0] = noteOne;\n node.notes[1] = noteTwo;\n node.notes[2] = noteThree;\n reRender(commentNodeKey);\n}", "function updateNotesData(notes) {\n fs.writeFile('db/db.json', JSON.stringify(notes,'\\t'), err => {\n if (err) throw err;\n return true;\n })\n}", "function setNotes() {\n var base = 260;\n var board_height = Rooms.findOne().board.height;\n var board_width = Rooms.findOne().board.width;\n var notes = getScaleNotes(SCALE_VALUES.MAJOR, base, board_height);\n for(x = 0; x < board_width; x++) {\n for(y = 0; y < board_height; y++) {\n boardData[x][y].frequency = notes[board_height-x-1];\n boardData[x][y].title = notes[board_height-x-1];\n }\n }\n}", "setNotes (notes) {\n this.log('notes', 'setNotes', notes)\n this.notes = notes\n this.setNoteElements()\n }", "function handleChange(event) {\n setNote(event.target.value);\n }", "createUpdatedNote(req, res) {\n res.note.title = req.body.title\n res.note.description = req.body.description\n res.note.isPinned = req.body.isPinned != null ? req.body.isPinned : res.note.isPinned\n res.note.isArchived = req.body.isArchived != null ? req.body.isArchived : res.note.isArchived\n res.note.isDeleted = req.body.isDeleted != null ? req.body.isDeleted : res.note.isDeleted\n res.note.color = req.body.color || res.note.color\n }", "function displayNotes(notes) {\n\tvar el = document.getElementById('notes-played');\n\tel.innerHTML = notes; \n}", "addNotes(note) {\n // generate random id each time\n let ID = uuidv4();\n // pull data from new note\n const { title, text } = note;\n // new note object to store data from above & adds new ID number\n const newNote = { id: ID, title, text }\n return this.getNotes()\n .then(notes => [...notes, newNote])\n .then(updateNotes => this.write(updateNotes))\n .then(() => newNote)\n }", "function editNote(index){\n let saveindex = document.getElementById('saveindex')\n let saveBtn = document.getElementById('saveBtn')\n let addBtn = document.getElementById('addBtn')\n saveindex.value = index;\n let notes = localStorage.getItem('notes');\n let notesObj = JSON.parse(notes);\n addTitle.value = notesObj[index][0];\n addTxt.value = notesObj[index][1];\n addBtn.style.display=\"none\";\n saveBtn.style.display=\"block\";\n }", "function update(data) {\n console.log('+++ TODO');\n }", "async updateNotes(notes, deleteNonExisting) {\n\n if (deleteNonExisting) {\n // We remove a note from memory and localStorage, if remote version is flagged for removal.\n for (let i = 0; i < notes.length; i++) {\n\n if (typeof notes[i].isRemoved === 'undefined') {\n await this.delete(notes[i].time);\n notes.splice(i, 1);\n } else {\n delete notes[i].isRemoved;\n }\n }\n\n }\n\n await this.storeLocal(notes);\n this.setState({ notes: notes, orderChanged: false },\n function() {\n this.updateItem(this.state);\n }.bind(this));\n }", "get note () {\n\t\treturn this._note;\n\t}", "get note () {\n\t\treturn this._note;\n\t}", "get note () {\n\t\treturn this._note;\n\t}", "get note () {\n\t\treturn this._note;\n\t}", "function UpdateNoteHandler(req, res, next) {\n const vidID = req.params.vidID;\n courseModel.updateNote(vidID, req.params.course, req.body.note, req.body.user).then(data => {\n res.status(200).json(data);\n });\n}", "setNoteContents ({commit}, noteContents) {\n commit(types.SET_NEW_NOTE_CONTENTS, noteContents)\n }", "updateActiveNote(note) {\n this.root.querySelector('.notes__title').value = note.title;\n this.root.querySelector('.notes__body').value = note.body;\n\n this.root.querySelectorAll('.notes__list-item').forEach(noteListItem => {\n noteListItem.classList.remove('notes__list-item--selected');\n });\n\n this.root.querySelector(`.notes__list-item[data-note-id='${note.id}']`).classList.add('notes__list-item--selected');\n }", "notify (note) {\n // Handle type-specific updates.\n this.log('notes', 'notify', note)\n switch (note.type) {\n case 'order': {\n const order = note.order\n const mkt = this.user.exchanges[order.host].markets[order.market]\n if (mkt.orders) {\n for (const i in mkt.orders) {\n if (mkt.orders[i].id === order.id) {\n mkt.orders[i] = order\n break\n }\n }\n }\n break\n }\n case 'balance': {\n const wallet = this.user.assets[note.assetID].wallet\n if (wallet) wallet.balance = note.balance\n break\n }\n case 'feepayment':\n this.handleFeePaymentNote(note)\n break\n case 'walletstate': {\n const wallet = note.wallet\n this.assets[wallet.assetID].wallet = wallet\n this.walletMap[wallet.assetID] = wallet\n const balances = this.main.querySelectorAll(`[data-balance-target=\"${wallet.assetID}\"]`)\n balances.forEach(el => { el.textContent = (wallet.balance.available / 1e8).toFixed(8) })\n }\n }\n\n // Inform the page.\n if (this.loadedPage) this.loadedPage.notify(note)\n // Discard data notifications.\n if (note.severity < ntfn.POKE) return\n // Poke notifications have their own display.\n if (note.severity === ntfn.POKE) {\n this.pokeNote.firstChild.textContent = `${note.subject}: ${note.details}`\n this.pokeNote.classList.add('active')\n if (this.pokeNote.timer) {\n clearTimeout(this.pokeNote.timer)\n }\n this.pokeNote.timer = setTimeout(() => {\n this.pokeNote.classList.remove('active')\n delete this.pokeNote.timer\n }, 5000)\n return\n }\n // Success and higher severity go to the bell dropdown.\n this.notes.push(note)\n this.setNoteElements()\n }", "function patchNote(content, id) {\n if(!content) {\n content = ' ';\n }\n\n let data = { content };\n $.ajax({\n url : `/notes/${id}`,\n data : JSON.stringify(data),\n type : 'PATCH',\n contentType : 'application/json',\n processData: false,\n dataType: 'json'\n });\n}", "async function saveNoteWithTitle(title, content) {\r\n const uid = localStorage.getItem(\"uid\")\r\n var d = new Date(Date.now())\r\n var lastUpdated = d.getDate() + '.' + (d.getMonth() + 1) + '.' + d.getFullYear() + ',' + d.getHours() + ':' + d.getMinutes();\r\n const userNoteRef = dbRef.ref('notes/' + uid)\r\n let upd =\r\n {\r\n title,\r\n content,\r\n lastUpdated\r\n }\r\n return await userNoteRef.update({\r\n\r\n [Date.now()]: upd\r\n })\r\n\r\n}", "function editNote(index){\n let saveindex = document.getElementById('saveindex')\n let saveBtn = document.getElementById('saveBtn')\n let addBtn = document.getElementById('addBtn')\n saveindex.value = index;\n let notes = localStorage.getItem('notes');\n let notesObj = JSON.parse(notes);\n addTitle.value = notesObj[index].title;\n addTxt.value = notesObj[index].text;\n addBtn.style.display=\"none\";\n saveBtn.style.display=\"block\";\n }", "function addNote(note) {\n setNotesList(prevList => { return [...prevList, note] });\n }", "function handleNoteChanged(changed) {\n \n // default changed value is 'true'\n changed = typeof changed !== 'undefined' ? changed : true;\n \n // save the initial values if the note is unchanged\n if (!changed) {\n\tvar $noteTitle = $(\"#note-title\");\n\t$noteTitle.data('initial-value', $noteTitle.val());\n\tvar $noteText = $(\"#note-area\");\n\t$noteText.data('initial-value', $noteText.val());\n }\n \n // update the state of the save button\n $(\"#save-button\").attr(\"disabled\", !changed);\n noteChanged = changed;\n}", "function updateNoteValue(con){\n\tif(con){\n\t\t$('.playerNotes .selected').find('div.note').each(function(index, element) {\n\t\t\t$(this).css('left', Number($('#dot'+(index+1)).val()));\n\t\t});\n\t\t\n\t\t$('.playerNotes .selected').css('top', Number($('#notePosition').val()) * heightScale);\n\t}else{\n\t\t//dragging\n\t\tfor(n=0;n<notes_arr.length;n++){\n\t\t\t$(\"#dot\"+(n+1)).val('');\n\t\t}\n\t\t\n\t\t$('.playerNotes .selected').find('div.note').each(function(index, element) {\n\t\t $('#dot'+(index+1)).val(parseInt($(this).css('left'))); \n\t\t});\n\t\t\n\t\tvar curIndex = Number($('.playerNotes .selected').attr('data-array'));\n\t\t$(\"#notePosition\").val(music_arr[curMusic].notes[curIndex].position);\n\t}\n\t\n\tgenerateArray(false);\n\tstopGame();\n}", "function addNote(worker, note) {\n if (note != null) {\n note = datastore.createNote(note);\n worker.port.emit(\"NoteAdded\", note);\n }\n}", "addNote(note) {\n const { title, text } = note;\n\n if (!title || !text) {\n throw new Error(\"Note 'title' and 'text' must be completed\");\n\n }\n\n const newNote = { title, text, id: uuidv1() };\n\n return this.getNotes()\n .then((notes) => [...notes, newNote])\n .then((updatedNotes) => this.write(updatedNotes))\n .then(() => newNote);\n }", "SAVE_NOTE({ commit }, content) {\n const purpose = \"User records note\";\n const c = catchHandler.bind({ purpose });\n if (state.currentUser) {\n const recordedTime = getDate();\n const newNote = { recordedTime, content };\n return c(writeChild(\"notes\", newNote, \"push\")).then((r) => {\n // If no error thrown, continue to update our local notes\n commit(\"WRITE_NOTE\", { newNote, key: r.key });\n return r;\n });\n }\n }", "function addNote() {\n if (noteText.value === \"\") {\n return;\n } else {\n notesCounter++;\n var note = {\n noteId: notesCounter,\n noteText: noteText.value,\n noteHead: noteHead.value,\n colorBg: noteDiv.style.background || \"rgb(255, 255, 255)\",\n tags: [],\n noteFavorite: false,\n noteFavoritePos: null,\n };\n // Add note to front end array\n notes.unshift(note);\n noteDiv.style.background = \"#ffffff\";\n renderNote(note);\n clearInputs();\n noteHead.style.display = \"none\";\n noteBot.style.display = \"none\";\n }\n console.log(note);\n }", "function updateNote(userId, noteId, updateNoteObj, done) {\n logger.info(\"Inside service method - update existing note\");\n notesDao.updateNoteDetails(userId, noteId, updateNoteObj, false, done);\n}", "function update() {\n\t\t\n\t}", "function updateNotify()\n{\n\n\t\tif( get[ 'msg' ] == 'update' )\n\t\t{\n\n\t\t\t\tnotifySuccess( 'El menú <b>' + get[ 'element' ] + '</b> ha sido modificado correctamente.' );\n\n\t\t}\n\n}", "function setFrequency(note, frequency){\n note.frequency = frequency;\n}", "set notes(val) {\n this._notes = val || '';\n }", "set notes(val) {\n this._notes = val || '';\n }", "function addnote(f)\n{\t\t\t\t\t\n\t// check to see if a user click save the note.\n\tif(saveflag==false && checkIfNoteSaved() == false)\n\t{\n\twarning({\n\t\ttitle:'Warning',\n\t\tmsg:'Would you like to Save the current note?',\n\t\tnoAction:function(){\n\t\t\tresetform();\n\t\t\tsaveflag=true;\n\t\t\t$('#save_note').attr('disabled','disabled');\n\t\t},\n\t\tyesAction:function(){\n\t\t\tif(saveNote() != false) {\n\t\t\t\tresetform();\n\t\t\t\tsaveflag=true;\n\t\t\t\t$('#save_note').attr('disabled','disabled');\n\t\t\t} else return false;\n\t\t\t},\n\t\tcancelAction:function(){return false;}\n\t\t});\n\t} else {\n\t\t\tresetform();\t\n\t}\n}", "function doLogNote(note) {\n if(BD18.noteTimeout !== null) {\n clearTimeout(BD18.noteTimeout);\n }\n var msg = BD18.welcomename + \": \" + note;\n $('#lognote').text(msg);\n BD18.noteTimeout = setTimeout(function() {\n $('#lognote').text(\"\");\n BD18.noteTimeout = null;\n },\"20000\");\n}", "function updateNote() {\n\n var new_title_val = $(this).val().trim();\n \n for(var i=0; i<notes.length; i++){\n if(notes[i].title == old_title_val){\n notes[i].title = new_title_val;\n }\n }\n localStorage.setItem(\"Notes\",JSON.stringify(notes));\n}" ]
[ "0.75796837", "0.7249449", "0.7069197", "0.7006927", "0.6953592", "0.6915031", "0.6894212", "0.6830427", "0.6803867", "0.68017465", "0.66917735", "0.66513544", "0.6588292", "0.6578864", "0.6577192", "0.65482384", "0.65423733", "0.65191627", "0.6506916", "0.650472", "0.6498546", "0.64769053", "0.6474595", "0.6472485", "0.64709365", "0.6467791", "0.6442651", "0.6436833", "0.64041793", "0.6399849", "0.63997835", "0.6378421", "0.637378", "0.6366295", "0.63637286", "0.63627934", "0.6360506", "0.6353284", "0.63527095", "0.6351126", "0.63428175", "0.63415307", "0.6331539", "0.63309133", "0.63223636", "0.6316617", "0.6289289", "0.6272451", "0.6272407", "0.6272224", "0.6268089", "0.62677217", "0.62590915", "0.62545395", "0.62486094", "0.6245859", "0.6234452", "0.6234095", "0.6229673", "0.6228422", "0.62208855", "0.6216023", "0.6206906", "0.61971587", "0.61936367", "0.6183069", "0.6176481", "0.61688715", "0.61645323", "0.61565727", "0.6155985", "0.6154513", "0.61439407", "0.6142009", "0.61389", "0.61389", "0.61389", "0.61389", "0.61373883", "0.61286426", "0.6125765", "0.6119835", "0.6112145", "0.60913837", "0.6089585", "0.6088894", "0.6082403", "0.6079558", "0.6076779", "0.6063182", "0.6062505", "0.60558707", "0.6045504", "0.6042468", "0.6040059", "0.60388577", "0.6032557", "0.6032557", "0.6028586", "0.60244286", "0.6021905" ]
0.0
-1
need to be able to select a pokemon from the map and return the ID number to load the info comp
render(){ return ( <div/> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onPokemonSelect(event) {\n let id = event.currentTarget.getAttribute('data-id');\n ClassPokemon.pokemonSelected = ClassPokemon.ListPokemons.find(x=>x._id==parseInt(id));\n ClassPokemon.renderInformationAdditional();\n ClassPokemon.renderList();\n }", "function selectPokemon(id){\n\tjQuery.get( \"http://pokeapi.co/api/v2/pokemon/\"+id+\"/\", function( data ) {\n alert( \"Data Loaded: \" + data );\n});\n\t//name & id\n\tconsole.log(id);\n\t\n\tdocument.getElementById('sprite').setAttribute('src',sprite(id+1));\n\tdocument.getElementById('name').innerHTML=allPokemon[id].Name;\n\tdocument.getElementById('number').innerHTML=allPokemon[id].Ndex;\n\t\n\t//types\n\tvar type1=document.getElementById('type1');\n\tvar type=allPokemon[id].Type1;\n\ttype1.innerHTML=type;\n\ttype1.classList.add(type);\n\t\n\tvar type2=document.getElementById('type2');\n\t\n\tif(allPokemon[id].Type2!=\"\"){\n\t\ttype2.classList.remove(\"Hide\");\n\t\ttype=allPokemon[id].Type2;\n\t\ttype2.innerHTML=type;\n\t\ttype2.classList.add(type);}\n\telse { //ony 1 type\n\t\ttype2.classList.add(\"Hide\");\n\t}\n\t//weaknesses\n\t\n\t//img\n\tvar num=Number.parseInt(id);\n\tnum++;\n\t\n\t\n\t//pokemon genus\n\tvar genus=\"\";\n\tdocument.getElementById('classification').textContent=genus;\n\t\n\t//description\n\t\n\t//stats\n\t\n\t//evolutions\n\t\n\t//previous & next pokemons\n\t\n\t//audio\n\t\n\t//3d\n\t\n\t//highlight pokemon in table\n}", "getPokemon(id) {\n return this.apiHandler.get(`pokemon/${id}/`);\n }", "async function getPokemonProps(pokemonName) {\n await fetch(\"https://pokeapi.co/api/v2/pokemon/\" + pokemonName)\n .then(response => response.json())\n .then(data => {\n selectedPokemonData.id = data.id\n selectedPokemonData.name = data.name\n selectedPokemonData.types = data.types.map(types => { return types.type.name; })\n selectedPokemonData.image = \"https://assets.pokemon.com/assets/cms2/img/pokedex/full/\" + (\"00\" + data.id).slice(-3) + \".png\"\n selectedPokemonData.index = (\"00\" + data.id).slice(-3)\n })\n .catch(() => {\n console.log(\"Error request pokémon. Id: \" + selectedPokemonData.id)\n })\n}", "function mostrarPokemon(id) {\n return pokemons[id] || {};\n}", "function getPokemon(id)\n{\n $.ajax({\n url: \"https://pokeapi.co/api/v2/pokemon/\" + id\n }).done(handleResponse);\n\n function handleResponse(data)\n {\n $('#pokemonImg img').attr('src', data.sprites.front_default);\n $('#pokemonName span').html(data.name);\n $('#pokemonId span').html('#' + data.id);\n\n for(let i = 0; i < data.types.length; i++)\n {\n $('.type[data-id=\"'+ i +'\"] span').html(data.types[i].type.name);\n }\n\n for(let i = 0; i < data.abilities.length; i++)\n {\n $('.abilities[data-id=\"'+ i +'\"] span').html(data.abilities[i].ability.name);\n }\n\n for(let i = 0; i < data.stats.length; i++)\n {\n let statName = data.stats[i].stat.name;\n let statNameSlice = statName.slice(0, 2);\n let statNameSliceTwo = statName.slice(8, 11);\n\n $('.baseStats[data-id=\"'+ i +'\"] span').html(data.stats[i].base_stat);\n\n if(statName.length >= 14)\n {\n $('.statName[data-id=\"'+ i +'\"] span').html(statNameSlice + \".\" + statNameSliceTwo.replace('att', 'atk'));\n }\n else\n {\n $('.statName[data-id=\"'+ i +'\"] span').html(data.stats[i].stat.name.replace('defense', 'def').replace('attack', 'atk'));\n }\n }\n }\n}", "async function getSpecificPokemon(pokemon) {\n const response = await axios.get(`https://pokeapi.co/api/v2/pokemon/${pokemon}`)\n // console.log(response.data);\n yourPokemon = response.data\n displayYourPokemon(response.data);\n displayYourPokemonMoves(response.data);\n assignPokemonStats(response.data.stats, \"me\");\n }", "function onPokeClick(pokemon){\n let pokeInfo = $.get(\"http://pokeapi.co/api/v1/pokemon/\" + pokemon.attr(\"id\"), function(data){\n console.log(data);\n populatePokemanInfo(data);\n }, \"json\");\n }", "function getPokemonId() {\n return window.location.search.split('=')[1];\n}", "getPokemonNameById(pokemonId) {\n if (this.pokemon) {\n for (let i = 0; i < this.pokemon.length; i++){\n if (this.pokemon[i].id == [pokemonId]){\n return this.pokemon[i].name + (this.pokemon[i].form == 'alolan' ? '*' : '');\n }\n }\n }\n return null;\n }", "function pickPok() {\n\t\tvar random = Math.floor(Math.random() * randomPokemon.length);\n\t\treturn randomPokemon[random];\n\t}", "function getPokemon()\n {\n //console.log(pokemons[selectPokemon.value]);\n var p=pokemons[selectPokemon.value];\n var poke = new Pokemon(p.nombre, p.vida, p.ataque,p.grito);\n var datos =\"vida: \" + poke.vida+\"\\n\"+\"\\nataque: \"+poke.ataque;\n poke.vida = poke.vida - 13;\n nombrePokemon.textContent = poke.nombre;\n datosPokemon.textContent=datos;\n imgPokemon.src=poke.imagen; \n }", "function randomPokemon() {\n selector = Math.floor(Math.random()* 781) + 26 //Random number between 26 and 809\n getAPIData(`https://pokeapi.co/api/v2/pokemon/${selector}`).then((pokeData) => {\n populatePokeCards(pokeData)\n })\n}", "function implant(pk){\n let Poke = new Pokemon(pk.name, pk.abilities, pk.sprites, pk.types);\n let move = \"\";\n let poketype = \"\";\n for(let x= 0; x< Poke._abilities.length; x++){\n move = move + \" \" + Poke._abilities[x].ability.name + \", \";\n }\n move = move.substring(0,move.length-2);\n for(let y of Poke._types){\n poketype = poketype + \" \" + y.type.name + \", \"; \n }\n poketype = poketype.substring(0,poketype.length-2);\n document.getElementById('pkInfo').innerHTML = '<br>' + 'Name: ' + Poke._name \n + '<br></br>' + 'Abilities: ' + move\n + '<br></br>' + 'Pokemon types: ' + poketype\n + '<br></br>' + \"<img src = ' \" + Poke._image.front_default + \"' /> \";\n\n console.log(Poke);\n console.log(pk);\n \n\n}", "function overView(id) {\n\t\treturn new Promise(function(resolve, reject) {\n\t\t\tclient.get('http://pokeapi.co/api/v2/pokemon/' + id + '/', function(data, res) {\n\t\t\t\tpokemon = {\n\t\t\t\t\tname: data.name,\n\t\t\t\t\texp: data.base_experience,\n\t\t\t\t\thp: data.stats[data.stats.length - 1].base_stat,\n\t\t\t\t\tweight: data.weight,\n\t\t\t\t\telement: data.types[0].type.name\n\t\t\t\t};\n\t\t\t\tresolve(pokemon);\n\t\t\t});\n\t\t});\n\t}", "function getPokemon() {\n var rngIndex = Math.floor(Math.random() * pokemonList.length);\n return pokemonList[rngIndex].name.toUpperCase();\n}", "function getPokemonData(id) {\n fetch(`https://pokeapi.co/api/v2/pokemon/${id}`)\n .then(res => res.json())\n .then(pokemon => {\n screen.classList.remove('hidden');\n screen.classList.remove(...types);\n powerButton.style.background = 'black';\n powerButton.style.border = '3px solid white';\n \n pokemonName.textContent = pokemon.name;\n pokemonID.textContent = '#' + pokemon.id;\n\n pokemonFront.src = pokemon.sprites.front_default;\n pokemonBack.src = pokemon.sprites.back_default;\n if(!pokemon.sprites.back_default) {\n pokemonFront.style.margin = '0px';\n pokemonBack.style.margin = '0px';\n }\n \n const pokemonType = pokemon.types;\n pokemonTypeOne.textContent = pokemonType[0]['type']['name'];\n screen.classList.add(pokemonType[0]['type']['name']);\n \n const secondType = pokemonType[1];\n if(secondType) {\n pokemonTypeTwo.textContent = pokemonType[1]['type']['name'];\n pokemonTypeOne.style.margin = '0px 25px';\n pokemonTypeTwo.style.margin = '0px 25px';\n } else {\n pokemonTypeTwo.textContent = '';\n pokemonTypeOne.style.margin = '0px';\n pokemonTypeTwo.style.margin = '0px';\n }\n })\n}", "function fetchPokemon() {\n // build a URL using the endpoint and a random integer\n const index = randomIntUpTo(pokedex);\n const url = `${endpoint}${index}`;\n\n // fetch request\n fetch(url)\n .then(response => response.json())\n .then((json) => {\n // resolved: retrieve the necessary information and update the pokemon variable\n const {\n name, sprites,\n } = json;\n\n const sprite = isShiny ? sprites.front_shiny : sprites.front_default;\n pokemon = {\n name,\n sprite,\n index,\n };\n })\n .catch((err) => {\n // rejected: update pokemon to false\n pokemon = false;\n });\n}", "function playerSelect() {\n $(\".pokemon .poke-container\").click(function () {\n // get the name of the clicked pokemon and compare it to the name in pokemonList array\n let name = $(this).children(\"h2\").text();\n for (let i in pokemonList) {\n if (pokemonList[i].name === name) {\n // find and save the chosen pokemon as the player's choice\n player.choice = pokemonList[i];\n //hide the pokemon list\n pokemon.style.display = \"none\";\n //after selecting pokemon, generate the pokemon in the battle arena, along with the user attacks\n createPoke($(\".arena .player\"), player.choice);\n createPoke($(\".arena .computer\"), computer.choice);\n attackList();\n }\n }\n });\n}", "function fetchPokemonLocations(pokeData){\n fetch(`https://pokeapi.co/api/v2/pokemon/${pokeData.id}/encounters`)\n .then(response => response.json())\n .then(function(pokeLocation){\n renderPokemon(pokeLocation)\n })\n}", "function getSinglePokemonCallback(response){\n\tconsole.log(response.name);\n\tvar imageUrl = pokemonImage(response)\n\tvar pokemonAbilities = pokemonAbilities(response);\n\tconsole.log(imageUrl);\n\tconsole.log(pokemonAbilities);\n}", "static getRandomPokemon() {\n let randomNum = Math.floor(Math.random() * (802));\n return Pokemon.allPokemons[randomNum]\n }", "function helperToGetPokemonData() {\n\t\tgetAjaxRequest(\"pokedex.php?pokemon=\" + this.getAttribute(\"alt\").toLowerCase(), \n\t\t\t\t\t\tdisplayCardData, true);\n\t\t$(\"start-btn\").classList.remove(\"hidden\");\n\t}", "function randomPokemon(pokedex) {\r\n let num = Math.floor((Math.random() * 156) + 1);\r\n let pokemon = pokedex[num].url;\r\n return pokemon\r\n}", "function showPokeInfo(pokemon) {\n loadDetails(pokemon).then(function() {\n showModal(pokemon);\n });\n}", "function cadaPokemonInfo(e){\n console.log(e.id);\n\n var nombrePok = e.id;\n var pokeURL = \"http://pokeapi.co/api/v2/pokemon/\" + nombrePok;\n\n $.getJSON(pokeURL, function(data){\n var pokeName = data.name;\n var pokeID = data.id;\n var pokeType = data.types[0].type.name;\n console.log(pokeName);\n console.log(pokeID);\n console.log(pokeType);\n\n var sprites = \"https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/\"; //25.png\n var espacio = '<div class=\"color-espacio col-md-3\" id=\"div-color\"><img src=\"'+ sprites+pokeID+'.png\"><h1>' + pokeName + '</h1></div>';\n //var li = '<h1>' + pokeName + '</h1>';\n //var foto = '<img src=\"'+ sprites+pokeID+'.png\">'\n \n\n $(\"#contenedor-pokemon\").append(espacio);\n if(pokeType == \"electric\"){\n $(\".contenedor-cada-pokemon\").css(\"background-color\",\"yellow\");\n }\n });\n }", "function loadTeamPokemon(e) {\n let obj = JSON.parse(e.target.responseText);\n let objName = obj.name;\n let pokemonName = capFirstLetter(objName);\n let pokemonWeight = (obj.weight / 10);\n let pokemonHeight = (obj.height * 10);\n let randomAbility = Math.floor((Math.random() * obj.abilities.length));\n let pokemonID = obj.id;\n let spriteDisplay = \"\";\n if (pokemonID > 649) {\n spriteDisplay = obj.sprites.front_default;\n }\n else {\n spriteDisplay = obj.sprites.versions['generation-v']['black-white'].animated.front_default;\n }\n\n\n // Get the pokemon id and diplay it how it is displayed in the offical pokedex\n\n if (pokemonID < 100) {\n pokemonID = \"0\" + pokemonID;\n if (pokemonID < 10) {\n pokemonID = \"0\" + pokemonID;\n }\n }\n\n\n pokemonID = \"#\" + pokemonID;\n let nameID = pokemonID + \" \" + pokemonName;\n\n // Get the ability of a pokemon and display it neatly\n let pokemonAbility = \"Not Yet Discovered!\";\n if (pokemonID < 808) {\n pokemonAbility = obj.abilities[randomAbility].ability.name;\n pokemonAbility = pokemonAbility.split('-');\n if (pokemonAbility.length == 2) {\n pokemonAbility = capFirstLetter(pokemonAbility[0]) + \" \" + capFirstLetter(pokemonAbility[1]);\n }\n else {\n pokemonAbility = capFirstLetter(pokemonAbility[0]);\n }\n }\n\n // Get the typing of pokemon (some have more than one type)\n let pokemonTypes = \"\";\n pokemonTypes = capFirstLetter(obj.types[0].type.name);\n if (obj.types.length == 2) {\n pokemonTypes = pokemonTypes + \" - \" + capFirstLetter(obj.types[1].type.name);\n }\n\n // Part of Sting that will be saved \n let contentToAdd = \"\";\n contentToAdd += \"<div class = 'teamMember' id='\" + pokemonName + \"'>\";\n contentToAdd += \"<div class = 'teamIMG'>\"\n contentToAdd += \"<img src='\" + spriteDisplay + \"' alt='\" + pokemonName + \" spirte'></div>\";\n contentToAdd += \"<span><p>\";\n contentToAdd += \"<b>\" + nameID + \"</b><br>\" + \"Type: \" + pokemonTypes + \"<br>Ability: \" + pokemonAbility + \"<br>Weight: \" + pokemonWeight + \" kg Height: \" + pokemonHeight + \" cm\";\n contentToAdd += \"</p><a href='https://bulbapedia.bulbagarden.net/wiki/\" + pokemonName + \"_(Pokémon)' target='_blank'>Visit Bulbapedia for More Info!</a>\"\n contentToAdd += \"</span></div>\";\n currentTeamHTML.push(contentToAdd);\n loadAllMembers();\n}", "function getPokemon () {\n var randomNum = Math.floor(Math.random() * numbers.length) + 1;\n pokeId = numbers[randomNum - 1];\n\n P.getPokemonByName(pokeId)\n .then(function(response){\n if(doing == false) {\n doing = true;\n pokeSprite = response.sprites.front_default;\n $(\".pokemon-img\").attr(\"src\", pokeSprite)\n $(\".pokemon-img\").attr(\"alt\", pokeName);\n pokeName = response.name;\n }\n });\n}", "function getApokemon(id, pokeTrainer){\n\treturn $.ajax({\n\turl: `https://pokeapi.co/api/v2/pokemon/${id}/`,\n\tmethod: 'GET',\n\tdataType: 'JSON',\n\tsuccess: function(data){\n\t\tconsole.log(data);\n\t\tlet id = data.id,\n\t\t\tname = data.name,\n\t\t\timage = data.sprites.front_default,\n\t\t\tdefense = data.stats[3].base_stat,\n\t\t\tattack = data.stats[4].base_stat,\n\t\t\thp = data.stats[5].base_stat,\n\t\t\tabilities = [],\n\t\t\ttypes = [];\n\n\t\tfor ( let i = 0; i < data.abilities.length; i++) {\n\t\t\t abilities.push(data.abilities[i].ability.name);\t\n\t\t} \n\n\t\tfor ( let i = 0; i < data.types.length; i++) {\n\t\t\t types.push( data.types[i].type.name);\n\t\t} \n\t\t\n\t\t let poke = new pokeData(id,name,image,hp,attack,defense,abilities,types); \n pokeTrainer.addPokemon(poke);\n},\n error: function(error){\n console.log(error);\n }\n})\n}", "function displayPokemon(pokemon) {\n $('.pokemon-selector-grid').append(\n `<div class=\"grid-pokemon-display\" id=\"${pokemon.species.name}\"><p>${pokemon.species.name}</p>\n <img src=\"${pokemon.sprites.front_shiny}\"></div>`\n )\n }", "function tierOf(pokeId) {\n var name = sys.pokemon(pokeId), tiers = sys.read(\"tiers.xml\").split('\\n'), start = 23, pokemon,\n tierId = { // + 1 compared to index\n 25: \"Chuck Norris\",\n 26: \"*** WINNER ***\",\n 27: \"Uber\",\n 28: \"OU\",\n 29: \"UU\",\n 30: \"RU\"\n };\n\n for (i = start; i < start + 8; i++) {\n pokemon = tiers[i].substring(tiers[i].indexOf(\"pokemons\") + 9, tiers[i].indexOf(\"abilities\")).trim();\n pokemon = pokemon.replace(/\"/g, \"\").split(\", \");\n if (pokemon.indexOf(name) > -1) {\n return tierId[i];\n }\n }\n\n return \"NU\";\n}", "function pokeInfo(pokemon) {\n const title = document.querySelector('.modal-title');\n const pokeImg = document.querySelector('.modal-body-pokeImg');\n const height = document.querySelector('.height');\n const xp = document.querySelector('.xp');\n const hp = document.querySelector('.hp');\n const atk = document.querySelector('.atk');\n const dfs = document.querySelector('.dfs');\n\n title.innerText = `${pokemon.name}`\n pokeImg.setAttribute('src', pokemon.sprites.other.dream_world.front_default);\n xp.innerHTML = `XP: ${pokemon.base_experience}`;\n hp.innerHTML = `HP: ${pokemon.stats[0].base_stat}`\n atk.innerHTML = `ATK: ${pokemon.stats[1].base_stat}`\n dfs.innerHTML = `DFS: ${pokemon.stats[2].base_stat}`\n\n}", "function curarPokemon(id){\n let energeticoHp = 20\n let pokemonVida = pokemons[id]\n\n \n if (pokemonVida.hp <90){\n pokemonVida.hp += energeticoHp\n return `${pokemonVida.nome}: ${pokemonVida.hp}`\n }else if (pokemonVida.hp == 90) {\n pokemonVida.hp = 100\n return `${pokemonVida.nome}: ${pokemonVida.hc}`\n }else if (pokemonVida.hp >=100) {\n return `O HP de ${pokemonVida.nome} Estou 100% para Luta ;)`\n }\n}", "async function randomPokemon(num) {\n try {\n const opposingPokeData = await axios.get(`https://pokeapi.co/api/v2/pokemon/${num}/`)\n let opposingNameData = opposingPokeData.data.name\n let opposingSpriteData = opposingPokeData.data.sprites.front_default\n let opposingTypeData = opposingPokeData.data.types[0].type.name\n // console.log(opposingNameData);\n // console.log(opposingSpriteData);\n let opposingPokemonName = document.getElementsByClassName('opposing-pokemon-name');\n opposingPokemonName = opposingNameData\n let opposingSprite = document.getElementById('opposing-pokemon-sprite');\n opposingSprite.src = opposingSpriteData\n return opposingTypeData\n } catch (err) {\n alert(err, 'Try spell-checking your pokemon');\n }\n}", "function getPokemonInfo(url) {\n fetch(url)\n .then((response) => response.json())\n .then((data) => {\n // Make sure data comes throufg\n console.log(data);\n // Write data to pokemon information container\n document.querySelector(\".pokemon-pic\").innerHTML = `\n <img class=\"pokemon-picture\" src=\"${data.sprites.other[\"official-artwork\"].front_default} \">\n `;\n document.querySelector(\".number\").innerHTML = `<br><span>${data.id}</span>`\n ;\n document.querySelector(\".pokemon-info\").innerHTML = ``;\n document.querySelector(\".pokemon-info\").innerHTML += `<br><span>${data.name}</span>`\n ;\n document.querySelector(\".pokemon-info\").innerHTML += `<br><span>${\" Weight: \"+data.weight+\" lbs\"}</span>`\n ;\n document.querySelector(\".pokemon-info\").innerHTML += `<br><span>${\"height: \"+data.height+\"ms\"}</span>`\n ;\n document.querySelector(\".pokemon-info\").innerHTML += `<br><span>${\"Type: \"+data.types[0].type.name}</span>`;\n if(data.types[1]){\n document.querySelector(\".pokemon-info\").innerHTML += `<span>,${ data.types[1].type.name }</span>`;\n }\n \n \n document.querySelector(\".pokemon-info\").innerHTML += `<br><span>${\"Ability 1: \"+data.abilities[0].ability.name}</span>`;\n if (data.abilities[1].ability.name){\n document.querySelector(\".pokemon-info\").innerHTML += `<br><span>${\"Ability 2: \"+data.abilities[1].ability.name}</span>`;\n }\n \n // document.querySelector(\".pokemon-info\").innerHTML += `<br><span>${\"Ability: \"+data.abilities[2].ability.name}</span>`;\n \n });\n}", "function findPokemon(args) {\n let pkmn = util.find(pokedex, args[0]);\n if (pkmn) {\n let pkmn_url = endpoints.pokemon.replace('%s', pkmn.resource_uri);\n return getPokemonResource(pkmn_url).then(pkmnBody => {\n \n let pkmnData = {\n name: pkmnBody.name,\n type: pkmnBody.types.reduce((out, type) => `${out}${type.name} `, '').trim().replace(' ', ' / ')\n }\n\n return {pkmnData, pkmnBody};\n }).then(data => {\n let desc_url = endpoints.description.replace('%s', data.pkmnBody.descriptions[0].resource_uri);\n return getPokemonResource(desc_url).then(descData => {\n data.pkmnData.desc = descData.description;\n return data;\n })\n }).then(data => {\n let sprite_url = endpoints.sprite.replace('%s', data.pkmnBody.sprites[0].resource_uri);\n return getPokemonResource(sprite_url).then(spriteData => {\n data.pkmnData.img = endpoints.img.replace('%s', spriteData.image);\n\n return data.pkmnData\n })\n }).then(p => {\n return [{\n text: `${p.name}: A [ ${p.type} ] pokemon. ${p.desc}`,\n img: p.img\n }]\n })\n }\n\n return Promise.reject({type: 'NOT_FOUND', message: `Error: pokemon [${args[0]}] not found`});\n}", "getPokemonById(pokemonId) {\n console.log('In PokeService');\n return fetch(`https://pokeapi.co/api/v2/pokemon/${pokemonId}/`)\n .catch((err) => {\n console.log('Error: ' + err);\n })\n }", "function loadSinglePokemon(id) {\n position_loader();\n var url_for_single_pokemon = 'http://pokeapi.co/api/v1/pokemon/' + id\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url_for_single_pokemon, true);\n xhr.send();\n\n xhr.onreadystatechange = function() {\n if (xhr.readyState != 4) return;\n \n if (xhr.status != 200) {\n // handle the error\n alert(xhr.status + ': ' + xhr.statusText);\n } else {\n // display results\n var json_result = xhr.responseText;\n var object_result = JSON.parse(json_result);\n \n var type_pokedex = '';\n var types_object = object_result.types;\n var x = 0;\n for (var key_type in types_object) {\n if(x == 0)\n type_pokedex = type_pokedex + types_object[key_type].name.charAt(0).toUpperCase() + types_object[key_type].name.substr(1).toLowerCase();\n else\n type_pokedex = type_pokedex + ', ' + types_object[key_type].name.charAt(0).toUpperCase() + types_object[key_type].name.substr(1).toLowerCase();\n x++;\n }\n\n //generate content single pokemon\n var single_pokemon = '<div class=\"single_pokemon\">\\\n <div class=\"image_pokedex\"><img src=\"http://pokeapi.co/media/img/' + object_result.pkdx_id + '.png\" class=\"img-responsive\" alt=\"' + object_result.name + '\"></div>\\\n <p class=\"name_pokemon\"><strong>' + object_result.name + ' #' + setupPrefInt(object_result.pkdx_id, 3) + '</strong></p>\\\n <table class=\"table table-bordered\">\\\n <tr><td>Type</td><td>' + type_pokedex + '</td></tr>\\\n <tr><td>Attack</td><td>' + object_result.attack + '</td></tr>\\\n <tr><td>Defense</td><td>' + object_result.defense + '</td></tr>\\\n <tr><td>HP</td><td>' + object_result.hp + '</td></tr>\\\n <tr><td>SP Attack</td><td>' + object_result.sp_atk + '</td></tr>\\\n <tr><td>SP Defense</td><td>' + object_result.sp_def + '</td></tr>\\\n <tr><td>Speed</td><td>' + object_result.speed + '</td></tr>\\\n <tr><td>Weight</td><td>' + object_result.weight + '</td></tr>\\\n <tr><td>Total moves</td><td>' + object_result.moves.length + '</td></tr>\\\n </table>\\\n </div>';\n \n // insert content into page and hide loader\n var body_single_pokemon = document.getElementById('body_single_pokemon');\n loader.style.display = \"none\";\n body_single_pokemon.innerHTML = single_pokemon;\n }\n }\n}", "function updatePokemon(pokeid, team, index) {\n var idStr = pokeid;\n if (Number(pokeid) < 100) idStr = \"0\" + idStr;\n if (Number(pokeid) < 10) idStr = \"0\" + idStr;\n if (Number(pokeid) > 796 && pokeid !== 802 && pokeid !== 803) idStr = \"201\";\n $('#mon-pic-' + (index + 1)).attr('src', 'https://pldh.net/media/pokemon/shuffle/' + idStr + '.png');\n $('#mon-select-' + (index + 1)).text(team.pokemon[index]);\n\n $(\".base-stat\").each(function(elem) {\n $(this).text(pokedex[toId(team.pokemon[index])].baseStats[$(this).data(\"stat\")]);\n calculateStatTotal($(this).data(\"stat\"));\n });\n}", "function getPokemonById(id){\n return $http\n .get('http://pokemon.origincodeacademy.com/api/v2/pokemon' + id)\n .then(function(response) {\n return response.data;\n });\n }", "function getPokemonId(url){\n\treturn url.slice(33, url.length-1);\n}", "function getRandomPokemon() {\r\n let pokemonNum = Math.floor(Math.random() * pokemonsInTheGenerations.length);\r\n let url = `https://pokeapi.co/api/v2/pokemon/${pokemonsInTheGenerations[pokemonNum].name}/`;\r\n fetch(url)\r\n .then(result => {\r\n return result.json();\r\n })\r\n .then(data => {\r\n pokemonImgEl.classList.add(\"gray\");\r\n pokemonImgEl.src = `${data.sprites.front_default}`;\r\n console.log(data.name);\r\n return pokemonName = data.name;\r\n })\r\n .catch(error => {\r\n console.error(`There has been a problem with your fetch operation: ${error}`);\r\n })\r\n}", "function getPokemon(id, trainer){\n return $.ajax({\n url: `https://pokeapi.co/api/v2/pokemon/${id}/`,\n dataType: 'json',\n method: 'GET',\n })\n .done(function(data) {\n console.log(data);\n let types = [];\n let getTypes = function(){\n for (let i = 0; i < data.types.length; i++){\n types.push(data.types[i].type.name);\n }\n }\n getTypes();\n let abilities = [];\n let getAbilities = function(){\n for (let i = 0; i < data.abilities.length; i++){\n abilities.push(data.abilities[i].ability.name);\n }\n }\n getAbilities();\n let pokemon = new Pokemon(data.id,data.name,data.sprites.front_default,types,data.weight,data.height,data.stats[3].base_stat,data.stats[4].base_stat,data.stats[5].base_stat,abilities);\n trainer.addPokemon(pokemon);\n });\n}", "function getSinglePokemon(pokemonName){\n\t$.ajax({\n\t\turl: \"http://pokeapi.co/api/v2/pokemon/\"+pokemonName,\n\t\tsuccess: getSinglePokemonCallback,\n\t\terror: function(){\n\t\t\talert(\"Try Again Fool!\");\n\t\t}\n\t})\n}", "function selectBreakpointIVs(e){\n\t\t\t\t$(\".poke.single\").first().find(\".advanced-section\").addClass(\"active\");\n\n\t\t\t\tvar level = parseFloat($(e.target).attr(\"level\"));\n\t\t\t\tvar atk = parseInt($(e.target).attr(\"atk\"));\n\t\t\t\tvar def = parseInt($(e.target).attr(\"def\"));\n\t\t\t\tvar hp = parseInt($(e.target).attr(\"hp\"));\n\n\t\t\t\tvar pokemon = pokeSelectors[0].getPokemon();\n\n\t\t\t\tif(pokemon){\n\t\t\t\t\tpokemon.setLevel(level);\n\t\t\t\t\tpokemon.setIV(\"atk\", atk);\n\t\t\t\t\tpokemon.setIV(\"def\", def);\n\t\t\t\t\tpokemon.setIV(\"hp\", hp);\n\t\t\t\t\tpokeSelectors[0].update();\n\n\t\t\t\t\t// Set level and iv fields\n\t\t\t\t\t$(\".poke.single\").first().find(\"input.level\").val(pokemon.level);\n\t\t\t\t\t$(\".poke.single\").first().find(\"input.iv[iv='atk']\").val(pokemon.ivs.atk);\n\t\t\t\t\t$(\".poke.single\").first().find(\"input.iv[iv='def']\").val(pokemon.ivs.def);\n\t\t\t\t\t$(\".poke.single\").first().find(\"input.iv[iv='hp']\").val(pokemon.ivs.hp);\n\t\t\t\t}\n\n\t\t\t\t$(\"html, body\").animate({ scrollTop: $(\".poke\").offset().top - 30 }, 500);\n\n\t\t\t}", "displayInfo(id) {\r\n const endpoint = `https://pokeapi.co/api/v2/pokemon/${id}/`;\r\n\r\n const req = new Request(endpoint);\r\n\r\n fetch(req)\r\n .then(blob => blob.json())\r\n .then(data => console.log(data));\r\n }", "function displayYourPokemon(pokemon) {\n scrollUp();\n $('.pokemon-selector-grid').html(\"\")\n $(\"#your-pokemon\").html(`<h1>You picked <font color=\"#0000e5\">${pokemon.species.name}</font>!</h1>\n <p><center><img src=\"${pokemon.sprites.front_default}\"></center></p>\n <p><h2>Choose 4 Moves for Your Pokemon!</h2></p>`)\n }", "function generateRandomPokemon(){\n const MAX = 809;\n const MIN = 1;\n const id = Math.floor(Math.random() * (MAX - MIN) + MIN)\n return id;\n}", "loadPoke(){\n\t\t//testing\n\t\t//console.log(this.pokes[this.current].abilities);\n\n\t\tpokeName.innerHTML = this.pokes[this.current].name;\n\t\tpokePic.src=this.pokes[this.current].img;\n\t\tpokePic.alt=\"Image of \"+this.pokes.name;\n\t\t//console.log(this.pokes[this.current].img);\n\t\t$(\"#hp\").html(this.pokes[this.current].hp);\n\t\t$(\"#attack\").html(this.pokes[this.current].attack);\n\t\t$(\"#defense\").html(this.pokes[this.current].defense);\n\t\t//the number of abilities varries in number so I put it in its own function \n\t\tthis.createAbilities();\n\t}", "function displayPokemonFromRegion(data) {\n $('.pokemon-list').empty();\n $.each(data, function (i, pokemon) {\n pokemonName = pokemon.name;\n pokemonID = pokemon.url.replace(\"https://pokeapi.co/api/v2/pokemon-species/\", \"\").replace(\"/\", \"\");\n\n $('.pokemon-list').append(`<div class=\"pokemon-container\" id=\"${pokemonID}\"></div>`);\n $(`#${pokemonID}`).append(`<p>${pokemonID}. ${firstLetterUppercase(pokemonName)}</p>`);\n $(`#${pokemonID}`).append(`<img src=\"https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/${pokemonID}.png\">`);\n });\n }", "function loadDetails(pokemon) {\n let url = pokemon.detailsUrl;\n return fetch(url)\n .then(function (response) {\n return response.json();\n })\n .then(function (details) {\n pokemon.imageUrlFront = details.sprites.front_default;\n pokemon.imageUrlBack = details.sprites.back_default;\n pokemon.height = details.height;\n pokemon.weight = details.weight;\n pokemon.types = [];\n for (var i=0; i < details.types.length; i++){\n pokemon.types.push(details.types[i].type.name);\n }\n pokemon.abilities = [];\n for (var i=0; i < details.abilities.length; i++) {\n pokemon.abilities.push(details.abilities[i].ability.name);\n }\n })\n .catch(function (e) {\n console.error(e);\n });\n }", "function getPokemonName(pokemonNumber) {\n\tvar pokemonName;\n\tfor (i=0; i<pokemon.length; i++) {\n\t\tif (pokemon[i][0] == pokemonNumber) {\n\t\t\tpokemonName = pokemon[i][1];\n\t\t\treturn pokemonName;\n\t\t};\n\t};\n}", "async function mostrarPokemon(id) {\n\n const result = await databaseConnection('pokemons').where({ id: id })\n\n return result[0]\n}", "function showDetails(pokemon) {\n loadDetails(pokemon).then(function(x) {\n const {name,height,sprites, types} = x; \n showModal(name, height, sprites, types);\n });\n}", "PokemonAmostra(idP)\n {\n // console.log(idP);\n const SetPok = this.props.SetPokemon(idP);\n // this.setState({pokemonAmostra:idP}); \n }", "function getPokedex() {\n let url = \"https://webster.cs.washington.edu/pokedex/pokedex.php?pokedex=all\";\n fetch(url)\n .then(checkStatus)\n .then(fillPokedex)\n .then(getPokemon);\n }", "function pickToon(toonId)\n {\n for (i = 0; i < toons.length; i++)\n {\n if (toons[i].id == toonId)\n {\n playerHealth = toons[i].hp;\n }\n }\n }", "function pick_9_Pokemons_from_list(pokemon){\n\n\t\tfor (let i = 0; i < 9;i++){\n\t\t\tgetRandomPokemon(pokemon);\n\t\t}\n\t\t//selectRandomName();\n\t}", "function getPokemonByName(name) {\n let pokemon = name;\n fetch(`https://pokeapi.co/api/v2/pokemon/${pokemon}`)\n .then(\n function (response) {\n if (response.status !== 200) {\n console.log('Looks like there was a problem. Status Code: ' +\n response.status);\n displayError(response.status);\n return;\n }\n\n // Examine The Text In The Response\n response.json().then(function (data) {\n console.log(data);\n displayData(data);\n });\n }\n )\n .catch(function (err) {\n console.log('Fetch Error :-S', err);\n });\n}", "function puzzleIdSelect(value){\n if(value == -2){\n loadPuzzles();\n }\n getPuzzleFromState(value);\n }", "async function showSelectedPokemon() {\n\tlet pokemonFirstClass\n\n\tif(inputBox.value && (suggestions.includes(inputBox.value) || (parseInt(inputBox.value) >= 1 && parseInt(inputBox.value) <= 898))){\n\t\tawait getPokemonProps(inputBox.value)\n\n\t\tswitch (selectedPokemonData.types[0]) {\n\t\t\tcase \"grass\":\n\t\t\t\tpokemonFirstClass = \"card-grass\" \n\t\t\t\tbreak;\n\t\t\tcase \"fire\":\n\t\t\t\tpokemonFirstClass = \"card-fire\"\n\t\t\t\tbreak;\n\t\t\tcase \"water\":\n\t\t\t\tpokemonFirstClass = \"card-water\"\n\t\t\t\tbreak;\n\t\t\tcase \"poison\":\n\t\t\t\tpokemonFirstClass = \"card-poison\"\n\t\t\t\tbreak;\n\t\t\tcase \"psychic\":\n\t\t\t\tpokemonFirstClass = \"card-psychic\"\n\t\t\t\tbreak;\n\t\t\tcase \"ground\":\n\t\t\t\tpokemonFirstClass = \"card-ground\"\n\t\t\t\tbreak;\n\t\t\tcase \"electric\":\n\t\t\t\tpokemonFirstClass = \"card-electric\"\n\t\t\t\tbreak; \n\t\t\tcase \"flying\":\n\t\t\t\tpokemonFirstClass = \"card-flying\"\n\t\t\t\tbreak;\n\t\t\tcase \"ice\" :\n\t\t\t\tpokemonFirstClass = \"card-ice\"\n\t\t\t\tbreak;\n\t\t\tcase \"bug\" :\n\t\t\t\tpokemonFirstClass = \"card-bug\"\n\t\t\t\tbreak; \n\t\t\tcase \"dark\" :\n\t\t\t\tpokemonFirstClass = \"card-dark\"\n\t\t\t\tbreak; \n\t\t\tcase \"dragon\" :\n\t\t\t\tpokemonFirstClass = \"card-dragon\"\n\t\t\t\tbreak; \n\t\t\tcase \"fairy\" :\n\t\t\t\tpokemonFirstClass = \"card-fairy\"\n\t\t\t\tbreak;\n\t\t\tcase \"fighting\" :\n\t\t\t\tpokemonFirstClass = \"card-fighting\"\n\t\t\t\tbreak; \n\t\t\tcase \"ghost\" :\n\t\t\t\tpokemonFirstClass = \"card-ghost\"\n\t\t\t\tbreak; \n\t\t\tcase \"rock\" :\n\t\t\t\tpokemonFirstClass = \"card-rock\"\n\t\t\t\tbreak; \n\t\t\tcase \"steel\" :\n\t\t\t\tpokemonFirstClass = \"card-steel\"\n\t\t\t\tbreak; \n\t\t\tdefault:\n\t\t\t\tpokemonFirstClass = \"card-normal\"\n\t\t\t\tbreak;\n\t\t}\n\t\t\n let pokemonTiposTraduzido = traduzirPokemon(selectedPokemonData.types)\n\n\t\tcardsBox.innerHTML =\n\t\t`\n\t\t\t<div class=\"card-pokemon ${pokemonFirstClass}\" id=${selectedPokemonData.name}>\n\t\t\t\t<h4><strong class=\"nome\">${selectedPokemonData.name}</strong></h4>\n\t\t\t\t<img class=\"imagempokemon\" src=\"${selectedPokemonData.image}\" alt=\"imagem do ${selectedPokemonData.name}\">\n\t\t\t\t<div class=\"container\">\n\t\t\t\t\t<span class=\"code-pokemon\">#${selectedPokemonData.index}</span>\n\t\t\t\t\t<p class=\"type-pokemon\">${pokemonTiposTraduzido.join('/')}</p>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t`\n searchWrapper.classList.remove(\"active\"); //hide autocomplete box\n inputBox.value = ''\n botaoSeemore.setAttribute('hidden','hidden')\n botaoBack.removeAttribute('hidden')\n\t} else {\n\t\tcardsBox.innerHTML =\n\t\t`\n\t\t\t<div class=\"card-pokemon\">\n\t\t\t\t<h4><strong class=\"nome\">Pokemon não encontrado!</strong></h4>\n\t\t\t</div>\n\t\t`\n searchWrapper.classList.remove(\"active\"); //hide autocomplete box\n inputBox.value = ''\n botaoSeemore.setAttribute('hidden','hidden')\n botaoBack.removeAttribute('hidden')\n }\n}", "pigeon(_, { id }) {\n return Pigeon.find(id);\n }", "function loadDetails(pokemon) {\n let url = pokemon.detailsUrl;\n return fetch(url)\n .then(function (response) {\n return response.json();\n })\n .then(function (details) {\n pokemon.imageUrl = details.sprites.front_default;\n pokemon.height = details.height;\n pokemon.types = details.types;\n })\n .catch(function (e) {\n console.error(e);\n });\n }", "searchByNameOrId(searchString){\n if(!searchString || searchString.length === 0){\n this.resetState()\n this.getMorePokemon()\n return;\n }\n \n let url = \"https://pokeapi.co/api/v2/pokemon/\"+searchString.toLowerCase()+\"/\";\n \n fetch(url)\n .then(response => response.json())\n .then(data => {\n if (data) {\n var temp = [];\n temp.push(data)\n this.setState({pokemonDetails: temp})\n } \n })\n .catch((ex)=>{\n console.log(\"something went wrong\"+ex)\n this.resetState();\n this.getMorePokemon();\n })\n \n }", "function findOnePokemon(req, res, next) {\n const pokeId = req.params.id\n if(pokeId.length === 36) {\n getOnePokemon(pokeId)\n .then(pokemon => {\n res.send(pokemon)\n })\n .catch(err => next(err))\n } else {\n axios.get(`${POKEMON_LIST}${pokeId}`)\n .then(pokemon => {\n const apiTypes = []\n pokemon.data.types.forEach(e => {\n apiTypes.push({name: e.type.name})\n })\n Type.findAll()\n .then(myTypes => {\n apiTypes.forEach(type => {\n if (!type.id) {\n myTypes.forEach(e => {\n if (type.name === e.dataValues.name) {\n type.id = e.dataValues.id\n }\n })\n }\n })\n const apiPoke = {\n id: pokemon.data.id,\n name: pokemon.data.name,\n img: pokemon.data.sprites.front_default,\n hp: pokemon.data.stats[0].base_stat,\n attack: pokemon.data.stats[1].base_stat,\n defense: pokemon.data.stats[2].base_stat,\n speed: pokemon.data.stats[5].base_stat,\n height: pokemon.data.height,\n weight: pokemon.data.weight,\n types: apiTypes\n }\n return res.send(apiPoke)\n })\n })\n .catch(err => next(err))\n }\n}", "function populateSelect(pokemons) {\n // sorts the list of Pokemon by their ID\n const pokemonList = sortBy(pokemons, ['id']);\n const options = map(pokemonList, (pokemon) => {\n // pads the ID string with 0's\n let paddedId = padStart(pokemon.id.toString(), 3, '0');\n return <Picker.Item label={`${paddedId} - ${pokemon.name}`} value={pokemon.id} key={pokemon.id} />;\n });\n\n return options;\n}", "function lookupPokemon(){\n\t$(\"#myModal\").show();\n\trefreshModal();\n\tvar input = $(\"#inputHelpBlock\").val();\n\tif(isNaN(input)){\n\t\tvar pokeName = input.toLowerCase(); //Not case specific\n\t\tvar found = false; // Flag for finding a pokemon\n\n\t\tfor (var i in pokemons){\n\t\t\tif (pokemons[i].name == pokeName){\n\t\t\t\tfound = true;\n\t\t\t\tpokemonRequestData(pokemons[i].id);\n\t\t\t}\n\t\t}\n\t\tif (found == false) {\n\t\t\terrorModal();\n\t\t}\n\t}\n\n\telse if(!(isNaN(input))){\n\t\t//When the input is a number, we check if the number is valid and then perform the request to the third party api\n\t\tvar num = parseInt(input);\n\t\tif(0 <= num && num <= pokemons.length){\n\t\t\tpokemonRequestData(num);\n\t\t}\n\t\telse{\n\t\t\t//This modal is created when the input is invalid\n\t\t\terrorModal();\n\t\t}\n\t}\n\n\t$(\"#inputHelpBlock\").val(''); //Clear the search bar\n}", "function submitpokemon() {\n //Retrieve the input\n var inputpokemon = document.getElementById('inputpokemon').value;\n var inputmodifier = document.getElementById('inputmodifier').value;\n var name = inputpokemon;\n if (inputmodifier !== null && inputmodifier !== '') name = name.concat(' (').concat(inputmodifier).concat(')');\n \n //Placeholder text while the rest of the function is working\n document.getElementById('pokemonoutput').innerHTML = 'Looking up '.concat(name).concat('... (this text will stay if lookup failed)');\n \n //Get request to a page on the Wikia\n $.get(wgScript,\n {title: name,\n action: 'raw',\n ctype: 'text/plain'},\n function(data) {\n //Don't even continue if the page isn't a Pokemon page\n if (data.indexOf(\"[[Category:Pokémon]]\") == -1) return;\n \n //Parse the page for data\n var name = data.match(/name \\= [a-z\\s0-9+\\-\\(\\)]+/i);\n if (name !== null) name = name.toString().replace(\"name = \", \"\");\n \n var dex = data.match(/no \\= [0-9]+/i);\n if (dex !== null) dex = dex.toString().replace(\"no = \", \"\");\n else dex = \"000\";\n \n var type = data.match(/type \\= [a-z]+/i);\n if (type !== null) type = type.toString().replace(\"type = \", \"\");\n else {\n \t type = data.match(/type \\= \\[\\[File:Type [a-z]+\\.png\\]\\]/i);\n if (type !== null) type = type.toString().replace(\"type = [[File:Type \", \"\").replace(\".png]]\", \"\");\n else type = \"Unknown\";\n }\n \n var bp = data.match(/atk \\= [0-9]+/i);\n if (bp !== null) bp = bp.toString().replace(\"atk = \", \"\");\n else bp = \"0\";\n \n var rml = data.match(/RML \\= [0-9]+/i);\n if (rml !== null) rml = rml.toString().replace(\"RML = \", \"\");\n else rml = \"0\";\n \n var skill = data.match(/ability \\= [a-z\\s0-9+\\-]+/i);\n if (skill !== null) skill = skill.toString().replace(\"ability = \", \"\");\n else skill = \"Unknown\";\n \n var ss1 = data.match(/SS1 \\= [a-z\\s0-9+\\-]+/i);\n if (ss1 !== null) ss1 = ss1.toString().replace(\"SS1 = \", \"\");\n var ss2 = data.match(/SS2 \\= [a-z\\s0-9+\\-]+/i);\n if (ss2 !== null) ss2 = ss2.toString().replace(\"SS2 = \", \"\");\n var ss3 = data.match(/SS3 \\= [a-z\\s0-9+\\-]+/i);\n if (ss3 !== null) ss3 = ss3.toString().replace(\"SS3 = \", \"\");\n var ss4 = data.match(/SS4 \\= [a-z\\s0-9+\\-]+/i);\n if (ss4 !== null) ss4 = ss4.toString().replace(\"SS4 = \", \"\");\n \n //Construct the HTML code to inject\n var innerhtml2 = \"<div id='infobox'></div>\";\n innerhtml2 = innerhtml2 + \"<br><b>Name</b>: \" + name;\n innerhtml2 = innerhtml2 + \"<br><b>Dex No.</b>: \" + dex;\n innerhtml2 = innerhtml2 + \"<br><b>Type</b>: \" + type;\n innerhtml2 = innerhtml2 + \"<br><b>Base Power</b>: \" + bp;\n innerhtml2 = innerhtml2 + \"<br><b>RML</b>: \" + rml;\n innerhtml2 = innerhtml2 + \"<br><b>Skill</b>: \" + skill;\n if (ss1 !== null) innerhtml2 = innerhtml2 + \"<br><b>SS1</b>: \" + ss1;\n if (ss2 !== null) innerhtml2 = innerhtml2 + \"<br><b>SS2</b>: \" + ss2;\n if (ss3 !== null) innerhtml2 = innerhtml2 + \"<br><b>SS3</b>: \" + ss3;\n if (ss4 !== null) innerhtml2 = innerhtml2 + \"<br><b>SS4</b>: \" + ss4;\n \n innerhtml2 += \"<br>If the data shown here doesn't match the data shown in the Infobox above, please report it to me, thanks!\";\n \n //Inject the HTML code!\n document.getElementById('pokemonoutput').innerHTML = innerhtml2;\n \n //Update dropdown menu with pokemon's skills\n var innerhtml3 = \"<option></option><option value='\" + skill + \"'>\" + skill + \"</option>\";\n if (ss1 !== null) innerhtml3 = innerhtml3 + \"<option value='\" + ss1 + \"'>\" + ss1 + \"</option>\";\n if (ss2 !== null) innerhtml3 = innerhtml3 + \"<option value='\" + ss2 + \"'>\" + ss2 + \"</option>\";\n if (ss3 !== null) innerhtml3 = innerhtml3 + \"<option value='\" + ss3 + \"'>\" + ss3 + \"</option>\";\n if (ss4 !== null) innerhtml3 = innerhtml3 + \"<option value='\" + ss4 + \"'>\" + ss4 + \"</option>\";\n document.getElementById('dropdownskill').innerHTML = innerhtml3;\n }\n );\n \n //gonna try to parse some wikitext using javascript\n var example = \"{{Pokémon_Tooltip_v2|pokemon=\" + inputpokemon + \"|modifier=\" + inputmodifier + \"}}\";\n $.getJSON('http://pkmnshuffle.wikia.com/api.php?format=json&action=parse&text=' + example,\n function(data) {\n var innerhtml4 = data.parse.text[\"*\"];\n document.getElementById('infobox').innerHTML = innerhtml4;\n }\n );\n }", "function pokemonSearch () {\n\n fetch(`https://pokeapi.co/api/v2/?pokemon=${pokemon}`)\n .then(response => response.json)\n .then(data => (console.log('data:', data)))\n}", "async getPokemoDetail(name) {\n const response = await fetch(`https://pokeapi.co/api/v2/pokemon/${name}`)\n const detail = await response.json()\n return detail\n }", "function playerChoice(id){\n var choixJ = id.alt;\n console.log(choixJ);\n gameStart(choixJ);\n}", "function Pokemon(data) {\n \tthis.data = data;\n\n \t// init other values to nil to be safe.\n \tthis.ability = undefined;\n \tthis.moves = new Array(4);\n\n \t// autocomplete\n \tthis.generateAutocompleteList();\n }", "componentDidMount() {\n // TODO prendere l'id dalla route per recuperare il dettaglio del pokemon\n }", "function theChallenger() {\n const challenge = Math.floor(Math.random() * 150) + 1 ;\n const url = `https://pokeapi.co/api/v2/pokemon/${challenge}`;\n fetch(url)\n .then( e => {\n return e.json();\n })\n .then( data => {\n challenger = {\n id: data.id,\n name: data.name.toUpperCase(),\n image: data.sprites['front_default'],\n experience: data.base_experience,\n type: data.types.map( type => type.type.name).join(', '),\n }\n displayBattle(challenger);\n })\n \n}", "function showDetails(pokemon) {\n\t \tloadDetails(pokemon).then(function () {\n\t \tshowModal(pokemon.imageUrl, pokemon.name, pokemon.height)\n\t\t });\n\t\t}", "function namePokemon(){\n var name = $('.name').val()\n var $xhr = $.getJSON('http://pokeapi.co/api/v2/pokemon/'+name);\n $xhr.done(function(data) {\n if ($xhr.status !== 200) {\n return;\n }\n $('#result').empty()\n $('#result').append(\"<p>Pokemon: \"+data['name']+\"</p>\")\n $('#result').append(\"<p>Height: \"+data['height']+\"</p>\")\n $('#result').append(\"<p>Weight: \"+data['weight']+\"</p>\")\n $('#result').append('<img src=\"'+data['sprites']['front_default']+'\"/>')\n});\n}", "function getPokemon(pokemon) {\n return __awaiter(this, void 0, void 0, function* () {\n return axios_1.default.get(`${POKE_API}/pokemon/${pokemon}`);\n });\n}", "generatePokemon() {\r\n if (!this.props.results) {\r\n return;\r\n }\r\n\r\n return this.props.results.map((pokemon, i) => {\r\n return (\r\n <div className=\"Pokemon__card\" key={i}>\r\n <img src={`images/${pokemon.id}.png`} alt={pokemon.name} onClick={() => this.displayInfo(pokemon.id)} />\r\n <p>{pokemon.name}</p>\r\n </div>\r\n )\r\n });\r\n }", "function handlePokemon(args) {\n if (!pokedex) {\n return getPokedex().then(() => findPokemon(args));\n }\n\n return findPokemon(args);\n}", "function getPokemon(id) {\n var fetchingModelStart = performance.now();\n var url = PROXY + 'http://pokeapi.co/api/v1/pokemon/' + id + '/?_b=' + Date.now();\n return fetch(url).then(function(response) {\n fetchingModelTime = performance.now() - fetchingModelStart;\n return response.json();\n });\n}", "function pokemonImage(pokemon){\n\t// $.ajax({\n\t// \turl: \"http://pokeapi.co/api/v2/pokemon/\"+pokemon,\n\t// \tsuccess: function(response){\n\t// \t\tconsole.log(response.sprites.front_default)\n\t// \t}\n\t// })\n\treturn response.sprites.front_default\n}", "async function retornarUm(id)\n{\n const response = await axios.get( 'https://pokeapi.co/api/v2/pokemon/'+id );\n return response.data;\n}", "function loadDetails(pokemon) {\n let url = pokemon.detailsUrl;\n return fetch(url)\n .then(function (response) {\n return response.json();\n })\n .then(function (details) {\n // add details to item pokemon\n pokemon.imageUrlFront = details.sprites.front_default;\n pokemon.imageUrlBack = details.sprites.back_default;\n pokemon.height = details.height;\n pokemon.weight = details.weight;\n pokemon.height = details.height;\n pokemon.types = details.types;\n })\n .catch(function (e) {\n console.error(e);\n });\n }", "function getPokemon() {\n let allSprites = qsa('.sprite');\n for ( let i = 0; i < allSprites.length; i++) {\n allSprites[i].onclick = getCard;\n } \n }", "async getPokemonSpecies(currentPokemon) {\n return axios.get(`${Endpoints.getPokemonSpecie}/${currentPokemon}`);\n }", "function selectBulkpointMove(e){\n\t\t\t\tvar moveId = $(e.target).find(\"option:selected\").val();\n\t\t\t\tvar attacker = pokeSelectors[1].getPokemon();\n\t\t\t\tvar move = attacker.getMoveById(moveId);\n\n\t\t\t\tself.displayBulkpoints(move);\n\t\t\t}", "function getPokedex() {\n return getPokemonResource(endpoints.pokedex).then(body => {\n pokedex = body.pokemon;\n })\n}", "renderPokemon(pkmNum) {\n // Request pokemon's data\n getJSON(this.state.pkmList[pkmNum].url, false, (response) => {\n let json = response.responseJSON;\n let types = [];\n for (let i = 0; i < json.types.length; i++)\n types.push(<p key={i}>{json.types[i].type.name}</p>);\n this.setState({\n pkmShow: (\n <div className=\"screen\">\n <h1>{`#${json.id} ${capitalize(json.name)}`}</h1>\n <div className=\"column\">\n <div className=\"image-back\">\n <img src={json.sprites.front_default} alt={json.name}/>\n </div>\n {types}\n </div>\n <div className=\"column\">\n <p>Weight: {json.weight}</p>\n <p>Height: {json.height}</p>\n <p>Speed: {json.stats[0].base_stat}</p>\n <p>Special-defense: {json.stats[1].base_stat}</p>\n <p>Special-attack: {json.stats[2].base_stat}</p>\n <p>Defense: {json.stats[3].base_stat}</p>\n <p>Attack: {json.stats[4].base_stat}</p>\n <p>HP: {json.stats[5].base_stat}</p>\n </div>\n </div>\n )\n });\n });\n\n // Add a pleceholder to indicate that no response has come yet\n this.setState({\n pkmShow: (\n <div className=\"screen\">\n <p>{\"Loading...\"}</p>\n </div>\n )\n });\n }", "function goToNextPokemon(){\r\n trainer.get();// here the method will fetch and assign the pokemon data to its designated element\r\n}", "function loadDetails(pokemon) {\n toggleLoadingMessage();\n let url = pokemon.detailsUrl;\n\n return fetch(url)\n .then(function (response) {\n return response.json();\n })\n .then(function (details) {\n //Convert types to comma separated string\n let rawTypes = [];\n details.types.forEach(function (pokemon) {\n rawTypes.push(pokemon.type.name);\n });\n\n let types = rawTypes.join(', ');\n\n //Build object with additional details\n pokemon.imageUrl = details.sprites.front_default;\n pokemon.height = details.height / 10; //converted from dm to m\n pokemon.weight = details.weight / 10; //converted from hg to kg\n pokemon.types = types;\n\n //Fetch further detail from Pokemon species url\n return fetch(details.species.url);\n })\n .then(function (response) {\n return response.json();\n })\n .then(function (details) {\n //Filter for English flavor text from Pokemon Red\n const rawFlavorText = details.flavor_text_entries.filter(function (\n pEntry\n ) {\n if (pEntry.language.name === 'en' && pEntry.version.name === 'red') {\n return true;\n }\n });\n\n //Grab string and remove special characters\n const flavorText = rawFlavorText[0].flavor_text.replace(\n /[\\n\\f]+/g,\n ' '\n );\n\n //Add final details to pokemon object\n pokemon.speciesType = details.genera[7].genus;\n pokemon.flavorText = flavorText;\n\n toggleLoadingMessage();\n })\n .catch(function (e) {\n console.error(e);\n toggleLoadingMessage();\n });\n }", "function post_select_existing_value(pokemon_id, pokemon_box_id) {\n var id = pokemon_id;\n var replaced_sprite_url = sprite_url.replace(\"100001\", id.toString()).replace(\"100002\", \"2\");\n var replaced_stat_url = stat_url.replace(\"100001\", id.toString());\n var full_replaced_sprite_url = window.location.origin + replaced_sprite_url;\n var full_replaced_stat_url = window.location.origin + replaced_stat_url;\n \n // get sprite and change DOM elements\n $.get(full_replaced_sprite_url, function(data, status){\n console.log(data);\n $(\"#question_mark_\" + pokemon_box_id).hide();\n $(\"#pokemon_\" + pokemon_box_id).val(id);\n $(\"#pokemon_img_\" + pokemon_box_id).animate({\n opacity: 0\n }, 1);\n $(\"#pokemon_img_\" + pokemon_box_id).attr({\n \"src\": data,\n \"width\": \"90%\",\n \"height\": \"90%\"\n });\n $(\"#pokemon_img_\" + pokemon_box_id).animate({\n opacity: 1\n }, 1);\n });\n\n // get stat and change DOM elements\n $.get(full_replaced_stat_url, function(data, status){\n console.log(data);\n $(\"#pokemon_\" + pokemon_box_id + \"_name\").text(data.data.name);\n $(\"#pokemon_\" + pokemon_box_id + \"_hp\").text(data.data.hp);\n $(\"#pokemon_\" + pokemon_box_id + \"_attack\").text(data.data.attack);\n $(\"#pokemon_\" + pokemon_box_id + \"_defense\").text(data.data.defense);\n });\n}", "function getPokemonInfo(url) {\n fetch(url)\n .then((response) => response.json())\n .then((data) => {\n // Make sure data comes throufg\n console.log(data.abilities);\n fetch(data.species.url)\n .then((res) => res.json())\n .then((speciesData) => {\n console.log(speciesData);\n // Write data to pokemon information container\n document.querySelector(\".pokemon-info\").innerHTML = `\n <img class=\"sprite\" src=\"${data.sprites.front_default} \">\n <p>NAME: ${data.name}</p>\n <p>ABILITY: ${data.abilities[0].ability.name}</p>\n <p>${speciesData.flavor_text_entries[0].flavor_text}</p>\n `;\n });\n });\n}", "function loadCompPokemon () {\n $(\".computerPokemon\").html(compPlayer.image);\n $(\".pokemonSelector\").addClass(\"showing\");\n $(\".attackOne\").removeClass(\"notShowing\");\n $(\".attackTwo\").removeClass(\"notShowing\");\n $(\".attackThree\").removeClass(\"notShowing\");\n $(\".attackFour\").removeClass(\"notShowing\");\n $(\".attackOne\").html(compPlayer.abilities.attackOne[0]);\n $(\".attackTwo\").html(compPlayer.abilities.attackTwo[0]);\n $(\".attackThree\").html(compPlayer.abilities.attackThree[0]);\n $(\".attackFour\").html(compPlayer.abilities.attackFour[0]);\n \n}", "function userPlayer () {\n playerOne = totalPokemon[0];\n}", "function makePokemon(id,slot){\n\treturn new Pokemon(\n\t\tsys.teamPokeNum(id,0,slot),\n\t\tsys.teamPokeName(id,0,slot),\n\t\tsys.teamPokeGender(id,0,slot),\n\t\tsys.teamPokeAbility(id,0,slot),\n\t\tsys.teamPokeItem(id,0,slot),\n\t\tsys.teamPokeLevel(id,0,slot),\n\t\tmakeIVs(id,slot),\n\t\tmakeEVs(id,slot),\n\t\tmakeMovesArray(id,slot),\n\t\tsys.teamPokeNature(id,0,slot),\n\t\tsys.teamPokeShine(id,0,slot),\n\t\tsys.teamPokeHappiness(id,0,slot)\n\t\t);\n}", "function showDetails(pokemon) {\n\t\t\tloadDetails(pokemon).then(function () {\n\t\t\tshowModal(pokemon);\n\t\t\t});\n\t\t}", "function showDetails(pokemon) {\n loadDetails(pokemon).then(function () {\n showModal(pokemon);\n });\n }", "function showDetails(pokemon) {\n loadDetails(pokemon).then(function () {\n showModal(pokemon);\n });\n }", "function showDetails(pokemon) {\n loadDetails(pokemon).then(function () {\n showModal(pokemon);\n });\n }", "function displayPokemon(data) {\n $('.pokemon-list').empty();\n $.each(data.results, function (i) {\n let pokemonID = offset * amount + i + 1;\n $('.pokemon-list').append(`<div class=\"pokemon-container\" id=\"${pokemonID}\"></div>`);\n $(`#${pokemonID}`).append(`<p>${pokemonID}. ${firstLetterUppercase(data.results[i].name)}</p>`);\n $(`#${pokemonID}`).append(`<img src=\"https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/${pokemonID}.png\">`);\n });\n }", "function displayYourPokemonMoves(pokemon) {\n // for (i = 0; i < pokemon.moves.length; i++) { \n // console.log(pokemon.moves[i].move.name); \n // }\n yourPokemonMoves = pokemon.moves.map((move) => {\n return move.move\n })\n moves = pokemon.moves.map((move) => {\n return move.move.name\n })\n moves.forEach((move) => {\n $('.pokemon-moves-selector-grid').append(\n `<div class=\"grid-your-pokemon-moves\" id=\"${move}\">\n <button class=\"move-button\"><p>${move}</p></button>\n </div>`)\n })\n enableStartBtn();\n }" ]
[ "0.72742873", "0.7253365", "0.70022404", "0.6821616", "0.6810767", "0.6702614", "0.6625099", "0.66118515", "0.6602848", "0.6578707", "0.6537803", "0.65052617", "0.6449666", "0.6418976", "0.63821214", "0.6327388", "0.63068396", "0.6293729", "0.62796247", "0.6254027", "0.6252242", "0.624298", "0.6228901", "0.622324", "0.62034255", "0.61933", "0.6191981", "0.6171022", "0.61698186", "0.6139548", "0.61381656", "0.6128314", "0.6118895", "0.61155427", "0.6109097", "0.61066073", "0.6073926", "0.60573125", "0.6047242", "0.60328376", "0.60322714", "0.60315496", "0.6024312", "0.6010169", "0.60042137", "0.6003483", "0.5989816", "0.5963725", "0.59506667", "0.5924982", "0.58946973", "0.58756524", "0.58666575", "0.5864085", "0.5858754", "0.5857144", "0.5851071", "0.5843936", "0.5840131", "0.5835997", "0.5835958", "0.58288896", "0.5824681", "0.5822922", "0.5821642", "0.58190894", "0.58042365", "0.5800043", "0.57982236", "0.57824796", "0.57513684", "0.57480174", "0.5747979", "0.574724", "0.57435095", "0.5742692", "0.5742163", "0.5741366", "0.5739408", "0.5738296", "0.5736631", "0.5735246", "0.57264674", "0.5724708", "0.5710656", "0.571004", "0.57057357", "0.5704553", "0.5704216", "0.5703723", "0.569471", "0.56933516", "0.56907177", "0.56904674", "0.56857556", "0.568352", "0.5678071", "0.5678071", "0.5678071", "0.56770176", "0.5676278" ]
0.0
-1
Capitalize function n = name
function capitalize(n) { return n.charAt(0).toUpperCase() + n.substr(1, n.length).toLowerCase(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function myFunction(param) {\n capitalize('Testing');\n}", "function upperCase(name){\n\n}", "function capital(name){\n n = name.toUpperCase()\n console.log(n)\n}", "function nombreEnMayuscula(n){\n n = n.toUpperCase()\n console.log(n)\n}", "function i(e){return e[0].toUpperCase()+e.substr(1)}", "function n(t){if(\"string\"!==typeof t)throw new TypeError(\"expected a string.\");return t=t.replace(/([A-Z])/g,\" $1\"),1===t.length?t.toUpperCase():(t=t.replace(/^[\\W_]+|[\\W_]+$/g,\"\").toLowerCase(),t=t.charAt(0).toUpperCase()+t.slice(1),t.replace(/[\\W_]+(\\w|$)/g,(function(t,e){return e.toUpperCase()})))}", "static capitalize(){\r\n \r\n }", "function n(e){if(\"string\"!=typeof e)throw new TypeError(\"expected a string.\");return e=e.replace(/([A-Z])/g,\" $1\"),1===e.length?e.toUpperCase():(e=e.replace(/^[\\W_]+|[\\W_]+$/g,\"\").toLowerCase(),e=e.charAt(0).toUpperCase()+e.slice(1),e.replace(/[\\W_]+(\\w|$)/g,function(e,t){return t.toUpperCase()}))}", "function n(e){if(\"string\"!=typeof e)throw new TypeError(\"expected a string.\");return e=e.replace(/([A-Z])/g,\" $1\"),1===e.length?e.toUpperCase():(e=e.replace(/^[\\W_]+|[\\W_]+$/g,\"\").toLowerCase(),e=e.charAt(0).toUpperCase()+e.slice(1),e.replace(/[\\W_]+(\\w|$)/g,function(e,t){return t.toUpperCase()}))}", "function n(e){if(\"string\"!=typeof e)throw new TypeError(\"expected a string.\");return e=e.replace(/([A-Z])/g,\" $1\"),1===e.length?e.toUpperCase():(e=e.replace(/^[\\W_]+|[\\W_]+$/g,\"\").toLowerCase(),e=e.charAt(0).toUpperCase()+e.slice(1),e.replace(/[\\W_]+(\\w|$)/g,function(e,t){return t.toUpperCase()}))}", "function n(e){if(\"string\"!=typeof e)throw new TypeError(\"expected a string.\");return e=e.replace(/([A-Z])/g,\" $1\"),1===e.length?e.toUpperCase():(e=e.replace(/^[\\W_]+|[\\W_]+$/g,\"\").toLowerCase(),e=e.charAt(0).toUpperCase()+e.slice(1),e.replace(/[\\W_]+(\\w|$)/g,function(e,t){return t.toUpperCase()}))}", "function n(e){if(\"string\"!=typeof e)throw new TypeError(\"expected a string.\");return e=e.replace(/([A-Z])/g,\" $1\"),1===e.length?e.toUpperCase():(e=e.replace(/^[\\W_]+|[\\W_]+$/g,\"\").toLowerCase(),e=e.charAt(0).toUpperCase()+e.slice(1),e.replace(/[\\W_]+(\\w|$)/g,function(e,t){return t.toUpperCase()}))}", "function n(e){if(\"string\"!=typeof e)throw new TypeError(\"expected a string.\");return e=e.replace(/([A-Z])/g,\" $1\"),1===e.length?e.toUpperCase():(e=e.replace(/^[\\W_]+|[\\W_]+$/g,\"\").toLowerCase(),e=e.charAt(0).toUpperCase()+e.slice(1),e.replace(/[\\W_]+(\\w|$)/g,function(e,t){return t.toUpperCase()}))}", "function name() {}", "function capitalize(str) {}", "function camelCase(name){return name.charAt(0).toUpperCase()+name.slice(1).replace(/-(\\w)/g,function(m,n){return n.toUpperCase();});}", "function n(e) {\n if (\"string\" != typeof e) throw new TypeError(\"expected a string.\");\n return e = e.replace(/([A-Z])/g, \" $1\"), 1 === e.length ? e.toUpperCase() : (e = e.replace(/^[\\W_]+|[\\W_]+$/g, \"\").toLowerCase(), e = e.charAt(0).toUpperCase() + e.slice(1), e.replace(/[\\W_]+(\\w|$)/g, function(e, t) {\n return t.toUpperCase()\n }))\n }", "static capitalize(name){\n return name.charAt(0).toUpperCase() + name.slice(1);\n }", "function fcamelCase( all, letter ) {\n return letter.toUpperCase();\n }", "function camelize (name) {\n return name.replace(/_(.)/g, (m, p1) => p1.toUpperCase());\n }", "function fcamelCase( all, letter ) {\n return letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\r\n\treturn letter.toUpperCase();\r\n}", "function caps(a) {return a.substring(0,1).toUpperCase() + a.substring(1,a.length);}", "function name (string){\n return string.charAt(0).toUpperCase() + string.slice(1); \n}", "function capitalize(name) {\n return name.substring(0, 1).toUpperCase() + name.substring(1);\n}", "function imprimirConOperador(nombre){\n console.log(nombre.toUpperCase());\n}", "function camelCase(name) { return name.replace(/-([a-z])/g,camelCase_replace); }", "function typeNameToFuncName(typeName) {\n var parts = typeName.split('_');\n return parts.map(function (part, i) {\n if (i !== 0 && part.length) return part.charAt(0).toUpperCase() + part.slice(1).toLowerCase();else return part.toLowerCase();\n }).join('');\n}", "function thunk(str){return str.replace(/-/g,'_').toUpperCase();}", "function titleCases(arg){\n return arg.charAt(0).toUpperCase() + arg.substring(1);\n }", "function capitalizeName (name) {\n console.log(name[0].toUpperCase() + name.slice(1))\n}", "function capitalize(name) {\n let capInitial = name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();\n console.log(capInitial);\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}", "function fcamelCase( all, letter ) {\n\treturn letter.toUpperCase();\n}" ]
[ "0.75649446", "0.73954946", "0.73112375", "0.7252557", "0.72145677", "0.720601", "0.71679586", "0.7144461", "0.7144461", "0.7144461", "0.7144461", "0.7144461", "0.7144461", "0.7124353", "0.70525235", "0.6973834", "0.6951299", "0.692303", "0.6825257", "0.6794007", "0.67721957", "0.6764584", "0.67539084", "0.674585", "0.67337215", "0.6732664", "0.6716522", "0.6707987", "0.6690723", "0.668339", "0.6683143", "0.6659675", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346", "0.664346" ]
0.7267803
3
Funciones que devuelven promesas
function conArroz(plato) { return new Promise((resolve, reject) => { resolve(plato + ' arroz'); // reject(new Error('no queda ajo')); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function principal() {\n choquecuerpo();\n choquepared();\n dibujar();\n movimiento();\n \n if(cabeza.choque (comida)){\n comida.colocar();\n cabeza.meter();\n } \n}", "function esquiver() \n{\n //Cas spéciaux : Mort, ou pas d'ennemi\n if (presenceEnnemi === 666){\n dialogBox(\"Eh me saoule pas là relance le jeu ou casse toi connard J'AI AUTRE CHOSE A FOUTRE LA.\")\n \n }else if(presenceEnnemi ===0){ \n dialogBox(\"Tu donnes l'impression de danser sur les chemins, c'est mignon mais ça va pas t'aider.\")\n }\n \n //PROCEDURE HABITUELLE\n else if (presenceEnnemi = 1, tourJoueur(tour)=== true){\n var Min= Number(personnage.esquive - 5)\n var Max= Number(personnage.esquive + 15)\n var Miin = Number(1)\n var Maax = Number(100)\n function getRndInterger(min, max) {\n return Math.floor(Math.random() * (max - min + 1) ) + min;}\n\njetEsquive = getRndInterger(Min, Max);\nvaleurEsquive = getRndInterger(Miin, Maax);\nconsole.log(\"jetEsquive du joueur : \"+jetEsquive+\" et la valeur minimale à avoir était \"+valeurEsquive);\n //Esquive réussie\n if (jetEsquive >= valeurEsquive){\n actionPerso = 2;\n } \n //Echec de l'esquive\n else if (jetEsquive < valeurEsquive){\n actionPerso = 3;\n }\nreactionEnnemi();\nresetSpecial();\n }\n \n}", "function mostraNotas(){}", "efficacitePompes(){\n\n }", "function verificaPontuacao(){\r\n if (escolha1 != escolha2) {\r\n window.setTimeout(function(){\r\n virarCarta(posicao1,false)\r\n virarCarta(posicao2,false)\r\n },500) // tempo para ver cartas erradas\r\n\r\n if (doisJogadores)\r\n jogador++ // se errou, troca o jogador\r\n \r\n } else if (doisJogadores) \r\n pontuaJogador(jogador%2 != 0)\r\n else if (++pontuacao1 == (select2.value*select2.value/2)) {\r\n pontuacao1 = 0\r\n pararCronometro()\r\n btnNovo.removeAttribute(\"hidden\")\r\n }\r\n}", "function accion(boton){\n\tvar id = boton.id;\n\tvar selfEncuesta;\n\tvar selfPregunta;\n\tvar selfRespuesta;\n\tvar selfValor;\n\tfor (var i = 0; i < encuestas.length; i++){\n\t\tif ($(boton).attr(\"data-idEncuesta\") == encuestas[i].id){\n\t\t\tselfEncuesta = encuestas[i];\n\t\t\tfor (var j = 0; j < encuestas[i].preguntas.length; j++) {\n\t\t\t\tif ($(boton).attr(\"data-idQuestion\") == encuestas[i].preguntas[j].id_pregunta) {\n\t\t\t\t\tselfPregunta = encuestas[i].preguntas[j];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor (var h = 0; h < selfPregunta.respuestas.length; h++){\n\t\tif ($(boton).attr(\"data-idResponse\") == selfPregunta.respuestas[h].id_respuesta) {\n\t\t\tselfRespuesta = selfPregunta.respuestas[h];\n\t\t}\n\t}\n\n\tselfValor = selfRespuesta.valor;\n\tsetPuntuacion(selfValor);\n\tlimpiarSalida();\n\t// si el numero de preguntas impresas es igual al total de preguntas de esa encuesta, sacamos el resultado\n\tif (this.printed == encuestas[this.pos].preguntas.length){\n\t\timprimirSolucion(this.pos);\n\t} else {\n\t\timprimirPreguntas(getEPos(), this.pos, getPPos());\t\n\t}\n}", "function pintarActividades(pListaActividades){ //aqui repintamos la lista completa\n seccionActividades.innerHTML = \"\"; //aqui estoy borrando todas actividades antes pintadas para que se muestren las que pinto ahora\n\n if(pListaActividades.length !=0) {\n pListaActividades.forEach( actividad => { //aqui estamos recorriendo los elementos de la lista para ver cual cumple lo que buscamos\n pintarActividad(actividad); //aqui reutilizamos la funcion pintarActividad que se encuentra en la linea 133\n })\n\n } else{\n seccionActividades.innerHTML = \"<h2>No hay registros con esas condiciones</h2>\" \n }\n}", "function reglaRebajaPrecios(){\n if(producto.super_avance.sellIn = 0)\n {\n precio_SuperAvance - 2;\n\n if(producto.fc_superduper.sellIn = 0){\n precio_FullSuperDuper - 2;\n\n if(producto.f_cobertura.sellIn = 0){\n precio_FullCobertura - 2;\n }\n }\n }else{\n }\n}", "function proximo_mes(){\n if(mes_actual!=10){\n mes_actual++;\n }else{\n mes_actual=0;\n año_actual++;\n }\n dibujar_fecha();\n escribir_mes();\n escogerdia1();\n escogerdia2();\n}", "function MetodoCruzamento(){\n //Nivel+1 para sabermos que não são os pais, e um o fruto de um cruzamento do nivel 1.\n\tNivel++;\n\tswitch(MetodoCruzamen){\n\t\tcase 1:\n\t\t\tKillError(\"-s [1:Não definido,2]\");\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tconsole.log(\"Cruzamento em andamento!\");\n\t\t\tconsole.log(\"- Crossover PMX\");\n\t\t\tconsole.log(\"- - Geração: \"+Geracao);\n\t\t\tif(Torneio==1){\n\t\t\t\tconsole.log(\"- - - Torneio\");\n\t\t\t}else{\n\t\t\t\tconsole.log(\"- - - Roleta\");\n\t\t\t}\n\t\t\twhile(Geracao>=0){\n\t\t\t\tCrossover_PMX();\n\t\t\t\tGeracao=Geracao-1;\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tKillError(\"-s [1,2]\");\n\t}\n\tQualidadeCheck();\n}", "function chequeo(){\n \n contador(preguntas);\n\n if(palabrasTotales == 27){\n final = true;\n alert('No quedan mas letras en el abecedario. :(');\n } else {\n proxturno = confirm('Desea seguir con la siguiente ronda?');\n }\n\n if(proxturno == false){ \n final = true;\n }\n }", "verificaDados(){\n this.verificaEndereco();\n if(!this.verificaVazio()) this.criaMensagem('Campo vazio detectado', true);\n if(!this.verificaIdade()) this.criaMensagem('Proibido cadastro de menores de idade', true);\n if(!this.verificaCpf()) this.criaMensagem('Cpf deve ser válido', true);\n if(!this.verificaUsuario()) this.criaMensagem('Nome de usuario deve respeitar regras acima', true);\n if(!this.verificaSenhas()) this.criaMensagem('Senha deve ter os critérios acima', true)\n else{\n this.criaMensagem();\n // this.formulario.submit();\n }\n }", "function promedioPorcentaje(democrats, republicans, independents) {\n app.statistics.votesWithPartyD = promedio(democrats);\n app.statistics.votesWithPartyR = promedio(republicans);\n app.statistics.votesWithPartyI = promedio(independents);\n}", "function irAAgregarMaestro(){\r\n\tvar msg = \"Desea Agregar un NUEVO REGISTRO?.. \";\r\n\tif(confirm(msg)) Cons_maestro(\"\", \"agregar\",tabla,titulo);\r\n}", "function verificarMontos(metodo) {\n if (metodo == 1) {\n //MontoEfe, MontoDolares\n var montoEfectivo = parseFloat($('#efectivo input#MontoEfe').val());\n var montoDolares = parseFloat($('#efectivo input#MontoDolares').val());\n var tipoCambio = parseFloat($('#tipoCambioMoneda').val());\n var montoPagar = parseFloat($('#efectivo input#MontoPagar').val());\n if (montoEfectivo + montoDolares * tipoCambio >= montoPagar) {\n return true;\n }\n alert(\"Monto en dolares y soles son menores que el monto a pagar\");\n return false;\n }\n if (metodo == 3) {\n //MontoEfe, MontoDolares\n var montoEfectivo = parseFloat($('#mixto input#MontoEfe').val());\n var montoDolares = parseFloat($('#mixto input#MontoDolares').val());\n var tarjeta = parseFloat($('#mixto input#MontoTar').val());\n var tipoCambio = parseFloat($('#tipoCambioMoneda').val());\n var montoPagar = parseFloat($('#mixto input#MontoPagar').val());\n if (tarjeta + montoEfectivo + montoDolares * tipoCambio >= montoPagar) {\n return true;\n }\n alert(\"Monto en dolares y soles son menores que el monto a pagar\");\n return false;\n }\n return true;\n}", "function limpiarCapas(){\n limpiarCapaRecorridos();\n limpiarCapaParadas();\n limpiarCapaNuevaRuta();\n limpiarCapturaNuevaRuta();\n limpiarCapaEstudiantes();\n}", "function infoGastosEnvio(){\n let compruebaPrime = true;\n for (propiedades in carrito){\n compruebaPrime = compruebaPrime && carrito[propiedades].premium;\n }\n let gastosInfo = compruebaPrime ? infoEnvio2 : infoEnvio1;\n return gastosInfo;\n}", "function falso(){\n\tif(cont==2||cont==3||cont==5||cont==6||cont==7||cont==8||cont==10||cont==11||cont==13||cont==17||cont==19){\n\t\talert(\"ESA ES MI CHICA! CORRECTO\");\n\t\tpuntos = puntos + 1;\n\t}else{\n\t\talert(\"MALA NOVIA!!! ERROR\");\n\t}\n\tconsole.log(puntos);\n\tcambiarPagina();\n}", "async function testePionJouable(i, j, login, hote, adversaire){\n \n // si le client est l'adversaire, c'est le blanc\n if(login===adversaire){\n \n let pionIJ=await getPion(i, j, hote, adversaire);\n \n if ((pionIJ===PION_BLANC)||(pionIJ===DAME_BLANC)){\n // pion haut droit\n if ((j<9)&&(i>0)){\n let pion1 = await getPion(i-1, j+1, hote, adversaire);\n if(pion1!=null){\n if(pion1===SANS_PION) return true;\n }\n }\n \n // pion haut gauche\n if ((j>0)&&(i>0)){\n let pion2 = await getPion(i-1, j-1, hote, adversaire);\n if(pion2!=null){\n if(pion2===SANS_PION) return true;\n }\n }\n \n // pion haut droit mangeable\n if ((j<8)&&(i>1)){\n let pion3, pion4;\n pion3 = await getPion(i-2, j+2, hote, adversaire);\n pion4 = await getPion(i-1, j+1, hote, adversaire); \n if ((pion3!=null)&&(pion4!=null)){\n if ((pion3===SANS_PION)&&(pion4===PION_NOIR)) return true;\n }\n }\n \n // pion haut gauche mangeable\n if ((j>1)&&(i>1)){\n let pion5, pion6;\n pion5 = await getPion(i-2, j-2, hote, adversaire);\n pion6 = await getPion(i-1, j-1, hote, adversaire); \n if((pion5===SANS_PION)&&(pion6===PION_NOIR)) return true;\n }\n \n // pion haut droit mangeable\n if ((j<8)&&(i>1)){\n let pion7, pion8;\n pion7 = await getPion(i-2, j+2, hote, adversaire);\n pion8 = await getPion(i-1, j+1, hote, adversaire);\n if ((pion7===SANS_PION)&&(pion8===DAME_NOIR)) return true;\n }\n \n // pion haut gauche mangeable\n if ((j>1)&&(i>1)){\n let pion9, pion10;\n pion9 = await getPion(i-2, j-2, hote, adversaire);\n pion10 = await getPion(i-1, j-1, hote, adversaire);\n if((pion9===SANS_PION)&&(pion10===DAME_NOIR)) return true;\n }\n \n // si c'est une dame (deplacement ou on veut)\n if (pionIJ===DAME_BLANC){\n // pion bas droit\n if ((j<9)&&(i<9)){\n let pion11 = await getPion(i+1, j+1, hote, adversaire);\n if (pion11===SANS_PION) return true; \n }\n \n // pion bas gauche\n if ((j>0)&&(i<9)){\n let pion12 = await getPion(i+1, j-1, hote, adversaire);\n if (pion12===SANS_PION) return true;\n }\n \n // pion bas droit mangeable\n if ((j<8)&&(i<8)){\n let pion13 = await getPion(i+1, j+1, hote, adversaire);\n let pion14 = await getPion(i+2, j+2, hote, adversaire);\n if((pion13===PION_NOIR)&&(pion14===SANS_PION)) return true;\n }\n \n // pion bas gauche mangeable\n if ((j>1)&&(i<8)){\n let pion15 = await getPion(i+1, j-1, hote, adversaire);\n let pion16 = await getPion(i+2, j-2, hote, adversaire); \n if((pion15===PION_NOIR)&&(pion16===SANS_PION)) return true;\n }\n \n // dame bas droit mangeable\n if ((j<8)&&(i<8)){\n let pion17 = await getPion(i+1, j+1, hote, adversaire);\n let pion18 = await getPion(i+2, j+2, hote, adversaire);\n if ((pion17==DAME_NOIR)&&(pion18===SANS_PION)) return true;\n }\n \n // dame bas gauche mangeable\n if ((j>1)&&(i<8)){\n let pion19 = await getPion(i+1, j-1, hote, adversaire);\n let pion20 = await getPion(i+2, j-2, hote, adversaire);\n if((pion19===DAME_NOIR)&&(pion20===SANS_PION)) return true;\n }\n }\n }\n }\n \n // si le client est l'hote, cest le pion noir\n if(login===hote){\n \n let pionIJ=await getPion(i, j, hote, adversaire);\n \n if((pionIJ===PION_NOIR)||(pionIJ===DAME_NOIR)){\n // pion bas droit\n if ((j<9)&&(i<9)){\n let pion1 = await getPion(i+1, j+1, hote, adversaire);\n if(pion1===SANS_PION) return true;\n }\n \n // pion bas gauche\n if ((j>0)&&(i<9)){\n let pion2 = await getPion(i+1, j-1, hote, adversaire);\n if(pion2===SANS_PION) return true;\n }\n \n // pion bas droit mangeable\n if ((j<8)&&(i<8)){\n let pion3 = await getPion(i+1, j+1, hote, adversaire);\n let pion4 = await getPion(i+2, j+2, hote, adversaire);\n if((pion3===PION_BLANC)&&(pion4===SANS_PION)) return true;\n }\n \n // pion bas gauche mangeable\n if ((j>1)&&(i<8)){\n let pion5 = await getPion(i+1, j-1, hote, adversaire);\n let pion6 = await getPion(i+2, j-2, hote, adversaire);\n if((pion5===PION_BLANC)&&(pion6===SANS_PION)) return true;\n }\n \n // dame bas droit mangeable\n if ((j<8)&&(i<8)){\n let pion7 = await getPion(i+1, j+1, hote, adversaire);\n let pion8 = await getPion(i+2, j+2, hote, adversaire);\n if((pion7===DAME_BLANC)&&(pion8===SANS_PION)) return true;\n }\n \n // dame bas gauche mangeable\n if ((j>1)&&(i<8)){\n let pion9 = await getPion(i+1, j-1, hote, adversaire);\n let pion10 = await getPion(i+2, j-2, hote, adversaire);\n if((pion9===DAME_BLANC)&&(pion10===SANS_PION)) return true;\n }\n \n // si c'est une dame (deplacement ou on veut)\n if (pionIJ===DAME_NOIR){\n // pion haut droit\n if ((j<9)&&(i>0)){\n let pion11 = await getPion(i-1, j+1, hote, adversaire);\n if (pion11===SANS_PION) return true;\n }\n \n // pion haut gauche\n if ((j>0)&&(i>0)){\n let pion12 = await getPion(i-1, j-1, hote, adversaire);\n if (pion12===SANS_PION) return true;\n }\n \n // pion haut droit mangeable\n if ((j<8)&&(i>1)){\n let pion13 = await getPion(i-2, j+2, hote, adversaire);\n let pion14 = await getPion(i-1, j+1, hote, adversaire);\n if((pion13===SANS_PION)&&(pion14===PION_BLANC)) return true;\n }\n \n // pion haut gauche mangeable\n if ((j>1)&&(i>1)){\n let pion15 = await getPion(i-2, j-2, hote, adversaire);\n let pion16 = await getPion(i-1, j-1, hote, adversaire);\n if ((pion15===SANS_PION)&&(pion16===PION_BLANC)) return true;\n }\n \n // dame haut droit mangeable\n if ((j<8)&&(i>1)){\n let pion17 = await getPion(i-2, j+2, hote, adversaire);\n let pion18 = await getPion(i-1, j+1, hote, adversaire);\n if((pion17===SANS_PION)&&(pion18===DAME_BLANC)) return true;\n }\n \n // dame haut gauche mangeable\n if ((j>1)&&(i>1)){\n let pion19 = await getPion(i-2, j-2, hote, adversaire);\n let pion20 = await getPion(i-1, j-1, hote, adversaire);\n if((pion19===SANS_PION)&&(pion20===DAME_BLANC)) return true;\n }\n }\n }\n }\n \n return false;\n}", "function _DependenciasProficienciaArmas() {\n var todas_simples = false;\n var todas_comuns = false;\n gPersonagem.proficiencia_armas = {};\n for (var i = 0; i < gPersonagem.classes.length; ++i) {\n var chave_classe = gPersonagem.classes[i].classe;\n var tabela_classe = tabelas_classes[chave_classe];\n var armas_classe = tabela_classe.proficiencia_armas || [];\n for (var j = 0; j < armas_classe.length; ++j) {\n gPersonagem.proficiencia_armas[armas_classe[j]] = true;\n if (armas_classe[j] == 'arco_curto' || armas_classe[j] == 'arco_longo') {\n for (var arma_tabela in tabelas_armas_comuns) {\n if (arma_tabela.indexOf(armas_classe[j]) == 0) {\n gPersonagem.proficiencia_armas[arma_tabela] = true;\n } \n }\n }\n }\n // TODO usar a nova funcao de PersonagemProficienteTipoArma.\n var talentos_classe = tabela_classe.talentos || [];\n for (var j = 0; j < talentos_classe.length; ++j) {\n if (talentos_classe[j] == 'usar_armas_simples') {\n todas_simples = true;\n } else if (talentos_classe[j] == 'usar_armas_comuns') {\n todas_comuns = true;\n }\n }\n }\n gPersonagem.proficiencia_armas['desarmado'] = true;\n gPersonagem.proficiencia_armas['manopla'] = true;\n if (todas_simples) {\n for (var arma in tabelas_armas_simples) {\n gPersonagem.proficiencia_armas[arma] = true;\n }\n }\n if (todas_comuns) {\n for (var arma in tabelas_armas_comuns) {\n gPersonagem.proficiencia_armas[arma] = true;\n }\n // Familiaridade.\n for (var arma in tabelas_raca[gPersonagem.raca].familiaridade_arma) {\n gPersonagem.proficiencia_armas[arma] = true;\n }\n }\n // Raciais.\n var armas_raca = tabelas_raca[gPersonagem.raca].proficiencia_armas;\n for (var i = 0; armas_raca != null && i < armas_raca.length; ++i) {\n gPersonagem.proficiencia_armas[armas_raca[i]] = true;\n }\n\n // Talentos. Preciso obter o nome da chave na tabela de armas.\n for (var chave_classe in gPersonagem.talentos) {\n var lista_classe = gPersonagem.talentos[chave_classe];\n for (var i = 0; i < lista_classe.length; ++i) {\n var talento = lista_classe[i];\n if ((talento.chave == 'usar_arma_comum' ||\n talento.chave == 'usar_arma_exotica') &&\n (talento.complemento != null) &&\n talento.complemento.length > 0) {\n var chave_arma = tabelas_armas_invertida[talento.complemento];\n // TODO remover essa verificacao quando o input dos talentos estiver\n // terminado.\n if (chave_arma == null) {\n Mensagem(Traduz('Arma') + ' \"' + talento.complemento + '\" ' + Traduz('inválida para talento') + ' \"' +\n Traduz(tabelas_talentos[talento.chave].nome) + '\"');\n continue;\n }\n var arma_tabela = tabelas_armas[chave_arma];\n if (arma_tabela.talento_relacionado != talento.chave) {\n // verifica familiaridade.\n var familiar = false;\n if (arma_tabela.talento_relacionado == 'usar_arma_exotica' &&\n tabelas_raca[gPersonagem.raca].familiaridade_arma &&\n tabelas_raca[gPersonagem.raca].familiaridade_arma[chave_arma] &&\n talento.chave == 'usar_arma_comum') {\n familiar = true;\n }\n if (!familiar) {\n Mensagem(Traduz('Arma') + ' \"' + talento.complemento + '\" ' + Traduz('inválida para talento') + ' \"' +\n Traduz(tabelas_talentos[talento.chave].nome) + '\"');\n continue;\n }\n }\n gPersonagem.proficiencia_armas[chave_arma] = true;\n }\n }\n }\n}", "function ActualizarParametrosRecibidor(Parametros,ParametrosTresHoras,flgPrimeraVez)\n{\n\tconsole.log(\"ActualizarParametrosRecibidor\\n\");\n\tActualizarFooter(Parametros);\n\tvar objeto;\n\tfor (x=0;x<tabla_objetos.length;x++)\n\t{\n\t\tobjeto=tabla_objetos[x];\n\t\tobjeto.ProcesaDatos(Parametros,ParametrosTresHoras,flgPrimeraVez);\n\t\t\n\t}\n}", "function partida(){\n if (contadorUser >= nRondas || contadorPc >= nRondas){\n //declarar ganador \n openWinner()\n \n } \n}", "function NotaFinal() {\r\n var cbounoa = document.getElementById(\"cbounoa\").value;\r\n var cbounob = document.getElementById(\"cbounob\").value;\r\n var cbounoc = document.getElementById(\"cbounoc\").value;\r\n var cbounod = document.getElementById(\"cbounod\").value;\r\n var cbounoe = document.getElementById(\"cbounoe\").value;\r\n var cbounof = document.getElementById(\"cbounof\").value;\r\n if (\r\n cbounoa == \"1\" ||\r\n cbounob == \"1\" ||\r\n cbounoc == \"1\" ||\r\n cbounod == \"1\" ||\r\n cbounoe == \"1\" ||\r\n cbounof == \"1\"\r\n ) {\r\n alert(\"Pregunta 1: Seleccione todas las respuestas posibles\");\r\n } else {\r\n var pre5a = document.getElementById(\"pre5a\").value;\r\n if (pre5a == \"\") {\r\n alert(\"Pregunta 5: Califiqué la pregunta\");\r\n } else {\r\n var pre6a = document.getElementById(\"pre6a\").value;\r\n if (pre6a == \"\") {\r\n alert(\"Pregunta 6: Califiqué la pregunta\");\r\n } else {\r\n pregunta1();\r\n pregunta2();\r\n pregunta3();\r\n pregunta4();\r\n pregunta5();\r\n pregunta6();\r\n pregunta7();\r\n var Nf = parseFloat(tpre1) + parseFloat(tpre2) + parseFloat(tpre3) + parseFloat(tpre4) + parseFloat(tpre5) + parseFloat(tpre6) + parseFloat(tpre7);\r\n var Vtotal = Nf.toFixed(2);\r\n $(\"#txtNota\").html(Vtotal);\r\n document.getElementById(\"bt_comprobar\").disabled = true;\r\n }\r\n }\r\n }\r\n}", "function procesar(tipo){\n\t\n\tif(tipo==\"saludo\"){\n\t\ttexto=\"Bienvenido, digite la URL y presione enter. Para detener audio, presione chift, más, dé\";\n\t\thablar();\n\t}else if(tipo==\"procesando\"){\n\t\tpararHablar();\n\t\thablar(\"Procesando\");\n\t}else if(tipo==\"finarticulo\"){\n\t\thablar(\"Artículo finalizado, presione chift, más, ene para digitar una url nueva o presione chift, más, ese, para leer los enlaces\");\t\t\t\t\n\t}else if(tipo==\"nueva\"){\n\t\thablar(\"digite una url nueva.\");\n\t}else if(tipo==\"ayuda\"){\n\t\thablar(\"Chift, más, déé, detener audio completamente.\");\n\t\thablar(\"Chift, más, espacio, pausar y continuar audio.\");\n\t\thablar(\"Chift, más, ene, ingresar nueva url.\");\n\t\thablar(\"Chift, más, ese, leer enlaces.\");\n\t\thablar(\"Para navegar entre enlaces, flecha arriba y flecha abajo\");\n\t\thablar(\"Chift, más, áá, leer artículo.\");\n\t\thablar(\"Chift, más, cé, escribir comentario.\");\n\n\t}else if(tipo==\"procesado\"){\n\t\thablar(\"Presione, chift, más, áá, para leer el artículo, chift, más, ese, para leer los enlaces\");\n\t}else if(tipo==\"comentar\"){\n\t\thablar(\"Digite el comentario y presione, chift, más, énter para enviarlo.\");\n\t}else if(tipo==\"enlaces\"){\n\t\thablar(\"Presione flechas abajo o arriba para navegar entre los enlaces disponibles\");\n\t}else if(tipo==\"noenlaces\"){\n\t\thablar(\"No hay enlaces disponibles, presione chift, más, áá, para leer el artículo\");\t\t\t\t\n\t}else if(tipo==\"noarticulo\"){\n\t\thablar(\"No hay artículos disponibles, digite una url nueva\");\n\t\t$('input[name=campoBuscar]').val(\"\");\n\t\t$('input[name=campoBuscar]').focus();\n\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\n}", "function leerSiPulsadoresActivados() {\n /**\n * Simular pulsador en intro_cotas\n */\n let b_i_c = cogerVariable(\"./variables/intro_cotas.html\");\n if (b_i_c == 1) {\n //volver a poner el boton en false porque es un pulsador\n $(\"#boton_intro_cotas\").val(\"0\");\n\n $('#boton_cota').css(\"background-color\",\"white\");\n $('#boton_parada').css(\"background-color\",\"white\");\n $('#boton_cota').removeAttr(\"disabled\");\n $('#boton_parada').removeAttr(\"disabled\");\n\n $(\"#form_cotas\").submit();\n }\n /**\n * Simular pulsador en intro_paradas\n */\n let b_i_p = cogerVariable(\"./variables/intro_paradas.html\");\n if (b_i_p == 1) {\n //volver a poner el boton en false porque es un pulsador\n $(\"#boton_intro_paradas\").val(\"0\");\n\n $('#boton_cota').css(\"background-color\",\"white\");\n $('#boton_parada').css(\"background-color\",\"white\");\n $('#boton_cota').removeAttr(\"disabled\");\n $('#boton_parada').removeAttr(\"disabled\");\n\n $(\"#form_paradas\").submit();\n }\n\n let b_i_o = cogerVariable(\"./variables/origen.html\");\n if (b_i_o == 1) {\n //volver a poner el boton en false porque es un pulsador\n $(\"#boton_intro_origen\").val(\"0\");\n $(\"#origen_form\").submit();\n }\n\n let b_i_r = cogerVariable(\"./variables/reset.html\");\n if (b_i_r == 1) {\n //volver a poner el boton en false porque es un pulsador\n $(\"#boton_intro_reset\").val(\"0\");\n $(\"#reset_form\").submit();\n }\n\n}", "function sedePromo(sede, promo) {\n // respondiendo primera pregunta. Hallando la cantidad de alumnas y el porcentaje recorriendo un array se puede contar cuantas alumnas hay\n var arr = data[sede][promo]['students'];\n var cant = 0;\n var nocant = 0;\n for (var i = 0; i < arr.length; i++) {\n if (arr[i].active === true) {\n cant++;\n } else {\n nocant++;\n }\n }\n var calculandoPorcentaje = parseInt((nocant / arr.length) * 100);\n total.textContent = cant;\n porcentaje.textContent = calculandoPorcentaje + '%';\n /* ***************************************************Cantida de alumnas que superan el objetivo*****************************************************/\n var sumaScore = 0;\n for (var i = 0; i < arr.length; i++) {\n debugger;\n var sumaHse = 0;\n var sumaTech = 0;\n for (var j = 0; j < data[sede][promo]['students'][i]['sprints'].length; j++) {\n var tech = data[sede][promo]['students'][i]['sprints'][j]['score']['tech'];\n var hse = data[sede][promo]['students'][i]['sprints'][j]['score']['hse'];\n sumaHse = sumaHse + hse;\n sumaTech = sumaTech + tech;\n }\n if (sumaHse > 3360 && sumaTech > 5040) {\n sumaScore++;\n }\n }\n meta.innerHTML = sumaScore;\n /* ***************************************************************cantida de nps*********************************************************************/\n var arrNps = data[sede][promo]['ratings'];\n var sum = 0;\n var npsTotal = 0;\n for (var i = 0; i < arrNps.length; i++) {\n var npsPromoters = data[sede][promo]['ratings'][i]['nps']['promoters'];\n var npsDetractors = data[sede][promo]['ratings'][i]['nps']['detractors'];\n var npsPassive = data[sede][promo]['ratings'][i]['nps']['passive'];\n var npsResta = npsPromoters - npsDetractors;\n sum = sum + npsResta;\n var npsSuma = npsPromoters + npsDetractors + npsPassive;\n npsTotal = npsTotal + npsSuma;\n }\n var promoterPorcentaje = parseInt((npsPromoters / npsTotal) * 100);\n var detractorsPorcentaje = parseInt((npsDetractors / npsTotal) * 100);\n var passivePorcentaje = parseInt((npsPassive / npsTotal) * 100);\n var totalNps = sum / arrNps.length;\n nps.textContent = totalNps.toFixed(2);\n npsPorciento.innerHTML = promoterPorcentaje + '% Promoters' + '<br>' + detractorsPorcentaje + '% Passive' + '<br>' + passivePorcentaje + '% Detractors';\n /* *********************************************calculando los puntos obtenidos en tech********************************************************************/\n var cantidadTech = 0;\n for (var i = 0; i < arr.length; i++) {\n var arrSprint = data[sede][promo]['students'][i]['sprints'];\n var sumTech = 0;\n for (var j = 0; j < arrSprint.length; j++) {\n var tech2 = data[sede][promo]['students'][i]['sprints'][j]['score']['tech'];\n sumTech = sumTech + tech2;\n if (sumTech > (1260 * 4)) {\n cantidadTech++;\n }\n }\n }\n pointTech.textContent = cantidadTech;\n /* ********************************************************calculando los puntos en hse*******************************************************************/\n var cantidadHse = 0;\n for (var i = 0; i < arr.length; i++) {\n var arrSprint = data[sede][promo]['students'][i]['sprints'];\n var sumHse = 0;\n for (var j = 0; j < arrSprint.length; j++) {\n var hse2 = data[sede][promo]['students'][i]['sprints'][j]['score']['hse'];\n sumHse = sumHse + hse2;\n if (sumHse > (840 * 4)) {\n cantidadHse++;\n }\n }\n }\n pointHse.textContent = cantidadHse;\n /* **************************************porcentaje de la expectativa de las alumnas respecto a laboratoria**************************************************/\n var sumaExpectativa = 0;\n for (var i = 0; i < arrNps.length; i++) {\n var studentNoCumple = data[sede][promo]['ratings'][i]['student']['no-cumple'];\n var studentCumple = data[sede][promo]['ratings'][i]['student']['cumple'];\n var studentSupera = data[sede][promo]['ratings'][i]['student']['supera'];\n var Expectativa = ((studentSupera + studentCumple) / (studentNoCumple + studentCumple + studentSupera)) * 100;\n sumaExpectativa = sumaExpectativa + Expectativa;\n }\n var porcentajeExpectativa = parseInt(sumaExpectativa / arrNps.length);\n boxExpectativa.textContent = porcentajeExpectativa + '%';\n /* *********************************************promedio de los profesores********************************************************************/\n var promedioTeacher = 0;\n for (var i = 0; i < arrNps.length; i++) {\n var teacher = data[sede][promo]['ratings'][i]['teacher'];\n promedioTeacher = (promedioTeacher + teacher) / arrNps.length;\n }\n boxTeacher.textContent = promedioTeacher.toFixed(2);\n /* *************************************************promedio jedi*****************************************************************/\n var promedioJedi = 0;\n for (var i = 0; i < arrNps.length; i++) {\n var jedi = data[sede][promo]['ratings'][i]['jedi'];\n promedioJedi = (promedioJedi + jedi) / arrNps.length;\n }\n boxJedi.textContent = promedioJedi.toFixed(2);\n }", "function SetPoints(tablica,userPoints,score,user,kostki,time){\n\n // potwierdzanie punktow\n\n const confirmPoints = (e) => {\n\n // czyszczenie funkcji kostek\n\n for(let j = 0 ; j < 5 ; j++){\n kostki.querySelectorAll(\".kostka_side\").forEach(k => {\n k.style.backgroundColor = \"white\"\n } )\n kostki.children[j].dataset.save = \"false\"\n kostki.children[j].removeEventListener('click', kostkaSave,true)\n repeatBtn.removeEventListener(\"click\", NewRole,true)\n }\n \n \n repeatBtn.style.opacity = \"0\";\n setTimeout(() => {\n repeatBtn.style.display = \"none\";\n }, 300);\n\n // przypisywanie kliknietych punkow jako stalych nie zmiennych do konca gry\n \n let confirm = new Promise(resolve => {\n let value = Number(e.path[0].innerHTML)\n let cat = e.path[0].dataset.cat;\n \n userPoints[cat].score = value;\n userPoints[cat].confirm = true;\n \n \n tablica.forEach(t => {\n t.removeEventListener(\"click\", confirmPoints,true)\n })\n resolve(tablica)\n })\n\n confirm.then(r => {\n \n e.path[0].style.backgroundColor = \"rgba(0, 0, 0, 0.603)\"\n \n clearAndSumTable(r,userPoints) \n \n })\n \n // wywolanie bota\n\n confirm.then(r => {\n setTimeout(() => {\n StartGame(user2)\n }, 2000);\n })\n \n \n }\n\n\n // ustawanie punktow kiedy gra bot\n\n const BotConfirmPoints = () => {\n\n // szukanie najwyższej liczby punktow\n\n let findMaxPoint = new Promise(resolve => {\n let sort = [...score];\n sort = sort.sort((a,b) => a - b).reverse();\n let pos = 0;\n let max = sort[pos];\n let index;\n \n let findIndex = () => {\n \n index = score.indexOf(max) \n \n if(max == 0){\n \n let i = tablePoints.length - 1;\n let f = false;\n while(f == false){\n \n if(userPoints[tablePoints[i].dataset.cat].confirm == false){\n \n let value = Number(tablePoints[i].innerHTML)\n let cat = tablePoints[i].dataset.cat;\n userPoints[cat].score = value;\n userPoints[cat].confirm = true;\n index = i;\n f = true;\n }\n \n i--;\n }\n \n }else if(userPoints[tablePoints[index].dataset.cat].confirm == true){\n pos++;\n max = sort[pos];\n findIndex();\n }else{\n let value = Number(tablePoints[index].innerHTML)\n let cat = tablePoints[index].dataset.cat;\n userPoints[cat].score = value;\n userPoints[cat].confirm = true;\n }\n }\n \n findIndex()\n \n \n \n resolve(tablePoints[index])\n \n })\n \n // zatwierdzanie punkktow\n\n findMaxPoint.then(r => {\n \n r.style.backgroundColor = \"rgba(0, 0, 0, 0.603)\"\n clearAndSumTable(tablica,userPoints) ;\n \n });\n \n //wczytywanie kolejnego gracz\n\n findMaxPoint.then(r => {\n setTimeout(() => {\n switch(currentUser){\n case 1: StartGame(user2); break;\n case 2: StartGame(user3); break;\n case 3: StartGame(user4); break;\n case 4: StartGame(user1); break;\n }\n }, 1000);\n })\n \n \n }\n\n // usuwanie mozliwosci klikania punktow\n\n tablica.forEach(t => {\n t.removeEventListener(\"click\", confirmPoints,true)\n })\n\n // tworzenie tabelicy tylko z polami w ktorych maja sie znajdowac punkty\n\n let tablePoints = []\n // wpisywanie w td punktow\n\n let createTable = new Promise(resolve => {\n\n tablica.forEach(t => {\n if(t.classList == \"points\"){\n tablePoints.push(t)\n }\n })\n\n\n resolve(tablePoints)\n })\n\n // rzypisywanie do pol odpowiednie im punkty\n\n createTable.then(r => {\n score.forEach((s,b) => {\n if(userPoints[r[b].dataset.cat].confirm == false){\n r[b].innerHTML = s;\n }\n })\n })\n\n // nadawanie polom mozliwosci zatwierdzania ich\n\n createTable.then(r => {\n\n if(user == \"1\"){\n if(time == 1){\n r.forEach(x => {\n if(userPoints[x.dataset.cat].confirm == false){\n x.addEventListener(\"click\", confirmPoints,true)\n }\n })\n }\n }\n else{\n if(time == 1){\n setTimeout(() => {\n BotConfirmPoints()\n }, 1000);\n }\n }\n \n })\n\n}", "function AyudaPrincipal(bDevolverExitoEjecucion)\r\n{\r\n\tif ( (sIDAyuda!=null) && (sIDAyuda!='') )\r\n\t{\t\r\n\t\tif (sIDAncla!='')\t\r\n\t\t\tfnCargarAyuda(sIDAyuda, sIDAncla);\r\n\t\telse\r\n\t\t\tfnCargarAyuda(sIDAyuda);\r\n\t\tif (bDevolverExitoEjecucion) return true; else return false; \r\n\t}\r\n\telse\r\n\t{\r\n\t\tif (bDevolverExitoEjecucion) \r\n\t\t\treturn false; \r\n\t\telse \r\n\t\t{\r\n\t\t\t// No se especificó la ubicación de la Ayuda global\r\n\t\t\tshowMessageCod(MSG_DATONOESPECIFICADO, iMsgTipoCerrar, getMensajeARQD(MSG_ERROR), getMensajeARQD(MSG_ERRORJS),null,null,\"DATO\",\"Ubicación de la ayuda global\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n}", "function aplicarDescuento(){\n if (numeroDeClases >= 12) {\n console.log(\"El total a abonar con su descuento es de \" + (totalClase - montoDescontar));\n } else if (numeroDeClases <= 11) {\n console.log(\"Aún NO aplica el descuento, el valor total a abonar es de \" + totalClase);\n }\n }", "function comprobarPreInversion (callback){\n \n // Recuperamos las cuentas que tienen saldo\n tienenSaldoDisponible(function(tienenSaldo){\n \n // Comprobamos que las cuentas recuperadas tengan el bot corriendo\n estadoBot(tienenSaldo,function(botRunning){\n \n // COmprobamos que tengan licencia \n tienenLicencia(botRunning,function(conLicencia){\n \n return callback(conLicencia)\n \n })\n })\n })\n}", "ajuste_potencia(){\n if (this.energia_disponible()){\n let danio_total = this.calcular_danio_total();\n let inyect_total = this.inyectores_disponibles();\n let plasma_inyector = (danio_total+this._plasma_requerido - inyect_total * limit_plasma)/this.inyectores_disponibles();\n for (let i = 0; i < this._injectores.length; i++) {\n if (this._injectores[i]._danio_por!==100){\n if (plasma_inyector<0){\n this._injectores[i].set_plasma = this._injectores[i].calcular_poder()+plasma_inyector;\n } else {\n this._injectores[i].set_plasma = this._injectores[i].calcular_poder();\n this._injectores[i].set_extra_plasma = plasma_inyector;\n\n }\n }\n }\n this._potencia_disponible = true;\n } else {\n this._potencia_disponible = false;\n\n }\n }", "async function main(){\n try{\n const usuario= await obterUsuario();\n // const telefone = await obterTelefone(usuario.id);\n // const endereco = await obterEnderecoAsync(usuario.id);\n\n //o promise all permite fazer com que as funcoes nele executem ao `mesmo tempo`\n const resultado = await Promise.all(\n [\n obterTelefone(usuario.id),\n obterEnderecoAsync(usuario.id)\n ]\n )\n console.log(`\n Nome:${usuario.nome}\n Telefone:${resultado[0].telefone}\n Endereco:${resultado[1].rua}\n `);\n\n }catch(error){\n console.error(`Deu ruim`,error)\n }\n\n}", "comprobarPresupuesto(){\n const presupuestoTotal = cantidadPresupuesto.presupuesto;\n const presupuestoRestante = cantidadPresupuesto.restante;\n // Comprobar el 25% del presupuesto\n const restante = document.querySelector('.restante');\n if ( (presupuestoTotal/4) >= presupuestoRestante) {\n restante.classList.remove('alert-success', 'alert-warning');// se le agrega en el 50%\n restante.classList.add('alert-danger');\n } else if ( (presupuestoTotal/2) >= presupuestoRestante) {\n restante.classList.remove('alert-success');\n restante.classList.add('alert-warning');\n }\n }", "function botonPrecionado(peso) {\n\n switch (peso) {\n case 10:\n addPeso(peso);\n break;\n case 7.5://6.6\n addPeso(peso);\n break;\n case 4.3://3.3\n addPeso(peso);\n break;\n case 0:\n addPeso(peso);\n break;\n default:\n }\n indicePregunta++;\n if(indicePregunta < preguntas.length){\n cambiarPregunta();\n }\n else {\n analizarAptitudes();\n // document.getElementById(\"con1\").value = 1\n // document.getElementById(\"con2\").value = 1\n // document.getElementById(\"con3\").value = 1\n // document.getElementById(\"con4\").value = 1\n // document.getElementById(\"con5\").value = 1\n // document.getElementById(\"con6\").value = 1\n\n //enviar resultados a\n document.getElementById(\"voc-form\").submit();\n\n }\n }", "resumen_estado_nave(){\n this.ajuste_potencia();\n if (typeof this._potencia_disponible !== \"undefined\"){\n if (this._potencia_disponible){\n let estado_plasma = \"\";\n for (let i = 0; i < this._injectores.length; i++) {\n estado_plasma += \"Plasma \"+i.toString()+\": \";\n let total = this._injectores[i].get_plasma+this._injectores[i].get_extra_plasma;\n estado_plasma += total+\"mg/s \";\n }\n console.log(estado_plasma);\n\n for (let i = 0; i < this._injectores.length; i++) {\n if (this._injectores[i].get_danio_por<100){\n if (this._injectores[i].get_extra_plasma>0){\n console.log(\"Tiempo de vida: \"+this._injectores[i].tiempo_vuelo().toString()+\" minutos.\");\n } else {\n console.log(\"Tiempo de vida infinito!\");\n break;\n }\n }\n }\n } else {\n console.log(\"Unable to comply.\")\n console.log(\"Tiempo de vida 0 minutos.\")\n }\n } else {\n throw \"_potencia_disponible: NO DEFINIDA\";\n }\n }", "procesarControles(){\n\n }", "executarPocao() {\n\t\tlet tempoPocaoResta = null; //quanto tempo a pocao fica ativo ateh desaparecer de novo (em milisegundos)\n\t\tlet pocaoMudaPers; //soh obrigatorio para pocoes que tenham desexecutar\n\n\t\tswitch (this._codPocao) {\n\t\t\tcase TipoPocao.DiminuirTamanhoPers:\n\t\t\t\ttempoPocaoResta = 7500;\n\t\t\t\tpocaoMudaPers = true;\n\t\t\t\tControladorJogo.pers.mudarTamanho(porcentagemSetTam); //50% do tamanho\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.MatarObjetos1Tiro:\n\t\t\t\t//mudanca na propria classe Obstaculo e Inimigo\n\t\t\t\ttempoPocaoResta = 3000;\n\t\t\t\tpocaoMudaPers = false;\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.RUIMPersPerdeVel:\n\t\t\t\ttempoPocaoResta = 5000;\n\t\t\t\tpocaoMudaPers = true;\n\t\t\t\tControladorJogo.pers.mudarVelocidade(porcentagemSetVelRuim);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.TiroPersMaisRapidoMortal:\n\t\t\t\ttempoPocaoResta = 8500;\n\t\t\t\tpocaoMudaPers = true;\n\n\t\t\t\t//porque depende do aviao do personagem, qual o index que vai ter o tiro bom\n\t\t\t\tconst indexTiroMelhor = ControladorJogo.pers.indexTiroMelhor;\n\t\t\t\t//mudar frequencia\n\t\t\t\tconst freqFuncAtual = ControladorJogo.pers.getFreqFuncAtirar(indexTiroMelhor);\n\t\t\t\tthis._frequenciaAtirarAntigo = freqFuncAtual.freq;\n\t\t\t\tfreqFuncAtual.freq = freqAtirarMaisRapidoMortal;\n\t\t\t\t//mudar infoTiro\n\t\t\t\tControladorJogo.pers.getControladorTiros(indexTiroMelhor).colocarInfoTiroEspecial(ArmazenadorInfoObjetos.infoTiro(\"TiroForte\", true));\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.MatarInimigosNaoEssenc:\n\t\t\t\tControladorJogo.controladoresInimigos.forEach(controladorInims => {\n\t\t\t\t\tif (!controladorInims.ehDeInimigosEssenciais)\n\t\t\t\t\t\t//soh mata os inimigos nao essenciais\n\t\t\t\t\t\tcontroladorInims.matarTodosInim();\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.ReverterTirosJogoInimDirInim:\n\t\t\t\tthis._reverterTirosContraInimigos(false);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.GanharPoucaVida:\n\t\t\t\tControladorJogo.pers.mudarVida(qtdGanhaPoucaVida);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.RUIMPersPerdeVida:\n\t\t\t\tControladorJogo.pers.mudarVida(-qtdPerdeVida);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.ReverterTirosJogoInimSeguirInim:\n\t\t\t\tthis._reverterTirosContraInimigos(true);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.DeixarTempoMaisLento:\n\t\t\t\ttempoPocaoResta = 5000;\n\t\t\t\tpocaoMudaPers = false;\n\t\t\t\t/* para deixar tempo mais lento:\n\t\t\t\t -> tiros tela. OK\n\t\t\t\t -> inimigos (incluindo tiros deles, atirar e inimigosSurgindo). OK\n\t\t\t\t -> obstaculos. OK\n\t\t\t\t -> Timers (aqui soh os que jah existem). OK\n\t\t\t\t ps1: verificar se nao existem Timers no PersonagemPrincipal\n\t\t\t\t ps2: verificar se nao podem ser criados freqFuncs sem ser do pers durante esse tempo\n\t\t\n\t\t\t\tresto:\n\t\t\t\t -> quando Timers forem criados. OK\n\t\t\t\t -> quando tiros(sem ser do personagem), obstaculos ou inimigos(freqFuncAtirar tambem) forem criados. OK\n\t\t\t\t*/\n\t\t\t\t//tiros sem dono\n\t\t\t\tControladorJogo.controladorOutrosTirosNaoPers.mudarTempo(porcentagemDeixarTempoLento);\n\t\t\t\t//suportes aereos\n\t\t\t\tControladorJogo.controladorSuportesAereos.suportesAereos.forEach(suporteAereo => suporteAereo.mudarTempo(porcentagemDeixarTempoLento));\n\t\t\t\t//inimigos (incluindo tiros deles e freqFuncAtirar)\n\t\t\t\tControladorJogo.controladoresInimigos.forEach(controladorInims =>\n\t\t\t\t\tcontroladorInims.mudarTempo(porcentagemDeixarTempoLento));\n\t\t\t\t//obstaculos\n\t\t\t\tControladorJogo.controladoresObstaculos.forEach(controladorObsts =>\n\t\t\t\t\tcontroladorObsts.mudarTempo(porcentagemDeixarTempoLento));\n\t\t\t\t//escuridao\n\t\t\t\tif (ControladorJogo.escuridao !== undefined)\n\t\t\t\t\tControladorJogo.escuridao.mudarTempo(porcentagemDeixarTempoLento);\n\t\t\t\t//Timers\n\t\t\t\tConjuntoTimers.mudarTempo(porcentagemDeixarTempoLento);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.RUIMTirosPersDirEle:\n\t\t\t\t//virar tiros contra criador\n\t\t\t\tControladorJogo.pers.virarTirosContraCriador(false);\n\t\t\t\t//diminuir a velocidade e o dano\n\t\t\t\tControladorJogo.pers.armas.forEach(arma => {\n\t\t\t\t\tarma.controlador.mudarQtdAndarTiros(porcentagemVelTiroSeVoltarPers);\n\t\t\t\t\tarma.controlador.mudarMortalidadeTiros(porcentagemMortalidadeTiroSeVoltarPers, true);\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.GanharMuitaVida:\n\t\t\t\tControladorJogo.pers.mudarVida(qtdGanhaMuitaVida);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.PersMaisRapido:\n\t\t\t\ttempoPocaoResta = 7500;\n\t\t\t\tpocaoMudaPers = true;\n\t\t\t\tControladorJogo.pers.mudarVelocidade(porcentagemSetVel);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.PersComMissil:\n\t\t\t\ttempoPocaoResta = 4500;\n\t\t\t\tpocaoMudaPers = true;\n\n\t\t\t\t//setar novo tiro\n\t\t\t\tControladorJogo.pers.getControladorTiros(indexArmaMissilPers).colocarInfoTiroEspecial(ArmazenadorInfoObjetos.infoTiro(\"TiroMissil\", true));\n\n\t\t\t\t//guardar frequencia e atirarDireto antigo antes de muda-los\n\t\t\t\tthis._informacoesNaoMissil = {\n\t\t\t\t\tfreq: ControladorJogo.pers.getFreqFuncAtirar(indexArmaMissilPers).freq,\n\t\t\t\t\tatirarDireto: ControladorJogo.pers.getConfigArma(indexArmaMissilPers).atirarDireto\n\t\t\t\t};\n\n\t\t\t\t//mudar freqAtirar e atirarDireto\n\t\t\t\tControladorJogo.pers.getFreqFuncAtirar(indexArmaMissilPers).freq = freqMissilPers;\n\t\t\t\tControladorJogo.pers.getFreqFuncAtirar(indexArmaMissilPers).setContadorUltimaEtapa(); //ele jah vai atirar missil em seguida\n\t\t\t\tControladorJogo.pers.getConfigArma(indexArmaMissilPers).atirarDireto = true;\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.TirarVidaTodosInim:\n\t\t\t\t//passa por todos os controladores de inimigos\n\t\t\t\tControladorJogo.controladoresInimigos.forEach(controladorInims =>\n\t\t\t\t\tcontroladorInims.tirarVidaTodosInim(qtdTiraVidaTodosInim));\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.CongelarInimigos:\n\t\t\t\ttempoPocaoResta = 5000;\n\t\t\t\tpocaoMudaPers = false;\n\t\t\t\t//congelar todos os inimigos\n\t\t\t\tControladorJogo.controladoresInimigos.forEach(controladorInims =>\n\t\t\t\t\tcontroladorInims.mudarCongelarTodosInim(true));\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tthrow \"Esse codigo pocao nao existe!\";\n\t\t}\n\n\t\tif (this.mudaAviaoPersTemp)\n\t\t\t//para mudancas feitas em uma certa nave do personagem nao desexecutar em outra\n\t\t\tthis._numeroAviaoPers = ControladorJogo.pers.numeroAviao;\n\n\t\tif (tempoPocaoResta !== null) //se tem que desexecutar depois de um tempo, programa esse Timer (pode ser soh uma acao pontual)\n\t\t{\n\t\t\t//programa quando quando vai parar com esse pocao\n\t\t\tthis._timerDesexecutar = new Timer(() => { this.desexecutarPocao(); }, tempoPocaoResta, false, false /*pocao transcende o level (mesmo se o level acabar ainda vai ter que desexecutar)*/,\n\t\t\t\tpocaoMudaPers, { obj: this, atr: \"_tempoRestante\" }); //atualiza quanto tempo falta\n\n\t\t\tthis._tempoTotal = tempoPocaoResta;\n\t\t\t//this._tempoRestante = tempoPocaoResta; nao precisa setar tempoRestante porque Timer jah faz isso\n\t\t} else\n\t\t\tdelete this._timerDesexecutar;\n\t}", "function Preguntar(Mensaje,objeto,enlace,marco){\n\t\t\t\tif(confirm(Mensaje)==true){ \n\t\t\t\t cargar(objeto,enlace,marco);\n\t\t\t\t return true;\n \t\t\t\t} \n\t\t\t\telse \n\t\t\t\t return false;\n\t\t\t\t}", "function attaquer() \n{\n if (presenceEnnemi === 666){\n dialogBox(\"MORT DE CHEZ MORT ARRETE MAINTENANT. TU PEUX PAS ATTAQUER T'ES MORT. MORT. MOOOOORT\");\n }else if (presenceEnnemi === 0){\n dialogBox(\"Tu n'as pas d'adversaire, va chercher la merde on en reparle après.\");\n }else if (presenceEnnemi = 1, tourJoueur(tour)=== true){\n var Min= Number(personnage.force - 10)\n var Max= Number(personnage.force + 10)\n\n function getRndInterger(min, max) {\n return Math.floor(Math.random() * (max - min + 1) ) + min;}\n\nvaleurAttaque = getRndInterger(Min, Max);\nactionPerso = 1;\nreactionEnnemi();\nesquiveReussie = 0;\nresetSpecial();\n}\n\n}", "function sveikinuosi( funkcijosPavadinimas ){\n console.log(\"Labutaitis\");\n if (funkcijosPavadinimas != null && funkcijosPavadinimas != undefined) {\n funkcijosPavadinimas();\n }\n}", "function actualizarProtesisf(diente, codigopieza){\n\t\t\n\t\tvar actualizarProtesis = false;\n\t\tvar error = false;\n\t\n\t\tvar tratamiento_abierto_protesis = ko.utils.arrayFilter(vm.tratamientosAplicados(), function(t){\n\t\t var eldiente = t.diente.id.toString(); \n \n // SI no tienes guiones y es protesis fija, esta incompleta la protesis fija\n\t\t if (eldiente.indexOf('_') <= -1 && t.tratamiento.id == codigopieza) { \n\t\t \terror = true;\n\t\t \tactualizarProtesis = true; // esto es para que no agregue un registro\n\n\t\t \tif((t.diente.id>=11 && t.diente.id<=28) && (diente.id>=11 && diente.id<=28)){\n\t\t \t\tt.diente.id += \"_\"+diente.id.toString();\n\t\t \t error = false;\n\t\t \t}\n\t\t \tif((t.diente.id>=51 && t.diente.id<=65) && (diente.id>=51 && diente.id<=65)){\n\t\t \t\tt.diente.id += \"_\"+diente.id.toString();\n\t\t \t error = false;\n\t\t \t}\n\t\t \tif((t.diente.id>=71 && t.diente.id<=85) && (diente.id>=71 && diente.id<=85)){\n\t\t \t\tt.diente.id += \"_\"+diente.id.toString();\n\t\t \t error = false;\n\t\t \t}\n\t\t \tif((t.diente.id>=31 && t.diente.id<=48) && (diente.id>=31 && diente.id<=48)){\n\t\t \t\tt.diente.id += \"_\"+diente.id.toString();\n\t\t \t error = false;\n\t\t \t}\n\n\t\t \t} \n\t\t});\t\n\n\t\tvar salida=[actualizarProtesis,error];\n\t\treturn salida;\n\n }", "function ControlloAbbonamentoPranzo() {\r\n var i;\r\n\t\t\tvar AbbonamentoPranzo = document.getElementById(\"AbbonamentoPranzo\");\r\n\t\t\tvar Iscrizione = document.getElementById(\"Iscrizione\");\r\n\t\t\tif (!Iscrizione.checked && AbbonamentoPranzo.checked) {\r\n\t\t\t\talert(\"Non è possibile registrare l'abbonamento ai pranzi senza l'iscrizione, almeno come ospite\");\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\t// chiedo conferma per la cancellazione dell'abbonamento\r\n\t\t\tif (!AbbonamentoPranzo.checked) {\r\n\t\t\t\t//if (!confirm(\"Attenzione! Sei sicuro di voler togliere all'iscritto l'abbonamento pranzi?\")) {\r\n\t\t\t\t\t//AbbonamentoPranzo.checked = true;\r\n\t\t\t\t//}\r\n\t\t\t} else {\r\n\t\t\t\t//if (confirm(\"Attenzione! Impostando l'abbonamento pranzi verranno annullati tutti i pranzi singoli\\nVuoi proseguire?\")) {\r\n\t\t\t\t\t// annullo i pranzi singoli se è impostato l'abbonamento\r\n\t\t\t\t\tvar Pranzi = document.getElementsByName(\"Pranzo[]\");\r\n\t\t var PranziGratis = document.getElementsByName(\"GratisPranzo[]\");\r\n\t\t\t\t\tfor (i=0; i < Pranzi.length; i++) {\r\n\t\t\t\t\t\tPranzi[i].checked = false;\r\n\t\t\t\t\t\tPranziGratis[i].checked = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t//} else {\r\n\t\t\t\t//\tAbbonamentoPranzo.checked = false;\r\n\t\t\t\t//}\r\n\t\t\t}\r\n\t\t\t// ricalcolo il totale\r\n\t\t\tdocument.getElementById(\"CostoTotaleEuroCalcolato\").value = CalcolaCostoTotale().toFixed(2).replace(\".\", \",\");\r\n\t\t\treturn; \r\n } // fine funzione controllo dell'abbonamento pranzo", "function partidaGanada(){\n\tif(contParejas == (imagenesOcultas.length/2)){\n\t\tanadirTexto(\"Enhorabuena, has ganado la partida.\");\n\t\tanadirTexto(\"Después de \"+contIntentos+\" intentos has encontrado todas las parejas.\");\n if(contrarreloj)\n anadirTexto(\"Te han sobrado \"+minPasados+\" minutos y \"+segPasados+\" segundos.\"); \n gameStart=false;\n\t}\n}", "function _GeraPontosDeVida(modo, submodo) {\n if (modo != 'personagem' && modo != 'elite' && modo != 'comum') {\n Mensagem(Traduz('Modo') + ' ' + modo + ' ' + Traduz('invalido') + '. ' + Traduz('Deve ser elite, comum ou personagem.'));\n return;\n }\n // Para cada classe, rolar o dado.\n var total_pontos_vida = 0;\n // Primeiro eh diferente na elite e personagem.\n var primeiro = (modo == 'comum') ? false : true;\n for (var i = 0; i < gPersonagem.classes.length; ++i) {\n var info_classe = gPersonagem.classes[i];\n for (var j = 0; j < info_classe.nivel; ++j) {\n var pontos_vida_nivel = 0;\n var template_personagem = PersonagemTemplate();\n var dados_vida = template_personagem != null && 'dados_vida' in template_personagem ?\n template_personagem.dados_vida :\n tabelas_classes[info_classe.classe].dados_vida;\n if (primeiro) {\n if (modo == 'elite') {\n pontos_vida_nivel = dados_vida;\n } else if (modo == 'personagem') {\n // O modificador de constituicao eh subtraido aqui pq sera adicionado\n // no calculo de pontos de vida, nos bonus.\n pontos_vida_nivel = dados_vida +\n gPersonagem.atributos['constituicao'].valor -\n gPersonagem.atributos['constituicao'].modificador;\n } else {\n pontos_vida_nivel = submodo == 'tabelado' ? dados_vida / 2 : Rola(1, dados_vida);\n }\n primeiro = false;\n } else {\n pontos_vida_nivel = submodo == 'tabelado' ? dados_vida / 2 : Rola(1, dados_vida);\n\n }\n // Nunca pode ganhar menos de 1 ponto por nivel.\n if (pontos_vida_nivel < 1) {\n pontos_vida_nivel = 1;\n }\n total_pontos_vida += pontos_vida_nivel;\n }\n }\n gPersonagem.pontos_vida.total_dados = Math.floor(total_pontos_vida);\n}", "function siguienteGeneracion() {\n if ((fitness.some(val => val > (1 / tamañoPoblacion * 1.4))) || (numPoblacionesIteradas > limiteIteraciones)) { //funcion de parado, cuando se hayan excedido el numero de iteraciones limite, o cuando se cumpla con la funcion de parado que es \n //cuando el fitness de un elemento de la poblacion es 40% mayor que el promedio que deberia tener\n hayQueParar = true;\n } else {\n poblacion = poblacion.map(val => {//actualizar la poblacion\n var ordenA = escogerUno(poblacion, fitness);\n var ordenB = escogerUno(poblacion, fitness); //obtener 2 muestras de la poblacion\n var orden = crossOver(ordenA, ordenB); //crossover entre las 2 muestras \n mutar(orden, 0.01); //mutacion aleatoria\n return orden;\n });\n }\n}", "function llenaArreglo() {\n var metodoSelecionado = parseFloat($('input[name=\"TipoPago\"]:checked').val());\n if (verificarMontos(metodoSelecionado)) {\n var nombreLista1 = \"idEventos\";\n var nombreLista2 = \"idPromociones\";\n var promocionesBTV = 1;\n var eventosBTV = 1;\n //si es un pago mixto no hay promociones - no afectan promociones\n //es pago solo en efectivo\n if (metodoSelecionado == 1) {\n promocionesBTV = document.getElementsByName('promoEfectivo');\n eventosBTV = document.getElementsByName('eventoEfectivo');\n } else {\n //es pago solo con tarjeta\n promocionesBTV = document.getElementsByName('promocionesCarrito');\n eventosBTV = document.getElementsByName('eventosCarrito');\n }\n //guardo los datos\n for (var i = 0; i < promocionesBTV.length; i++) {\n var idProm = promocionesBTV[i].value;\n var idEvento = eventosBTV[i].value;\n escribeArreglo(nombreLista2, idProm, i);\n escribeArreglo(nombreLista1, idEvento, i);\n }\n return true;\n }\n return false;\n}", "function menu_paquet(){\n\t\taction=prompt(\"F fin de tour | P piocher une carte\");\n\t\taction=action.toUpperCase();\n\t\tif (action != null){\n\t\t\tswitch(action){\n\t\t\t\tcase \"F\":\n\t\t\t\t\tif (att_me.length>0){\n\t\t\t\t\t\t//MAJ des cartes en INV_ATT1,2\n\t\t\t\t\t\tmajCartesEnAttaque();\n\t\t\t\t\t}\n\t\t\t\t\tif (pv_adv==0 || pv_me==0){\n\t\t\t\t\t\tif (pv_adv==0){\n\t\t\t\t\t\t\talert(\"Vous avez gagné !!!\");\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\talert(\"Vous avez perdu !!!\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\t/////////////////////////////////Gérer la fin de partie ICI\n\t\t\t\t\t} else {\n\t\t\t\t\t\tIA_jouer(IA_stategie_basic);\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tcase \"P\":\n\t\t\t\t\tjeu_piocherDsPaquet(true);\t\t\t\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "function modificarInspeccion(){\n Concurrent.Thread.create(obtenerValoresIniciales);\n Concurrent.Thread.create(obtenerValoresPreliminar);\n Concurrent.Thread.create(obtenerValoresProteccion);\n Concurrent.Thread.create(obtenerValoresElementos);\n Concurrent.Thread.create(obtenerValoresMecanicos);\n Concurrent.Thread.create(obtenerValoresElectrica);\n Concurrent.Thread.create(obtenerValoresMotorizacion);\n Concurrent.Thread.create(obtenerValoresOtras);\n Concurrent.Thread.create(obtenerValoresManiobras);\n Concurrent.Thread.create(obtenerValoresObservacionFinal);\n Concurrent.Thread.create(obtenerValoresAudios);\n Concurrent.Thread.create(obtenerValoresFotografias);\n}", "function coherencia(objeto){\n // extrae las variables nesesarias para la evaluacion\n var estructura= objeto.structure;\n var nivelagregacion=objeto.aggregationlevel;\n var tipointeractividad=objeto.interactivitytype; \n var nivelinteractivo=objeto.interactivitylevel;\n var tiporecursoeducativo=objeto.learningresourcetype;\n \n //inicializa las reglas y las variables de los pesos\n var r=0;\n var pesor1=0;\n var pesor2=0;\n var pesor3=0;\n\n //verifica las reglas que se van a evaluar\n if (estructura===\"atomic\" && nivelagregacion===\"1\"){\n r++;\n pesor1=1;\n }else if (estructura===\"atomic\" && nivelagregacion===\"2\"){\n r++;\n pesor1=0.5;\n }else if (estructura===\"atomic\" && nivelagregacion===\"3\"){\n r++;\n pesor1=0.25;\n }else if (estructura===\"atomic\" && nivelagregacion===\"4\"){\n r++;\n pesor1=0.125;\n }else if (estructura===\"collection\" && nivelagregacion===\"1\"){\n r++;\n pesor1=0.5;\n }else if (estructura===\"networked\" && nivelagregacion===\"1\"){\n r++;\n pesor1=0.5; \n }else if (estructura===\"hierarchical\" && nivelagregacion===\"1\"){\n r++;\n pesor1=0.5; \n }else if (estructura===\"linear\" && nivelagregacion===\"1\"){\n r++;\n pesor1=0.5; \n }else if (estructura===\"collection\" && (nivelagregacion===\"2\" || \n nivelagregacion===\"3\" || \n nivelagregacion===\"4\") ){\n r++;\n pesor1=1; \n }else if (estructura===\"networked\" && (nivelagregacion===\"2\" || \n nivelagregacion===\"3\" || \n nivelagregacion===\"4\") ){\n r++;\n pesor1=1; \n }else if (estructura===\"hierarchical\" && (nivelagregacion===\"2\" || \n nivelagregacion===\"3\" || \n nivelagregacion===\"4\") ){\n r++;\n pesor1=1; \n }else if (estructura===\"linear\" && (nivelagregacion===\"2\" || \n nivelagregacion===\"3\" || \n nivelagregacion ===\"4\") ){\n r++;\n pesor1=1; \n }\n\n if (tipointeractividad===\"active\" && (nivelinteractivo===\"very high\" || \n nivelinteractivo===\"high\" || \n nivelinteractivo===\"medium\" || \n nivelinteractivo===\"low\" ||\n nivelinteractivo===\"very low\") ){\n $r++;\n $pesor2=1; \n }else if (tipointeractividad===\"mixed\" && (nivelinteractivo===\"very high\" || \n nivelinteractivo===\"high\" || \n nivelinteractivo===\"medium\" || \n nivelinteractivo===\"low\" ||\n nivelinteractivo===\"very low\") ){\n r++;\n pesor2=1;\n }else if (tipointeractividad===\"expositive\" && (nivelinteractivo===\"very high\" || \n nivelinteractivo===\"high\") ){\n r++;\n pesor2=0;\n }else if (tipointeractividad===\"expositive\" && nivelinteractivo===\"medium\" ){\n r++;\n pesor2=0.5;\n }else if (tipointeractividad===\"expositive\" && ( nivelinteractivo===\"low\" ||\n nivelinteractivo===\"very low\") ){\n r++;\n pesor2=1;\n } \n if ( tipointeractividad===\"active\" && (tiporecursoeducativo===\"exercise\" || \n tiporecursoeducativo===\"simulation\" || \n tiporecursoeducativo===\"questionnaire\" || \n tiporecursoeducativo===\"exam\" ||\n tiporecursoeducativo===\"experiment\" ||\n tiporecursoeducativo===\"problem statement\" ||\n tiporecursoeducativo===\"self assessment\") ){\n r++;\n pesor3=1; \n }else if (tiporecursoeducativo===\"active\" && (tiporecursoeducativo===\"diagram\" || \n tiporecursoeducativo===\"figure\" || \n tiporecursoeducativo===\"graph\" || \n tiporecursoeducativo===\"index\" ||\n tiporecursoeducativo===\"slide\" ||\n tiporecursoeducativo===\"table\" ||\n tiporecursoeducativo===\"narrative text\" ||\n tiporecursoeducativo===\"lecture\") ){\n r++;\n pesor3=0;\n \n }else if (tipointeractividad===\"expositive\" && (tiporecursoeducativo===\"exercise\" || \n tiporecursoeducativo===\"simulation\" || \n tiporecursoeducativo===\"questionnaire\" || \n tiporecursoeducativo===\"exam\" ||\n tiporecursoeducativo===\"experiment\" ||\n tiporecursoeducativo===\"problem statement\" ||\n tiporecursoeducativo===\"self assessment\") ){\n r++;\n pesor3=0; \n }else if (tipointeractividad===\"expositive\" && (tiporecursoeducativo===\"diagram\" || \n tiporecursoeducativo===\"figure\" || \n tiporecursoeducativo===\"graph\" || \n tiporecursoeducativo===\"index\" ||\n tiporecursoeducativo===\"slide\" ||\n tiporecursoeducativo===\"table\" ||\n tiporecursoeducativo===\"narrative text\" ||\n tiporecursoeducativo===\"lecture\") ){\n r++;\n pesor3=1;\n }else if (tipointeractividad===\"mixed\" && (tiporecursoeducativo===\"exercise\" || \n tiporecursoeducativo===\"simulation\" || \n tiporecursoeducativo===\"questionnaire\" || \n tiporecursoeducativo===\"exam\" ||\n tiporecursoeducativo===\"experiment\" ||\n tiporecursoeducativo===\"problem statement\" ||\n tiporecursoeducativo===\"self assessment\" ||\n tiporecursoeducativo===\"diagram\" ||\n tiporecursoeducativo===\"figure\" ||\n tiporecursoeducativo===\"graph\" ||\n tiporecursoeducativo===\"index\" ||\n tiporecursoeducativo===\"slide\" ||\n tiporecursoeducativo===\"table\" ||\n tiporecursoeducativo===\"narrative text\" ||\n tiporecursoeducativo===\"lecture\" )){\n r++;\n pesor3=1; \n } \n m_coherencia=0;\n if (r>0) {\n\n // hace la sumatoria de los pesos \n m_coherencia= ( pesor1 + pesor2 + pesor3) / r;\n \n \n //alert(mensaje);\n return m_coherencia;\n //echo \"* Coherencia de: \". m_coherencia.\"; \". evaluacion.\"<br><br>\";\n }else{\n \n return m_coherencia;\n \n }\n\n\n }", "function karinaFaarNotifikation() {\n\n\n\n}", "programarPocoesLevel()\n\t//ps: soh o ControladorJogo chama esse metodo\n\t//programa para adicionar e remover todas as pocoes (tenta fazer com que o numero de maximo de pocoes do level seja adicionado antes do level acabar)\n\t{\n\t\tconst maxPocoesLevelAtual = ControladorPocaoTela._maxPocoesFromLevel(ControladorJogo.level);\n\t\tif (maxPocoesLevelAtual > this._qtdPocoesFaltaProgramar)\n\t\t//se usuario passou o level anterior mais rapido que o esperado e nao deu tempo de colocar algumas pocoes na tela, e, faltar mais pocoes doq o numero maximo de pocoes desse level, nao substitui\n\t\t{\n\t\t\tthis._qtdPocoesFaltaProgramar = maxPocoesLevelAtual;\n\t\t\tif (this._jahProgramouDeixarPocaoTela)\n\t\t\t\t//se jah deixou programado para colocar uma pocao na tela e ainda nao tirou essa pocao, teria uma pocao a mais nesse level\n\t\t\t\tthis._qtdPocoesFaltaProgramar--;\n\t\t}\n\n\t\t//dividir o tempo em qtdPocoesFaltaAdd vezes e deixar uma pocao para cada parcela desse tempo\n\t\tthis._intervaloCadaPocao = ControladorJogo.tempoEstimadoLevel(ControladorJogo.level) / this._qtdPocoesFaltaProgramar * 1000;\n\n\t\tthis._precisaSetarProgramarPocoes = this._jahProgramouDeixarPocaoTela;\n\t\t//se jah deixou programado de colocar uma pocao na tela e ainda nao tirou da tela, tem que esperar ela sair para programar de colocar a proxima pocao\n\t\t//nao tem como jah setar um Timer porque nao se saber quanto tempo falta para a pocao sair da tela\n\n\t\tif (!this._jahProgramouDeixarPocaoTela)\n\t\t\tthis._criarTmrsProgramarPocoes();\n\t}", "function productosPromociones(btn) {\n var producto = \"\";\n var precio = 0;\n if (btn === \"promo1\") {\n producto = \"Promoción Pollo y Papas\";\n precio = 10500;\n }\n if (btn === \"promo2\") {\n producto = \"Promoción Hamburguesas y Refrescos\";\n precio = 5000;\n }\n if (btn === \"promo3\") {\n producto = \"Promoción 2 X 3\";\n precio = 21400;\n }\n if (btn === \"promo4\") {\n producto = \"Oferta de Wantan\";\n precio = 2475;\n }\n agrega(producto, precio);\n}", "function activarHerramientaPerfil() {\n console.log(\"Activar herramienta perfil\");\n\n crearYCargarCapaLineaPerfil();\n activarControlDibujo();\n\n\n}", "function copiafyv(principal, copia) {\n try {\n /*Analizo primero el root principal */\n principal.lista_Nodo.forEach(function (element) {\n if (element.tipo == \"Clase\") {\n MYFPrincipal = [];\n MYFfCopia = [];\n /*por cada calse encontrada, la busco en el otro arbol*/\n copia.lista_Nodo.forEach(function (element2) {\n if (element2.tipo == \"Clase\") {\n /*Por cada clase que encuentro en el otro root compruebo si son los mismos*/\n if (element.descripcion == element2.descripcion) {\n /*recorro para encontrar los metodos y funciones de la clase principal*/\n element.lista_Nodo.forEach(function (element3) {\n if (element3.tipo == \"Funcion\") {\n MYFPrincipal.push(element3.descripcion);\n /*encontramos si tiene parametros la funcion*/\n element3.lista_Nodo.forEach(function (parametrosMF) {\n if (parametrosMF.tipo == \"Parametros\") {\n var parametroslst = returnLst(parametrosMF.lista_Nodo);\n element2.lista_Nodo.forEach(function (fmCopia) {\n if (fmCopia.tipo == \"Funcion\" && element3.tipodato == fmCopia.tipodato) {\n fmCopia.lista_Nodo.forEach(function (paramCopia) {\n if (paramCopia.tipo == \"Parametros\") {\n var parametroslstCopia = returnLst(paramCopia.lista_Nodo);\n if (parametroslst.toString() == parametroslstCopia.toString()) {\n console.log(\"las funciones \" + element3.descripcion + \" Son iguales en ambos archivos,por tener los mismos tipos de parametros en el mismo orden\" + \" de la calse \" + element.descripcion);\n MYFfCopia_Clase.push(element.descripcion);\n MYFfCopia.push(element3.descripcion);\n }\n }\n });\n }\n });\n }\n });\n }\n else if (element3.tipo == \"Metodo\") {\n MYFPrincipal.push(element3.descripcion);\n /*encontramos si tiene parametros la funcion*/\n element3.lista_Nodo.forEach(function (parametrosF) {\n if (parametrosF.tipo == \"Parametros\") {\n var parametroslstM = returnLst(parametrosF.lista_Nodo);\n element2.lista_Nodo.forEach(function (mCopia) {\n if (mCopia.tipo == \"Metodo\" && element3.descripcion == mCopia.descripcion) {\n mCopia.lista_Nodo.forEach(function (paramCopiaM) {\n if (paramCopiaM.tipo == \"Parametros\") {\n var parametroslstCopiaM = returnLst(paramCopiaM.lista_Nodo);\n if (parametroslstM.toString() == parametroslstCopiaM.toString()) {\n console.log(\"los metodos \" + element3.descripcion + \" Son iguales en ambos archivos,por tener los mismos tipos de parametros en el mismo orden\" + \" de la calse \" + element.descripcion);\n MYFfCopia.push(element3.descripcion);\n MYFfCopia.push(element3.descripcion);\n }\n }\n });\n }\n });\n }\n });\n }\n });\n if (MYFPrincipal.toString() == MYFfCopia.toString()) {\n console.log(\"las clases \" + element.descripcion + \" Son iguales en ambos archivos\");\n }\n }\n }\n });\n }\n });\n }\n catch (error) {\n }\n}", "function affichageCardsTravaux() {\n if (partieSolo) {\n if (arrayPlayCardTravaux[numberTour][0] == \"Solo\" || arrayPlayCardTravaux[numberTour + 1][0] == \"Solo\" || arrayPlayCardTravaux[numberTour + 2][0] == \"Solo\") {\n card1NumberElt.style.fontSize = \"60px\";\n card2NumberElt.style.fontSize = \"60px\";\n card3NumberElt.style.fontSize = \"60px\";\n\n cardPlanPoint11.style.display = 'none';\n cardPlanPoint21.style.display = 'none';\n cardPlanPoint31.style.display = 'none';\n }\n if (numberTour === 78) {\n alert(\"Fin de partie\");\n }\n }\n\n// Card 1\n card1NumberElt.innerText = arrayPlayCardTravaux[numberTour][0];\n affichageDosCardTravaux(arrayPlayCardTravaux[numberTour][1], card1ActionElt);\n \n affichageCardTravauxLittleLogo(arrayPlayCardTravaux[numberTour + 3][1], card1CoinElt);\n \n// Card 2 \n card2NumberElt.innerText = arrayPlayCardTravaux[numberTour + 1][0];\n affichageDosCardTravaux(arrayPlayCardTravaux[numberTour + 1][1], card2ActionElt);\n\n affichageCardTravauxLittleLogo(arrayPlayCardTravaux[numberTour + 4][1], card2CoinElt);\n \n// Card 3 \n card3NumberElt.innerText = arrayPlayCardTravaux[numberTour + 2][0];\n affichageDosCardTravaux(arrayPlayCardTravaux[numberTour + 2][1], card3ActionElt);\n\n affichageCardTravauxLittleLogo(arrayPlayCardTravaux[numberTour + 5][1], card3CoinElt);\n}", "function ejecucionPUE(cb) {\n PUEP(\"60d67e6809df6a0015937ede\", 1, \"PUE1\",2, 2, function () {\n PUEP(\"60d67e6809df6a0015937ede\", 2, \"PUE2\",2, 5, function () {\n PUEG(\"60d67e6809df6a0015937ede\", 1, \"PUE3\",4, 4, function () {\n PUEG(\"60d67e6809df6a0015937ede\", 0, \"PUE4\", 4,4, function () {\n PUEG(\"60d67e6809df6a0015937ede\", 2, \"PUE5\", 0,5, function(){\n PUEM(\"60d67e6809df6a0015937ede\", 2, textmas500,\"PUE6\", 1,5, function(){\n PUEB(\"60d67e6809df6a0015937ede\", 0, \"PUE7\", 3,3, function(){\n\n PUEM2(\"60d67e6809df6a0015937ede\", 2, \"PUE8\", 3, 3, function(){\n\n PUEG(\"CONSTANTINI\", 0, \"PUE9\", 5,5, function() {\n PUEM(\"60d67e6809df6a0015937ede\", 0, \"Hola\",\"PUE10\", 4,4, function(){\n cb(true);\n } )\n })\n })\n\n })\n })\n })\n })\n })\n })\n })\n}", "function procurarComida() {\n console.log()\n console.log(\"Você pega sua faca, enche o cantil de água e sai pra procurar o que comer... saudade do iFood?\")\n prompt(textos.enter)\n\n //pode ocorrer de achar frutas, achar caça, ou não achar nada\n let x = Math.random()\n if (x < 0.33) {\n //fruta\n let tempoCaminhada = calcTempo(10,30)\n let f = infos.frutaAleatoria()\n console.log(`Após caminhar por ${tempoCaminhada} minutos, você encontrou um pé de ${f.toLowerCase()}!`)\n console.log(\"Depois de descobrir que você não é um exímio catador de frutas, você consegue matar a fome e leva alguns frutos para casa\")\n prompt(textos.enter)\n infos.addItem(f)\n infos.fome = 100\n sede(-10);\n passaTempo(tempoCaminhada);\n mainJogo();\n\n }\n else if (x < 0.66) {\n //caça\n eventos.encontroAnimal()\n }\n else {\n //nada\n let tempoCaminhada = calcTempo(20,40)\n console.log(`Após caminhar por ${tempoCaminhada} minutos, você não encontrou nada para comer... e só fez ficar com mais fome e sede`)\n fome(-10);\n sede(-10);\n passaTempo(tempoCaminhada);\n mainJogo();\n\n }\n}", "function maisProdutos(){\n rl.question(\"Deseja acrescentar mais produtos a sacola?\\n 1 - Sim\\n 2 - Não\\n\", (opcao) =>{\n if(opcao === \"1\"){\n procurandoPedido();\n }else{\n listarSacola();\n }\n })\n}", "function prueba( req, res){\n\n res.status(200).json({\n ok: true,\n mensaje: 'Operación Satisfactoria Bien cred Mesas'\n });\n}", "function proposer(element){\n\t\t\t\t\t\n\t\t\t\t\t// Si la couleur de fond est lightgreen, c'est qu'on a déja essayé - on quitte la fonction\n\t\t\t\t\tif(element.style.backgroundColor==\"lightGreen\" ||fini) return;\n\t\t\t\t\t\n\t\t\t\t\t// On récupere la lettre du clavier et on met la touche en lightgreen (pour signaler qu'elle est cliqu�e)\n\t\t\t\t\tvar lettre=element.innerHTML;\n\t\t\t\t\tchangeCouleur(element,\"lightGrey\");\n\t\t\t\t\t\n\t\t\t\t\t// On met la variable trouve false;\n\t\t\t\t\tvar trouve=false;\n\t\t\t\t\t\n\t\t\t\t\t// On parcours chaque lettre du mot, on cherche si on trouve la lettre s�l�ectionn�e au clavier\n\t\t\t\t\tfor(var i=0; i<tailleMot; i++) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Si c'est le cas :\n\t\t\t\t\t\tif(tableauMot[i].innerHTML==lettre) {\n\t\t\t\t\t\t\ttableauMot[i].style.visibility='visible';\t// On affiche la lettre\n\t\t\t\t\t\t\ttrouve=true;\n\t\t\t\t\t\t\tlettresTrouvees++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// Si la lettre n'est pas présente, trouve vaut toujours false :\n\t\t\t\t\tif(!trouve){\n\t\t\t\t\t\tcoupsManques++;\n\t\t\t\t\t\tdocument.images['pendu'].src=\"asset/image/pendu_\"+coupsManques+\".jpg\"; // On change l'image du pendu\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Si on a rate 9 fois :\n\t\t\t\t\t\tif(coupsManques==8){\n\t\t\t\t\t\t\talert(\"Vous avez perdu !\");\n\t\t\t\t\t\t\tfor(var i=0; i<tailleMot; i++) tableauMot[i].style.visibility='visible';\n\t\t\t\t\t\t\tfini=true;\n\t\t\t\t\t\t\t// on affiche le mot, on fini le jeu\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(lettresTrouvees==tailleMot){\n\t\t\t\t\t\talert(\"Bravo ! Vous avez découvert le mot secret !\");\n\t\t\t\t\t\tfini=true;\n\t\t\t\t\t}\n\t\t\t\t}", "function ultimo_mes(){\n if(mes_actual!=0){\n mes_actual--;\n }else if(mes_actual==0){\n mes_actual=10;\n año_actual--;\n }\n dibujar_fecha();\n escribir_mes();\n escogerdia1();\n escogerdia2();\n}", "function decideMineFunc(avid){\n\tvar mineVal = $(\"#paraMine\").val();\n\t\tif(mineVal==1){\n\t\t\tsubtractMine(avid);\n\t\t}else{\n\t\t\tplusMine(avid);\n\t\t}\n\t}", "function procesarJugadores() {\r\n\t// Obtenemos todos los enlaces de tipo jugador y hacemos peticiones ajax a sus fichas.\r\n\tvar allEnlaces = document.getElementsByTagName(\"a\");\r\n\tfor (var e = 0; e < allEnlaces.length; e++) {\r\n\t\tvar enlaceActual = allEnlaces[e];\r\n\t\t// Si es un enlace correspondiente a un jugador, lo procesamos.\r\n\t\tif (enlaceActual.href.indexOf(\"plantilla_infojugador.asp?idjugador=\") != -1) {\r\n\t\t\tcontJugadoresEncontrados++;\r\n\t\t\tget(enlaceActual.href, procesarJugador, extraerIdJugador(enlaceActual), '');\r\n\t\t}\r\n\t}\r\n}", "function NotaFinal() {\r\n\r\n pregunta1();\r\n pregunta3();\r\n cor =\r\n parseFloat(tpre1) +\r\n parseFloat(tpre3);\r\n Calculo_nota();\r\n}", "function _DependenciasNivelConjurador() {\n // Niveis basicos de conjurador.\n gPersonagem.classes.forEach(function(entrada_classe) {\n var classe_tabela = tabelas_classes[entrada_classe.classe];\n if (classe_tabela.nivel_conjurador == null) {\n entrada_classe.nivel_conjurador = 0;\n entrada_classe.linha_tabela_feiticos = 0;\n } else {\n var nivel_minimo = classe_tabela.nivel_conjurador.minimo || 0;\n if (entrada_classe.nivel < nivel_minimo) {\n entrada_classe.nivel_conjurador = 0;\n entrada_classe.linha_tabela_feiticos = 0;\n return;\n }\n var modificador_nivel_conjurador = classe_tabela.nivel_conjurador.modificador || 0;\n entrada_classe.nivel_conjurador = Math.floor(entrada_classe.nivel * modificador_nivel_conjurador);\n entrada_classe.linha_tabela_feiticos = entrada_classe.nivel;\n }\n });\n // Niveis incrementais de conjurador.\n gPersonagem.classes.forEach(function(classe_personagem_modificadora) {\n var classe_tabela = tabelas_classes[classe_personagem_modificadora.classe];\n if (classe_tabela.incremento_nivel_conjurador == null) {\n return;\n }\n classe_tabela.incremento_nivel_conjurador.forEach(function(tipo) {\n var classe_personagem = PersonagemMaiorClasseConjurador(tipo);\n if (classe_personagem == null) {\n return;\n }\n classe_personagem.nivel_conjurador += classe_personagem_modificadora.nivel;\n classe_personagem.linha_tabela_feiticos += classe_personagem_modificadora.nivel;\n });\n });\n}", "function probabilidadDeNClient1(po, intesidad, n, callback){\n return callback(intesidad, n) * po\n}", "function esProtesisf(diente, codigopieza){\n\t\t\n\t\tvar esProtesisf = false;\n\t\tvar color = 'blue';\n\t\tvar pdiente = \"\"; //primer diente\n\t\tvar udiente = \"\"; // ultimo diente\n\t\tvar protesisfcompleto = false;\n\t\tvar salida ='';\n\n\t\tvar esCor = false;\n\t\tvar color = 'blue';\n\n\t\tvar trat_protesisf = ko.utils.arrayFilter(vm.tratamientosAplicados(), function(t){\n\t\t\treturn t.tratamiento.id == codigopieza;\n\t\t});\t\n\n\t\ttry {\n\n \tfor (var i = 0; i <= trat_protesisf.length - 1; i++) {\n\t\t\tvar t = trat_protesisf[i];\n \n // Si esta completo el puente\n if (t.diente.id.indexOf('_') > -1) { \n\t\t pdiente = t.diente.id.substring(0, t.diente.id.indexOf('_'));\t\n\t\t\t udiente = t.diente.id.substring(t.diente.id.lastIndexOf('_')+3, t.diente.id.length - t.diente.id.lastIndexOf('_'));\n\n // si estan definidos ambos dientes del puente devuelvo el tratamiento\n\t\t\t if(pdiente>0 && udiente>0 && diente.id==pdiente){ \n\t\t\t \t esProtesisf = true;\n\t\t\t \t protesisfcompleto = true;\n\n\t\t if (t.tratamiento.id == \"01.09\" || t.tratamiento.id == \"01.03\" || t.tratamiento.id == \"01.10\"){\n\t\t\t\t\t color = t.tratamiento.color;\n\t\t } \n\t\t\t \t salida=[esProtesisf,color,pdiente,udiente, protesisfcompleto];\n\t\t\t }\n\t\t\t // con que uno este definido ya es puente\n\t\t\t if(pdiente>0 && udiente>0 && diente.id==pdiente){ \n\t\t\t \t esProtesisf = true;\n\t\t\t \t salida=[esProtesisf,color,pdiente,udiente, protesisfcompleto];\n\t\t\t }\n\t\t\t \n\t\t\t} \n\t\t};\n \n }\n catch(err) {\n\t\t \n\t\t}\n \treturn salida;\n\n\t}", "function NotaFinal() {\r\n var pre1a = document.getElementById(\"pre1a\").value;\r\n if (pre1a == \"\") {\r\n alert(\"Pregunta 1: Califiqué la pregunta\");\r\n } else {\r\n var pre2a = document.getElementById(\"pre2a\").value;\r\n if (pre2a == \"\") {\r\n alert(\"Pregunta 2: Califiqué la pregunta\");\r\n } else {\r\n pregunta1();\r\n pregunta2();\r\n pregunta3();\r\n cor =\r\n parseFloat(tpre1) +\r\n parseFloat(tpre2) +\r\n parseFloat(tpre3);\r\n Calculo_nota();\r\n }\r\n }\r\n}", "function twpro_calculateJobs() {\r\n\t\tif (TWPro.twpro_failure) return;\r\n\t\tvar twpro_setitembonus;\r\n\t\tvar twpro_setitemjobname;\r\n\t\tfor (var twpro_wear in Wear.wear) {\r\n\t\t\tTWPro.twpro_prepareItem(Wear.wear[twpro_wear].obj);\r\n\t\t}\r\n\t\tvar bagitems = Bag.getInstance().items;\r\n\t\tfor (var twpro_bag in bagitems) {\r\n\t\t\tTWPro.twpro_prepareItem(bagitems[twpro_bag].obj);\r\n\t\t}\r\n\t\tTWPro.twpro_calculated = false;\r\n\t\t\r\n\t\t// alle Setberechnungen löschen\r\n\t\tTWPro.twpro_setItemsCalc = {};\r\n\t\tTWPro.twpro_setItemsEffect = false;\r\n\t\tfor (var twpro_i = 0; twpro_i < TWPro.twpro_bag.twpro_types.length; twpro_i++) {\r\n\t\t\tTWPro.twpro_setItemsCalc[TWPro.twpro_bag.twpro_types[twpro_i]] = [null];\r\n\t\t}\r\n\t\t\r\n\t\t// Check ob Berechnung nötig und Flags setzen --> für 1er Sets müsste hier von >=2 auf >=1 geändert werden\r\n\t\tTWPro.twpro_setCount = {};\r\n\t\tfor (var twpro_setItemId in TWPro.twpro_setItems) {\r\n\t\t\tvar twpro_setItem = TWPro.twpro_setItems[twpro_setItemId];\r\n\t\t\tif (twpro_setItem.twpro_wearable && TWPro.twpro_setItemsCount[twpro_setItem.set.key] >= 2) {\r\n\t\t\t\tTWPro.twpro_setItemsCalc[twpro_setItem.type].push(twpro_setItem);\r\n\t\t\t\tTWPro.twpro_setCount[twpro_setItem.set.key] = 0;\r\n\t\t\t\tTWPro.twpro_setItemsEffect = true;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\tif(!TWPro.twpro_re_att){\r\n\t\t\tTWPro.twpro_re_att = {};\r\n\t\t\tTWPro.twpro_re_skill = {};\r\n\t\t\tTWPro.twpro_re_skills = {};\r\n\t\t\tfor(var twpro_attname in Character.skill_names){\r\n\t\t\t\tvar skill_names = Character.skill_names[twpro_attname];\r\n\t\t\t\tTWPro.twpro_re_skills[twpro_attname] = new RegExp(skill_names.join('|'), 'g');\r\n\t\t\t\tTWPro.twpro_re_att[twpro_attname] = new RegExp(twpro_attname, 'g');\r\n\t\t\t\tfor(var i=0; i<skill_names.length; i++){\r\n\t\t\t\t\tTWPro.twpro_re_skill[skill_names[i]] = new RegExp(skill_names[i], 'g');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar re_char_skills = /Character\\.skills\\./g;\r\n\t\tfor (var twpro_i=0; twpro_i<TWPro.twpro_jobs.length; twpro_i++) {\r\n\t\t\tvar twpro_job = TWPro.twpro_jobs[twpro_i];\r\n\t\t\ttwpro_job.twpro_jobid = twpro_i;\r\n\t\t\ttwpro_job.twpro_skill = eval(twpro_job.twpro_calculation);\r\n\t\t\ttwpro_job.twpro_skills = twpro_job.twpro_calculation.replace(/ \\+ \\d+$/, '').replace(re_char_skills, '');\r\n\t\t\ttwpro_job.twpro_attributes = twpro_job.twpro_skills.replace(re_char_skills, '');\r\n\t\t\tfor (var twpro_attname in Character.skill_names) {\r\n\t\t\t\ttwpro_job.twpro_attributes = twpro_job.twpro_attributes.replace(TWPro.twpro_re_skills[twpro_attname], twpro_attname);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Hier folgt Setberechnung, wenn oben Flag gesetzt wurde\r\n\t\t\tif (TWPro.twpro_setItemsEffect && !TWPro.twpro_setBonusParsed) {\r\n\t\t\t\tfor (var twpro_itemSet in TWPro.twpro_setBonus) {\r\n\t\t\t\t\tvar twpro_itemSetBouns = TWPro.twpro_setBonus[twpro_itemSet];\r\n\t\t\t\t\t// Berechnung ab hier auch für twpro_j=1 (war vorher 2) um auch 1er Sets zu berücksichtigen)\r\n\t\t\t\t\tfor (var twpro_j = 2; twpro_j < twpro_itemSetBouns.length; twpro_j++) {\r\n\t\t\t\t\t\ttwpro_setitembonus = twpro_itemSetBouns[twpro_j];\r\n\t\t\t\t\t\ttwpro_setitemjobname = twpro_job.shortName;\r\n\t\t\t\t\t\ttwpro_setitembonus.parsedBonus[twpro_setitemjobname] = (twpro_job.malus == -1 ? 0 : twpro_setitembonus.jobBonus.all) +\r\n\t\t\t\t\t\t(!twpro_setitembonus.jobBonus[twpro_setitemjobname] ? 0 : twpro_setitembonus.jobBonus[twpro_setitemjobname]) + TWPro.twpro_testItem(twpro_job, twpro_setitembonus);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\ttwpro_job.twpro_bestStats = {};\r\n\t\t\tfor (var twpro_j = 0; twpro_j < TWPro.twpro_bag.twpro_types.length; twpro_j++) {\r\n\t\t\t\ttwpro_job.twpro_bestStats[TWPro.twpro_bag.twpro_types[twpro_j]] = 0;\r\n\t\t\t}\r\n\t\t\tfor (var twpro_wear in Wear.wear) {\r\n\t\t\t\tTWPro.twpro_compareItem(twpro_job, Wear.wear[twpro_wear].obj);\r\n\t\t\t}\r\n\t\t\tfor (var twpro_bag in bagitems) {\r\n\t\t\t\tTWPro.twpro_compareItem(twpro_job, bagitems[twpro_bag].obj);\r\n\t\t\t}\r\n\t\t\ttwpro_job.twpro_aps = twpro_job.twpro_skill - Math.max(0, twpro_job.malus);\r\n\t\t\tfor (var twpro_type in twpro_job.twpro_bestStats) {\r\n\t\t\t\ttwpro_job.twpro_aps += twpro_job.twpro_bestStats[twpro_type];\r\n\t\t\t}\r\n\t\t\tif (TWPro.twpro_setItemsEffect) {\r\n\t\t\t\tvar twpro_setItem;\r\n\t\t\t\ttwpro_job.twpro_parsedItemBonus = {};\r\n\t\t\t\ttwpro_job.twpro_bestCombi = {};\r\n\t\t\t\tfor (var twpro_type in twpro_job.twpro_bestStats) {\r\n\t\t\t\t\ttwpro_job.twpro_bestCombi[twpro_type] = 0;\r\n\t\t\t\t\tfor (var twpro_j = 1; twpro_j < TWPro.twpro_setItemsCalc[twpro_type].length; twpro_j++) {\r\n\t\t\t\t\t\ttwpro_setItem = TWPro.twpro_setItemsCalc[twpro_type][twpro_j];\r\n\t\t\t\t\t\ttwpro_job.twpro_parsedItemBonus[twpro_setItem.item_id] = TWPro.twpro_testItem(twpro_job, twpro_setItem);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\ttwpro_job.twpro_noSetAps = twpro_job.twpro_aps;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (TWPro.twpro_setItemsEffect) {\r\n\t\t\tTWPro.twpro_calcSets();\r\n\t\t}\r\n\t\tfor(var i=0; i<TWPro.twpro_jobs.length; i++){\r\n\t\t\tvar twpro_job = TWPro.twpro_jobs[i],\r\n\t\t\t\tn = 1;\r\n\t\t\tif(Character.characterClass == 'worker' && twpro_job.shortName == 'construct'){\r\n\t\t\t\tn = 1.05;\r\n\t\t\t}\r\n\tTWPro.twpro_jobValues[twpro_job.shortName].laborp = twpro_job.twpro_aps = Math.floor(n*twpro_job.twpro_aps);\r\n\t\r\n\t\t}\r\n\t\tTWPro.twpro_setBonusParsed = true;\r\n\t\tTWPro.twpro_invHash = TWPro.twpro_invHashTest.join(',');\r\n\t\tTWPro.twpro_calculated = true;\r\n\t}", "function calcularPromedio() {\n const notas = [];\n let suma = 0;\n const notaParcial1 = prompt('Ingrese nota del primer parcial');\n const notaParcial2 = prompt('Ingrese nota del segundo parcial');\n const notaProyectoFinal = prompt('Ingrese nota del proyecto final');\n\n notas.push(notaParcial1);\n notas.push(notaParcial2);\n notas.push(notaProyectoFinal);\n\n for (let indice = 0; indice < notas.length; indice++) {\n // const element = notas[indice];\n suma = suma + parseInt(notas[indice]);\n }\n\n const promedio = suma / notas.length;\n\n if (promedio >= 6) {\n console.log('Aprobó la materia');\n } else {\n console.log('Desaprobó la materia 😣');\n }\n\n console.log(notas);\n\n}", "function mensajes(respuesta){\n\n\t\t\t\tvar foo = respuesta;\n\n\t\t\t\t\tswitch (foo) {\n\n\t\t\t\t\t\tcase \"no_exite_session\":\n\t\t\t\t\t\t//============================caso 1 NO EXISTE SESSION==================//\n\t\t\t\t\t\tswal(\n\t\t\t\t\t\t\t\t'Antes de comprar Inicia tu Session en la Pagina?',\n\t\t\t\t\t\t\t\t'Recuerda si no tienes cuenta en la pagina puedes registrarte?',\n\t\t\t\t\t\t\t\t'question'\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\tbreak;\n\n\n\t\t\t\t\t\tcase \"saldo_insuficiente\":\n\t\t\t\t\t\t//==============CASO 2 SALDO INSUFICIENTE=======================//\n\n\t\t\t\t\t\tswal({\n\t\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\t\ttitle: 'Oops...',\n\t\t\t\t\t\t\ttext: 'Tu saldo es insuficiente para poder realizar la trasaccion, recarga tu monedero e intenta de nuevo',\n\t\t\t\t\t\t\tfooter: 'Puedes recargas tu saldo con nostros mas informacion en nuestras redes sociales'\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak;\n\n\n\n\t\t\t\t\t}\n\t\t\t}", "function jogar(escolha){\n\tjogadorEscolha = escolha;\n\tselecionar('jogador',jogadorEscolha);\n\t//sortear jogada do computador\n\tcomputadorEscolha = sortear(1,3);\n\tselecionar('computador',computadorEscolha);\n\t//calcular quem ganhou, somar pontos e exibir para o usuario\n\tvar ganhador = calcularEscolha(jogadorEscolha, computadorEscolha);\n\tif(ganhador==0){ mensagem('Empate!'); }\n\t\telse if (ganhador==1) {\n\t\t\tmensagem('Ponto para '+jogadorNome+'!');\n\t\t\tsomarPontoJogador();\n\t\t}\n\t\telse if (ganhador==2) { \n\t\t\tmensagem('Ponto para computador!');\n\t\t\tsomarPontoComputador();\n\t\t}\n\tsetTimeout(function() { \n\t\tdeselecionar('jogador');\n\t\tdeselecionar('computador');\n\t\tmensagem(jogadorNome + ', escolha uma opção acima..');\n\t}, 2000);\n}", "getBuscaProfundidade(verticeEscolhido) {\n\t\tif(this.trep == 1) {\n\t\t\tlet lista = this.getRepresentacao()\n\t\t\tlet quantVertice = this.getQNos()\n\t\t\tlet principal = verticeEscolhido\n\t\t\tlet backtracking = [];\n\t\t\tlet buscaProf = [];\n\t\t\tlet arrayVertices = [];\n\t\t\tlet tempo = 0;\n\n\t\t //Criação de uma lista de array contendo todos os vertices diferentes do\n\t\t //vertice escolhido pelo usuário\n\t\t for(let i = 0; i < quantVertice; i++) {\n\t\t \tif(verticeEscolhido != i) arrayVertices.push(i);\n\t\t }\n\t\t /*Estrutura auxiliar de array bidimensional contendo na primeira posição da\n\t\t segunda dimensão um objeto tendo cor, tempo da primeira passagem,\n\t\t tempo da segunda passagem e antecessor. Na segunda posição da mesma dimensão a grafo*/\n\t\t for(let i = 0; i < quantVertice; i++){\n\t\t \tbuscaProf[i] = {\n\t\t \t\tcor: \"branco\",\n\t\t \t\ttempoInicial: \"indef\",\n\t\t \t\ttempoFinal: \"indef\",\n\t\t \t\tantecessor: \"indef\",\n\t\t \t\tadj: lista[i]\n\t\t \t}\n\t\t }\n while(arrayVertices.length > 0){\n\n\t\t \tif(buscaProf[verticeEscolhido].cor == \"branco\"){\n\n\t\t \t\tbuscaProf[verticeEscolhido].cor = \"cinza\"\n\t\t \t\tbuscaProf[verticeEscolhido].tempoInicial = ++tempo\n\t\t \t\tbuscaProf[verticeEscolhido].antecessor = null\n\n\t\t \t\tbacktracking.push(verticeEscolhido);\n\n\t\t \t\tvar verticeSecundario\n\n\t\t \t\twhile(backtracking.length > 0){\n\n\t\t \t\t\tif(buscaProf[verticeEscolhido].adj.length > 0){\n\n\t\t \t\t\t\tverticeSecundario = buscaProf[verticeEscolhido].adj.shift().vertice;\n\n\t\t \t\t\t\tif(buscaProf[verticeSecundario].cor == \"branco\"){\n\n\t\t \t\t\t\t\tbuscaProf[verticeSecundario].cor = \"cinza\"\n\t\t \t\t\t\t\tbuscaProf[verticeSecundario].tempoInicial = ++tempo\n\t\t \t\t\t\t\tbuscaProf[verticeSecundario].antecessor = verticeEscolhido\n\t\t \t\t\t\t\tbacktracking.push(verticeEscolhido)\n\t\t \t\t\t\t\tverticeEscolhido = verticeSecundario\n\t\t \t\t\t\t}\n\n\n\t\t \t\t\t}\n\t\t \t\t\telse{\n\t\t \t\t\t\tbuscaProf[verticeEscolhido].cor = \"preto\"\n\t\t \t\t\t\tbuscaProf[verticeEscolhido].tempoFinal = ++tempo\n\t\t \t\t\t\tverticeEscolhido = backtracking.pop()\n\n\t\t \t\t\t}\n\t\t \t\t}\n\n\t\t \t}\n\t\t \tverticeEscolhido = arrayVertices.shift();\n\t\t }\n\n\t\t buscaProf[principal].antecessor = null\n\n\t\t return buscaProf;\n\t\t}\n\t\telse {\n\t\t\tlet matriz = this.getRepresentacao()\n\t\t\tlet quantVertice = this.getQNos()\n\t\t\tlet principal = verticeEscolhido\n\t\t\tlet backtracking = []\n\t\t\tlet buscaProf = []\n\t\t\tlet arrayVertices = []\n\t\t\tlet tempo = 0\n\n\t\t\tfor(let i = 0; i < quantVertice; i++) {\n\t\t\t\tif(verticeEscolhido != i) arrayVertices.push(i);\n\t\t\t}\n\n\t\t\tfor(let j = 0; j < quantVertice; j++){\n\t\t\t\tvar obj = {\n\t\t\t\t\tcor: \"branco\",\n\t\t\t\t\ttempoInicial: \"indef\",\n\t\t\t\t\ttempoFinal: \"indef\",\n\t\t\t\t\tantecessor: \"indef\"\n\t\t\t\t}\n\t\t\t\tbuscaProf[j] = obj\n\t\t\t}\n //contador de vertices, recebe a quantidade de vértices - 1, para ir até o penúltimo na busca\n\t\t\tlet contVert = quantVertice - 1\n\n\t\t\twhile(contVert > 0){\n\t\t\t\tif(buscaProf[verticeEscolhido].cor == \"branco\"){\n\t\t\t\t\tbuscaProf[verticeEscolhido].cor = \"cinza\"\n\t\t\t\t\tbuscaProf[verticeEscolhido].tempoInicial = ++tempo\n\t\t\t\t\tbuscaProf[verticeEscolhido].antecessor = null\n\n\t\t\t\t\tbacktracking.push(verticeEscolhido)\n\n\t\t\t\t\tvar verticeSecundario\n\n\n\t\t\t\t\twhile(backtracking.length > 0){\n\n\t\t\t\t\t\tfor(verticeSecundario = 0; verticeSecundario < quantVertice; verticeSecundario++){\n\t\t\t\t\t\t\tif(matriz[verticeEscolhido][verticeSecundario] != \"inf\"){\n\t\t\t\t\t\t\t\tif(buscaProf[verticeSecundario].cor == \"branco\"){\n\t\t\t\t\t\t\t\t\tbuscaProf[verticeSecundario].cor = \"cinza\"\n\t\t\t\t\t\t\t\t\tbuscaProf[verticeSecundario].tempoInicial = ++tempo\n\t\t\t\t\t\t\t\t\tbuscaProf[verticeSecundario].antecessor = verticeEscolhido\n\n\t\t\t\t\t\t\t\t\tbacktracking.push(verticeEscolhido)\n\t\t\t\t\t\t\t\t\tverticeEscolhido = verticeSecundario\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(verticeSecundario == quantVertice){\n\t\t\t\t\t\t\tbuscaProf[verticeEscolhido].cor = \"preto\"\n\t\t\t\t\t\t\tbuscaProf[verticeEscolhido].tempoFinal = ++tempo\n\t\t\t\t\t\t\tverticeEscolhido = backtracking.pop()\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tverticeEscolhido = arrayVertices.shift();\n\t\t\t\tcontVert--\n\t\t\t}\n\n\t\t\tbuscaProf[principal].antecessor = null\n\t\t\treturn buscaProf\n\t\t}\n }", "function desbloquearCamposHU(){\n\t\tif(tieneRol(\"cliente\")){//nombre, identificador, prioridad, descripcion y observaciones puede modificar, el boton crear esta activo para el\n\t\t\n\t\t}\n\t\tif(tieneRol(\"programadror\")){// modificar:estimacion de tiempo y unidad dependencia responsables, todos los botones botones \n\t\t\n\t\t}\n\t}", "function comportement (){\n\t }", "function NotaFinal() {\r\n var pre1a = document.getElementById(\"pre1a\").value;\r\n if (pre1a == \"\") {\r\n alert(\"Pregunta 1: Califiqué la pregunta\");\r\n } else {\r\n var pre2a = document.getElementById(\"pre2a\").value;\r\n if (pre2a == \"\") {\r\n alert(\"Pregunta 2: Califiqué la pregunta\");\r\n } else {\r\n pregunta1();\r\n pregunta2();\r\n pregunta3();\r\n pregunta4();\r\n pregunta5();\r\n pregunta6();\r\n pregunta7();\r\n pregunta8();\r\n var Nf =\r\n parseFloat(tpre1) +\r\n parseFloat(tpre2) +\r\n parseFloat(tpre3) +\r\n parseFloat(tpre4) +\r\n parseFloat(tpre5) +\r\n parseFloat(tpre6) +\r\n parseFloat(tpre7) +\r\n parseFloat(tpre8);\r\n var Vtotal = Nf.toFixed(2);\r\n $(\"#txtNota\").html(Vtotal);\r\n document.getElementById(\"bt_comprobar\").disabled = true;\r\n }\r\n }\r\n}", "async function grilleProduits() {\n let textGrille = \"\";\n let destinationGrille = document.getElementById(\"grille__produits\");\n\n await panierNounours();\n\n if(mesNounours == null || mesNounours.length == 0){\n destinationGrille.innerHTML =\n `\n <div id=\"panier__grille--vide\"> \n <p>Il n' y a actuellement aucun produit dans votre panier.</p>\n </br>\n <i class=\"far fa-frown\"></i>\n </div>\n `\n \n } else {\n mesNounours.forEach(nounours => (\n textGrille += \n `\n <div class=\"grille__conteneurcarte\">\n <img class=\"grille__miniature\" src=\"${nounours.imageUrl}\"></img>\n <p class=\"grille__nomArticle\"> ${nounours.name}</p>\n <p class=\"grille__prixArticle\"> <strong>${(nounours.price/100).toFixed(2)} €</strong> </p>\n <i class=\"fas fa-trash-alt bouton__poubelle\"></i>\n </div>\n `\n ))\n destinationGrille.innerHTML = textGrille;\n\n // Calcul du prix total\n\n prixTotal = 0;\n for(let nounours of mesNounours){\n prixTotal += nounours.price;\n }\n\n // Injection du prix total\n\n let textPrix = \n `\n <div class=\"conteneur__prix\">\n <p><strong>Prix total :<strong></p>\n <P><strong>${(prixTotal/100).toFixed(2)} €<strong></p>\n </div>\n `\n destinationGrille.innerHTML += textPrix;\n\n // Ajout eventlistener sur la poubelle\n\n let mesPoubelles = document.getElementsByClassName(\"bouton__poubelle\");\n for(let i=0; i<mesPoubelles.length; i++){\n mesPoubelles[i].addEventListener(\"click\",function(){\n mesNounours.splice(i,1);\n localStorage.setItem(\"panier\", JSON.stringify(mesNounours));\n location.reload();\n })\n }\n }\n \n // Ajout de l'event listener fonction au bouton\n document.getElementById(\"validationButton\").addEventListener(\"click\", envoi)\n}", "function UtilPoFo() {\r\n if (perso.Pinv[0] != 0) { //Test si il reste des potion\r\n if (perso.Pfor >= 100) { //Test si le maximum est atteint\r\n alert(\"Vous avez atteint la force maximale\");\r\n console.log(\"Force au max / nombre de potion = \"+ perso.Pinv[0]);\r\n } else {\r\n perso.Pinv[0] -= 1; // -1 potion\r\n perso.Pfor += 1; // +1 caracteristique\r\n document.getElementById('nbPoFo').value = perso.Pinv[0]; //affichage du nombre de potion dans l'inventaire\r\n document.getElementById('force').value = perso.Pfor; //affichage de la force dans les caractéristique\r\n console.log(\"Utilisation d'une potion de force / nombre de potion = \"+ perso.Pinv[0]);\r\n console.log(\"La force de \"+ perso.Pnom + \" monte a \"+perso.Pfor);\r\n }\r\n } else {\r\n alert(\"Vous n'avez plus de potion\");\r\n console.log(\"Pas de potion de force / nombre de potion = \"+ perso.Pinv[0]);\r\n }\r\n\r\n}", "function verificar(){\n if(respostas[0]==frase1){\n botaoMudar = createButton('Proxima');\n botaoMudar.position(140, 90);\n botaoMudar.mousePressed(mudarFase); // tela 5\n }\nif(respostas[1]==frase1){\n botaoMudar = createButton('Proxima');\n botaoMudar.position(140, 90);\n botaoMudar.mousePressed(mudarFase);// tela 2\n}\n\n if(respostas[2]==frase1){\n botaoMudar = createButton('Proxima');\n botaoMudar.position(140, 90);\n botaoMudar.mousePressed(mudarFase) //tela 6\n }\n \n if(respostas[3]==frase1){\n botaoMudar = createButton('Proxima');\n botaoMudar.position(140, 90);\n botaoMudar.mousePressed(mudarFase) //tela 6\n }\n \n if(respostas[4]==frase1){\n botaoMudar = createButton('Proxima');\n botaoMudar.position(140, 90);\n botaoMudar.mousePressed(mudarFase) //tela 6\n }\n\n if(respostas[5]==frase1){\n botaoMudar = createButton('Proxima');\n botaoMudar.position(140, 90);\n botaoMudar.mousePressed(mudarFase) //tela 6\n }\n \n if(respostas[6]==frase1){\n botaoMudar = createButton('Proxima');\n botaoMudar.position(140, 90);\n botaoMudar.mousePressed(mudarFase) //tela 6\n }\n\n if(respostas[7]==frase1){\n botaoMudar = createButton('Proxima');\n botaoMudar.position(140, 90);\n botaoMudar.mousePressed(mudarFase) //tela 6\n }\n \n if(respostas[8]==frase1){\n botaoMudar = createButton('Proxima');\n botaoMudar.position(140, 90);\n botaoMudar.mousePressed(mudarFase) //tela 6\n }\n \n if(respostas[9]==frase1){\n botaoMudar = createButton('Proxima');\n botaoMudar.position(140, 90);\n botaoMudar.mousePressed(mudarFase) //tela 6\n }\n \n //muda de fase\nfunction mudarFase(){\n //tela=2\n inp.value(\"\");\n botaoMudar.hide();//tela 5\n\nif(tela==5){\n tela=2\n}else{\n if(tela==2){\n tela=6\n }else{ \n if(tela==6){\n tela=7\n }\n else{\n if(tela==7){\n tela=8\n }\n else{\n if(tela==8){\n tela=9\n }\n else{\n if(tela==9){\n tela=10\n }\n else{\n if(tela==10){\n tela=11\n }\n else{\n if(tela==11){\n tela=12\n }\n else{\n if(tela==12){\n tela=13\n }\n else{\n if(tela==13){\n tela=14\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}\n\n\n /*function mudarFase(){\n tela=6;\n inp.value(\"\");\n botaoMudar.hide();// tela 2\n}*/\n \n}\n}", "function probaDeEspera(intesidad, numServ, po){\n return ((intesidad**numServ) * 2 * po)/(factorial(numServ) * (numServ - intesidad))\n}", "function fnc_child_cargar_valores_iniciales() {\n\n}", "function prozori() {\n confirm(\"Odabrali ste nacin placanja Gotovina\");\n}", "function isAllValidationsOk() {\n\n if (jQuery.isEmptyObject(dataOrder.order.products)) {\n showNotification('info', 'Aviso', 'No puede cerrar ventas vacías.');\n return false;\n }\n\n if (isCreditClient && $('#input-pi-tag').val().trim() === '') {\n showNotification('info', 'Aviso', 'El campo TAG es obligatorio para los clientes a crédito.');\n return false;\n }\n\n if ($('#switch-pi-prod').prop('checked') || $('#switch-pi-late-prod').prop('checked')) {\n if ($('#pi-fecha').val() === '') {\n showNotification('info', 'Aviso', 'Debe especificar una fecha de entrega.');\n return false;\n }\n\n if ($('#pi-hora').val() === '0') {\n showNotification('info', 'Aviso', 'Debe especificar una hora de entrega.');\n return false;\n }\n\n if ($('#pi-sucursal-prod').val() === '0') {\n showNotification('info', 'Aviso', 'Debe especificar la sucursal de producción.');\n return false;\n }\n\n if ($('#pi-sucursal-deliv').val() === '0') {\n showNotification('info', 'Aviso', 'Debe especificar la sucursal de entrega.');\n return false;\n }\n }\n\n if (Math.abs($('#pi-input-transfer').val()) > 0 && $('#pi-pt-comprobante').val() === '') {\n showNotification('info', 'Aviso', 'Debe proporcionar el comprobante para el pago por transferencia.');\n return false;\n }\n\n if (dataOrder.order.clientId === ID_NACIONAL && $('#pi-input-soli-nacional').val().trim() === '') {\n showNotification('info', 'Aviso', 'Debe especificar el nombre de la persona que solicita el trabajo para NACIONAL.');\n $('#div-soli-nacional').show();\n return false;\n }\n\n if (isCreditClient && tipo_venta !== 'CRÉDITO' && asked_for_credit === false) {\n Swal.fire({\n title: 'Sugerencia',\n text: 'El tipo de venta sugerido para este cliente es CRÉDITO, ¿desea procesarlo como tal?',\n type: 'question',\n showCancelButton: true,\n confirmButtonText: 'Procesar como CRÉDITO',\n cancelButtonText: 'No, gracias',\n allowOutsideClick: false\n }).then((result) => {\n if (result.value) {\n setTipoPago('credito');\n } else {\n asked_for_credit = true;\n cerrarVenta();\n }\n });\n return false;\n }\n\n if ($('#switch-pi-prod').prop('checked') || $('#switch-pi-late-prod').prop('checked')) {\n if (entregaAntesDeHoy()) {\n showNotification('info', 'Aviso', 'No puede agendar ordenes de trabajos para días pasados.');\n return false;\n }\n\n let produce_otra_sucursal = parseInt($('#pi-sucursal-prod').val()) !== Poster.settings.spotId;\n\n if (getHoraActual() >= 12 && produce_otra_sucursal && entregaEsHoy()) {\n showNotification('info', 'Aviso', 'A partir del medio día, las ordenes de trabajo producidas en otra sucursal no pueden ser agendadas para el día de hoy.');\n return false;\n }\n\n if (entregaEsHoy() && produce_otra_sucursal && parseInt($('#pi-hora').val()) < 18) { // 18 hrs = 6 pm\n showNotification('info', 'Aviso', 'No puede agendar para antes de las 6 p.m. una orden que será procesada en otra sucursal.');\n return false;\n }\n }\n\n return true;\n}", "function processParticipation(result) {\n \n}", "function specialClic() {\n if (presenceEnnemi===0){\n dialogBox(\"Tu veux t'amuser à faire de l'esbrouffe sans spectateurs ? T'es quel genre de gars ? Le genre à boire tout seul chez lui ? A faire tourner les serviettes lors d'un dîner en tête à tête avec ton chat ? Garde ton energie pour tes prochaines rencontres.\")\n }else if (presenceEnnemi===1){\n if(specialReboot <3){\n dialogBox(\"Tu dois encore attendre pour relancer un special, t'es fou ou quoi ? T'ES UN CHEATER UN TRUC DU GENRE ? NAN MAIS T'ES QUI POUR VOULOIR ENVOYER DES COUPS SPECIAUX H24, TA MERE ELLE T'A EDUQUé COMMENT AU JUSTE ?\");\n }else if(specialReboot ===3){\n document.getElementById(\"aventure\").innerHTML += (\"</br></br>COUP SPECIAL DE LA MORT QUI TACHE</br>Attend trois actions pour pouvoir relancer le bouzin\");\n switch (classeChoisie){\n \n \n case \"guerrier\":\n \n rndEnnemi.esquive = Number(15);\n degatAssomoir = Number(personnage.force*2);\n rndEnnemi.sante = rndEnnemi.sante - degatAssomoir;\n document.getElementById(\"santeEnnemi\").innerHTML = rndEnnemi.sante;\n document.getElementById(\"aventure\").innerHTML += (\"</br></br>Votre coup était SANS SOMMATION, votre adversaire en est tout étourdi et il semble perdre en agilité, il aura du mal à esquiver vos prochains coups, et vous lui infligez \"+degatAssomoir+\" point de dégats dans sa teuté.</br>\");\n \n break;\n \n case \"moine\":\n \n personnage.esquive = personnage.esquive - 15;\n personnage.sante = personnage.sante + 250;\n document.getElementById(\"santePerso\").innerHTML = personnage.sante;\n document.getElementById(\"esquivePerso\").innerHTML = personnage.esquive;\n document.getElementById(\"aventure\").innerHTML += (\"</br></br>Vous sortez une fiole de votre poche et prenez une lampée, vous vous santez en meilleure forme, mais votre agilité en prend un coup ! Avec modération s'il vous plait !</br>\");\n \n break;\n\n case \"mage\":\n\n //Decide d'une invocation random parmis 3 possibles\n\n var Min= Number(1)\n var Max= Number(3)\n\n function getRndInterger(min, max) {\n return Math.floor(Math.random() * (max - min + 1) ) + min;}\n incantation = getRndInterger(Min, Max);\n document.getElementById(\"aventure\").innerHTML += (\"</br></br>Les incantations d'Akimieumieu sont instables, vous vous concentrez et \");\n \n\n switch (incantation){\n case (1) :\n incantationName=\"BOULE DE SHNECK ULTRA\";\n degatBoule= (rndEnnemi.sante/2)+30;\n rndEnnemi.sante = rndEnnemi.sante - degatBoule;\n document.getElementById(\"santeEnnemi\").innerHTML = rndEnnemi.sante;\n document.getElementById(\"aventure\").innerHTML += (\"lancez le sort '\"+incantationName+\"' qui amoche votre adversaire bien salement, lui ôtant \" + degatBoule + \" Points de vie</br>EN FAIT C'EST LA MOITIE DE SA VIE + 30 SI T'A CAPTé</br>\" ) \n \n break;\n\n case (2) :\n incantationName=\"INVISIBILITÉ BON MARCHÉ\";\n personnage.esquive = Number(88);\n document.getElementById(\"esquivePerso\").innerHTML = personnage.esquive;\n document.getElementById(\"aventure\").innerHTML += (\"lancez le sort '\"+incantationName+\"'. L'adversaire ne vous voit que sous une forme quasiment transparente. Un peu comme si il regardait au travers d'une pinte de bière vide. C'est le moment d'esquiver ses coups !</br>\" ) \n \n break;\n \n case (3) :\n incantationName=\"CARRESSE PSYCHIQUE\";\n degatCarresse= 1;\n rndEnnemi.sante = rndEnnemi.sante + degatCarresse;\n document.getElementById(\"santeEnnemi\").innerHTML = rndEnnemi.sante;\n document.getElementById(\"aventure\").innerHTML += (\"lancez le sort '\"+incantationName+\"' que vous aviez appris à lancer à la Fac pour séduire une jeune mage très douce, qui depuis votre séparation s'est étrangement passionnée pour la démonologie. Ce sort n'est pas vraiment un sort de combat, et votre adversaire semble même un peu plus excité qu'au paravant, vous lui avez rendu \" + degatCarresse + \" Point de vie</br>\" ) \n \n break;\n }\n break;\n case \"david\":\n attaquer();\n document.getElementById(\"aventure\").innerHTML += (\"</br></br>VOTRE ENNEMI A SIMPLEMENT CESSé D'EXISTER.</br>\");\n resetEnnemi();\n \n break;\n \n default :\n dialogBox(\"Interaction cheloue du spécial, merci d'en faire part au MJ il code comme un pied, veuillez l'excuser.\")\n break;\n }\nesquiver();\nspecialReboot=0;\nconsole.log(\"Le spécial s'est exécuté\");\nscrollDown(\"fenetreCentrale\");\n}\n}\n}", "function verificarP1(){\n\t $.ajax({\n\t\t type : 'POST',\n\t\t url: 'Permisos',\n\t\t dataType: 'json',\n\t\t error: function(data) {\n\t\t\t var obj = JSON.parse(JSON.stringify(data));\n\t\t\t console.log(JSON.stringify(data));\n\t\t\t notificacionError(obj.responseText);\n\t\t\t \n\t\t },\n\t\t success: function(data) {\n\t\t\t var conteo1, conteo2, inventario, auditoria, diferencia;\n\t\t\t var ceros = 0;\n\t\t\t console.log(JSON.stringify(data));\n\t\t\t for(var i = 0; i < data.length; i++) {\n\t\t\t\t var obj = data[i];\n\t\t\t\t switch(i){\n\t\t\t\t case 0:\n\t\t\t\t \tif(obj.permiso==1){\n\t\t\t\t\t\t\t $('#conteo1').show();\n\t\t\t\t\t\t\t conteo1 = 1;\n\t\t\t\t\t }else{\n\t\t\t\t\t \tceros++;\n\t\t\t\t\t\t\t $('#conteo1').hide();\n\t\t\t\t\t\t\t conteo1 = 0;\n\t\t\t\t\t }\n\t\t\t\t \tbreak;\n\t\t\t\t case 1:\n\t\t\t\t \tif(obj.permiso==1){\n\t\t\t\t\t\t\t $('#conteo2').show();\n\t\t\t\t\t\t\t conteo2 = 1;\n\t\t\t\t\t }else{\n\t\t\t\t\t \tceros++;\n\t\t\t\t\t\t\t $('#conteo2').hide();\n\t\t\t\t\t\t\t conteo2 = 0;\n\t\t\t\t\t }\n\t\t\t\t \tbreak;\n\t\t\t\t case 2: \n\t\t\t\t \tif(obj.permiso==1){\n\t\t\t\t\t\t\t $('#inventario').show();\n\t\t\t\t\t\t\t inventario = 1;\n\t\t\t\t\t }else{\n\t\t\t\t\t \tceros++;\n\t\t\t\t\t\t\t $('#inventario').hide();\n\t\t\t\t\t\t\t inventario = 0;\n\t\t\t\t\t }\n\t\t\t\t \tbreak;\n\t\t\t\t case 3:\n\t\t\t\t \tif(obj.permiso==1){\n\t\t\t\t\t\t\t $('#auditoria').show();\n\t\t\t\t\t\t\t auditoria = 1;\n\t\t\t\t\t }else{\n\t\t\t\t\t \tceros++;\n\t\t\t\t\t\t\t $('#auditoria').hide();\n\t\t\t\t\t\t\t auditoria = 0;\n\t\t\t\t\t }\n\t\t\t\t \tbreak;\n\t\t\t\t case 4:\n\t\t\t\t \tif(obj.permiso==1){\n\t\t\t\t\t\t\t $('#diferencia').show();\n\t\t\t\t\t\t\t diferencia = 1;\n\t\t\t\t\t }else{\n\t\t\t\t\t \tceros++;\n\t\t\t\t\t\t\t $('#diferencia').hide();\n\t\t\t\t\t\t\t diferencia = 0;\n\t\t\t\t\t }\n\t\t\t\t \tbreak;\n\t\t\t\t }\n\t\t\t\t \n\t\t\t\t}\n\t\t\t if(ceros == 5){\n\t\t\t\t alert('No tiene ninguna opcion asignada, comuniquese con el administrador');\n\t\t\t\t window.location = \"Logout\";\n\t\t\t }\n\t\t\t if(conteo1==0 && conteo2 ==0 && inventario == 0){\n\t\t\t\t if(auditoria==1){\n\t\t\t\t\t window.location = \"admin.jsp\";\n\t\t\t\t }else{\n\t\t\t\t\t window.location = \"diferencia.jsp\";\n\t\t\t\t }\n\t\t\t }\n\t\t\t $.ajax({\n\t\t\t\t type : 'POST',\n\t\t\t\t url: 'BuscarEstado',\n\t\t\t\t dataType: 'html',\n\t\t\t\t error: function(data) {\n\t\t\t\t\t var obj = JSON.parse(JSON.stringify(data));\n\t\t\t\t\t notificacionError(obj.responseText);\n\t\t\t\t },\n\t\t\t\t success: function(data) {\n\t\t\t\t\t \n\t\t\t\t\t if(data=='3'){\n\t\t\t\t\t\t if(conteo1 == 1 && conteo2 == 1){\n\t\t\t\t\t\t\t window.location = \"agregar2.jsp\";\n\t\t\t\t\t\t }\n//\t\t\t\t\t\t else if(conteo1==0 && conteo2==0){\n//\t\t\t\t\t\t\t if(auditoria==1){\n//\t\t\t\t\t\t\t\t window.location = \"admin.jsp\";\n//\t\t\t\t\t\t\t }else{\n//\t\t\t\t\t\t\t\t if(diferencia==1){\n//\t\t\t\t\t\t\t\t\t window.location = \"diferencia.jsp\"\n//\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 }\n//\t\t\t\t\t else if(data=='2'){\n//\t\t\t\t\t\t if(conteo1 == 1 && conteo2 == 1){\n//\t\t\t\t\t\t\t window.location = \"agregar2.jsp\";\n//\t\t\t\t\t\t }else if(conteo1==0 && conteo2==0){\n//\t\t\t\t\t\t\t if(auditoria==1){\n//\t\t\t\t\t\t\t\t window.location = \"admin.jsp\";\n//\t\t\t\t\t\t\t }else{\n//\t\t\t\t\t\t\t\t if(diferencia==1){\n//\t\t\t\t\t\t\t\t\t window.location = \"diferencia.jsp\"\n//\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 }\n\t\t\t\t }\n\t\t\t\t});\n\t\t }\n\t\t});\n }", "function comprobar(){\n \n //Comprobar el nombre.\n verifDatos(document.getElementById(\"nombre\"), document.getElementById(\"errNom\"));\n verifDatos(document.getElementById(\"edad\"), document.getElementById(\"errEdad\"));\n verifDatos(document.getElementById(\"fecha\"), document.getElementById(\"errFecha\"));\n verifGen();\n verifProv();\n \n if(counter == 0){\n return true;\n }\n \n return false;\n}", "calculoPromesa(val1, val2) {\n this.metodoPromesa(val1, val2)\n .then(function () {\n objCalculo.calculo(val1, val2)\n })\n .catch(err => console.log(err.message))\n }", "function checkedGestionControlbyMail(){\n\tif(checkedN == \"checked\")\n\t\t{\n\t\t\tconsole.log('toto1');\n\t\t\tpreInscriptionNoGood();\n\t\t}\n\t\telse if (checkedP == \"checked\")\n\t\t{\n\t\t\tconsole.log('toto2');\n\t\t\tcliendNoGood();\n\t\t}\n\t\telse if (checkedI == \"checked\")\n\t\t{\n\t\t\telementManquant1=\"\";\t\n\t\t}\t\n\t\telse\n\t\t{\n\t\t\tconsole.log('toto3');\t\n\t\t\tinscriptionNoGood();\n\t\t}\n}", "function VerificaGlobal(){\n\tverificado=true;\n\tmen=\"\";\n\t// Verificar que tenga al menos 1 titulo.\n\tvar nTitulos=$(\"#tablaTitulos tr\").length;\n\t//alert(\"nTitulos:\"+nTitulos);\n\tif (nTitulos<2){\n\t\t// cuenta como tr el encabezado\n\t\tmen=men+\"Debe incluir al menos 1 título en el escandallo\\n\";\n\t\tverificado=false;\n\t}\n\t// Verifica que tenga al menos 1 linea.\n\tvar nLineas=$(\"#tablaLineas tr\").length;\n\t//alert(\"nLineas:\"+nLineas);\n\tif (nLineas<2){\n\t\t// cuenta como tr el encabezado\n\t\tmen=men+\"Debe incluir al menos 1 Linea en el escandallo\\n\";\n\t\tverificado=false;\n\t}\n\n\t// añade mensaje\n\tif (!(verificado)){\n\t\tmensaje=mensaje+\"ERRORES GENERALES DEL ESCANDALLO\\n----------------------------------------\\n\"+men;\n\t}\n\treturn verificado;\n}", "function daComentarioFbk(){\r\n var limit = 150; \r\n /* ahora brega con el parrafo y da feedback pq ya se cuantos faltan */\r\n var parrafo = document.getElementById('comentario-feedback-paragraph');\r\n \r\n var faltan = noUsado(); \r\n if(faltan == limit && ! escogioFoto()){\r\n parrafo.style.color='red';\r\n parrafo.innerHTML='<b>Comentario del juego de hoy.</b>'; \r\n parrafo.style.fontSize = '1.00em';\r\n }else if(faltan == limit && escogioFoto()){\r\n parrafo.style.color='green';\r\n parrafo.innerHTML='<b>Comentario opcional del juego.</b>'; \r\n parrafo.style.fontSize = '1.00em'; \r\n }else if(faltan > 1){\r\n parrafo.style.color='green';\r\n //parrafo.innerHTML= 'Puedes usar ' + faltan + ' letras mas.';\r\n parrafo.innerHTML= '<b>' + faltan + '</b>';\r\n parrafo.style.fontSize = '0.70em';\r\n }else if(faltan == 1){\r\n parrafo.style.color='green';\r\n //parrafo.innerHTML= 'Puedes usar ' + faltan + ' letra mas.';\r\n parrafo.innerHTML= '<b>' + faltan + '</b>';\r\n parrafo.style.fontSize = '0.70em';\r\n }else if(faltan == 0){\r\n parrafo.style.color='green';\r\n //parrafo.innerHTML= 'Usando exactamente ' + limit + ' letras.';\r\n parrafo.innerHTML= '<b>' + faltan + '</b>'; \r\n parrafo.style.fontSize = '0.70em';\r\n }else if(faltan == -1 ){\r\n parrafo.style.color='red';\r\n parrafo.innerHTML='<b>Tienes ' + (-1 * faltan) + ' letra de mas.</b>';\r\n parrafo.style.fontSize = '1.00em';\r\n }else if(faltan < -1 ){\r\n parrafo.style.color='red';\r\n parrafo.innerHTML='<b>Tienes ' + (-1 * faltan) + ' letras de mas.</b>';\r\n parrafo.style.fontSize = '1.00em';\r\n }\r\n }", "function verificarEmpleadoConceptos(form) {\r\n\tvar secuencia=document.getElementById(\"secuencia\").value;\r\n\tvar registro=document.getElementById(\"registro\").value;\r\n\tvar accion=document.getElementById(\"accion\").value;\r\n\tvar codconcepto=document.getElementById(\"codconcepto\").value; codconcepto=codconcepto.trim();\r\n\tvar pdesde=document.getElementById(\"pdesde\").value; pdesde=pdesde.trim(); var esPdesde=esPContable(pdesde);\r\n\tvar phasta=document.getElementById(\"phasta\").value; phasta=phasta.trim(); var esPhasta=esPContable(phasta);\r\n\tvar codproceso=document.getElementById(\"codproceso\").value; codproceso=codproceso.trim();\r\n\tvar monto=document.getElementById(\"monto\").value; monto=monto.trim(); monto=monto.replace(\",\", \".\");\r\n\tvar cantidad=document.getElementById(\"cantidad\").value; cantidad=cantidad.trim(); cantidad=cantidad.replace(\",\", \".\");\r\n\tvar status=document.getElementById(\"status\").value; status=status.trim();\r\n\tif (document.getElementById(\"flagproceso\").checked) var flagproceso=\"S\"; else var flagproceso=\"N\";\r\n\t\r\n\tif (codconcepto==\"\" || status==\"\" || codproceso==\"\" || pdesde==\"\") msjError(1010);\r\n\telse if (isNaN(monto)) alert(\"¡MONTO INCORRECTO!\");\r\n\telse if (isNaN(cantidad)) alert(\"¡CANTIDAD INCORRECTA!\");\r\n\telse if (pdesde!=\"\" && !esPdesde) alert(\"¡PERIODO INCORRECTO!\");\r\n\telse if (phasta!=\"\" && !esPhasta) alert(\"¡PERIODO INCORRECTO!\");\r\n\telse if (pdesde!=\"\" && phasta!=\"\" && (!esPdesde || !esPhasta || (pdesde>phasta))) alert(\"¡PERIODO INCORRECTO!\");\r\n\t//else if (monto == 0) alert(\"¡NO SE PUEDE ASIGNAR UN CONCEPTO CON MONTO EN CERO!\");\r\n\telse {\r\n\t\t//\tCREO UN OBJETO AJAX PARA VERIFICAR QUE EL NUEVO REGISTRO NO EXISTA EN LA BASE DE DATOS\r\n\t\tvar ajax=nuevoAjax();\r\n\t\tajax.open(\"POST\", \"fphp_ajax_nomina.php\", true);\r\n\t\tajax.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\r\n\t\tajax.send(\"modulo=EMPLEADOS-CONCEPTOS&accion=\"+accion+\"&codpersona=\"+registro+\"&secuencia=\"+secuencia+\"&codconcepto=\"+codconcepto+\"&pdesde=\"+pdesde+\"&phasta=\"+phasta+\"&codproceso=\"+codproceso+\"&monto=\"+monto+\"&cantidad=\"+cantidad+\"&status=\"+status+\"&flagproceso=\"+flagproceso);\r\n\t\tajax.onreadystatechange=function() {\r\n\t\t\tif (ajax.readyState==4)\t{\r\n\t\t\t\tvar resp=ajax.responseText;\r\n\t\t\t\tif (resp!=0) alert (\"¡\"+resp+\"!\");\r\n\t\t\t\telse cargarPagina(form, \"empleados_conceptos.php\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}", "function pintaActivas(arreglo,filtrados){\r\n\t$('#proceso').hide();\r\n\thtml=inicio();\r\n\r\n\tvar cont=0;\r\n\tvar existe_modulo=false;\r\n\tvar submodulos_global=[];\r\n\t\r\n\tfor(var i=0;i<arreglo.length;i++){\r\n\t\tvar existe_submodulo=false;\r\n\t\tvar existe_submodulo2=false;\r\n\t\tvar existe_submodulo3 = false;\r\n\t\t$.each($(\".permisos_sub\"),function(index, value){\r\n\t\t\tif(value.value=='PRIVILEGIO.MENU.VOKSE.16=true'){\r\n\t\t\t\texiste_modulo=true;\r\n\t\t\t}\r\n\t\t\tif(value.value=='PRIVILEGIO.SUBMENU.VOKSE.16,'+filtrados[cont].estatusid+'=true'){\r\n\t\t\t\texiste_submodulo=true;\r\n\t\t\t}\r\n\t\t\tif(arreglo[i]==2){\r\n\t\t\t\tif(value.value=='PRIVILEGIO.SUBMENU.VOKSE.16,'+filtrados[cont+1].estatusid+'=true'){\r\n\t\t\t\t\texiste_submodulo2=true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(arreglo[i]==3){\r\n\t\t\t\tif(value.value=='PRIVILEGIO.SUBMENU.VOKSE.16,'+filtrados[cont+1].estatusid+'=true'){\r\n\t\t\t\t\texiste_submodulo2=true;\r\n\t\t\t\t}\r\n\t\t\t\tif(value.value=='PRIVILEGIO.SUBMENU.VOKSE.16,'+filtrados[cont+2].estatusid+'=true'){\r\n\t\t\t\t\texiste_submodulo3=true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\tvar cadenas=filtrados[cont].estatus.replace('VALIDACION','VOBO').split('-',2);\r\n\t\tvar cant=\"\";\r\n\t\tvar color=\"\";\r\n\t\tvar estatusId = filtrados[cont].estatusid;\r\n\t\t\r\n\t\tif(filtrados[cont].totalSum!=undefined){\r\n\t\t\tcant=filtrados[cont].totalSum;\r\n\t\t}else{\r\n\t\t\tcant=filtrados[cont].total;\r\n\t\t}\r\n\t\t\tif(existe_submodulo==true || existe_modulo==false && filtrados[cont].areaValidacion==$('#areaId').val() && perfil!='3'){\r\n\t\t\t\tcolor=\"verde cursor\";\r\n\t\t\t\tsubmodulos_global.push(filtrados[cont].estatusid);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tcolor=\"blanco\";\r\n\t\t\t\tif(perfil=='3'){\r\n\t\t\t\t\tcolor=\"blanco cursor\";\r\n\t\t\t\t\tsubmodulos_global.push(filtrados[cont].estatusid);\r\n\t\t\t\t}\t\t\r\n\t\t\t}\r\n\t\t\r\n\t\tif(arreglo[i]==1){\r\n\t\t\thtml=html+simple(cadenas[1] ,cant ,cadenas[0], color, estatusId, MDS_ACTIVAS);\r\n\t\t}\r\n\t\tif(arreglo[i]==2){\r\n\t\t\tvar cadenas2= filtrados[cont+1].estatus.replace('VALIDACION','VOBO').split('-',2);\r\n\t\t\tvar cant2= \"\";\r\n\t\t\tvar color2=\"\";\r\n\t\t\tvar estatusId2 = filtrados[cont+1].estatusid;\r\n\t\t\t\r\n\t\t\tif(filtrados[cont+1].totalSum!=undefined){\r\n\t\t\t\tcant2=filtrados[cont+1].totalSum;\r\n\t\t\t}else{\r\n\t\t\t\tcant2=filtrados[cont+1].total;\r\n\t\t\t}\r\n\t\t\tif(existe_submodulo2==true || existe_modulo==false && filtrados[cont+1].areaValidacion==$('#areaId').val() && perfil!='3'){\r\n\t\t\t\tcolor2=\"verde cursor\";\r\n\t\t\t\tsubmodulos_global.push(filtrados[cont+1].estatusid);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tcolor2=\"blanco\";\r\n\t\t\t\tif(perfil=='3'){\r\n\t\t\t\t\tcolor2=\"blanco cursor\";\r\n\t\t\t\t\tsubmodulos_global.push(filtrados[cont+1].estatusid);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\thtml=html+doble(cadenas[1] ,cant ,cadenas[0],color ,cadenas2[1] ,cant2 ,cadenas2[0], color2, estatusId, estatusId2, MDS_ACTIVAS);\t\r\n\t\t\t\r\n\t\t\tcont++;\r\n\t\t}\r\n\t\tif(arreglo[i]==3){\r\n\t\t\tvar cadenas2= filtrados[cont+1].estatus.replace('VALIDACION','VOBO').split('-',2);\r\n\t\t\tvar cant2= \"\";\r\n\t\t\tvar color2=\"\";\r\n\t\t\tvar estatusId2 = filtrados[cont+1].estatusid;\r\n\t\t\tvar cadenas3= filtrados[cont+2].estatus.replace('VALIDACION','VOBO').split('-',2);\r\n\t\t\tvar cant3= \"\";\r\n\t\t\tvar color3=\"\";\r\n\t\t\tvar estatusId3 = filtrados[cont+2].estatusid;\r\n\t\t\t\r\n\t\t\tif(filtrados[cont+1].totalSum!=undefined){\r\n\t\t\t\tcant2=filtrados[cont+1].totalSum;\r\n\t\t\t}else{\r\n\t\t\t\tcant2=filtrados[cont+1].total;\r\n\t\t\t}\r\n\t\t\tif(filtrados[cont+2].totalSum!=undefined){\r\n\t\t\t\tcant3=filtrados[cont+2].totalSum;\r\n\t\t\t}else{\r\n\t\t\t\tcant3=filtrados[cont+2].total;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(existe_submodulo2==true || existe_modulo==false && filtrados[cont+1].areaValidacion==$('#areaId').val() && perfil!='3'){\r\n\t\t\t\tcolor2=\"verde cursor\";\r\n\t\t\t\tsubmodulos_global.push(filtrados[cont+1].estatusid);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tcolor2=\"blanco\";\r\n\t\t\t\tif(perfil=='3'){\r\n\t\t\t\t\tcolor2=\"blanco cursor\";\r\n\t\t\t\t\tsubmodulos_global.push(filtrados[cont+1].estatusid);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(existe_submodulo3==true || existe_modulo==false && filtrados[cont+2].areaValidacion==$('#areaId').val() && perfil!='3'){\r\n\t\t\t\tcolor3=\"verde cursor\";\r\n\t\t\t\tsubmodulos_global.push(filtrados[cont+2].estatusid);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tcolor3=\"blanco\";\r\n\t\t\t\tif(perfil=='3'){\r\n\t\t\t\t\tcolor3=\"blanco cursor\";\r\n\t\t\t\t\tsubmodulos_global.push(filtrados[cont+2].estatusid);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\thtml=html+triple(cadenas[1] ,cant ,cadenas[0],color ,cadenas2[1] ,cant2 ,cadenas2[0].replace('CORRECCIÓN',''), color2, estatusId, estatusId2,estatusId3, MDS_ACTIVAS,cadenas3[1] ,cant3 ,cadenas3[0].replace('CORRECCIÓN',''),color3);\t\r\n\t\t\t\r\n\t\t\tcont += 2;\r\n\t\t}\r\n\t\tcont++;\r\n\t}\r\n\tEnviaSubmodulosAction(submodulos_global);\r\n\t\r\n\t$('#proceso').html(html);\r\n\t$('.hexa').css('background-image','url(\"img/hexaverde.svg\")');\r\n\t\r\n\t$('#proceso').fadeIn();\r\n\tcierraLoading();\r\n}", "function comprobarCajas() {\n\n for (let i = 2, posCaja = 0; i < mapa.length; i += 3)\n for (let j = 1; j < mapa[0].length; j += 4, posCaja++)\n if (!cajasDescubiertas[posCaja] && mapa[i][j].classList.contains('caja'))\n if (cajaRodeada(i, j)) {\n\n cajasDescubiertas[posCaja] = true;\n descubrirCaja(i, j, posCaja);\n\n if (contenidoCajas[posCaja] == 'cofre') {\n puntos = parseInt(puntos) + 200;\n actualizarPuntuacion();\n insertarContenidoLeyenda('contenedorMonedas', 'leyendaCajaMoneda', 'cantidadMonedas');\n }\n else if (contenidoCajas[posCaja] == 'pergamino') {\n personaje.pergamino = true;\n applyContrastToMummies();\n }\n else if (contenidoCajas[posCaja] == 'llave') {\n insertarContenidoLeyenda('contenedorLlave', 'leyendaCajaLlave', 'cantidadLlaves');\n personaje.llave = true;\n }\n else if (contenidoCajas[posCaja] == 'urna') {\n insertarContenidoLeyenda('contenedorUrna', 'leyendaCajaUrna', 'cantidadUrnas');\n personaje.urna = true;\n }\n }\n\n}", "function acceder(){\r\n limpiarMensajesError()//Limpio todos los mensajes de error cada vez que corro la funcion\r\n let nombreUsuario = document.querySelector(\"#txtUsuario\").value ;\r\n let clave = document.querySelector(\"#txtClave\").value;\r\n let acceso = comprobarAcceso (nombreUsuario, clave);\r\n let perfil = \"\"; //variable para capturar perfil del usuario ingresado\r\n let i = 0;\r\n while(i < usuarios.length){\r\n const element = usuarios[i].nombreUsuario.toLowerCase();\r\n if(element === nombreUsuario.toLowerCase()){\r\n perfil = usuarios[i].perfil;\r\n usuarioLoggeado = usuarios[i].nombreUsuario;\r\n }\r\n i++\r\n }\r\n //Cuando acceso es true \r\n if(acceso){\r\n if(perfil === \"alumno\"){\r\n alumnoIngreso();\r\n }else if(perfil === \"docente\"){\r\n docenteIngreso();\r\n }\r\n }\r\n}", "function actualizarProgreso() {\r\n //Obtener todas las tareas\r\n const tareas = document.querySelectorAll('li.tarea');\r\n\r\n //Obtener las tareas completadas\r\n const tareasCompletadas = document.querySelectorAll('i.completo');\r\n\r\n //Determinar el avance\r\n const avance = Math.round((tareasCompletadas.length / tareas.length) * 100);\r\n console.log(avance);\r\n\r\n //Asignar el avance a la barra\r\n const porcentaje = document.querySelector('#porcentaje');\r\n porcentaje.style.width = avance + '%';\r\n\r\n //Enviar alerta al terminar el proyecto\r\n if (avance === 100) {\r\n Swal.fire({\r\n icon: 'success',\r\n title: 'Proyecto terminado',\r\n text: 'Felicidades!!! ya no tienes tareas pendientes'\r\n });\r\n }\r\n\r\n\r\n}", "function mostrarHoteles() {\n if (mostraStatus) {\n mostrarHotelesActivados();\n } else {\n mostrarHotelesDesactivados();\n }\n}", "async pesquisarTarefa() {\n printPlanejamentoAtual(this.getPlanejamentoAtual());\n const { tarefa } = await formPesquisarTarefa(this.listaTarefas());\n await this.informacaoTarefa(tarefa);\n }", "function repartoFinal (){\n if(contadorManosTerminadas == contadorManos){ //Una vez que todas las manos estén terminadas se repartirá a la banca\n for(;sumaTotalBanca<17;){\n console.log('Como es menor que 17, le voy a dar otra carta');\n darCartaBanca();\n };\n if(sumaTotalBanca>=17){\n arrayValorCartasBanca.splice(arrayValorCartasBanca.length);\n console.log('Voy a comprobar, ya que es mayor de 17');\n \n }\n }\n \n }", "function proNoSis(intesidad, numServ, callback){ \n return 1/(callback(intesidad, numServ) + ((intesidad**numServ/factorial(numServ)) * (numServ/(numServ - intesidad))))\n}", "function adivinarSexoEstudiante(estudiantes) {\n //valor que se utilizará para comparar\n var resultado = 100000;\n //tupla que almacenará la posición más cercana \n var numeroTupla = 0;\n //for que recorre todos los datos como parámetro de la consulta \n //de la tabla de estudiantes\n for (var i = 0; i < estudiantes.length; i++) {\n var recintoTupla = 1;\n var estiloTupla = 0;\n \n \n //se le da valor a los recintos que pertenecen las personas en las\n //tuplas si es paraíso es 1 y turrialba es 2 \n if (estudiantes[i].recinto === 'Turrialba') {\n recintoTupla = 2;\n }\n //se elige el estilo de aprendizaje y se le asigna un valor\n //de 1 a 4\n switch (estudiantes[i].estilo) {\n case 'DIVERGENTE':\n estiloTupla = 1;\n break;\n case 'CONVERGENTE':\n estiloTupla = 2;\n break;\n case 'ASIMILADOR':\n estiloTupla = 3;\n break;\n case 'ACOMODADOR':\n estiloTupla = 4;\n break;\n }\n \n //distancia euclidiana aplicada a los valores de las tuplas para definir distancia\n var sumatoria = Math.pow((estiloTupla - (parseInt(document.getElementById('estilo').value))), 2) + Math.pow(recintoTupla - (parseInt(document.getElementById('recinto').value)), 2) + Math.pow((parseFloat(estudiantes[i].promedio)) - (parseFloat(document.getElementById('promedio').value)), 2);\n var distancia = Math.sqrt(sumatoria);\n \n //aquí comparan para mostrar el más cercano al que entra como parámetro\n //comparando los datos de la tupla y los ingresados\n if (resultado > distancia) {\n resultado = distancia;\n numeroTupla = i;\n } \n }\n \n //if para mostrar el sexo en la pantalla dependiendo de la tupla\n if(estudiantes[numeroTupla].sexo === 'M')\n document.getElementById('mensaje3').innerHTML = 'Su sexo es: Masculino y el número de tupla es: '+estudiantes[numeroTupla].id+'.';\n else\n document.getElementById('mensaje3').innerHTML = 'Su sexo es: Femenino y el número de tupla es: '+estudiantes[numeroTupla].id+'.';\n}" ]
[ "0.6348015", "0.61486346", "0.6129453", "0.5999885", "0.59539616", "0.58548564", "0.58150166", "0.5813115", "0.58114517", "0.5808636", "0.57955307", "0.5787083", "0.57815224", "0.57757324", "0.5768038", "0.57261246", "0.5698734", "0.56798744", "0.56579924", "0.56539166", "0.5637075", "0.5634475", "0.56231445", "0.56214994", "0.56162107", "0.5603606", "0.558899", "0.5582688", "0.5576853", "0.55762076", "0.55758876", "0.55724335", "0.55673045", "0.5559345", "0.5558472", "0.55490655", "0.5547407", "0.553735", "0.55351967", "0.5533228", "0.55307513", "0.5517732", "0.5515907", "0.5503736", "0.5503536", "0.55016434", "0.5490862", "0.5490725", "0.54876155", "0.5485824", "0.54825276", "0.548225", "0.54776424", "0.5467588", "0.546527", "0.5465049", "0.54499507", "0.54495305", "0.54451716", "0.54377615", "0.54375005", "0.5437432", "0.54366475", "0.54350346", "0.5419361", "0.54159385", "0.5415596", "0.54135096", "0.54046327", "0.5394604", "0.5390981", "0.53869194", "0.5386122", "0.5384351", "0.53800577", "0.5372378", "0.5371351", "0.53646815", "0.5362816", "0.5362386", "0.5360151", "0.53580683", "0.5355185", "0.53533137", "0.5351163", "0.53465927", "0.53450143", "0.53337187", "0.53323364", "0.5331631", "0.53312045", "0.5329407", "0.5322295", "0.53185445", "0.53167903", "0.531623", "0.53128874", "0.53121424", "0.53118515", "0.5304684", "0.5296048" ]
0.0
-1
Update the known topics.
function updateTopics(topics) { topics.forEach(function(d) { d.r = r(d.count); d.cr = Math.max(minRadius, d.r); d.k = fraction(d.parties[0].count, d.parties[1].count); if (isNaN(d.k)) d.k = .5; if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random(); d.bias = .5 - Math.max(.1, Math.min(.9, d.k)); }); force.nodes(data.topics = topics).start(); updateNodes(); updateLabels(); updateArrows(); tick({alpha: 0}); // synchronous update }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateTopics(topics) {\n topics.forEach(function(d, i) { d.r = Math.max(12, r(d.count)); }); // min. collision\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n }", "function updateTopics(topics) {\n topics.forEach(function(d, i) { d.r = Math.max(12, r(d.count)); }); // min. collision\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n}", "function processTopicSettingsUpdated(topic){\n console.log(\"Processing topic settings updated\");\n for(let participant of topic.participants){\n let nickname = participant.getNickname();\n let alias = participant.getAlias()\n Common.setParticipantAlias(topic, participant, alias)\n Common.setParticipantNickname(topic, participant, nickname)\n }\n\n for (let invite of topic.getInvites()){\n Common.setInviteAlias(invite)\n }\n\n}", "changeTopic(newTopic) {\n let url = defaultUrl + '&category=' + newTopic;\n this.apiCall(url);\n }", "function updatePubSub(){\n\n\t\t// LOAD IN PUBLISH INFO\n\t\tvar publishers = [];\n\n\t\tfor (var i=0, len=publishes.length; i<len; i++){\n\t\t var m = publishes[i];\n\t\t var pub = {\n\t\t \t\"name\": m.name,\n\t\t \t\"type\": m.type,\n\t\t \t\"default\": m._default\n\t\t }\t \n\n\t\t publishers.push(pub); \n\t\t}\n\t\t \n\t\t// LOAD IN SUBSCRIBE INFO\n\t\tvar subscribers = [];\n\t\t \n\t\tfor (var i=0; i<subscribes.length; i++){\n\t\t var m = subscribes[i];\n\t\t var sub = {\n\t\t \t\"name\": m.name,\n\t\t \t\"type\": m.type\n\t\t }\n\t\t \n\t\t subscribers.push(subs); \n\t\t}\n\n\t\ttConfig.config = {\n\t\t\tname: this.name,\n\t\t\tdescription: this.description,\n\t\t\tsubscribe: {\n\t\t\t\tmessages: subscribers\n\t\t\t}, \n\t\t\tpublish: {\n\t\t\t\tmessages: publishers\n\t\t\t}\n\t\t};\n\n\t\tif ( connectionEstablished ){\n\t\t\twsClient.send( JSON.stringify( tConfig ) );\n\t\t}\n\t}", "function processVaultUpdated(data){\n let { topics } = data\n for(let topic of topics){\n renameTopicInUX(topic.pkfp, topic.name)\n }\n}", "function setTopic( text ) {\n info.setTopic( text );\n}", "function newTopic(topicArray, topicsList) {\n //console.log('received: ', topicArray);\n if(typeof topicArray !== \"undefined\"){\n topicArray.forEach(function (topic, topicIndex) {\n var addToTopicsList = true;\n if (topicsList.length > 0) {\n\n topicsList.forEach(function (topicObject, index) {\n if (topicObject.topic == topic.term) {\n var newCount = topicObject.count + 1;\n topicObject.count = newCount;\n addToTopicsList = false;\n }\n });\n\n }\n if (addToTopicsList == true) {\n\n //then add it to topicsList\n var newTopic = {topic: topic.term, count: 1};\n topicsList.push(newTopic);\n }\n });\n\n }\n return topicsList;\n}", "function setTopic(newTopic) {\n const oldTopic = topic;\n topic = topicToFileName(newTopic);\n const date = datepicker('getDate');\n fetchDates(topic, getYYYYMM(date));\n return oldTopic;\n }", "function updateClassTopics(classTopics, schoolID) {\n\t// First, empty the current collection as upserting will leave old entries that should be removed\n\tClassTopic.remove({}, function () { });\n\n\t// Add the schoolID to each topic object\n\tclassTopics.forEach( function(topic) {\n\t\ttopic.schoolID = schoolID;\n\t});\n\n\t// Insert all as an array\n\tClassTopic.create(classTopics, function(err, result){\n\t\tif(err) return logError('Error updating class topics in the DB', err);\n\t});\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.select(\"#g-topic\").text((topic.count > maxMentions ? \"A sampling of \" : topic.count || \"No\") + \" mentions of \" + topic.name + \".\");\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.select(\"#g-topic\").text(\"Lucastimmons tweets\");\n }\n}", "function topicChanged( topic, room, user ) {\n}", "function forEachScopedTopic(topic, callback) {\n // this won't include individual dev topics, but\n // the vast majority of installations won't notice.\n const scopes = ['', 'staging', 'production'];\n const topics = scopes.map(scope => `${scope}${scope === '' ? '' : '-'}${topic}`);\n topics.forEach(callback);\n}", "function switchTopic(key) {\n alert(\"Switching topics not yet implemented\");\n}", "function updateTopics(npc, code) {\n for (let opt of npc.askOptions) {\n if (opt[\"name\" + code] !== undefined) {\n opt.name = opt[\"name\" + code]\n }\n }\n}", "function updateUserTopic(userId, topic) {\n return new Promise((resolve, reject) => {\n if (!topic) {\n reject(new Error(\"topic must be set\"));\n return;\n }\n const data = JSON.stringify({\n api_key: process.env.EMAIL_OCTOPUS_API_KEY,\n fields: {\n Topic: topic,\n },\n status: \"SUBSCRIBED\",\n });\n\n updateContact(userId, data)\n .then((result) => resolve(result))\n .catch((err) => reject(err));\n });\n}", "function showTopicsInMap(topicsToShow) {\n for (var i = 0; i < topicsToShow.length; i++) {\n var topic = topicsToShow[i];\n var featureToToggle = checkFeatureById(topic.id);\n if (featureToToggle != null) {\n featureToToggle.renderIntent = \"default\";\n } else {\n // log(\"[ERROR] no feature found for \" + topic.id );\n }\n }\n // rerender\n kiezatlas.layer.redraw();\n }", "consume(topics, cb) {\n if (Array.isArray(topics)) {\n if (cb) {\n Promise.all(topics.map(topic => this.eventContext.get(topic)))\n .then(values => {\n const ret = {};\n values.map((val, index) => {\n ret[topics[index]] = val;\n });\n // unlink any error in cb from promise flow to let it fail\n setImmediate(() => cb(ret, this));\n })\n .catch(err => {\n if (this._catchHandler) {\n return this._catchHandler(err);\n }\n });\n return this; // for cascading style\n }\n\n const promises = topics.reduce((memo, topic) => {\n memo.push(this.eventContext.get(topic));\n return memo;\n }, []);\n\n return Promise.all(promises)\n .then(results => results.reduce((memo, data, index) => {\n memo[topics[index]] = data;\n return memo;\n }, {}));\n }\n\n // handle single topics\n if (cb) {\n this.eventContext.on(topics, data => {\n if (data instanceof Promise) {\n data.then(cb).catch(err => {\n this.define('error', err);\n });\n return;\n }\n\n cb(data, this);\n });\n return this;\n }\n return this.eventContext.get(topics);\n }", "function queryTopics (finish) {\n let data = [], self = this;\n clearInterval(self.lookupIntervalID); // close interval. setup after lookup finished.\n http.get(`http://${self.host}:${self.port}/topics`, res => {\n res.on('data', chunk => data.push(chunk));\n res.on('end', () => {\n data = Buffer.concat(data).toString();\n parseResult(data);\n });\n }).on('error', err => {\n err.message = 'request lookupd error. Caused by:' + err.message;\n onERROR(err);\n retry();\n });\n\n function parseResult(res) {\n data = JSON.parse(res);\n console.log('lookup result', res);\n if (data.status_code !== 200) {\n console.log('C', data.status_code + data.status_txt);\n let err = new Error('NSQ Lookup failed. http response: ' + data.status_code + data.status_txt);\n onERROR(err);\n return retry();\n }\n\n\n self.topics = data.data.topics;\n finish();\n\n self.lookupIntervalID = setInterval(() => {\n queryTopics.bind(self)(() => {\n console.log('interval lookup');\n let currTopic = Object.keys(self.readers);\n if ( (self.topics.length === currTopic.length)\n && (self.topics.filter(item => currTopic.find(e => e === item)).length = self.topics.length) ) {\n // topic list not change\n return;\n }\n establish.bind(self)(self.topics);\n });\n }, LOOKUP_INTERVAL);\n }\n\n function onERROR(err) {\n self.emit('error', err);\n }\n\n function retry() {\n console.log('lookup retry');\n setTimeout(() => {\n queryTopics.bind(self)(finish);\n }, RETRY_DELAY);\n }\n}", "get topicsInput() {\n return this._topics;\n }", "function change_topic() {\n\tif (numAnswered < chosenTopics.length - 1) {\n\t\t//update progress bar\n\t\tnumAnswered++; //global\n\t\tset_progress();\n\t\t//reset input in text area\n\t\tdocument.getElementById(\"answer-input\").value=\"\";\n\t\t//change topic in header\n\t\tdocument.getElementById(\"topic-text\").innerHTML = chosenTopics[numAnswered].topicText;\n\t\tif (numAnswered === chosenTopics.length - 1){\n\t\t\tdocument.getElementById(\"send-button\").innerHTML = \"Finish\";\n\t\t}\n\t}\n\telse {\n\t\tprepare_modal();\n\t}\n}", "_renewSubscriptions () {\n let i;\n const subs = new Map(this._subscriptionsById);\n\n this._subscriptionsById.clear();\n this._subscriptionsByKey.clear();\n\n subs.forEach((sub) => {\n i = sub.callbacks.length;\n while (i--) {\n this.subscribe(sub.topic, sub.callbacks[i], sub.advancedOptions);\n }\n });\n }", "function ImportTopics() {\n\t}", "function forumUpdate() {\n var b = readify('beta-refreshing', false)\n\n if (! b) {\n try {\n var url = window.location.pathname\n console.log(url)\n request(url, addTopics)\n\n } catch(e) {\n debu(e)\n }\n }\n}", "subscribe(topic) {\n this.topicQueues[topic] = []\n }", "function updateLinks()\n\t{\n\t\tconsole.log(\"All appended link text updated\");\n\t\t$(\"a.appended\").each(function()\n\t\t{\n\t\t\tif(savedTopics.hasOwnProperty(this.id))\n\t\t\t{\n\t\t\t\t$(this).text(\"x\");\n\t\t\t\t$(this).prev().css(\"font-style\", \"italic\");\n\t\t\t\tconsole.log(\"Found \" + this.id + \" in saved links, added delete\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$(this).text(\"Save\");\n\t\t\t\t$(this).prev().css(\"font-style\", \"\");\n\t\t\t}\n\t\t});\n\t}", "function updateNodes() {\n node = node.data(data.topics, function(d) { return d.name; });\n\n node.exit().remove();\n\n node.enter().append(\"a\")\n .attr(\"class\", \"g-node\")\n .attr(\"xlink:href\", function(d) { return \"#\" + encodeURIComponent(d.name); })\n .call(force.drag)\n .call(linkTopic)\n .append(\"circle\");\n\n node.select(\"circle\")\n .attr(\"r\", function(d) { return r(d.count); });\n}", "updateTopic(topic, options = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n const { span, updatedOptions } = createSpan(\"ChatThreadClient-UpdateTopic\", options);\n try {\n yield this.client.chatThread.updateChatThreadProperties(this.threadId, { topic: topic }, operationOptionsToRequestOptionsBase(updatedOptions));\n }\n catch (e) {\n span.setStatus({\n code: CanonicalCode.UNKNOWN,\n message: e.message\n });\n throw e;\n }\n finally {\n span.end();\n }\n });\n }", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}" ]
[ "0.72805154", "0.72191924", "0.6702866", "0.6646864", "0.6348247", "0.6219668", "0.5864411", "0.5834315", "0.5817131", "0.57902694", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.5753025", "0.57266736", "0.5664543", "0.5650087", "0.5638093", "0.55419695", "0.54883385", "0.5461841", "0.5455688", "0.54119956", "0.5340022", "0.53386533", "0.5297645", "0.5275997", "0.5255061", "0.52533185", "0.5244881", "0.5208176", "0.5200046", "0.5200046", "0.5200046", "0.5200046", "0.5200046", "0.5200046", "0.5200046", "0.5200046", "0.5200046", "0.5200046", "0.5200046", "0.5200046", "0.5200046", "0.5200046", "0.5200046" ]
0.7189533
28
Update the displayed nodes.
function updateNodes() { node = node.data(data.topics, function(d) { return d.name; }); node.exit().remove(); var nodeEnter = node.enter().append("a") .attr("class", "g-node") .attr("xlink:href", function(d) { return "#" + encodeURIComponent(d.name); }) .call(force.drag) .call(linkTopic); var democratEnter = nodeEnter.append("g") .attr("class", "g-democrat"); democratEnter.append("clipPath") .attr("id", function(d) { return "g-clip-democrat-" + d.id; }) .append("rect"); democratEnter.append("circle"); var republicanEnter = nodeEnter.append("g") .attr("class", "g-republican"); republicanEnter.append("clipPath") .attr("id", function(d) { return "g-clip-republican-" + d.id; }) .append("rect"); republicanEnter.append("circle"); nodeEnter.append("line") .attr("class", "g-split"); node.selectAll("rect") .attr("y", function(d) { return -d.r - clipPadding; }) .attr("height", function(d) { return 2 * d.r + 2 * clipPadding; }); node.select(".g-democrat rect") .style("display", function(d) { return d.k > 0 ? null : "none" }) .attr("x", function(d) { return -d.r - clipPadding; }) .attr("width", function(d) { return 2 * d.r * d.k + clipPadding; }); node.select(".g-republican rect") .style("display", function(d) { return d.k < 1 ? null : "none" }) .attr("x", function(d) { return -d.r + 2 * d.r * d.k; }) .attr("width", function(d) { return 2 * d.r; }); node.select(".g-democrat circle") .attr("clip-path", function(d) { return d.k < 1 ? "url(#g-clip-democrat-" + d.id + ")" : null; }); node.select(".g-republican circle") .attr("clip-path", function(d) { return d.k > 0 ? "url(#g-clip-republican-" + d.id + ")" : null; }); node.select(".g-split") .attr("x1", function(d) { return -d.r + 2 * d.r * d.k; }) .attr("y1", function(d) { return -Math.sqrt(d.r * d.r - Math.pow(-d.r + 2 * d.r * d.k, 2)); }) .attr("x2", function(d) { return -d.r + 2 * d.r * d.k; }) .attr("y2", function(d) { return Math.sqrt(d.r * d.r - Math.pow(-d.r + 2 * d.r * d.k, 2)); }); node.selectAll("circle") .attr("r", function(d) { return r(d.count); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateNodes() {\n for (var item = 0; item < matrixLen; item++) {\n addItem(tempArray[item]);\n }\n addButton();\n }", "function updateNodes() {\n node = node.data(data.topics, function(d) {\n return d.name;\n });\n\n node.exit().remove();\n\n node.enter().append(\"a\")\n .attr(\"class\", \"g-node\")\n //.attr(\"xlink:href\", function(d) { return \"#\" + encodeURIComponent(d.name); })\n .attr(\"id\", function(d) {\n return encodeURIComponent(d.name);\n })\n .call(force.drag)\n .call(linkTopic)\n .append(\"g\")\n .append(\"circle\")\n\n node.select(\"circle\")\n .attr(\"r\", function(d) {\n return r(d.count);\n })\n .style(\"fill\", function(d) {\n return d.count >= 40 ? \"#74c1ab\" : '#8ee6ca' });\n\n }", "function updateNodes() {\n node = node.data(data.topics, function(d) { return d.name; });\n\n node.exit().remove();\n\n node.enter().append(\"a\")\n .attr(\"class\", \"g-node\")\n .attr(\"xlink:href\", function(d) { return \"#\" + encodeURIComponent(d.name); })\n .call(force.drag)\n .call(linkTopic)\n .append(\"circle\");\n\n node.select(\"circle\")\n .attr(\"r\", function(d) { return r(d.count); });\n}", "function graphUpdate (nodes) {\n\n nodes = new vis.DataSet(nodes)\n network.redraw()\n}", "function updateNodes() {\n\t var _this8 = this;\n\n\t var nodesLayer = select(this.svg).select(\".nodes-layer\"); // DATA JOIN\n\t // Join new data with old elements, if any.\n\n\t var nodes = nodesLayer.selectAll(\".node\").data(this.layout.vertices, function (v) {\n\t return \"n_\".concat(v.key);\n\t }); // ENTER\n\t // Create new elements as needed.\n\n\t var newNodes = nodes.enter().append(\"g\").attr(\"id\", function (v) {\n\t return v.id;\n\t }).attr(\"class\", function (v) {\n\t return [\"node\"].concat(toConsumableArray(v.classes)).join(\" \");\n\t }).attr(\"transform\", function (v) {\n\t return \"translate(\".concat(_this8.scales.x(v.x), \", \").concat(_this8.scales.y(v.y), \")\");\n\t }); // add the specific node shapes or 'baubles'\n\n\t this.settings.baubles.forEach(function (bauble) {\n\t var d = bauble.createShapes(newNodes.filter(bauble.vertexFilter)).attr(\"class\", \"node-shape\");\n\t bauble.updateShapes(d);\n\t });\n\t newNodes.append(\"text\").attr(\"class\", \"node-label name\").attr(\"text-anchor\", \"start\").attr(\"alignment-baseline\", \"middle\").attr(\"dx\", \"12\").attr(\"dy\", \"0\").text(function (d) {\n\t return d.rightLabel;\n\t });\n\t newNodes.append(\"text\").attr(\"class\", \"node-label support\").attr(\"text-anchor\", \"end\").attr(\"dx\", \"-6\").attr(\"dy\", function (d) {\n\t return d.labelBelow ? -8 : +8;\n\t }).attr(\"alignment-baseline\", function (d) {\n\t return d.labelBelow ? \"bottom\" : \"hanging\";\n\t }).text(function (d) {\n\t return d.leftLabel;\n\t }); // update the existing elements\n\n\t nodes.transition().duration(this.settings.transitionDuration).ease(this.settings.transitionEase).attr(\"class\", function (v) {\n\t return [\"node\"].concat(toConsumableArray(v.classes)).join(\" \");\n\t }).attr(\"transform\", function (v) {\n\t return \"translate(\".concat(_this8.scales.x(v.x), \", \").concat(_this8.scales.y(v.y), \")\");\n\t }); // update all the baubles\n\n\t this.settings.baubles.forEach(function (bauble) {\n\t var d = nodes.select(\".node-shape\").filter(bauble.vertexFilter).transition().duration(_this8.settings.transitionDuration).ease(_this8.settings.transitionEase);\n\t bauble.updateShapes(d);\n\t });\n\t nodes.select(\"text .node-label .name\").transition().duration(this.settings.transitionDuration).ease(this.settings.transitionEase).attr(\"class\", \"node-label name\").attr(\"text-anchor\", \"start\").attr(\"alignment-baseline\", \"middle\").attr(\"dx\", \"12\").attr(\"dy\", \"0\").text(function (d) {\n\t return d.rightLabel;\n\t });\n\t nodes.select(\"text .node-label .support\").transition().duration(this.settings.transitionDuration).ease(this.settings.transitionEase).attr(\"alignment-baseline\", function (d) {\n\t return d.labelBelow ? \"bottom\" : \"hanging\";\n\t }).attr(\"class\", \"node-label support\").attr(\"text-anchor\", \"end\").attr(\"dx\", \"-6\").attr(\"dy\", function (d) {\n\t return d.labelBelow ? -8 : +8;\n\t }).text(function (d) {\n\t return d.leftLabel;\n\t }); // EXIT\n\t // Remove old elements as needed.\n\n\t nodes.exit().remove();\n\t updateNodeStyles.call(this); // add callbacks\n\n\t var _iteratorNormalCompletion = true;\n\t var _didIteratorError = false;\n\t var _iteratorError = undefined;\n\n\t try {\n\t for (var _iterator = this.callbacks.nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t var callback = _step.value;\n\t callback();\n\t }\n\t } catch (err) {\n\t _didIteratorError = true;\n\t _iteratorError = err;\n\t } finally {\n\t try {\n\t if (!_iteratorNormalCompletion && _iterator[\"return\"] != null) {\n\t _iterator[\"return\"]();\n\t }\n\t } finally {\n\t if (_didIteratorError) {\n\t throw _iteratorError;\n\t }\n\t }\n\t }\n\t}", "function update(tree) {\n if (graph.nodes && !graph.nodes.empty()) graph.nodes.remove()\n if (graph.links && !graph.links.empty()) graph.links.remove()\n\n graph.links = graph.element.append('g').attr('id', 'linksContainer')\n graph.nodes = graph.element.append('g').attr('id', 'nodesContainer')\n\n let nodes = tree.descendants()\n let links = tree.descendants().slice(1)\n\n linksAttr(graph.links.selectAll('.link').data(links, d => d.data.id).enter())\n nodesAttrs(graph.nodes.selectAll('.node').data(nodes).enter())\n\n if (!graph.style.barChart) updateLeafLabels(graph.style.leafLabels)\n else {\n graph.element.selectAll('.leafLabelIsolates text').remove()\n graph.element.selectAll('circle').each(d => addBarCharts(d))\n addLeafLabelsNotIsolates()\n }\n\n updateLinkLabels(graph.style.linkLabels)\n updateInternalLabels(graph.style.parentLabels)\n }", "show() {\n for (let node of this.nodes) {\n node.show();\n node.showLinks();\n }\n }", "function update() {\n\n // calculate the x,y coordinates of the currentRoot\n tree(currentRoot);\n\n // create KV for simple access\n var currentRootKV = currentRoot.descendants().reduce(function(kv, el) {kv[el.data.id] = el; return kv},{});\n\n // the currentRoot contains the correct XY positions for all the nodes\n // minus the ones that need to be hidden. We don't want to limit the\n // number of nodes for our data elements, since that causes text and lines to\n // `jump` around. So we need to make sure we have the same amount of elements\n // and hide rendering the hidden ones.\n var toRender = root.descendants().map(function(el) {\n if (currentRootKV[el.data.id]) {\n var newNode = currentRootKV[el.data.id];\n return newNode;\n } else {\n // if the child is not in the KV map, it is hidden. We\n // now need to set its position to the calculated position of\n // the first visible parent. In other words, the first one\n // which is in the currentRootKV map.\n var fromRoot = _.cloneDeep(el);\n var parent = fromRoot.parent;\n while (!currentRootKV[parent.data.id]) {\n parent = parent.parent;\n }\n var newParent = currentRootKV[parent.data.id];\n\n fromRoot.hidden = true;\n fromRoot.x = newParent.x;\n fromRoot.y = newParent.y;\n\n // we also set the parents x,y since the lines need to\n // be drawn from this position.\n fromRoot.parent.x = newParent.x;\n fromRoot.parent.y = newParent.y;\n\n return fromRoot;\n }\n });\n\n // now that we have to correct data, create the links\n var links = chart.selectAll(\".link\")\n .data(toRender.slice(1));\n\n var linksEnter = links.enter().append(\"path\")\n .attr(\"class\", \"link\")\n .attr(\"d\", diagonal({x:0, y:0, parent: {x:0, y:0}}))\n .style(\"stroke\", function(d) {return colorScale(d.data.group)});\n\n links.merge(linksEnter)\n .transition().duration(2000).attr(\"d\", diagonal);\n\n // create the groups that hold the circle and the text elements\n var nodes = chart.selectAll(\".node\").data(toRender);\n\n var nodesEnter = nodes.enter().append(\"g\")\n .attr(\"class\", \"node\")\n .on(\"click\", click)\n\n nodesEnter.append(\"circle\")\n .attr(\"r\", 2.5)\n .style(\"fill\", function(d) {return colorScale(d.data.group)});\n\n nodesEnter.append(\"text\")\n .attr(\"dy\", \".31em\")\n\n // combine the updated and new nodes\n var nodesUpdate = nodes.merge(nodesEnter);\n\n // transition the nodes (circles & text)\n nodesUpdate.transition().duration(2000)\n .attr(\"transform\", function(d) { return \"translate(\" + project(d.x, d.y) + \")\"; })\n .style(\"opacity\", function(d) { return !d.hidden ? 1 : 0} )\n .on(\"end\", function(d) {d.hidden ? d3.select(this).attr(\"display\", \"none\"): \"\"})\n .on(\"start\", function(d) {!d.hidden ? d3.select(this).attr(\"display\", \"\"): \"\"});\n\n nodesUpdate.select(\"text\")\n .attr(\"x\", function(d) { return d.x < 180 === !d.children ? 6 : -6; })\n .text(function(d) {return d.data.name; })\n // we could also tween the anchor see chapter 2\n .style(\"text-anchor\", function(d) {\n // for the right side\n if (d.x < 180 && d.children) return \"end\"\n else if (d.x < 180 && !d.children) return \"start\"\n // for the left side\n else if (d.x >= 180 && !d.children) return \"end\"\n else if (d.x >= 180 && d.children) return \"start\"\n })\n .transition().duration(2000)\n .attr(\"transform\", function(d) {\n // called once to determine the target value, and tween the values\n return \"rotate(\" + (d.x < 180 ? d.x - 90 : d.x + 90) + \")\";\n })\n }", "function update_graph_nodes(nodes) {\n\t\t$.each(nodes, function (i, node) {\n\t\t\tvar node_id = node[\"id\"];\n\t\t\tvar ele = g.elements(\"node\" + \"[id='\" + node_id + \"']\")[0];\n\t\t\tif (ele) {\n\t\t\t\tele.data(node);\n\t\t\t\tele.position({x: node.view.position.x, y: node.view.position.y});\n\t\t\t}\n\t\t\telse {\n\t\t\t\talert(node_id + \" no ele\");\n\t\t\t}\n\t\t});\n\t}", "updateNode() {\n for (let b of this.buttons) {\n b.updateNode();\n }\n }", "function refresh() {\n\t\t\tself.getNodePosition();\n\t\t\tself.getViewPortSize();\n\t\t\tcheck(null, {});\n\t\t}", "function refresh() {\n\t\n\t// Set min_cost to be displayed\n\tmin_cost = 2;\n\t\n\t// Load any updates data and attach update event\n\td3.json(\"data/updates.json\", function(json) {\n\t\t\n\t\t// Node updates\n\t\tfor (var i in json.nodes) {\n\t\t\tvar node = json.nodes[i];\n\t\t\tvar node_update = lookup[ node.label ]\n\t\t\tif (node_update != undefined) {\n\t\t\t\tnode_update.area = Math.log( node.cost );\n\t\t\t\tnode_update.cost = Math.log( node.cost ); \n\t\t\t}\n\t\t}\n\t\n\t\t// Run update canvas function\n\t\tupdate();\n\t\t\n\t});\n\t\n}", "function update() {\n redrawView(evalContainer, evalVis, evalData);\n redrawView(detailContainer, detailVis, detailData);\n redrawView(messageContainer, messageVis, messageData);\n }", "updateViewObjects(state) {\n //Node\n if (!this.viewObjects[\"main\"] ||\n (!this.skipLabel && !this.labels[state.labels[this.constructor.name]] && this[state.labels[this.constructor.name]])) {\n this.createViewObjects(state);\n }\n\n if (this.fixed) { copyCoords(this, this.foci || this.layout); }\n\n if (this.controlNodes) {\n copyCoords(this, getCenterOfMass(this.controlNodes).multiplyScalar(2)); //double the distance from center\n }\n\n copyCoords(this.viewObjects[\"main\"].position, this);\n\n this.updateLabels(state.labels[this.constructor.name], state.showLabels[this.constructor.name],\n this.viewObjects[\"main\"].position.clone().addScalar(5 + this.val * state.nodeRelSize));\n }", "function updateAvailableNodes() {\r\n\tvar availableNodesSpan = document.getElementById('available-nodes-span');\r\n\tif (availableNodesSpan != null || availableNodesSpan != undefined) {\r\n\t\tavailableNodesSpan.innerText = countAvailableNodes();\r\n\t}\r\n}", "function update() {\n\n force\n .nodes(nodes)\n .links(links)\n .start();\n\n // Draw links\n var link = zoomContainer.selectAll(\".graph.link\")\n .data(links);\n link.enter().append(\"path\")\n .attr(\"class\", \"graph link\");\n link.exit().remove();\n\n // Draw nodes\n var node = zoomContainer.selectAll(\"#node\")\n .data(nodes);\n\n node\n .enter().append(\"g\")\n .attr(\"id\", \"node\")\n //TODO: fade buttons in and out\n //.on('mouseenter', nodeMouseEnter )\n //.on('mouseleave', function() { console.log('out') } )\n .call(force.drag);\n \n node.exit().remove();\n\n // Draw a background shape for the node.\n // The shape of the node is dependant on the type of node being drawn. An SVG path is used\n // to allow for a dynamic shape.\n node.append('path')\n .attr(\"class\", function(d) { return d.nodeType === 'origin' ? 'graph origin' : \"graph node\"; })\n .attr(\"d\", function(d) { \n if( d.nodeType === 'origin' ) {\n return getCirclePath(0, 0, originRadius);\n }else if( d.get('nodeClass') === 'node' ) { \n var r = calculateRadius(d.get('transitions').length);\n return getCirclePath(0, 0, r);\n }else if( d.get('nodeClass') === 'group' ) {\n return getRectPath(150,50);\n }else {\n console.warn('unknown nodeClass : ' + d.get('nodeClass'));\n return '';\n }\n } );\n\n // Label the node with the name of the hypernode\n node \n .append(\"text\")\n .attr(\"x\", 0)\n .attr(\"y\", function(d) { return d.nodeType === 'origin' ? 20 : 8; } )\n\t\t\t.attr(\"text-anchor\", \"middle\")\n\t\t\t.attr(\"class\", \"graph node title\" )\n .text(function( d ) { return d.get('name'); }); \n\n // Draw a plus icon button for adding new transitions\n var createLinkButton = node \n .append('g')\n .attr('style', function(d) { return d.showLinkButton ? 'visibility:hidden' : '' })\n .on('click', function(d) { eventHandler( { type : 'newTransition', data : {sourceId : d.get('id')} }) } )\n .attr('transform', function(d) { return d.nodeType === 'origin' ? 'translate(0,0)' : 'translate(0,40)' } );\n\n createLinkButton\n .append('circle')\n .attr('r', function(d) { return d.nodeType === 'origin' ? 35 : 25 } )\n .attr('class', 'graph node add-link')\n\n createLinkButton.append('text')\n .attr('text-anchor', 'middle')\n .text('+')\n .attr('x', 0)\n .attr('y', 5 );\n\n // Draw an elipses button for activating the popup menu\n\n var popupButton = node \n .append('g')\n .attr('transform', 'translate(0,-40)')\n .attr('style', function(d) { return d.nodeType === 'origin' || d.get('nodeClass') === 'group' ? 'visibility:hidden' : '' } )\n .on('click', function(d) { \n eventHandler({ type: 'nodeSelected', data: { id: d.get('id') } }, function(){}); \n });\n\n popupButton\n .append('circle')\n .attr('r', '15')\n .attr('class', 'graph node add-link')\n\n popupButton.append('text')\n .attr('text-anchor', 'middle')\n .text('...')\n .attr('x', 0)\n .attr('y', 5 );\n\n // Animation function for the d3 force directed graph\n force.on(\"tick\", function() {\n\n // draw directed edges with proper padding from node centers\n link.attr('d', function(d) {\n\n var sourceX = d.source.x;\n var sourceY = d.source.y;\n var targetX = d.target.x;\n var targetY = d.target.y;\n \n return 'M' + sourceX + ',' + sourceY + 'L' + targetX + ',' + targetY;\n }); \n\n // move the linked nodes into place\n node.attr('transform', function(d) { return 'translate(' + d.x + ',' + d.y + ')'; });\n });\n\n }", "renderNodes() {\n const chart = this.chart;\n chart.selectAll('.node').remove();\n\n const _recursiveBuild = (selection, childrenNodes) => {\n if (!childrenNodes) return;\n const nodesGroup = selection.selectAll('.node')\n .data(childrenNodes)\n .enter().append('g')\n .classed('node', true)\n .attr('transform', d => {\n return svgUtil.translate(d.x, d.y);\n });\n\n nodesGroup.each(function(d) {\n const s = d3.select(this);\n s.append('g').classed('node-ui', true);\n _recursiveBuild(s.append('g'), d.nodes);\n });\n };\n _recursiveBuild(chart, this.layout.nodes);\n chart.selectAll('.node-ui').call(this.renderNode);\n }", "function updateGraphState() {\n var curState = states[stateIndex];\n\n // show the queue, if applicable\n showQueue(curState.queue);\n\n // show distance matrix, if applicable\n showMatrix(curState.matrix);\n\n // update distances, if applicable\n showDistances(curState.distancesMap);\n\n // show heap, if applicable\n displayMinHeap(curState.heap);\n\n // show log, if applicable\n showLog(curState.log);\n\n // update node colors (visited and cur nodes)\n updateNodeColors(curState);\n}", "function update() {\n if (clustersUI[1] == undefined) {\n updateOutline(clustersUI[0], clustersUI[0], \"grey\", paths[0].svg);\n updateOutline(clustersUI[0], clustersUI[0], \"grey\", paths[0].svg);\n } else {\n _.forEach(clustersUI, function(cluster1, idx1) {\n _.forEach(clustersUI, function(cluster2, idx2) {\n if (cluster1 != cluster2) {\n updateOutline(cluster1, cluster2, \"grey\", paths[idx1].svg);\n updateOutline(cluster2, cluster1, \"grey\", paths[idx2].svg);\n }\n })\n })\n }\n domCreated = true;\n }", "update() {\n\t\tthis.node.innerText = this.getTime(this.ticks);\n\t}", "function update() {\n _.forEach(clustersUI, function(cluster1, idx1) {\n _.forEach(clustersUI, function(cluster2, idx2) {\n if (cluster1 != cluster2) {\n updateOutline(cluster1, cluster2, \"grey\", paths[idx1].svg);\n updateOutline(cluster2, cluster1, \"grey\", paths[idx2].svg);\n }\n })\n })\n domCreated = true;\n }", "function updateTotalNodes() {\r\n\tvar totalNodesSpan = document.getElementById('total-nodes-span');\r\n\tif (totalNodesSpan != null || totalNodesSpan != undefined) {\r\n\t\ttotalNodesSpan.innerText = countNodes();\r\n\t}\r\n}", "update() {\n for ( let i = 0; i < this.barNodes.length; i++ ) {\n this.barNodes[ i ].update();\n }\n }", "function updateNodes(nodes){\n\t\tfor (var node of nodes){\n\t\t\tnodeUpdate(node);\n\t\t}\n\t\t\n\t\t\n\t}", "function graphRepositionNodes () {\n for (var nodeId in this.calculationNodes) {\n if (this.calculationNodes.hasOwnProperty(nodeId)) {\n this.calculationNodes[nodeId].vx = 0; this.calculationNodes[nodeId].vy = 0;\n this.calculationNodes[nodeId].fx = 0; this.calculationNodes[nodeId].fy = 0;\n }\n }\n if (this.constants.hierarchicalLayout.enabled == true) {\n this._setupHierarchicalLayout();\n showValueOfRange.call(this, 'graph_H_nd', 1, \"physics_hierarchicalRepulsion_nodeDistance\");\n showValueOfRange.call(this, 'graph_H_cg', 1, \"physics_centralGravity\");\n showValueOfRange.call(this, 'graph_H_sc', 1, \"physics_springConstant\");\n showValueOfRange.call(this, 'graph_H_sl', 1, \"physics_springLength\");\n showValueOfRange.call(this, 'graph_H_damp', 1, \"physics_damping\");\n }\n else {\n this.repositionNodes();\n }\n this.moving = true;\n this.start();\n }", "function refresh_node_values(nodes) {\n var i;\n for (i = 0; i < nodes.length; i++) {\n if (nodes[i].onWorldChange) {\n nodes[i].onWorldChange(world);\n }\n }\n }", "function refresh_node_values(nodes) {\n var i;\n for (i = 0; i < nodes.length; i++) {\n if (nodes[i].onWorldChange) {\n nodes[i].onWorldChange(world);\n }\n }\n }", "function drawNodes() {\r\n that.nodeList.forEach(element => {\r\n c.node = element;\r\n c.nodeRadius = 40;\r\n c.beginPath();\r\n c.strokeStyle = \"black\";\r\n c.fillStyle = \"black\";\r\n c.arc(c.node.x, c.node.y, c.nodeRadius, 0, 2 * Math.PI, false);\r\n c.fill();\r\n c.stroke();\r\n c.closePath();\r\n\r\n // kvadrat i text id\r\n c.beginPath();\r\n c.fillStyle = \"yellow\";\r\n c.fillRect(c.node.x + 44, c.node.y + 8, 60, 60);\r\n c.stroke();\r\n c.closePath();\r\n // id\r\n c.beginPath();\r\n c.fillStyle = \"black\";\r\n c.font = \"40px Verdana\";\r\n c.fillText(c.node.id, c.node.x + 50, c.node.y + 50)\r\n c.fill();\r\n c.stroke();\r\n c.closePath();\r\n\r\n cNodesList.push(Object.assign({}, c));\r\n });\r\n\r\n }", "function update() {\n updateBodyCostDisplay();\n updateAddedComponentDisplay();\n updateBodyStringDisplay();\n updateComponentCountDisplay();\n updateComponentCountTable();\n updateProgressBar();\n }", "toggleNodes() {\n\t\tif (this.toggleVisibility) {\n\t\t\tthis.hideNodes();\n\t\t\tthis.toggleVisibility = false;\n\t\t} else {\n\t\t\tthis.showNodes();\n\t\t\tthis.toggleVisibility = true;\n\t\t}\n\t}", "function update() {\n updateLinks();\n updateDummyLinks();\n updateNodes(); \n\n // sets the graph in motion\n force\n .nodes(dataset.nodes)\n .force(\"link\").links(dataset.edges);\n\n force.alphaTarget(0.3).restart();\n}", "function TreeGrid_Update(theObject)\n{\n\t//clean up the paint \n\tTreeGrid_Paint_CleanUp(theObject);\n\t//clean up the content\n\tTreeGrid_Content_CleanUp(theObject);\n\t//visible?\n\tif (Get_Bool(theObject.Properties[__NEMESIS_PROPERTY_VISIBLE], true))\n\t{\n\t\t//now update the header\n\t\tTreeGrid_UpdateContent_Headers(theObject);\n\t\t//and then the tree part\n\t\tTreeGrid_UpdateContent_Tree(theObject);\n\t\t//and the content\n\t\tTreeGrid_UpdateContent_Cells(theObject);\n\t\t//create the lines\n\t\tTreeGrid_UpdateContent_Lines(theObject);\n\t\t//Trigger the selection\n\t\tTreeGrid_UpdateSelection(theObject);\n\t\t//Finally Refresh the TreeGrid\n\t\tTreeGrid_Paint(theObject);\n\t}\n}", "updateStats() {\n if (this.visualize) {\n var ncount = document.getElementById(\"ncount\");\n ncount.innerHTML = \"Neutron count: \" + this.neutrons.length;\n\n var meanHeat = document.getElementById(\"meanHeat\");\n meanHeat.innerHTML = \"Mean heat: \" + this.getMeanHeat();\n }\n }", "function updateDisplay() {\n\n crawlerModel.user = _useVenueData ? _venueData.messages : _deviceData.messages;\n $scope.mode = ( _useVenueData ? _venueData.mode : _deviceData.mode ) || 'full-size';\n $scope.mode = 'full-size';\n\n getTVGrid();\n\n ogAds.getCurrentAd()\n .then( function ( currentAd ) {\n crawlerModel.ads = currentAd.textAds || [];\n } )\n .then( reloadTweets )\n .then( function () {\n\n $log.debug( \"Rebuilding hz scroller feed\" );\n var tempArr = [];\n crawlerModel.user.forEach( function ( um ) {\n tempArr.push( { text: um, style: { color: '#ffffff' } } )\n } );\n\n crawlerModel.twitter.forEach( function ( um ) {\n tempArr.push( { text: um, style: { color: '#87CEEB' } } )\n } );\n\n crawlerModel.ads.forEach( function ( um ) {\n tempArr.push( { text: um, style: { color: '#ccf936' } } )\n } );\n\n tempArr = tempArr.filter( function ( x ) {\n return (x !== (undefined || !x.message));\n } );\n\n $scope.crawlerMessages = _.shuffle( tempArr );\n } );\n\n }", "setNodes(nodes) {\n this._nodes = nodes\n }", "renderNodesDelta() {\n const chart = this.chart;\n\n const _recursiveBuild = (selection, childrenNodes) => {\n if (!childrenNodes) return;\n\n const nodesGroup = selection.selectAll('.node').filter(function() {\n return this.parentNode === selection.node();\n }).data(childrenNodes, d => d.id);\n\n const newNodes = nodesGroup.enter().append('g')\n .classed('node', true);\n\n // nodesGroup.exit().remove();\n nodesGroup.exit().each(d => (d.state = 'removed'));\n newNodes.each(d => (d.state = 'new'));\n nodesGroup.each(d => (d.state = 'updated'));\n\n [newNodes, nodesGroup].forEach(g => {\n g.each(function(d) {\n const selection = d3.select(this);\n\n // Allocate for the node itself\n if (selection.select('.node-ui').size() === 0) {\n selection.append('g').classed('node-ui', true);\n }\n selection.select('.node-ui').datum(d);\n\n // Allocate for the node's children\n if (selection.select('.node-children').size() === 0) {\n selection.append('g').classed('node-children', true);\n }\n _recursiveBuild(selection.select('.node-children'), d.nodes);\n });\n\n g.transition().duration(1000).attr('transform', d => {\n return svgUtil.translate(d.x, d.y);\n });\n });\n };\n _recursiveBuild(chart, this.layout.nodes);\n\n chart.selectAll('.node-ui').filter(d => d.state === 'new').call(this.renderNodeAdded);\n chart.selectAll('.node-ui').filter(d => d.state === 'updated').call(this.renderNodeUpdated);\n chart.selectAll('.node-ui').filter(d => d.state === 'removed').call(this.renderNodeRemoved);\n }", "function setNodesPosition(nodes) {\n var deferred = $.Deferred();\n if ( nodes.length == 0 ) { deferred.resolve(); return deferred.promise(); }\n var lab_filename = $('#lab-viewport').attr('data-path');\n var form_data = [];\n form_data=nodes;\n var url = '/api/labs' + lab_filename + '/nodes' ;\n var type = 'PUT';\n $.ajax({\n cache: false,\n timeout: TIMEOUT,\n type: type,\n url: encodeURI(url),\n dataType: 'json',\n data: JSON.stringify(form_data),\n success: function (data) {\n if (data['status'] == 'success') {\n logger(1, 'DEBUG: node position updated.');\n deferred.resolve();\n } else {\n // Application error\n logger(1, 'DEBUG: application error (' + data['status'] + ') on ' + type + ' ' + url + ' (' + data['message'] + ').');\n deferred.reject(data['message']);\n }\n },\n error: function (data) {\n // Server error\n var message = getJsonMessage(data['responseText']);\n logger(1, 'DEBUG: server error (' + data['status'] + ') on ' + type + ' ' + url + '.');\n logger(1, 'DEBUG: ' + message);\n deferred.reject(message);\n }\n });\n return deferred.promise();\n}", "function updateSelectedNes() {\n\t\tif (this.dottedSelection.x != 0 && this.dottedSelection.y != 0) {\n\t\t\tvar mapScL = document.getElementById(\"MAP\").scrollLeft;\n\t\t\tvar mapScT = document.getElementById(\"MAP\").scrollTop;\n\t\t\tfor (var i = 0; i < this.selectedNetworkElements.getLength(); i++) {\n\t\t\t\tvar ne = this.selectedNetworkElements.get(i);\n\t\t\t\tif (this.dottedSelection.isHidden()) {\n\t\t\t\t\tne.allocate(ne.x + this.dottedSelection.x + mapScL, ne.y + this.dottedSelection.y + mapScT);\n\t\t\t\t} else {\n\t\t\t\t\tne.allocate(ne.x + this.dottedSelection.x - BORDER_WH + mapScL, ne.y + this.dottedSelection.y - BORDER_WH + mapScT);\n\t\t\t\t}\n\t\t\t\tif (ne.miniNE != null) {\n\t\t\t\t\tne.miniNE.writeMiniNetworkElement(ne);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (var i = 0; i < this.selectedNetworkElements.getLength(); i++) {\n\t\t\t\tthis.selectedNetworkElements.get(i).updatePorts();\n\t\t\t}\n\t\t}\n\t\tthis.dottedSelection.release();\n\t\tthis.setDottedSelection();\n\t}", "function updateNodes(type){\n if(first){ document.getElementById(\"intro\").remove();\n first = 0;\n }\n \n \n //Check if nodes are to be updated or added \n var extracted = nodes.filter(function(d) {return d.type!=type;}); \n \n if(extracted.length != nodes.length){\n nodes = extracted;\n \n }else{ \n var toAdd = data.filter(function(d) { return d.type==type;}); \n \n toAdd.forEach(function(d){\n nodes.push(d)\n }); \n }\n \n //Create all dots in graph \n var dots = svg.selectAll(\".dot\").data(nodes); \n \n updateAxis(); \n dots.exit().remove(); \n \n dots = dots\n .enter()\n .append(\"circle\")\n .attr(\"class\", \"dot\")\n .attr(\"r\", 3.5)\n .attr(\"cx\", xMap)\n .attr(\"cy\", yMap)\n .style(\"fill\", function(d) { return color(cValue(d));})\n .style(\"opacity\", function(d){\n if(xMap(d)==0){ \n return 0;\n }else{\n return 1;\n }})\n .merge(dots);\n \n updateTooltip();\n \n \n}", "function updateElements() { //Main loop logic here.\r\n updateResourceDisplay();\r\n updateCoreDisplay();\r\n}", "function updateAndShow(src,forceFit) {\n om.root.removeComputed();\n om.root.deepUpdate(om.overrides);\n if (forceFit) draw.mainCanvas.fitContents();\n draw.refresh();\n if (src!=\"tree\") tree.initShapeTreeWidget();\n }", "function updateGeo() {\r\n Graph.nodeRelSize(nodeSize); \r\n }", "function updateOutgoingNodesData(currElements) {\n\n\t\t//console.log(\"updating data of\", currElements);\n\n\t\t// loop through board data\n\t\tlet onlyNodes = [];\n\t\tcurrElements.forEach(function (element) {\n\n\t\t\t// if the element is not a node, skip it\n\t\t\tif (element['type'] != \"prettyNode\") return;\n\n\t\t\t//element['data']['incomingNodes'] = getIncomers(element, currElements);\n\t\t\telement['data']['outgoingNodes'] = getOutgoers(element, currElements);\n\t\t\tonlyNodes.push(element);\n\n\t\t});\n\t\t//console.log(document.getElementsByClassName(\"react-flow__node\"));\n\n\t\t//the point of the code below is a workaround for the node not re-rendering on data change\n\t\t//loop through the html of the nodes\n\t\tlet i = 0;\n\t\tlet htmlNodes = document.getElementsByClassName(\"react-flow__node\");\n\t\tfor (i = 0; i < htmlNodes.length; i++) {\n\n\t\t\t//get id of the node from the class name\n\t\t\tlet htmlNodeId = htmlNodes[i].classList[2];\n\n\t\t\tlet j = 0;\n\t\t\tfor (j = 0; j < onlyNodes.length; j++) {\n\t\t\t\t//if id of html node matches the json data node, update the outgoingNodes counter\n\t\t\t\tif (htmlNodeId == onlyNodes[j]['id']) {\n\t\t\t\t\tlet currLabel = htmlNodes[i].getElementsByClassName(\"MuiChip-label\")[0];\n\t\t\t\t\tcurrLabel.innerText = onlyNodes[j]['data']['outgoingNodes'].length + \"\";\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn currElements;\n\t}", "function updateDisplay() {\n if (view == 'assignments') {\n $('#graded-items').hide();\n\n $('#assignments').show();\n $('.assignment-progress-bar').show();\n updateAssignments((a) => {\n assignments = a;\n displayAssignments(assignments);\n });\n } else if (view == 'gradedItems') {\n $('#assignments').hide();\n $('.assignment-progress-bar').hide();\n\n $('#graded-items').show();\n updateGradedItems((g) => {\n gradedItems = g;\n displayGradedItems(gradedItems);\n });\n }\n }", "function updateDisplay () {\n\n showValue('.held-value',heldValue);\n showValue('.next-Value',nextValue);\n}", "function Interpreter_UpdateDisplay()\n{\n\t//helpers\n\tvar uidObject, theObject;\n\t//loop through all of our iframes\n\tfor (uidObject in this.LoadedIFrames)\n\t{\n\t\t//get the object\n\t\ttheObject = this.LoadedIFrames[uidObject];\n\t\t//valid?\n\t\tif (theObject && theObject.HTML)\n\t\t{\n\t\t\t//purge all css data\n\t\t\tBrowser_RemoveCSSData_Purge(theObject.HTML.contentDocument);\n\t\t}\n\t}\n\t//purge all css data from main doc too\n\tBrowser_RemoveCSSData_Purge(document);\n\t//loop through all toplevel objects\n\tfor (uidObject in this.TopLevelObjects)\n\t{\n\t\t//get the object\n\t\ttheObject = this.TopLevelObjects[uidObject];\n\t\t//valid?\n\t\tif (theObject)\n\t\t{\n\t\t\t//update it with full recursion\n\t\t\ttheObject.UpdateDisplay(true);\n\t\t}\n\t}\n\t//rearrange the forms\n\tForm_RearrangeForms(this.FocusedFormId);\n\t//and reset this\n\tthis.FocusedFormId = [];\n\t//have we got a focused object id? (AND NOT IN DESIGNER)\n\tif (this.State && this.State.FocusedObjectId > 0)\n\t{\n\t\t//memorise it\n\t\tthis.FocusedObjectId = this.State.FocusedObjectId;\n\t}\n\t//we need to handle the tabs here\n\tthis.PreUpdatePostDisplay();\n}", "function update(nodes, links, sourceNode) {\n const originalNodes = allNodes;\n const originalLinks = allLinks;\n\n // update pattern: https://livebook.manning.com/book/d3js-in-action-second-edition/chapter-7/142\n const centerNode = originalNodes.filter(d => d.id === sourceNode.id)\n links = originalLinks.filter(d =>\n centerNode.includes(d.source) ||\n centerNode.includes(d.target))\n\n nodes = links.map(d => {\n return originalNodes.filter(item =>\n d.source.id.includes(item.id) ||\n d.target.id.includes(item.id))\n }).flat()\n\n nodes = nodes.reduce((acc, current) => {\n const x = acc.find(item => item.id === current.id);\n if (!x) {\n return acc.concat([current]);\n } else {\n return acc;\n }\n }, []);\n\n console.log(d3.select(\".network\").selectAll(\".node\").data(nodes));\n console.log(links)\n console.log(nodes)\n\n d3.select(\".network\").select(\".nodes\").selectAll(\".node\")\n .data(nodes)\n .join( enter => {\n const nodeEnter = enter.append(\"g\").attr(\"class\",\"node\")\n .on('click', function(d){\n update(nodes, links, d)\n nodeInfo.html(`<span class=\"node-info__label\">${d.label}</span> <a class=\"node-info__link\" href=${d.id} target=__blank>${d.id}</a>`)\n .style(\"display\", \"block\")\n })\n .on(\"mouseover\", d => {\n return tooltip.style(\"visibility\", \"visible\")\n .text(d.label)\n })\n .on(\"mousemove\", () => {\n // tt positioning: https://www.d3-graph-gallery.com/graph/interactivity_tooltip.html\n return tooltip.style(\"top\", (event.pageY-10)+\"px\").style(\"left\",(event.pageX+10)+\"px\")\n })\n .on(\"mouseout\", () => {\n return tooltip.style(\"visibility\", \"hidden\")\n })\n\n tickLink(node)\n // .attr(\"transform\", function(d) {\n // return \"translate(\" + d.x + \",\" + d.y + \")\";\n // });\n nodeEnter.append(\"circle\")\n .attr(\"r\", function(d) {\n if (d.type === \"node\") {\n return 10;\n } else {\n return 6;\n }\n })\n .attr(\"class\", d => `type-${d.type}`)\n .call(d3.drag()\n .on(\"start\", dragstarted)\n .on(\"drag\", dragged)\n .on(\"end\", dragended));\n },\n update => {\n update.select(\".node\")\n update.select(\"circle\").attr(\"r\", function(d) {\n if (d.type === \"node\") {\n return 10;\n } else {\n return 6;\n }\n }).attr(\"class\", d => `type-${d.type}`)\n .call(d3.drag()\n .on(\"start\", dragstarted)\n .on(\"drag\", dragged)\n .on(\"end\", dragended))\n })\n // exit => exit\n // .call(exit => exit.remove())\n\n d3.select(\".network\").select(\".links\").selectAll(\".link\")\n .data(links)\n .join( enter => {\n enter.append(\"line\")\n .attr(\"class\",\"link\")\n\n tickLink(link)\n // .attr(\"x1\", function(d) { return d.source.x; })\n // .attr(\"y1\", function(d) { return d.source.y; })\n // .attr(\"x2\", function(d) { return d.target.x; })\n // .attr(\"y2\", function(d) { return d.target.y; });\n },\n update => {\n update.select(\".link\")\n .attr(\"x1\", function(d) {\n return d.source.x;\n })\n\n tickLink(link)\n // .attr(\"y1\", function(d) { return d.source.y; })\n // .attr(\"x2\", function(d) { return d.target.x; })\n // .attr(\"y2\", function(d) { return d.target.y; });\n })\n\n\n // simulation\n // //.nodes(nodes)\n // .on(\"tick\", () => {\n // ticked(link, node)\n // });\n\n\n\n // simulation.force(\"link\")\n // .links(links);\n }", "updateNode() {\n if (selectedType === this.type) {\n this.contour.removeAttribute(\"display\");\n } else {\n this.contour.setAttribute(\"display\", \"none\");\n }\n }", "updateNodesVisibility () {\n let skipped;\n\n for (let i = Object.keys(this.columnCache).length; i--;) {\n skipped = 0;\n // Update `y` according to the number of previously skipped nodes.\n for (let j = 0, len = this.columnNodeOrder[i].length; j < len; j++) {\n if (\n this.columnNodeOrder[i][j].hidden &&\n !this.columnNodeOrder[i][j].data.queryMode\n ) {\n skipped++;\n }\n this.columnNodeOrder[i][j].y = this.scale.y(j - skipped);\n }\n }\n\n return this;\n }", "function updateDisplay() {\n\tshowValue(\".next-value\", nextValue);\n\tshowValue(\".held-value\", heldValue);\n}", "function displayNodesinfo() {\n\n\t\tvar ptx = 0,\n\t\t\tpty = 0,\n\t\t\tarrpt = [],\n\t\t\tt;\n\t\tvar svgg = theSvgElement.getElementsByClassName('textsqueleton');\n\t\tfor (var i = 0; i <= svgg.length - 1; i += 1) {\n\t\t\tsvgg[i].addEventListener('mouseover', function(evt) {\n\t\t\t\tt = evt.target;\n\t\t\t\tarrpt = t.id.split(\" \");\n\n\t\t\t\t//1: Views; 3: Shapes; 5: Points\n\t\t\t\tptx = theObj.Views[arrpt[1]].Shapes[arrpt[3]].Points[arrpt[5]].x;\n\t\t\t\tpty = theObj.Views[arrpt[1]].Shapes[arrpt[3]].Points[arrpt[5]].y;\n\n\t\t\t\tvar elemx = document.getElementById(\"nodeinfox\");\n\t\t\t\tvar elemy = document.getElementById(\"nodeinfoy\");\n\n\t\t\t\telemx.setAttribute(\"type\", \"text\");\n\t\t\t\telemy.setAttribute(\"type\", \"text\");\n\n\t\t\t\telemx.readOnly = true;\n\t\t\t\telemy.readOnly = true;\n\n\t\t\t\telemx.size = 10;\n\t\t\t\telemy.size = 10;\n\n\t\t\t\telemx.value = ptx;\n\t\t\t\telemy.value = pty;\n\n\t\t\t\tdocument.getElementById(\"outputsqueleton\").innerHTML = \"View: \" + arrpt[1] + \" / Shape: \" + arrpt[3];\n\t\t\t});\n\t\t\tsvgg[i].addEventListener('mouseout', function() {\n\t\t\t\tdocument.getElementById(\"nodeinfox\").value = \"\";\n\t\t\t\tdocument.getElementById(\"nodeinfoy\").value = \"\";\n\t\t\t\tdocument.getElementById(\"outputsqueleton\").innerHTML = \"\";\n\n\t\t\t});\n\t\t}\n\n\t\treturn 0;\n\t}", "function update() {\n\n\tupdateFocus();\n\tupdateFamilyTooltip();\n\tupdateHighlights();\n}", "function refreshDisplay() {\r\n\r\n if (useOfflineSync) {\r\n syncLocalTable().then(displayItems);\r\n } else {\r\n displayItems();\r\n }\r\n }", "function updateTree(source) {\n if (treeOrientation) {\n treeLayout.size([innerWidth, innerHeight]);\n linkPathGenerator = d3.linkVertical().x(d => d.x).y(d => d.y);\n } else {\n treeLayout.size([innerHeight, innerWidth]);\n linkPathGenerator = d3.linkHorizontal().x(d => d.y).y(d => d.x);\n }\n console.log(source);\n // Compute the new tree layout.\n treeLayout(root);\n const nodes = root.descendants();// Get an array of all the nodes\n const links = root.links();// Get an array of all the links\n console.log(nodes)\n console.log(links)\n\n // ****************** Nodes section ***************************\n //Joining new data\n const node = g.selectAll('g')\n .data(nodes, d => d.id || (d.id = ++i));\n\n /*** Nodes Enter Selection ***/\n // Enter any new nodes at the parent's previous position.\n const enterNode = node.enter().append('g')\n .attr('class', 'node')\n .attr('transform', treeOrientation ? `translate(${source.x0},${source.y0})` : `translate(${source.y0},${source.x0})`)\n .on('click', nodeClicked);\n\n // Add Circle for the nodes\n enterNode.append('circle')\n .attr('class', 'node')\n .attr('r', 1e-6)\n .style(\"fill\", d => d._children ? \"#fdc793\" : \"#fff\")\n\n // Add labels for the nodes\n enterNode.append('text')\n .text(d => `${d.data['Scientific name']}(${d.data.PICount})`)\n .style(\"fill-opacity\", 1e-6);\n\n /*** Nodes Update Selection ***/\n const updateNode = enterNode.merge(node);\n\n // Transition to the proper position for the node\n updateNode.transition(getTransition())\n .attr('transform', d => treeOrientation ? `translate(${d.x},${d.y})` : `translate(${d.y},${d.x})`)\n\n // Update the Circle attributes and style\n updateNode.select('circle')\n .transition(getTransition())\n .attr('r', 5)\n .style(\"fill\", d => d._children ? \"#fdc793\" : \"#fff\")\n .attr('cursor', 'pointer');\n\n // Update the Labels attributes and style\n updateNode.select(\"text\")\n .text(d => `${d.data['Scientific name']}(${d.data.PICount})`)\n .transition(getTransition())\n /* This sets the \"Y\" position of \"Root\" node and the \n \"Leaf\" nodes */\n .attr('y', d => {\n if (treeOrientation) {\n if (!d.parent || (!d.parent && !d.children)) return -20\n else if (!d.children) {\n return 5\n }\n }\n else {\n if (d.parent && d.children) { return d.altCount ? -25 : 25 }\n }\n })\n /* This sets the \"X\" position of intermediate nodes depending upon\n the value of their boolean variable \"altCount\" */\n .attr('x', d => {\n if (treeOrientation) {\n if (d.parent && d.children) { return d.altCount ? -15 : 15 }\n else if (!d.children) {\n return 15\n }\n }\n else {\n if (!d.parent) return -20\n else if (!d.children) {\n return 13\n }\n }\n })\n /* This sets the label text anchors of nodes depending upon whether\n they are Root, Leaf or intermediatry nodes */\n .attr('text-anchor', d => {\n if (treeOrientation) {\n if (!d.parent) return \"middle\" //Root Node\n else if (!d.children) {// Leaf Nodes\n return \"start\"\n } else {\n return d.altCount ? \"end\" : \"start\"\n }\n }\n else {\n if (!d.parent) return \"end\" //Root Node\n else if (!d.children) {// Leaf Nodes\n return \"start\"\n } else {\n return \"middle\"\n }\n }\n })\n .attr('transform', d => {\n if (treeOrientation)\n return (d.parent && !d.children) ? 'rotate(90)' : 'rotate(0)'\n })\n .style(\"fill-opacity\", 1);\n\n /*** Nodes Exit Selection ***/\n const exitNode = node.exit().transition(getTransition())\n .attr('transform', treeOrientation ? `translate(${source.x},${source.y})` : `translate(${source.y},${source.x})`)\n .remove();\n\n // On exit reduce the node circles size to 0\n exitNode.select('circle')\n .attr('r', 1e-6);\n\n // On exit reduce the opacity of text labels\n exitNode.select('text')\n .style('fill-opacity', 1e-6);\n\n\n // ****************** links section ***************************\n const link = g.selectAll('path')\n .data(links, d => d.target.id);// Data Join\n\n /*** Links Enter/Update Selection ***/\n link.enter().insert('path', 'g')// Enter Selection\n .attr('class', 'link')\n .attr('d', treeOrientation\n ? d3.linkVertical().x(source.x0).y(source.y0)\n : d3.linkHorizontal().x(source.y0).y(source.x0))\n .merge(link)// Update Selection\n .transition(getTransition())\n .attr('d', linkPathGenerator);\n\n /*** Links Exit Selection ***/\n link.exit().transition(getTransition())\n .attr('d', treeOrientation\n ? d3.linkVertical().x(source.x).y(source.y)\n : d3.linkHorizontal().x(source.y).y(source.x))\n .remove();\n\n // Store the old positions for transition.\n nodes.forEach(function (d) {\n d.x0 = d.x;\n d.y0 = d.y;\n });\n}", "function update(source) {\n if (!source)\n return;\n\n /*\n * Calculate the max label width of all visible nodes\n */\n var maxLabelLength = calcLabelWidth(root, 0);\n\n /*\n * Set the node size according to the maximum width of the labels\n * ensuring that no labels overlaps with another node\n */\n tree.nodeSize([maxLabelLength * WIDTH_PER_CHARACTER, NODE_HEIGHT]);\n\n /*\n * The layout converts the hierarchy of data nodes\n * presented by root into an array of tree layout nodes\n */\n var nodes = tree.nodes(root).reverse();\n\n var minX = 0;\n var maxX = 0;\n var minY = 0;\n var maxY = 0;\n // Normalize for fixed-depth.\n nodes.forEach(function (node) {\n node.y = node.depth * DEPTH_HEIGHT + TOP_MARGIN;\n node.x = node.x + (isTopToBottom() ? (scope.width / 2) : ((scope.height / 2) - CHILDREN_ICON_Y));\n\n minX = Math.min(minX, node.x);\n minY = Math.min(minY, node.y);\n maxX = Math.max(maxX, node.x);\n maxY = Math.max(maxY, node.y);\n });\n\n /*\n * Modify the dimensions of the svg canvas\n * in order to allow most of the nodes to be\n * displayable using the scrollbars\n */\n var g = 80;\n var w = Math.abs(minX) + Math.abs(maxX);\n var h = Math.abs(minY) + Math.abs(maxY);\n\n scope.preferredWidth = scope.width;\n scope.preferredHeight = scope.height;\n\n if ((w + g) > scope.preferredWidth)\n scope.preferredWidth = w + g;\n\n if ((h + g) > scope.preferredHeight)\n scope.preferredHeight = h + g;\n\n svg.attr(D3V.CSS_WIDTH, scope.preferredWidth)\n .attr(D3V.CSS_HEIGHT, scope.preferredHeight);\n\n /*\n * Select all existing nodes\n */\n var nodeSelection = svgGroup.selectAll(D3V.GROUP_ELEMENT + SYNTAX.DOT + D3V.NODE);\n\n /*\n * Map and append all new nodes from the data array\n * to the node selection\n */\n var updateNodeSelection = nodeSelection.data(nodes, function (node) {\n // self link will be unique while the id is not necessarily\n return id(node);\n });\n\n /*\n * Selection of new nodes being added to layout\n */\n var enterNodes = updateNodeSelection.enter();\n\n /*\n * Add group element to enter nodes\n */\n var enterNodesGroup = enterNodes.append(D3V.GROUP_ELEMENT);\n\n /*\n * Adds the\n * transform for x,y\n * node group id\n * click handler to new nodes\n */\n enterNodesGroup.attr(\"class\", \"node\")\n .attr(D3V.SVG_TRANSFORM, function (node) {\n var x = isTopToBottom() ? source.x : source.y;\n var y = isTopToBottom() ? source.y : source.x;\n\n return D3V.SVG_TRANSLATE + SYNTAX.OPEN_BRACKET + x + SYNTAX.COMMA + y + SYNTAX.CLOSE_BRACKET;\n })\n .attr(D3V.ID, function (node) {\n return id(node);\n });\n\n /*\n * Append the id to each new node\n *\n * text-anchor=\"middle\" will anchor the text using the centre\n * of the label at the location specified by the x attribute\n *\n * Note: the y and dy attributes locate the text using the\n * bottom-left of the text block\n */\n enterNodesGroup.append(D3V.HTML_TEXT)\n .attr(D3V.HTML_TEXT_ANCHOR, D3V.MIDDLE)\n .attr(D3V.HTML_DY, TEXT_ORIGIN_Y)\n .style(D3V.CSS_FILL_OPACITY, 1)\n .text(function (node) {\n return node[VDB_KEYS.ID];\n })\n .on(D3V.HTML_CLICK, selectionCallback);\n\n /*\n * Append the type to each new node\n *\n * text-anchor=\"middle\" will anchor the text using the centre\n * of the label at the location specified by the x attribute\n *\n * Note: the y and dy attributes locate the text using the\n * bottom-left of the text block\n */\n enterNodesGroup.append(D3V.HTML_TEXT)\n .attr(D3V.HTML_TEXT_ANCHOR, D3V.MIDDLE)\n .attr(D3V.HTML_DY, TEXT_ORIGIN_Y + TEXT_HEIGHT)\n .style(D3V.CSS_FILL_OPACITY, 1)\n .text(function (node) {\n return SYNTAX.COLON + SYNTAX.OPEN_SQUARE_BRACKET + node[VDB_KEYS.TYPE] + SYNTAX.CLOSE_SQUARE_BRACKET;\n })\n .on(D3V.HTML_CLICK, selectionCallback);\n\n /*\n * Centre the icon above the circle\n */\n enterNodesGroup.append(D3V.HTML_IMAGE)\n .attr(D3V.HTML_X, IMAGE_X)\n .attr(D3V.HTML_Y, IMAGE_Y)\n .each(imageResourceCallback)\n .on(D3V.HTML_CLICK, selectionCallback);\n\n if (scope.displayParents) {\n /*\n * Add parent indicator circles above the image\n * Added after the items with the selection callback to\n * ensure its above in the 'z-order'.\n */\n enterNodesGroup.append(D3V.SVG_CIRCLE)\n .attr(D3V.ID, PARENT_BUTTON_ID)\n .attr(D3V.HTML_RADIUS, 1e-6)\n .attr(D3V.SVG_CIRCLE_Y, PARENT_ICON_Y)\n .style(D3V.CSS_FILL, BLACK)\n .on(D3V.HTML_CLICK, expandCollapseParentCallback);\n }\n\n /*\n * Add children indicator circles below the image\n * Added after the items with the selection callback to\n * ensure its above in the 'z-order'.\n */\n enterNodesGroup.append(D3V.SVG_CIRCLE)\n .attr(D3V.ID, CHILD_BUTTON_ID)\n .attr(D3V.HTML_RADIUS, 1e-6)\n .attr(D3V.SVG_CIRCLE_Y, CHILDREN_ICON_Y)\n .style(D3V.CSS_FILL, BLACK)\n .on(D3V.HTML_CLICK, expandCollapseChildCallback);\n\n /*\n * Animate new nodes, ie. child nodes being displayed after expanding parent, \n * using a transition. This will move the new nodes from parent nodes to their\n * final destination.\n */\n var nodeUpdate = updateNodeSelection.transition()\n .duration(TRANSITION_DURATION)\n .attr(D3V.SVG_TRANSFORM, function (node) {\n var x = isTopToBottom() ? node.x : node.y;\n var y = isTopToBottom() ? node.y : node.x;\n\n return D3V.SVG_TRANSLATE + SYNTAX.OPEN_BRACKET + x + SYNTAX.COMMA + y + SYNTAX.CLOSE_BRACKET;\n });\n\n /*\n * All circles currently being updated have their radius enlarged to their\n * destination visible size.\n */\n if (scope.displayParents) {\n nodeUpdate.select(SYNTAX.HASH + PARENT_BUTTON_ID)\n .attr(D3V.HTML_RADIUS, function (node) {\n return hasParent(node) ? 3.5 : 1e-10;\n })\n .style(D3V.CSS_FILL, BLACK);\n }\n\n nodeUpdate.select(SYNTAX.HASH + CHILD_BUTTON_ID)\n .attr(D3V.HTML_RADIUS, function (node) {\n return node[VDB_KEYS.HAS_CHILDREN] ? 3.5 : 1e-10;\n })\n .style(D3V.CSS_FILL, BLACK);\n\n /*\n * Animate the removal of nodes being removed from the diagram\n * when a parent node is contracted.\n */\n var nodeExit = updateNodeSelection.exit().transition()\n .duration(TRANSITION_DURATION)\n .attr(D3V.SVG_TRANSFORM, function (node) {\n var x = isTopToBottom() ? source.x : source.y;\n var y = isTopToBottom() ? source.y : source.x;\n\n return D3V.SVG_TRANSLATE + SYNTAX.OPEN_BRACKET + x + SYNTAX.COMMA + y + SYNTAX.CLOSE_BRACKET;\n })\n .remove();\n\n /*\n * Make the removed nodes circles too small to be visible\n */\n nodeExit.selectAll(D3V.SVG_CIRCLE)\n .attr(D3V.HTML_RADIUS, 1e-6);\n\n /*\n * Update the locations of all remaining nodes based on where\n * the layout has now located them\n */\n nodes.forEach(function (node) {\n node.x0 = node.x;\n node.y0 = node.y;\n });\n\n updateLinks(source, nodes);\n }", "function updatePoints() {\n var prev = {y: 0, num: 0};\n obj.points = [];\n for (var j = 0, jj = obj.visibleNodes.length; j < jj; j++) {\n var offset = obj.visibleNodes[j].$li.offset(),\n y = Math.round(offset.top);\n obj.visibleNodes[j].top = y;\n obj.visibleNodes[j].left = Math.round(offset.left);\n if (prev.y) {\n var q = (y - prev.y) / 4;\n for (var i = prev.y; i < y; i++) {\n var where = (i - prev.y < q)?\"above\":(i - prev.y < q * 3)?\"append\":\"below\";\n obj.points[i] = {num: prev.num, where: where, top: prev.y};\n }\n }\n if (j == jj - 1) {\n var q = (obj.visibleNodes[j].height) / 4;\n for (var i = y; i < y + obj.visibleNodes[j].height; i++) {\n var where = (i - y < q)?\"above\":(i - y < q * 3)?\"append\":\"below\";\n obj.points[i] = {num: j, where: where, top: y};\n }\n }\n prev.y = y;\n prev.num = j;\n }\n }", "function paintAll() {\n var nodes = tree.nodes(mainRoot);\n var links = tree.links(nodes);\n\n setParent(mainRoot);\n\n paintLinks();\n paintNodes();\n\n //Setting parents for each element\n function setParent(node) {\n if ('children' in node) {\n for (var index in node.children) {\n node.children[index].parent = node;\n setParent(node.children[index]);\n }\n }\n }\n\n //painting nodes\n function paintNodes() {\n var forNodes = formD3ChainCalls(panel, \"g#noderz\"+graphId+\"|id'noderz\"+graphId);\n var update = forNodes.selectAll(\".node\").data(nodes, function (d) {return \"\"+ d.uniqueId + d.expanded;});\n var enter = update.enter();\n var exit = update.exit();\n\n enter.append(\"g\").attr(\"class\", \"node\").style('opacity', 0).attr('transform', function (d) {\n if (typeof d === 'object' && 'parent' in d) {\n if (!d.ui) {\n if (d.type == elementTypes.paginator) createPaginator(d, d3.select(this));\n else if (d.type == elementTypes.loader) createLoader(d, d3.select(this));\n } else {\n if (d.type == elementTypes.paginator) this.appendChild(d.ui.root.node());\n else if (d.type == elementTypes.loader) this.appendChild(d.ui.root.node());\n }\n return \"translate(\" + d.parent.y + \",\" + d.parent.x + \")\";\n } else return \"translate(0,0)\";\n });\n\n exit.filter(function (d) { return !d.wasDiscarded; })\n .transition().duration(p.animdur).style('opacity', 0).attr('transform', function (d) {\n if (typeof d !== 'object' || !('parent' in d)) return \"translate(0,0)\";\n else return \"translate(\" + d.parent.y + \",\" + d.parent.x + \")\";\n }).remove();\n exit.filter(function (d) { return d.wasDiscarded; })\n .transition().duration(p.animdur).style('opacity', 0).remove();\n\n update.attr('pointer-events', function (d) { return willBeDiscarded(d) ? 'none' : null; })\n .transition().duration(function (d) { return willBeDiscarded(d) ? p.discardAnimDuration : p.animdur; })\n .attr(\"transform\", function (d) { return \"translate(\" + d.y + \",\" + d.x + \")\";})\n .style('opacity', function (d) { return willBeDiscarded(d) ? 0.2 : 1; })\n .each(function (d) {\n var thisItem = d3.select(this);\n if (d.type == elementTypes.paginator) { updatePaginator(d, thisItem); }\n else if (d.type == elementTypes.loader) { updateLoader(d, thisItem); }\n else if (d.type == elementTypes.objProperty) {\n thisItem.text('');\n paintObjProperty(d, thisItem);\n } else if (d.type == elementTypes.instance) {\n if (d.dataIndicator && d.dataIndicator.ui) {\n d.dataIndicator.ui.remove();\n d.dataIndicator.ui = null;\n }\n thisItem.text('');\n paintInstance(d, thisItem);\n }\n if (d.pageIndicator) { arrangePageIndicator(d, d.pageIndicator); }\n });\n\n function createPaginator(d, parent) {\n d.ui = svgui.Paginator({parent: parent, color: d.parent.color, width: 160});\n d.ui.onPageChanged = function (page) { onPageChanged(page, d, d.parent); };\n }\n\n function onPageChanged(newPage, paginatorModel, parentModel) {\n if (parentModel.pageRequest && parentModel.pageRequest.isRunning)\n parentModel.pageRequest.cancel();\n if (parentModel.pageIndicator)\n parentModel.pageIndicator.remove();\n\n var margin = 15, nodeSize = p.nodeWidth - p.nodeDif;\n var indicator = Indicator.create(panel, {size: p.pageIndicatorSize, maxWidth: nodeSize - margin}).run();\n arrangePageIndicator(parentModel, indicator);\n parentModel.pageIndicator = indicator;\n paginatorModel.currentPage = newPage;\n\n if (parentModel.type == elementTypes.objProperty) {\n parentModel.pageRequest = requestForInstances(parentModel, newPage, renderParams.pageLimitForInstances, indicator);\n } else if (parentModel.type == elementTypes.instance) {\n parentModel.pageRequest = requestForObjPropPage(parentModel, newPage, renderParams.pageLimitForObjectProperties, indicator);\n }\n paintAll();\n }\n\n function arrangePageIndicator(parentModel, indicatorInstance) {\n var minX = Infinity;\n var minY = Infinity, maxY = -Infinity;\n panel.selectAll(\".node\").filter(function (nodeData) {\n return nodeData.parent === parentModel && nodeData.type != elementTypes.paginator;\n }).each(function (d) {\n // d.x and d.y are swapped here\n minX = Math.min(minX, d.y);\n var height = calcHeight(d);\n minY = Math.min(minY, d.x - height / 2);\n maxY = Math.max(maxY, d.x + height / 2);\n });\n\n var margin = 15, nodeSize = p.nodeWidth - p.nodeDif;\n var position = vector(minX - nodeSize / 2 + p.pageIndicatorSize / 2 + margin, minY + (maxY - minY) / 2);\n indicatorInstance.moveTo(position);\n }\n\n function createLoader(d, parent) {\n var container = parent.append(\"g\").attr(\"width\", p.childrenLoaderSize).attr(\"height\", p.childrenLoaderSize);\n d.ui = Indicator.create(container, {size: p.childrenLoaderSize}).run();\n d.ui.root = container;\n updateIndicatorUI(d);\n }\n\n function paintObjProperty(d, d3This){\n var uiElement = d.ui;\n var halfWidth = (p.nodeWidth-p.nodeDif) / 2;\n var ti = textInfo(d.name, \"basicTextInGraph\");\n uiElement.render(d3This, 0 -( (ti.width/2>=halfWidth)?halfWidth:((ti.width)/2)), 10, p.nodeWidth - p.nodeDif);\n\n var path = (d.direction == 'OUT') ? \"M0,-5L10,0L0,5\" : \"M0,-5L-10,0L0,5\";//Triangle\n d3This.append(\"path\").attr(\"d\", path).attr(\"fill\", d.parent.color);\n\n //Circle expander\n var circle = d3This.append(\"circle\").attr({cx:halfWidth,cy:0,r:10, fill:'white',stroke: d.color,'stroke-width':2});\n path = (!d.children) ? \"M0,-5L10,0L0,5\" : \"M0,-5L-10,0L0,5\";\n var triangle = d3This.append(\"path\").attr(\"d\", path).attr(\"fill\", d.parent.color).attr(\"transform\",\"translate(\" + ((!d.children)?(halfWidth-4):(halfWidth+3)) + \",\" + 0 + \")\");\n circle.on(\"mousedown\", rightAction);\n triangle.on(\"mousedown\", rightAction);\n\n function rightAction() {\n invokeRightAction(d, function (d) { rightActionForObjectProperty(d); });\n }\n }\n\n function paintInstance(d,d3This){\n var uiElement = (d.expanded)? d.uiExpanded : d.ui;\n var leftRightHeight = uiElement.height(p.nodeWidth - p.nodeDif);\n var halfWidth = (p.nodeWidth-p.nodeDif) / 2;\n //If it's not root - we create left ear\n var leftEar=null;\n var rightEar=null;\n if (d.parent && !d.error){\n leftEar = createEar(d, d3This,-halfWidth - p.buttonWidth,\n -(leftRightHeight / 2) + 1, halfWidth , leftRightHeight,\n uiElement, leftAction(d), \"M5,-5L-5,0L5,5\",-halfWidth-(p.buttonWidth)/2);\n }\n //right ear\n if (!d.error) {\n rightEar = createEar(d, d3This, 0 , -(leftRightHeight / 2) + 1, halfWidth + p.buttonWidth,\n leftRightHeight, uiElement, function() {\n invokeRightAction(d, function (d) { rightActionForInstance(d); });\n }, (d.children) ? \"M5,-5L-5,0L5,5\" : \"M-5,-5L-5,5L5,0\",\n (d.children) ? (halfWidth+(p.buttonWidth-4)/2) : (halfWidth+(p.buttonWidth)/2));\n }\n //render main element after ears\n uiElement.render(d3This, -halfWidth, -leftRightHeight / 2, p.nodeWidth-p.nodeDif);\n if (!d.error) uiElement.setAction(\"mousedown.open\", centerAction(d));\n uiElement.setAction(\"mouseover.uwi\", onMouseElement(1));\n uiElement.setAction(\"mouseout.uwi\", onMouseElement(0));\n\n //Changing opacity to 0 or 1\n function onMouseElement(opacity){\n return function () {\n if(rightEar!=null) rightEar.transition().duration(p.animdur).attr(\"opacity\", opacity);\n if (leftEar != null) leftEar.transition().duration(p.animdur).attr(\"opacity\", opacity);\n };\n }\n\n //create left or right ear\n function createEar(d, d3This, x ,y, width, height, uiElement, action, path, translate){\n var ear = d3This.append(\"g\").attr(\"opacity\",0);\n addBorderedRect(ear, x , y, width, height, 2, \"white\", uiElement.RxRy(), uiElement.RxRy(), d.color);\n ear.append(\"path\").attr(\"d\", path).attr(\"fill\", d.color).attr(\"transform\",\"translate(\"+translate+\",0)\");\n actionSet(ear);\n return ear;\n\n function actionSet(item){\n item.on(\"mousedown\", action);\n item.on('mouseover', function () { ear.transition().duration(p.animdur).attr(\"opacity\",1);});\n item.on('mouseout', function () { ear.transition().duration(p.animdur).attr(\"opacity\",0);});\n }\n }\n }\n\n function invokeRightAction(d, rightActionHandler) {\n var isExpanded = d['children'], hasCollapsedChildren = d['_children'];\n var isLoadingError = d.pageRequest && d.pageRequest.isFailed;\n if (isExpanded || !isLoadingError && hasCollapsedChildren) {\n expandOrCollapseChildren(d);\n paintAll();\n } else {\n d['_children'] = false;\n rightActionHandler(d);\n }\n }\n\n function updatePaginator(d, d3This) {\n d.ui.currentPage = d.currentPage;\n d.ui.pageCount = d.overallPages;\n d.ui.update();\n var size = svgui.measure(d.ui, vector(p.nodeWidth - p.nodeDif, Infinity));\n svgui.arrange(d.ui, -((size.x / 2 >= (p.nodeWidth - p.nodeDif) / 2)\n ? (p.nodeWidth - p.nodeDif) / 2 : size.x / 2), -10);\n }\n\n function updateLoader(d, d3This) {\n var height = d.ui.size;\n d.ui.parent.attr(\"transform\", \"translate(\" +\n (-(p.nodeWidth - p.nodeDif) / 2 + 5) + \",\" + (-height / 2) + \")\");\n }\n }\n\n //painting links\n function paintLinks() {\n var forLinks = formD3ChainCalls(panel, \"g#linkers\"+graphId+\"|id'linkers\"+graphId);\n var update = forLinks.selectAll(\".link\").data(links, function (d) {return d.source.uniqueId + \"_\" + d.target.uniqueId;});\n var enter = update.enter();\n var exit = update.exit();\n\n enter.append(\"path\").attr(\"class\", \"link\").attr('stroke', function (d) {\n if (d.source.type == elementTypes.instance) return d.source.color;\n else if (d.source.type == elementTypes.objProperty) return d.source.parent.color;\n }).style('opacity',0);\n\n exit.filter(function (d) { return !d.target.wasDiscarded; })\n .transition().duration(p.animdur).attr(\"d\", function (d) {\n var o = {x: d.target.x, y: d.target.y};\n return diagonal({source: o, target: o});\n }).style('opacity', 0).remove();\n exit.filter(function (d) { return d.target.wasDiscarded; }).remove();\n\n update.transition().duration(function (d) { return willBeDiscarded(d.target) ? p.discardAnimDuration : p.animdur; })\n .attr(\"d\", function (d) {\n /// !!!!! X and Y are inverted here!!!!!\n if (d.target.type == elementTypes.paginator) return \"M\"+ d.target.y+\",\"+ d.target.x;\n var m = (d.source.y + d.target.y) / 2;\n var halfWidth = (p.nodeWidth-p.nodeDif) / 2;\n var k = [\n {x: d.source.x, y: d.source.y + halfWidth }, //left point\n {x: d.source.x, y: m}, //middle left\n {x: d.target.x, y: m}, //middle right\n {x: d.target.x, y: d.target.y - halfWidth } //right point\n ];\n\n var toRet = \"\";\n var prefix = \"M\";\n var suffix = \"\";\n var firstDone = false;\n if (d.target.type == elementTypes.objProperty)//if left element is object property - we make a long line\n suffix += \"M\" + (d.target.y - halfWidth) + \",\" + d.target.x +\" L\" + (d.target.y+halfWidth ) + \",\" + d.target.x;\n\n k = k.map(function (d) { return [ d.y, d.x ];});\n each(k, function (d) {\n if (!firstDone) {toRet += d + \" C\";firstDone = true;}\n else toRet += d + \" \";\n });\n\n return prefix + toRet.trim() + suffix;\n }).style('opacity', function (d) { return willBeDiscarded(d.target) ? 0.2 : 1; });\n }\n }", "update(info) {\n _.each(this.nodes, (node) => {\n node.shape.setText(node.getText(info));\n if (node.isCritical) {\n if (node.isCritical(info)) {\n node.shape.fillStyle = UI.WARN_COLOR;\n } else {\n node.shape.fillStyle = UI.TEXT_COLOR;\n }\n }\n });\n }", "function update() {\n\t// call start before doing svg stuff, since we want any new nodes instantiated\n\tForce.force().start();\n\t\n\tnode = node.data(Net.nodes, function (n) {\n\t\treturn n.id;\n\t});\n\n\tlink = link.data(Net.links, function (n) {\n\t\treturn (n.source.id + n.target.id);\n\t});\n\n\t// \tAdding basic links\n\tlink.enter().append(\"line\").attr(\"class\", \"link\");\n\t// experimental: put arrows on links\n\t//.attr(\"marker-end\", \"url(#end)\");\n\n\n/*\t// polygonlinks\n\tlink.enter()\n .append('path')\n\t\t.attr(\"class\", \"polygonlink\");\n*/\t\n\n\t\t// experimental: link labels\n\t\t/*\n\t var edgelabels = svg.selectAll(\".edgelabel\")\n\t .data(Net.links)\n\t\t .enter()\n\t\t .append('text')\n\t\t .style(\"pointer-events\", \"none\")\n\t\t .attr({'class':'edgelabel',\n\t\t 'id':function(d,i){return 'edgelabel'+i},\n\t\t 'dx':50,\n\t\t 'dy':8,\n\t\t 'font-size':12});\n\n\t\tvar textPath = edgelabels.append('textPath')\n\t\t .attr('xlink:href',function(d,i) {return '#edgepath'+i})\n\t\t .style(\"pointer-events\", \"none\")\n\t\t .text(Net.linkDistance);\n\t\t*/\t\n\n\n\t\tlink.exit().remove();\n\n\t\t\n\n\t\n\t// draw an svg:group for each node\t\n\tvar g = node.enter().append(\"g\")\n\t\t.attr(\"class\", function (d) {\n\t\treturn d.group;\n\t})\n\t\t.attr(\"transform\", function () {\n\t\treturn \"translate(\" + w / 2 + \",\" + h / 2 + \")\"\n\t});\n\t// type the node name in each group\n\tvar g_label = g.append(\"g\")\n\t\t.attr(\"class\", \"node_label\");\n\t\t\n\tg_label.append(\"rect\")\n\t\t.attr(\"class\", \"label_background\")\n\t\t.style(\"fill\", function (d) {\n\t\t\treturn d3.rgb(color(d.group)).darker();\n\t\t\t});\n\tg_label.append(\"text\")\n\t\t.attr(\"dy\", \".35em\")\n\t\t.attr(\"x\", function (n) {\n\t\treturn 14 + 0.3 * n.size;\n\t})\n\t\t.attr(\"font-size\", function (n) {\n\t\treturn 14 + 0.1 * n.size;\n\t})\n\t\t.attr(\"class\", \"label_text\")\n\t\t.text(function (n) {\n\t\treturn n.name;\n\t});\n\t// add a hover:title in each group\n\tg.append(\"title\").text(function (d) {\n\t\treturn (d.description ? d.description + \"\\n\" : \"\") + \"[\" + d.group + \"]\";\n\t});\n\n\t// halo\n\tg.append(\"circle\").attr(\"r\", function (n) {\n\t\treturn (12 + n.size * 0.4);\n\t})\n\t\t.attr(\"class\", function (d) {\n\t\treturn \"halo\";\n\t})\n\t\t.style(\"fill\", function (d) {\n\t\treturn \"url(#g\" + (groups.indexOf(d.group)) + \")\";\n\t});\n\n\t// put a circle in each group\n\tg.append(\"circle\").attr(\"r\", function (n) {\n\t\treturn (6 + n.size * 0.2);\n\t})\n\t.attr(\"class\", \"node\")\n\t.on(\"mouseover\", Force.d3_layout_forceMouseover)\n\t.on(\"mouseout\", Force.d3_layout_forceMouseout);\n\n/*\n\t// Experimental but really cool:\n\t// Mark fixed nodes\n\tg.append(\"circle\")\n\t\t.attr(\"r\", function (n) {\n\t\t\treturn (20 + n.size * 0.4);\n\t\t})\n\t\t.attr(\"class\", \"fixed\")\n\t\t.style(\"display\", \"none\");\n*/\n\t// get rid of obsolete nodes (deleted through the radial menu's trash can in a previous iteration)\n\tnode.exit().remove();\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t// Build the radial menu\n\tg.selectAll(\"circle\")\n\t\t.on(\"mouseup\", function () {\n\t\t\tvar sunburst = svg.selectAll(\"g.radial\");\n\t\t\tsunburst.remove();\n\t\t})\t\n\t\t.on(\"contextmenu\", function (n) {\n\t\t// The radial menu function takes a JSON structure, according to d3's docs on pie menus.\n\t\tvar tree = {\n\t\t\t\"size\": n.size,\n\t\t\t\"children\": [{\n\t\t\t\t\t\"label\": \"remove\",\n\t\t\t\t\t\"id\": n.id,\n\t\t\t\t\t\"icon\": \"#icon_remove\",\n\t\t\t\t\t\"size\": \"10\",\n\t\t// we inject a callback for each menu item, what to execute on selection. Maybe I can become a decent js-coder afterall?\n\t\t\t\t\t\"callback\": function (node) {Net.drop(node.id);update();}\n\t\t\t\t\t}, {\n\t\t\t\t\t\"label\": \"explode\",\n\t\t\t\t\t\"id\": n.id,\n\t\t\t\t\t\"icon\": \"#icon_explode\",\n\t\t\t\t\t\"size\": \"10\",\n\t\t\t\t\t\"children\": [],\n\t\t\t\t\t\"callback\": function (node) {Net.supernova(node.id);update();}\n\t\t\t\t\t}, {\n\t\t\t\t\t\"label\": \"freeze\",\n\t\t\t\t\t\"id\": n.id,\n\t\t\t\t\t\"icon\": \"#icon_fixed\",\n\t\t\t\t\t\"size\": \"10\",\n\t\t\t\t\t\"callback\": function (node) {Net.toggleFixed(node.id);update();}\n\t\t\t\t\t}/*, {\n\t\t\t\t\t\"label\": \"add\",\n\t\t\t\t\t\"id\": n.id,\n\t\t\t\t\t\"icon\": \"#icon_add\",\n\t\t\t\t\t\"size\": \"15\",\n\t\t\t\t\t\"callback\": function (node) {Net.derive(node.id);update();}\n\t\t\t\t}*/]\n\t\t};\n\t\t//\n\t\tif (n.description == \"user added\") {\n\t\t\t// push all Net.nodes onto the radial menu JSON\n\t\t\tNet.nodes.forEach(function (node) {\n\t\t\t\tvar push = {};\n\t\t\t\tpush.name = node.name;\n\t\t\t\tpush.id = node.id;\n\t\t\t\tpush.group = node.group;\n\t\t\t\tpush.size = node.size;\n\t\t\t\t// not properly updated since implemented id's instead of indices:\n\t\t\t\tvar arg = {\"source\":{\"id\":n.id}, \"target\": {\"id\":node.id}};\n\t\t\t\tpush.callback = function(){Net.addLink(arg); update();};\n\t\t\t\ttree.children[1].children.push(push);\n\t\t\t\t});\n\t\t} else {\n\t\t\tvar links = ALL.nodeSource(n.id);\n\t\t\t// push all links/edge menu items onto the radial menu JSON\n\t\t\tlinks.forEach(function (l) {\n\t\t\t\tvar c = l.target == n.id ? ALL.n(l.source) : ALL.n(l.target);\n\t\t\t\tc = jQuery.extend(true, {\"callback\" : function(node){Net.add(ALL.n(node.id)); update()}}, c);\n\t\t\t\ttree.children[1].children.push(c);\n\t\t\t\t\n\t\t\t});\n\t\t}\t\t\n\t\tdrawRadial(tree, n);\n\t});\n\t\n\tnode.call(Force.nodeDrag);\n\n\t\tif (Settings.drawOrigo && !Settings.rotateLabels) {\n\t\tvar origo = svg.append(\"g\").attr(\"id\", \"origo\");\n\t\torigo.append(\"circle\").attr(\"r\", 4).style(\"fill\", \"#fff\");\n\t\torigo.append(\"circle\").attr(\"r\", 7).style(\"stroke\", \"#fff\").style(\"fill\", \"none\").style(\"stroke-width\", \"1.5px\");\n\t}\n\n\n\t/* ---------------------------- FOR SIMULATION ----------------------------- */\n\n\t// links are actually little trapezoids (arrows). You can barely see the link direction...\n\tvar updateLink = function () {\n\t\t/*\n\t\tthis.attr('d', function(d) {\n\n\t\t\tvar sx = d.source.x; var sy = d.source.y; var tx = d.target.x; var ty = d.target.y;\n\t\t\tvar Dx = tx-sx; var Dy = ty-sy; // D as in Delta\n\t\t\tvar pDx = Dy; var pDy = -Dx; \t// p as in perpendicular\n\t\t\t// normalize\n\t\t\tvar length = Math.sqrt(pDx*pDx+pDy*pDy);\n\t\t\tpDx /= length;\n\t\t\tpDy /= length;\n\n\n\t\t\tvar sC = 1;\n\t\t\tvar tC = 0.6;\n//\t\t\tvar sS = 6 + d.source.size * 0.2;\n//\t\t\tvar tS = 6 + d.target.size * 0.2;\n\t\t\tvar sS = 7*sC;\n\t\t\tvar tS = 7*tC;\n\n\t\t\tvar s1x = sx+pDx*sS;\n\t\t\tvar s1y = sy+pDy*sS;\n\n\t\t\tvar s2x = sx-pDx*sS;\n\t\t\tvar s2y = sy-pDy*sS;\n\n\t\t\tvar t1x = tx+pDx*tS;\n\t\t\tvar t1y = ty+pDy*tS;\n\n\t\t\tvar t2x = tx-pDx*tS;\n\t\t\tvar t2y = ty-pDy*tS;\n\t\t\tvar path = \"M \" + s1x + \" \" + s1y;\n\t\t\tpath += \" L \" + t1x + \" \" + t1y;\n\t\t\tpath += \" L \" + t2x + \" \" + t2y;\n\t\t\tpath += \" L \" + s2x + \" \" + s2y;\n\t\t\tpath += \" Z\";\n\t\t\treturn path;\n\t\t});\n*/\n\t\t// Deprecated:\n\t\t// Plain svg:line objects\n\t\tthis.attr(\"x1\", function (d) {\n\t\t\treturn d.source.x;\n\t\t}).attr(\"y1\", function (d) {\n\t\t\treturn d.source.y;\n\t\t}).attr(\"x2\", function (d) {\n\t\t\treturn d.target.x;\n\t\t}).attr(\"y2\", function (d) {\n\t\t\treturn d.target.y;\n\t\t});\n\t}\n\n\tvar updateNode = function () {\n\t\tif (!Settings.rotateLabels) {\n\t\t\tvar center = Net.getCenter();\n\t\t\tif (Settings.drawOrigo) svg.select(\"#origo\").attr(\"transform\", \"translate(\" + center.x + \",\" + center.y + \")\");\n\t\t\t\t\n\t\t}\n\n\t\tthis.attr(\"transform\", function (d, i) {\n//\t\t\tthis.childNodes[4].setAttribute(\"style\", \"display: \"+ (d.fixed ? \"block\" : \"none\"));\n\t\t\t\n\t\t\tvar angle = rotate = 0, anchor = \"start\";\n\t\t\t\n\t\t\tif (text = this.childNodes[0].childNodes[1]) {\n\t\t\t\tvar offset = 14 + 0.3 * d.size;\t\t\t\t\n\n\t\t\t\t// rotate labels\n\t\t\t\tif (Settings.rotateLabels) {\n\t\t\t\t\tvar ns = Net.getNeighbors(d.id);\n\t\t\t\t\tif (ns.length) {\n\t\t\t\t\t\t// my intricate (read 'cheap') rotation algorithm for avoiding labels blocking other nodes or links.\n\t\t\t\t\t\tns.x = d3.mean(ns, function(n){return n.x;});\n\t\t\t\t\t\tns.y = d3.mean(ns, function(n){return n.y;});\n\t\t\t\t\t\tangle = 57 * myAtan((d.y-ns.y), (d.x-ns.x)); // Seems DRAWING rotated text is the speed hog, NOT myAtan...\n\t\t\t\t\t} else angle = 0;\n\t\t\t\t\t\n\t\t\t\t\t// Rotating isn't everything - here's some alignment so labels won't cover nodes\n\t\t\t\t\tif (Math.abs(angle) > 90) {\n\t\t\t\t\t\tvar anchor = \"end\";\n\t\t\t\t\t\tvar offset = -offset\n\t\t\t\t\t\tvar rotate = 180;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\ttext.setAttribute(\"transform\", \"rotate(\" + rotate + \")\");\n\t\t\t\t\ttext.setAttribute(\"x\", offset);\n\t\t\t\t\ttext.setAttribute(\"text-anchor\", anchor);\n\n\t\t\t\t\tif (Settings.drawAngles) text.textContent = Math.floor(angle);\n\n\t\t\t\t} else {\n\t\t\t\t\t// no text rotations\n\t\t\t\t\tvar dX = d.x - center.x;\n\n\t\t\t\t\tif (dX > 0) {\n\t\t\t\t\t\tvar anchor = \"start\";\n\t\t\t\t\t\ttext.setAttribute(\"x\", offset);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar anchor = \"end\";\n\t\t\t\t\t\toffset = -offset\n\t\t\t\t\t}\n\t\t\t\t\ttext.setAttribute(\"x\", offset);\n\t\t\t\t\ttext.setAttribute(\"text-anchor\", anchor);\n\t\t\t\t\ttext.setAttribute(\"transform\", \"rotate(\" + 0 + \")\");\t\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// we have all we need - now draw the label\n\t\t\tvar margin = 5;\n\t\t\tvar rect = this.childNodes[0].childNodes[0];\n\t\t\tvar textbox = text.getBBox();\n\t\t\trect.setAttribute(\"x\", textbox.x-margin);\n\t\t\trect.setAttribute(\"y\", textbox.y);\n\t\t\trect.setAttribute(\"width\", textbox.width+2*margin);\n\t\t\trect.setAttribute(\"height\", textbox.height);\n\t\t\trect.setAttribute(\"transform\", \"rotate(\" + rotate + \")\");\n\t\t\t\n\t\t\treturn \"translate(\" + d.x + \",\" + d.y + \") rotate(\" + angle + \")\";\n\t\t});\n\t}\n\n\t// Hooking bookmarklet generation into the simulation sequence\n\tForce.force().on(\"start\", start());\n\tForce.force().on(\"tick\", tick);\n\tForce.force().on(\"end\", end);\n\t\n\tfunction start() {\n\t\t//\tFPS.init();\n\t\t// everything is set up for rendering - create a bookmarklet for saving:\n\t\tif (Net.nodes.length) {\n\t\t\t$(\"#buttonbar\").show();\n\t\t\t$(\"#bookmarklet\").attr(\"class\", \"btn-sm btn-warning\");\n\t\t}\n\t}\n\t\n\tfunction end() {\n\t\t$(\"#bookmarklet\").attr(\"class\", \"btn-sm btn-success\");\n\t\t$(\"#bookmarklet\").attr(\"href\", Net.exportN());\t\t\n\t}\n\n\t// Do this every iteration\n\tfunction tick (e) {\n\t\t// update percent counter\n\t\t$(\"#bookmarklet\").text(Math.floor(1000*(0.1-(Force.force().alpha()))) + 6 + \"%\")\n\n\t\t// for benchmarking\n\t\t// FPS.sample();\n\n\n\t\tnode.call(updateNode);\n\t\tlink.call(updateLink);\n\t}\n}", "function redrawNode(n) {\n var xn = n.position().x + n.parent.position().x;\n var yn = n.position().y + n.parent.position().y;\n for (let l of n.linked) {\n redrawLine(l, n.kind, xn, yn);\n }\n}", "refresh() {\n this.viewDiv.node().style.top = this._position.y + \"px\";\n this.viewDiv.node().style.left = this._position.x + \"px\";\n }", "function updateDOM() {\n updateFeaturedImage();\n updateFeaturedShoutout();\n updateFeaturedName();\n updateDots();\n}", "function updateDisplay() {\n node\n .attr(\"r\", forceProperties.collide.radius)\n .attr(\"stroke\", forceProperties.charge.strength > 0 ? \"blue\" : \"red\")\n .attr(\"stroke-width\", forceProperties.charge.enabled == false ? 0 : Math.abs(forceProperties.charge.strength) / 15);\n\n \n link\n .attr(\"stroke-width\", forceProperties.link.enabled ? 3 : .5)\n .attr(\"opacity\", forceProperties.link.enabled ? 1 : 0);\n}", "function update(nodes, links, sourceNode) {\n const originalNodes = allNodes;\n const originalLinks = allLinks;\n\n // -> true if user clicked on a node\n if (sourceNode) {\n // update pattern: https://livebook.manning.com/book/d3js-in-action-second-edition/chapter-7/142\n const centerNode = originalNodes.filter(d => d.id === sourceNode.id)\n links = originalLinks.filter(d =>\n centerNode.includes(d.source) ||\n centerNode.includes(d.target))\n\n nodes = links.map(d => {\n return originalNodes.filter(item =>\n d.source.id.includes(item.id) ||\n d.target.id.includes(item.id))\n }).flat()\n\n // remove dups: https://dev.to/marinamosti/removing-duplicates-in-an-array-of-objects-in-js-with-sets-3fep\n nodes = nodes.reduce((acc, current) => {\n const x = acc.find(item => item.id === current.id);\n if (!x) {\n return acc.concat([current]);\n } else {\n return acc;\n }\n }, []);\n // -> default\n } else {\n nodes = originalNodes;\n links = originalLinks;\n }\n\n d3.select(\".network\").select(\".nodes\").selectAll(\".node\")\n .data(nodes)\n .join( enter => {\n const nodeEnter = enter.append(\"g\").attr(\"class\",\"node\")\n\n // node events\n .on('click', function(d){\n update(nodes, links, d)\n nodeInfo.html(`<span class=\"node-info__label\">${d.label}</span> <a class=\"node-info__link\" href=${d.id} target=__blank>${d.id}</a>`)\n .style(\"display\", \"block\")\n })\n .on(\"mouseover\", d => {\n return tooltip.style(\"visibility\", \"visible\")\n .text(d.label)\n })\n .on(\"mousemove\", () => {\n // tt positioning: https://www.d3-graph-gallery.com/graph/interactivity_tooltip.html\n return tooltip.style(\"top\", (event.pageY-10)+\"px\").style(\"left\",(event.pageX+10)+\"px\")\n })\n .on(\"mouseout\", () => {\n return tooltip.style(\"visibility\", \"hidden\")\n }).attr(\"transform\", function(d) {\n return \"translate(\" + d.x + \",\" + d.y + \")\";\n });\n\n // node circles\n nodeEnter.append(\"circle\")\n .attr(\"r\", function(d) {\n if (d.type === \"node\") {\n return 10;\n } else {\n return 6;\n }\n })\n .attr(\"class\", d => `type-${d.type}`)\n .call(d3.drag()\n .on(\"start\", dragstarted)\n .on(\"drag\", dragged)\n .on(\"end\", dragended));\n },\n update => {\n update.select(\"circle\").attr(\"r\", function(d) {\n if (d.type === \"node\") {\n return 10;\n } else {\n return 6;\n }\n }).attr(\"class\", d => `type-${d.type}`)\n .call(d3.drag()\n .on(\"start\", dragstarted)\n .on(\"drag\", dragged)\n .on(\"end\", dragended))\n })\n\n d3.select(\".network\").select(\".links\").selectAll(\".link\")\n .data(links)\n .join( enter => {\n enter.append(\"line\")\n .attr(\"class\",\"link\")\n .attr(\"x1\", function(d) { return d.source.x; })\n .attr(\"y1\", function(d) { return d.source.y; })\n .attr(\"x2\", function(d) { return d.target.x; })\n .attr(\"y2\", function(d) { return d.target.y; });\n },\n update => {\n update.select(\".link\")\n .attr(\"x1\", function(d) {\n return d.source.x;\n })\n .attr(\"y1\", function(d) { return d.source.y; })\n .attr(\"x2\", function(d) { return d.target.x; })\n .attr(\"y2\", function(d) { return d.target.y; });\n })\n }", "function renderNodes(dataInstance){\n currentDisplay.innerHTML +=\n `<i class=\"fab fa-first-order-alt selector\" data-id = ${dataInstance.id} style=\"position:\n fixed;top:${dataInstance.position_top}%;left:${dataInstance.position_left}%;\n font-size: 1.5em; \"></i>`\n}", "async function refreshNodes(){\r\n let result = await axios.get(NODES_API);\r\n let payload = result.data['Nodes'];\r\n\r\n let nodes = {};\r\n\r\n for (let i = 0; i < payload.length; i++) {\r\n let node = payload[i];\r\n if (!nodes[node.Location.X]) {\r\n nodes[node.Location.X] = {};\r\n }\r\n nodes[node.Location.X][node.Location.Y] = node;\r\n }\r\n\r\n state.nodes = nodes;\r\n}", "redraw() {\n let nodeParams = this.nodes.map((el) => ({height: el.height, center: el.center}));\n\n this.nodes.forEach(function(node) {\n node.redraw(nodeParams);\n });\n\n //Redraw the grandparent expression as well.\n //Expression parents are Units, all Units have a parent Expression, so\n //if this has a parent, it has a grandparent.\n if(this.parent !== null)\n this.parent.parent.redraw();\n }", "function updateNodePositions() {\n // set node positions\n rect.attr('transform', function (d) {\n return 'translate(' + d.x + ',' + d.y + ')';\n });\n}", "function updateAll() {\n\t\n\t// Class view\n\t//updateVid();\n\t\n\t//updateClassChart();\n\tshowClassChart();\n\tupdateClassDataBackgroundLabel();\n\tupdateText();\n\tupdateButtonHighlights();\n\t\n\tupdateScrollCommand();\n\t// Focus view\n\t//focusp1=initfocusp1;\n\t//focusp2=initfocusp2;\n\tupdateFocus();\n\t\n\t// Context view\n\tupdateContext();\n\n}", "function updateGraph(OrigData, data) {\n simulation.stop();\n var nodes = data.nodes,\n links = data.links,\n date = data.date; // when slider moves, these elements are to disappear on screen because they are confirmed after the selected date\n\n var nodesRemove = OrigData.nodes.filter(function (d) {\n return d.date > date.getTime();\n });\n var linksRemove = OrigData.links.filter(function (d) {\n return d.date > date.getTime();\n }); // snapshot of all confirmed cases up until selected date\n // elements remain unchanged on screen if these cases are existing before the selected date\n\n nodes = OrigData.nodes.filter(function (d) {\n return nodesRemove.map(function (el) {\n return el.id;\n }).indexOf(d.id) == -1;\n });\n links = OrigData.links.filter(function (d) {\n return linksRemove.map(function (el) {\n return el.id;\n }).indexOf(d.id) == -1;\n }); // remove links that do not have either a start and end node in nodes variable\n\n var nodeIDs = nodes.map(function (d) {\n return d.id;\n });\n links = links.filter(function (d) {\n return nodeIDs.indexOf(d.start_id) !== -1 & nodeIDs.indexOf(d.end_id) !== -1;\n });\n var newEle = updateAttributes(nodes, links);\n nodes = newEle.nodes;\n links = newEle.links;\n links.forEach(function (d) {\n d.source = nodes.find(function (el) {\n return el.id === d.start_id;\n });\n d.target = nodes.find(function (el) {\n return el.id === d.end_id;\n });\n });\n links.forEach(function (d) {\n linkedByIndex[\"\".concat(d.source.id, \",\").concat(d.target.id)] = 1;\n });\n nodes.forEach(function (d) {\n var coords = {\n x: graphWrapper.width / 2,\n y: graphWrapper.height / 2\n };\n d.x = d.x ? d.x : coords.x;\n d.y = d.y ? d.y : coords.y;\n d.fx = d.type == \"root\" ? coords.x : undefined;\n d.fy = d.type == \"root\" ? coords.y : undefined;\n d.x0 = d.x;\n d.y0 = d.y;\n });\n simulation.nodes(nodes);\n simulation.force(\"link\").links(links);\n simulation.alpha(0.3).restart();\n\n for (var i = 0, n = 300; i < n; ++i) {\n simulation.tick();\n }\n\n nodes.forEach(function (d) {\n d.x0 = d.x;\n d.y0 = d.y;\n });\n draw(nodes, links, newEle.accessors);\n return {\n nodes: nodes,\n links: links\n };\n }", "function hideNodes(){\n\n nodes.update({id: 1, hidden: true});\n nodes.update({id: 2, hidden: true});\n nodes.update({id: 3, hidden: true});\n nodes.update({id: 4, hidden: true});\n nodes.update({id: 5, hidden: true});\n nodes.update({id: 6, hidden: true});\n nodes.update({id: 7, hidden: true});\n \n}", "saveNodesPositions() {\n if (this.visualization && this.visualization.getNodesPositions) {\n const nodes = this.visualization.getNodesPositions();\n this.props.actions.setVisualizationNodesPosition(this.props.visualizationKey, nodes);\n }\n }" ]
[ "0.7232441", "0.70909846", "0.69900596", "0.6880904", "0.6800278", "0.67776644", "0.6766936", "0.67061895", "0.6682401", "0.65789086", "0.6509172", "0.6435647", "0.6375836", "0.63610035", "0.6337292", "0.63245517", "0.6324409", "0.63194233", "0.6291541", "0.62733907", "0.62594014", "0.62557185", "0.6215082", "0.6195398", "0.6181821", "0.6168495", "0.6168495", "0.6146612", "0.6124198", "0.6097686", "0.60919553", "0.60427123", "0.6037796", "0.6033968", "0.6021442", "0.60149497", "0.6013946", "0.5999538", "0.5994167", "0.5983338", "0.5976498", "0.5957683", "0.59528303", "0.59363496", "0.5934962", "0.5929728", "0.5928942", "0.5924217", "0.5921894", "0.5921029", "0.5908701", "0.5907152", "0.59039897", "0.5888423", "0.58833146", "0.5882232", "0.5879562", "0.58785135", "0.5860901", "0.58580935", "0.5853519", "0.58505666", "0.5847361", "0.5828468", "0.5820732", "0.5819083", "0.58172697", "0.5812263", "0.58109945", "0.5802064", "0.5801718", "0.5798023" ]
0.5800237
94
Update the displayed node labels.
function updateLabels() { label = label.data(data.topics, function(d) { return d.name; }); label.exit().remove(); var labelEnter = label.enter().append("a") .attr("class", "g-label") .attr("href", function(d) { return "#" + encodeURIComponent(d.name); }) .call(force.drag) .call(linkTopic); labelEnter.append("div") .attr("class", "g-name") .text(function(d) { return d.name; }); labelEnter.append("div") .attr("class", "g-value"); label .style("font-size", function(d) { return Math.max(8, d.r / 2) + "px"; }) .style("width", function(d) { return d.r * 2.5 + "px"; }); // Create a temporary span to compute the true text width. label.append("span") .text(function(d) { return d.name; }) .each(function(d) { d.dx = Math.max(d.r * 2.5, this.getBoundingClientRect().width); }) .remove(); label .style("width", function(d) { return d.dx + "px"; }) .select(".g-value") .text(function(d) { return formatShortCount(d.parties[0].count) + " - " + formatShortCount(d.parties[1].count); }); // Compute the height of labels when wrapped. label.each(function(d) { d.dy = this.getBoundingClientRect().height; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateLabels() {\n label = label.data(data.topics, function(d) {\n return d.name;\n });\n\n label.exit().remove();\n\n var labelEnter = label.enter().append(\"a\")\n .attr(\"class\", \"g-label\")\n .attr(\"id\", function(d) {\n return encodeURIComponent(d.name);\n })\n .call(force.drag)\n .call(linkTopic);\n\n labelEnter.append(\"div\")\n .attr(\"class\", \"g-name\")\n .text(function(d) {\n return d.name;\n });\n\n labelEnter.append(\"div\")\n .attr(\"class\", \"g-value\");\n\n label\n .style(\"font-size\", function(d) {\n return Math.max(8, r(d.count) / 2.2) + \"px\";\n })\n .style(\"width\", function(d) {\n return r(d.count) * 2.5 + \"px\";\n });\n\n // Create a temporary span to compute the true text width.\n label.append(\"span\")\n .text(function(d) {\n return d.name;\n })\n .each(function(d) { d.dx = Math.max(2.5 * r(d.count), this.getBoundingClientRect().width); })\n .remove();\n\n label\n .style(\"width\", function(d) {\n return d.dx + \"px\";\n })\n .select(\".g-value\")\n .text(function(d) {\n return d.count + (d.r > 60 ? \" mentions\" : \"\");\n });\n\n // Compute the height of labels when wrapped.\n label.each(function(d) { d.dy = this.getBoundingClientRect().height; });\n }", "configureLabels() {\n this.label\n .attr(\"class\", \"lgv-label\")\n .attr(\"data-node-label\", d => this.extractLabel(d))\n .attr(\"data-node-depth\", d => d.depth)\n .attr(\"data-node-children\", d => d.children ? true : false)\n .attr(\"x\", d => d.x)\n .attr(\"y\", d => d.children ? (d.y - (d.r * 0.9)) : d.y)\n .text(d => this.extractLabel(d));\n }", "function updateLabels() {\n label = label.data(data.topics, function(d) { return d.name; });\n\n label.exit().remove();\n\n var labelEnter = label.enter().append(\"a\")\n .attr(\"class\", \"g-label\")\n .attr(\"href\", function(d) { return \"#\" + encodeURIComponent(d.name); })\n .call(force.drag)\n .call(linkTopic);\n\n labelEnter.append(\"div\")\n .attr(\"class\", \"g-name\")\n .text(function(d) { return d.name; });\n\n labelEnter.append(\"div\")\n .attr(\"class\", \"g-value\");\n\n label\n .style(\"font-size\", function(d) { return Math.max(8, r(d.count) / 2) + \"px\"; })\n .style(\"width\", function(d) { return r(d.count) * 2.5 + \"px\"; });\n\n // Create a temporary span to compute the true text width.\n label.append(\"span\")\n .text(function(d) { return d.name; })\n .each(function(d) { d.dx = Math.max(2.5 * r(d.count), this.getBoundingClientRect().width); })\n .remove();\n\n label\n .style(\"width\", function(d) { return d.dx + \"px\"; })\n .select(\".g-value\")\n .text(function(d) { return d.count + (d.r > 60 ? \" mentions\" : \"\"); });\n\n // Compute the height of labels when wrapped.\n label.each(function(d) { d.dy = this.getBoundingClientRect().height; });\n}", "#updateLabel() {\n this.container.querySelector('.label').innerHTML = this.label;\n }", "function redrawLabels() {\n labels\n .transition()\n .duration(1500)\n .attr(\"x\", d => d.x)\n .attr(\"y\", d => d.y);\n\n links\n .transition()\n .duration(1500)\n .attr(\"x2\", d => d.x)\n .attr(\"y2\", d => d.y);\n }", "toggleLabels() {\n this.areLabelsShown = !this.areLabelsShown;\n this.labelsGroup.visible = this.areLabelsShown;\n\n this.render();\n }", "_updateLabels() {\n this._updateLabel(this._$fixItLabel,\n this._reviewView.hasOpenIssues(),\n 'has-issues');\n this._updateLabel(this._$shipItLabel,\n this.model.get('review').get('shipIt'),\n 'ship-it');\n }", "function updateLabel(){\n var textUpdate = \"\";\n for(var i = 0; i < domain.length; i++){\n textUpdate = textUpdate.concat(domain[i].name);\n textUpdate = textUpdate.concat(\"<br/>\");\n }\n domLabel.html(textUpdate);\n}", "update() {\n\t\tthis.node.innerText = this.getTime(this.ticks);\n\t}", "_updateLabels() {\n if (this._reviewView.hasOpenIssues()) {\n this._$boxStatus.addClass('has-issues');\n this._$fixItLabel\n .show()\n .css({\n opacity: 1,\n left: 0,\n });\n } else {\n this._$fixItLabel.css({\n opacity: 0,\n left: '-100px',\n });\n this._$boxStatus.removeClass('has-issues');\n }\n }", "function updateLinkLabels(active) {\n graph.element.selectAll('.link text').remove()\n if (active) {\n graph.element.selectAll('.link')\n .append('text')\n .attr('x', d => (d.parent.y + d.y) / 2)\n .attr('y', d => d.x - 5)\n .attr('text-anchor', 'middle')\n .attr('class', 'linkLabel')\n .attr('id', d => 'label' + d.data.id)\n .style('font', `${graph.style.labels_size}px sans-serif`)\n .text(d => d.data.data.value)\n }\n }", "function updateInternalLabels(active) {\n graph.element.selectAll('.internal-label').remove()\n if (active) {\n graph.element\n .selectAll('.node--internal')\n .append('text')\n .attr('class', ' internal-label')\n .attr('dy', 20)\n .attr('x', -13)\n .style('text-anchor', 'end')\n .style('font', `${graph.style.labels_size}px sans-serif`)\n .text(d => d.data.id)\n }\n }", "function updateLabel() {\r\n for (var i = 0; i < 4; i++) {\r\n buttons[i].innerHTML = getNextLabel(buttons[i].innerHTML);\r\n }\r\n for (var i = 5; i < 9; i++) {\r\n buttons[i].innerHTML = getNextLabel(buttons[i].innerHTML);\r\n }\r\n }", "function updateLabel() {\n\t\tlabelVal.text( slider._getLabelValCallback( brush.extent()[0] ) );\n\t\tlabelLabel.attr(\"transform\", \"translate(\" + (+sliderWidth + \n \t\t\t\t\t\t \t +labelVal[0][0].offsetWidth + \n \t\t\t\t\t\t \t +margin.labelSpace) + \n \t \",\" + sliderHeight/2 + \")\");\n\t}", "updateLabel() {\n this.text = this._text;\n }", "updateLabel() {\n this.text = this._text;\n }", "function addInternalLabels() {\n graph.style.parentLabels = !graph.style.parentLabels\n updateInternalLabels(graph.style.parentLabels)\n }", "function updateLeafLabels(active) {\n graph.element.selectAll('.node--leaf text').remove()\n if (active) {\n graph.element.selectAll('.node--leaf')\n .append('text')\n .attr('class', 'leafLabel')\n .attr('dy', 5)\n .attr('x', 13)\n .style('text-anchor', 'start')\n .style('font', `${graph.style.labels_size}px sans-serif`)\n .text(d => d.data.id)\n .on('mouseover', mouseOveredDendrogram(true))\n .on('mouseout', mouseOveredDendrogram(false))\n }\n }", "function updateLabels() {\n for (const label of [...document.getElementsByClassName('ehp-label')]) {\n label.parentElement.removeChild(label);\n }\n actions = {};\n for (const label of labels) {\n const element = label.element && (label.element instanceof Node ? label.element : label.element()) || document.createElement('div');\n actions[label.key] = label.action || (element => () => { element.click(); })(element.querySelector('a'));\n if (element) {\n element.style.position = 'relative';\n }\n const el = document.createElement('div');\n el.style.position = 'absolute';\n el.style.border = '1px solid var(--foreground)';\n el.style.borderRadius = '2px';\n el.style.top = '1px';\n el.style.left = '-10px';\n el.style.width = '1em';\n el.style.lineHeight = '1em';\n el.style.backgroundColor = 'var(--background)';\n el.style.color = 'var(--foreground)';\n el.style.textAlign = 'center';\n el.style.fontWeight = 'bold';\n el.style.display = 'none';\n el.classList.add('ehp-label');\n if (label.action) {\n el.style.top = 'calc(50% - 0.5em)';\n el.style.left = 'calc(50% - 0.5em)';\n }\n if (label.top) { el.style.top = label.top; }\n if (label.left) { el.style.left = label.left; }\n el.innerText = label.key;\n element.appendChild(el);\n }\n\n\n\n for (const label of [...document.getElementsByClassName('ehp-tag-label')]) {\n label.parentElement.removeChild(label);\n }\n tagActions = {};\n for (const label of tagLabels) {\n const element = label.element && (label.element instanceof Node ? label.element : label.element()) || document.createElement('div');\n tagActions[label.key] = label.action || (element => () => { element.click(); })(element.querySelector('a'));\n if (element) {\n element.style.position = 'relative';\n }\n const el = document.createElement('div');\n el.style.position = 'absolute';\n el.style.border = '1px solid var(--foreground)';\n el.style.borderRadius = '2px';\n el.style.top = '1px';\n el.style.left = '-10px';\n el.style.width = '1em';\n el.style.lineHeight = '1em';\n el.style.backgroundColor = 'var(--background)';\n el.style.color = 'var(--foreground)';\n el.style.textAlign = 'center';\n el.style.fontWeight = 'bold';\n el.style.display = 'none';\n el.classList.add('ehp-tag-label');\n if (label.action) {\n el.style.top = 'calc(50% - 0.5em)';\n el.style.left = 'calc(50% - 0.5em)';\n }\n if (label.top) { el.style.top = label.top; }\n if (label.left) { el.style.left = label.left; }\n el.innerText = label.key;\n element.appendChild(el);\n }\n }", "function UpdateLabelHandler() {\n /**\n * Set the label and return the changed elements.\n *\n * Element parameter can be label itself or connection (i.e. sequence flow).\n *\n * @param {djs.model.Base} element\n * @param {String} text\n */\n function setText(element, text) {\n // external label if present\n var label = element.label || element;\n var labelTarget = element.labelTarget || element;\n setLabel(label, text, labelTarget !== label);\n return [label, labelTarget];\n }\n\n function execute(ctx) {\n ctx.oldLabel = getLabel(ctx.element);\n return setText(ctx.element, ctx.newLabel);\n }\n\n function revert(ctx) {\n return setText(ctx.element, ctx.oldLabel);\n } // API\n\n\n this.execute = execute;\n this.revert = revert;\n }", "function updateNodes() {\n\t var _this8 = this;\n\n\t var nodesLayer = select(this.svg).select(\".nodes-layer\"); // DATA JOIN\n\t // Join new data with old elements, if any.\n\n\t var nodes = nodesLayer.selectAll(\".node\").data(this.layout.vertices, function (v) {\n\t return \"n_\".concat(v.key);\n\t }); // ENTER\n\t // Create new elements as needed.\n\n\t var newNodes = nodes.enter().append(\"g\").attr(\"id\", function (v) {\n\t return v.id;\n\t }).attr(\"class\", function (v) {\n\t return [\"node\"].concat(toConsumableArray(v.classes)).join(\" \");\n\t }).attr(\"transform\", function (v) {\n\t return \"translate(\".concat(_this8.scales.x(v.x), \", \").concat(_this8.scales.y(v.y), \")\");\n\t }); // add the specific node shapes or 'baubles'\n\n\t this.settings.baubles.forEach(function (bauble) {\n\t var d = bauble.createShapes(newNodes.filter(bauble.vertexFilter)).attr(\"class\", \"node-shape\");\n\t bauble.updateShapes(d);\n\t });\n\t newNodes.append(\"text\").attr(\"class\", \"node-label name\").attr(\"text-anchor\", \"start\").attr(\"alignment-baseline\", \"middle\").attr(\"dx\", \"12\").attr(\"dy\", \"0\").text(function (d) {\n\t return d.rightLabel;\n\t });\n\t newNodes.append(\"text\").attr(\"class\", \"node-label support\").attr(\"text-anchor\", \"end\").attr(\"dx\", \"-6\").attr(\"dy\", function (d) {\n\t return d.labelBelow ? -8 : +8;\n\t }).attr(\"alignment-baseline\", function (d) {\n\t return d.labelBelow ? \"bottom\" : \"hanging\";\n\t }).text(function (d) {\n\t return d.leftLabel;\n\t }); // update the existing elements\n\n\t nodes.transition().duration(this.settings.transitionDuration).ease(this.settings.transitionEase).attr(\"class\", function (v) {\n\t return [\"node\"].concat(toConsumableArray(v.classes)).join(\" \");\n\t }).attr(\"transform\", function (v) {\n\t return \"translate(\".concat(_this8.scales.x(v.x), \", \").concat(_this8.scales.y(v.y), \")\");\n\t }); // update all the baubles\n\n\t this.settings.baubles.forEach(function (bauble) {\n\t var d = nodes.select(\".node-shape\").filter(bauble.vertexFilter).transition().duration(_this8.settings.transitionDuration).ease(_this8.settings.transitionEase);\n\t bauble.updateShapes(d);\n\t });\n\t nodes.select(\"text .node-label .name\").transition().duration(this.settings.transitionDuration).ease(this.settings.transitionEase).attr(\"class\", \"node-label name\").attr(\"text-anchor\", \"start\").attr(\"alignment-baseline\", \"middle\").attr(\"dx\", \"12\").attr(\"dy\", \"0\").text(function (d) {\n\t return d.rightLabel;\n\t });\n\t nodes.select(\"text .node-label .support\").transition().duration(this.settings.transitionDuration).ease(this.settings.transitionEase).attr(\"alignment-baseline\", function (d) {\n\t return d.labelBelow ? \"bottom\" : \"hanging\";\n\t }).attr(\"class\", \"node-label support\").attr(\"text-anchor\", \"end\").attr(\"dx\", \"-6\").attr(\"dy\", function (d) {\n\t return d.labelBelow ? -8 : +8;\n\t }).text(function (d) {\n\t return d.leftLabel;\n\t }); // EXIT\n\t // Remove old elements as needed.\n\n\t nodes.exit().remove();\n\t updateNodeStyles.call(this); // add callbacks\n\n\t var _iteratorNormalCompletion = true;\n\t var _didIteratorError = false;\n\t var _iteratorError = undefined;\n\n\t try {\n\t for (var _iterator = this.callbacks.nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t var callback = _step.value;\n\t callback();\n\t }\n\t } catch (err) {\n\t _didIteratorError = true;\n\t _iteratorError = err;\n\t } finally {\n\t try {\n\t if (!_iteratorNormalCompletion && _iterator[\"return\"] != null) {\n\t _iterator[\"return\"]();\n\t }\n\t } finally {\n\t if (_didIteratorError) {\n\t throw _iteratorError;\n\t }\n\t }\n\t }\n\t}", "function renderNodeLabels(ctx, nodes_to_label, opacity) {\n ctx.fillStyle = 'black';\n ctx.textBaseline = 'middle';\n ctx.textAlign = 'center'; // ctx.globalAlpha = 1\n\n nodes_to_label // .filter(d => d.type === \"concept\" && (d.font_size > 7 || do_print_run))\n .filter(function (d) {\n return d.type === 'concept' && (d.font_size > 7 || do_print_run && d.font_size > 3 / sf_scale);\n }).forEach(function (d) {\n ctx.font = 'normal normal 300 ' + d.font_size + 'px ' + font_family;\n ctx.globalAlpha = opacity ? opacity : d.opacity;\n ctx.fillText(d.label.toUpperCase(), d.x, d.y);\n });\n ctx.globalAlpha = 1;\n } //function renderNodeLabels", "function updateTopLabels(current_state){\n \n var points = model.get_current_state_array();\n var names = Object.keys(model.get_current_state());\n\n chart[current_state].selectAll(\".bubble-label\"+current_state).remove();\n \n chart[current_state].selectAll(\".bubble-label\"+current_state).data(points).enter().append(\"text\").attr(\"class\", \"bubble-label\"+current_state)\n .attr(\"x\",function(d,i){return chart_width*(i/(points.length-1))})\n .attr('y',chart_height/4)\n .attr(\"dx\",-4)\n .attr(\"text-anchor\",\"middle\")\n .text(function(d) { return round_number(d,4); });\n }", "function update(tree) {\n if (graph.nodes && !graph.nodes.empty()) graph.nodes.remove()\n if (graph.links && !graph.links.empty()) graph.links.remove()\n\n graph.links = graph.element.append('g').attr('id', 'linksContainer')\n graph.nodes = graph.element.append('g').attr('id', 'nodesContainer')\n\n let nodes = tree.descendants()\n let links = tree.descendants().slice(1)\n\n linksAttr(graph.links.selectAll('.link').data(links, d => d.data.id).enter())\n nodesAttrs(graph.nodes.selectAll('.node').data(nodes).enter())\n\n if (!graph.style.barChart) updateLeafLabels(graph.style.leafLabels)\n else {\n graph.element.selectAll('.leafLabelIsolates text').remove()\n graph.element.selectAll('circle').each(d => addBarCharts(d))\n addLeafLabelsNotIsolates()\n }\n\n updateLinkLabels(graph.style.linkLabels)\n updateInternalLabels(graph.style.parentLabels)\n }", "adjustLabelsToCameraPosition() {\n if (!this.areLabelsShown || !this.settings.labelsConfig.areSpritesUsed) return;\n this.labelsGroup.children.forEach((label) => {\n const { atomPosition, atomName: element } = label.userData;\n const offsetVector = this.getLabelOffsetVector(atomPosition, element);\n label.position.addVectors(atomPosition, offsetVector);\n label.visible = this.areLabelsShown;\n label.lookAt(this.camera.position);\n });\n }", "function updateXlabel() {\n if (options.xlabel && xlabel) {\n xlabel.text(options.xlabel);\n }\n }", "function updateNodes() {\n node = node.data(data.topics, function(d) {\n return d.name;\n });\n\n node.exit().remove();\n\n node.enter().append(\"a\")\n .attr(\"class\", \"g-node\")\n //.attr(\"xlink:href\", function(d) { return \"#\" + encodeURIComponent(d.name); })\n .attr(\"id\", function(d) {\n return encodeURIComponent(d.name);\n })\n .call(force.drag)\n .call(linkTopic)\n .append(\"g\")\n .append(\"circle\")\n\n node.select(\"circle\")\n .attr(\"r\", function(d) {\n return r(d.count);\n })\n .style(\"fill\", function(d) {\n return d.count >= 40 ? \"#74c1ab\" : '#8ee6ca' });\n\n }", "function setloopLabel(Labelnew){\n loopLabel.textContent = Labelnew;\n}", "function updateNodes() {\n node = node.data(data.topics, function(d) { return d.name; });\n\n node.exit().remove();\n\n node.enter().append(\"a\")\n .attr(\"class\", \"g-node\")\n .attr(\"xlink:href\", function(d) { return \"#\" + encodeURIComponent(d.name); })\n .call(force.drag)\n .call(linkTopic)\n .append(\"circle\");\n\n node.select(\"circle\")\n .attr(\"r\", function(d) { return r(d.count); });\n}", "function showNodeLabelText(nodeLabel){\n\t\tlet n = d3.select('#' + nodeLabel)\n\t\tsvg.append(\"text\") // Name label text\n\t\t\t.attr('id', 'text' + n.attr('label'))\n\t\t\t.attr('label', 'textNode' + n.attr('label'))\n\t\t\t.attr('class', 'textNode')\n\t\t\t.attr('x', function() { return n.attr('cx') })\n\t\t\t.attr('y', function() { return n.attr('cy') + Math.floor(nodeRadius)})\n\t\t\t.style('font-size', nodeRadius)\n\t\t\t.text(function() {\n\t\t\t\treturn n.attr('label').replace('node', '')\n\t\t\t})\n\t}", "function updateLabelLayer() {\n\n labelLayer.getSource().clear();\n if (scope.message) {\n var features = MessageService.featuresForMessage(scope.message);\n if (features.length > 0) {\n var coordIndex = 1;\n angular.forEach(features, function (gjFeature) {\n\n var olFeature = MapService.gjToOlFeature(gjFeature);\n var styles = [];\n\n // Create a label for the feature\n var name = gjFeature.properties\n ? gjFeature.properties['name:' + $rootScope.language]\n : undefined;\n\n if (name) {\n styles.push(scope.styleForFeatureName(\n olFeature,\n name));\n }\n\n // Create labels for the \"readable\" coordinates\n var coords = [];\n MapService.serializeReadableCoordinates(gjFeature, coords);\n for (var x = 0; x < coords.length; x++) {\n\n var c = MapService.fromLonLat([ coords[x].lon, coords[x].lat ]);\n\n styles.push(scope.styleForFeatureCoordIndex(\n olFeature,\n coordIndex,\n c));\n\n if (coords[x].name) {\n styles.push(scope.styleForFeatureCoordName(\n olFeature,\n coords[x].name,\n c));\n }\n coordIndex++;\n }\n\n if (styles.length > 0) {\n olFeature.setStyle(styles);\n labelLayer.getSource().addFeature(olFeature);\n }\n });\n }\n }\n }", "function updateLabel(msg) {\n $(\"#status_label\").text(msg);\n }", "updateViewObjects(state) {\n //Node\n if (!this.viewObjects[\"main\"] ||\n (!this.skipLabel && !this.labels[state.labels[this.constructor.name]] && this[state.labels[this.constructor.name]])) {\n this.createViewObjects(state);\n }\n\n if (this.fixed) { copyCoords(this, this.foci || this.layout); }\n\n if (this.controlNodes) {\n copyCoords(this, getCenterOfMass(this.controlNodes).multiplyScalar(2)); //double the distance from center\n }\n\n copyCoords(this.viewObjects[\"main\"].position, this);\n\n this.updateLabels(state.labels[this.constructor.name], state.showLabels[this.constructor.name],\n this.viewObjects[\"main\"].position.clone().addScalar(5 + this.val * state.nodeRelSize));\n }", "function updateLabels(newStatus, statusField, button) {\n\n statusField.text(newStatus);\n\n // update button label\n if (button) {\n if (newStatus === 'active') {\n button.text('deactivate');\n } else {\n button.text('activate');\n }\n }\n }", "updateCursorLabels() {\n const cursorInfo = this.engine.getSession().selection.getCursor();\n this.uiHandler.updateCursorLabels(cursorInfo);\n }", "function setPositionOfOldLabelsOnNewLabels(oldLabelNodes, labelNodes) {\n\t\tlabelNodes.forEach(function (labelNode) {\n\t\t\tfor (var i = 0; i < oldLabelNodes.length; i++) {\n\t\t\t\tvar oldNode = oldLabelNodes[i];\n\t\t\t\tif (oldNode.equals(labelNode)) {\n\t\t\t\t\tlabelNode.x = oldNode.x;\n\t\t\t\t\tlabelNode.y = oldNode.y;\n\t\t\t\t\tlabelNode.px = oldNode.px;\n\t\t\t\t\tlabelNode.py = oldNode.py;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "function updateCounts() {\n const counts = knnClassifier.getCountByLabel();\n\n document.querySelector('#example1').textContent = counts.Up || 0;\n document.querySelector('#example2').textContent = counts.Right || 0;\n document.querySelector('#example3').textContent = counts.Down || 0;\n document.querySelector('#example4').textContent = counts.Left || 0;\n}", "createLabels() {\n if (this.settings.labelsConfig.areSpritesUsed) {\n this.createLabelsAsSprites();\n } else {\n this.createLabelsAsPoints();\n }\n this.render();\n }", "function updateClusterAndNodeNames ( stats, state ){\n if (stats) {\n // get master node id if available\n var masterNodeId = undefined;\n if (state) {\n masterNodeId = state.master_node;\n }\n if(stats.cluster_name && clusterName != stats.cluster_name) {\n clusterName = stats.cluster_name;\n clusterNameSpan.text(clusterName);\n }\n if (stats.nodes) {\n var nodesChanged = false;\n for (var node in nodes) {\n // node removed?\n if (!stats.nodes[node]) {\n if (selectedNodeName && nodes[node] == selectedNodeName) {\n selectedNodeName = undefined;\n cleanCharts(charts);\n // TODO stop timer ?\n }\n delete nodes[node];\n nodesChanged = true;\n }\n }\n for (var node in stats.nodes) {\n // new node?\n if (!nodes[node]) {\n nodes[node] = stats.nodes[node].name;\n nodesChanged = true;\n }\n }\n if (nodesChanged) {\n //redraw nodes\n var _nodes = [];\n for (var n in nodes) _nodes.push(nodes[n]);\n _nodes.sort(); // sort node names alphabetically\n nodesSpan.empty();\n if (selectedNodeName == undefined && _nodes.length > 0) {\n // make first available node selected\n selectedNodeName = _nodes[0];\n refreshNodeInfo(selectedNodeName);\n }\n $.each(_nodes, function(index, value) {\n var node = $(document.createElement(\"span\")).attr(\"class\",\"node\").append(value);\n if (value == selectedNodeName) { $(node).addClass(\"selectedNode\"); }\n if ( masterNodeId == getSelectedNodeId(value)) { $(node).addClass( \"masterNode\" ); }\n $(node).click(\n function(){\n // new node selected by user\n if (selectedNodeName != $(this).text()) {\n selectedNodeName = $(this).text();\n refreshNodeInfo(selectedNodeName);\n $.each(nodesSpan.children(),\n function(id, s){\n if (selectedNodeName == $(s).text()) $(s).addClass(\"selectedNode\")\n else $(s).removeClass(\"selectedNode\");\n }\n );\n cleanCharts(charts);\n setupInterval($(\"#interval option:selected\").val());\n }\n }\n );\n $(nodesSpan).append(node);\n });\n }\n }\n }\n }", "updateNode() {\n for (let b of this.buttons) {\n b.updateNode();\n }\n }", "function updateNodes() {\n for (var item = 0; item < matrixLen; item++) {\n addItem(tempArray[item]);\n }\n addButton();\n }", "changeLblTxt(newTxt) {\r\n this.HTMLElement.textContent = newTxt;\r\n }", "updateEdgeLabel() {\n const rotatelabel = this.getRotateLabel()\n d3.select(this.html.node().parentElement).select(\"text\")\n .attr(\"x\", (this.x2+this.x1)/ 2 - 5*this.label.length)\n .attr(\"y\", (this.y2+this.y1 - this.stroke_width)/2)\n .attr(\"transform\", rotatelabel)\n }", "function updateNetworkDisplay(on) {\n networkDom.text(on ? 'on' : 'off');\n networkDom.toggleClass('label-success', on);\n networkDom.toggleClass('label-important', !on);\n }", "function updateAvailableNodes() {\r\n\tvar availableNodesSpan = document.getElementById('available-nodes-span');\r\n\tif (availableNodesSpan != null || availableNodesSpan != undefined) {\r\n\t\tavailableNodesSpan.innerText = countAvailableNodes();\r\n\t}\r\n}", "function renderNodeLabels(ctx, nodes_to_label, opacity) {\n ctx.fillStyle = 'black';\n ctx.textBaseline = 'middle';\n ctx.textAlign = 'center'; //Get all the nodes that need a label\n\n var nodes_big = nodes_to_label.filter(function (d) {\n return d.type === 'concept' && (d.font_size > 7 || do_print_run && d.font_size > 3 / sf_scale);\n }); //Draw all non-biome concept nodes\n\n nodes_big.filter(function (d) {\n return d.group !== 'biome';\n }).forEach(function (d) {\n ctx.font = 'normal normal 300 ' + d.font_size + 'px ' + font_family;\n ctx.globalAlpha = opacity ? opacity : d.opacity;\n ctx.fillText(d.label.toUpperCase(), d.x, d.y);\n }); //forEach\n\n ctx.globalAlpha = 1; //Draw the biome concept nodes\n\n nodes_big.filter(function (d) {\n return d.group === 'biome';\n }).forEach(function (d) {\n ctx.globalAlpha = opacity ? opacity : d.opacity; //Draw the icon on top\n\n if (d.img_loaded) {\n var radius = d.r - d.stroke_width * 1.5;\n drawImage(ctx, d, d.r * 0.7, radius);\n } //if\n //Change the opacity\n\n\n var col = d3__WEBPACK_IMPORTED_MODULE_6__[\"rgb\"](d.fill);\n var col_new = 'rgba(' + col.r + ',' + col.g + ',' + col.b + ',' + 0.7 + ')';\n ctx.fillStyle = col_new;\n ctx.font = 'normal normal 500 ' + d.font_size + 'px ' + font_family; // ctx.fillText(d.title.toUpperCase(), d.x, d.y)\n\n ctx.save();\n ctx.translate(d.x, d.y);\n drawTextAlongArc(ctx, d.title.toUpperCase(), 0, d.r * 0.8, 'up');\n ctx.restore();\n }); //forEach\n\n ctx.globalAlpha = 1;\n } //function renderNodeLabels", "function renderLabels() {\n renderLabelsHorizontal.call(this);\n renderLabelsVertical.call(this);\n}", "function _updateLabelFor(){\n\t\tvar aFields = this.getFields();\n\t\tvar oField = aFields.length > 0 ? aFields[0] : null;\n\n\t\tvar oLabel = this._oLabel;\n\t\tif (oLabel) {\n\t\t\toLabel.setLabelFor(oField); // as Label is internal of FormElement, we can use original labelFor\n\t\t} else {\n\t\t\toLabel = this.getLabel();\n\t\t\tif (oLabel instanceof Control /*might also be a string*/) {\n\t\t\t\toLabel.setAlternativeLabelFor(oField);\n\t\t\t}\n\t\t}\n\t}", "update(info) {\n _.each(this.nodes, (node) => {\n node.shape.setText(node.getText(info));\n if (node.isCritical) {\n if (node.isCritical(info)) {\n node.shape.fillStyle = UI.WARN_COLOR;\n } else {\n node.shape.fillStyle = UI.TEXT_COLOR;\n }\n }\n });\n }", "function setButtonLabel(){\n\t\t\tlabel = that.container\n\t\t\t\t.append(\"text\")\n\t\t\t\t.attr(\"class\", \"buttonLabel\")\n\t\t\t\t.attr(\"id\",labelId)\n\t\t\t\t.style(\"opacity\", hidden)\n\t\t\t\t.text(that.labelText);\n\t\t}", "function updateCounts() {\n const counts = knnClassifier.getCountByLabel();\n const numLabels = knnClassifier.getNumLabels();\n\n select(\"#samplesA\").html(`${counts[\"train background noise\"] || 0} samples`);\n select(\"#samplesB\").html(`${counts[\"train a sound\"] || 0} samples`);\n\n if (numLabels > 0) {\n buttonPredict.style(\"visibility\", \"visible\");\n buttonClearAll.style(\"visibility\", \"visible\");\n } else {\n buttonPredict.style(\"visibility\", \"hidden\");\n buttonClearAll.style(\"visibility\", \"hidden\");\n }\n}", "refreshLabel() {\n const _elemId = this._getMarkupElemIdPart('label', 'HView#refreshLabel');\n if (this.isNumber(_elemId)) {\n ELEM.setHTML(_elemId, this.label);\n }\n return this;\n }", "function updateLikes(){\n\tdocument.getElementById('LabelLikes').innerHTML = nf.format(likes);\n\tdocument.getElementById('likestxt').innerHTML = \"You have \" + nf.format(likes) + \" likes\";\n}", "function NodeLabels (view)\r\n{\r\n if (arguments.length > 0) {\r\n\tthis.init(view);\r\n }\r\n}", "function labelNodes(node, IDs) {\n // Terminals\n if (node.desc === null) {\n node.id = IDs[0];\n IDs[0]++;\n } else {\n // Internals\n if (node.name === \"root\") {\n node.id = 0;\n } else {\n node.id = IDs[1];\n IDs[1]++;\n }\n for (let i = 0; i < node.desc.length; i++) {\n // Recurse through descendants\n IDs = labelNodes(node.desc[i], IDs);\n }\n }\n return IDs;\n}", "function repaintAllLabels(){\n\t\t\t\t//enableLoadingScreen();\n\t\t\t\t//give chance for loading screen to pop up\n\t\t\t\t//setTimeout(function() {\n\t\t\t\t\trepaintLabels(undefined);\t\n\t\t\t\t\t//disableLoadingScreen();\n\t\t\t\t//},0);\n\t\t\t}", "updateDisplayString() {\n this.displayString = 'Increase ' + this.name + ' by ' + this.value + ' ' + this.measuringUnit;\n }", "function sliderLabelUpdate()\t\t\n {\n $sliderGroup.find('.slider-text').val(function()\n {\n var val = $(this).next('.slider').slider( \"option\", \"value\");\n return val; \n })\n }", "updateDisplay() {\n $('#steps .value').text(this.stepCounter);\n }", "loadLabels(labels) {\n if (!labels) return;\n // update last JSON screenshot with new input\n const labelsCopy = cloneDeep(labels);\n this._.lastLabelsJSONScreenshot = labelsCopy;\n\n const mode = this._.mode;\n const canvas = this.refs.labelCanvas;\n let lid = 0;\n let rid = 0;\n for (const label of labelsCopy) {\n const regions = new Set();\n const text = label.text;\n const newLabel = { id: label.id, regions, x: label.x, y: label.y, text, minimized: true };\n this._.labelSet.add(newLabel);\n this._.id2labelMap[newLabel.id] = newLabel;\n for (const reg of label.regions) {\n if (rid < reg.id) rid = reg.id;\n const region = cloneDeep(reg);\n if (region.type === CIRCLE_TYPE) {\n region.rx = this.props.circleRadius / canvas.offsetWidth;\n region.ry = this.props.circleRadius / canvas.offsetHeight;\n }\n region.stringPosition = this.getRegionStringPosition(region);\n regions.add(region);\n }\n if (lid < label.id) lid = label.id;\n }\n this._.labelId = lid + 1;\n this._.regionId = rid + 1;\n\n if (mode === MODES.READONLY) {\n /* make sure to make visible labels that are selected */\n const { selectedLabelIds } = this.props;\n if (selectedLabelIds) {\n selectedLabelIds.forEach(id => {\n const label = this._.id2labelMap[id];\n if (label) label.visible = true;\n else console.warn('WARNING: id = ', id, ' not found in id2labelMap');\n });\n }\n }\n\n this.renderForAWhile();\n if (mode !== MODES.READONLY) this.forceUpdate(this.refreshAllLabelsPositions);\n }", "function updateTotalNodes() {\r\n\tvar totalNodesSpan = document.getElementById('total-nodes-span');\r\n\tif (totalNodesSpan != null || totalNodesSpan != undefined) {\r\n\t\ttotalNodesSpan.innerText = countNodes();\r\n\t}\r\n}", "function graphUpdate (nodes) {\n\n nodes = new vis.DataSet(nodes)\n network.redraw()\n}", "function updateSampleCountDisplay() {\n $('.message-nn1-true').html(NN1TrueDataArray.length);\n $('.message-nn1-false').html(NN1FalseDataArray.length);\n $('.message-nn2-true').html(NN2TrueDataArray.length);\n $('.message-nn2-false').html(NN2FalseDataArray.length);\n }", "function updateFieldLabel (event) {\n lib.updateActiveFieldLabel(this.value);\n }", "_updateLabel($label, visible, boxClassName) {\n if (visible) {\n this._$boxStatus.addClass(boxClassName);\n $label\n .show()\n .css({\n opacity: 1,\n left: 0,\n });\n } else {\n $label.css({\n opacity: 0,\n left: '-100px',\n });\n this._$boxStatus.removeClass(boxClassName);\n }\n }", "function showLabels() {\n let labels = gLabels.selectAll(\"text:not([display=none])\");\n let points = gPoints.selectAll(\"path\");\n let labelsToShow = [];\n\n // gLabels.selectAll(\"rect\").remove(); // Debug\n\n labels.each(function () {\n let label = d3.select(this);\n let labelBBox = getBBox(this);\n let overlap = false;\n\n // // Show bboxes\n // const bbRect = gLabels\n // .append(\"rect\")\n // .attr(\"x\", labelBBox.x - labelPadding)\n // .attr(\"y\", labelBBox.y - labelPadding)\n // .attr(\"width\", labelBBox.width + labelPadding * 2)\n // .attr(\"height\", labelBBox.height + labelPadding * 2)\n // .attr(\"fill\", \"black\")\n // .attr(\"opacity\", 0.1);\n\n // Check if label overlaps with other points\n points.each(function (d) {\n if (\n label.datum()[0].id !== d.id &&\n getRectsOverlap(labelBBox, getBBox(this))\n ) {\n overlap = true;\n }\n });\n\n // Check if label overlaps with labels we want to show\n if (!overlap) {\n labelsToShow.forEach(function (l) {\n if (getRectsOverlap(labelBBox, getBBox(l))) overlap = true;\n });\n }\n\n // Check if label overlaps with y-axis\n if (!overlap) {\n if (getRectsOverlap(labelBBox, getBBox(gY.node()))) overlap = true;\n }\n\n // Add label to array we want to show\n if (!overlap) {\n labelsToShow.push(this);\n }\n });\n\n // Show labels\n d3.selectAll(labelsToShow)\n .transition()\n .duration(animationTime / 2)\n .attr(\"opacity\", \"1\");\n }", "function updateLabels() {\n if (object_selected) {\n var obj = objects[selected_object_index];\n var desc = getDesc(obj);\n }\n\n if (object_selected && obj.type == \"word\") {\n $('#edit_button').show();\n $('#edit_button').html(\"Convert \" + desc + \" to Image\");\n } else {\n $('#edit_button').hide();\n }\n \n if (object_selected && (obj.type == \"line\" || obj.type == \"circle\")) {\n $('#incr_button').show();\n $('#decr_button').show();\n } else {\n $('#incr_button').hide();\n $('#decr_button').hide();\n }\n\n if (object_selected) {\n $('#copy_button').show();\n $('#copy_button').html(\"Copy \" + desc);\n $('#del_button').show();\n $('#del_button').html(\"Delete \" + desc);\n $('#top_button').show();\n $('#top_button').html(\"Move \" + desc + \" to Top\");\n } else {\n $('#copy_button').hide();\n $('#del_button').hide();\n $('#top_button').hide();\n }\n\n if (picking_photo) {\n $('#button_div').toggle(false);\n } else {\n $('#button_div').toggle(true);\n }\n}", "function setLabel(props){\n //label content\n var labelAttribute = \"<h1>\" + props[expressed] + \"%\" +\n \"</h1><b>\" + \"Percent \" + 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.NAME_1 + \"_label\")\n .html(labelAttribute);\n\n var stateName = infolabel.append(\"div\")\n .attr(\"class\", \"labelname\")\n .html(props.NAME_1);\n}", "_updateAriaLabel() {\n var displayable = this.getTopDisplayable();\n if (displayable && !dvt.Agent.deferAriaCreation())\n displayable.setAriaProperty('label', this.getAriaLabel());\n }", "function showNode(node, show) {\n\n var opacity = network.display.DEF_NODE_OPACITY;\n var font = network.display.DEF_LABEL_FONT;\n var fontWeight = network.display.DEF_LABEL_WEIGHT;\n var fontSize = network.display.DEF_LABEL_SIZE;\n var nodeSize = network.display.DEF_NODE_SIZE;\n var thumbVis = network.display.DEF_THUMB_VISIBILITY;\n var thumbWidth = network.display.DEF_THUMB_WIDTH;\n var thumbHeight = network.display.DEF_THUMB_HEIGHT;\n\n if (show === \"highlight\") {\n opacity = network.display.HLT_NODE_OPACITY;\n font = network.display.HLT_LABEL_FONT;\n fontWeight = network.display.HLT_LABEL_WEIGHT; \n fontSize = network.display.HLT_LABEL_SIZE;\n nodeSize = network.display.HLT_NODE_SIZE;\n thumbVis = network.display.HLT_THUMB_VISIBILITY;\n thumbWidth = network.display.HLT_THUMB_WIDTH;\n thumbHeight = network.display.HLT_THUMB_HEIGHT;\n }\n else if (show === \"select\") {\n opacity = network.display.SEL_NODE_OPACITY;\n font = network.display.SEL_LABEL_FONT;\n fontWeight = network.display.SEL_LABEL_WEIGHT; \n fontSize = network.display.SEL_LABEL_SIZE;\n nodeSize = network.display.SEL_NODE_SIZE;\n thumbVis = network.display.SEL_THUMB_VISIBILITY;\n thumbWidth = network.display.SEL_THUMB_WIDTH;\n thumbHeight = network.display.SEL_THUMB_HEIGHT;\n }\n\n node.labelElem.attr(\"opacity\", opacity);\n node.labelElem.attr(\"font-family\", font);\n node.labelElem.attr(\"font-weight\", fontWeight);\n node.labelElem.attr(\"font-size\", fontSize);\n\n node.nodeElem .attr(\"r\", nodeSize);\n node.nodeElem .attr(\"opacity\", opacity);\n\n node.thumbElem.attr(\"visibility\", thumbVis);\n node.thumbElem.attr(\"width\", thumbWidth);\n node.thumbElem.attr(\"height\", thumbHeight);\n\n // move the highlighted node thumbnail element\n // to the end of its parents' list of children,\n // so it is displayed on top\n var thumbNode = node.thumbElem.node();\n thumbNode.parentNode.appendChild(thumbNode);\n }", "function changeButtonLabels(){\n sessionTime.innerHTML = convertToString(minutesSession);\n breakTime.innerHTML = convertToString(minutesBreak);\n displayTime(minutesSession,0);\n}", "function updateNode(initial_state, final_state, node_label) {\n\t\tsaveFAState();\n\t\texecuteEditFANode(g, selected, initial_state, final_state, node_label);\n\t}" ]
[ "0.7136593", "0.69141847", "0.6898004", "0.6802935", "0.67315245", "0.66303724", "0.66242313", "0.66188896", "0.66165584", "0.6605812", "0.6589973", "0.6467728", "0.6438781", "0.6405271", "0.63405585", "0.63405585", "0.6313205", "0.63078684", "0.6287532", "0.62315905", "0.6208422", "0.617034", "0.6167712", "0.61145663", "0.6095797", "0.6073737", "0.6071923", "0.6066395", "0.60376424", "0.6022286", "0.5997423", "0.5996125", "0.5992085", "0.59795916", "0.5973018", "0.59020257", "0.5893085", "0.5886789", "0.5875769", "0.5855985", "0.585329", "0.5853265", "0.5852081", "0.58518285", "0.5842253", "0.58287835", "0.5796453", "0.5793004", "0.5785386", "0.5781502", "0.5777692", "0.57668626", "0.5760827", "0.5758903", "0.5749107", "0.57378215", "0.5732893", "0.5730573", "0.57304156", "0.5725934", "0.57068205", "0.5705278", "0.5701128", "0.5694516", "0.5692442", "0.5690203", "0.5687978", "0.56856567", "0.56746626", "0.56736815", "0.56725657", "0.5672503" ]
0.7029836
28
Update the active topic.
function updateActiveTopic(topic) { d3.selectAll(".g-head").attr("class", topic ? "g-head g-has-topic" : "g-head g-hasnt-topic"); if (activeTopic = topic) { node.classed("g-selected", function(d) { return d === topic; }); updateMentions(findMentions(topic)); d3.selectAll(".g-head a").text(topic.name); d3.select(".g-democrat .g-head span.g-count").text(formatCount(topic.parties[0].count)); d3.select(".g-republican .g-head span.g-count").text(formatCount(topic.parties[1].count)); } else { node.classed("g-selected", false); updateMentions(sampleMentions()); d3.selectAll(".g-head a").text("various topics"); d3.selectAll(".g-head span.g-count").text("some number of"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateActiveTopic(topic) {\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.select(\"#g-topic\").text((topic.count > maxMentions ? \"A sampling of \" : topic.count || \"No\") + \" mentions of \" + topic.name + \".\");\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.select(\"#g-topic\").text(\"Lucastimmons tweets\");\n }\n}", "changeTopic(newTopic) {\n let url = defaultUrl + '&category=' + newTopic;\n this.apiCall(url);\n }", "function setTopic(newTopic) {\n const oldTopic = topic;\n topic = topicToFileName(newTopic);\n const date = datepicker('getDate');\n fetchDates(topic, getYYYYMM(date));\n return oldTopic;\n }", "function topicChanged( topic, room, user ) {\n}", "handleUpdatedTopicStore( topicStore ) {\n\n this.setState( {\n isActive: this.props.id == topicStore.activeTopicId\n } );\n\n }", "function processTopicSettingsUpdated(topic){\n console.log(\"Processing topic settings updated\");\n for(let participant of topic.participants){\n let nickname = participant.getNickname();\n let alias = participant.getAlias()\n Common.setParticipantAlias(topic, participant, alias)\n Common.setParticipantNickname(topic, participant, nickname)\n }\n\n for (let invite of topic.getInvites()){\n Common.setInviteAlias(invite)\n }\n\n}", "async updateTopic({ topic_id, memo }) {\n\t\tconst client = this.#client\n\t\tconst topic = await new TopicUpdateTransaction()\n\t\t\t.setTopicId(topic_id)\n\t\t\t.setTopicMemo(memo)\n\t\t\t.execute(client)\n\n\t\treturn topic\n\t}", "updateTopicStatus(courseId, topic, status, userId) {\n return __awaiter(this, void 0, void 0, function* () {\n if (topic.userTopicId) {\n return this.updateCourseTopicStatus(topic.userTopicId, status);\n }\n else {\n return this.addCourseTopic(courseId, topic.code, status, userId);\n }\n });\n }", "updateTopic(topic, options = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n const { span, updatedOptions } = createSpan(\"ChatThreadClient-UpdateTopic\", options);\n try {\n yield this.client.chatThread.updateChatThreadProperties(this.threadId, { topic: topic }, operationOptionsToRequestOptionsBase(updatedOptions));\n }\n catch (e) {\n span.setStatus({\n code: CanonicalCode.UNKNOWN,\n message: e.message\n });\n throw e;\n }\n finally {\n span.end();\n }\n });\n }", "static changeTopic() {\n const input = document.getElementById('subscription_topic');\n const topic = input.value;\n\n Controller.Api.post('/change_topic', { topic: topic })\n .then(response => {\n console.log(response.data);\n })\n .catch(error => {\n console.log(error);\n });\n\n console.log('topic: ', topic);\n input.value = '';\n }", "function setTopic( text ) {\n info.setTopic( text );\n}", "function updateUserTopic(userId, topic) {\n return new Promise((resolve, reject) => {\n if (!topic) {\n reject(new Error(\"topic must be set\"));\n return;\n }\n const data = JSON.stringify({\n api_key: process.env.EMAIL_OCTOPUS_API_KEY,\n fields: {\n Topic: topic,\n },\n status: \"SUBSCRIBED\",\n });\n\n updateContact(userId, data)\n .then((result) => resolve(result))\n .catch((err) => reject(err));\n });\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n }", "function switchTopic(key) {\n alert(\"Switching topics not yet implemented\");\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function change_topic() {\n\tif (numAnswered < chosenTopics.length - 1) {\n\t\t//update progress bar\n\t\tnumAnswered++; //global\n\t\tset_progress();\n\t\t//reset input in text area\n\t\tdocument.getElementById(\"answer-input\").value=\"\";\n\t\t//change topic in header\n\t\tdocument.getElementById(\"topic-text\").innerHTML = chosenTopics[numAnswered].topicText;\n\t\tif (numAnswered === chosenTopics.length - 1){\n\t\t\tdocument.getElementById(\"send-button\").innerHTML = \"Finish\";\n\t\t}\n\t}\n\telse {\n\t\tprepare_modal();\n\t}\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(findTopic(name));\n}", "function increaseExample() {\n var url = '/example/increase/' + dm4c.selected_object.id,\n topic = dm4c.restc.request('GET', url)\n dm4c.show_topic(new Topic(topic), 'show')\n }", "updateTopic(root, args, { user }) {\n if (!user) {\n throw new AuthenticationError('You must be logged in to update a topic')\n }\n // todo before trying to update, check if it is found\n let _tempTopic = Object.assign({}, args)\n delete _tempTopic.id\n return Topic.updateOne({ _id: args.id }, { $set: _tempTopic })\n }", "handleClick() {\n topicActions.updateActiveTopicId( this.props.id );\n }", "function updatePubSub(){\n\n\t\t// LOAD IN PUBLISH INFO\n\t\tvar publishers = [];\n\n\t\tfor (var i=0, len=publishes.length; i<len; i++){\n\t\t var m = publishes[i];\n\t\t var pub = {\n\t\t \t\"name\": m.name,\n\t\t \t\"type\": m.type,\n\t\t \t\"default\": m._default\n\t\t }\t \n\n\t\t publishers.push(pub); \n\t\t}\n\t\t \n\t\t// LOAD IN SUBSCRIBE INFO\n\t\tvar subscribers = [];\n\t\t \n\t\tfor (var i=0; i<subscribes.length; i++){\n\t\t var m = subscribes[i];\n\t\t var sub = {\n\t\t \t\"name\": m.name,\n\t\t \t\"type\": m.type\n\t\t }\n\t\t \n\t\t subscribers.push(subs); \n\t\t}\n\n\t\ttConfig.config = {\n\t\t\tname: this.name,\n\t\t\tdescription: this.description,\n\t\t\tsubscribe: {\n\t\t\t\tmessages: subscribers\n\t\t\t}, \n\t\t\tpublish: {\n\t\t\t\tmessages: publishers\n\t\t\t}\n\t\t};\n\n\t\tif ( connectionEstablished ){\n\t\t\twsClient.send( JSON.stringify( tConfig ) );\n\t\t}\n\t}", "updateActiveThread(thread) {\r\n thread.unreadCount = 0;\r\n this.props.uiManager.setActiveThread(thread);\r\n this.props.uiManager.updateMainPresenter(Messages_UI_State_1.MainPresenter.thread);\r\n }", "function changeTT(topic, message) {\n str = message.toString('utf-8');\n console.log('Received %s : %s', topic, str);\n\n value = parseInt(str,10);\n\n // Update HTML content\n document.getElementById(topic).innerHTML = value;\n\n ds = mapTTData.get(topic);\n // Update chart\n if (ds.data.length > 10) {\n ds.data.shift();\n }\n ds.data.push(value).toFixed(2);\n chartTT.update();\n}", "async function setNodewarTopic(message, topic) {\n console.log(\"Setting topic\")\n const conf = await DB.Connect(message.guild)\n .table(\"configuration\")\n .get(0)\n .run()\n const nodeWarChannel = message.member.guild.channels.find(\n \"name\",\n conf.nodeWarChannel\n )\n return nodeWarChannel.setTopic(topic)\n}", "function selectTopic() {\n\t//Topic is different than existing active topic\n\tif (selectedTopicID != $(this).val()) {\n\t\tif (selectedTopicID != null && selectedTopicID != \"\") {\n\t\t\tstopTimer();\n\t\t\tunsetActiveTopic();\n\t\t}\n\n\t\tselectedTopicID = $(this).val();\n\t\tstoreSelectedTopicID();\n\n\t\tsetActiveTopic();\n\t\tstartTimer();\n\n\t\tdocument.title = \"Work Log - \" + topicsDictionary[selectedTopicID].name;\n\t} else {\n\t\ttoggleTimer(!isWorkingOnTask);\n\t}\n\n\trenderEvents();\n\tstoreLocalStorage(eventsLogList, topicsDictionary, selectedTopicID);\n}", "function updateTopics(topics) {\n topics.forEach(function(d, i) { d.r = Math.max(12, r(d.count)); }); // min. collision\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n }", "get topic () {\n\t\treturn this._topic;\n\t}", "get topic () {\n\t\treturn this._topic;\n\t}", "update() {\n MessagingModule.updateMessage(this.conversation, this.uuid, this.text, this.payload);\n }", "onTopicClick(topic) {\n if (topic.rowid === this.currentTopic) {\n return;\n }\n\n this.currentTopic = topic.rowid;\n localStorage.setItem('currentTopic', this.currentTopic);\n this.loadSelections();\n }", "function updateTopics(topics) {\n topics.forEach(function(d, i) { d.r = Math.max(12, r(d.count)); }); // min. collision\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}" ]
[ "0.7262941", "0.6778754", "0.6123975", "0.6117092", "0.60513514", "0.6050638", "0.6042087", "0.6021171", "0.59397566", "0.5913625", "0.5878051", "0.58735174", "0.5779246", "0.5770122", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57410204", "0.560651", "0.5577939", "0.5511931", "0.5500691", "0.5500132", "0.54637045", "0.54538196", "0.5447298", "0.5425999", "0.542092", "0.5417563", "0.5417563", "0.54091877", "0.54064935", "0.53766227", "0.53624165", "0.53624165", "0.53624165", "0.53624165", "0.53624165", "0.53624165", "0.53624165", "0.53624165", "0.53624165", "0.53624165", "0.53624165", "0.53624165", "0.53624165" ]
0.68540275
27
Bind the arrow path elements with their associated topic.
function updateArrows() { arrow = arrow.data( data.topics.filter(function(d) { return d.arrow; }), function(d) { return this.id ? this.id.substring(8) : d.arrow; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "bindTopicToAction(topic, action) {\n\n const client = new PubkeeperClient({\n server: config.PK_SERVER,\n jwt: config.PK_JWT,\n brews: [\n new WebSocketBrew({\n brewerConfig: {\n hostname: config.PKWEBSOCKET_HOST,\n port: config.PKWEBSOCKET_PORT,\n secure: true,\n },\n }),\n ],\n });\n\n client.connect().then(() => {\n\n client.addPatron(topic, (patron) => {\n\n const handler = (rawData) => {\n const data = JSON.parse(new TextDecoder().decode(rawData))[0];\n this.dispatcher(action(data));\n };\n\n patron.on('message', handler);\n\n return () => {\n // deactivation/tear-down\n patron.off('message', handler);\n };\n });\n\n\n });\n }", "function initTopics() {\n nav\n .on(\"navigation:panClick\", function (e, direction) {\n topic.publish(EventManager.Navigation.PAN, {\n direction: direction\n });\n })\n .on(\"navigation:zoomClick\", function (e, in_out) {\n var newLvl = (in_out === \"zoomIn\") ? 1 : -1;\n topic.publish(EventManager.Navigation.ZOOM_STEP, {\n level: newLvl\n });\n })\n .on(\"navigation:zoomSliderChange\", function (e, newVal) {\n topic.publish(EventManager.Navigation.ZOOM, {\n level: newVal\n });\n })\n .on(\"navigation:fullExtentClick\", function () {\n topic.publish(EventManager.Navigation.FULL_EXTENT);\n });\n }", "initPathConnect() {\n\t\tthis.svgSelector.append('svg:g').append('svg:path')\n\t\t\t.attr('id', `${this.dummyPathId}`)\n\t\t\t.attr('class', 'dummy-edge solid')\n\t\t\t.attr('fill', 'none')\n\t\t\t.attr('marker-end', `url(#${this.arrowId})`)\n\t}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a.on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n }", "subscribe_( path, parsedPath ) {\n\n\t\t// returns an array of bindings for the given path that is changed\n\t\t// according to the contained objects in the group\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath;\n\t\tlet index = indicesByPath[ path ];\n\t\tconst bindings = this._bindings;\n\n\t\tif ( index !== undefined ) return bindings[ index ];\n\n\t\tconst paths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tobjects = this._objects,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_,\n\t\t\tbindingsForPath = new Array( nObjects );\n\n\t\tindex = bindings.length;\n\n\t\tindicesByPath[ path ] = index;\n\n\t\tpaths.push( path );\n\t\tparsedPaths.push( parsedPath );\n\t\tbindings.push( bindingsForPath );\n\n\t\tfor ( let i = nCachedObjects, n = objects.length; i !== n; ++ i ) {\n\n\t\t\tconst object = objects[ i ];\n\t\t\tbindingsForPath[ i ] = new PropertyBinding( object, path, parsedPath );\n\n\t\t}\n\n\t\treturn bindingsForPath;\n\n\t}", "addTopic(topic) {\n if(topic in this.listeners) return;\n var listener = new ROSLIB.Topic({\n ros : ros,\n name : topic,\n messageType : 'sensor_msgs/NavSatFix'\n });\n listener.color = this.COLORS[this.topicN++ % this.COLORS.length];\n this.listeners[topic] = listener;\n var that = this;\n listener.subscribe(function(message) {\n if(!message) return;\n if(!message.latitude || !message.longitude) return;\n var marker = L.circleMarker([message.latitude, message.longitude], { renderer: that.renderer, color: this.color, radius: 3 });\n marker.addTo(that.map);\n if(!(topic in that.markersByTopic)) {\n that.markersByTopic[topic] = [];\n }\n that.markersByTopic[topic].push(marker);\n while(that.markersByTopic[topic].length > 1024) {\n that.map.removeLayer(that.markersByTopic[topic][0]);\n that.markersByTopic[topic].shift();\n }\n that.lastMessage = message;\n });\n }", "bind(_topic) {\n return {\n subscriberId: this.phoneNumber,\n endpoint: this.phoneNumber,\n protocol: sns.SubscriptionProtocol.SMS,\n filterPolicy: this.props.filterPolicy,\n };\n }", "function linkTopic(a) {\n a .on(\"click\", click);\n //.on(\"mouseover\", mouseover)\n //.on(\"mouseout\", mouseout);\n}", "attachPathRemovalListeners() {\n\n // existing data fades away before removal when the skater direction changes\n this.skater.directionProperty.link( direction => {\n this.initiateSampleRemoval();\n } );\n\n // existing data is removed immediately when any of these Properties change\n const boundClearSamples = this.clearEnergyData.bind( this );\n Multilink.multilink( [ this.saveSamplesProperty, this.skater.draggingProperty, this.sceneProperty ], boundClearSamples );\n this.skater.returnedEmitter.addListener( boundClearSamples );\n this.trackChangedEmitter.addListener( boundClearSamples );\n }", "function moveToTopics(alpha) {\n return function (d) {\n var target = topicCenters[d.topic];\n d.x = d.x + (target.x - d.x) * damper * alpha * 1.1;\n d.y = d.y + (target.y - d.y) * damper * alpha * 1.1;\n };\n }", "_bindEvents () {\n this.channel.on('route', this.navigate)\n }", "_prependPathToReferences(path) {\n const elements = this._elementsWithExternalReferences;\n if (elements) {\n elements.forEach((attrs, element) => {\n attrs.forEach(attr => {\n element.setAttribute(attr.name, `url('${path}#${attr.value}')`);\n });\n });\n }\n }", "_prependPathToReferences(path) {\n const elements = this._elementsWithExternalReferences;\n if (elements) {\n elements.forEach((attrs, element) => {\n attrs.forEach(attr => {\n element.setAttribute(attr.name, `url('${path}#${attr.value}')`);\n });\n });\n }\n }", "function updateNodes() {\n node = node.data(data.topics, function(d) { return d.name; });\n\n node.exit().remove();\n\n node.enter().append(\"a\")\n .attr(\"class\", \"g-node\")\n .attr(\"xlink:href\", function(d) { return \"#\" + encodeURIComponent(d.name); })\n .call(force.drag)\n .call(linkTopic)\n .append(\"circle\");\n\n node.select(\"circle\")\n .attr(\"r\", function(d) { return r(d.count); });\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}" ]
[ "0.53744376", "0.5305825", "0.5139406", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.5022906", "0.5011586", "0.4990179", "0.49775308", "0.49768794", "0.49672967", "0.4885167", "0.4834449", "0.47945195", "0.47945195", "0.47434652", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917", "0.46951917" ]
0.65143627
28
Return a random sample of mentions per party, one per topic. Mentions are returned in chronological order.
function sampleMentions() { return data.parties.map(function(party, i) { return data.topics .map(function(d) { return d.parties[i].mentions; }) .filter(function(d) { return d.length; }) .map(function(d) { return d[Math.floor(Math.random() * d.length)]; }) .sort(orderMentions); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sampleMentions() {\n return data.topics\n .filter(function(d) { return d.mentions.length; })\n .map(function(d) { return d.mentions[Math.floor(Math.random() * d.mentions.length)]; })\n .sort(orderMentions);\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n var mentions = topic.mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n }\n return mentions;\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function getRandomMemes() {\r\n const randomMemesUrl = [];\r\n bulkImageUrls.map((imageUrl) => {\r\n randomMemesUrl.push(imageUrl.example);\r\n });\r\n // console.log(randomMemesUrl);\r\n\r\n const randomNumber = Math.floor(Math.random() * randomMemesUrl.length);\r\n return randomMemesUrl[randomNumber];\r\n }", "getRandomPhrase() {\n var randomNumber = Math.floor(Math.random() * 5);\n return this.phrases[randomNumber]\n }", "getRandomPhrase() {\n let randomNumber = Math.floor(Math.random() * 5);\n return this.phrases[randomNumber];\n }", "function generateTopic(room) {\n const list = gameTopics.getTopics();\n const index = mathUtil.getRandomInt(0, list.length);\n room.topic = list[index];\n return room;\n}", "getRandomPhrase() {\n const randNum = Math.floor(Math.random() * Math.floor(5));\n const randomPhrase = this.phrases[randNum];\n return randomPhrase;\n }", "async getRandomPersons(number = 6, mattMode = false) {\n if (this.peopleCache.length < 1) await this.refreshPeopleCache();\n\n const peopleArray = await this.doMattMode(mattMode);\n\n const personCount = peopleArray.length;\n\n if (personCount <= number)\n throw new Error(\n \"PeopleManager: There are fewer (or equal) number of people in the cache than what was requested! Either hire more people or request a lower amount.\"\n );\n let result = [];\n while (result.length < number) {\n // generate random numbers, and push people into our array until we have enough\n // this could get really inefficient if we were always getting close to the number of total people in the DB\n const index = Math.floor(Math.random() * personCount);\n\n const someone = peopleArray[index];\n if (!result.includes(someone)) {\n result.push(someone);\n }\n }\n return result;\n }", "getRandomPhrase() {\n let randomOneToFive = Math.floor(Math.random() * 5);\n return this.phrases[randomOneToFive];\n }", "getRandomPhrase() {\n const randomNumber = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomNumber];\n }", "getRandomPhrase() {\n const randomNumber = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomNumber];\n }", "getRandomPhrase() {\n const randomNumber = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomNumber];\n }", "function randomMemes() {\n\treturn memes[Math.floor(Math.random() * memes.length)];\n}" ]
[ "0.8132888", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.70380515", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5780876", "0.5528284", "0.54189646", "0.5389368", "0.5317498", "0.53137416", "0.530492", "0.52684236", "0.5253769", "0.5253769", "0.5253769", "0.5221309" ]
0.8405532
28
Return displayable mentions per party for the specified topic. If too many, a random sample of matching mentions is returned. Mentions are returned in chronological order.
function findMentions(topic) { return data.parties.map(function(party, i) { var mentions = topic.parties[i].mentions; if (mentions.length > maxMentions) { shuffle(mentions).length = maxMentions; mentions.sort(orderMentions); mentions.truncated = true; } return mentions; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findMentions(topic) {\n var mentions = topic.mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n }\n return mentions;\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topics\n .map(function(d) { return d.parties[i].mentions; })\n .filter(function(d) { return d.length; })\n .map(function(d) { return d[Math.floor(Math.random() * d.length)]; })\n .sort(orderMentions);\n });\n}", "function sampleMentions() {\n return data.topics\n .filter(function(d) { return d.mentions.length; })\n .map(function(d) { return d.mentions[Math.floor(Math.random() * d.mentions.length)]; })\n .sort(orderMentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "getMentions(hashtag) {\n return this.twitter.getMentions()\n .then((mentions) => {\n // filter by favorited flag/hashtag\n return _.filter(mentions, (m) => {\n return !m.favorited && m.text.includes(hashtag);\n });\n });\n }", "replyToMentions(hashtag) {\n return this.getMentions(hashtag)\n .then((mentions) => {\n // debug console.log('Filtered mentions:', mentions);\n return Promise.all(_.map(mentions, (t) => {\n return this.reply(t);\n }));\n });\n }", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}" ]
[ "0.774369", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.6960102", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.56994593", "0.5661201", "0.56030005", "0.5309747", "0.5309747", "0.5309747", "0.5309747", "0.5309747", "0.5309747", "0.5309747", "0.5309747", "0.5309747" ]
0.8250053
28
Group mentions by speaker, collapse overlapping excerpts.
function groupMentionsBySpeaker(mentions) { return d3.nest() .key(function(d) { return d.section.speaker; }) .rollup(collapseMentions) .entries(mentions); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function groupRecipients (recipients) {\n return _.groupBy(recipients, (recipient) => {\n return recipient.isNew ? 'new-appointment' : 'appointment-reminder'\n })\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i) {\n var mentions = topic.parties[i].mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n mentions.truncated = true;\n }\n return mentions;\n });\n}", "function groupWordsInTheirSentence(stream) {\n let prevParagraph = 1; // init at first to avoid emit of empty first sentence\n let prevSentence = 1;\n let sentence = [];\n return stream\n .map(({ key, value }) => {\n // `${keyPrefix}\\x00${pad(paragraphNumber)}\\x00${pad(sentenceNumber)}\\x00${pad(wordNumber)}`\n const [, paragraphNumber, sentenceNumber, wordNumber] = key.split('\\x00');\n return {\n paragraphNumber: parseInt(paragraphNumber, 10),\n sentenceNumber: parseInt(sentenceNumber, 10),\n wordNumber: parseInt(wordNumber, 10),\n word: value,\n };\n })\n .consume((err, x, push, next) => {\n if (err) {\n push(err);\n next();\n } else if (x === _.nil) {\n push(null, sentence);\n push(null, x);\n } else {\n const { paragraphNumber, sentenceNumber } = x;\n // there could be two paragraphs with one sentence\n if (prevSentence === sentenceNumber && prevParagraph === paragraphNumber) {\n sentence.push(x);\n } else {\n push(null, sentence);\n sentence = [x];\n }\n prevSentence = sentenceNumber;\n prevParagraph = paragraphNumber;\n next();\n }\n });\n}", "function _meetupTitleFromPresentations(presentations) {\n let titles = presentations.rejectBy('isLightningTalk', true);\n titles = titles.map((presentation) => {\n let speakerName = presentation.get('speaker.fullName');\n let presentationName = presentation.get('title');\n\n return `\"${presentationName}\" by ${speakerName}`;\n });\n\n return titles.join(' and ');\n}", "function consolidate(entries) {\n var note = {}; \n entries.forEach(function(entry) {\n if(!note[entry.note_id])\n note[entry.note_id] = {}; \n \n note[entry.note_id]['note_id'] = entry.note_id;\n note[entry.note_id]['user'] = entry.user;\n note[entry.note_id]['subject'] = entry.subject;\n \n if(!note[entry.note_id]['receipent_mail'])\n note[entry.note_id]['receipent_mail'] = new Array();\n if(!note[entry.note_id]['receipent_ph_num'])\n note[entry.note_id]['receipent_ph_num'] = new Array();\n if(!note[entry.note_id]['actions'])\n note[entry.note_id]['actions'] = new Array();\n \n var split = entry.receipents.split(\", \");\n for(var index in split) {\n var s = split[index];\n if(is_mail(s) && note[entry.note_id]['receipent_mail'].indexOf(s) < 0)\n note[entry.note_id]['receipent_mail'].push(s);\n if(is_ph_num(s) && note[entry.note_id]['receipent_ph_num'].indexOf(s) < 0)\n note[entry.note_id]['receipent_ph_num'].push(s);\n } \n \n var asplit = entry.actions.split(\", \");\n for(var index in asplit) {\n var a = asplit[index];\n var a_dash = \"-\"+a;\n var cancel = false;\n if(a.indexOf(\"-\") == 0){\n a_dash = a.substring(1);\n cancel = true;\n }\n var index = note[entry.note_id]['actions'].indexOf(a_dash);\n if(index < 0) {\n if(note[entry.note_id]['actions'].indexOf(a) < 0)\n note[entry.note_id]['actions'].push(a);\n } else {\n note[entry.note_id]['actions'].splice(index, 1);\n }\n } \n \n if(!note[entry.note_id]['creation_epoch'])\n note[entry.note_id]['creation_epoch'] = {}; \n \n note[entry.note_id]['creation_epoch'][entry.creation_epoch] = {}; \n note[entry.note_id]['creation_epoch'][entry.creation_epoch]['body'] = entry.body;\n note[entry.note_id]['creation_epoch'][entry.creation_epoch]['cron'] = entry.exec_cron;\n });\n return note;\n}", "function groupBy(group_by, words, limit, multiple) {\n\n // Find out what groupings are involved using these parts of speech\n var groupings = {};\n words.forEach(function(currVal, currIndex, listObj) {\n // Get the word itself\n var word = currVal.innerHTML.trim();\n\n // Get the grouping described in the metadata for this word\n var texthead = currVal.parentNode.previousElementSibling; \n var meta_grouping = texthead.querySelector(\"[metaclass=\\\"\"+groupings_metaclass[group_by]+\"\\\"]\");\n var grouping = \"\";\n if (meta_grouping != null) grouping = meta_grouping.innerHTML.split(\":\")[1].trim();\n\n // If there are multiple parts to this grouping criterion, separated by commas,\n // split them up and iterate over them\n if (multiple) {\n parts = grouping.split(\",\");\n for (var i = 0; i < parts.length; i++) {\n groupings = countFreqForWord(word, groupings, parts[i]);\n }\n } else {\n groupings = countFreqForWord(word, groupings, grouping);\n }\n\n });\n\n // Sort descending by the groupings with the most words\n var groupingsSorted = Object.keys(groupings).sort(function(a, b) {return -(groupings[a].sit_count - groupings[b].sit_count);});\n \n var group_html = \"\";\n for (var i = 0; i < groupingsSorted.length; i++) { \n var grouping = groupingsSorted[i];\n group_html += \"<h3>\"+grouping+\" (\"+groupings[grouping].sit_count+\" matches)\"+\"</h3><br>\" \n var freq_list_i = buildFreqList(groupings[grouping].freq_dict,\n groupings[grouping].sit_count,\n limit);\n group_html += freq_list_i;\n group_html += \"<br>\"; \n };\n\n return group_html;\n}", "function sanitizeGroups() {\n const sanitizedGroups = [];\n noteGroups.forEach(group => {\n let tempGroup = [];\n group.forEach((note, index, group) => {\n const isFirstOrLast = index === 0 || index === group.length - 1;\n const prevNote = group[index - 1];\n\n const breaksOnEachRest = !config.beam_rests && note.isRest();\n const breaksOnFirstOrLastRest = (config.beam_rests &&\n config.beam_middle_only && note.isRest() && isFirstOrLast);\n\n let breakOnStemChange = false;\n if (config.maintain_stem_directions && prevNote &&\n !note.isRest() && !prevNote.isRest()) {\n const prevDirection = prevNote.getStemDirection();\n const currentDirection = note.getStemDirection();\n breakOnStemChange = currentDirection !== prevDirection;\n }\n\n const isUnbeamableDuration = parseInt(note.duration, 10) < 8;\n\n // Determine if the group should be broken at this note\n const shouldBreak = breaksOnEachRest || breaksOnFirstOrLastRest ||\n breakOnStemChange || isUnbeamableDuration;\n\n if (shouldBreak) {\n // Add current group\n if (tempGroup.length > 0) {\n sanitizedGroups.push(tempGroup);\n }\n\n // Start a new group. Include the current note if the group\n // was broken up by stem direction, as that note needs to start\n // the next group of notes\n tempGroup = breakOnStemChange ? [note] : [];\n } else {\n // Add note to group\n tempGroup.push(note);\n }\n });\n\n // If there is a remaining group, add it as well\n if (tempGroup.length > 0) {\n sanitizedGroups.push(tempGroup);\n }\n });\n\n noteGroups = sanitizedGroups;\n }", "function augumentGroupConversation(conversation) {\n conversation.nextMessage = \"\";\n }", "function formatAllTalks (talks) {\n var tmpl = $('#summary-div .summary');\n var dest = $('<ul>'); // lists are a bit more accessible\n talks = talks.slice(0,5); // subset for debugging\n for( var i=0; i < talks.length; i++ ) {\n talk = talks[i];\n console.log(i+\": \"+talk.title);\n var clone = tmpl.clone();\n // insert data\n clone.find(\".index\").text(i+1);\n clone.find(\".title\").html(talk.title);\n clone.find(\".authors\").html(\"\");\n addAuthors(clone.find(\".authors\"), talk.presenters);\n clone.find(\".start\").text(talk.start_time);\n clone.find(\".location\").text(talk.location);\n clone.find(\".abstract\").html(talk.description).hide();\n // finishing up\n dest.append(clone);\n // debug\n // console.log(clone.attr(\"data-scott\"));\n }\n $('#summaries').append(dest);\n}", "function problem6() {\n\n var groupedByFirstName = group(generatePeople(6, problem6), 'firstname'),\n groupedByLastName = group(generatePeople(6, problem6), 'lastname'),\n groupedByAge = group(generatePeople(6, problem6), 'age'),\n resultConsole = '',\n resultHTML = '',\n prop;\n\n resultConsole += '\\nGrouped by first name:\\n\\n';\n resultHTML += '<br />Grouped by first name:<br /><br />';\n for (prop in groupedByFirstName) {\n resultConsole += (prop + ': ' + printArrayOfObjects(groupedByFirstName[prop], 'console'));\n resultHTML += (prop + ': ' + printArrayOfObjects(groupedByFirstName[prop], 'html'));\n }\n resultConsole += '\\nGrouped by last name:\\n\\n';\n resultHTML += '<br />Grouped by last name:<br /><br />';\n for (prop in groupedByLastName) {\n resultConsole += (prop + ': ' + printArrayOfObjects(groupedByLastName[prop], 'console'));\n resultHTML += (prop + ': ' + printArrayOfObjects(groupedByLastName[prop], 'HTML'));\n }\n resultConsole += '\\nGrouped by age:\\n\\n';\n resultHTML += '<br />Grouped by age:<br /><br />';\n for (prop in groupedByAge) {\n resultConsole += (prop + ': ' + printArrayOfObjects(groupedByAge[prop], 'console'));\n resultHTML += (prop + ': ' + printArrayOfObjects(groupedByAge[prop], 'HTML'));\n }\n console.log(resultConsole);\n document.getElementById('pr6answer').innerHTML = 'Result:' + resultHTML;\n document.getElementById('second-button6').removeEventListener('click', problem6);\n}", "function ParsedNoteSection (props) {\n let { classes, onAddSuggestion, tooltips, text, offset } = props;\n let hasMatch = tooltips.length > 0;\n let frontMatter = text;\n if (hasMatch) {\n var matches = tooltips.sort( (e1, e2) => (e1.start-e2.start) );\n var firstMatch = matches[0];\n // The front matter is the text before the first match begins\n frontMatter = text.substring(0, firstMatch.start-offset);\n var matchID = firstMatch[ONTOLOGY_KEY]; // TODO: Handle more than just HPO\n var matchName = firstMatch[\"names\"][0];\n\n // The contained matter is the text inside the first match\n var containedMatches = matches.filter( (el) => (\n el.start >= firstMatch.start && el.end <= firstMatch.end && !(el.start == firstMatch.start && el.end == firstMatch.end)\n ));\n var containedMatter = text.substring(firstMatch.start-offset, firstMatch.end-offset);\n\n // The uncontained matter is the text after the first match, up until the end of the last match\n // (It still needs to be parsed for more notes)\n var uncontainedMatches = matches.filter( (el) => (el.end > firstMatch.end));\n var lastMatch = Math.max(...(tooltips.map((el) => (el.end))));\n var middleMatter = text.substring(firstMatch.end-offset, lastMatch-offset);\n\n // The end matter is the text after the last match\n var endMatter = text.substring(lastMatch-offset);\n }\n\n // Handle the user clicking on a chip which corresponds to a suggestion\n let addSuggestion = (event) => {\n event.preventDefault();\n onAddSuggestion(firstMatch[ONTOLOGY_KEY].replace(/:/g, \"\"), firstMatch[\"names\"][0])\n }\n\n return (<React.Fragment>\n <Typography display=\"inline\">{frontMatter}</Typography>\n {hasMatch &&\n <React.Fragment>\n <Tooltip title={`Add ${matchName} (${matchID}) to selection`}>\n <Chip\n size=\"small\"\n onClick={addSuggestion}\n color=\"info\"\n label={\n <ParsedNoteSection\n tooltips={containedMatches}\n text={containedMatter}\n offset={firstMatch.start}\n classes={classes}\n onAddSuggestion={onAddSuggestion}\n />\n }\n />\n </Tooltip>\n <ParsedNoteSection\n tooltips={uncontainedMatches}\n text={middleMatter}\n offset={firstMatch.end}\n classes={classes}\n onAddSuggestion={onAddSuggestion}\n />\n <Typography display=\"inline\">{endMatter}</Typography>\n </React.Fragment>}\n </React.Fragment>)\n}", "function sectionsCollapser(sections) {\n const collapsed = [...sections.reduce((result, section) => {\n const key = `${section.key}-${section.mode}-${section.timeSignature}`\n const value = result.get(key) || Object.assign({}, section, { duration: 0 })\n value.duration += section.duration\n return result.set(key, value)\n }, new Map).values()]\n return collapsed\n}", "function findMentions(topic) {\n var mentions = topic.mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n }\n return mentions;\n}" ]
[ "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.5463319", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.51037484", "0.5004414", "0.49067548", "0.4823099", "0.48176312", "0.4783049", "0.4775691", "0.46653038", "0.46315497", "0.4621677", "0.46107614", "0.45597115" ]
0.7465256
28
Given an array of mentions, computes the start and end point of the context excerpt, and then collapses any overlapping excerpts.
function collapseMentions(mentions) { var sentenceRe = /([!?.)]+)\s+/g, // sentence splitting requires NLP i, n = mentions.length, d0, d1; // First compute the excerpt contexts. for (i = 0; i < n; ++i) { d0 = mentions[i]; d0.start = excerptStart(d0); d0.end = excerptEnd(d0); } // Then collapse any overlapping excerpts (from the same speech). for (i = 1, d1 = mentions[0]; i < n; ++i) { d0 = d1; d1 = mentions[i]; if (d1.section.speech.id === d0.section.speech.id && d1.start >= d0.start && d1.start < d0.end) { d1.start = -1; d0.end = d1.end; d1 = d0; } } // Returns the start index of the excerpt for the specified mention. function excerptStart(mention) { var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match; while (match = sentenceRe.exec(mention.section.speech.text)) { if (match.index < mention.i - 20) return match.index + match[0].length; if (i <= mention.section.i) break; sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20); } return mention.section.i; } // Returns the end index of the excerpt for the specified mention. function excerptEnd(mention) { var i = mention.section.j, match; sentenceRe.lastIndex = mention.j + 40; match = sentenceRe.exec(mention.section.speech.text); return match ? Math.min(match.index + match[1].length, i) : i; } return mentions.filter(function(d) { return d.start >= 0; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_applyEllipses(start, end) {\n if (this.ellipses) {\n if (start > 0) {\n // The first page will always be included. If the displayed range\n // starts after the third page, then add ellipsis. But if the range\n // starts on the third page, then add the second page instead of\n // an ellipsis, because the ellipsis would only hide a single page.\n if (start > 2) {\n this.pages.unshift(-1);\n }\n else if (start === 2) {\n this.pages.unshift(2);\n }\n this.pages.unshift(1);\n }\n if (end < this.pageCount) {\n // The last page will always be included. If the displayed range\n // ends before the third-last page, then add ellipsis. But if the range\n // ends on third-last page, then add the second-last page instead of\n // an ellipsis, because the ellipsis would only hide a single page.\n if (end < (this.pageCount - 2)) {\n this.pages.push(-1);\n }\n else if (end === (this.pageCount - 2)) {\n this.pages.push(this.pageCount - 1);\n }\n this.pages.push(this.pageCount);\n }\n }\n }", "@computed\n get textIntersections() {\n if (this.annotations.length == 0) {\n return [];\n }\n // split annotation in parts to create spans\n\n const offsets = {};\n\n // helper functions\n const addOffset = (start, end, annotations) => {\n if (offsets[`${start}-${end}`] == undefined) {\n offsets[`${start}-${end}`] = {\n startOffset: start,\n endOffset: end,\n annotations: annotations,\n };\n } else {\n for (const annotation of annotations) {\n if (!includes(offsets[`${start}-${end}`].annotations, annotation)) {\n offsets[`${start}-${end}`].annotations.push(annotation);\n }\n }\n }\n };\n\n const intersects = (x1, x2, y1, y2) => x2 > y1 && y2 > x1;\n\n // go through the annotation and split them\n const annotationCount = this.annotations.length;\n\n for (let i = 0; i < annotationCount; i++) {\n const annotation = this.annotations[i];\n let hasIntersections = false;\n let lastMiddleOffset = undefined;\n\n if (!isEmpty(offsets)) {\n // offset exists\n map(\n orderBy(\n values(offsets),\n ['startOffset', 'endOffset'],\n ['asc', 'desc'],\n ),\n offset => {\n if (\n intersects(\n annotation.startOffset,\n annotation.endOffset,\n offset.startOffset,\n offset.endOffset - 1,\n )\n ) {\n if (!hasIntersections) {\n hasIntersections = true;\n }\n\n // found intersection\n const startOffset = annotation.startOffset - offset.startOffset;\n const endOffset = annotation.endOffset - offset.endOffset;\n const offsetAnnotations = offset.annotations;\n\n // front part\n\n if (startOffset > 0) {\n addOffset(\n offset.startOffset,\n annotation.startOffset,\n offsetAnnotations,\n );\n } else if (\n startOffset < 0 &&\n lastMiddleOffset < annotation.startOffset // dont add thing that there before\n ) {\n addOffset(annotation.startOffset, offset.startOffset, [\n annotation.id,\n ]);\n }\n\n // middle part\n\n addOffset(\n Math.max(annotation.startOffset, offset.startOffset),\n Math.min(annotation.endOffset, offset.endOffset),\n offsetAnnotations.concat(annotation.id),\n );\n\n lastMiddleOffset = Math.min(\n annotation.endOffset,\n offset.endOffset,\n );\n\n // back part\n\n if (endOffset > 0) {\n addOffset(offset.endOffset, annotation.endOffset, [\n annotation.id,\n ]);\n } else if (endOffset < 0) {\n addOffset(\n annotation.endOffset,\n offset.endOffset,\n offsetAnnotations,\n );\n }\n\n // delete pre existing offset if not in there\n if (\n (startOffset != 0 || endOffset != 0) &&\n offsets[\n `${offset.startOffset}-${offset.endOffset}`\n ].annotations.find(d => {\n return d == annotation.id;\n }) == undefined\n ) {\n delete offsets[`${offset.startOffset}-${offset.endOffset}`];\n }\n }\n },\n );\n } else {\n // offset is empty > init\n addOffset(annotation.startOffset, annotation.endOffset, [\n annotation.id,\n ]);\n }\n // no intersections found\n if (!hasIntersections) {\n // didn't found intersection\n addOffset(annotation.startOffset, annotation.endOffset, [\n annotation.id,\n ]);\n }\n }\n return orderBy(values(offsets), ['startOffset'], 'asc');\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "decorations(node, decorations) {\n var leaves = [_objectSpread$4({}, node)];\n\n for (var dec of decorations) {\n var rest = _objectWithoutProperties(dec, [\"anchor\", \"focus\"]);\n\n var [start, end] = Range.edges(dec);\n var next = [];\n var o = 0;\n\n for (var leaf of leaves) {\n var {\n length\n } = leaf.text;\n var offset = o;\n o += length; // If the range encompases the entire leaf, add the range.\n\n if (start.offset <= offset && end.offset >= offset + length) {\n Object.assign(leaf, rest);\n next.push(leaf);\n continue;\n } // If the range starts after the leaf, or ends before it, continue.\n\n\n if (start.offset > offset + length || end.offset < offset || end.offset === offset && offset !== 0) {\n next.push(leaf);\n continue;\n } // Otherwise we need to split the leaf, at the start, end, or both,\n // and add the range to the middle intersecting section. Do the end\n // split first since we don't need to update the offset that way.\n\n\n var middle = leaf;\n var before = void 0;\n var after = void 0;\n\n if (end.offset < offset + length) {\n var off = end.offset - offset;\n after = _objectSpread$4({}, middle, {\n text: middle.text.slice(off)\n });\n middle = _objectSpread$4({}, middle, {\n text: middle.text.slice(0, off)\n });\n }\n\n if (start.offset > offset) {\n var _off = start.offset - offset;\n\n before = _objectSpread$4({}, middle, {\n text: middle.text.slice(0, _off)\n });\n middle = _objectSpread$4({}, middle, {\n text: middle.text.slice(_off)\n });\n }\n\n Object.assign(middle, rest);\n\n if (before) {\n next.push(before);\n }\n\n next.push(middle);\n\n if (after) {\n next.push(after);\n }\n }\n\n leaves = next;\n }\n\n return leaves;\n }", "function aggregatePatchSuggestions(patch_suggestions, num_votes, sentences, minimum_agreement_percentage) {\r\n\tvar open = [];\r\n\tvar start = null, end = null;\r\n\tvar patches = [];\r\n\t\r\n\tvar minimum_agreement = Math.max(1, Math.ceil(num_votes * minimum_agreement_percentage));\r\n\t\r\n\tfor (var i=0; i<=getParagraph(sentences).length; i++) {\r\n\t\tfor (var j=0; j<patch_suggestions.length; j++) {\r\n\t\t\tif (i == patch_suggestions[j].start) {\r\n\t\t\t\topen.push(patch_suggestions[j]);\r\n\t\t\t\tif (open.length == minimum_agreement && start == null) {\r\n\t\t\t\t\tstart = open[0].start;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (i == patch_suggestions[j].end) {\r\n\t\t\t\topen.splice(open.indexOf(open[j]), 1);\r\n\t\t\t\tif (open.length == 0 && start != null) {\r\n\t\t\t\t\tend = i;\r\n\t\t\t\t\tpatches.push(new Patch(start, end, sentences));\r\n\t\t\t\t\tstart = end = null;\r\n\t\t\t\t}\r\n\t\t\t}\t\t\t\r\n\t\t}\r\n\t}\r\n\treturn patches;\r\n}", "decorations(node, decorations) {\n var leaves = [_objectSpread$4({}, node)];\n\n for (var dec of decorations) {\n var rest = _objectWithoutProperties(dec, _excluded2$1);\n\n var [start, end] = Range.edges(dec);\n var next = [];\n var o = 0;\n\n for (var leaf of leaves) {\n var {\n length\n } = leaf.text;\n var offset = o;\n o += length; // If the range encompases the entire leaf, add the range.\n\n if (start.offset <= offset && end.offset >= o) {\n Object.assign(leaf, rest);\n next.push(leaf);\n continue;\n } // If the range expanded and match the leaf, or starts after, or ends before it, continue.\n\n\n if (start.offset !== end.offset && (start.offset === o || end.offset === offset) || start.offset > o || end.offset < offset || end.offset === offset && offset !== 0) {\n next.push(leaf);\n continue;\n } // Otherwise we need to split the leaf, at the start, end, or both,\n // and add the range to the middle intersecting section. Do the end\n // split first since we don't need to update the offset that way.\n\n\n var middle = leaf;\n var before = void 0;\n var after = void 0;\n\n if (end.offset < o) {\n var off = end.offset - offset;\n after = _objectSpread$4(_objectSpread$4({}, middle), {}, {\n text: middle.text.slice(off)\n });\n middle = _objectSpread$4(_objectSpread$4({}, middle), {}, {\n text: middle.text.slice(0, off)\n });\n }\n\n if (start.offset > offset) {\n var _off = start.offset - offset;\n\n before = _objectSpread$4(_objectSpread$4({}, middle), {}, {\n text: middle.text.slice(0, _off)\n });\n middle = _objectSpread$4(_objectSpread$4({}, middle), {}, {\n text: middle.text.slice(_off)\n });\n }\n\n Object.assign(middle, rest);\n\n if (before) {\n next.push(before);\n }\n\n next.push(middle);\n\n if (after) {\n next.push(after);\n }\n }\n\n leaves = next;\n }\n\n return leaves;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "ranges(words, history, custom = () => {}) {\n // [[start, end, type], ...]\n let ranges = words.map((w, n) => w.ranges(this.toString()).map(r => [...r, n])).flat().sort((a, b) => {\n return a[0] - b[0];\n });\n // remove conflicts\n let offset = 0;\n ranges.forEach((range, m) => {\n ranges[m][0] = Math.max(range[0], offset);\n offset = Math.max(range[1] + 1, offset);\n });\n // remove empty ranges\n ranges = ranges.filter(r => r[1] >= r[0]);\n\n // extract text nodes\n const content = this.toString();\n\n const doc = this.e.ownerDocument;\n const walk = doc.createTreeWalker(this.e, NodeFilter.SHOW_TEXT, {\n acceptNode: () => {\n return NodeFilter.FILTER_ACCEPT;\n }\n }, false);\n let t;\n let position = -1;\n let ch;\n const update = () => {\n position += 1;\n if (position === content.length) {\n return false;\n }\n ch = content[position];\n };\n update();\n let range = ranges.shift();\n let e = doc.createRange();\n\n const track = () => {\n const out = [];\n\n while (t = walk.nextNode()) {\n const ignore = history.has(t);\n\n history.add(t);\n const data = t.data.replace(/[\\n\\t]/g, ' ');\n\n for (let x = 0; x < data.length; x += 1) {\n if (data[x] === ch) {\n if (range[0] === position) {\n e.setStart(t, x);\n }\n if (range[1] === position) {\n e.setEnd(t, x + 1);\n if (ignore === false) {\n custom(e, this.words[range[2]]);\n out.push(e);\n }\n\n range = ranges.shift();\n\n if (!range) {\n return out;\n }\n e = doc.createRange();\n }\n if (update() === false) {\n throw Error('position reached');\n }\n }\n }\n }\n throw Error('end of stream');\n };\n\n return track();\n }", "function fixEditAreas(outputPatch, patch) {\r\n var fieldEditingText = getEditedTextOptions(outputPatch);\r\n \r\n var previousSentences = patch.sentences.slice(0, patch.sentenceRange().startSentence);\r\n previousSentences.push(\"\"); // to simulate the sentence that we're starting\r\n var editOffset = previousSentences.join(sentence_separator).length;\r\n if (fieldEditingText.alternatives.length > 0) {\r\n fieldEditingText.alternatives.sort( function(a, b) { return a.editStart - b.editStart; } ); // ascending by location of first edit\r\n outputPatch.editStart = fieldEditingText.alternatives[0].editStart;\r\n fieldEditingText.alternatives.sort( function(a, b) { return b.editEnd - a.editEnd; } ); // descending by location of last edit\r\n outputPatch.editEnd = fieldEditingText.alternatives[0].editEnd;\r\n \r\n // For each option we need to edit it back down to just the changed portion, removing the extraenous parts of the sentence\r\n // e.g., we need to prune to just [patch.editStart, patch.editEnd] \r\n var dmp = new diff_match_patch();\r\n for (var i=0; i<fieldEditingText.alternatives.length; i++) {\r\n // To remove the extraneous parts of the text, we turn the first and last elements of the diff\r\n // (the prefix and postfix) into deletions\r\n var diff_cut = prune(fieldEditingText.alternatives[i].diff, 1000000); // copy it very deep\r\n \r\n // First we remove the unnecessary parts of the prefix from the text, keeping only what everybody has edited\r\n if (diff_cut[0][0] == 0) {\r\n var startOffset = outputPatch.editStart - editOffset;\r\n var prefixCut = diff_cut[0][1].substring(0, startOffset);\r\n var prefixKeep = diff_cut[0][1].substring(startOffset);\r\n var cutStartDiffElement = [-1, prefixCut]; // -1 == delete\r\n var keepStartDiffElement = [0, prefixKeep]; // 0 == keep\r\n diff_cut.splice(0, 1, cutStartDiffElement, keepStartDiffElement); // remove the original first element and replace it with our cut and keep\r\n }\r\n \r\n // Now we do the same with the end\r\n if (diff_cut[diff_cut.length-1][0] == 0) {\r\n var endLength = patch.sentences.slice(0, patch.sentenceRange().endSentence+1).join(sentence_separator).substring(outputPatch.editEnd).length;\r\n var postfixString = diff_cut[diff_cut.length-1][1];\r\n var postfixKeep = postfixString.substring(0, postfixString.length - endLength);\r\n var postfixCut = diff_cut[diff_cut.length-1][1].substring(postfixString.length - endLength);\r\n keepEndDiffElement = [0, postfixKeep]; // 0 == keep\r\n cutEndDiffElement = [-1, postfixCut]; // -1 == delete\r\n diff_cut.splice(diff_cut.length-1, 1, keepEndDiffElement, cutEndDiffElement); // remove the original first element and replace it with our cut and keep \r\n }\r\n \r\n var editedText = dmp.patch_apply(dmp.patch_make(diff_cut), patch.plaintextSentence())[0];\r\n fieldEditingText.alternatives[i].editedText = editedText;\r\n }\r\n }\r\n \r\n outputPatch.originalText = outputPatch.originalText.substring(outputPatch.editStart - editOffset, outputPatch.editEnd - editOffset);\r\n \r\n // return to original sort order\r\n fieldEditingText.alternatives.sort( function(a, b) { return a.start - b.start; } );\r\n}", "function spreadOut() {\n let fragment = ['to', 'code'];\n let sentence = ['learning', ...fragment, 'is', 'fun'] // change this line\n return sentence;\n }", "before(editor, at) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var anchor = Editor.start(editor, []);\n var focus = Editor.point(editor, at, {\n edge: 'start'\n });\n var range = {\n anchor,\n focus\n };\n var {\n distance = 1\n } = options;\n var d = 0;\n var target;\n\n for (var p of Editor.positions(editor, _objectSpread({}, options, {\n at: range,\n reverse: true\n }))) {\n if (d > distance) {\n break;\n }\n\n if (d !== 0) {\n target = p;\n }\n\n d++;\n }\n\n return target;\n }", "before(editor, at) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var anchor = Editor.start(editor, []);\n var focus = Editor.point(editor, at, {\n edge: 'start'\n });\n var range = {\n anchor,\n focus\n };\n var {\n distance = 1\n } = options;\n var d = 0;\n var target;\n\n for (var p of Editor.positions(editor, _objectSpread$8(_objectSpread$8({}, options), {}, {\n at: range,\n reverse: true\n }))) {\n if (d > distance) {\n break;\n }\n\n if (d !== 0) {\n target = p;\n }\n\n d++;\n }\n\n return target;\n }", "function findOverlapsAndMerge(patches, paragraph_index) {\r\n print('merging...')\r\n patches.sort( function(a, b) { return a.editStart - b.editStart; } );\r\n var mergedPatches = new Array();\r\n \r\n var openPatch = 0;\r\n var openIndex = patches[0].editStart;\r\n var closeIndex = patches[0].editEnd;\r\n for (var i=0; i<patches.length; i++) {\r\n if (closeIndex < patches[i].editStart) { // if we start a new region\r\n var mergedPatch = mergePatches(patches, openPatch, i-1, paragraph_index);\r\n mergedPatches.push(mergedPatch);\r\n openPatch = i;\r\n openIndex = patches[i].editStart;\r\n closeIndex = patches[i].editEnd;\r\n } else { // we need to mark this one as mergeable; it starts before the closeindex\r\n closeIndex = Math.max(closeIndex, patches[i].editEnd);\r\n }\r\n }\r\n // merge final open patch\r\n var mergedPatch = mergePatches(patches, openPatch, patches.length-1, paragraph_index);\r\n mergedPatches.push(mergedPatch); \r\n \r\n return mergedPatches;\r\n}" ]
[ "0.5495962", "0.5235811", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.51254964", "0.50941044", "0.5085702", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.4764202", "0.47036433", "0.46691132", "0.4628994", "0.46227968", "0.46201283", "0.4603504" ]
0.68123806
29
Returns the start index of the excerpt for the specified mention.
function excerptStart(mention) { var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match; while (match = sentenceRe.exec(mention.section.speech.text)) { if (match.index < mention.i - 20) return match.index + match[0].length; if (i <= mention.section.i) break; sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20); } return mention.section.i; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "getIndex() {\n\t\t\tconst {overrides} = this.impl;\n\t\t\tif (overrides !== undefined) {\n\t\t\t\treturn overrides.getIndex(this);\n\t\t\t}\n\n\t\t\treturn this.currentToken.start;\n\t\t}", "function get_index_to_start_from() {\n var all_present_inlines = this.$('#inline_body tr').not(\".form_error\");\n if (!all_present_inlines.length)\n return 0\n var max_index = $(_.last(all_present_inlines)).attr(\"index\");\n return parseInt(max_index) + 1;\n }", "function mention(value, fromIndex) {\n var index = value.indexOf('@', fromIndex)\n\n if (index !== -1 && repo(value.charCodeAt(index - 1))) {\n return mention(value, index + 1)\n }\n\n return index\n}", "function findStartIndex(markdown) {\n const match = markdown.match(/\\n## Table of Contents\\n/);\n if (match === null || match.index === undefined) return null;\n return match.index + match[0].length - 1;\n}", "function getStartOffSet() {\n var selObj = window.getSelection();\n var selRange = selObj.getRangeAt(0);\n return selRange['startOffset'];\n }", "get startPage() {\n if (!this.owner.isDocumentLoaded || isNullOrUndefined(this.viewer)\n || isNullOrUndefined(this.viewer.selectionStartPage)) {\n return 1;\n }\n return this.viewer.pages.indexOf(this.viewer.selectionStartPage) + 1;\n }", "_getStartRefLineNumber(referenceNumber) {\n var refRef = PassageMarkdown.START_REF_PREFIX + referenceNumber;\n var ref = this.refs[refRef];\n\n if (!ref) {\n return null;\n }\n\n var $ref = $$1(ReactDOM$c.findDOMNode(ref)); // We really care about the first text after the ref, not the\n // ref element itself:\n\n var $refText = $ref.next();\n\n if ($refText.length === 0) {\n // But if there are no elements after the ref, just\n // use the ref itself.\n $refText = $ref;\n }\n\n var vPos = $refText.offset().top;\n return this.state.startLineNumbersAfter + 1 + this._convertPosToLineNumber(vPos);\n }", "getStartOffset(paragraph) {\n let startOffset = 0;\n if (paragraph.childWidgets.length > 0) {\n let childWidgets = paragraph.childWidgets[0];\n return this.getStartLineOffset(childWidgets);\n }\n return startOffset;\n }", "function find_start_line() {\n // TODO:\n return 0\n}", "function getFirstVisiblePosition(el) {\r\n var firstVisibleTextChild = isTextNode(el) ? el : getFirstVisibleTextNode(el);\r\n var curDocument = findDocument(el);\r\n var range = curDocument.createRange();\r\n if (firstVisibleTextChild) {\r\n range.selectNodeContents(firstVisibleTextChild);\r\n return calculatePositionByNodeAndOffset(el, { node: firstVisibleTextChild, offset: range.startOffset });\r\n }\r\n return 0;\r\n }", "get documentStart() {\n if (!isNullOrUndefined(this.selectionModule)) {\n return this.selection.getDocumentStart();\n }\n return undefined;\n }", "function wordStart(area) {\n area.pos = area.pos || pos(area);\n return area.pos - wordPos(area);\n }", "function getStartIndex(rangeHeader, max) {\n var start = rangeHeader ? parseInt(rangeHeader.split('-')[1], 10) + 1 : 0;\n return start >= max ? max - 1 : start;\n}", "function getClozePosition(fullText, cloze){\n\t\tvar start = fullText.indexOf(cloze);\n\t\tconsole.log(\"\\nstart: \", start);\n\t}", "getOffsetToRenderedContentStart() {\n return this._renderedContentOffsetNeedsRewrite ? null : this._renderedContentOffset;\n }", "function selectionIndex(passage) {\n var selection = $(passage).find('#selection .word');\n var startId = $(passage).find('.word').index(selection.first());\n if(selection.length == 1) { // single word\n return startId;\n } else { // range of words\n return startId + \"-\" + (startId + selection.length - 1);\n } \n }", "getOffsetToRenderedContentStart() {\n return this._renderedContentOffsetNeedsRewrite ? null : this._renderedContentOffset;\n }", "getOffsetToRenderedContentStart() {\n return this._renderedContentOffsetNeedsRewrite ? null : this._renderedContentOffset;\n }", "function getScanStartPosition(enclosingNode, originalRange, sourceFile) {\n var start = enclosingNode.getStart(sourceFile);\n if (start === originalRange.pos && enclosingNode.end === originalRange.end) {\n return start;\n }\n var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile);\n if (!precedingToken) {\n // no preceding token found - start from the beginning of enclosing node\n return enclosingNode.pos;\n }\n // preceding token ends after the start of original range (i.e when originalRange.pos falls in the middle of literal)\n // start from the beginning of enclosingNode to handle the entire 'originalRange'\n if (precedingToken.end >= originalRange.pos) {\n return enclosingNode.pos;\n }\n return precedingToken.end;\n }", "get start() {\n return this.selector('TextPositionSelector').start;\n }", "get start() {\n return this.selector('TextPositionSelector').start;\n }", "function findStartLine(cm, n) {\n var minindent, minline, doc = cm.view.doc;\n for (var search = n, lim = n - 100; search > lim; --search) {\n if (search == 0) return 0;\n var line = getLine(doc, search-1);\n if (line.stateAfter) return search;\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline;\n }", "function findStartLine(cm, n) {\n var minindent, minline, doc = cm.view.doc;\n for (var search = n, lim = n - 100; search > lim; --search) {\n if (search == 0) return 0;\n var line = getLine(doc, search-1);\n if (line.stateAfter) return search;\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline;\n }", "function findStartLine(cm, n) {\n var minindent, minline, doc = cm.view.doc;\n for (var search = n, lim = n - 100; search > lim; --search) {\n if (search == 0) return 0;\n var line = getLine(doc, search-1);\n if (line.stateAfter) return search;\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline;\n }", "getWordIndex() {\n return parseInt(this.args[3], 10);\n }", "function findMark() {\n\t\n\t\tif (intent > 0) var aim = $('.active').next('section');\n\t\telse aim = $('.active').prev('section');\n\t\tif (!aim.length) return 0;\n\t\n\t\treturn Math.abs(aim.offset().top-gate.scrollTop());\n\t}", "function findStartLine(cm, n, precise) {\n\t\t var minindent, minline, doc = cm.doc;\n\t\t var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n\t\t for (var search = n; search > lim; --search) {\n\t\t if (search <= doc.first) { return doc.first }\n\t\t var line = getLine(doc, search - 1), after = line.stateAfter;\n\t\t if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n\t\t { return search }\n\t\t var indented = countColumn(line.text, null, cm.options.tabSize);\n\t\t if (minline == null || minindent > indented) {\n\t\t minline = search - 1;\n\t\t minindent = indented;\n\t\t }\n\t\t }\n\t\t return minline\n\t\t }", "function translator_getPosition()\n{\n var position = this.parser.getPosition();\n return position - this.offsetAdj;\n}", "sentanceExtractor({ numSentances = 1, startIndex = false, text = fakeData.loremIpsum } = {}) {\n //Works only with big Chunks of text\n //Specifically made for the loremIpsum text from fakeData\n let start = startIndex ? startIndex : math.rand(0, Math.floor(text.length / 2));\n let outputText = '';\n function findNextSentance() {\n let temp = start;\n //The 'or' might be error prone\n while (text[start] !== '.' || (start - temp) < 4) {\n start++;\n }\n }\n\n //Search for beginning of next sentance\n if (text[start] !== '.') {\n findNextSentance();\n start += 2;\n } else {\n start += 2;\n }\n\n for (numSentances; numSentances != 0; numSentances--) {\n let sentStartIndex = start;\n findNextSentance();\n outputText += text.substring(sentStartIndex, start++) + '.';\n }\n return outputText;\n\n //String.indexOf(); maybe?\n }", "function findStartLine(cm, n, precise) {\n var minindent,\n minline,\n doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) {\n return doc.first;\n }\n\n var line = getLine(doc, search - 1),\n after = line.stateAfter;\n\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier)) {\n return search;\n }\n\n var indented = countColumn(line.text, null, cm.options.tabSize);\n\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n\n return minline;\n }", "get startIndex() {\n return this.$from.index(this.depth);\n }", "function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) { return doc.first }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n { return search }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n }", "function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) { return doc.first }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n { return search }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n }", "function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) { return doc.first }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n { return search }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n }", "function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) { return doc.first }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n { return search }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n }", "function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) { return doc.first }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n { return search }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n }", "function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) { return doc.first }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n { return search }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n }", "function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) { return doc.first }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n { return search }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n }", "function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) { return doc.first }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n { return search }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n }", "function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) { return doc.first }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n { return search }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n }", "function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) { return doc.first }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n { return search }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n }" ]
[ "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.5832447", "0.5655069", "0.5510152", "0.5481976", "0.5437452", "0.5179008", "0.5165169", "0.50831676", "0.50771743", "0.50391054", "0.5026851", "0.50164855", "0.49907923", "0.49869716", "0.49548745", "0.4924869", "0.49238998", "0.49238998", "0.4905284", "0.48919886", "0.48919886", "0.48841405", "0.48841405", "0.48841405", "0.48695275", "0.48586768", "0.48503214", "0.48002744", "0.47735816", "0.47724858", "0.4771387", "0.47687757", "0.47687757", "0.47687757", "0.47687757", "0.47687757", "0.47687757", "0.47687757", "0.47687757", "0.47687757", "0.47687757" ]
0.8424665
29
Returns the end index of the excerpt for the specified mention.
function excerptEnd(mention) { var i = mention.section.j, match; sentenceRe.lastIndex = mention.j + 40; match = sentenceRe.exec(mention.section.speech.text); return match ? Math.min(match.index + match[1].length, i) : i; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }", "getLastEndPosition() {\n\t\t\tconst {overrides} = this.impl;\n\t\t\tif (overrides !== undefined) {\n\t\t\t\treturn overrides.getLastEndPosition(this);\n\t\t\t}\n\n\t\t\treturn this.getPositionFromIndex(this.prevToken.end);\n\t\t}", "function getEndOffSet() {\n var selObj = window.getSelection();\n var selRange = selObj.getRangeAt(0);\n return selRange['endOffset'];\n }", "function annot_offset(range_end){\n var lines = editor.getSession().getDocument().getLines(0, range_end.row);\n var total_off = 0;\n var num_char;\n\n for(var i = 0; i < lines.length; i++){\n num_char = lines[i].length;\n total_off += parseInt((num_char - 1) / 80, 10);\n }\n\n return total_off;\n}", "get endOffset() {\n return this.getHierarchicalIndexByPosition(this.end);\n }", "function textInlineCommentEndIndex(text, i) {\n var j = indexOfEndRecurse(text, \"<%--\", \"--%>\", i + 4);\n if ( !j ) {\n textExceptionThrow(text, i, \"The inline comment statement '<%--' was not closed with a '--%>'\")\n }\n return j + 4; // Returns start of index for comment\n }", "_getInterpolationEndIndex(input, expressionEnd, start) {\n for (const charIndex of this._forEachUnquotedChar(input, start)) {\n if (input.startsWith(expressionEnd, charIndex)) {\n return charIndex;\n }\n // Nothing else in the expression matters after we've\n // hit a comment so look directly for the end token.\n if (input.startsWith('//', charIndex)) {\n return input.indexOf(expressionEnd, charIndex);\n }\n }\n return -1;\n }", "_getInterpolationEndIndex(input, expressionEnd, start) {\n for (const charIndex of this._forEachUnquotedChar(input, start)) {\n if (input.startsWith(expressionEnd, charIndex)) {\n return charIndex;\n }\n // Nothing else in the expression matters after we've\n // hit a comment so look directly for the end token.\n if (input.startsWith('//', charIndex)) {\n return input.indexOf(expressionEnd, charIndex);\n }\n }\n return -1;\n }", "get endPage() {\n if (!this.owner.isDocumentLoaded || isNullOrUndefined(this.viewer)\n || isNullOrUndefined(this.viewer.selectionEndPage)) {\n return 1;\n }\n return this.viewer.pages.indexOf(this.viewer.selectionEndPage) + 1;\n }", "function lastIndexOf(str, token, start) {\n\treturn str \n\t\t? String(str).lastIndexOf(token, start || 0) \n\t\t: -1;\n}", "getEndLocation() {\n const self = this;\n const ends = [\"End of the Project Gutenberg EBook\",\n \"End of Project Gutenberg's\",\n \"\\\\*\\\\*\\\\*END OF THE PROJECT GUTENBERG EBOOK\",\n \"\\\\*\\\\*\\\\* END OF THIS PROJECT GUTENBERG EBOOK\"\n ]\n const joined = ends.join('|');\n\n let endLocation;\n const lastLine = this.lines.find((line, i) => {\n return line.match(joined)\n })\n\n if (lastLine) {\n endLocation = this.lines.indexOf(lastLine);\n this.endLine = this.lines[endLocation]\n } else { // if Can 't find the ending.\n console.info(\"Can't find an ending line. Assuming that the book ends at the end of the text.\")\n endLocation = this.lines.length - 1 //# The end\n this.endLine = false;\n\n }\n console.info(`End line:: ${this.endLine} at line:: ${endLocation}`);\n return endLocation;\n }", "getEndIndex() {\n return this.endIndex;\n }", "get currentEndIndex() {\n if (this.index > 0) {\n const curToken = this.peek(-1);\n return curToken.end + this.offset;\n }\n // No tokens have been processed yet; return the next token's start or the length of the input\n // if there is no token.\n if (this.tokens.length === 0) {\n return this.inputLength + this.offset;\n }\n return this.next.index + this.offset;\n }", "get currentEndIndex() {\n if (this.index > 0) {\n const curToken = this.peek(-1);\n return curToken.end + this.offset;\n }\n // No tokens have been processed yet; return the next token's start or the length of the input\n // if there is no token.\n if (this.tokens.length === 0) {\n return this.inputLength + this.offset;\n }\n return this.next.index + this.offset;\n }", "get endIndex() {\n return this.$to.indexAfter(this.depth);\n }", "function lastIndexOf(arr, elt, start=arr.length-1) {\n\tconsole.log(start);\n\tfor (let i = start; i >= 0; i--)\n\t\tif (arr[i] === elt) return i;\n\treturn -1;\n}", "function visualLineEndNo(doc, lineN) {\n\t\t if (lineN > doc.lastLine()) { return lineN }\n\t\t var line = getLine(doc, lineN), merged;\n\t\t if (!lineIsHidden(doc, line)) { return lineN }\n\t\t while (merged = collapsedSpanAtEnd(line))\n\t\t { line = merged.find(1, true).line; }\n\t\t return lineNo(line) + 1\n\t\t }", "getAsyncEndPos(){\n\t\tvar sz = this.async_stop_pos.count();\n\t\tif (sz == 0){\n\t\t\treturn \"\";\n\t\t}\n\t\tvar obj = this.async_stop_pos.item(sz - 1);\n\t\treturn obj.get(\"end\", \"\", \"string\");\n\t}", "getDocumentEnd() {\n let textPosition = undefined;\n let documentStart = this.owner.documentStart;\n let lastPage = this.viewer.pages[this.viewer.pages.length - 1];\n if (!isNullOrUndefined(documentStart) && lastPage.bodyWidgets[0].childWidgets.length > 0) {\n let block = undefined;\n let section = lastPage.bodyWidgets[0];\n let blocks = section.childWidgets;\n let lastBlkItem = blocks.length - 1;\n let lastBlock = blocks[lastBlkItem];\n if (lastBlock instanceof BlockWidget) {\n block = lastBlock;\n }\n textPosition = this.setPositionForBlock(block, false);\n }\n return textPosition;\n }", "function visualLineEndNo(doc, lineN) {\n\t if (lineN > doc.lastLine()) return lineN;\n\t var line = getLine(doc, lineN), merged;\n\t if (!lineIsHidden(doc, line)) return lineN;\n\t while (merged = collapsedSpanAtEnd(line))\n\t line = merged.find(1, true).line;\n\t return lineNo(line) + 1;\n\t }", "function visualLineEndNo(doc, lineN) {\n\t if (lineN > doc.lastLine()) return lineN;\n\t var line = getLine(doc, lineN), merged;\n\t if (!lineIsHidden(doc, line)) return lineN;\n\t while (merged = collapsedSpanAtEnd(line))\n\t line = merged.find(1, true).line;\n\t return lineNo(line) + 1;\n\t }", "function visualLineEndNo(doc, lineN) {\n\t if (lineN > doc.lastLine()) return lineN;\n\t var line = getLine(doc, lineN), merged;\n\t if (!lineIsHidden(doc, line)) return lineN;\n\t while (merged = collapsedSpanAtEnd(line))\n\t line = merged.find(1, true).line;\n\t return lineNo(line) + 1;\n\t }", "function visualLineEndNo(doc, lineN) {\n\t\t if (lineN > doc.lastLine()) return lineN;\n\t\t var line = getLine(doc, lineN), merged;\n\t\t if (!lineIsHidden(doc, line)) return lineN;\n\t\t while (merged = collapsedSpanAtEnd(line))\n\t\t line = merged.find(1, true).line;\n\t\t return lineNo(line) + 1;\n\t\t }", "indexAfter(depth) {\n depth = this.resolveDepth(depth);\n return this.index(depth) + (depth == this.depth && !this.textOffset ? 0 : 1);\n }", "get end() {\n return this.selector('TextPositionSelector').end;\n }", "get end() {\n return this.selector('TextPositionSelector').end;\n }", "function returnIndex() {\n return index - options.infinite || 0;\n }", "function myLastIndexOf(arr, element, startPos = arr.length){\n\n var index ;\n\n // uses the optional parameter\n\n for (let i = startPos ; i >= 0; i--){\n\n if (arr[i] === element) { // maybe use == instead\n\n // can exit here on true\n\n index = i ;\n\n\n return index;\n // return i;\n\n\n\n }\n\n\n\n }\n\n\n\n index = -1;\n\n return index;\n // return -1;\n // this is for if we want to go the whole array\n // not needed though\n\n\n\n}", "function findLastIndex(tweets, date){\n\tfor(var index = tweets.length-1; index >= 0; index--){\n\t\tif(new Date(tweets[index].created_at) >= date){\n\t\t\treturn index+1;\n\t\t}\n\t}\n\treturn 0;\n}", "function cursorIndex() {\r\n var current = selection.createRange(),\r\n diff = current.duplicate();\r\n\r\n diff.moveToElementText(this);\r\n diff.setEndPoint('EndToEnd', current);\r\n\r\n return diff.text.length - current.text.length;\r\n }", "get end() {\n return this.span.end;\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }", "function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }" ]
[ "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.57554775", "0.5528957", "0.5438013", "0.5422414", "0.524538", "0.52217066", "0.52217066", "0.5134965", "0.5133506", "0.5122551", "0.51051474", "0.5088911", "0.5088911", "0.5084953", "0.50838345", "0.50325304", "0.5032467", "0.5011695", "0.49919492", "0.49919492", "0.49919492", "0.49914464", "0.4979285", "0.4974806", "0.4974806", "0.4973846", "0.49568096", "0.4956221", "0.49492362", "0.4918262", "0.49027485", "0.49027485", "0.49027485", "0.49027485", "0.49027485", "0.49027485", "0.49027485", "0.49027485", "0.49027485", "0.49027485", "0.49027485" ]
0.84146756
29
Orders mentions chronologically: by speech and position within speech.
function orderMentions(a, b) { return a.section.speech.id - b.section.speech.id || a.i - b.i; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sortTwitsByText( ) {\n this.twits.sort( (a, b) => {\n \n if (this.switchPosition == \"normal\");\n if (a.text > b.text) {\n return 1;\n }\n if (a.text < b.text) {\n return -1;\n }\n if (this.switchPosition == \"reversed\"){\n if (a.text < b.text) {\n return 1;\n }\n if (a.text > b.text) {\n return -1;\n }\n }\n return 0;\n });\n }", "sortTwitsByAuthor( ) {\n this.twits.sort( (a, b) => {\n \n if (this.switchPosition == \"normal\");\n if (a.user.name > b.user.name) {\n return 1;\n }\n if (a.user.name < b.user.name) {\n return -1;\n }\n if (this.switchPosition == \"reversed\"){\n if (a.user.name < b.user.name) {\n return 1;\n }\n if (a.user.name > b.user.name) {\n return -1;\n }\n }\n return 0;\n });\n }", "function hookMomentsSort(moments) {\n const momentsNames = Object.keys(moments);\n const momentsOrdered = { };\n momentsNames.sort((a, b) => {\n const momentA = moments[a] || { };\n const momentB = moments[b] || { };\n if ( typeof momentA.order === 'number' && typeof momentB.order === 'number' ) {\n return momentA.order - momentB.order;\n }\n return a - b;\n }).forEach((name, i) => {\n momentsOrdered[name] = moments[name];\n });\n return momentsOrdered;\n}", "function sortSentiment(data){\n var textS = $('#paragraph').val();\n var positiveWords = [];\n var negativeWords = [];\n for (var i = 0; i < data.length; i++) {\n if(data[i].sentiment.type === \"positive\"){\n positiveWords.push(data[i].text);\n } else if (data[i].sentiment.type === \"negative\"){\n negativeWords.push(data[i].text);\n }\n }\n var positive = positiveWords.join(' ').split(' ');\n var negative = negativeWords.join(' ').split(' ');\n postParagraph(positive, negative);\n return positive, negative;\n}", "_updateMatches() {\n let matches = [];\n let completeList = this.words.concat(this.extraWords);\n completeList.forEach((word) => {\n word.matches.forEach((match) => {\n matches.push({\n match,\n word\n });\n });\n });\n matches.sort(function (a, b) {\n return b.match.length - a.match.length;\n });\n this.matches = matches;\n }", "function findMentions(topic) {\n var mentions = topic.mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n }\n return mentions;\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = excerptEnd(d0);\n }\n\n // Then collapse any overlapping excerpts (from the same speech).\n for (i = 1, d1 = mentions[0]; i < n; ++i) {\n d0 = d1;\n d1 = mentions[i];\n if (d1.section.speech.id === d0.section.speech.id\n && d1.start >= d0.start\n && d1.start < d0.end) {\n d1.start = -1;\n d0.end = d1.end;\n d1 = d0;\n }\n }\n\n // Returns the start index of the excerpt for the specified mention.\n function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20);\n }\n return mention.section.i;\n }\n\n // Returns the end index of the excerpt for the specified mention.\n function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }\n\n return mentions.filter(function(d) { return d.start >= 0; });\n}", "function sortHiddenWords(){\r\n\t//phan chia cac tu trong hiddenWords vao mang tmpList - chua kiem tra su ton tai cua tu\r\n\tconsole.log(hiddenWords)\r\n\tvar tmpList = hiddenWords.split(\",\");\r\n\t\r\n\t//tao list chua cac tu - chua sap xep theo thu tu xuat hien\r\n\tvar list = [];\r\n\tcheckList(transcript, list, tmpList);\r\n\t\r\n\t//tao mang mapList chua thu tu xuat hien cua cac tu trong list\r\n\tfor ( var i = 0; i < list.length; i++) {\t\r\n\t\tmapList.push(transcript.indexOf(list[i]));\r\n\t}\r\n\t\r\n\tmapList.sort(function(a,b){return a - b; });\r\n\r\n\r\n\t//sap xep lai cac tu theo thu tu xuat hien vao mang mapList\r\n\tfor (var i = 0; i < list.length; i++) {\r\n\t\tfor (var j = 0; j < mapList.length; j++) {\r\n\t\t\tif (typeof mapList[j] != \"number\") {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (transcript.indexOf(list[i]) == mapList[j]) {\t\r\n\t\t\t\tmapList[j] = list[i];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "function arrangeWordsInOrder(mergedArray, k) {\n let mergedLine = '';\n let wordArray = [];\n let line = mergedArray[k]['match'];\n\n for (let i = 0; i < line.length; i++) {\n let index = line[i]['matchLineNum'];\n let matchedWordForLine = mergedArray[index].description;\n\n let mainX = mergedArray[k].boundingPoly.vertices[0].x;\n let compareX = mergedArray[index].boundingPoly.vertices[0].x;\n\n if (compareX > mainX) {\n mergedLine = mergedArray[k].description + ' ' + matchedWordForLine;\n } else {\n mergedLine = matchedWordForLine + ' ' + mergedArray[k].description;\n }\n }\n return mergedLine;\n}", "function getOrder(line, direction) {\n var order = line.order;\n\n if (order == null) {\n order = line.order = bidiOrdering(line.text, direction);\n }\n\n return order;\n } // EVENT HANDLING", "function order(){\n\n var keys = getKeys( PEERS ),\n\n times = {};\n\n times[ PLAYER.time ] = PLAYER.id;\n\n for ( var i = 0, l = keys.length; i < l; i++ ) times[ PEERS[ keys[i] ].time ] = keys[i];\n\n var list = getKeys( times ).sort( rank ).map( function ( key ) { return times[key]; }),\n\n user;\n\n if ( list.length !== keys.length + 1 ) {\n\n var msg = 'Precision time conflict';\n\n WATCH.emit('error', { msg: msg, line: 340 });\n\n throw new Error( msg );\n }\n\n DATA.length = 0;\n\n for ( i = 0, l = list.length; i < l; i++ ) {\n\n user = PEERS[ list[i] ] || PLAYER;\n\n user.pos = DATA.push( user.data ) - 1;\n }\n\n function rank ( curr, next ) { return curr - next; }\n }", "function sortMessagesByDate(conversation) {\n conversation.messages.sort(function (a, b) {\n return (new Date(a.timestamp) - new Date(b.timestamp));\n })\n}", "function sampleMentions() {\n return data.topics\n .filter(function(d) { return d.mentions.length; })\n .map(function(d) { return d.mentions[Math.floor(Math.random() * d.mentions.length)]; })\n .sort(orderMentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}", "function groupMentionsBySpeaker(mentions) {\n return d3.nest()\n .key(function(d) { return d.section.speaker; })\n .rollup(collapseMentions)\n .entries(mentions);\n}" ]
[ "0.60937816", "0.55811733", "0.5532338", "0.54517126", "0.5322693", "0.5262462", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.5220889", "0.5165837", "0.5098198", "0.509224", "0.50082314", "0.49975732", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514", "0.49821514" ]
0.6685393
29
Assign event handlers to topic links.
function linkTopic(a) { a .on("click", click) .on("mouseover", mouseover) .on("mouseout", mouseout); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function linkTopic(a) {\n a.on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n }", "function linkTopic(a) {\n a .on(\"click\", click);\n //.on(\"mouseover\", mouseover)\n //.on(\"mouseout\", mouseout);\n}", "linksHandler() {\n\t\treplaceLinks(this.content, (href) => {\n\t\t\tthis.emit(EVENTS.CONTENTS.LINK_CLICKED, href);\n\t\t});\n\t}", "function initTopics() {\n nav\n .on(\"navigation:panClick\", function (e, direction) {\n topic.publish(EventManager.Navigation.PAN, {\n direction: direction\n });\n })\n .on(\"navigation:zoomClick\", function (e, in_out) {\n var newLvl = (in_out === \"zoomIn\") ? 1 : -1;\n topic.publish(EventManager.Navigation.ZOOM_STEP, {\n level: newLvl\n });\n })\n .on(\"navigation:zoomSliderChange\", function (e, newVal) {\n topic.publish(EventManager.Navigation.ZOOM, {\n level: newVal\n });\n })\n .on(\"navigation:fullExtentClick\", function () {\n topic.publish(EventManager.Navigation.FULL_EXTENT);\n });\n }", "setupLinks() {\n for (let link in this.links) {\n this.links[link].addEventListener(\"click\", (e) => {\n let linkID = e.target.id;\n let viewToShow = linkID.slice(0, -5);\n let pointerToShow = `${viewToShow}-pointer`;\n this.showView(viewToShow);\n this.showPointer(pointerToShow);\n });\n\n // Events mouseover and mouseout simulates a hover effect for links.\n this.links[link].addEventListener(\"mouseover\", (e) => {\n let linkID = e.target.id;\n let pointerToShow = `${linkID.slice(0, -5)}-pointer`;\n this.showPointer(pointerToShow);\n });\n\n this.links[link].addEventListener(\"mouseout\", (e) => {\n for (let view in this.views) {\n if (this.views[view].classList != \"hidden\") {\n let activeView = `${this.views[view].id}-pointer`;\n this.showPointer(activeView);\n }\n }\n });\n }\n }", "_setupLinks() {\n\t\tthis.$links = this.$control.find( '.link' );\n\n\t\tthis._bindLinked();\n\t}", "_events() {\n this._linkClickListener = this._handleLinkClick.bind(this);\n this.$element.on('click.zf.smoothScrollWithLinks', 'a[href*=\"#\"]', this._linkClickListener);\n }", "initMessageHandlers() {\n Object.keys(this.topics).forEach(key => this.subscriberSocket.subscribe(this.topics[key]));\n this.subscriberSocket.on('message', this.emit.bind(this));\n }", "function bindPusherEvents() {\n var pusher = new Pusher('bf3b73f9a228dfef0913');\n var channel = pusher.subscribe(divvy.channel);\n\n channel.bind('discussionWasModified', discussionWasModified);\n channel.bind('discussionWasDeleted', discussionWasDeleted);\n }", "function bindHandlers() {\n wss.bindHandlers(handlerMap);\n $log.debug('topo2 event handlers bound');\n }", "function summaryAddLinksHandler()\n\t{\n\t\tvar $summaryAddLinks = $('.configurator-summary-article__link');\n\n\t\t$summaryAddLinks.on('click', function(e){\n\t\t\te.preventDefault();\n\t\t\tvar $$tabTargetIndex = $(this).data('stepTabIndex');\n\t\t\tvar $accordionItemTargetindex = $(this).data('itemIndex');\n\n\t\t\tswitchStepTab($tabTargetIndex);\n\t\t\topenAccordionItemByIndex($tabTargetIndex, $accordionItemTargetindex);\n\t\t});\n\t}", "function setEventListeners(uxBus, context, player){\n console.log(\"Setting event listeners\");\n let buttonClickHandlers = {}\n buttonClickHandlers[UI.BUTTON_IDS.JOIN_TOPIC] = topicJoinModal.open.bind(topicJoinModal)\n buttonClickHandlers[UI.BUTTON_IDS.NEW_TOPIC] = topicCreateModal.open.bind(topicCreateModal)\n buttonClickHandlers[UI.BUTTON_IDS.CTX_INVITE] = context.invite.bind(context, uxBus)\n buttonClickHandlers[UI.BUTTON_IDS.CTX_ALIAS] = context.alias.bind(context, uxBus)\n buttonClickHandlers[UI.BUTTON_IDS.CTX_BOOT] = context.boot.bind(context, uxBus)\n buttonClickHandlers[UI.BUTTON_IDS.CTX_DELETE] = context.delete.bind(context, uxBus)\n buttonClickHandlers[UI.BUTTON_IDS.MUTE_SOUND] = toggleMute.bind(null, uxBus)\n\n\n\n //Processing button clicks\n uxBus.on(Common.UXMessage.BUTTON_CLICK, btnId=>{\n if(btnId in buttonClickHandlers){\n buttonClickHandlers[btnId]()\n }\n })\n\n uxBus.on(Events.TOPIC_CREATED, addNewTopicToUX.bind(null, uxBus))\n uxBus.on(Common.UXMessage.TOPIC_LOADED, addNewTopicToUX.bind(null, uxBus))\n\n uxBus.on(Common.UXMessage.TOPIC_CLICK, context.selectTopic.bind(context, uxBus, uxTopics))\n uxBus.on(Common.UXMessage.TOPIC_DBLCLICK, context.expandTopic.bind(context, uxBus, uxTopics))\n uxBus.on(Common.UXMessage.TOPIC_EXPAND_ICON_CLICK, context.expandTopic.bind(context, uxBus, uxTopics))\n\n uxBus.on(Common.UXMessage.MAIN_MENU_CLICK, handleMainMenuClick);\n\n //Invite code click events\n uxBus.on(Common.UXMessage.INVITE_DBLCLICK, context.doubleSelectInvite.bind(context, uxBus, uxTopics));\n uxBus.on(Common.UXMessage.INVITE_CLICK, context.selectInvite.bind(context, uxBus, uxTopics));\n\n //emitet at chatuifactory.js\n uxBus.on(Common.UXMessage.PARTICIPANT_CLICK, context.selectParticipant.bind(context, uxBus, uxTopics));\n\n //Attachment handlers\n uxBus.on(Common.UXMessage.ATTACH_FILE_ICON_CLICK, selectFileAttachment);\n\n\n //Handle private message mode cancel click\n uxBus.on(Common.UXMessage.CANCEL_PRIVATE_MESSAGE, cancelPrivateMessageSend);\n\n //Handling send message click\n uxBus.on(Common.UXMessage.SEND_BUTTON_CLICK, sendMessage.bind(null, uxBus, context));\n\n //Handling key presses while in new message area\n uxBus.on(Common.UXMessage.MESSAGE_AREA_KEY_PRESS, processMessageAreaKeyPress.bind(null, uxBus, context))\n\n uxBus.on(Common.UXMessage.LAST_MESSAGES_RESPONSE, processLastMessagesResponse)\n\n\n uxBus.on(Common.UXMessage.CHAT_SCROLL, processChatScroll.bind(null, uxBus))\n\n uxBus.on(TopicEvents.NEW_CHAT_MESSAGE, processNewChatMessage.bind(null, context, player))\n uxBus.on(TopicEvents.INVITE_CREATED, addNewInvite.bind(null, uxBus))\n\n uxBus.on(VaultEvents.TOPIC_DELETED, context.topicDeleted.bind(context))\n uxBus.on(Common.UXMessage.TOPIC_JOIN_SUCCESS, (data)=>{\n console.log(\"Topic join success adding to UX\");\n addNewTopicToUX(uxBus, data.topic)\n })\n\n uxBus.on(TopicEvents.NEW_PARTICIPANT_JOINED, data=>{\n\n console.log(\"NEW PARTICIPANT JOINED PROCESSING UX\");\n addNewParticipantToUX(uxBus, data.topicPkfp, data.pkfp)\n\n })\n\n uxBus.on(VaultEvents.VAULT_UPDATED, processVaultUpdated)\n uxBus.on(VaultEvents.VAULT_FORMAT_UPDATED, ()=>{\n toastr.success(\"Vault has been updated to the newest format\")\n })\n uxBus.on(TopicEvents.SETTINGS_UPDATED, processTopicSettingsUpdated)\n\n\n\n uxBus.on(SessionEvents.CONNECTION_LOST, setConnectionIndicatorStatus.bind(null, ConnectionIndicatorStatus.DISCONNECTED))\n uxBus.on(SessionEvents.CONNECTED, setConnectionIndicatorStatus.bind(null, ConnectionIndicatorStatus.CONNECTED))\n uxBus.on(SessionEvents.RECONNECTING, setConnectionIndicatorStatus.bind(null, ConnectionIndicatorStatus.CONNECTING))\n\n uxBus.on(VaultEvents.VAULT_SETTINGS_UPDATED, processVaultSettingsUpdate)\n uxBus.on(TopicEvents.ERROR, errorMessage=>{\n console.log(`Topic error received: ${errorMessage}`);\n toastr.warning(errorMessage)\n })\n}", "function setChannelLink(){\n document.querySelectorAll('.channel-link').forEach(link => {\n link.onclick = ()=> {\n load_channel(link.dataset.channel);\n return false;\n }\n });\n }", "function initializeEvents() {\n 'use strict';\n var thumbnails = getThumbnailsArray();\n thumbnails.forEach(addThumbClickHandler);\n}", "function initializeEvents() {\n 'use strict';\n var thumbnails = getThumbnailsArray();\n thumbnails.forEach(addThumbClickHandler);\n}", "function trk_bind_links() {\n $(\"a\").on(\"click\", function(e) {\n\ttrk_reset_freq();\n\tvar target = $(e.target);\n\tvar url = target.attr(\"href\");\n\tif (!url) {\n\t url = \"\"\n\t}\n\tvar text = target.text();\n\tvar path = trk_path($(e.target));\n\tvar which = e.which;\n\tvar cx = e.clientX;\n\tvar cy = e.clientY;\n\tvar x = e.pageX;\n\tvar y = e.pageY;\n\tvar t = Date.now();\n\tvar cls = target.attr(\"class\");\n\tvar msgtype = \"link\";\n\tif (cls && cls.indexOf(\"dropdown-toggle\") >= 0) {\n\t msgtype = \"menu-open\";\n\t} else if (cls && cls.indexOf(\"nav-link\") >= 0) {\n\t if (target.closest(\".dropdown-menu\").length > 0) {\n\t\tmsgtype = \"menu-select\";\n\t } else {\n\t\tmsgtype = \"menu-link\";\n\t }\n\t} else if (target.closest(\".ssh-logo\").length > 0) {\n\t msgtype = \"logo-link\";\n\t} else if (target.closest(\".breadcrumb\").length > 0) {\n\t msgtype = \"breadcrumb-link\";\n\t}\n\tif (target.closest(\"cta-item\").length > 0) {\n\t msgtype = \"cta-item\";\n\t /* Save call-to-action in local data for next page. */\n\t var local = getLocalData();\n\t local.cta = cta.attr(\"id\");\n\t setLocalData(local);\n\t} else {\n\t /* Clear call-to-action in local data. */\n\t var local = getLocalData();\n\t if (local.cta) {\n\t\tlocal.cta = null;\n\t\tsetLocalData(local);\n\t }\n\t}\n\tvar extra = [msgtype, t - trk_t, url, text, which, x, y, cx, cy, path];\n\tvar chat_st = trk_chat_click_st(target);\n\tif (chat_st.length > 0) {\n\t extra = extra.concat(chat_st);\n\t}\n\tvar hubspot_st = trk_hubspot_st(target);\n\tif (hubspot_st.length > 0) {\n\t extra = extra.concat(hubspot_st);\n\t}\n\tvar cta_st = trk_cta_st(target);\n\tif (cta_st.length > 0) {\n\t extra = extra.concat(cta_st);\n\t}\n\tif (url &&\n\t target.attr(\"target\") != \"_blank\" &&\n\t !url.startsWith(\"#\") &&\n\t !url.startsWith(\"https:\") &&\n\t !url.startsWith(\"http:\") &&\n\t !url.startsWith(\"mailto:\")) {\n\t // It is an internal link. They replace current page.\n\t window.onbeforeunload = null;\n\t trk_send(true, extra);\n\t ga('send', 'event', 'nav', msgtype, url, {\n\t\t'transport': 'beacon',\n\t\t'hitCallback': function() {\n\t\t document.location = url;\n\t\t}\n\t });\n\t} else {\n\t // It is an outbound external link or a link with target=\"_blank\".\n\t // Such links open new tab.\n\t trk_extra = trk_extra.concat(extra);\n\t ga('send', 'event', 'Outbound link', msgtype);\n\t}\n\treturn true;\n });\n $(\"input[type=submit], button[type=submit]\")\n\t.on(\"click\", function(e) {\n\t trk_reset_freq();\n\t var target = $(e.target);\n\t var tag = target.prop(\"tagName\").toLowerCase();\n\t var form = target.closest(\"form\");\n\t var url = form && form.attr(\"action\");\n\t if (!url) {\n\t\turl = \"\";\n\t }\n\t var text;\n\t if (tag == \"input\") {\n\t\ttext = target.val();\n\t } else {\n\t\ttext = target.text();\n\t }\n\t var path = trk_path($(e.target));\n\t var which = e.which;\n\t var cx = e.clientX;\n\t var cy = e.clientY;\n\t var x = e.pageX;\n\t var y = e.pageY;\n\t var t = Date.now();\n\t var extra = [\"submit\", t - trk_t, url, text, which,\n\t\t\t x, y, cx, cy, path];\n\t var chat_st = trk_chat_click_st(target);\n\t if (chat_st.length > 0) {\n\t\textra = extra.concat(chat_st);\n\t }\n\t var hubspot_st = trk_hubspot_st(target);\n\t if (hubspot_st.length > 0) {\n\t\textra = extra.concat(hubspot_st);\n\t }\n\t var cta_st = trk_cta_st(target);\n\t if (cta_st.length > 0) {\n\t\textra = extra.concat(cta_st);\n\t }\n\t var final = !!url;\n\t if (url && url.startsWith(\"https://forms.hubspot.com/\")) {\n\t\tfinal = false;\n\t }\n\t trk_send(final, extra);\n\t if (final) {\n\t\tga('send', 'event', 'Submit', 'submit', url, {\n\t\t 'transport': 'beacon',\n\t\t 'hitCallback': function() {\n\t\t\te.preventDefault();\n\t\t\tform.submit();\n\t\t }\n\t\t});\n\t } else {\n\t\tga('send', 'event', 'Submit', 'click', url);\n\t }\n\t return true;\n\t});\n}", "_bindLinked() {\n\t\tif ( this.slidersLinked ) {\n\t\t\tthis.$links.addClass( 'linked' );\n\t\t}\n\n\t\tthis.$links.on( 'click', event => {\n\t\t\tevent.preventDefault();\n\t\t\tthis.slidersLinked = ! this.slidersLinked;\n\t\t\tthis.$links.toggleClass( 'linked', this.slidersLinked );\n\t\t\tthis.$control.trigger( 'linked', { isLinked: this.slidersLinked } );\n\t\t\tthis._triggerChangeEvent();\n\t\t} );\n\t}", "bindEventHandlers(events) {\n events.forEach(name => {\n const method = this[`on${name[0].toUpperCase()}${name.slice(1)}`];\n if (method) {\n this.slack.rtmClient.on(name, method.bind(this));\n }\n });\n }", "setupHandlers () {\n this.rs.on('connected', () => this.eventHandler('connected'));\n this.rs.on('ready', () => this.eventHandler('ready'));\n this.rs.on('disconnected', () => this.eventHandler('disconnected'));\n this.rs.on('network-online', () => this.eventHandler('network-online'));\n this.rs.on('network-offline', () => this.eventHandler('network-offline'));\n this.rs.on('error', (error) => this.eventHandler('error', error));\n\n this.setEventListeners();\n this.setClickHandlers();\n }", "bindEvents() {\n this.AMapEventListeners = [];\n\n /**\n * Construct event callbacks.\n */\n const eventCallbacks = this.parseEvents();\n\n Object.keys(eventCallbacks).forEach((key) => {\n const eventName = key.substring(2).toLowerCase();\n const handler = eventCallbacks[key];\n\n this.AMapEventListeners.push(\n window.AMap.event.addListener(this.marker, eventName, handler),\n );\n });\n }", "function linkListeners(action)\n {\n if(post[action.type]) post[action.type].apply(post,action.args);\n }", "_bindEvents () {\n this.channel.on('route', this.navigate)\n }", "function attachRouterToLinks() {\n\n this.$('a:not([href^=\"http\"])').off('click').on('click', $.proxy(function(e) {\n var link = $(e.currentTarget).attr('href');\n if (link.indexOf('#') === 0) {\n return;\n }\n //if the link start with hash '#' => ignore\n e.preventDefault();\n this.controller.router.dispatch(link, {\n trigger: true\n });\n\n }, this));\n\n this.$('[data-role=\"back\"]').off('click').on('click', $.proxy(function(e){\n window.history.back();\n Backbone.history.isBack = true;\n },this));\n\n this.controller.on(\"actionFinish\",function(event){\n Backbone.history.isBack = false;\n });\n }", "function links_click_event(event) {\n console.log(\"works link\");\n}", "function bindPusherEvents() {\n var pusher = new Pusher('bf3b73f9a228dfef0913');\n var channel = pusher.subscribe(divvy.channel);\n\n channel.bind('commentWasDeleted', commentWasDeleted);\n channel.bind('commentWasLeft', commentWasLeft);\n channel.bind('commentWasModified', commentWasModified);\n }", "bindTopicToAction(topic, action) {\n\n const client = new PubkeeperClient({\n server: config.PK_SERVER,\n jwt: config.PK_JWT,\n brews: [\n new WebSocketBrew({\n brewerConfig: {\n hostname: config.PKWEBSOCKET_HOST,\n port: config.PKWEBSOCKET_PORT,\n secure: true,\n },\n }),\n ],\n });\n\n client.connect().then(() => {\n\n client.addPatron(topic, (patron) => {\n\n const handler = (rawData) => {\n const data = JSON.parse(new TextDecoder().decode(rawData))[0];\n this.dispatcher(action(data));\n };\n\n patron.on('message', handler);\n\n return () => {\n // deactivation/tear-down\n patron.off('message', handler);\n };\n });\n\n\n });\n }", "function AttachLinkEvents() {\n var aElements = document.getElementsByTagName(\"a\");\n for (i = 0; i < aElements.length; i++) {\n if (aElements[i].rel == \"contents\") {\n aElements[i].onclick = function() {\n var todomain = getDomain(this.href);\n var thisdomain = getDomain(window.location);\n if(todomain == thisdomain) {\n ShowPage(this);\n return false;\n } else {\n window.open(this.href); return false;\n }\n }\n }\n } \n}", "function activateAutoLinks() {\r\n\tlinkReaders.forEach( function(linkReader) {\r\n\t\tlinkReader.postMessage(extractorIsOn);\r\n\t});\r\n}", "function bindPusherEvents() {\n var pusher = new Pusher('bf3b73f9a228dfef0913');\n var channel = pusher.subscribe(divvy.channel);\n\n channel.bind('subtaskWasModified', subtaskWasModified);\n channel.bind('subtaskWasDeleted', subtaskWasDeleted);\n channel.bind('subtaskWasCompleted', subtaskWasCompleted);\n channel.bind('subtaskWasIncomplete', subtaskWasIncomplete);\n }", "function _bindEventHandlers() {\n\t\t\n helper.bindEventHandlers();\n }", "function loadEventListeners() {\n // DOM load event from local storage\n document.addEventListener('DOMContentLoaded', getTopics);\n // Add topic event\n form.addEventListener('submit', addTopic);\n // Remove topic event\n topicList.addEventListener('click', removeTopic);\n // Remove all topics event\n clearBtn.addEventListener('click', clearTopics);\n // Filter through topics event\n filter.addEventListener('keyup', filterTopics);\n}", "setupSubLinks() {\n for (let subLink in this.subLinks) {\n this.subLinks[subLink].addEventListener(\"click\", (e) => {\n let linkID = e.target.id;\n if (linkID === \"\") {\n linkID = e.target.parentNode.id;\n }\n let subViewToShow = linkID.slice(0, -5);\n this.showSubView(subViewToShow);\n });\n }\n }", "function attachEvent() {\n $el.on(\"click\", \"a\", function(e) {\n e.preventDefault();\n\n var newSchool = $(this).data(\"school\");\n\n if (newSchool !== planner.school) {\n if (planner.school) {\n $.publish(\"module:clean\");\n } else {\n $('body').chardinJs('start');\n }\n // update planner school\n planner.set(\"school\", newSchool);\n // update ui\n uiUpdate();\n }\n\n $el.modal(\"hide\");\n\n planner.trackEvent(\"change-school\", newSchool !== planner.school);\n });\n }", "function createRelatedTopicHandler(resultData) {\r\n topicToRelate = JSON.parse(resultData); // mark down the dm4.webbrowser.url topic (now with ID) for later usage..\r\n if (topicToRelate.type_uri == \"dm4.webbrowser.url\") {\r\n // we want relate to the web resource, not the webbrowser.url\r\n getRelatedWebResource(resultData, function(web_resource) {\r\n // \r\n topicToRelate = JSON.parse(web_resource).items[0]\r\n if (topicOrigin != undefined) {\r\n // create the to be related topic\r\n sendTopicPost(topicOrigin, associateResultHandler);\r\n } else {\r\n alert(\"ERROR: no dm4.webbrowser.url \" + topicToRelate.id + \" found where the note could be related to .. skipping\");\r\n }\r\n });\r\n } else {\r\n // topicToRelate to is already a web resource (initial bookmark of web resource with url x)\r\n if (topicOrigin != undefined) {\r\n // create the to be related topic\r\n sendTopicPost(topicOrigin, associateResultHandler);\r\n } else {\r\n alert(\"ERROR: no dm4.webbrowser.url \" + topicToRelate.id + \" found where the note could be related to .. skipping\");\r\n }\r\n }\r\n}", "bindEventListeners(links) \r\n\t{\r\n\t\tlet instance = this;\r\n\r\n\t\tthis.next.childNodes[0].onclick = function(e) {\r\n\t\t\te.preventDefault();\r\n\r\n\t\t\tlet requestedPage = instance.current+1;\r\n\r\n\t\t\tif (instance.notInPageRange(requestedPage)) {\r\n\t\t\t\tthrow new NotInPageRangeException('The page you requesting does not exists');\r\n\t\t\t}\r\n\r\n\t\t\tif (Products && Products.booted) {\r\n\t\t\t\tProducts.loadProducts(requestedPage).then(function(products) {\r\n\t\t\t\t\tinstance.setCurrent(requestedPage);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tthis.previous.childNodes[0].onclick = function(e) {\r\n\t\t\te.preventDefault();\r\n\r\n\t\t\tlet requestedPage = instance.current-1;\r\n\r\n\t\t\tif(instance.notInPageRange(requestedPage)) {\r\n\t\t\t\tthrow new NotInPageRangeException('The page you requesting does not exists');\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (Products && Products.booted) {\r\n\t\t\t\tProducts.loadProducts(requestedPage).then(function(products) {\r\n\t\t\t\t\tinstance.setCurrent(requestedPage);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tfor(var i = 0; i < this.pages.length; i++) {\r\n\t\t\tthis.pages[i].childNodes[0].onclick = function(e) {\r\n\t\t\t\te.preventDefault();\r\n\t\t\t\t\r\n\t\t\t\tlet requestedPage = this.getAttribute('data-page-nr');\r\n\t\t\t\t\r\n\t\t\t\tif (Products && Products.booted) {\r\n\t\t\t\t\tProducts.loadProducts(requestedPage).then(function(products) {\r\n\t\t\t\t\t\tinstance.setCurrent(requestedPage);\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}", "function addClickEventListener(nodes, codeNames, links){\n nodes.on('click', clicked);\n codeNames.on('click', clicked);\n}", "handleLinkEvent(event, link) {\n if (this.renderer && this.renderer.handleLinkEvent) {\n this.renderer.handleLinkEvent(this.editorContext, event, link);\n }\n }", "function initializeEvents() {\r\n 'use strict';\r\n var thumbnails = getThumbnailsArray();\r\n thumbnails.forEach(addThumbClickHandler);\r\n\r\n // 7.1.3 - Listening for the keypress event\r\n addKeyPressHandler();\r\n}", "function bindPublishButtonHandler () {\n var $cta = $('#initiate_publish_button');\n\n ($cta && $cta[0] && $cta[0].hasAttribute('href') && $cta.on('click', modifyPublishURL)) ||\n $cta.on('click', togglePublishTooltip);\n}", "function assignEvents () {\r\n const getButton = document.querySelector('button.get')\r\n const addButton = document.querySelector('button.add')\r\n const editButton = document.querySelector('button.edit')\r\n const deleteButton = document.querySelector('button.delete')\r\n\r\n getButton.addEventListener('click', uiGetPosts)\r\n addButton.addEventListener('click', uiAddPost)\r\n editButton.addEventListener('click', uiEditPost)\r\n deleteButton.addEventListener('click', uiDeletePost)\r\n}", "function onRoomLinkHandler(link) {\r\n\tlinkUrl = link;\r\n\tconnList = {};\r\n\t//chat = [];\r\n}", "function handleBindEventHandlers(){\n handleAddBookmark();\n handleFilterRating();\n handleDeleteBookmark();\n handleAddForm();\n handleDescExpand();\n handleCloseButton();\n }", "ConnectEvents() {\n\n }", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function setUpClickListeners() {\n $(\"#content a\").live('click', function() { //If links point to galleries, make them use getContent.\n var href = $(this).attr('href');\n if(href.indexOf(\"image/tid\") > -1) {\n var id = href.split(\"/\")[3];\n getContent(id);\n return false;\n }\n });\n $('.galleria-images .galleria-image img').live('click', function() { //Make images clickable. This is to make up for the\n window.open($(this).attr('src'), '_blank'); //wrapping a-tag removed above.\n });\n }", "function webLinkHandler5x(event) {\n webLinkHandler(event, \"href\");\n }", "bindEvents() {\n let _this = this;\n this.$blogPost.on(\"click\", \"a\", () => {\n event.preventDefault();\n this.loadContent(event.target);\n });\n }", "function publish() {\n if (!arguments || arguments.Length < 1) {\n throw \"Publishing events requires at least one argument for topic id\";\n }\n\n var topic = arguments[0];\n var restArgs = Array.prototype.slice.call(arguments, 1);\n\n cache[topic] && angular.forEach(cache[topic], function(callback) {\n try {\n callback.apply(null, restArgs);\n } catch (exc) {\n console.log(\"Error in messaging handler for topic \", topic);\n }\n });\n }", "on(params) {\n let self = this\n\n this.find(params.topic)\n .on(params.event, payload => self.send(params.topic, \"Message\", {event: params.event, payload: payload}))\n }", "registerHandlers() {\n this.formEl.onsubmit = event => this.submitNews(event)\n this.moreBtn.onclick = () => this.loadProducts()\n }", "function addFnLinkEventListeners(fnElts, notesElt) {\n for (var i = 0, l = fnElts.length; i < l; i++) {\n fnElts[i].addEventListener('click', function() {\n removeClass(notesElt, 'hidden');\n });\n }\n }", "function addEventsToAnchors() {\n const deleteAnchors = document.querySelectorAll(\"a[data-id]\");\n deleteAnchors.forEach(del => {\n del.addEventListener(\"click\", function (e) {\n e.preventDefault();\n const comID = e.target.getAttribute(\"data-id\");\n // delete the comment\n Be.deleteComment(token, comID).then(res => {\n if (res.ok) {\n //refresh the list with comments\n getComments();\n Utils.showToastMsg(\"Comment removed\", Utils.TOAST_MESSAGE);\n } else {\n // pop up window with message and timer\n Utils.showToastMsg(\"There was a problem!\", Utils.TOAST_ERROR);\n }\n });\n });\n });\n}", "registerHandlers() {\n this.fieldSlaveChannel.subscribe(PUT_FIELD_REQUEST, putFieldHandler.bind(this));\n this.fieldSlaveChannel.subscribe(PATCH_FIELD_STATUS_REQUEST, patchStatusHandler.bind(this));\n this.fieldSlaveChannel.subscribe(PATCH_FIELD_SETTINGS_REQUEST, patchSettingsHandler.bind(this));\n }", "function setEventHandlers() {\n // Socket.IO\n socket.sockets.on(\"connection\", onSocketConnection);\n SearchServices.emptyArray();\n}" ]
[ "0.7027552", "0.6863875", "0.64106756", "0.6332329", "0.62175745", "0.59810287", "0.5946024", "0.58910644", "0.5687338", "0.56710696", "0.56260896", "0.56119186", "0.559328", "0.55852777", "0.55852777", "0.5515453", "0.5492993", "0.54866874", "0.5475323", "0.5457495", "0.54553545", "0.5454687", "0.5441839", "0.5425618", "0.54198295", "0.54174715", "0.5411842", "0.5411093", "0.5386517", "0.53701633", "0.5343328", "0.53249687", "0.5323377", "0.53184974", "0.52999157", "0.5278011", "0.52748203", "0.5251881", "0.5251696", "0.5251621", "0.5213655", "0.5208896", "0.5196123", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.5188907", "0.51867235", "0.5180612", "0.5179658", "0.517931", "0.517748", "0.5174631", "0.51734614", "0.51588345", "0.5156289", "0.5151547" ]
0.69139016
29
Returns the topic matching the specified name, approximately. If no matching topic is found, returns undefined.
function findTopic(name) { for (var i = 0, n = data.topics.length, t; i < n; ++i) { if ((t = data.topics[i]).name === name || new RegExp("^" + (t = data.topics[i]).re.source + "$", "i").test(name)) { return t; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n return topic;\n}", "function topic(name) {\r\n name = name.replace(/[\\[]/, \"\\\\\\[\").replace(/[\\]]/, \"\\\\\\]\");\r\n var regexS = \"[\\\\?&]\" + name + \"=([^&#]*)\";\r\n var regex = new RegExp(regexS);\r\n var results = regex.exec(href);\r\n if (results == null)\r\n return \"\";\r\n else\r\n return results[1];\r\n }", "function getTopic(parameters) {\n if (!isUndefined(parameters.Topic)) {\n return parameters.Topic;\n }\n else {\n return '';\n }\n}", "function getTopic(topic) {\n return new Promise( function(resolve) {\n // Create object and set up request\n let xhttp = new XMLHttpRequest();\n xhttp.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n resolve(this.responseText);\n }\n };\n\n // Pass query information into server script for GET request\n let queryString = \"?topic=\" + topic;\n xhttp.open(\"GET\", \"../backend/filter_topic.php\" + queryString, true);\n xhttp.send();\n });\n }", "function getTopicById(topicId) {\n // printOut(\"searching through \" + mapTopics.result.topics.length);\n for (var m = 0; m < kiezatlas.mapTopics.result.topics.length; m++){\n //printOut(' searching through ' + mapTopics.result.topics.length + ' mapTopics');\n // printOut(\"|..checking \" + mapTopics.result.topics[m].id + '==' + topicId + ' |');\n if (topicId == kiezatlas.mapTopics.result.topics[m].id) {\n // printOut(' foundTopicById: ' + topicId);\n return kiezatlas.mapTopics.result.topics[m];\n }\n }\n return null;\n }", "function getSelectedTopic() {\n\tvar node = getActiveAnchor();\n\tif (node != null) {\n\t\tvar href = node.href;\n\t\tvar index = href.indexOf(\"/topic/\");\n\t\tif (index != -1) {\n\t\t\treturn href.substring(index + 6);\n\t\t}\n\t\tindex = href.indexOf(\"/nav/\");\n\t\tif (index != -1) {\n\t\t\treturn \"/..\" + href.substring(index);\n\t\t}\n\t}\n\t// no selection\n\treturn null;\n}", "function getTopicByOriginId(topicId) {\n // printOut(\"searching through \" + mapTopics.result.topics.length);\n for (var m = 0; m < mapTopics.result.topics.length; m++){\n //printOut(' searching through ' + mapTopics.result.topics.length + ' mapTopics');\n // printOut(\"|..checking \" + mapTopics.result.topics[m].id + '==' + topicId + ' |');\n if (topicId == mapTopics.result.topics[m].originId) {\n // printOut(' foundTopicById: ' + topicId);\n return mapTopics.result.topics[m];\n }\n }\n return null;\n }", "function getAllTopics(topicName) {\r\n var keys = Object.keys(topicListenerMap);\r\n var regExp = new RegExp(topicName);\r\n var matchingTopics = [];\r\n for(var i = 0; i < keys.length; i++) {\r\n var key = keys[i];\r\n if(regExp.test(key)) {\r\n matchingTopics.push(key);\r\n } else\r\n console.log(\"Didnot match \"+key);\r\n }\r\n return matchingTopics;\r\n}", "function BOT_topicToName(tid) {\r\n\tvar res = BOT_get(tid,\"name\",\"VAL\");\r\n\tif(!res) res = BOT_get(tid,\"_reference\",\"VAL\");\r\n\tif(BOT_isArray(res)) { \r\n\t\tif(res.length > 0) return res[0]\r\n\t\telse return \"Unnamed\" // no name nor reference founc\r\n\t\t}\r\n\telse return res\r\n}", "function getq (name) {\n if (!name) { console.error(\"No name passed\"); return null; }\n var qprofiles = this.qps;\n var n = qprofiles.filter(function (it) { return it.id == name; })[0];\n return n;\n}", "find(topic) {\n return channels[topic] || channel\n }", "function getTopic(topic){\n\n\t\t// Get correct title and subtitle\n\t\tif (topic === \"income\"){\n\t\t\ttitel = \"Yearly income\";\n\t\t\tsubtitel = \"x 1000 euro\";\n\t\t}\n\t\telse if (topic === \"birthsanddeaths\"){\n\t\t\ttitel = \"Amount of births and deaths\";\n\t\t\tsubtitel = \"Per 1000 people\";\n\t\t}\n\t\telse if (topic === \"causesofdeath\"){\n\t\t\ttitel = \"Causes of Death\";\n\t\t\tsubtitel = \"Per 1000 people\";\n\t\t}\n\t\telse if (topic === \"migration\"){\n\t\t\ttitel = \"Migration\";\n\t\t\tsubtitel = \"Percentages\";\n\t\t}\n\t\telse if (topic === \"socialsecurity\"){\n\t\t\ttitel = \"Social Security\";\n\t\t\tsubtitel = \"Per 1000 people\";\n\t\t}\n\t\telse if (topic === \"education\")\n\t\t{\n\t\t\ttitel = \"Highest level of Education\";\n\t\t\tsubtitel = \"Per 1000 people\";\n\t\t}\n\n\t\treturn texts = {\n\t\t\ttitel : titel,\n\t\t\tsubtitel : subtitel\n\t\t};\n}", "function getTopicName(docUrl) {\n return (docUrl.match(/\\/([a-z_\\-]*)-[0-9]{8}\\.html$/)[1] || '???').\n replace(/\\s\\S/g, txt => ' ' + txt.substr(1).toUpperCase()).\n replace(/^\\S/, txt => txt.toUpperCase());\n }", "function findNode(name) {\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].name === name) {\n return nodes[i];\n }\n }\n return null;\n }", "function getTopic(txt) {\n var result= \"\";\n \n var writing = false;\n \n for (i = 0; i < txt.length; i++) {\n if (!writing) {\n if (txt.charAt(i) == '/')\n writing = true;\n } else {\n \tif (txt.charAt(i) == '/')\n \t\tbreak;\n result += txt.charAt(i);\n }\n }\n \n return result;\n}", "getEvent(nameOrSignatureOrTopic) {\n if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__[/* isHexString */ \"l\"])(nameOrSignatureOrTopic)) {\n const topichash = nameOrSignatureOrTopic.toLowerCase();\n for (const name in this.events) {\n if (topichash === this.getEventTopic(name)) {\n return this.events[name];\n }\n }\n logger.throwArgumentError(\"no matching event\", \"topichash\", topichash);\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (nameOrSignatureOrTopic.indexOf(\"(\") === -1) {\n const name = nameOrSignatureOrTopic.trim();\n const matching = Object.keys(this.events).filter((f) => (f.split(\"(\" /* fix:) */)[0] === name));\n if (matching.length === 0) {\n logger.throwArgumentError(\"no matching event\", \"name\", name);\n }\n else if (matching.length > 1) {\n logger.throwArgumentError(\"multiple matching events\", \"name\", name);\n }\n return this.events[matching[0]];\n }\n // Normlize the signature and lookup the function\n const result = this.events[_fragments__WEBPACK_IMPORTED_MODULE_7__[/* EventFragment */ \"c\"].fromString(nameOrSignatureOrTopic).format()];\n if (!result) {\n logger.throwArgumentError(\"no matching event\", \"signature\", nameOrSignatureOrTopic);\n }\n return result;\n }", "function getTopic(bill) {\n var topic;\n if (bill.subjects_top_term === '') {\n topic = bill.committees.committee\n .replace(new RegExp('Senate '), '')\n .replace(new RegExp(' Committee'), '');\n }\n else {\n topic = bill.subjects_top_term;\n }\n topic = topic\n .replace(new RegExp(' and.*'), '')\n .replace(new RegExp(\",.*\"), \"\")\n .replace(new RegExp('&#39;'), '');\n return topic;\n }", "get topic () {\n\t\treturn this._topic;\n\t}", "get topic () {\n\t\treturn this._topic;\n\t}", "getEvent(nameOrSignatureOrTopic) {\n if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__ethersproject_bytes__[\"f\" /* isHexString */])(nameOrSignatureOrTopic)) {\n const topichash = nameOrSignatureOrTopic.toLowerCase();\n for (const name in this.events) {\n if (topichash === this.getEventTopic(name)) {\n return this.events[name];\n }\n }\n logger.throwArgumentError(\"no matching event\", \"topichash\", topichash);\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (nameOrSignatureOrTopic.indexOf(\"(\") === -1) {\n const name = nameOrSignatureOrTopic.trim();\n const matching = Object.keys(this.events).filter((f) => (f.split(\"(\" /* fix:) */)[0] === name));\n if (matching.length === 0) {\n logger.throwArgumentError(\"no matching event\", \"name\", name);\n }\n else if (matching.length > 1) {\n logger.throwArgumentError(\"multiple matching events\", \"name\", name);\n }\n return this.events[matching[0]];\n }\n // Normlize the signature and lookup the function\n const result = this.events[__WEBPACK_IMPORTED_MODULE_8__fragments__[\"a\" /* EventFragment */].fromString(nameOrSignatureOrTopic).format()];\n if (!result) {\n logger.throwArgumentError(\"no matching event\", \"signature\", nameOrSignatureOrTopic);\n }\n return result;\n }", "function resolvePropertyName(name, syntax) {\r\n var snippet = resources.findSnippet(syntax, name);\r\n \r\n if (!snippet && prefs.get('css.fuzzySearch')) {\r\n var minScore = parseFloat(prefs.get('css.fuzzySearchMinScore'));\r\n snippet = resources.fuzzyFindSnippet(syntax, name, minScore);\r\n }\r\n \r\n if (snippet) {\r\n if (!_.isString(snippet)) {\r\n snippet = snippet.data;\r\n }\r\n \r\n return cssResolver.splitSnippet(snippet).name;\r\n }\r\n }", "getEvent(nameOrSignatureOrTopic) {\n if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__ethersproject_bytes__[\"f\" /* isHexString */])(nameOrSignatureOrTopic)) {\n const topichash = nameOrSignatureOrTopic.toLowerCase();\n for (const name in this.events) {\n if (topichash === this.getEventTopic(name)) {\n return this.events[name];\n }\n }\n logger.throwArgumentError(\"no matching event\", \"topichash\", topichash);\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (nameOrSignatureOrTopic.indexOf(\"(\") === -1) {\n const name = nameOrSignatureOrTopic.trim();\n const matching = Object.keys(this.events).filter((f) => (f.split(\"(\" /* fix:) */)[0] === name));\n if (matching.length === 0) {\n logger.throwArgumentError(\"no matching event\", \"name\", name);\n }\n else if (matching.length > 1) {\n logger.throwArgumentError(\"multiple matching events\", \"name\", name);\n }\n return this.events[matching[0]];\n }\n // Normlize the signature and lookup the function\n const result = this.events[__WEBPACK_IMPORTED_MODULE_8__fragments__[\"b\" /* EventFragment */].fromString(nameOrSignatureOrTopic).format()];\n if (!result) {\n logger.throwArgumentError(\"no matching event\", \"signature\", nameOrSignatureOrTopic);\n }\n return result;\n }", "async getNameOfTheStock(name) {\r\n const nameObj = await this.getResourse(\r\n `https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=${name}&apikey=${this._APIkey}`\r\n );\r\n\r\n return nameObj.bestMatches[0];\r\n }", "get topic() {\n\t\treturn this.__topic;\n\t}", "async function getExercise(collection, name){\n var exerciseName = name; \n return new Promise(function(resolve,reject){\n collection.find({\n \"name\": exerciseName\n }).limit(1).toArray(function(err,docs){\n if(err) reject(err); \n if(docs){\n resolve(docs[0]); \n }\n });\n }); \n }", "query(name) {\n for (let node of this) {\n if (node.name === name) {\n return node;\n }\n }\n }", "function getTopic() {\n var topic = $(topicElement).text();\n // var topic = new Array();\n // topic.push($(\".topic-tag__1jni\").parent().firstChild().text());\n // if($(\".topic-tag__1jni\").parent().firstChild().text() != $(\".topic-tag__1jni\").parent().lastElementChild().text()){\n // topic.push($(\".topic-tag__1jni\").parent().lastElementChild().text())\n // }\n console.log(\"Topic : \" + JSON.stringify(topic));\n return topic;\n}", "function getItemTopicsData(topic){\n\n var item;\n for(var i=0; i < topicsData.length; i++){\n if(topicsData[i].topic === topic){\n item = topicsData[i];\n break;\n }\n }\n return item;\n}", "function topicCreator(topicName) {\n return new Promise(function (fulfill, reject) {\n pubsub.createTopic(topicName, function (err, topic) {\n if (!err) {\n seneca.log.info('Topic \"' + topicName + '\" created: ', topic);\n fulfill(topic);\n }\n else if (err.code === 409) { // If the topic already exists, just return it\n seneca.log.warn('Topic \"' + topicName + '\" already exists.');\n fulfill(pubsub.topic(topicName));\n }\n else {\n seneca.log.info('Failed to create topic: ', topicName);\n reject(err);\n }\n });\n });\n }", "getTopic(bill) {\n var topic;\n if (bill.primary_subject === '') {\n topic = bill.committees\n .replace(new RegExp('Senate '), '')\n .replace(new RegExp(' Committee'), '');\n }\n else {\n topic = bill.primary_subject;\n }\n topic = topic\n .replace(new RegExp(' and.*'), '')\n .replace(new RegExp(\",.*\"), \"\")\n .replace(new RegExp('&#39;'), '');\n return topic;\n }", "getTopicById(id, callback, errorCallback) {\n CommonUtil.requestAxios(\n baseServerAxios().get(\n UrlConstant.api.topic.GET_TOPIC_BY_ID.replace('{id}', id)\n ),\n callback,\n errorCallback\n );\n }", "function getBestMatch(subject) {\n\tvar bestScore = 100.0\n\tvar matchName = \"\"\n\tvar returnString = \"\"\n\tvar allMeasurements = Object.keys(Measurements)\n\tvar allSubjects = []\n\tfor (firstIndex = 0; firstIndex < allMeasurements.length; firstIndex++) {\n\t\tvar measurement = allMeasurements[firstIndex]\n\t\tallSubjects[firstIndex] = exportArray(Measurements[measurement])\n\t}\n\tfor (secondIndex = 0; secondIndex < allSubjects.length; secondIndex++) {\n\t\tvar score = compareWithSubject(subject, allSubjects[secondIndex])\n\t\tif (score < bestScore) {\n\t\t\tbestScore = score\n\t\t\tmatchName = allMeasurements[secondIndex]\n\t\t}\n\t}\t\n\treturn matchName\n}", "function getArtboardWithName(name) {\n\tvar artboards = jsArray([doc artboards]);\n\tfor(var i = 0; i < artboards.length; i++) {\n\t \tvar artboard = artboards[i];\n\t \t//we check for the “changelog” substring so we can attach the page name in the changelog artboard name\n artboardName = [artboard name].substring(0,9);\n\t \tif(artboardName == name) {\n\t \t\treturn artboard;\n\t \t}\n\t}\n\treturn;\n}", "function findProductByName(name) {\r\n return products.find(p => p.name === name);\r\n}", "function getSchool(schoolName) {\n let schoolRef = db.collection('schools');\n let schoolDoc = schoolRef.where('name', '==', schoolName).get().then(snapshot => {\n if (snapshot.empty) {\n return;\n }\n var schools = [];\n snapshot.forEach(doc => {\n schools.push({id: doc.id, data: doc.data()});\n });\n if (schools.length > 0) {\n return schools[0];\n } else {\n return;\n }\n })\n return schoolDoc;\n}", "function byName(name) {\n return byId(nameIdMap[name]);\n }", "function getSchoolStartingWith(schoolName) {\n let schoolRef = db.collection('schools');\n let slen = schoolName.length;\n let ubound = schoolName.substring(0, slen-1) +\n String.fromCharCode(schoolName.charCodeAt(slen-1) + 1);\n let schoolDoc = schoolRef.where('name', '>=', schoolName).where('name', '<', ubound)\n .get().then(snapshot => {\n if (snapshot.empty) {\n return [];\n }\n var schools = [];\n snapshot.forEach(doc => {\n schools.push(doc.data());\n });\n return schools;\n })\n return schoolDoc;\n}", "async function getName(nameOfGerm) {\n\n //find reference to the part of database containing germs\n let con = firebase.database().ref(\"germs\");\n\n //takes a slice of this data based upon the parameters (name) and only the first one\n let snap = await con.orderByChild(\"name\").limitToFirst(1).equalTo(nameOfGerm).once('value');\n\n //takes the value of that slice and return it\n let germ = snap.val();\n\n //if there is a firebase object that exist, get the key, and return an object\n if(germ) {\n\n let index = Object.keys(germ)[0]\n let finalGerm = germ[index]\n return finalGerm;\n\n }\n // if nothing exists, just returns a message that states that\n else {\n\n return \"Nothing here\"\n }\n\n}", "function qs(name) {\n return document.querySelector(name);\n}", "function OpenPCS_Read_BuildTopicString (strVarPath_p, fAltTopic_p, strAltTopic_p)\n {\n\n var strTopic;\n\n // select between default and alternative topic\n if ( !fAltTopic_p )\n {\n strTopic = strVarPath_p;\n }\n else\n {\n strTopic = strAltTopic_p;\n }\n\n // normalize topic\n strTopic = strTopic.trim();\n\n // prevent empty topic\n if (strTopic.length == 0)\n {\n strTopic = 'undefined';\n }\n\n return (strTopic);\n\n }", "function findTocTopic()\r\n{\r\n\tvar toc_window = window.frames[\"ory_toc\"];\r\n\r\n\t// check for false is not safe since the value might be undefined if the frame is not loaded yet\r\n\t//if (toc_window.toc_loaded == false )\r\n\tif ( toc_window.toc_loaded != true )\r\n\t{\r\n\t\t//if ( toc_window.toc_loaded == undefined )\r\n\t\t//{\r\n\t\t//\talert(\"got it!\");\r\n\t\t//}\r\n\t\twindow.setTimeout(\"findTocTopic()\", 200);\r\n\t}\r\n\telse\r\n\t{\r\n\t\tif ( topicToDisplay == null )\r\n\t\t{\r\n\t\t\ttopicToDisplay = toc_window.getFirstTopicUrl();\r\n\t\t}\r\n\t\r\n\t\tvar topic = topicToDisplay;\r\n\t\tvar found = toc_window.selectTopic(topic);\r\n\t\tif ( found == false )\r\n\t\t{\r\n\t\t\tvar anchorIndex = topic.lastIndexOf(\"#\");\r\n\t\t\tif (anchorIndex > 0)\r\n\t\t\t{\r\n\t\t\t\ttopic = topic.substring(0, anchorIndex);\r\n\t\t\t}\r\n\t\t\tfound = toc_window.selectTopic(topic);\r\n\t\t}\t\t\t\t\t\t\r\n\r\n\t\t// find the topic in the current view, if not, look for the next view\r\n\t\tif ( found == false )\r\n\t\t{\r\n\t\t\tif ( loadingTabIndex < viewTabs.length )\r\n\t\t\t{\r\n\t\t\t\tdisplayTree(viewTabs[loadingTabIndex++]);\r\n\t\t\t\tfindTocTopic();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// end finding and got nothing\r\n\t\t\t\t// display the default\r\n\t\t\t\talert(bookmarkviews_js_MESSAGE1);\r\n\t\t\t\tloadingTabIndex = 0;\r\n\t\t\t\tshowPage();\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tloadingTabIndex = 0;\r\n\t\t\t// find successful, display the topic page\r\n\t\t\tshowPage();\r\n\t\t}\r\n\t}\r\n}", "get(name) {\n if (!this._observers[name]) {\n this.set(name, null);\n }\n return this._subjects[name].getValue();\n }" ]
[ "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7118566", "0.6771797", "0.5988107", "0.5771484", "0.5704432", "0.5534121", "0.5520019", "0.546523", "0.5462548", "0.5425821", "0.54153013", "0.52761865", "0.5222692", "0.520426", "0.5093805", "0.50230926", "0.50069773", "0.49958786", "0.49958786", "0.49948162", "0.4984867", "0.49798375", "0.4969472", "0.4939631", "0.49346355", "0.49293852", "0.4924279", "0.49158025", "0.4896653", "0.48612726", "0.48140392", "0.4774254", "0.47614413", "0.47443232", "0.46932605", "0.4688627", "0.46731922", "0.4669812", "0.465043", "0.463929", "0.46378687", "0.4623812" ]
0.7834644
29
Returns the topic matching the specified name, approximately. If no matching topic is found, a new one is created.
function findOrAddTopic(name) { var topic = findTopic(name); if (!topic) { topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1)); topic.y = 0; updateTopics(data.topics); } return topic; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findOrAddTopic(name) {\n var topic = findTopic(name);\n return topic;\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n return t;\n }\n }\n}", "function topic(name) {\r\n name = name.replace(/[\\[]/, \"\\\\\\[\").replace(/[\\]]/, \"\\\\\\]\");\r\n var regexS = \"[\\\\?&]\" + name + \"=([^&#]*)\";\r\n var regex = new RegExp(regexS);\r\n var results = regex.exec(href);\r\n if (results == null)\r\n return \"\";\r\n else\r\n return results[1];\r\n }", "function topicCreator(topicName) {\n return new Promise(function (fulfill, reject) {\n pubsub.createTopic(topicName, function (err, topic) {\n if (!err) {\n seneca.log.info('Topic \"' + topicName + '\" created: ', topic);\n fulfill(topic);\n }\n else if (err.code === 409) { // If the topic already exists, just return it\n seneca.log.warn('Topic \"' + topicName + '\" already exists.');\n fulfill(pubsub.topic(topicName));\n }\n else {\n seneca.log.info('Failed to create topic: ', topicName);\n reject(err);\n }\n });\n });\n }", "function getTopicById(topicId) {\n // printOut(\"searching through \" + mapTopics.result.topics.length);\n for (var m = 0; m < kiezatlas.mapTopics.result.topics.length; m++){\n //printOut(' searching through ' + mapTopics.result.topics.length + ' mapTopics');\n // printOut(\"|..checking \" + mapTopics.result.topics[m].id + '==' + topicId + ' |');\n if (topicId == kiezatlas.mapTopics.result.topics[m].id) {\n // printOut(' foundTopicById: ' + topicId);\n return kiezatlas.mapTopics.result.topics[m];\n }\n }\n return null;\n }", "function getTopic(topic) {\n return new Promise( function(resolve) {\n // Create object and set up request\n let xhttp = new XMLHttpRequest();\n xhttp.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n resolve(this.responseText);\n }\n };\n\n // Pass query information into server script for GET request\n let queryString = \"?topic=\" + topic;\n xhttp.open(\"GET\", \"../backend/filter_topic.php\" + queryString, true);\n xhttp.send();\n });\n }", "function getTopic(parameters) {\n if (!isUndefined(parameters.Topic)) {\n return parameters.Topic;\n }\n else {\n return '';\n }\n}", "function getAllTopics(topicName) {\r\n var keys = Object.keys(topicListenerMap);\r\n var regExp = new RegExp(topicName);\r\n var matchingTopics = [];\r\n for(var i = 0; i < keys.length; i++) {\r\n var key = keys[i];\r\n if(regExp.test(key)) {\r\n matchingTopics.push(key);\r\n } else\r\n console.log(\"Didnot match \"+key);\r\n }\r\n return matchingTopics;\r\n}", "function addNewTopic(topic) {\n\tif (topic != \"\") {\n\t\tconsole.log(\"Adding new task: \" + topic);\n\t\tvar topicId = Math.floor(100000 + Math.random() * 900000);\n\t\ttopicsDictionary[topicId] = {id: topicId, name: topic, time: 0};\n\n\t\tif (selectedTopicID == \"\" || selectedTopicID == null || isWorkingOnTask == false) {\n\t\t\tselectedTopicID = topicId;\n\t\t\tstoreSelectedTopicID();\n\t\t}\n\t\tstoreTopics();\n\t}\n}", "find(topic) {\n return channels[topic] || channel\n }", "function getTopicByOriginId(topicId) {\n // printOut(\"searching through \" + mapTopics.result.topics.length);\n for (var m = 0; m < mapTopics.result.topics.length; m++){\n //printOut(' searching through ' + mapTopics.result.topics.length + ' mapTopics');\n // printOut(\"|..checking \" + mapTopics.result.topics[m].id + '==' + topicId + ' |');\n if (topicId == mapTopics.result.topics[m].originId) {\n // printOut(' foundTopicById: ' + topicId);\n return mapTopics.result.topics[m];\n }\n }\n return null;\n }", "function generateTopic(room) {\n const list = gameTopics.getTopics();\n const index = mathUtil.getRandomInt(0, list.length);\n room.topic = list[index];\n return room;\n}", "static small(topicData) {\n return (new Topic(topicData)).build()\n }", "function getTopic(topic){\n\n\t\t// Get correct title and subtitle\n\t\tif (topic === \"income\"){\n\t\t\ttitel = \"Yearly income\";\n\t\t\tsubtitel = \"x 1000 euro\";\n\t\t}\n\t\telse if (topic === \"birthsanddeaths\"){\n\t\t\ttitel = \"Amount of births and deaths\";\n\t\t\tsubtitel = \"Per 1000 people\";\n\t\t}\n\t\telse if (topic === \"causesofdeath\"){\n\t\t\ttitel = \"Causes of Death\";\n\t\t\tsubtitel = \"Per 1000 people\";\n\t\t}\n\t\telse if (topic === \"migration\"){\n\t\t\ttitel = \"Migration\";\n\t\t\tsubtitel = \"Percentages\";\n\t\t}\n\t\telse if (topic === \"socialsecurity\"){\n\t\t\ttitel = \"Social Security\";\n\t\t\tsubtitel = \"Per 1000 people\";\n\t\t}\n\t\telse if (topic === \"education\")\n\t\t{\n\t\t\ttitel = \"Highest level of Education\";\n\t\t\tsubtitel = \"Per 1000 people\";\n\t\t}\n\n\t\treturn texts = {\n\t\t\ttitel : titel,\n\t\t\tsubtitel : subtitel\n\t\t};\n}", "function findNode(name) {\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].name === name) {\n return nodes[i];\n }\n }\n return null;\n }", "function BOT_topicToName(tid) {\r\n\tvar res = BOT_get(tid,\"name\",\"VAL\");\r\n\tif(!res) res = BOT_get(tid,\"_reference\",\"VAL\");\r\n\tif(BOT_isArray(res)) { \r\n\t\tif(res.length > 0) return res[0]\r\n\t\telse return \"Unnamed\" // no name nor reference founc\r\n\t\t}\r\n\telse return res\r\n}", "function getSelectedTopic() {\n\tvar node = getActiveAnchor();\n\tif (node != null) {\n\t\tvar href = node.href;\n\t\tvar index = href.indexOf(\"/topic/\");\n\t\tif (index != -1) {\n\t\t\treturn href.substring(index + 6);\n\t\t}\n\t\tindex = href.indexOf(\"/nav/\");\n\t\tif (index != -1) {\n\t\t\treturn \"/..\" + href.substring(index);\n\t\t}\n\t}\n\t// no selection\n\treturn null;\n}", "function createTopic() {\n var newTopic = JSONfn.parse(JSONfn.stringify(widgetTopicTemplate));\n console.log(newTopic);\n return newTopic;\n }", "function getTopic(txt) {\n var result= \"\";\n \n var writing = false;\n \n for (i = 0; i < txt.length; i++) {\n if (!writing) {\n if (txt.charAt(i) == '/')\n writing = true;\n } else {\n \tif (txt.charAt(i) == '/')\n \t\tbreak;\n result += txt.charAt(i);\n }\n }\n \n return result;\n}", "constructor(id, topic_name, topic_score) {\n this.id = id;\n this. topic_name = topic_name;\n this.topic_score = topic_score;\n }", "function subscribe(name, id, callback, timeout) {\n if (typeof name !== s_string) {\n throw new TypeError('topic name must be a string.');\n }\n if (id === undefined || id === null) {\n if (typeof callback === s_function) {\n id = callback;\n }\n else {\n throw new TypeError('callback must be a function.');\n }\n }\n if (typeof id === s_function) {\n timeout = callback;\n callback = id;\n if (_id === null) {\n _id = autoId();\n }\n _id.then(function(id) {\n subscribe(name, id, callback, timeout);\n });\n return;\n }\n if (typeof callback !== s_function) {\n throw new TypeError('callback must be a function.');\n }\n if (Future.isPromise(id)) {\n id.then(function(id) {\n subscribe(name, id, callback, timeout);\n });\n return;\n }\n if (timeout === undefined) { timeout = _timeout; }\n var topic = getTopic(name, id, true);\n if (topic === null) {\n var cb = function() {\n _invoke(self, name, [id, topic.handler, cb, {\n idempotent: true,\n failswitch: false,\n timeout: timeout\n }], false);\n };\n topic = {\n handler: function(result) {\n var topic = getTopic(name, id, false);\n if (topic) {\n if (result !== null) {\n var callbacks = topic.callbacks;\n for (var i = 0, n = callbacks.length; i < n; ++i) {\n try {\n callbacks[i](result);\n }\n catch (e) {}\n }\n }\n if (getTopic(name, id, false) !== null) { cb(); }\n }\n },\n callbacks: [callback]\n };\n _topics[name][id] = topic;\n cb();\n }\n else if (topic.callbacks.indexOf(callback) < 0) {\n topic.callbacks.push(callback);\n }\n }", "function getArtboardWithName(name) {\n\tvar artboards = jsArray([doc artboards]);\n\tfor(var i = 0; i < artboards.length; i++) {\n\t \tvar artboard = artboards[i];\n\t \t//we check for the “changelog” substring so we can attach the page name in the changelog artboard name\n artboardName = [artboard name].substring(0,9);\n\t \tif(artboardName == name) {\n\t \t\treturn artboard;\n\t \t}\n\t}\n\treturn;\n}", "function getItemTopicsData(topic){\n\n var item;\n for(var i=0; i < topicsData.length; i++){\n if(topicsData[i].topic === topic){\n item = topicsData[i];\n break;\n }\n }\n return item;\n}", "function getq (name) {\n if (!name) { console.error(\"No name passed\"); return null; }\n var qprofiles = this.qps;\n var n = qprofiles.filter(function (it) { return it.id == name; })[0];\n return n;\n}", "query(name) {\n for (let node of this) {\n if (node.name === name) {\n return node;\n }\n }\n }", "function byName(name) {\n return byId(nameIdMap[name]);\n }", "function getTopicName(docUrl) {\n return (docUrl.match(/\\/([a-z_\\-]*)-[0-9]{8}\\.html$/)[1] || '???').\n replace(/\\s\\S/g, txt => ' ' + txt.substr(1).toUpperCase()).\n replace(/^\\S/, txt => txt.toUpperCase());\n }", "function selectTopic(topic){\n currentSubject = topic;\n var topicObj = getItemTopicsData(currentSubject);\n \n if(topicObj.data.length > 0){\n //show the stickers from the data stored\n showStickers(topicObj.data);\n }\n else\n {\n //search for the topic in the API and load the topic data\n searchSticker(topicObj);\n }\n \n $(\"#button-more\").css(\"display\",\"block\");\n}", "function createTopicResource(url, title) {\r\n //\r\n var webpageTitle = cleanUpForJson(title);\r\n var webtopic = '{\"uri\":\"\",\"type_uri\":\"dm4.webbrowser.web_resource\",\"composite\":'\r\n + '{\"dm4.webbrowser.web_resource_description\":\"'+webpageTitle+'\",\"dm4.webbrowser.url\":\"'+url+'\"}}';\r\n // checks if topic with given url already exists\r\n getTopicByValueAndType('dm4.webbrowser.url', url, function(responseText) {\r\n //\r\n if (responseText != undefined) {\r\n // ### Notify user and load existing Bookmark, may wants to change title/name of URL \r\n if (lookmarker.statusLabel != undefined) lookmarker.statusLabel.value = lookmarker.statusdoubledURL;\r\n } else { // undefined => no topic like this known.. go on create it.\r\n sendTopicPost(webtopic, getResultingTopicId);\r\n }\r\n });\r\n}", "function set_curr_topic(name, url){\n var txt = document.getElementById(\"topic_name\");\n txt.innerHTML = name;\n txt.url = url;\n report_history({ev_type:\"found_topic\", carac:{name:name, url:url}});\n}", "function getTopic() {\n var topic = $(topicElement).text();\n // var topic = new Array();\n // topic.push($(\".topic-tag__1jni\").parent().firstChild().text());\n // if($(\".topic-tag__1jni\").parent().firstChild().text() != $(\".topic-tag__1jni\").parent().lastElementChild().text()){\n // topic.push($(\".topic-tag__1jni\").parent().lastElementChild().text())\n // }\n console.log(\"Topic : \" + JSON.stringify(topic));\n return topic;\n}", "function findProductByName(name) {\r\n return products.find(p => p.name === name);\r\n}", "async function getExercise(collection, name){\n var exerciseName = name; \n return new Promise(function(resolve,reject){\n collection.find({\n \"name\": exerciseName\n }).limit(1).toArray(function(err,docs){\n if(err) reject(err); \n if(docs){\n resolve(docs[0]); \n }\n });\n }); \n }", "function getSchool(schoolName) {\n let schoolRef = db.collection('schools');\n let schoolDoc = schoolRef.where('name', '==', schoolName).get().then(snapshot => {\n if (snapshot.empty) {\n return;\n }\n var schools = [];\n snapshot.forEach(doc => {\n schools.push({id: doc.id, data: doc.data()});\n });\n if (schools.length > 0) {\n return schools[0];\n } else {\n return;\n }\n })\n return schoolDoc;\n}", "changeTopic(newTopic) {\n let url = defaultUrl + '&category=' + newTopic;\n this.apiCall(url);\n }", "function addNewTopic(topicName, description){\n try {\n var row = originalWindow.document.createElement(\"tr\");\n var columnOne = originalWindow.document.createElement(\"td\");\n columnOne.setAttribute(\"class\", \"confluenceTd\");\n columnOne.append(originalWindow.document.createTextNode(topicName));\n var columnTwo = originalWindow.document.createElement(\"td\");\n columnTwo.setAttribute(\"class\", \"confluenceTd\");\n columnTwo.append(originalWindow.document.createTextNode(description));\n\n row.append(columnOne);\n row.append(columnTwo);\n\n var lastRowIndex = topicRows_atm.length-1;\n var parent = topicRows_atm[lastRowIndex].parentNode; \n parent.insertBefore(row, parent.childNodes[lastRowIndex-1]);\n sortTable(\"topics\");\n } catch (err) {\n atmWindow.alert(err);\n\t atmWindow.console.log(err);\n }\n }", "get topic () {\n\t\treturn this._topic;\n\t}", "get topic () {\n\t\treturn this._topic;\n\t}", "function isValidTopic(topic) {\n return topicRegExp.test(topic);\n}", "getTopicById(id, callback, errorCallback) {\n CommonUtil.requestAxios(\n baseServerAxios().get(\n UrlConstant.api.topic.GET_TOPIC_BY_ID.replace('{id}', id)\n ),\n callback,\n errorCallback\n );\n }", "async updateTopic({ topic_id, memo }) {\n\t\tconst client = this.#client\n\t\tconst topic = await new TopicUpdateTransaction()\n\t\t\t.setTopicId(topic_id)\n\t\t\t.setTopicMemo(memo)\n\t\t\t.execute(client)\n\n\t\treturn topic\n\t}", "function subscribeListenerToOneTopic(topicName, listener, count) {\r\n var topicListeners = topicListenerMap[topicName];\r\n if(!topicListeners) {\r\n topicListenerMap[topicName] = topicListeners = [];\r\n }\r\n if(topicListeners.indexOf(listener) == -1) {\r\n topicListeners.push(listener);\r\n if(count && count > 0) {\r\n deliverLastNMessages(topicName, listener, count);\r\n }\r\n }\r\n}", "getEvent(nameOrSignatureOrTopic) {\n if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__[/* isHexString */ \"l\"])(nameOrSignatureOrTopic)) {\n const topichash = nameOrSignatureOrTopic.toLowerCase();\n for (const name in this.events) {\n if (topichash === this.getEventTopic(name)) {\n return this.events[name];\n }\n }\n logger.throwArgumentError(\"no matching event\", \"topichash\", topichash);\n }\n // It is a bare name, look up the function (will return null if ambiguous)\n if (nameOrSignatureOrTopic.indexOf(\"(\") === -1) {\n const name = nameOrSignatureOrTopic.trim();\n const matching = Object.keys(this.events).filter((f) => (f.split(\"(\" /* fix:) */)[0] === name));\n if (matching.length === 0) {\n logger.throwArgumentError(\"no matching event\", \"name\", name);\n }\n else if (matching.length > 1) {\n logger.throwArgumentError(\"multiple matching events\", \"name\", name);\n }\n return this.events[matching[0]];\n }\n // Normlize the signature and lookup the function\n const result = this.events[_fragments__WEBPACK_IMPORTED_MODULE_7__[/* EventFragment */ \"c\"].fromString(nameOrSignatureOrTopic).format()];\n if (!result) {\n logger.throwArgumentError(\"no matching event\", \"signature\", nameOrSignatureOrTopic);\n }\n return result;\n }" ]
[ "0.75759107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.6212907", "0.6023352", "0.5380078", "0.5353892", "0.51901764", "0.51652426", "0.51560676", "0.51553196", "0.51521516", "0.5081616", "0.5071421", "0.49617413", "0.49269313", "0.49133587", "0.48944157", "0.4878433", "0.4837329", "0.48309118", "0.47966492", "0.47868827", "0.47665605", "0.47522134", "0.47176787", "0.4711026", "0.47075826", "0.46662635", "0.4659665", "0.4653105", "0.46207845", "0.46087804", "0.4606422", "0.45481262", "0.45448548", "0.45439053", "0.4521255", "0.4521255", "0.44978923", "0.44903508", "0.44453615", "0.44385377", "0.44118324" ]
0.77954704
28
Simulate forces and update node and label positions on tick.
function tick(e) { node .each(bias(e.alpha * 105)) .each(collide(.5)) .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; }); label .style("left", function(d) { return (d.x - d.dx / 2) + "px"; }) .style("top", function(d) { return (d.y - d.dy / 2) + "px"; }); arrow.style("stroke-opacity", function(d) { var dx = d.x - d.cx, dy = d.y - d.cy; return dx * dx + dy * dy < d.r * d.r ? 1: 0; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tickPhysics()\n{\n n_recalculateTorques(rootNode);\n n_applyTorques(rootNode);\n n_updatePositions(rootNode);\n}", "function tick(e) {\n\t // make sure the force gets smaller as the simulation runs\n\t var ky = 10 * e.alpha;\n\t \n\t root.nodes.forEach(function(d, i) {\n\t\t// fix the x value at the depth of the node\n\t\t// and add in the radius of the first node\n\t\ti!=0 ? d.x = d.fixed_x + root.nodes[0].radius+50 : d.x = d.fixed_x + root.nodes[0].radius;\n\t\t// move low prob nodes down\n\t\t// and keep the groups together (to a lesser extent)\n\t\tif (root.nodes[1].value > root.nodes[2].value) { \n\t\t j = 1;\n\t\t} else {\n\t\t j = -1;\n\t\t}\n\t\t// the amount to move the node\n\t\tdelta_y = (3 * d.value - j * .3 * d.group + .3) * ky;\n\t\t// store the old position in case something goes wrong\n\t\t// the collision detection can casue NaNs and I am not sure why\n\t\td.y_old = d.y;\n\t\t// check to make sure the node is not outside the plot area\n\t\t// if it is change the direction of the push\n\t\tif ((d.y-d.radius<0 && delta_y>0) || (d.y+d.radius>height && delta_y<0)) {\n\t\t delta_y *= -1\n\t\t}\n\t\td.y -= delta_y;\n\t });\n\n\t // Also do collision detection after a few itterations\n\t if (e.alpha<0.05) {\n\t\tvar q=d3.geom.quadtree(root.nodes),\n\t\t i=0,\n\t\t n=root.nodes.length;\n\t\twhile (++i < n) q.visit(collide(root.nodes[i]));\n\t }\n\t \n\t // if the new position is NaN use the previous position\n\t // this prevents links for disappearing\n\t root.nodes.forEach( function(d) {\n\t\tif (isNaN(d.y)) { d.y = d.y_old; }\n\t });\n\t \n\t // Translate the node group to the new position\n\t gnode.attr(\"transform\", function(d) {\n\t\treturn 'translate(' + [d.x, d.y] + ')'; \n\t }); \n\t link.attr(\"d\",diagonal);\n\t}", "function tick(e){\n // First let's reposition the nodes. As the force\n // layout runs it updates the `x` and `y` properties\n // that define where the node should be positioned.\n // To move the node, we set the appropriate SVG\n // attributes to their new values. \n node.style('left', function (d) { return d.x + 'px'; })\n .style('top', function (d) { return d.y + 'px'; })\n .call(force.drag);\n \n // We also need to update positions of the links.\n // For those elements, the force layout sets the\n // `source` and `target` properties, specifying\n // `x` and `y` values in each case.\n link.attr('x1', function(d){ return d.source.x})\n .attr('y1',function(d){ return d.source.y})\n .attr('x2', function(d){ return d.target.x})\n .attr('y2',function(d){ return d.target.y})\n .attr(\"stroke-width\", function(d){ return d.opacity*5; })\n .attr(\"stroke\", function(d){ \n \tif(d.color = \"positive\")\n \t\treturn \"green\";\n \telse\n \t\treturn \"red\";\n })\n }", "function tick(e) {\n\t // make sure the force gets smaller as the simulation runs\n\t var kx = 10 * e.alpha;\n\t \n\t root.nodes.forEach(function(d, i) {\n\t\t // fix the y value at the depth of the node\n d.y = d.fixed_y ? d.fixed_y - .5*origin_y : d.fixed_y;\n\t\t // move low prob nodes left\n\t\t // and keep the groups together (to a lesser extent)\n\t\t if (root.nodes[1].value > root.nodes[2].value) { \n\t\t j = 1;\n\t\t } else {\n\t\t j = -1;\n\t\t }\n\t\t // the amount to move the node\n\t\t delta_x = (3 * d.value - j * .3 * d.group + .3) * kx;\n\t\t // store the old position in case something goes wrong\n\t\t // the collision detection can casue NaNs and I am not sure why\n\t\t d.x_old = d.x;\n\t\t // check to make sure the node is not outside the plot area\n\t\t // if it is change the direction of the push\n\t\t if ((d.x-d.radius<0 && delta_x>0) || (d.x+d.radius>height && delta_x<0)) {\n\t\t delta_x *= -1\n\t\t }\n\t\t d.x -= delta_x;\n\t });\n\n\t // Also do collision detection after a few itterations\n\t if (e.alpha<0.05) {\n\t\t var q=d3.geom.quadtree(root.nodes),\n\t\t i=0,\n\t\t n=root.nodes.length;\n\t\t while (++i < n) q.visit(collide(root.nodes[i]));\n\t }\n\t \n\t // if the new position is NaN use the previous position\n\t // this prevents links for disappearing\n\t root.nodes.forEach( function(d) {\n\t\t if (isNaN(d.x)) { d.x = d.x_old; }\n\t });\n\t \n\t // Translate the node group to the new position\n\t gnode.attr(\"transform\", function(d) {\n\t\t return 'translate(' + [d.x, d.y] + ')'; \n\t }); \n\t link.attr(\"d\",diagonal);\n\t }", "function update() {\n updateLinks();\n updateDummyLinks();\n updateNodes(); \n\n // sets the graph in motion\n force\n .nodes(dataset.nodes)\n .force(\"link\").links(dataset.edges);\n\n force.alphaTarget(0.3).restart();\n}", "function tick() {\n // Update SVG size\n updateSvgSize();\n svgPointer.attr('height', height)\n .attr('width', width);\n simulationPointer.force('centre', d3.forceCenter(width / 2, height / 2));\n\n // Update circle positions\n circlePointer.attr('transform', function(d) {\n d.x = Math.max(RADIUS, Math.min(width - RADIUS, d.x));\n d.y = Math.max(RADIUS, Math.min(height - RADIUS, d.y));\n return 'translate(' + d.x + ',' + d.y + ')'\n });\n\n // update image positions\n imagePointer.attr('transform', function(d) {\n d.x = Math.max(20, Math.min(width - 20, d.x));\n d.y = Math.max(25, Math.min(height - 10, d.y));\n let cenX = imagePointer.node(d).getBBox().width / 2;\n let cenY = imagePointer.node(d).getBBox().height / 2;\n if(d.orientation === \"ReverseComp\") {\n return `translate(${d.x}, ${d.y}) rotate(180, ${cenX}, ${cenY})`;\n }\n return `translate(${d.x}, ${d.y})`;\n });\n\n // update tooltip positions for node representation\n textPointer.attr('transform', function(d) {\n d.x = Math.max(RADIUS, Math.min(width - RADIUS, d.x));\n d.y = Math.max(RADIUS, Math.min(height - RADIUS, d.y));\n return 'translate(' + d.x + ',' + d.y + ')'\n });\n\n // Update link positions\n linkPointer.attr('d', updateLinks);\n}", "function tickActions() {\n //update circle positions each tick of the simulation\n var node = d3.select(\"g.nodes\").selectAll(\"circle\");\n\n node\n .attr(\"cx\", function(d) { return d.x; })\n .attr(\"cy\", function(d) { return d.y; });\n\n //update link positions\n //simply tells one end of the line to follow one node around\n //and the other end of the line to follow the other node around\n\n var link = d3.selectAll(\"line\");\n link\n .attr(\"x1\", function(d) { return d.source.x; })\n .attr(\"y1\", function(d) { return d.source.y; })\n .attr(\"x2\", function(d) { return d.target.x; })\n .attr(\"y2\", function(d) { return d.target.y; });\n\n}", "function tick(e) {\n node\n .each(gravity(e.alpha * .1))\n .each(collide(.5))\n .attr(\"transform\", function(d) { return \"translate(\" + d.x + \",\" + d.y + \")\"; });\n\n label\n .style(\"left\", function(d) { return (d.x - d.dx / 2) + \"px\"; })\n .style(\"top\", function(d) { return (d.y - d.dy / 2) + \"px\"; });\n}", "tick()\n {\n this.update();\n }", "function tick(e) {\n node\n .each(gravity(e.alpha * .1))\n .each(collide(.5))\n .attr(\"transform\", function(d) {\n return \"translate(\" + d.x + \",\" + d.y + \")\";\n });\n\n label\n .style(\"left\", function(d) {\n return (d.x - d.dx / 2) + \"px\";\n })\n .style(\"top\", function(d) {\n return (d.y - d.dy / 2) + \"px\";\n });\n }", "tick() {\n this._update();\n }", "update() {\n // override to add custom forces before World step\n }", "function tick(e) {\n for ( i = 0; i < nodes.length; i++ ) {\n var node = nodes[i];\n /*\n * Animate the radius via the tick.\n *\n * Typically this would be performed as a transition on the SVG element itself,\n * but since this is a static force layout, we must perform it on the node.\n */\n node.radius = node.idealradius - node.idealradius * e.alpha * 10;\n node = gravity(.2 * e.alpha)(node);\n node = collide(.5)(node);\n node.cx = node.x;\n node.cy = node.y;\n }\n}", "tick() {\n\t\tthis.ticks++;\n\t\tthis.update();\n\t}", "function updateForces() {\n // get each force by name and update the properties\n simulation.force(\"center\")\n .x(width * forceProperties.center.x)\n .y(height * forceProperties.center.y);\n simulation.force(\"charge\")\n .strength(forceProperties.charge.strength * forceProperties.charge.enabled)\n .distanceMin(forceProperties.charge.distanceMin)\n .distanceMax(forceProperties.charge.distanceMax);\n simulation.force(\"collide\")\n .strength(forceProperties.collide.strength * forceProperties.collide.enabled)\n .radius(forceProperties.collide.radius)\n .iterations(forceProperties.collide.iterations);\n simulation.force(\"forceX\")\n .strength(forceProperties.forceX.strength * forceProperties.forceX.enabled)\n .x(width * forceProperties.forceX.x);\n simulation.force(\"forceY\")\n .strength(forceProperties.forceY.strength * forceProperties.forceY.enabled)\n .y(height * forceProperties.forceY.y);\n simulation.force(\"link\")\n .id(function (d) {\n return d.id;\n })\n .distance(forceProperties.link.distance)\n .iterations(forceProperties.link.iterations)\n .links(forceProperties.link.enabled ? graph.links : []);\n\n // updates ignored until this is run\n // restarts the simulation (important if simulation has already slowed down)\n simulation.alpha(1).restart();\n}", "function tick () {\n console.log('mario x position', window.nes.ppu.spriteMem[23])\n console.log('mario y position', window.nes.ppu.spriteMem[28])\n console.log('luigi x position', window.nes.ppu.spriteMem[43])\n console.log('luigi y position', window.nes.ppu.spriteMem[48])\n }", "tickActions() {\n this.tickCounter += 1;\n\n // Keeps my node static and centered\n this.meNode\n .attr('transform', (d) => {\n d.vx = 0;\n d.vy = 0;\n d.x = this.w / 2;\n d.y = this.h / 2;\n return `translate(${d.x}, ${d.y})`;\n });\n\n\n // Calculate the current total velocity in the simulation\n let totalVelocity = 0;\n this.linkNode\n .attr('transform', (d) => {\n totalVelocity += Math.abs(d.vx) + Math.abs(d.vy);\n });\n\n // Moves the link nodes forward\n this.linkNode\n .attr('transform', (d) => {\n // Store the node's position every 25 ticks in lx (last x) and ly (last y)\n // We use these in several different ways for the drag functionality\n if (this.tickCounter % 25 === 0) {\n d.lx = d.x;\n d.ly = d.y;\n }\n\n // When the total simulation's velocity goes outside of our\n // set range, this gradually brings it back\n if (totalVelocity < 3) {\n d.vx *= 1.003;\n d.vy *= 1.003;\n } else if (totalVelocity > 30) {\n d.vx *= 0.997;\n d.vy *= 0.997;\n }\n\n // Basic pythagorean calculation to find distance from mouse to center of node\n const a = this.mouseX - d.x;\n const b = this.mouseY - d.y;\n const c = Math.sqrt(a * a + b * b);\n\n // If a node is frozen and the mouse is inside of it then don't move it\n if (d.frozen) {\n if (c <= d.r) {\n d.vx = 0;\n d.vy = 0;\n }\n }\n\n // Keeps nodes within the boudaries of the screen\n if (d.x > this.w - d.r) {\n d.x = this.w - d.r;\n }\n if (d.x < d.r) {\n d.x = d.r;\n }\n if (d.y > this.h - d.r) {\n d.y = this.h - d.r;\n }\n if (d.y < d.r) {\n d.y = d.r;\n }\n\n return `translate(${d.x}, ${d.y})`;\n });\n\n this.force.restart();\n }", "handleTick() {\n this.update()\n this.draw()\n }", "tick() {\n let currentState = this.state;\n this.step++;\n this.state = this.updateState(currentState);\n this.updateElements();\n if (!this.stable && this.running) {\n setTimeout(() => {\n this.tick();\n }, 200);\n }\n }", "function layout_tick() {\n\n // update rect position on drag\n if (mousedown && svg.classed('ctrl')) {\n updateNodePositions();\n drawPaths();\n updateDistances();\n }\n}", "function updateSimulation() {\n\t if (shouldSkipUpdate()) return;\n\n\t g_ball.update();\n\t g_ball2.update();\n\t g_paddle1.update();\n\t g_paddle2.update();\n}", "function tick(e){\n\t\tlabelForce.start();\n\t\tvar k = 0.03 * e.alpha;\n\t\tvar kY = 0.05;\n\n\n\t\tnodes\n\t\t\t.attr(\"cx\", function(d) {\n\t\t\t\tif (d.outside.isOutside){\t\t\n\t\t\t\t\tvar tmpXOffset = Math.max(Math.min(xOffset, maxXOfferset) - leftPanelWidth, 0);\t\t\n\t\t\t\t\treturn d.x = Math.max(tmpXOffset + nodeRadius + d.labelWidth / 2, Math.min(tmpXOffset + windowWidth - nodeRadius - d.labelWidth / 2, d.x));\n\t\t\t\t} \n\t\t\t\tif (d.isTemporary){\t\t\n\t\t\t\t\tvar tmpXOffset = Math.max(Math.min(xOffset, maxXOfferset) - leftPanelWidth, 0);\t\t\n\t\t\t\t\treturn d.x = Math.max(tmpXOffset + nodeRadius + d.labelWidth / 2, Math.min(tmpXOffset + windowWidth - nodeRadius - d.labelWidth / 2, d.x));\n\t\t\t\t} \n\t\t\t\tvar differX = d.position.x - d.x;\n\t\t\t\tif (d.type == \"anchor\"){\n\t\t\t\t\td.x += differX * kY;\n\t\t\t\t\tif (Math.abs(d.position.x - d.x) < 20){\n\t \t\t\td.x = d.position.x;\n\t \t\t}\n\t\t\t\t} else {\n\t \t\t\td.x += differX * kY;\n\t\t\t\t}\n\t \t\treturn d.x;\n\t \t})\n\t .attr(\"cy\", function(d) { \n\t \tif (d.outside.isOutside){\n\t \t\td.y += -d.y * k;\n\t \t\treturn d.y = Math.max(nodeRadius + 12, Math.min(height - nodeRadius, d.y));\n\t \t}\n\t \tvar differY = d.position.y - d.y;\n\t \tif (d.type == \"anchor\"){\n\t \t\td.y += differY * kY;\n\t \t\tif (Math.abs(d.position.y - d.y) < 20 || d.y >= height - nodeRadius){\n\t \t\t\td.y = d.position.y;\n\t \t\t}\n\t \t} else {\n\t \t\td.y += differY * kY;\n\t \t}\n\t \treturn d.y = Math.max(nodeRadius, Math.min(height - nodeRadius, d.y));\n\t });\n\t \n\n\n\t labels.each(function(d, i){\n\t \tif (i % 2 == 0){\n\t \t\tif (d.type == \"linkCircle\"){\n\t\t \t\tvar a = nodesData[d.node.src];\n\t\t \t\tvar b = nodesData[d.node.tgt];\n\t\t \t\td.y = (a.y + b.y) / 2;\n\t\t \t\td.x = (a.x + b.x) / 2 + (nodesData[d.node.tgt].x - nodesData[d.node.src].x) / 6;\n\t\t \t\t/*var i, j;\t\t\t\n\t\t\t\t\tfor (i = 0; i < 1; i += 0.1){\n\t\t\t\t\t\tif (getXofLabel(d, i, d.y)){\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ti -= 0.1;\n\t\t\t\t\tfor (j = 0; j < 0.1; j += 0.01){\n\t\t\t\t\t\tif (getXofLabel(d, i + j, d.y)){\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t} \t*/\n\n\t\t \t\t\t \t\t\n\t \t\t} else if (d.type == \"edgeLinkCircle\"){\n\t \t\t\tvar a = d.node.src;\n\t \t\t\tvar b = nodesData[d.node.tgt];\n\t \t\t\td.x = (a.x + b.x) / 2 + (b.x - a.x) / 6;\n\t \t\t\td.y = (a.y + b.y) / 2;\n\t \t\t} else {\n\t \t\t\td.x = d.node.x;\n\t \t\t\td.y = d.node.y;\n\t \t\t} \n\t \t} else {\n\t\t\t\tvar dx = textData[i - 1].x;\n\t\t\t\tvar dy = textData[i - 1].y;\n\t\t\t\td.y = dy;\n\t\t\t\td.x = dx;\n\t \t}\n\t\t})\n\n\t //if (!firstTime){\n\t \tlinks.call(updateLink);\n\t \tlabels.call(updateLabel);\n\t \tlabelLinks.call(updateLabelLink); \t\n\t\t//}\n\t}", "function requestTick() {\n\tif (!ticking) {\n\t\trequestAnimationFrame(updatePositions);\n\t}\n\tticking = true;\n}", "function tick() {\n // update the links\n path.select(\".link\").attr(\"d\", function(d) {return getPath(d, 0)});\n // update the link labels\n path.select(\".linklabel\").attr(\"transform\", function(d) {\n if (d.target.x<d.source.x){\n bbox = this.getBBox();\n rx = bbox.x+bbox.width/2;\n ry = bbox.y+bbox.height/2;\n return \"rotate(180 \"+rx+\" \"+ry+\")\";\n }\n else {\n return \"rotate(0)\";\n }\n });\n \n // update dummy links\n dummyPath.select(\".link\").attr(\"d\", function(d) {return getPath(d, 1)});\n // update dummy link labels\n dummyPath.select(\".linklabel\").attr(\"transform\", function(d) {\n if (d.target.x<d.source.x){\n bbox = this.getBBox();\n rx = bbox.x+bbox.width/2;\n ry = bbox.y+bbox.height/2;\n return \"rotate(180 \"+rx+\" \"+ry+\")\";\n }\n else {\n return \"rotate(0)\";\n }\n });\n\n // update nodes\n rect.attr(\"transform\", (d) => `translate(${d.x - (d.w/2)},${d.y - (d.h)/2})`); \n}", "function doForceField(nodes) {\n\tvar deltas = [];\n\tfor (var i = 0; i < nodes.length * 2; i++)\n\t\tdeltas.push(0.0);\n\t\n\t// For simplicitly, we perturb positions directly, instead of velocities\n\tfor (var i = 0; i < nodes.length; i++) {\n\t\tvar nodeA = nodes[i];\n\t\tfor (var j = 0; j < i; j++) {\n\t\t\tvar nodeB = nodes[j];\n\t\t\tvar dx = nodeA.posX - nodeB.posX;\n\t\t\tvar dy = nodeA.posY - nodeB.posY;\n\t\t\tvar distSqr = dx * dx + dy * dy;\n\t\t\t// Notes: The factor 1/sqrt(distSqr) is to make (dx, dy) into a unit vector.\n\t\t\t// 1/distSqr is the inverse square law, with a smoothing constant added to prevent singularity.\n\t\t\tvar factor = repulsionForce / (Math.sqrt(distSqr) * (distSqr + 0.00001));\n\t\t\tdx *= factor;\n\t\t\tdy *= factor;\n\t\t\tdeltas[i * 2 + 0] += dx;\n\t\t\tdeltas[i * 2 + 1] += dy;\n\t\t\tdeltas[j * 2 + 0] -= dx;\n\t\t\tdeltas[j * 2 + 1] -= dy;\n\t\t}\n\t}\n\tfor (var i = 0; i < nodes.length; i++) {\n\t\tnodes[i].posX += deltas[i * 2 + 0];\n\t\tnodes[i].posY += deltas[i * 2 + 1];\n\t}\n}", "function animate() {\n updatePhysics();\n}", "update(delta, force)\n\t{\n\t\tdelta = delta / this.tree.theme.nodeSmoothing;\n\n\t\tif (this.dragging)\n\t\t\tthis.posSmooth.lerpTo(this.snapPos, delta);\n\t\telse\n\t\t\tthis.posSmooth.lerpTo(this.position, delta);\n\n\t\tthis.input.update();\n\t}", "onTick() {\n\n this.factorIncrements();\n\n var event = new Event('tick', this);\n document.dispatchEvent(event);\n }", "function update(data) {\n console.log('New Dataset Force: ', data);\n\n // Sort the nodes so that the bigger ones are at the back\n // https://bl.ocks.org/\n data = data.sort(function (a, b) {\n var sizeA = 0,\n sizeB = 0;\n sizeA = a.values[3].values[0].value;\n sizeB = b.values[3].values[0].value;\n\n return sizeB - sizeA;\n });\n\n // Bind data to nodes\n node = node.data(data);\n\n // Use General Update Pattern\n // Exit and remove unused nodes \n node.exit().transition().duration(100).attr('r', 1e-6).remove();\n\n // Update existing nodes\n node.transition().duration(100).attr('r', function (d) {\n return d.values[3].values[0].value + 1;\n });\n\n // Draw nodes\n node = node.enter().append('circle').attr('r', function (d) {\n return d.values[3].values[0].value / 1.25 + 1;\n }).attr('fill', function (d) {\n return color(d.values[3].values[0].value);\n }).style('cursor', 'pointer').merge(node).on('mouseover', handleMouseOver).on('mouseout', handleMouseOut).on('click', handleClick);\n\n // https://bl.ocks.org/\n // Dragging interactions\n node.call(d3.drag().on('start', dragstarted).on('drag', dragged).on('end', dragended));\n\n // Update the simulation based on the data\n simulation.nodes(data).force('collide', d3.forceCollide().strength(0.5).radius(function (d) {\n return d.values[3].values[0].value + 2.5;\n }).iterations(1)).on('tick', function (d) {\n node.attr('cx', function (d) {\n return d.x;\n }).attr('cy', function (d) {\n return d.y;\n });\n });\n }", "function beginp() {\n\tfor(let node of g.foundNodes) { // calculate forces\n\t\tnode.ibox.xacc=0;\n\t\tnode.ibox.yacc=0;\n\t}\n\tfor(let node of g.foundNodes) { // calculate forces\n\t\tnode.ibox.sumForces();\n\t}\n\tfor(let node of g.foundNodes) { // apply forces\n\t\tnode.ibox.applyForces();\n\t}\n}", "function tick() {\n\n\n\n}", "function update() {\r\n try {\r\n resetforces(); //Set all forces to zero at the beginning of each frame\r\n applyforces(); //Apply electrostatic forces between particles based on their charge and distance\r\n updateparticles(); //Update the velocities and positions of each particle\r\n containparticles(); //Keep the particles inside the screen\r\n requestAnimationFrame(draw); //Draw the particles\r\n } catch (e) {\r\n $(\"#divLogEventos\").append(\"Error: \" + e.message);\r\n }\r\n }", "function render() {\n\t// Clear all trails\n\td3.selectAll('.trails').selectAll('*').remove();\n\n const sim = state.forceSim;\n\n // Initial state\n sim.nodes(balls);\n\n setTimeout(() => {\n // Apply future\n balls.filter(ball => ball.future).forEach(ball => {\n Object.keys(ball.future).forEach(attr => { ball[attr] = ball.future[attr]});\n });\n }, 800);\n\n}", "_tick() {\n this._model.time++;\n }", "function tick() {\n localizer.tick();\n robot.resetOdometer();\n }", "function tick(e) {\n var r = nodeR(w,h);\n //Drags node in intended direction & Push Nodes within Boundary:\n link.attr(\"x1\", function(d) { return d.source.x = Math.max(r, Math.min(w-r, d.source.x))})\n .attr(\"y1\", function(d) { return d.source.y = Math.max(r, Math.min(h-r, d.source.y))})\n .attr(\"x2\", function(d) { return d.target.x = Math.max(r, Math.min(w-r, d.target.x))})\n .attr(\"y2\", function(d) { return d.target.y = Math.max(r, Math.min(h-r, d.target.y))});\n gnode.attr(\"transform\", function(d) { return 'translate(' + [d.x = Math.max(r, Math.min(w - r, d.x)), d.y= Math.max(r, Math.min(h - r, d.y))] + ')'; });\n }", "function refreshParticleForce() {\n\tvar force = $(\"#forceSlider\").slider(\"value\");\n\t$(\"#forceLabel\").text(force);\n\t\n\tparticle_force = force / 1000;\n\t\n\tReloadWebGL();\n}", "function tick () {\n if (!ticking) return\n\n // Some browsers call events a little too frequently, refuse to run more than is reasonable\n if (last_tick && (now() - last_tick) < 10) {\n raf.call(window, tick)\n return\n }\n\n last_tick = now()\n position()\n\n // tick again...\n raf.call(window, tick)\n }", "tick() {\n \n }", "function prepareForce () {\n svg = d3.select(\"graph\").append(\"svg\")\n .attr(\"id\", \"graph-svg\")\n .attr(\"class\", \"canvas\")\n .attr(\"width\", \"100%\")\n .attr(\"height\", height);\n\n simulation = d3.forceSimulation();\n simulation\n .force(\"charge\", d3.forceManyBody().strength(-550))\n .force(\"center\", d3.forceCenter(width * 3 / 5, height * 3 / 5))\n .force(\"x\", d3.forceX())\n .force(\"y\", d3.forceY())\n .alpha(1)\n .alphaTarget(0.5)\n .velocityDecay(0.55);\n\n g = svg.append(\"g\")\n .attr(\"class\", \"everything\");\n\n link = g.append(\"g\")\n .attr(\"class\", \"links\")\n .selectAll(\"line\");\n\n node = g.append(\"g\")\n .attr(\"class\", \"nodes\")\n .selectAll(\"circle\");\n\n label = g.append(\"g\")\n .attr(\"class\", \"labels\")\n .selectAll(\"text\");\n}", "function gameTick(dt) {\n\tvar i, agent;\n\n\t//Calculate steering and flocking forces for all agents\n\tfor (i = agents.length - 1; i >= 0; i--) {\n\t\tagent = agents[i];\n\n\t\t//Work out our behaviours\n\t\tvar ff = steeringBehaviourSeek(agent, destinations[agent.group]);\n\t\tvar sep = steeringBehaviourSeparation(agent);\n\t\tvar alg = steeringBehaviourAlignment(agent);\n\t\tvar coh = steeringBehaviourCohesion(agent);\n\t\tvar avd = steeringBehaviourAvoid(agent);\n\n\t\t//For visually debugging forces agent.forces = [ff.Copy(), sep.Copy(), alg.Copy(), coh.Copy()];\n\n\t\tagent.forceToApply = ff.Add(sep.Multiply(1.2)).Add(alg.Multiply(0.3)).Add(coh.Multiply(0.05)).Add(avd.Multiply(10));\n\n\t\tvar lengthSquared = agent.forceToApply.LengthSquared();\n\t\tif (lengthSquared > agent.maxForceSquared) {\n\t\t\tagent.forceToApply.Multiply(agent.maxForce / Math.sqrt(lengthSquared));\n\t\t}\n\t}\n\n\t//Move agents based on forces being applied (aka physics)\n\tfor (i = agents.length - 1; i >= 0; i--) {\n\t\tagent = agents[i];\n\n\t\t//Apply the force\n\t\t//console.log(i + ': ' + agent.forceToApply.x + ', ' + agent.forceToApply.y);\n\t\tagent.body.ApplyImpulse(agent.forceToApply.Multiply(dt), agent.position());\n\n\t\t//Calculate our new movement angle TODO: Should probably be done after running step\n\t\tagent.rotation = agent.velocity().Angle();\n\t}\n\n\tworld.Step(dt, 10, 10);\n\tworld.ClearForces();\n}", "function tick() {\n requestAnimationFrame(tick);\n\n drawScene();\n animate();\n}", "function graphRepositionNodes () {\n for (var nodeId in this.calculationNodes) {\n if (this.calculationNodes.hasOwnProperty(nodeId)) {\n this.calculationNodes[nodeId].vx = 0; this.calculationNodes[nodeId].vy = 0;\n this.calculationNodes[nodeId].fx = 0; this.calculationNodes[nodeId].fy = 0;\n }\n }\n if (this.constants.hierarchicalLayout.enabled == true) {\n this._setupHierarchicalLayout();\n showValueOfRange.call(this, 'graph_H_nd', 1, \"physics_hierarchicalRepulsion_nodeDistance\");\n showValueOfRange.call(this, 'graph_H_cg', 1, \"physics_centralGravity\");\n showValueOfRange.call(this, 'graph_H_sc', 1, \"physics_springConstant\");\n showValueOfRange.call(this, 'graph_H_sl', 1, \"physics_springLength\");\n showValueOfRange.call(this, 'graph_H_damp', 1, \"physics_damping\");\n }\n else {\n this.repositionNodes();\n }\n this.moving = true;\n this.start();\n }", "function ticked() {\n link.attr(\"d\", positionLink);\n node.attr(\"transform\", positionNode);\n }", "function tick () {\n // update all other player's data\n tickOtherPlayers();\n\n // update this clients player data\n OasisPlayer.tick();\n\n // update the game camera\n OasisCamera.tick();\n}", "function tick() {\r\n\trequestAnimFrame(tick);\r\n\tdraw();\r\n\tanimate();\r\n}", "function draw() {\n textFont('Trebuchet MS');\n background('#181818');\n //If menu is not running run the simulation\n if (show_menu == 0) {\n menu_created = 0;\n //Check if slider values have changed and update the stars accordingly. This can be done even while paused\n //Still display sliders and stars while paused but not while in the menu\n for (var index = 0; index < N; index++) {\n if (sliders[index].value() != masses[index]) {\n masses[index] = sliders[index].value() / scale_mass_slider;\n stars[index].m = masses[index];\n stars[index].r = scale_radius * sqrt(masses[index]);\n //reset(); //May choose to reset with slider change but it is nice to change sizes within the same simulation\n }\n noStroke();\n fill(220);\n text(\"Mass \" + (index + 1), sliders[index].x * 2 + sliders[index].width, 35 + 30 * index);\n }\n //Code runs when not paused this is the active portion of the sim\n if (paused == 0) {\n if (binary_flag == 0 && binary_flag_planet == 0) {\n dt = initial_dt;\n }\n //The primary physics engine generalized for N bodies\n var positions_copy = positions;\n var velocities_copy = velocities;\n var acceleration_copy = accelerations;\n //Physics! Still time stepped but fairly effectively. Need to work on singularities more\n for (var primary = 0; primary < masses.length; primary++) {\n //Update positions\n positions[primary].x = positions_copy[primary].x + velocities_copy[primary].x / KM_PER_AU * AU * dt;\n positions[primary].y = positions_copy[primary].y + velocities_copy[primary].y / KM_PER_AU * AU * dt;\n accelerations[primary].x = 0;\n accelerations[primary].y = 0;\n for (var secondary = 0; secondary < masses.length; secondary++) {\n if (primary != secondary) {\n norm3 = pow(sqrt(pow(positions_copy[secondary].x - positions_copy[primary].x, 2) + pow(positions_copy[secondary].y - positions_copy[primary].y, 2)) * scale_distance, 3);\n accelerations[primary].x += G * masses[secondary] * (positions_copy[secondary].x - positions_copy[primary].x) * scale_distance / (norm3 * KM_PER_SOLARRADIUS);\n accelerations[primary].y += G * masses[secondary] * (positions_copy[secondary].y - positions_copy[primary].y) * scale_distance / (norm3 * KM_PER_SOLARRADIUS);\n }\n }\n //console.log('x ' + accelerations[primary].x);\n //console.log('y ' + accelerations[primary].y);\n //Handle singularities \n //Rails accelerations at a threshold value. This could be edited if needed\n //We may want to handle singularities in the looping portion to isolate contributions from each star\n if (accelerations[primary].x > singularity_threshold) {\n accelerations[primary].x = singularity_threshold;\n }\n if (accelerations[primary].x < (-1 * singularity_threshold)) {\n accelerations[primary].x = -1 * singularity_threshold;\n }\n if (accelerations[primary].y > singularity_threshold) {\n accelerations[primary].y = singularity_threshold;\n }\n if (accelerations[primary].y < (-1 * singularity_threshold)) {\n accelerations[primary].y = -1 * singularity_threshold;\n }\n // console.log('x_railed ' + accelerations[primary].x);\n // console.log('y_railed ' + accelerations[primary].y);\n //Update velocities\n velocities[primary].x = velocities_copy[primary].x + accelerations[primary].x * dt;\n velocities[primary].y = velocities_copy[primary].y + accelerations[primary].y * dt;\n }\n //if (console_flag % 10 == 0) {\n //console.log('vX ' + velocities[0].x);\n //console.log('vY ' + velocities[0].y);\n //console.log('aX ' + accelerations[0].x);\n //console.log('aY ' + accelerations[0].y);\n //}\n //console_flag += 1;\n //See planet physics function, similar to above physics\n doPlanetPhysics();\n }\n var reset_flag = 0;\n //update the positions and draw stars\n //still runs while paused so that stars still appear\n for (var index = 0; index < N; index++) {\n stars[index].update_position(positions[index]);\n stars[index].draw_path();\n stars[index].draw();\n if (abs(positions[index].x) > windowWidth / 2 || abs(positions[index].y) > windowHeight / 2) {\n reset_flag++;\n }\n }\n //reset the simulation if all stars are off the screen\n if (reset_flag == N && N != 0) {\n reset();\n }\n\n //draw planets\n for (var index = 0; index < M; index++) {\n planets[index].update_position(planet_positions[index]);\n //comment out line bellow to remove planet paths\n planets[index].draw_path();\n planets[index].draw();\n }\n //update time\n t += dt;\n }\n //menu\n else {\n //delete everything\n for (var index = 0; index < sliders.length; index++) {\n sliders[index].remove();\n }\n pause_button.remove();\n start_button.remove();\n menu_button.remove();\n randomize_button.position(20, 20);\n //generate the star number input, this will not work if it is continuously being referenced, hence the if statement\n if (menu_created == 0) {\n createMenu();\n }\n menu_created = 1;\n //generate text for the star and planet inputs\n for (var index = 0; index < input_mass_sliders.length; index++) {\n text(\"Star \" + (index + 1), input_mass_sliders[index].x, 95);\n text(\"Mass\", input_mass_sliders[index].x, 115);\n text(\"Initial X Position\", input_mass_sliders[index].x, 170);\n text(\"Initial Y Position\", input_mass_sliders[index].x, 220);\n text(\"Initial X Velocity\", input_mass_sliders[index].x, 270);\n text(\"Initial Y Velocity\", input_mass_sliders[index].x, 320);\n }\n //for troubleshooting\n //console.log(M);\n for (var index = 0; index < planet_input_masses.length; index++) {\n text(\"Mass of Planet \" + (index + 1), planet_input_masses[index].x, 370);\n text(\"Initial X Position\", planet_input_masses[index].x, 420);\n text(\"Initial Y Position\", planet_input_masses[index].x, 470);\n text(\"Initial X Velocity\", planet_input_masses[index].x, 520);\n text(\"Initial Y Velocity\", planet_input_masses[index].x, 570);\n }\n }\n //for troubleshooting\n if (console_flag % 5 == 0) {\n //console.log('X ' + planet_accelerations[0].x);\n //console.log('Y ' + planet_accelerations[0].y);\n }\n console_flag += 1;\n}", "refreshFromPhysics() {}", "refreshFromPhysics() {}", "_ticked() {\n this._tickedLink()\n this._tickedTermPoint()\n this._tickedNode()\n }", "function tick(e) {\n this.x = this.body.GetPosition().x * SCALE;\n this.y = this.body.GetPosition().y * SCALE;\n }", "refreshToPhysics() {}", "refreshToPhysics() {}", "function tick() {\r\n buildSnake();\r\n}", "update() {\n for(let i=0; i<Simulation.speed; i++) {\n globalUpdateCount += 1\n this.fields.forEach(f => f.update())\n this.sender.auto()\n this.sender.update()\n this.updateR()\n this.chart.update(this.fields, this.sender)\n }\n }", "function tick() {\n\n ///Respond differently based on the game state\n timerID = setTimeout(tick, 33); ///Restart the timer\n\n var currentTime = new Date(); ///Get the current time\n var now = currentTime.getTime(); ///Get the current time in milliseconds\n\n //Update the global model\n update();\n\n\n drawCanvas();\n}", "function requestTick() {\n if (!ticking) {\n requestAnimationFrame(update);\n ticking = true;\n }\n }", "function onTick() {\n var t0 = currentTime();\n var t1, t2;\n var dt = 1 / 30; // seconds\n var interval = t0 - last;\n last = t0;\n\n\n simulate();\n // Run the physics simulation\n doPhysics(dt);\n t1 = currentTime();\n\n draw();\n\n // Draw physics debugging info\n var playerPosition = canvasCoordinates(level.player);\n var x = playerPosition.x - screenWidth / 2;\n box2DSprite.translate(-x, 0);\n level.world.DrawDebugData();\n box2DSprite.translate(x, 0);\n\n\n t2 = currentTime();\n\n // UI\n codeheart.drawLogo();\n fillText(\"and\", 330, screenHeight - 26, makeColor(0.3, 0.3, 0.3), \"30px Arial\");\n drawImage(BOX2D_LOGO_IMAGE, 400, screenHeight - 70);\n\n fillText(\"Framerate: \" + round(1 / interval) + \" fps\", 50, 50, makeColor(0, 0, 0), \"40px Arial\");\n fillText(\"Physics: \" + round((t1 - t0) * 1000) + \" ms\", 50, 100, makeColor(0, 0, 0), \"40px Arial\");\n fillText(\"Graphics: \" + round((t2 - t1) * 1000) + \" ms\", 50, 150, makeColor(0, 0, 0), \"40px Arial\");\n\n\n}", "function tick()\n{\n\thandleKeys();\n\tdraw();\n\tanimate();\n\trequestAnimationFrame(tick);\n}", "tick() {\n }", "function tick(state) {\n \n let ball = state.canvas.selectAll('circle.ball').data(state.forceSim.nodes());\n\n\tball.exit().remove();\n\n\tball.merge(\n\t\tball.enter().append('circle')\n\t\t\t.classed('ball', true)\n\t\t\t.style('fill', function(d,idx) {\n if (idx == 0) {\n return INFECTED;\n } else {\n return HEALTHY;\n }\n })\n\t)\n\t\t.attr('r', d => d.r || BALL_RADIUS)\n\t\t.attr('cx', d => d.x)\n\t\t.attr('cy', d => d.y)\n .attr('id', (d, idx) => \"ball\"+idx.toString());\n \n\n // Generate live counter\n d3.select(\"span.healthy-count\").text(HEALTHY_COUNT.toString());\n d3.select(\"span.infected-count\").text(INFECTED_COUNT.toString());\n d3.select(\"span.recovered-count\").text(RECOVERED_COUNT.toString());\n d3.select(\"span.time-count\").text(time.toString());\n\n plusTime();\n tick_count++;\n}", "function requestTick() {\n if (ticking === false) {\n requestAnimationFrame(update);\n }\n ticking = true;\n }", "function requestTick() {\n if (ticking === false) {\n requestAnimationFrame(update);\n }\n ticking = true;\n }", "refreshFromPhysics() {\n //2D\n this.position.set(this.physicsObj.position.x,this.physicsObj.position.y);\n }", "function updateSimulation() {\n if (shouldSkipUpdate()) return;\n\n g_ball.update();\n g_ball2.update();\n\n // Uncoment this to see how the font shinks after 100 and 1000 score of pad2\n //randomBalls_update(); \n\n g_paddle1.update();\n g_paddle2.update();\n}", "function tick() {\r\n requestAnimFrame(tick);\r\n draw();\r\n animate();\r\n}", "function tick() {\n // redraw the path of the links given their source/target node positions\n _this.link.attr('d', d => {\n const prevStart = d.start ? d.start : d.source\n const prevEnd = d.end ? d.end : d.target\n const start = _this.getClosestMidpointOnRect(d.target, d.source)\n const end = _this.getClosestPointOnRect(prevStart, d.target)\n d.midX = (start.x + end.x) / 2\n d.midY = (start.y + end.y) / 2\n d.start = start\n d.end = end\n return `M${start.x},${start.y}L${end.x},${end.y}`\n })\n\n _this.lock.attr('x', d => d.midX)\n .attr('y', d => d.midY)\n .attr('transform', d =>\n `translate(${d.midX - 8},${d.midY - 10})scale(.7,.7)`)\n\n // redraw the ndes at their new position\n _this.node.attr('x', d => d.x - _this.props.nodeSize.width / 2)\n .attr('y', d => d.y - _this.props.nodeSize.height / 2)\n\n _this.nodelabels\n .attr('x', d => d.x - _this.props.nodeSize.width / 2 + 6)\n .attr('y', d => d.y - _this.props.nodeSize.height / 2 + 4)\n\n _this.warn\n .attr('transform', d =>\n `translate(${d.x + _this.warnOffset.x},${d.y - _this.warnOffset.y}),scale(0.3,0.3)`)\n\n _this.warnBackground\n .attr('cx', d => d.x + _this.props.nodeSize.width / 2 - 0.5)\n .attr('cy', d => d.y - _this.props.nodeSize.height / 2 + 3.5)\n }", "function tick (e) {\n\t\t// update percent counter\n\t\t$(\"#bookmarklet\").text(Math.floor(1000*(0.1-(Force.force().alpha()))) + 6 + \"%\")\n\n\t\t// for benchmarking\n\t\t// FPS.sample();\n\n\n\t\tnode.call(updateNode);\n\t\tlink.call(updateLink);\n\t}", "function initializeForces() {\n // add forces and associate each with a name\n simulation\n .force(\"link\", d3.forceLink())\n .force(\"charge\", d3.forceManyBody())\n .force(\"collide\", d3.forceCollide())\n .force(\"center\", d3.forceCenter())\n .force(\"forceX\", d3.forceX())\n .force(\"forceY\", d3.forceY());\n // apply properties to each of the forces\n updateForces();\n}", "function tick() {\n node\n .attr('cx', function (d) {\n return d.x;\n })\n .attr('cy', function (d) {\n return d.y;\n });\n\n link\n .attr('x1', function (d) {\n return d.source.x;\n })\n .attr('y1', function (d) {\n return d.source.y;\n })\n .attr('x2', function (d) {\n return d.target.x;\n })\n .attr('y2', function (d) {\n return d.target.y;\n });\n\n text.attr('transform', function (d) {\n return 'translate(' + d.x + ',' + d.y + ')';\n });\n }", "function tick() {\n requestAnimFrame(tick);\n draw();\n handleKeys();\n animate();\n}", "function update() {\n\n force\n .nodes(nodes)\n .links(links)\n .start();\n\n // Draw links\n var link = zoomContainer.selectAll(\".graph.link\")\n .data(links);\n link.enter().append(\"path\")\n .attr(\"class\", \"graph link\");\n link.exit().remove();\n\n // Draw nodes\n var node = zoomContainer.selectAll(\"#node\")\n .data(nodes);\n\n node\n .enter().append(\"g\")\n .attr(\"id\", \"node\")\n //TODO: fade buttons in and out\n //.on('mouseenter', nodeMouseEnter )\n //.on('mouseleave', function() { console.log('out') } )\n .call(force.drag);\n \n node.exit().remove();\n\n // Draw a background shape for the node.\n // The shape of the node is dependant on the type of node being drawn. An SVG path is used\n // to allow for a dynamic shape.\n node.append('path')\n .attr(\"class\", function(d) { return d.nodeType === 'origin' ? 'graph origin' : \"graph node\"; })\n .attr(\"d\", function(d) { \n if( d.nodeType === 'origin' ) {\n return getCirclePath(0, 0, originRadius);\n }else if( d.get('nodeClass') === 'node' ) { \n var r = calculateRadius(d.get('transitions').length);\n return getCirclePath(0, 0, r);\n }else if( d.get('nodeClass') === 'group' ) {\n return getRectPath(150,50);\n }else {\n console.warn('unknown nodeClass : ' + d.get('nodeClass'));\n return '';\n }\n } );\n\n // Label the node with the name of the hypernode\n node \n .append(\"text\")\n .attr(\"x\", 0)\n .attr(\"y\", function(d) { return d.nodeType === 'origin' ? 20 : 8; } )\n\t\t\t.attr(\"text-anchor\", \"middle\")\n\t\t\t.attr(\"class\", \"graph node title\" )\n .text(function( d ) { return d.get('name'); }); \n\n // Draw a plus icon button for adding new transitions\n var createLinkButton = node \n .append('g')\n .attr('style', function(d) { return d.showLinkButton ? 'visibility:hidden' : '' })\n .on('click', function(d) { eventHandler( { type : 'newTransition', data : {sourceId : d.get('id')} }) } )\n .attr('transform', function(d) { return d.nodeType === 'origin' ? 'translate(0,0)' : 'translate(0,40)' } );\n\n createLinkButton\n .append('circle')\n .attr('r', function(d) { return d.nodeType === 'origin' ? 35 : 25 } )\n .attr('class', 'graph node add-link')\n\n createLinkButton.append('text')\n .attr('text-anchor', 'middle')\n .text('+')\n .attr('x', 0)\n .attr('y', 5 );\n\n // Draw an elipses button for activating the popup menu\n\n var popupButton = node \n .append('g')\n .attr('transform', 'translate(0,-40)')\n .attr('style', function(d) { return d.nodeType === 'origin' || d.get('nodeClass') === 'group' ? 'visibility:hidden' : '' } )\n .on('click', function(d) { \n eventHandler({ type: 'nodeSelected', data: { id: d.get('id') } }, function(){}); \n });\n\n popupButton\n .append('circle')\n .attr('r', '15')\n .attr('class', 'graph node add-link')\n\n popupButton.append('text')\n .attr('text-anchor', 'middle')\n .text('...')\n .attr('x', 0)\n .attr('y', 5 );\n\n // Animation function for the d3 force directed graph\n force.on(\"tick\", function() {\n\n // draw directed edges with proper padding from node centers\n link.attr('d', function(d) {\n\n var sourceX = d.source.x;\n var sourceY = d.source.y;\n var targetX = d.target.x;\n var targetY = d.target.y;\n \n return 'M' + sourceX + ',' + sourceY + 'L' + targetX + ',' + targetY;\n }); \n\n // move the linked nodes into place\n node.attr('transform', function(d) { return 'translate(' + d.x + ',' + d.y + ')'; });\n });\n\n }" ]
[ "0.69361484", "0.66475767", "0.66207063", "0.6548886", "0.65287095", "0.643942", "0.63420755", "0.6320788", "0.6320117", "0.6315147", "0.6245371", "0.6233002", "0.6137982", "0.610261", "0.60940826", "0.6028687", "0.6019603", "0.59852123", "0.59837604", "0.59708226", "0.5959797", "0.59309185", "0.5918091", "0.58959454", "0.5856774", "0.58327156", "0.5827903", "0.58100766", "0.58001107", "0.57774675", "0.5765805", "0.5765349", "0.5756445", "0.5720844", "0.5720667", "0.57189155", "0.5703523", "0.56822336", "0.5673059", "0.56505096", "0.5642647", "0.56356984", "0.563521", "0.56146646", "0.56004226", "0.55922776", "0.5584657", "0.5578951", "0.5578951", "0.5570479", "0.5553223", "0.55531496", "0.55531496", "0.55506897", "0.55484486", "0.5544322", "0.5543883", "0.5536838", "0.5534423", "0.5526072", "0.5524442", "0.55187297", "0.55187297", "0.5515872", "0.55142", "0.55034566", "0.55019104", "0.5501492", "0.5500451", "0.5498794", "0.54918224", "0.5490607" ]
0.58123493
55
A leftright bias causing topics to orient by party preference.
function bias(alpha) { return function(d) { d.x += d.bias * alpha; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lined_on( origin, base, bias){\n return origin + (base - origin) * bias;\n }", "function drawBias() {\n\tctx.fillStyle = \"white\";\n\tctx.font = \"14px Monospace\";\n\tctx.fillText(\"BIASES\", 30, 180);\n\t\n\tif (network == null) return;\n\t\n\tlet biases = network.bias.matrix[0];\n\tfor (let i=0; i<biases.length; i++) {\n\t\tlet hue;\n\t\t// determine hue; red = negative value, blue = positive value\n\t\tif (biases[i] < 0) {\n\t\t\thue = 0;\n\t\t} else {\n\t\t\thue = 200;\n\t\t}\n\t\t// determine lightness; lighter = larger absolute value\n\t\tlet lightness = Math.abs(biases[i])*95 + 5;\n\t\tctx.fillStyle = \"hsl(\"+hue+\",100%,\"+lightness+\"%)\";\n\t\t\n\t\tctx.fillRect(30 + 5*i, 190, 4, 4);\n\t}\n}", "function weightedClue(clue) {\n return clue ? clue : -10;\n }", "get stealChance() {\n return (this.Dexterity + this.Intelligence + this.Luck)/2\n }", "get skillChance() {\n return (this.Dexterity + this.Intelligence + this.Luck)/2;\n }", "function setLeaderAdvantage() {\r\n // Reset all advantage\r\n attacker.leader_fire_advantage = 0;\r\n attacker.leader_shock_advantage = 0;\r\n defender.leader_fire_advantage = 0;\r\n defender.leader_shock_advantage = 0;\r\n // Sets fire advantage\r\n if (attacker.leader_fire_pip > defender.leader_fire_pip) {\r\n attacker.leader_fire_advantage = attacker.leader_fire_pip - defender.leader_fire_pip;\r\n } else {\r\n defender.leader_fire_advantage = defender.leader_fire_pip - attacker.leader_fire_pip;\r\n }\r\n\r\n // Sets shock advantage\r\n if (attacker.leader_shock_pip > defender.leader_shock_pip) {\r\n attacker.leader_shock_advantage = attacker.leader_shock_pip - defender.leader_shock_pip;\r\n } else {\r\n defender.leader_shock_advantage = defender.leader_shock_pip - attacker.leader_shock_pip;\r\n }\r\n}", "get lowerLegTwist() {}", "function C012_AfterClass_Amanda_Spank() {\n\tCurrentTime = CurrentTime + 50000;\n\tif (!GameLogQuery(CurrentChapter, CurrentActor, \"Spank\")) {\n\t\tGameLogAdd(\"Spank\");\n\t\tActorChangeAttitude(-1, 1 + PlayerGetSkillLevel(\"Fighting\"));\n\t}\n\tif (PlayerGetSkillLevel(\"Fighting\") > 0) OverridenIntroText = GetText(\"SpankWithStrength\");\n}", "function desirableWeight() {\n var desirableWeight = userInfo[\"desirable-weight\"];\n var weight = userInfo[\"weight\"];\n var step1 = weight - desirableWeight;\n var step2 = step1 * 0.32;\n var DW = step2 + desirableWeight;\n return DW;\n}", "get HOUSING_WEIGHTS() { \n return [.180, .300, .170, .160, .090, .050, .040, .010];\n }", "get weighting() { return this._weighting; }", "function getTrainingWarningMsg(attName, gain) {\n var ret = '';\n if (getTrainingStatus(attName)+gain < 100) {\n if (getTrainingStatus(attName)+(Math.round(gain*1.1)) >= 100) {\n //ret += ' *** Warning : A training breakthrough could cause rollover.<br/>';\n ret += '<br/>';\n } else {\n ret += '<br/>';\n }\n } else {\n ret += ' *** Training will cause rollover.<br/>';\n }\n return ret;\n}", "function C012_AfterClass_Jennifer_Spank() {\n\tCurrentTime = CurrentTime + 50000;\n\tif (PlayerGetSkillLevel(\"Fighting\") > 0) {\n\t\tOverridenIntroText = GetText(\"SpankWithStrength\");\n\t\tif (!GameLogQuery(CurrentChapter, CurrentActor, \"Spank\")) {\n\t\t\tGameLogAdd(\"Spank\");\n\t\t\tActorChangeAttitude(0, PlayerGetSkillLevel(\"Fighting\"));\n\t\t}\n\t}\n}", "function heuristics(weight) {\n choice = 1;\n w = weight;\n}", "function colemanLiau(letters, words, sentences) {\n return (0.0588 * (letters * 100 / words))\n - (0.296 * (sentences * 100 / words))\n - 15.8;\n}", "function colemanLiau(letters, words, sentences) {\n return (0.0588 * (letters * 100 / words))\n - (0.296 * (sentences * 100 / words))\n - 15.8;\n}", "function C012_AfterClass_Jennifer_TestLove() {\n\tif (!ActorIsGagged()) {\n\t\tif (!ActorIsRestrained() && !Common_PlayerRestrained) {\n\t\t\tif (!Common_PlayerNaked && (ActorGetValue(ActorCloth) != \"Naked\")) {\n\t\t\t\tif (ActorGetValue(ActorLove) >= 20) {\n\t\t\t\t\tActorSetPose(\"\");\n\t\t\t\t\tC012_AfterClass_Jennifer_CurrentStage = 100;\n\t\t\t\t\tOverridenIntroText = \"\";\n\t\t\t\t}\n\t\t\t} else OverridenIntroText = GetText(\"CantDateWhileNaked\");\n\t\t} else OverridenIntroText = GetText(\"CantDateWhileRestrained\");\n\t} else C012_AfterClass_Jennifer_GaggedAnswer();\n}", "get hint() {\n if (super.hint) {\n return super.hint;\n }\n return 'Legends tell of a mysterious Berry that only appears while surrounded by all types of Berries.';\n }", "set lowerLegTwist(value) {}", "adjust(target, label, amnt, topological_neighbourhood, visited){\n /* If Node already visited or top. neighbourhood lt 0 */\n if(visited.has(this.idx) || topological_neighbourhood < 0) return;\n /* add to Set */\n visited.add(this.idx);\n\n /* Adjust ourselves */\n const N = this.w.length;\n for(let x = 0; x < N; ++x){\n this.w[x] = this.w[x] + (LEARNING_RATE*(target[x]-this.w[x]));\n }\n this.shift(label, amnt);\n\n /* Adjust neighbours */\n let neighbours = getNeighbours(this.idx);\n for(let x = 0; x < neighbours.length; ++x){\n neighbours[x].adjust(this.weights, label, amnt*GAMMA, topological_neighbourhood-1, visited);\n }\n }", "get upperLegTwist() {}", "function aiAvoid(plRay) {\n aiSeek.call(this,plRay,true);\n}", "set upperLegTwist(value) {}", "incrementRotor(){if(this.bias<25){this.bias+=1;}else{this.bias=0;}}", "getWord(){\n\t\t//generate a randome number between 0 and 1\n\t\tvar r = Math.random();\n\t\tvar sum = 0;\n\t\t//for each of the words associated with the chain\n\t\tfor(var e of this.preds){\n\t\t\t//add the word probability to the sum\n\t\t\tsum += e.proba;\n\t\t\t//once the sum reaches r or above\n\t\t\tif(sum > r){\n\t\t\t\t//pick the word\n\t\t\t\treturn e.word;\n\t\t\t}\n\t\t}\n\t}", "static aThreatToHumanity(){\n return 0.75;\n }", "_updateBlendWeights() {\n if (!this._vertices || this._vertices.length === 0) return;\n\n if (this._vertices.length === 1) {\n [...this._states.values()][0].weight = 1;\n return;\n }\n\n // Initially set all sub-state weights to zero\n this._states.forEach(state => {\n state.setWeight(0);\n });\n this._phaseLeadState = null;\n\n const p = [this._blendValueX, this._blendValueY];\n\n if (this._vertices.length === 2) {\n this._setInfluenceClosestPointOnLine(p);\n } else {\n const triangle = this._triangles.find(triangle => {\n return MathUtils.isPointInTriangle(\n this._vertices[triangle[0]],\n this._vertices[triangle[1]],\n this._vertices[triangle[2]],\n p\n );\n });\n\n if (triangle) {\n this._setInfluenceTriangle(triangle, p);\n } else {\n this._setInfluenceClosestPointInTriangles(p);\n }\n }\n }", "function C012_AfterClass_Amanda_TestLove() {\n\tif (!ActorIsGagged()) {\n\t\tif (!ActorIsRestrained() && !Common_PlayerRestrained) {\n\t\t\tif (!Common_PlayerNaked && (ActorGetValue(ActorCloth) != \"Naked\")) {\n\t\t\t\tif (ActorGetValue(ActorLove) >= 20) {\n\t\t\t\t\tActorSetPose(\"\");\n\t\t\t\t\tC012_AfterClass_Amanda_CurrentStage = 100;\n\t\t\t\t\tOverridenIntroText = \"\";\n\t\t\t\t}\n\t\t\t} else OverridenIntroText = GetText(\"CantDateWhileNaked\");\n\t\t} else OverridenIntroText = GetText(\"CantDateWhileRestrained\");\n\t} else C012_AfterClass_Amanda_GaggedAnswer();\n}", "function heuristics1(weight) {\n choice = 2;\n w = weight;\n}", "get weight() {}", "knowledgeUp()\n {\n if(this.knowledge >= 0 && this.knowledge < this.maxKnowledge)//if the knowledge is between 0 and 100 increase\n {\n this.knowledge = this.knowledge + 10;//increase knowledge\n KnowledgeBar.x = (KnowledgeBar.x + 10);//add to the knowledge bar\n KnowledgeBar.setScale((player.knowledge/player.maxKnowledge),1);//scale knowledge bar\n kn = player.getKnowledge();\n }\n }", "function getNounRelatedToAdj(word) {\n return \"rel_jja=\" + adj;\n}", "function boundaryWarn(direction) {\n var roverFace = roverDirection(direction);\n console.log(\"Reach boundary, there's no way to move towards \" + roverFace);\n}", "get lowerArmTwist() {}", "function outcomes_passage_readability(totalWords, totalSentences,\n\t\ttotalSyllables) {\n\tif (totalSentences == 0 || totalWords == 0) {\n\t\treturn NaN;\n\t}\n\treturn 206.835 - 1.015 * (totalWords / totalSentences) - 84.6\n\t\t\t* (totalSyllables / totalWords);\n}", "function colemanLiau(data) {\n const { letters, words, sentences } = data;\n return (0.0588 * (letters * 100 / words))\n - (0.296 * (sentences * 100 / words))\n - 15.8;\n}", "function automatedReadabilityIndex(letters, numbers, words, sentences) {\n return (4.71 * ((letters + numbers) / words))\n + (0.5 * (words / sentences))\n - 21.43;\n}", "function automatedReadabilityIndex(letters, numbers, words, sentences) {\n return (4.71 * ((letters + numbers) / words))\n + (0.5 * (words / sentences))\n - 21.43;\n}", "function C012_AfterClass_Roommates_TestRefuseIsolation() {\n\tif (ActorGetValue(ActorSubmission) <= -10) {\n\t\tActorSetPose(\"Angry\");\n\t\tOverridenIntroText = GetText(\"CannotRefuseIsolation\");\n\t\tC012_AfterClass_Roommates_CurrentStage = 225;\n\t}\n}", "function kindle(ob1, ob2){\r\n if(!ob1.weldJoint){\r\n var dis=b2Vec2.distance(ob1.body.GetPosition(), ob2.body.GetPosition());\r\n if(dis<1){\r\n ob1.flame=true;\r\n // console.info(ob1.flame);\r\n }\r\n }\r\n}", "function changeRotorBias(id){\n\tlet rotor_pos = id.substr(1);\n\tif(id.charAt(0)===\"+\"){\n\t\tenigmaMachine.getRotor(rotor_pos).incrementRotor();\n\t}else{\n\t\tenigmaMachine.getRotor(rotor_pos).decrementRotor();\n\t}\n\tupdateRotorWindows();\n}", "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}", "engage() {\n\n this.value = this.incomingSignal;\n this.incomingSignal = 0;\n\n //bias is always 1.\n if (this.type == 'b') {\n this.value = 1;\n }\n }", "function beetle_lvl5() {}", "get attenuation() { return this._attenuation; }", "function bias(id) {\r\n\tvar random = Math.floor(Math.random() * 2);\r\n\t\r\n\tif (id < 9)\r\n\t\treturn id;\r\n\telse {\r\n\t\tswitch(id) {\r\n\t\t\tcase 9:\r\n\t\t\t\tif (random == 0)\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\telse\r\n\t\t\t\t\treturn 6;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 10:\r\n\t\t\t\tif (random == 0)\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\telse\r\n\t\t\t\t\treturn 7;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 11:\r\n\t\t\t\tif (random == 0)\r\n\t\t\t\t\treturn 2;\r\n\t\t\t\telse\r\n\t\t\t\t\treturn 8;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 12:\r\n\t\t\t\tif (random == 0)\r\n\t\t\t\t\treturn 3;\r\n\t\t\t\telse\r\n\t\t\t\t\treturn 6;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 13:\r\n\t\t\t\tif (random == 0)\r\n\t\t\t\t\treturn 4;\r\n\t\t\t\telse\r\n\t\t\t\t\treturn 7;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 14:\r\n\t\t\t\tif (random == 0)\r\n\t\t\t\t\treturn 5;\r\n\t\t\t\telse\r\n\t\t\t\t\treturn 8;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 15:\r\n\t\t\t\tif (random == 0)\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\telse\r\n\t\t\t\t\treturn 3;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 16:\r\n\t\t\t\tif (random == 0)\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\telse\r\n\t\t\t\t\treturn 4;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 17:\r\n\t\t\t\tif (random == 0)\r\n\t\t\t\t\treturn 2;\r\n\t\t\t\telse\r\n\t\t\t\t\treturn 5;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}", "function setGoal() {\n goal = Math.floor(Math.random() * 102) + 19;\n}", "set weight(value) {}", "determineFacing(deltaX, deltaY, deltaEu, player, baddie) {\n // School of knocks: who gets hit by what force (the entity name is the entity being knocked):\n const playerVerticalKnock = deltaY / 2;\n const baddieVerticalKnock = -deltaY / 2; // Since delta Y is always from the player's perspective\n const playerHorizontalKnock = baddie.currentAttackKnockback || 0.4; // Default value for when baddies just walk into you.\n const baddieHorizontalKnock = player.currentAttackKnockback; // horizontal knocks are unsigned here\n // Enter the logic tree: If delta x is greater than zero, player is to the right of the baddie:\n if (deltaX > 0) {\n if (player.facing === 'right') {\n if (baddie.facing === 'right') {\n // Player is to the right, player faces right, baddie faces right: baddie is behind you!\n // If enemy is behind you then it doesn't matter if you're attacking:\n if (\n deltaEu <\n badDictionary[`baddie_${baddie.type}`].baddieBehind.dangerZone ||\n // Since attacks are lateral, they'll be added to calculations involving delta X, not delta Euclid:\n (Math.abs(deltaX) <\n badDictionary[`baddie_${baddie.type}`].baddieBehind.dangerZone +\n baddie.attackRadius &&\n // AND make sure the player is more or less in the right height range:\n Math.abs(player.y - baddie.y) < badDictionary[`baddie_${baddie.type}`].spriteWidth)\n ) {\n // If there's a hit, player takes damage and is knocked according to what direction you're hit from:\n player.damageReceived = baddie.currentAttackDamage || 1;\n player.getKnockedBack(playerHorizontalKnock, playerVerticalKnock);\n }\n } else {\n // Player is to the right, player faces right, baddie faces left: you stand back-to-back.\n // if you and baddie stand back to back then it doesn't matter if you're attacking:\n if (\n deltaEu <\n // Baddie's zone of killing you is UNAFFECTED by baddie attacks (until we invent energy fields anyway):\n badDictionary[`baddie_${baddie.type}`].backToBack.dangerZone\n ) {\n player.damageReceived = baddie.currentAttackDamage || 1;\n player.getKnockedBack(playerHorizontalKnock, playerVerticalKnock);\n }\n }\n // Player faces left:\n } else {\n if (baddie.facing === 'right') {\n // Player is to the right, player faces left, baddie faces right: you face each other:\n // Since you face the baddie, attacking IS possible:\n if (\n // Player must be in the attacking state to consider whether a strike is successful:\n player.isAttacking &&\n // Distance-to-strike calculus: Strike succeeds if (player attack radius > [Euclidean distance MINUS baddie WIDTH])\n player.attackRadius >\n deltaEu - badDictionary[`baddie_${baddie.type}`].spriteWidth\n ) {\n // if attack is successful, the baddie is hit!\n baddie.damageReceived = player.currentAttackDamage;\n baddie.getKnockedBack(-baddieHorizontalKnock, baddieVerticalKnock);\n // If your strike fails we must consider whether you can now be killed by them:\n } else if (\n deltaEu <\n badDictionary[`baddie_${baddie.type}`].baddieBehind.dangerZone ||\n // Since attacks are lateral, they'll be added to calculations involving delta X, not delta Euclid:\n (Math.abs(deltaX) <\n badDictionary[`baddie_${baddie.type}`].baddieBehind.dangerZone +\n baddie.attackRadius &&\n // AND make sure the player is more or less in the right height range:\n Math.abs(player.y - baddie.y) < badDictionary[`baddie_${baddie.type}`].spriteWidth)\n ) {\n player.damageReceived = baddie.currentAttackDamage || 1;\n player.getKnockedBack(playerHorizontalKnock, playerVerticalKnock);\n }\n } else {\n // Player is to the right, player faces left, baddie faces left: player is behind baddie!\n // This is the last case where the player stands to the right of a baddie and has the opportunity to attack:\n if (\n player.isAttacking &&\n player.attackRadius >\n deltaEu - badDictionary[`baddie_${baddie.type}`].spriteWidth\n ) {\n // if attack succeeds, the baddie is hit!\n baddie.damageReceived = player.currentAttackDamage;\n baddie.getKnockedBack(-baddieHorizontalKnock, baddieVerticalKnock);\n } else if (\n deltaEu <\n badDictionary[`baddie_${baddie.type}`].playerBehind.dangerZone\n ) {\n player.damageReceived = baddie.currentAttackDamage || 1;\n player.getKnockedBack(playerHorizontalKnock, playerVerticalKnock);\n }\n }\n }\n } else {\n // If your delta X is less than zero Player is LEFT of the baddie:\n if (player.facing === 'right') {\n if (baddie.facing === 'right') {\n // Player is left of the baddie, facing right, and baddie faces right: player is behind baddie!\n // Since you face the baddie you can attempt an attack:\n if (\n player.isAttacking &&\n player.attackRadius >\n deltaEu - badDictionary[`baddie_${baddie.type}`].spriteWidth\n ) {\n // if they are, the baddie is killed!\n baddie.damageReceived = player.currentAttackDamage;\n baddie.getKnockedBack(baddieHorizontalKnock, baddieVerticalKnock);\n } else if (\n deltaEu <\n badDictionary[`baddie_${baddie.type}`].playerBehind.dangerZone\n ) {\n player.damageReceived = baddie.currentAttackDamage || 1;\n player.getKnockedBack(-playerHorizontalKnock, playerVerticalKnock);\n }\n } else {\n // Player is left of the baddie, player faces right, baddie faces left (head-on collision):\n // Attempt attack:\n if (\n player.isAttacking &&\n player.attackRadius >\n deltaEu - badDictionary[`baddie_${baddie.type}`].spriteWidth\n ) {\n // if they are, the baddie is killed!\n baddie.damageReceived = player.currentAttackDamage;\n baddie.getKnockedBack(baddieHorizontalKnock, baddieVerticalKnock);\n } else if (\n deltaEu <\n badDictionary[`baddie_${baddie.type}`].baddieBehind.dangerZone ||\n // Since attacks are lateral, they'll be added to calculations involving delta X, not delta Euclid:\n (Math.abs(deltaX) <\n badDictionary[`baddie_${baddie.type}`].baddieBehind.dangerZone +\n baddie.attackRadius &&\n // AND make sure the player is more or less in the right height range:\n Math.abs(player.y - baddie.y) < badDictionary[`baddie_${baddie.type}`].spriteWidth)\n ) {\n player.damageReceived = baddie.currentAttackDamage || 1;\n player.getKnockedBack(-playerHorizontalKnock, playerVerticalKnock);\n }\n }\n // player faces left:\n } else {\n // Player stands to the left, player faces left, baddie faces right: you face away from each other.\n // No player attack is possible from this angle, so we go straight to seeing if they kill you:\n if (baddie.facing === 'right') {\n if (\n deltaEu <\n badDictionary[`baddie_${baddie.type}`].backToBack.dangerZone\n ) {\n player.damageReceived = baddie.currentAttackDamage || 1;\n player.getKnockedBack(-playerHorizontalKnock, playerVerticalKnock);\n }\n } else {\n // Player stands to the left, player faces left, baddie faces left: baddie is behind you!\n // No player attack possible:\n if (\n deltaEu <\n badDictionary[`baddie_${baddie.type}`].baddieBehind.dangerZone ||\n // Since attacks are lateral, they'll be added to calculations involving delta X, not delta Euclid:\n (Math.abs(deltaX) <\n badDictionary[`baddie_${baddie.type}`].baddieBehind.dangerZone +\n baddie.attackRadius &&\n // AND make sure the player is more or less in the right height range:\n Math.abs(player.y - baddie.y) < badDictionary[`baddie_${baddie.type}`].spriteWidth)\n ) {\n player.damageReceived = baddie.currentAttackDamage || 1;\n player.getKnockedBack(-playerHorizontalKnock, playerVerticalKnock);\n }\n }\n }\n }\n baddie.handleCollisions();\n }", "propagate(learningRate, target) {\n let error = 0;\n let isOutput = typeof target !== 'undefined';\n\n if (isOutput) {\n this.error.responsibility = this.error.projected = target - this.activation;\n } else {\n for (const connection of Object.keys(this.connections.projected)) {\n const projectedConnection = this.connections.projected[connection];\n const neuron = projectedConnection.to;\n\n error += neuron.error.responsibility * projectedConnection.weight;\n }\n\n this.error.responsibility = this.error.projected = this.derivative * error;\n }\n\n // adjust all the neuron's incoming connections\n for (const connection of Object.keys(this.connections.incoming)) {\n const incomingConnection = this.connections.incoming[connection];\n\n let gradient = this.error.projected;\n incomingConnection.weight += learningRate * gradient * incomingConnection.from.derivative;\n }\n\n this.bias += learningRate * this.error.responsibility;\n }", "adjustSpawnProb() {\n if (this.monsterSpawnProb < 1) this.monsterSpawnProb += this.monsterSpawnIncreaseSlope;\n }", "function Weight() {\n\tthis.value = Math.random() * .2 - .1;\n\tthis.gradient = 0;\n}", "function pacManBias(ghost) {\n // this function get the ghosts out of the box they start in\n if (ghost.ghostIndex === 168 || ghost.ghostIndex === 169 || ghost.ghostIndex === 170 || ghost.ghostIndex === 171 || ghost.ghostIndex === 148 || ghost.ghostIndex === 149 || ghost.ghostIndex === 150 || ghost.ghostIndex === 151) {\n outOfBox(ghost)\n } else if (ghost.bias === 1) {\n towardsPacMan(ghost)\n } else if (ghost.bias === 2) {\n awayFromPacMan(ghost)\n } else if (ghost.bias === 3) {\n sendHome(ghost)\n }\n }", "function twitch() {\n\t\t\tif( ms.x < 6 || ms.y < 6 ) {\n\t\t\t\tvar forceRange = 15; // -value to +value\n\t\t\t\tinsertImpulse( Math.random() * WIDTH, (Math.random()*(forceRange*2)-forceRange ) );\n\t\t\t}\n\t\t}", "gainMult() { // Returns your multiplier to your gain of the prestige resource.\n return new Decimal(1) // Factor in any bonuses multiplying gain here.\n }", "function Twitch() {\n\t\tif (ms.x < 6 || ms.y < 6) {\n\t\t\tvar forceRange = 5;\n\t\t\t// -value to +value\n\t\t\tInsertImpulse(Math.random() * WIDTH, (Math.random() * (forceRange * 2) - forceRange ));\n\t\t}\n\t}", "constructor(name, legs, isDanger){\n super(name, legs)//properties inherited from the parent class\n this.isDanger = isDanger\n }", "function getMaxRunaways() {\n var considerWeightAdjustment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n var weightBuffs = considerWeightAdjustment ? (0, _kolmafia.weightAdjustment)() : 0;\n return Math.floor(((0, _kolmafia.familiarWeight)(familiar) + weightBuffs) / 5);\n}", "set lowerArmTwist(value) {}", "get weights() {\n return this.trainableWeights.concat(this.nonTrainableWeights);\n }", "function LanguageUnderstandingModel() {\n }", "land() {\n this._tag = \"_LANDED_\";\n }", "get weights() { return this.w; }", "function blockStrength(defender) {\n return Math.floor(defender.defense) - Math.floor((randomNum(6) * 0.1 * defender.defense));\n}", "function embCorr() {\n var borEmbRatio = borD / adjEmbD;\n //return borEmbRatio * borEmbRatio * (walW + 0.75 * adjEmbD); // per spreadsheet\n return borEmbRatio * borEmbRatio * (borD / 2 + walW + 0.6133 * adjEmbD / 2); // an alternative\n //return borEmbRatio * borEmbRatio * (walW + 1.7 * adjEmbD); // http://www.phy.mtu.edu/~suits/fingers.html\n //return 10.84 * borEmbRatio * borEmbRatio * walW * adjEmbD / (borD + 2 * walW); // kosel's empirical fit\n}", "function setHints(){\r\n hints[0]=\"Better luck next time.\";//show if chances=0\r\n hints[1]=\"Country ends with \"+answer[answer.length-1];//show if chances=1\r\n hints[2]=\"Country starts with \"+answer[0];// shows if chances=2\r\n hints[3]=\"Country has \"+answer.length+\" letters\";//show if chances are 3\r\n //check SHOWHINTS();var hint=hints[chances];set the current hint, based on how many chances are left\r\n } //END OF HINT BiZzness", "standUp() {\n this.jump(0);\n this.bendLeg( this.body.leftLeg, 10 );\n this.bendLeg( this.body.rightLeg, 10 );\n }", "get blendDistance() {}", "function getKramcoWandererChance() {\n var fights = (0, _property.get)(\"_sausageFights\");\n var lastFight = (0, _property.get)(\"_lastSausageMonsterTurn\");\n var totalTurns = (0, _kolmafia.totalTurnsPlayed)();\n\n if (fights < 1) {\n return lastFight === totalTurns && (0, _kolmafia.myTurncount)() < 1 ? 0.5 : 1.0;\n }\n\n var turnsSinceLastFight = totalTurns - lastFight;\n return Math.min(1.0, (turnsSinceLastFight + 1) / (5 + fights * 3 + Math.pow(Math.max(0, fights - 5), 3)));\n}", "get hint() {\n if (super.hint) {\n return super.hint;\n }\n const berries = this.fieldBerries.map((fb) => BerryType[fb.berry]).join(', ');\n return `Legends tell of a mysterious Berry that only appears in a field of ${berries} Berries.`;\n }", "fear() {\n\t\tthis.mentalScore--;\n\t\tif (this.mentalScore < 0) {\n\t\t\tthis.mentalScore = 0;\n\t\t}\n\t}", "bendLeg( leg, length ) {\n if ( length < 0 ) {\n console.log(\"ERROR: can't bend leg to \"+length);\n return\n }\n var upper = this.skeleton.bones[leg.upper];\n var lower = this.skeleton.bones[leg.lower];\n var scaling = this.rootMesh.scaling.x;\n\n if ( length > leg.lowerLength + leg.upperLength ) {\n length = leg.lowerLength + leg.upperLength;\n if ( length == leg.length ) {\n return;\n }\n }\n leg.length = length;\n\n if ( ! leg.upperQuat ) {\n leg.upperQuat = BABYLON.Quaternion.FromRotationMatrix(upper.getWorldMatrix().getRotationMatrix());\n leg.upperQuatInv = BABYLON.Quaternion.Inverse(leg.upperQuat);\n\n leg.lowerQuat = BABYLON.Quaternion.FromRotationMatrix(lower.getWorldMatrix().getRotationMatrix());\n leg.lowerQuatInv = BABYLON.Quaternion.Inverse(leg.lowerQuat);\n\n leg.upperRot = upper.getTransformNode().rotationQuaternion.clone();\n }\n\n // simplified math by using same length for both bones\n // it's right angle, hypotenuse is bone\n // length/2 is sinus of half of elbow angle\n var boneLength = (leg.lowerLength + leg.upperLength)/2;\n var innerAngle = Math.asin(length/2/boneLength);\n //this.log(\"Bone length: \"+boneLength+\" distance to target \"+length);\n var upperAngle = Math.PI/2-innerAngle;\n var lowerAngle = upperAngle*2;\n\n var axis = leg.frontAxis.axis;\n var sign = leg.frontAxis.sign;\n\n var upperQuat = BABYLON.Quaternion.RotationAxis(axis,upperAngle*sign);\n\n //var upperRot = upper.getTransformNode().rotationQuaternion;\n upper.getTransformNode().rotationQuaternion = leg.upperRot.multiply(upperQuat);\n\n var fix = leg.upperQuat.multiply(leg.lowerQuatInv);\n var lowerQuat = BABYLON.Quaternion.RotationAxis(axis,-lowerAngle*sign);\n lowerQuat = lowerQuat.multiply(fix);\n\n lower.getTransformNode().rotationQuaternion = lowerQuat;\n\n return length;\n }", "get hint() {\n if (super.hint) {\n return super.hint;\n }\n return `I've heard that using the ${App.game.oakItems.itemList[this.oakItem].displayName} can cause ${BerryType[this.originalBerry]} Berries to change!`;\n }", "function infuse(weapons) {\n var mainWeapon = weapons[0];\n weapons.shift();\n weapons.forEach(function (fodder, index, array) {\n var diff = fodder.light - mainWeapon.light;\n if (diff > 0) {\n var threshold = THRESHOLD['main'][mainWeapon.rarity] + THRESHOLD['fodder'][fodder.rarity];\n var oldLight = mainWeapon.light;\n var increasedLight = diff;\n if (diff > threshold) {\n increasedLight = Math.round(diff * PENALTIES[mainWeapon.rarity]);\n }\n mainWeapon.light += increasedLight;\n var costShards = fodder.rarity === 'e' ? SHARDS : 0;\n var costMarks = (fodder.rarity === 'e' || fodder.rarity === 'l') ? MARKS : 0;\n\n totalCosts.marks += costMarks;\n totalCosts.shards += costShards;\n console.log('Main weapon has gone from ' + oldLight + ' to ' + mainWeapon.light + '. Marks: ' + costMarks + ', Shards: ' + costShards);\n } else {\n console.log('Max light of ' + mainWeapon.light + ' reached after infusing ' + fodder.rarity + fodder.light);\n return;\n }\n });\n}", "get upperArmTwist() {}" ]
[ "0.62531126", "0.5555873", "0.5474362", "0.5433658", "0.5406714", "0.5377929", "0.53565264", "0.5319594", "0.531506", "0.5297229", "0.52530986", "0.51892704", "0.518832", "0.5172908", "0.51517606", "0.51517606", "0.5143453", "0.51297593", "0.5114689", "0.5107598", "0.51045483", "0.50692254", "0.506262", "0.50482446", "0.5044728", "0.5042255", "0.5019734", "0.50075626", "0.5004219", "0.49609512", "0.49567038", "0.49481678", "0.49265575", "0.49112058", "0.49006358", "0.48974478", "0.48911005", "0.48911005", "0.48820046", "0.48574752", "0.4847112", "0.48401985", "0.48342326", "0.48237738", "0.48210415", "0.48177424", "0.481544", "0.4797025", "0.47923124", "0.47902477", "0.47854447", "0.4780705", "0.47754955", "0.47753903", "0.47733995", "0.4769389", "0.47630534", "0.47587353", "0.47549203", "0.4754436", "0.47532672", "0.47518337", "0.47508886", "0.47360417", "0.4722946", "0.47124353", "0.47092587", "0.4708743", "0.47049457", "0.47015905", "0.46945864", "0.46939775", "0.4692006", "0.46892643", "0.4676903" ]
0.0
-1
Resolve collisions between nodes.
function collide(alpha) { var q = d3.geom.quadtree(data.topics); return function(d) { var r = d.cr + maxRadius + collisionPadding, nx1 = d.x - r, nx2 = d.x + r, ny1 = d.y - r, ny2 = d.y + r; q.visit(function(quad, x1, y1, x2, y2) { if (quad.point && (quad.point !== d) && d.other !== quad.point && d !== quad.point.other) { var x = d.x - quad.point.x, y = d.y - quad.point.y, l = Math.sqrt(x * x + y * y), r = d.cr + quad.point.r + collisionPadding; if (l < r) { l = (l - r) / l * alpha; d.x -= x *= l; d.y -= y *= l; quad.point.x += x; quad.point.y += y; } } return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1; }); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleCollisions() {\n\tfor(var i = 4; i < grupo.children.length-1; i++){\n\t\t//j = i + 1 -> important to avoid unecessary checks\n\t\tfor(var j = i+1; j < grupo.children.length; j++){\n\t\t\tgrupo.children[i].checkCollisions(grupo.children[j]);\n\t\t}\n }\n}", "function resolveCollisions(nodesByBreadth, nodeGap, height, width, orient) {\n\t var keyAttr = orient === 'vertical' ? 'x' : 'y';\n\t each(nodesByBreadth, function (nodes) {\n\t nodes.sort(function (a, b) {\n\t return a.getLayout()[keyAttr] - b.getLayout()[keyAttr];\n\t });\n\t var nodeX;\n\t var node;\n\t var dy;\n\t var y0 = 0;\n\t var n = nodes.length;\n\t var nodeDyAttr = orient === 'vertical' ? 'dx' : 'dy';\n\t\n\t for (var i = 0; i < n; i++) {\n\t node = nodes[i];\n\t dy = y0 - node.getLayout()[keyAttr];\n\t\n\t if (dy > 0) {\n\t nodeX = node.getLayout()[keyAttr] + dy;\n\t orient === 'vertical' ? node.setLayout({\n\t x: nodeX\n\t }, true) : node.setLayout({\n\t y: nodeX\n\t }, true);\n\t }\n\t\n\t y0 = node.getLayout()[keyAttr] + node.getLayout()[nodeDyAttr] + nodeGap;\n\t }\n\t\n\t var viewWidth = orient === 'vertical' ? width : height; // If the bottommost node goes outside the bounds, push it back up\n\t\n\t dy = y0 - nodeGap - viewWidth;\n\t\n\t if (dy > 0) {\n\t nodeX = node.getLayout()[keyAttr] - dy;\n\t orient === 'vertical' ? node.setLayout({\n\t x: nodeX\n\t }, true) : node.setLayout({\n\t y: nodeX\n\t }, true);\n\t y0 = nodeX;\n\t\n\t for (var i = n - 2; i >= 0; --i) {\n\t node = nodes[i];\n\t dy = node.getLayout()[keyAttr] + node.getLayout()[nodeDyAttr] + nodeGap - y0;\n\t\n\t if (dy > 0) {\n\t nodeX = node.getLayout()[keyAttr] - dy;\n\t orient === 'vertical' ? node.setLayout({\n\t x: nodeX\n\t }, true) : node.setLayout({\n\t y: nodeX\n\t }, true);\n\t }\n\t\n\t y0 = node.getLayout()[keyAttr];\n\t }\n\t }\n\t });\n\t }", "function Resolver() {\n var resolvers = {\n boxandbox: function(E1, E2) {\n var pyTop = E2.getTop() + game.renderOffset.y;\n var pyLeft = E2.getLeft() - game.renderOffset.x;\n var pyRight = E2.getRight() - game.renderOffset.x;\n var pyBottom = E2.getBottom() + game.renderOffset.y;\n\n fill(0);\n\n // Minkowski sum from\n // http://gamedev.stackexchange.com/questions/29786/a-simple-2d-rectangle-collision-algorithm-that-also-determines-which-sides-that\n\n var w = 0.5 * (E1.size.width + E2.size.width);\n var h = 0.5 * (E1.size.height + E2.size.height);\n\n var dx = E1.getMidX() - E2.getMidX();\n var dy = E1.getMidY() - E2.getMidY();\n\n if(Math.abs(dx) <= w && Math.abs(dy) <= h) {\n // collision!\n var wy = w * dy;\n var hx = h * dx;\n\n noStroke();\n\n if(wy > hx) {\n if(wy > -hx) {\n // Bottom\n E1.position.y = E2.getBottom();\n E1.velocity.y = 0;\n fill(0, 0, 255);\n if(game.showPhysics) {\n rect(pyLeft, pyBottom, E2.size.width, 5);\n }\n } else {\n // Left\n E1.position.x = E2.getLeft() - E1.size.width;\n E1.velocity.x = 0;\n fill(255, 255, 0);\n if(game.showPhysics) {\n rect(pyLeft - 5, pyTop, 5, E2.size.height);\n }\n }\n } else if(wy > -hx) {\n // Right\n E1.position.x = E2.getRight();\n E1.velocity.x = 0;\n fill(255, 0, 0);\n if(game.showPhysics) {\n rect(pyRight, pyTop, 5, E2.size.height);\n }\n } else {\n // Top\n E1.position.y = E2.getTop() - E1.size.height;\n E1.velocity.y = 0;\n if(game.showPhysics) {\n fill(0, 255, 0);\n rect(pyLeft, pyTop - 5, E2.size.width, 5);\n }\n }\n }\n }\n };\n\n this.resolve = function(E1, E2) {\n if(E1.id === E2.id) {\n return false;\n }\n\n var entities = [E1, E2];\n\n if(E1.properties.get('shape') > E2.properties.get('shape')) {\n entities = [E2, E1];\n }\n\n return resolvers[entities[0].properties.get('shape') + 'and' + entities[1].properties.get('shape')](E1, E2);\n }\n}", "function detectAndHandleCollisions(entities) {\n\n for (var i = 1; i < entities.length; i++)\n {\n var e1 = entities[i];\n\n for (var j = 0; j < i; j++)\n {\n var e2 = entities[j];\n\n if (e1.newVersion._id === e2.newVersion._id)\n {\n return;\n }\n\n var dx = e2.newVersion.x - e1.newVersion.x;\n var dy = e2.newVersion.y - e1.newVersion.y;\n var distance = Math.sqrt(dx * dx + dy * dy);\n\n if (distance < TILE_SIZE_PX)\n {\n handleCollision(e1, e2);\n }\n }\n }\n\n}", "function solveNodeCollisions(nodesView, nodesData)\n {\n var nodes = nodesData;\n\n var view = nodesView.closest('body');\n\n for (var i = 0; i < nodes.length; i++)\n {\n for (var j = 0; j < nodes.length; j++)\n {\n if (i != j && hasNodeCollision(nodes[i], nodes[j]))\n {\n nodes[i].position.top += nodeHeight;\n j = 0;\n }\n }\n }\n }", "resolveCollision(objects, dt, self) {\n\t\tthis.standing = false;\n\n\t\tvar used = [];\n\t\tused.length = objects.length;\n\t\tused.fill(false);\n\n\t\tvar collisionData = {dt: dt, proj: new Vector2(this.vel.x, this.vel.y)};\n\t\twhile(Math.abs(collisionData.dt) > eps) {\n\t\t\tdt = collisionData.dt;\n\t\t\tcollisionData = this.resolveObjects(objects, collisionData);\n\t\t\tthis.updateByCollisionData(collisionData, objects, used, self);\n\t\t\tcollisionData.proj = new Vector2(this.vel.x, this.vel.y);\n\t\t\tcollisionData.dt = dt - collisionData.dt;\n\t\t}\n\t}", "function resolveCollisions(container) {\n\t var svg = container.find('svg');\n\t var bounds = [];\n\n\t var iterations = 0, mainBounds, changed, temp;\n\t do {\n\t temp = resolveCollisionsInSelection(svg.find('g.main.pielabel'));\n\t mainBounds = temp[0];\n\t changed = temp[1];\n\t iterations++;\n\t } while (changed && iterations < 10);\n\t bounds.push(mainBounds);\n\n\t var groups = {};\n\t svg.find('g.sub.pielabel').each(function(){\n\t groups[$(this).attr('group')] = true;\n\t });\n\t var okg = Object.keys(groups);\n\t var i;\n\t var groupBounds;\n\t for (i = 0; i < okg.length; i++) {\n\t var group = okg[i];\n\t var selection = svg.find('g.sub.pielabel[group=\"' + group + '\"]');\n\t iterations = 0;\n\t do {\n\t temp = resolveCollisionsInSelection(selection);\n\t groupBounds = temp[0];\n\t changed = temp[1];\n\t iterations++;\n\t } while (changed && iterations < 10);\n\t bounds.push(groupBounds);\n\t }\n\t return findExtremeBounds(bounds);\n\t }", "function resolveCollision(particle, otherParticle) {\n var xVelocityDiff = particle.velocity.x - otherParticle.velocity.x;\n var yVelocityDiff = particle.velocity.y - otherParticle.velocity.y;\n var xDist = otherParticle.x - particle.x;\n var yDist = otherParticle.y - particle.y; // Prevent accidental overlap of particles\n\n if (xVelocityDiff * xDist + yVelocityDiff * yDist >= 0) {\n // Grab angle between the two colliding particles\n var angle = -Math.atan2(otherParticle.y - particle.y, otherParticle.x - particle.x); // Store mass in var for better readability in collision equation\n\n var m1 = particle.mass;\n var m2 = otherParticle.mass; // Velocity before equation\n\n var u1 = rotate(particle.velocity, angle);\n var u2 = rotate(otherParticle.velocity, angle); // Velocity after 1d collision equation\n\n var v1 = {\n x: u1.x * (m1 - m2) / (m1 + m2) + u2.x * 2 * m2 / (m1 + m2),\n y: u1.y\n };\n var v2 = {\n x: u2.x * (m1 - m2) / (m1 + m2) + u1.x * 2 * m2 / (m1 + m2),\n y: u2.y\n }; // Final velocity after rotating axis back to original location\n\n var vFinal1 = rotate(v1, -angle);\n var vFinal2 = rotate(v2, -angle); // Swap particle velocities for realistic bounce effect\n\n particle.velocity.x = vFinal1.x * friction;\n particle.velocity.y = vFinal1.y * friction;\n otherParticle.velocity.x = vFinal2.x * friction;\n otherParticle.velocity.y = vFinal2.y * friction;\n }\n} // Objects", "function resolveCollisions(nodesByBreadth, nodeGap, height, width, orient) {\n var keyAttr = orient === 'vertical' ? 'x' : 'y';\n util[\"k\" /* each */](nodesByBreadth, function (nodes) {\n nodes.sort(function (a, b) {\n return a.getLayout()[keyAttr] - b.getLayout()[keyAttr];\n });\n var nodeX;\n var node;\n var dy;\n var y0 = 0;\n var n = nodes.length;\n var nodeDyAttr = orient === 'vertical' ? 'dx' : 'dy';\n\n for (var i = 0; i < n; i++) {\n node = nodes[i];\n dy = y0 - node.getLayout()[keyAttr];\n\n if (dy > 0) {\n nodeX = node.getLayout()[keyAttr] + dy;\n orient === 'vertical' ? node.setLayout({\n x: nodeX\n }, true) : node.setLayout({\n y: nodeX\n }, true);\n }\n\n y0 = node.getLayout()[keyAttr] + node.getLayout()[nodeDyAttr] + nodeGap;\n }\n\n var viewWidth = orient === 'vertical' ? width : height; // If the bottommost node goes outside the bounds, push it back up\n\n dy = y0 - nodeGap - viewWidth;\n\n if (dy > 0) {\n nodeX = node.getLayout()[keyAttr] - dy;\n orient === 'vertical' ? node.setLayout({\n x: nodeX\n }, true) : node.setLayout({\n y: nodeX\n }, true);\n y0 = nodeX;\n\n for (var i = n - 2; i >= 0; --i) {\n node = nodes[i];\n dy = node.getLayout()[keyAttr] + node.getLayout()[nodeDyAttr] + nodeGap - y0;\n\n if (dy > 0) {\n nodeX = node.getLayout()[keyAttr] - dy;\n orient === 'vertical' ? node.setLayout({\n x: nodeX\n }, true) : node.setLayout({\n y: nodeX\n }, true);\n }\n\n y0 = node.getLayout()[keyAttr];\n }\n }\n });\n}", "function resolveCollisionsTopToBottom(nodes, y, i, alpha) {\n for (; i < nodes.length; ++i) {\n var node = nodes[i];\n var dy_3 = (y - node.y0) * alpha;\n if (dy_3 > 1e-6)\n (node.y0 += dy_3), (node.y1 += dy_3);\n y = node.y1 + py;\n }\n }", "function hasNodeCollision(node1, node2)\n {\n if (node1.position.side != node2.position.side) return false;\n\n return Math.abs(node1.position.top - node2.position.top) < (nodeHeight);\n }", "function Physics() {\n\n function resolve(dTime, balls, obstacles) {\n var collisions = [];\n balls.forEach(function(ball){\n collisions = collisions.concat(resolveBall(dTime, ball, obstacles));\n });\n return collisions;\n }\n\n function resolveBall(dTime, ball, obstacles) {\n // For now treat the ball as a rectangle\n var collisions = [];\n ball.move(dTime);\n obstacles.forEach(function(obstacle) {\n // Get updated ball geometry\n var ballRect = ball.getRect();\n var obstacleRect = obstacle.getRect();\n // Check for circle origin inside rectangle\n if (ballRect.vMin.x < obstacleRect.vMax.x &&\n ballRect.vMax.x > obstacleRect.vMin.x &&\n ballRect.vMin.y < obstacleRect.vMax.y &&\n ballRect.vMax.y > obstacleRect.vMin.y) {\n // collision\n var ballVelocity = ball.getVelocity();\n var delta = obstacleRect.getOrigin().sub(ballRect.getOrigin());\n var obstacleRectAspectRatio = obstacleRect.getWidth() / obstacleRect.getHeight();\n delta.y *= obstacleRectAspectRatio;\n if (Math.abs(delta.x) > Math.abs(delta.y)) {\n // Horizontal collision\n // Check for fly-through collisions\n if (ballVelocity.x < 0 && delta.x < 0 || ballVelocity.x > 0 && delta.x > 0) {\n ball.flipHorizontally();\n }\n } else {\n // Vertical collision\n // Check for fly-through collisions\n if (ballVelocity.y < 0 && delta.y < 0 || ballVelocity.y > 0 && delta.y > 0) {\n ball.flipVertically();\n }\n }\n collisions.push(new Collision(ball, obstacle))\n }\n });\n return collisions;\n }\n\n return {\n resolve : resolve\n }\n}", "function resolveCollision(particle, otherParticle) {\n const xVelocityDiff = particle.velocity.x - otherParticle.velocity.x;\n const yVelocityDiff = particle.velocity.y - otherParticle.velocity.y;\n\n const xDist = otherParticle.x - particle.x;\n const yDist = otherParticle.y - particle.y;\n\n // Prevent accidental overlap of particles\n if (xVelocityDiff * xDist + yVelocityDiff * yDist >= 0) {\n\n // Grab angle between the two colliding particles\n const angle = -Math.atan2(otherParticle.y - particle.y, otherParticle.x - particle.x);\n\n // Store mass in var for better readability in collision equation\n const m1 = particle.mass;\n const m2 = otherParticle.mass;\n\n // Velocity before equation\n const u1 = rotate(particle.velocity, angle);\n const u2 = rotate(otherParticle.velocity, angle);\n\n // Velocity after 1d collision equation\n const v1 = { x: u1.x * (m1 - m2) / (m1 + m2) + u2.x * 2 * m2 / (m1 + m2), y: u1.y };\n const v2 = { x: u2.x * (m1 - m2) / (m1 + m2) + u1.x * 2 * m2 / (m1 + m2), y: u2.y };\n\n // Final velocity after rotating axis back to original location\n const vFinal1 = rotate(v1, -angle);\n const vFinal2 = rotate(v2, -angle);\n\n // Swap particle velocities for realistic bounce effect\n particle.velocity.x = vFinal1.x;\n particle.velocity.y = vFinal1.y;\n\n otherParticle.velocity.x = vFinal2.x;\n otherParticle.velocity.y = vFinal2.y;\n }\n}", "function resolveCollision(particle, otherParticle) {\n const xVelocityDiff = particle.velocity.x - otherParticle.velocity.x;\n const yVelocityDiff = particle.velocity.y - otherParticle.velocity.y;\n\n const xDist = otherParticle.x - particle.x;\n const yDist = otherParticle.y - particle.y;\n\n // Prevent accidental overlap of particles\n if (xVelocityDiff * xDist + yVelocityDiff * yDist >= 0) {\n\n // Grab angle between the two colliding particles\n const angle = -Math.atan2(otherParticle.y - particle.y, otherParticle.x - particle.x);\n\n // Store mass in var for better readability in collision equation\n const m1 = particle.mass;\n const m2 = otherParticle.mass;\n\n // Velocity before equation\n const u1 = rotate(particle.velocity, angle);\n const u2 = rotate(otherParticle.velocity, angle);\n\n // Velocity after 1d collision equation\n const v1 = { x: u1.x * (m1 - m2) / (m1 + m2) + u2.x * 2 * m2 / (m1 + m2), y: u1.y };\n const v2 = { x: u2.x * (m1 - m2) / (m1 + m2) + u1.x * 2 * m2 / (m1 + m2), y: u2.y };\n\n // Final velocity after rotating axis back to original location\n const vFinal1 = rotate(v1, -angle);\n const vFinal2 = rotate(v2, -angle);\n\n // Swap particle velocities for realistic bounce effect\n particle.velocity.x = vFinal1.x;\n particle.velocity.y = vFinal1.y;\n\n otherParticle.velocity.x = vFinal2.x;\n otherParticle.velocity.y = vFinal2.y;\n }\n}", "function resolveCollision(particle, otherParticle) {\n const xVelocityDiff = particle.velocity.x - otherParticle.velocity.x;\n const yVelocityDiff = particle.velocity.y - otherParticle.velocity.y;\n\n const xDist = otherParticle.x - particle.x;\n const yDist = otherParticle.y - particle.y;\n\n // Prevent accidental overlap of particles\n if (xVelocityDiff * xDist + yVelocityDiff * yDist >= 0) {\n\n // Grab angle between the two colliding particles\n const angle = -Math.atan2(otherParticle.y - particle.y, otherParticle.x - particle.x);\n\n // Store mass in var for better readability in collision equation\n const m1 = particle.mass;\n const m2 = otherParticle.mass;\n\n // Velocity before equation\n const u1 = rotate(particle.velocity, angle);\n const u2 = rotate(otherParticle.velocity, angle);\n\n // Velocity after 1d collision equation\n const v1 = { x: u1.x * (m1 - m2) / (m1 + m2) + u2.x * 2 * m2 / (m1 + m2), y: u1.y };\n const v2 = { x: u2.x * (m1 - m2) / (m1 + m2) + u1.x * 2 * m2 / (m1 + m2), y: u2.y };\n\n // Final velocity after rotating axis back to original location\n const vFinal1 = rotate(v1, -angle);\n const vFinal2 = rotate(v2, -angle);\n\n // Swap particle velocities for realistic bounce effect\n particle.velocity.x = vFinal1.x;\n particle.velocity.y = vFinal1.y;\n\n otherParticle.velocity.x = vFinal2.x;\n otherParticle.velocity.y = vFinal2.y;\n }\n}", "solveCollision2(transformA, physicsA, colliderA, transformB, physicsB, colliderB){\n // let nameA = \"unknown\";\n // let nameB = \"unknown\";\n // if(colliderA.gameObject.name != null) nameA = colliderA.gameObject.name;\n // if(colliderB.gameObject.name != null) nameB = colliderB.gameObject.name;\n console.log(\"[\"+frameCount+\"] solveCollision2 {\"+colliderA.gameObject.name+\"} -- {\"+colliderB.gameObject.name+\"}\");\n physicsA.speed = 0;\n physicsA.direction = createVector(0,0,0);\n physicsA.nextFrameLocal = transformA.local;\n physicsB.speed = 0;\n physicsB.direction = createVector(0,0,0);\n physicsB.nextFrameLocal = transformB.local;\n }", "function resolveCollisionsBottomToTop(nodes, y, i, alpha) {\n for (; i >= 0; --i) {\n var node = nodes[i];\n var dy_4 = (node.y1 - y) * alpha;\n if (dy_4 > 1e-6)\n (node.y0 -= dy_4), (node.y1 -= dy_4);\n y = node.y0 - py;\n }\n }", "function nodeRepulsion(node1, node2) {\n // we do this twice because we want to repel from both corners, not just the\n // upper left corner.\n var x1 = node1.x + node1.group.x + ITEM_WIDTH * node1.nodeDegree / 2;\n var x2 = node2.x + node2.group.x + ITEM_WIDTH * node2.nodeDegree / 2;\n\n\n var r = x1 - x2;\n\n var force = 0;\n\n force = KE * Math.pow(node1.nodeDegree - 2, 1.5)\n * Math.pow(Q_CONST, 2) / Math.pow(r,2);\n\n if (r < 0) {\n force = -force;\n }\n //console.log(\"repulsive force: \" + force);\n return force\n}", "function collide(node1,node2,callback) {\n if(getDistance(node1,node2) < 80){\n callback.apply(this,arguments);\n }\n}", "handleCollisions(){\n\t const newX = this.head.x + (this.direction.x * this.speed);\n\t const xExplorer = new Coord(newX, this.head.y);\n\t const xCollision = this.map.collidingWithWall(xExplorer);\n\t\n\t const newY = this.head.y + (this.direction.y * this.speed);\n\t const yExplorer = new Coord(this.head.x, newY);\n\t const yCollision = this.map.collidingWithWall(yExplorer);\n\t\n\t const zExplorer = new Coord(newX, newY);\n\t const zCollision = this.map.collidingWithWall(zExplorer);\n\t\n\t if (xCollision || yCollision || zCollision) {\n\t // generate reflected ray\n\t\n\t // reflect direction based on collision\n\t const reflectionDirection = new Coord(this.direction.x, this.direction.y);\n\t if (xCollision) {\n\t reflectionDirection.x = -reflectionDirection.x;\n\t } else if (yCollision) {\n\t reflectionDirection.y = -reflectionDirection.y;\n\t } else {\n\t reflectionDirection.y = -reflectionDirection.y;\n\t reflectionDirection.x = -reflectionDirection.x;\n\t }\n\t\n\t const origin = new Coord(this.head.x, this.head.y);\n\t const reflection = new Ray(\n\t origin,\n\t reflectionDirection,\n\t this.map,\n\t this.age, // advance new ray age to parent ray current age\n\t this.body.length // set new ray max length\n\t );\n\t\n\t reflection.monster = this.monster;\n\t\n\t this.map.rays.push(reflection);\n\t // console.log(this.map.rays.length);\n\t\n\t // stop expansion of current ray\n\t this.direction.x = 0;\n\t this.direction.y = 0;\n\t\n\t return true;\n\t } else {\n\t return false;\n\t }\n\t }", "function collide(node) {\n\t var r = node.radius,\n\t\tnx1 = node.x - r,\n\t\tnx2 = node.x + r,\n\t\tny1 = node.y - r,\n\t\tny2 = node.y + r;\n\t return function(quad, x1, y1, x2, y2) {\n\t\tif (quad.point && (quad.point !== node)) {\n\t\t var x = node.x - quad.point.x,\n\t\t\ty = node.y - quad.point.y,\n\t\t\tl = Math.sqrt(x * x + y * y),\n\t\t\tr = 0.9*(node.radius + quad.point.radius);\n\t\t if (l < r) {\n\t\t\tl = (l - r) / l * .5;\n\t\t\t//node.x -= x *= l;\n\t\t\tnode.y -= y *= l;\n\t\t\t//quad.point.x += x;\n\t\t\tquad.point.y += y;\n\t\t }\n\t\t}\n\t\treturn x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1;\n\t };\n\t}", "function checkCollisions(){\r\n for(var i = 0; i < Object.keys(playerServerMetaList).length; i++){\r\n var currentID = Object.keys(playerServerMetaList)[i];\r\n for(var j = 0; j < playerServerMetaList[currentID].chunksVisible.length; j++){\r\n\r\n //PLAYERS\r\n for(var k = 0; k < Object.keys(playerServerMetaList[currentID].chunksVisible[j].players).length; k++){\r\n\r\n var otherID = Object.keys(playerServerMetaList[currentID].chunksVisible[j].players)[k];\r\n\r\n if(currentID == otherID){\r\n continue;\r\n }\r\n\r\n var squareDistance = Math.pow(playerMetaList[currentID].x - playerMetaList[otherID].x, 2) + Math.pow(playerMetaList[currentID].y - playerMetaList[otherID].y, 2);\r\n var squareTouchDistance = Math.pow(playerMetaList[currentID].radius + 10, 2) + Math.pow(playerMetaList[otherID].radius + 10, 2);;\r\n //Collision\r\n if(squareDistance <= squareTouchDistance){\r\n directionX = (playerMetaList[otherID].x - playerMetaList[currentID].x) / Math.sqrt(squareDistance);\r\n directionY = (playerMetaList[otherID].y - playerMetaList[currentID].y) / Math.sqrt(squareDistance);\r\n\r\n playerServerMetaList[otherID].xSpeed += directionX * 2;\r\n playerServerMetaList[otherID].ySpeed += directionY * 2;\r\n }\r\n }\r\n\r\n //ENTITIES\r\n for(var k = 0; k < Object.keys(playerServerMetaList[currentID].chunksVisible[j].entities).length; k++){\r\n var otherEntity = entityList[Object.keys(playerServerMetaList[currentID].chunksVisible[j].entities)[k]];\r\n\r\n var squareDistance = Math.pow(playerMetaList[currentID].x - otherEntity.x, 2) + Math.pow(playerMetaList[currentID].y - otherEntity.y, 2);\r\n\r\n\r\n\r\n //Collision\r\n if(squareDistance < playerMetaList[currentID].radius + entityRadius){\r\n /*\r\n directionX = (playerMetaList[currentID].x - otherEntity.x) / Math.sqrt(squareDistance);\r\n directionY = (playerMetaList[currentID].y - otherEntity.y) / Math.sqrt(squareDistance);\r\n\r\n otherEntity.xSpeed += directionX * 0.1;\r\n otherEntity.ySpeed += directionY * 0.1;\r\n */\r\n }\r\n }\r\n }\r\n }\r\n}", "function resolveCollision(particle, otherParticle) {\n const xVelocityDiff = particle.dx - otherParticle.dx;\n const yVelocityDiff = particle.dy - otherParticle.dy;\n\n const xDist = otherParticle.x - particle.x;\n const yDist = otherParticle.y - particle.y;\n\n // Prevent accidental overlap of particles\n if (xVelocityDiff * xDist + yVelocityDiff * yDist >= 0) {\n\n // Grab angle between the two colliding particles\n const angle = -Math.atan2(otherParticle.y - particle.y, otherParticle.x - particle.x);\n\n // Store mass in var for better readability in collision equation\n const m1 = particle.mass;\n const m2 = otherParticle.mass;\n\n // Velocity before equation\n const u1 = rotate(particle.dx, particle.dy, angle);\n const u2 = rotate(otherParticle.dx, otherParticle.dy, angle);\n\n // Velocity after 1d collision equation\n const v1 = { x: u1.x * (m1 - m2) / (m1 + m2) + u2.x * 2 * m2 / (m1 + m2), y: u1.y };\n const v2 = { x: u2.x * (m1 - m2) / (m1 + m2) + u1.x * 2 * m2 / (m1 + m2), y: u2.y };\n\n // Final velocity after rotating axis back to original location\n const vFinal1 = rotate(v1.x, v1.y, -angle);\n const vFinal2 = rotate(v2.x, v2.y, -angle);\n\n // Swap particle velocities for realistic bounce effect\n particle.dx = vFinal1.x;\n particle.dy = vFinal1.y;\n\n otherParticle.dx = vFinal2.x;\n otherParticle.dy = vFinal2.y;\n }\n }", "function collide (node) {\n\t\t var r = node.radius + 16,\n\t\t nx1 = node.x - r,\n\t\t nx2 = node.x + r,\n\t\t ny1 = node.y - r,\n\t\t ny2 = node.y + r;\n\t\t return function (quad, x1, y1, x2, y2) {\n\t\t if (quad.point && (quad.point !== node)) {\n\t\t var x = node.x - quad.point.x,\n\t\t y = node.y - quad.point.y,\n\t\t l = Math.sqrt(x * x + y * y),\n\t\t r = node.radius + quad.point.radius;\n\t\t if (l < r) {\n\t\t l = (l - r) / l * .5;\n\t\t node.x -= x *= l;\n\t\t node.y -= y *= l;\n\t\t quad.point.x += x;\n\t\t quad.point.y += y;\n\t\t }\n\t\t }\n\t\t return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1;\n\t\t };\n\t\t}", "resolveCollision(entity, delta_t) {\n //this.entities.forEach(e => {\n // Could only check collision if entity is within camera to save time\n let normal = this.player.detectCollison(entity, delta_t);\n if (normal !== undefined){\n this.player.resolveCollision(entity, delta_t, normal);\n return true;\n }\n return false;\n //}); \n }", "function collide(node) {\n\t var r = node.radius,\n\t\t nx1 = node.x - r,\n\t\t nx2 = node.x + r,\n\t\t ny1 = node.y - r,\n\t\t ny2 = node.y + r;\n\t return function(quad, x1, y1, x2, y2) {\n\t\t if (quad.point && (quad.point !== node)) {\n\t\t var x = node.x - quad.point.x,\n\t\t\t y = node.y - quad.point.y,\n\t\t\t l = Math.sqrt(x * x + y * y),\n\t\t\t r = 0.9*(node.radius + quad.point.radius);\n\t\t if (l < r) {\n\t\t\t l = (l - r) / l * .5;\n\t\t\t node.x -= x *= l;\n\t\t\t //node.y -= y *= l;\n\t\t\t quad.point.x += x;\n\t\t\t //quad.point.y += y;\n\t\t }\n\t\t }\n\t\t return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1;\n\t };\n\t }", "function collisionCheck() {\n for (var count = 0; count < BUSH_NUM; count++) {\n elfAndBush(bushes[count]);\n }\n\n for (var count = 0; count < BUNNY_NUM; count++) {\n elfAndBunny(bunnies[count]);\n }\n\n for (var count = 0; count < BUNNY_NUM; count++) {\n arrowAndBunny(bunnies[count], arrows[0]);\n arrowAndBunny(bunnies[count], arrows[1]);\n arrowAndBunny(bunnies[count], arrows[2]);\n arrowAndBunny(bunnies[count], arrows[3]);\n arrowAndBunny(bunnies[count], arrows[4]);\n }\n\n for (var count = 0; count < APPLE_NUM; count++) {\n elfAndApple(apples[count]);\n }\n}", "collide(p2, damp = 1) {\n // reference: http://codeflow.org/entries/2010/nov/29/verlet-collision-with-impulse-preservation\n // simultaneous collision not yet resolved. Possible solutions in this paper: https://www2.msm.ctw.utwente.nl/sluding/PAPERS/dem07.pdf \n let p1 = this;\n let dp = p1.$subtract(p2);\n let distSq = dp.magnitudeSq();\n let dr = p1.radius + p2.radius;\n if (distSq < dr * dr) {\n let c1 = p1.changed;\n let c2 = p2.changed;\n let dist = Math.sqrt(distSq);\n let d = dp.$multiply(((dist - dr) / dist) / 2);\n let np1 = p1.$subtract(d);\n let np2 = p2.$add(d);\n p1.to(np1);\n p2.to(np2);\n let f1 = damp * dp.dot(c1) / distSq;\n let f2 = damp * dp.dot(c2) / distSq;\n let dm1 = p1.mass / (p1.mass + p2.mass);\n let dm2 = p2.mass / (p1.mass + p2.mass);\n c1.add(new Pt_1.Pt(f2 * dp[0] - f1 * dp[0], f2 * dp[1] - f1 * dp[1]).$multiply(dm2));\n c2.add(new Pt_1.Pt(f1 * dp[0] - f2 * dp[0], f1 * dp[1] - f2 * dp[1]).$multiply(dm1));\n p1.previous = p1.$subtract(c1);\n p2.previous = p2.$subtract(c2);\n }\n }", "function collide(node) {\n var nodeID = +d3.select(node).attr('id')\n var dx = +d3.select(node).attr('cx')\n var dy = +d3.select(node).attr('cy')\n var r = +d3.select(node).attr('r'),\n nx1 = dx - r,\n nx2 = dx + r,\n ny1 = dy - r,\n ny2 = dy + r\n var colliding = false\n d3.selectAll('g').each(function(point, i) {\n var pointID = +d3.select(this).attr('id')\n var pr = +d3.select(this).attr('r')\n var px = +d3.select(this).attr('cx')\n var py = +d3.select(this).attr('cy')\n var x1 = px - pr,\n y1 = py - pr,\n x2 = px + pr,\n y2 = py + pr\n var x = dx - px,\n y = dy - py,\n l = Math.sqrt(x * x + y * y),\n rad = r + pr\n if (l < rad) {\n l = (l - rad) / l * .5\n\n if (!isFinite(l)) {\n l = 0\n }\n x *= l\n y *= l\n dx -= x\n dy -= y\n px += x\n py += y\n\n if (d3.select(this).classed('ended') && d3.select(this).attr('T') == 1) {\n d3.select(node).attr('cx', Math.max(r, Math.min(w - r, dx)))\n d3.select(this).attr('cx', Math.max(pr, Math.min(w - pr, px)))\n\n } else if (d3.select(node).classed('ended') && d3.select(node).attr('T') == 1) {\n d3.select(node).attr('cx', Math.max(r, Math.min(w - r, dx)))\n d3.select(this).attr('cx', Math.max(pr, Math.min(w - pr, px)))\n } else {\n d3.select(node).attr('cx', Math.max(r, Math.min(w - r, dx)))\n d3.select(node).attr('cy', Math.max(r, Math.min(h - r, dy)))\n d3.select(this).attr('cx', Math.max(pr, Math.min(w - pr, px)))\n d3.select(this).attr('cy', Math.max(py, Math.min(h - pr, py)))\n }\n\n\n\n }\n if (!(nx1 > x2 || nx2 < x1 || ny1 > y2 || ny2 < y1) && pointID != nodeID)\n colliding = true\n })\n return colliding\n}", "function resolveClusters() {\n //Encontra os Matchs\n findClusters();\n //Enquanto houver Matchs\n while (clusters.length > 0) {\n //Remove-os\n removeClusters();\n //Desce os tiles\n shiftTiles();\n //Verifica a formação de mais\n findClusters();\n }\n }", "async resolveConflicts() {\n const neighbours = this.nodes;\n let newChain = undefined;\n\n // We're only looking for chains longer than ours\n let maxLength = this.chain.length;\n\n // Grab and verify the chains from all the nodes in our network\n for (const node of neighbours) {\n const response = await axios(`http://${ node }/chain`);\n\n if (response.status === 200) {\n const length = response.data.length;\n const chain = response.data.chain;\n\n // Check if the length is longer and the chain is valid\n if (length > maxLength && Blockchain.validChain(chain)) {\n maxLength = length;\n newChain = chain;\n }\n }\n }\n\n if (newChain) {\n this.chain = newChain;\n return true;\n }\n\n return false;\n }", "function collide(alpha, nodes) {\n var quadtree = d3.geom.quadtree(nodes);\n return function(d) {\n var rb = 2*radius + padding,\n nx1 = d.x - rb,\n nx2 = d.x + rb,\n ny1 = d.y - rb,\n ny2 = d.y + rb;\n quadtree.visit(function(quad, x1, y1, x2, y2) {\n if (quad.point && (quad.point !== d)) {\n var x = d.x - quad.point.x,\n y = d.y - quad.point.y,\n l = Math.sqrt(x * x + y * y);\n if (l < rb) {\n l = (l - rb) / l * alpha;\n d.x -= x *= l;\n d.y -= y *= l;\n quad.point.x += x;\n quad.point.y += y;\n }\n }\n return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1;\n });\n };\n}", "function resolveConflicts(conflicts, node, $kids, $oldkids, numAddedNodes) {\n // the distance between the first conflicting node and the last\n var distance = conflicts.length - 1,\n // prevents same conflict being resolved twice consider when two nodes switch places.\n // only one should be given a mutation event (note -~ is used as a math.ceil shorthand)\n counter = -~((distance - numAddedNodes) / 2), $cur, oldstruct, conflict;\n while (conflict = conflicts.pop()) {\n $cur = $kids[conflict.i];\n oldstruct = $oldkids[conflict.j];\n // attempt to determine if there was node rearrangement... won't gaurentee all matches\n // also handles case where added/removed nodes cause nodes to be identified as conflicts\n if (config.kids && counter && Math.abs(conflict.i - conflict.j) >= distance) {\n mutations.push(MutationRecord({\n type: 'childList', target: node, addedNodes: [$cur], removedNodes: [$cur],\n // haha don't rely on this please\n nextSibling: $cur.nextSibling, previousSibling: $cur.previousSibling\n }));\n counter--; // found conflict\n }\n // Alright we found the resorted nodes now check for other types of mutations\n if (config.attr && oldstruct.attr) findAttributeMutations(mutations, $cur, oldstruct.attr, config.afilter);\n if (config.charData && $cur.nodeType === 3 && $cur.nodeValue !== oldstruct.charData)\n mutations.push(MutationRecord({type: 'characterData', target: $cur}));\n // now look @ subtree\n if (config.descendents) findMutations($cur, oldstruct);\n }\n }", "function resolveClusters() {\n \n // Check for clusters\n findClusters();\n \n // While there are clusters left\n while (clusters.length > 0) {\n \n // Remove clusters\n removeClusters();\n \n // Shift tiles\n shiftTiles();\n \n // Check if there are clusters left\n findClusters();\n }\n }", "collision() {\n\t\tthis.vars.collision = true;\n\t}", "function collide(node) {\n var r = node.radius + 16,\n nx1 = node.x - r,\n nx2 = node.x + r,\n ny1 = node.y - r,\n ny2 = node.y + r;\n return function(quad, x1, y1, x2, y2) {\n if (quad.point && (quad.point !== node)) {\n var x = node.x - quad.point.x,\n y = node.y - quad.point.y,\n l = Math.sqrt(x * x + y * y),\n r = node.radius + quad.point.radius;\n if (l < r) {\n l = (l - r) / l * .5;\n node.x -= x *= l;\n node.y -= y *= l;\n quad.point.x += x;\n quad.point.y += y;\n }\n }\n return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1;\n };\n }", "function resolveCollision(particle) {\n var canvas = document.querySelector('canvas');\n var xVelocityDiff = particle.velocity.x - 0;\n var yVelocityDiff = particle.velocity.y - 0;\n var centerX = canvas.width / 2;\n var centerY = canvas.height / 2;\n var xDist = centerX - particle.x;\n var yDist = centerY - particle.y; // Prevent accidental overlap of particles\n\n if (xVelocityDiff * xDist + yVelocityDiff * yDist >= 0) {\n // Grab angle between the two colliding particles\n var angle = -Math.atan2(centerY - particle.y, centerX - particle.x); // Store mass in var for better readability in collision equation\n\n var m1 = particle.mass;\n var m2 = 100; // Velocity before equation\n\n var u1 = rotate(particle.velocity, angle);\n var u2 = rotate({\n x: 0,\n y: 0\n }, angle); // Velocity after 1d collision equation\n\n var v1 = {\n x: u1.x * (m1 - m2) / (m1 + m2) + u2.x * 2 * m2 / (m1 + m2),\n y: u1.y\n }; // Final velocity after rotating axis back to original location\n\n var vFinal1 = rotate(v1, -angle); // Swap particle velocities for realistic bounce effect\n\n particle.velocity.x = vFinal1.x;\n particle.velocity.y = vFinal1.y;\n }\n}", "function checkCollision(i1, i2, result) {\n\n var p1 = i1.position;\n var b1 = i1.body;\n var p2 = i2.position;\n var b2 = i2.body;\n\n if ((b1.type & 1) && (b2.type & 1)) {\n // this check is pointless for 2 circles as it's the same as the full test\n if (b1.type !== T.BODY_CIRCLE || b2.type !== T.BODY_CIRCLE) {\n vec2.add(p1, b1.boundOffset, tv1);\n vec2.add(p2, b2.boundOffset, tv2);\n var rss = b1.boundRadius + b2.boundRadius;\n if (tv1.distancesq(tv2) > rss*rss) {\n return false;\n }\n }\n }\n\n var colliding = null;\n var flipped = false;\n\n if (b1.type > b2.type) {\n \n var tmp = b2;\n b2 = b1;\n b1 = tmp;\n\n tmp = i2;\n i2 = i1;\n i1 = tmp;\n\n tmp = p2;\n p2 = p1;\n p1 = tmp;\n\n flipped = true;\n\n }\n\n if (b1.type === T.BODY_AABB) {\n if (b2.type === T.BODY_AABB) {\n colliding = AABB_AABB(i1, i2, result);\n } else if (b2.type === T.BODY_CIRCLE) {\n colliding = AABB_circle(p1, b1, p2, b2, result);\n } else if (b2.type === T.BODY_LINE_SEGMENT) {\n colliding = AABB_lineSegment(p1, b1, p2, b2, result);\n }\n } else if (b1.type === T.BODY_CIRCLE) {\n if (b2.type === T.BODY_CIRCLE) {\n colliding = circle_circle(p1, b1, p2, b2, result);\n } else if (b2.type === T.BODY_LINE_SEGMENT) {\n colliding = circle_lineSegment(i1, i2, result);\n }\n } else if (b1.type === T.BODY_LINE_SEGMENT) {\n if (b2.type === T.BODY_LINE_SEGMENT) {\n colliding = lineSegment_lineSegment(p1, b1.size, p2, b2.size, result);\n }\n }\n\n if (colliding === null) {\n console.error(\"warning: unsupported arguments to collision detection\");\n return false; \n } else {\n if (flipped) {\n result.mtv.x *= -1;\n result.mtv.y *= -1;\n }\n return colliding;\n }\n\n}", "function resolveClusters() {\n // Check for clusters\n findClusters();\n \n // While there are clusters left\n while (clusters.length > 0) {\n \n // Remove clusters\n removeClusters();\n \n // Shift tiles\n shiftTiles();\n \n // Check if there are clusters left\n findClusters();\n }\n }", "function resolveClusters() {\n // Check for clusters\n findClusters();\n \n // While there are clusters left\n while (clusters.length > 0) {\n \n // Remove clusters\n removeClusters();\n \n // Shift tiles\n shiftTiles();\n \n // Check if there are clusters left\n findClusters();\n }\n }", "collision () {\n }", "function resolveConflicts(conflicts, node, $kids, $oldkids, numAddedNodes) {\n // the distance between the first conflicting node and the last\n var distance = conflicts.length - 1;\n // prevents same conflict being resolved twice consider when two nodes switch places.\n // only one should be given a mutation event (note -~ is used as a math.ceil shorthand)\n var counter = -~((distance - numAddedNodes) / 2);\n var $cur;\n var oldstruct;\n var conflict;\n while ((conflict = conflicts.pop())) {\n $cur = $kids[conflict.i];\n oldstruct = $oldkids[conflict.j];\n\n // attempt to determine if there was node rearrangement... won't gaurentee all matches\n // also handles case where added/removed nodes cause nodes to be identified as conflicts\n if (config.kids && counter && Math.abs(conflict.i - conflict.j) >= distance) {\n mutations.push(MutationRecord({\n type: \"childList\",\n target: node,\n addedNodes: [$cur],\n removedNodes: [$cur],\n // haha don't rely on this please\n nextSibling: $cur.nextSibling,\n previousSibling: $cur.previousSibling\n }));\n counter--; // found conflict\n }\n\n // Alright we found the resorted nodes now check for other types of mutations\n if (config.attr && oldstruct.attr) findAttributeMutations(mutations, $cur, oldstruct.attr, config.afilter);\n if (config.charData && $cur.nodeType === 3 && $cur.nodeValue !== oldstruct.charData) {\n mutations.push(MutationRecord({\n type: \"characterData\",\n target: $cur,\n oldValue: oldstruct.charData\n }));\n }\n // now look @ subtree\n if (config.descendents) findMutations($cur, oldstruct);\n }\n }", "function forceCollision() {\n var nodes;\n var radii;\n var strength = 1;\n var iterations = 1;\n\n function radius(d) {\n return d.r;\n }\n\n function x(d) {\n return d.x + d.vx;\n }\n\n function y(d) {\n return d.y + d.vy;\n }\n\n function constant(x) {\n return function () {\n return x;\n };\n }\n\n function force() {\n var i;\n var n = nodes.length;\n var tree;\n var node;\n var xi;\n var yi;\n var ri;\n var ri2;\n\n for (var k = 0; k < iterations; ++k) {\n tree = d3__WEBPACK_IMPORTED_MODULE_6__[\"quadtree\"](nodes, x, y).visitAfter(prepare);\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n ri = radii[node.index];\n ri2 = ri * ri;\n xi = node.x + node.vx;\n yi = node.y + node.vy;\n tree.visit(apply);\n } //for i\n\n } //for k\n\n\n function apply(quad, x0, y0, x1, y1) {\n var data = quad.data;\n var rj = quad.r;\n var r = ri + rj;\n\n if (data) {\n if (data.index > node.index) {\n var _x = xi - data.x - data.vx;\n\n var _y = yi - data.y - data.vy;\n\n var l = _x * _x + _y * _y;\n\n if (l < r * r) {\n if (_x === 0) _x = jiggle(), l += _x * _x;\n if (_y === 0) _y = jiggle(), l += _y * _y;\n l = (r - (l = Math.sqrt(l))) / l * strength;\n node.vx += (_x *= l) * (r = (rj *= rj) / (ri2 + rj));\n node.vy += (_y *= l) * r;\n data.vx -= _x * (r = 1 - r);\n data.vy -= _y * r;\n } //if\n\n } //if\n\n\n return;\n } //if\n\n\n return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;\n } //function apply\n\n } //function force\n\n\n function prepare(quad) {\n if (quad.data) return quad.r = radii[quad.data.index];\n\n for (var i = quad.r = 0; i < 4; ++i) {\n if (quad[i] && quad[i].r > quad.r) {\n quad.r = quad[i].r;\n } //if\n\n } //for i\n\n } //function prepare\n\n\n function initialize() {\n if (!nodes) return;\n var i,\n n = nodes.length,\n node;\n radii = new Array(n);\n\n for (i = 0; i < n; ++i) {\n node = nodes[i], radii[node.index] = +radius(node, i, nodes);\n }\n } //function initialize\n\n\n force.initialize = function (_) {\n nodes = _;\n initialize();\n return force;\n };\n\n force.iterations = function (_) {\n return arguments.length ? (iterations = +_, force) : iterations;\n };\n\n force.strength = function (_) {\n return arguments.length ? (strength = +_, force) : strength;\n };\n\n force.radius = function (_) {\n return arguments.length ? (radius = typeof _ === 'function' ? _ : constant(+_), force) : radius;\n };\n\n return force;\n } //function forceCollision", "function forceCollision() {\n var nodes;\n var radii;\n var strength = 1;\n var iterations = 1;\n\n function radius(d) {\n return d.r;\n }\n\n function x(d) {\n return d.x + d.vx;\n }\n\n function y(d) {\n return d.y + d.vy;\n }\n\n function constant(x) {\n return function () {\n return x;\n };\n }\n\n function force() {\n var i;\n var n = nodes.length;\n var tree;\n var node;\n var xi;\n var yi;\n var ri;\n var ri2;\n\n for (var k = 0; k < iterations; ++k) {\n tree = d3__WEBPACK_IMPORTED_MODULE_6__[\"quadtree\"](nodes, x, y).visitAfter(prepare);\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n ri = radii[node.index];\n ri2 = ri * ri;\n xi = node.x + node.vx;\n yi = node.y + node.vy;\n tree.visit(apply);\n } //for i\n\n } //for k\n\n\n function apply(quad, x0, y0, x1, y1) {\n var data = quad.data;\n var rj = quad.r;\n var r = ri + rj;\n\n if (data) {\n if (data.index > node.index) {\n var _x = xi - data.x - data.vx;\n\n var _y = yi - data.y - data.vy;\n\n var l = _x * _x + _y * _y;\n\n if (l < r * r) {\n if (_x === 0) _x = jiggle(), l += _x * _x;\n if (_y === 0) _y = jiggle(), l += _y * _y;\n l = (r - (l = Math.sqrt(l))) / l * strength;\n node.vx += (_x *= l) * (r = (rj *= rj) / (ri2 + rj));\n node.vy += (_y *= l) * r;\n data.vx -= _x * (r = 1 - r);\n data.vy -= _y * r;\n } //if\n\n } //if\n\n\n return;\n } //if\n\n\n return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;\n } //function apply\n\n } //function force\n\n\n function prepare(quad) {\n if (quad.data) return quad.r = radii[quad.data.index];\n\n for (var i = quad.r = 0; i < 4; ++i) {\n if (quad[i] && quad[i].r > quad.r) {\n quad.r = quad[i].r;\n } //if\n\n } //for i\n\n } //function prepare\n\n\n function initialize() {\n if (!nodes) return;\n var i,\n n = nodes.length,\n node;\n radii = new Array(n);\n\n for (i = 0; i < n; ++i) {\n node = nodes[i], radii[node.index] = +radius(node, i, nodes);\n }\n } //function initialize\n\n\n force.initialize = function (_) {\n nodes = _;\n initialize();\n return force;\n };\n\n force.iterations = function (_) {\n return arguments.length ? (iterations = +_, force) : iterations;\n };\n\n force.strength = function (_) {\n return arguments.length ? (strength = +_, force) : strength;\n };\n\n force.radius = function (_) {\n return arguments.length ? (radius = typeof _ === 'function' ? _ : constant(+_), force) : radius;\n };\n\n return force;\n } //function forceCollision", "function peopleCollisions(population) {\n // we only care about infected people\n const infected = population.filter(p => p.infected !== null);\n\n // find people in vicinity of infected people\n const collisions = infected.map(person => {\n // subdivides whole space to find nearest candidates\n const subdvidedSpace = d3\n .quadtree()\n .extent([\n [-1, -1],\n [RADIUS * 2, RADIUS * 2]\n ])\n .x(d => d.x)\n .y(d => d.y)\n .addAll(\n // everyone not infected and not current lookup\n population\n .filter(p => !p.infected)\n .filter(p => p.key !== person.key)\n );\n\n // person within RADIUS*2 of lookup position\n const candidate = subdvidedSpace.find(person.x, person.y, RADIUS * 2);\n\n return candidate ? candidate : null;\n });\n\n return collisions.filter(p => p !== null);\n}", "handleCollision(climber) {\n\n // distance\n //\n // to calculate the distance between the avalanche and climber\n let d = dist(this.x, this.y, climber.x, climber.y);\n\n // dist()\n //\n // To keep track of the avalanche and the avatar are in contact\n if (d < this.width / 2 + climber.width / 2) {\n // this is to push the climber down\n climber.vy += 2;\n\n }\n }", "collisionWithSelf(x, y) {\n for (let i = 1; i < this.units.length; ++i) {\n if (this.units[i].x === x && this.units[i].y === y) {\n this.death(true);\n }\n }\n }", "function collide(node) {\n// var r1 = 2 + (radtype ? node.pr_rad : node.evc_rad)\n var r1 = 1 + node.radius\n var nx1 = node.x - r1\n var nx2 = node.x + r1\n var ny1 = node.y - r1\n var ny2 = node.y + r1\n return function(quad, x1, y1, x2, y2) {\n if (quad.point && (quad.point !== node)) {\n var x = node.x - quad.point.x\n var y = node.y - quad.point.y\n var l = Math.sqrt(x * x + y * y)\n// var r = radtype ? (node.pr_rad + quad.point.pr_rad) : (node.evc_rad + quad.point.evc_rad)\n var r = node.radius + quad.point.radius\n if (l < r) {\n l = (l - r) / l * 0.5\n node.x -= x *= l\n node.y -= y *= l\n quad.point.x += x\n quad.point.y += y\n }\n }\n return x1 > nx2\n || x2 < nx1\n || y1 > ny2\n || y2 < ny1\n }\n}", "function checkForMatchingNodes() {\n if(!inMotion){\n \n\n if(intersect !== undefined && isNearNode(intersect.object)) {\n rotationCount = 0;\n activeNode = intersect.object;\n originalRotY = activeNode.rotation.y;\n activeNode.updateMatrixWorld();\n THREE.SceneUtils.attach(bridge, scene, activeNode);\n inMotion = true;\n }\n }\n}", "function calculateCollisions(){\n\tfor(let player1 of Object.keys(players)){\n\t\tfor(let player2 of Object.keys(players)){\n\t\t\tif(player1 != player2){\n\t\t\t\t//If the two players have collided, note that in the collisions object\n\t\t\t\tif(detectCollision(players[player1], players[player2])){\n\t\t\t\t\tif(!collisions[player1].includes(player2)){\n\t\t\t\t\t\tcollisions[player1].push(player2);\n\n\t\t\t\t\t\t//If a collision occurs between the player who is it and someone else, then the other player is now it.\n\t\t\t\t\t\tif(players[player1].it || players[player2].it){\n\t\t\t\t\t\t\tconsole.log(\"Tag, you're it!\");\n\t\t\t\t\t\t\tplayers[player1].it = !players[player1].it;\n\t\t\t\t\t\t\tplayers[player2].it = !players[player2].it;\n\t\t\t\t\t\t\ttaggedBy[player1] = player2;\n\t\t\t\t\t\t\ttaggedBy[player2] = player1;\n\n\t\t\t\t\t\t\t//Update the players to the client\n\t\t\t\t\t\t\tio.emit(\"updatePlayer\", {\n\t\t\t\t\t\t\t\tindex: player1,\n\t\t\t\t\t\t\t\tdata: players[player1]\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tio.emit(\"updatePlayer\", {\n\t\t\t\t\t\t\t\tindex: player2,\n\t\t\t\t\t\t\t\tdata: players[player2]\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\t//Need to update the inverse as well\n\t\t\t\t\tif(!collisions[player2].includes(player1)){\n\t\t\t\t\t\tcollisions[player2].push(player1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//If the two players have not collided, but they are noted as colliding, a separation has occurred. \n\t\t\t\telse{\n\t\t\t\t\tif(collisions[player1].includes(player2)){\n\t\t\t\t\t\tcollisions[player1].splice(collisions[player1].indexOf(player2), 1);\n\t\t\t\t\t\t//Need to update the inverse as well\n\t\t\t\t\t\tcollisions[player2].splice(collisions[player2].indexOf(player1), 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "calRepulsive(displacements, vecMap) {\n const self = this;\n const nodes = self.nodes;\n const max = self.width * self.optimizeRangeFactor;\n const nodeStrength = self.nodeStrength;\n const alpha = self.alpha;\n const nodeCollideStrength = self.nodeCollideStrength;\n const preventNodeOverlap = self.preventNodeOverlap;\n const nodeSizeFunc = self.nodeSize;\n const nodeSpacingFunc = self.nodeSpacing;\n const scale = self.depthRepulsiveForceScale;\n const center = self.center;\n nodes.forEach((v, i) => {\n if (!v.x || !v.y)\n return;\n // center gravity\n if (center) {\n const gravity = self.gravity;\n const vecX = v.x - center[0] || 0.005;\n const vecY = v.y - center[1] || 0.005;\n const l = Math.sqrt(vecX * vecX + vecY * vecY);\n displacements[i].x -= (vecX * gravity * alpha) / l;\n displacements[i].y -= (vecY * gravity * alpha) / l;\n }\n nodes.forEach((u, j) => {\n if (i === j) {\n return;\n }\n if (!u.x || !u.y)\n return;\n const { vl2, vl } = vecMap[`${v.id}-${u.id}`];\n if (vl > max)\n return;\n const { vx, vy } = vecMap[`${v.id}-${u.id}`];\n let depthDiff = Math.log(Math.abs(u.depth - v.depth) / 10) + 1 || 1;\n depthDiff = depthDiff < 1 ? 1 : depthDiff;\n if (u.comboId !== v.comboId)\n depthDiff += 1;\n const depthParam = depthDiff ? Math.pow(scale, depthDiff) : 1;\n const params = ((nodeStrength(u) * alpha) / vl2) * depthParam;\n displacements[i].x += vx * params;\n displacements[i].y += vy * params;\n // prevent node overlappings\n if (i < j && preventNodeOverlap) {\n const ri = nodeSizeFunc(v) + nodeSpacingFunc(v);\n const rj = nodeSizeFunc(u) + nodeSpacingFunc(u);\n const r = ri + rj;\n if (vl2 < r * r) {\n const ll = ((r - vl) / vl) * nodeCollideStrength;\n const rj2 = rj * rj;\n let rratio = rj2 / (ri * ri + rj2);\n const xl = vx * ll;\n const yl = vy * ll;\n displacements[i].x += xl * rratio;\n displacements[i].y += yl * rratio;\n rratio = 1 - rratio;\n displacements[j].x -= xl * rratio;\n displacements[j].y -= yl * rratio;\n }\n }\n });\n });\n }", "doEntityCollision() {\n Object.values(this.entities).forEach((ent = new Entity()) => {\n // pls give object.length js\n if (ent.enableCollision && Object.keys(ent.collideFunctions).length > 0) {\n var samePosEnt = Object.values(this.entities).find(e => ent.x == e.x && ent.y == e.y);\n if (samePosEnt && ent.collideFunctions[samePosEnt.name] && samePosEnt.enableCollision) {\n if (params.debug) console.log(\"DEBUG: Entity \" + ent.name + \" collided with entity \" + samePosEnt.name + \".\");\n ent.collideFunctions[samePosEnt.name]();\n }\n }\n });\n }", "function areCollide(r1, r2) {\n //Define the variables we'll need to calculate\n var hit, combinedHalfWidths, combinedHalfHeights, vx, vy;\n\n //hit will determine whether there's a collision\n hit = false;\n\n //Find the center points of each sprite\n r1.centerX = r1.x + r1.width / 2;\n r1.centerY = r1.y + r1.height / 2;\n r2.centerX = r2.x + r2.width / 2;\n r2.centerY = r2.y + r2.height / 2;\n\n //Find the half-widths and half-heights of each sprite\n r1.halfWidth = r1.width / 2;\n r1.halfHeight = r1.height / 2;\n r2.halfWidth = r2.width / 2;\n r2.halfHeight = r2.height / 2;\n\n //Calculate the distance vector between the sprites\n vx = r1.centerX - r2.centerX;\n vy = r1.centerY - r2.centerY;\n\n //Figure out the combined half-widths and half-heights\n combinedHalfWidths = r1.halfWidth + r2.halfWidth;\n combinedHalfHeights = r1.halfHeight + r2.halfHeight;\n\n //Check for a collision on the x axis\n if (Math.abs(vx) < combinedHalfWidths) {\n\n //A collision might be occuring. Check for a collision on the y axis\n if (Math.abs(vy) < combinedHalfHeights) {\n\n //There's definitely a collision happening\n hit = true;\n } else {\n\n //There's no collision on the y axis\n hit = false;\n }\n } else {\n\n //There's no collision on the x axis\n hit = false;\n }\n\n //`hit` will be either `true` or `false`\n return hit;\n}", "function updateCol(b1, b2){\n\tvar collisionAngle = Math.atan2(b1.nextY - b2.nextY, b1.nextX - b2.nextX)\n\tb1.updateInfo();\n\tb2.updateInfo();\n\n\n\tvar dx1 = b1.speed * Math.cos(b1.direction - collisionAngle);\n\tvar dx2 = b2.speed * Math.cos(b2.direction - collisionAngle);\n\n\tvar dy1 = b1.speed * Math.sin(b1.direction - collisionAngle);\n\tvar dy2 = b2.speed * Math.sin(b2.direction - collisionAngle);\n\n\tvar final_dx1 = ((b1.mass - b2.mass) * dx1 + 2 * b2.mass * dx2)\n\t\t/(b1.mass + b2.mass);\n\tvar final_dx2 = ((b2.mass - b1.mass) * dx2 + 2 * b1.mass * dx1)/(b1.mass + b2.mass);\n\tvar final_dy1 = dy1;\n\tvar final_dy2 = dy2;\n\tb1.dx = Math.cos(collisionAngle) * final_dx1 +\n\t\tMath.cos(collisionAngle + Math.PI/2) * final_dy1;\n\tb2.dx = Math.cos(collisionAngle) * final_dx2 +\n\t\tMath.cos(collisionAngle + Math.PI/2) * final_dy2;\n\tb1.dy = Math.sin(collisionAngle) * final_dx1 +\n\t\tMath.sin(collisionAngle + Math.PI/2) * final_dy1;\n\tb2.dy = Math.sin(collisionAngle) * final_dx2 +\n\t\tMath.sin(collisionAngle + Math.PI/2) * final_dy2;\n}", "function check_collision( objects_to_check )\n\t{\n\t\treturn false;\n\t}", "function resolveCollisionsInSelection(selection) {\n\t var bounds = [];\n\t selection.each(function(){\n\t var bbox = $(this)[0].getBBox();\n\t bounds.push({\n\t left: bbox.x,\n\t right: bbox.x + bbox.width,\n\t top: bbox.y,\n\t bottom: bbox.y + bbox.height\n\t });\n\t });\n\t var collisions = {};\n\t var collider, collidee;\n\t for (collider = 0; collider < bounds.length; collider++) {\n\t var colliderBounds = bounds[collider];\n\t for (collidee = 0; collidee < bounds.length; collidee++) { if (collider !== collidee) {\n\t var collideeBounds = bounds[collidee];\n\t var collisionLR = colliderBounds.right - collideeBounds.left;\n\t var collisionRL = colliderBounds.left - collideeBounds.right;\n\t var collisionTB = colliderBounds.bottom - collideeBounds.top;\n\t var collisionBT = colliderBounds.top - collideeBounds.bottom;\n\n\t if (collisionLR > 0 && collisionRL < 0 && collisionTB > 0 && collisionBT < 0) {\n\t if (!collisions[collider]) {\n\t collisions[collider] = {};\n\t }\n\t if (!collisions[collider][collidee]) {\n\t collisions[collider][collidee] = {};\n\t }\n\t collisions[collider][collidee] = {\n\t x: (collisionLR > -collisionRL ? collisionRL : collisionLR),\n\t y: (collisionTB > -collisionBT ? collisionBT : collisionTB)\n\t };\n\t }\n\t }}\n\t }\n\n\t function adjustBy(collision, coordinate) {\n\t return function() {\n\t var t = $(this).attr(coordinate);\n\t var adjustment = collision[coordinate];\n\t $(this).attr(coordinate, t - adjustment / 1.9);\n\t };\n\t }\n\n\t for (collider in collisions) {if (collisions.hasOwnProperty(collider)) {\n\t var collidingWith = collisions[collider];\n\t for (collidee in collidingWith) {if (collidingWith.hasOwnProperty(collidee)) {\n\t var collision = collidingWith[collidee];\n\t var g = $(selection[collider]);\n\t if (Math.abs(collision.x) < Math.abs(collision.y)) {\n\t g.find('text').each(adjustBy(collision, 'x'));\n\t } else {\n\t g.find('text').each(adjustBy(collision, 'y'));\n\t }\n\t }}\n\t }}\n\n\t return [\n\t findExtremeBounds(bounds),\n\t !!(Object.keys(collisions).length)\n\t ];\n\t }", "collision() {\n const playerBox = {x: player.x, y: player.y, width: 76, height: 83};\n const enemyBox = {x: this.x, y: this.y, width: 76, height: 83};\n\n if (playerBox.x < enemyBox.x + enemyBox.width &&\n playerBox.x + playerBox.width > enemyBox.x &&\n playerBox.y < enemyBox.y + enemyBox.height &&\n playerBox.height + playerBox.y > enemyBox.y) {\n player.restart();\n hearts.pop();\n life--;\n if (life === 0) {\n lose();\n }\n }\n }", "resolveNodes() {\n const {\n map,\n _cstAliases\n } = this;\n Object.keys(map).forEach(a => {\n map[a] = map[a].resolved;\n });\n\n _cstAliases.forEach(a => {\n a.source = a.source.resolved;\n });\n\n delete this._cstAliases;\n }", "resolveNodes() {\n const {\n map,\n _cstAliases\n } = this;\n Object.keys(map).forEach(a => {\n map[a] = map[a].resolved;\n });\n\n _cstAliases.forEach(a => {\n a.source = a.source.resolved;\n });\n\n delete this._cstAliases;\n }", "resolveNodes() {\n const {\n map,\n _cstAliases\n } = this;\n Object.keys(map).forEach(a => {\n map[a] = map[a].resolved;\n });\n\n _cstAliases.forEach(a => {\n a.source = a.source.resolved;\n });\n\n delete this._cstAliases;\n }", "resolveNodes() {\n const {\n map,\n _cstAliases\n } = this;\n Object.keys(map).forEach(a => {\n map[a] = map[a].resolved;\n });\n\n _cstAliases.forEach(a => {\n a.source = a.source.resolved;\n });\n\n delete this._cstAliases;\n }", "function collisions() {\n collisonBords(ballon);\n\n equipes.forEach((eq) => {\n eq.joueurs.forEach((e) => {\n // Touche le cote droit\n collisonBords(e);\n });\n });\n\n let collision = false;\n\n // Pour toutes les equipes\n equipes.forEach((e) => {\n // Pour chaque joueur de chaque équipe\n e.joueurs.forEach((j) => {\n if (GestionnaireCollision.cercleCercle(j, ballon, j.rayon(), ballon.rayon())) {\n gererCollision(j, ballon);\n collision = true;\n }\n\n // Pour chaque équipe\n equipes.forEach((e2) => {\n // Chaque joueur de chaque équipe\n e2.joueurs.forEach((j2) => {\n if (j.x === j2.x && j.y === j2.y) {\n return;\n }\n\n if (GestionnaireCollision.cercleCercle(j, j2, j.rayon(), j2.rayon())) {\n collision = true;\n gererCollision(j, j2);\n }\n });\n });\n });\n });\n\n if (collision) {\n soundsManager.collisionJoueurs();\n }\n\n if (GestionnaireCollision.pointDansRectangle(map.cageGauche, ballon.centre())) {\n score.DROITE += 1;\n reset();\n soundsManager.but();\n } else if (GestionnaireCollision.pointDansRectangle(map.cageDroite, ballon.centre())) {\n score.GAUCHE += 1;\n reset();\n soundsManager.but();\n }\n }", "detectCollision() {\n // first check edgeGroup for lanes\n let self = this;\n this.edgeGroup.children.forEach((edgeViewGroup) => {\n let edgeModel = self.edgeCollection.getModel(edgeViewGroup.modelId);\n let edgePaths = edgeViewGroup.children;\n let isColliding = false;\n\n // There are usually 3 paths, break early if we find one that is intersecting\n for (let i = 0; i < edgePaths.length; i++) {\n let currentEdgePath = edgePaths[i];\n if (this.isCollidingWithKeepoutArea(currentEdgePath)) {\n isColliding = true;\n break;\n }\n }\n\n if (isColliding) {\n edgeModel.setInvalid();\n } else {\n let sourceNodeModel = self.nodeCollection.getModel(edgeModel.sourceId);\n if (this.isInsideKeepoutArea(sourceNodeModel)) {\n edgeModel.setInvalid();\n } else {\n edgeModel.setValid();\n }\n }\n });\n }", "function checkCollisions(keys) {\n // Itter through grid names\n for (let i = 0; i < keys.length; i++) {\n // Grid has more than 1 object\n if (usedSections[keys[i]].length > 1) {\n // get the used grid\n let grid = usedSections[keys[i]];\n // Itter through objects inside the grid\n for (let p1 = 0; p1 < grid.length; p1++) {\n for (let p2 = 0; p2 < grid.length; p2++) {\n // Aslong as the object isnt looking at itself check for collisions\n // Checks objects no object will have the exact same values.\n if (p1 != p2) {\n let pa1 = particles[grid[p1][2]];\n let pa2 = particles[grid[p2][2]];\n let distance = dist(pa1.pos.x, pa1.pos.y, pa2.pos.x, pa2.pos.y);\n if (distance <= master.size) {\n // Using try to prevent out of bound bug that used to occur that would stop the main loop and freeze the game\n try {\n pa1.isColliding = true\n pa2.isColliding = true\n } finally {\n continue\n }\n }\n }\n }\n }\n }\n }\n}", "resolveNodes() {\n const {\n map,\n _cstAliases\n } = this;\n Object.keys(map).forEach(a => {\n map[a] = map[a].resolved;\n });\n\n _cstAliases.forEach(a => {\n a.source = a.source.resolved;\n });\n\n delete this._cstAliases;\n }", "_cleanOldCollisions() {\n for (const guid in this.collisions) {\n if (this.collisions.hasOwnProperty(guid)) {\n const frameCollision = this.frameCollisions[guid];\n const collision = this.collisions[guid];\n const entity = collision.entity;\n const entityCollision = entity.collision;\n const entityRigidbody = entity.rigidbody;\n const others = collision.others;\n const length = others.length;\n let i = length;\n while (i--) {\n const other = others[i];\n // if the contact does not exist in the current frame collisions then fire event\n if (!frameCollision || frameCollision.others.indexOf(other) < 0) {\n // remove from others list\n others.splice(i, 1);\n\n if (entity.trigger) {\n // handle a trigger entity\n if (entityCollision) {\n entityCollision.fire('triggerleave', other);\n }\n if (other.rigidbody) {\n other.rigidbody.fire('triggerleave', entity);\n }\n } else if (!other.trigger) {\n // suppress events if the other entity is a trigger\n if (entityRigidbody) {\n entityRigidbody.fire('collisionend', other);\n }\n if (entityCollision) {\n entityCollision.fire('collisionend', other);\n }\n }\n }\n }\n\n if (others.length === 0) {\n delete this.collisions[guid];\n }\n }\n }\n }", "function numCollisions() {\n var i; //questions\n var j; //edges\n var k; //edges\n var num = 0; //number of collisions. NOT A COUNTER\n\n for (i = 0; i < allquestions.length; i += 1) {\n allquestions[i].update();\n }\n\n //node to node\n /*for (i = 0; i < allquestions.length; i += 1) { //preventing node to node collision entirely\n for (j = i + 1; j < allquestions.length; j += 1) {\n if (isCollidingNN(allquestions[i], allquestions[j])) {\n return Number.MAX_VALUE;\n }\n }\n }*/\n\n for (j = 0; j < alledges.length; j += 1) {\n alledges[j].update();\n }\n\n //node to edge\n for (i = 0; i < allquestions.length; i += 1) {\n for (j = 0; j < alledges.length; j += 1) {\n if (isCollidingNE(allquestions[i], alledges[j])) {\n num += 10; //counts as two collisions, may be changed in the future\n }\n }\n }\n\n for (j = 0; j < alledges.length; j += 1) {\n for (k = j + 1; k < alledges.length; k += 1) {\n if (isCollidingEE(alledges[j], alledges[k], false, false)) {\n num += 1;\n }\n }\n }\n return num;\n}", "satisfyConstraints() {\n let row_delta = 2 * this.m;\n let column_delta = 2;\n\n //delta_length is a distance between current nodes\n //diff1 and diff2 are deformation coefficients of the edge\n //delta is a vector betveen nodes\n //node_movement is a vector of translation for the nodes\n let delta_length, diff1, diff2;\n let delta = new Float32Array(2);\n let node_movement = new Float32Array(2);\n\n // reset stress in all nodes\n this.initializeStress();\n\n // checks of distances is performed in several iterations. Number of iterarions can be set using\n // the global variable\n for (let l = 0; l < number_of_iterations; ++l) {\n // iterate over nodes and move them if they are outside rendering area\n for (let i = 0; i < this.n; ++i) {\n for (let j = 0; j < this.m; ++j) {\n this.coord[i * row_delta + j * column_delta] = Math.min(this.coord[i * row_delta + j * column_delta], 1);\n this.coord[i * row_delta + j * column_delta] = Math.max(this.coord[i * row_delta + j * column_delta], -1);\n this.coord[i * row_delta + j * column_delta + 1] = Math.min(this.coord[i * row_delta + j * column_delta + 1], 1);\n this.coord[i * row_delta + j * column_delta + 1] = Math.max(this.coord[i * row_delta + j * column_delta + 1], -1);\n }\n }\n\n // iterate over nodes again\n for (let i = 0; i < this.n; ++i) {\n for (let j = 0; j < this.m; ++j) {\n // if current node is not in the last row and is not in the last column\n if (i != this.n - 1 && j != this.m - 1) {\n // calculate coordinate deltas between current node and it's right neighbour\n delta[0] = this.coord[i * row_delta + j * column_delta] - this.coord[i * row_delta + (j + 1) * column_delta];\n delta[1] = this.coord[i * row_delta + j * column_delta + 1] - this.coord[i * row_delta + (j + 1) * column_delta + 1];\n\n // calculate distance between these nodes\n delta_length = delta[0] * delta[0] + delta[1] * delta[1];\n delta_length = Math.sqrt(delta_length);\n\n // calculate deformation coefficient of the edge between the nodes\n diff1 = (delta_length - this.distance_between_nodes) / delta_length;\n\n // move nodes to make distance between them correct\n for (let k = 0; k < 2; ++k) {\n node_movement[k] = 0.5 * diff1 * delta[k];\n this.coord[i * row_delta + j * column_delta + k] -= node_movement[k];\n this.coord[i * row_delta + (j + 1) * column_delta + k] += node_movement[k];\n }\n\n // calculate coordinate deltas between current node and it's down neighbour\n delta[0] = this.coord[i * row_delta + j * column_delta] - this.coord[(i + 1) * row_delta + j * column_delta];\n delta[1] = this.coord[i * row_delta + j * column_delta + 1] - this.coord[(i + 1) * row_delta + j * column_delta + 1];\n\n // calculate distance between these nodes\n delta_length = delta[0] * delta[0] + delta[1] * delta[1];\n delta_length = Math.sqrt(delta_length);\n\n // calculate deformation coefficient of the edge between the nodes\n diff2 = (delta_length - this.distance_between_nodes) / delta_length;\n\n // move nodes to make distance between them correct\n for (let k = 0; k < 2; ++k) {\n node_movement[k] = 0.5 * diff2 * delta[k];\n this.coord[i * row_delta + j * column_delta + k] -= node_movement[k];\n this.coord[(i + 1) * row_delta + j * column_delta + k] += node_movement[k];\n }\n }\n\n // the same for the rest of the cases\n if (i != this.n - 1 && j == this.m - 1) {\n delta[0] = this.coord[i * row_delta + j * column_delta] - this.coord[(i + 1) * row_delta + j * column_delta];\n delta[1] = this.coord[i * row_delta + j * column_delta + 1] - this.coord[(i + 1) * row_delta + j * column_delta + 1];\n\n delta_length = delta[0] * delta[0] + delta[1] * delta[1];\n delta_length = Math.sqrt(delta_length);\n\n diff1 = (delta_length - this.distance_between_nodes) / delta_length;\n\n for (let k = 0; k < 2; ++k) {\n node_movement[k] = 0.5 * diff1 * delta[k];\n this.coord[i * row_delta + j * column_delta + k] -= node_movement[k];\n this.coord[(i + 1) * row_delta + j * column_delta + k] += node_movement[k];\n }\n }\n\n if (i == this.n - 1 && j != this.m - 1) {\n delta[0] = this.coord[i * row_delta + j * column_delta] - this.coord[i * row_delta + (j + 1) * column_delta];\n delta[1] = this.coord[i * row_delta + j * column_delta + 1] - this.coord[i * row_delta + (j + 1) * column_delta + 1];\n\n delta_length = delta[0] * delta[0] + delta[1] * delta[1];\n delta_length = Math.sqrt(delta_length);\n\n diff1 = (delta_length - this.distance_between_nodes) / delta_length;\n\n for (let k = 0; k < 2; ++k) {\n node_movement[k] = 0.5 * diff1 * delta[k];\n this.coord[i * row_delta + j * column_delta + k] -= node_movement[k];\n this.coord[i * row_delta + (j + 1) * column_delta + k] += node_movement[k];\n }\n }\n\n // if it is the last iteration calculate stress in the node and\n // it's neighbours\n if (l == number_of_iterations - 1)\n this.calculateStress(i, j, diff1, diff2);\n }\n }\n\n // if some node is selected return it to the mouse position\n if (this.selected_node != -1) {\n this.coord[this.selected_node] = this.current_mouse_x;\n this.coord[this.selected_node + 1] = this.current_mouse_y;\n }\n\n // return locked nodes to their places\n for (let i = 0; i < this.locked_nodes.length; i += 3) {\n this.coord[this.locked_nodes[i]] = this.locked_nodes[i + 1];\n this.coord[this.locked_nodes[i] + 1] = this.locked_nodes[i + 2];\n }\n }\n\n // calculate colours of the nodes based on the stress\n this.calculateColors();\n }", "function detectCollision() {\n ballCollision();\n brickCollision();\n}", "function collide(alpha) {\n d3 = dex.charts.d3.d3v3;\n var quadtree = d3.geom.quadtree(nodes);\n return function (d) {\n //dex.console.log(\"COLLIDE-D\", d, nodes);\n var r = d.radius + config.radius.max + Math.max(\n config.nodePadding, config.clusterPadding),\n nx1 = d.x - r,\n nx2 = d.x + r,\n ny1 = d.y - r,\n ny2 = d.y + r;\n quadtree.visit(function (quad, x1, y1, x2, y2) {\n if (quad.point && (quad.point !== d)) {\n var x = d.x - quad.point.x,\n y = d.y - quad.point.y,\n l = Math.sqrt(x * x + y * y),\n r = d.radius + quad.point.radius +\n (d.cluster === quad.point.cluster ?\n config.nodePadding : config.clusterPadding);\n if (l < r) {\n l = (l - r) / l * alpha;\n d.x -= x *= l;\n d.y -= y *= l;\n quad.point.x += x;\n quad.point.y += y;\n }\n }\n return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1;\n });\n };\n }", "function compute_collision() {\n for (var i = 0; i < elements.length; i++) {\n // Compute collision with wall\n if ((elements[i].object.x\n - elements[i].center.x) <= 0) {\n elements[i].speed.x = \n Math.abs(elements[i].speed.x);\n elements[i].real_coord.x = \n elements[i].object.x = \n elements[i].center.x + 1;\n }\n else if ((elements[i].object.x + \n elements[i].center.x) >= world_width) {\n elements[i].speed.x = \n - Math.abs(elements[i].speed.x);\n elements[i].real_coord.x = \n elements[i].object.x = \n world_width - elements[i].center.x - 1;\n }\n if ((elements[i].object.y\n - elements[i].center.y) <= 0) {\n elements[i].speed.y = \n Math.abs(elements[i].speed.y);\n elements[i].real_coord.y = \n elements[i].object.y = \n elements[i].center.y + 1;\n }\n else if((elements[i].object.y + \n elements[i].center.y) >= world_height) {\n elements[i].speed.y = \n - Math.abs(elements[i].speed.y);\n elements[i].real_coord.y = \n elements[i].object.y =\n world_height - elements[i].center.y - 1;\n }\n }\n }", "static collideWithTiles(hitbox, initialVelocity) {\n const velocity = { ...initialVelocity }; // create a copy of the velocity so that we can maintain the original\n const topLeft = { ...hitbox.position };\n const bottomRight = {\n x: hitbox.position.x + hitbox.dimensions.w,\n y: hitbox.position.y - hitbox.dimensions.h\n };\n const tiles = this.getTilesInDetectionArea(_states_rootState__WEBPACK_IMPORTED_MODULE_0__[\"State\"].ninjaState.collisionDetectionBox);\n let modification;\n for (const tile of tiles) {\n // if moving to the right, check tiles to the right of the hitbox\n if (velocity.dx > 0) {\n // check the alignment of the box to ensure its in the same vertical space\n if (this.hasOverlap(bottomRight.y, topLeft.y, tile.row - 1, tile.row)) {\n // if the box will be moved beyond the tile boundaries, then update the velocity based off of tile physics\n if (this.hasOverlap(bottomRight.x, bottomRight.x + velocity.dx, tile.col, tile.col + 1)) {\n modification = (bottomRight.x + velocity.dx - tile.col);\n // console.log(\"wall: \" + tile.col.toFixed(2));\n // console.log(\"New Position: \" + (bottomRight.x + velocity.dx).toFixed(2));\n // console.log(\"DX Dif: \" + modification.toFixed(2));\n velocity.dx -= modification;\n }\n }\n }\n else if (velocity.dx < 0) {\n // check the alignment of the box to ensure its in the same vertical space\n if (this.hasOverlap(bottomRight.y, topLeft.y, tile.row - 1, tile.row)) {\n // if the box will be moved beyond the tile boundaries, then update the velocity based off of tile physics\n if (this.hasOverlap(topLeft.x + velocity.dx, topLeft.x, tile.col, tile.col + 1)) {\n modification = (tile.col + 1) - (topLeft.x + velocity.dx);\n // console.log(\"wall: \" + (tile.col + 1).toFixed(2));\n // console.log(\"New Position: \" + (topLeft.x + velocity.dx).toFixed(2));\n // console.log(\"DX Dif: \" + modification.toFixed(2));\n velocity.dx += modification;\n }\n }\n }\n // if moving up, check tiles above the hitbox\n if (velocity.dy > 0) {\n // check the alignment of the box to ensure its in the same horizontal space\n if (this.hasOverlap(topLeft.x, bottomRight.x, tile.col, tile.col + 1)) {\n // if the box will be moved beyond the tile boundaries, then update the velocity based off of tile physics\n if (this.hasOverlap(topLeft.y, topLeft.y + velocity.dy, tile.row - 1, tile.row)) {\n modification = topLeft.y + velocity.dy - (tile.row - 1);\n // console.log(\"wall: \" + (tile.row - 1).toFixed(2));\n // console.log(\"New Position: \" + (topLeft.y + velocity.dy).toFixed(2));\n // console.log(\"DX Dif: \" + modification.toFixed(2));\n velocity.dy -= modification;\n }\n }\n }\n else if (velocity.dy < 0) {\n // check the alignment of the box to ensure its in the same horizontal space\n if (this.hasOverlap(topLeft.x, bottomRight.x, tile.col, tile.col + 1)) {\n // if the box will be moved beyond the tile boundaries, then update the velocity based off of tile physics\n if (this.hasOverlap(bottomRight.y + velocity.dy, bottomRight.y, tile.row - 1, tile.row)) {\n modification = (tile.row) - (bottomRight.y + velocity.dy);\n // console.log(\"wall: \" + tile.row.toFixed(2));\n // console.log(\"New Position: \" + (bottomRight.y + velocity.dy).toFixed(2));\n // console.log(\"DX Dif: \" + modification.toFixed(2));\n velocity.dy += modification;\n if (Math.abs(velocity.dy) < 0.00001) {\n velocity.dy = 0;\n }\n }\n }\n }\n }\n return velocity;\n }", "constructor(){\n\n\t\tthis.minVelocityPercentDif = 60;\n\n\t\tthis.checkPositionOverlap = (obj1, obj2)=>{ //takes 2 objects and checks for overlap\n\t\t\t//distances from center to edge\n\t\t\tlet sudoDiameter1 = new Vector2(obj1.size.x / 2, obj1.size.y / 2);\n\t\t\tlet sudoDiameter2 = new Vector2(obj2.size.x / 2, obj2.size.y / 2);\n\n\t\t\t//position of point at center of obj\n\t\t\tlet centerPos1 = new Vector2(obj1.position.x + sudoDiameter1.x, obj1.position.y + sudoDiameter1.y);\n\t\t\tlet centerPos2 = new Vector2(obj2.position.x + sudoDiameter2.x, obj2.position.y + sudoDiameter2.y);\n\n\t\t\treturn (Math.abs(centerPos1.x - centerPos2.x) < (sudoDiameter1.x + sudoDiameter2.x) && Math.abs(centerPos1.y - centerPos2.y) < (sudoDiameter1.y + sudoDiameter2.y))\n\n\t\t}\n\n\t\tthis.staticDynamicCollision = (statObj, dynObj)=>{\n\n\t\t\tlet statRadius = new Vector2(statObj.size.x / 2, statObj.size.y / 2)\n\t\t\tlet dynRadius = new Vector2(dynObj.size.x / 2, dynObj.size.y / 2)\n\n\t\t\t// let edge = calcCollisionEdge(statObj, dynObj);\n\t\t\tlet edge = null;\n\t\t\t// console.log(edge)\n\n\t\t\tif(edge == null){\n\t\t\t\tdynObj.velocity = new Vector2(-dynObj.velocity.x, -dynObj.velocity.y);\n\t\t\t}else if (edge[0] % 2 == 0){\n\t\t\t\t\t\tdynObj.velocity = new Vector2(-dynObj.velocity.x, dynObj.velocity.y);\n\t\t\t}else{\n\t\t\t\tdynObj.velocity = new Vector2(dynObj.velocity.x, -dynObj.velocity.y);\n\t\t\t}\n\n\t\n\t\t}\n\n\t\tthis.executeCollision = (obj1, obj2)=>{\n\n\t\t\t//initial velocities (adjusted for angle)\n\t\t\tlet initVelocity1 = Math.sqrt(obj1.velocity.x ^2 + obj1.velocity.y ^2);\n\t\t\tlet initVelocity2 = Math.sqrt(obj2.velocity.x ^2 + obj2.velocity.y ^2);\n\n\n\t\t\t//initial angles in radians\n\t\t\tlet initAngle1 = Math.atan(obj1.velocity.y/obj1.velocity.x);\n\t\t\tlet initAngle2 = Math.atan(obj2.velocity.y/obj2.velocity.x);\n\n\t\t\t// console.log(initAngle1, initAngle2);\n\t\t\t// console.log(obj1.name, obj2.name)\n\n\t\t\tlet tempVelocity = obj1.velocity;\n\t\t\tobj1.velocity = new Vector2((obj2.velocity.x * obj2.mass) / obj1.mass, (obj2.velocity.y * obj2.mass) / obj1.mass);\n\t\t\tobj2.velocity = new Vector2((tempVelocity.x * obj1.mass) / obj2.mass, (tempVelocity.y * obj1.mass) / obj2.mass);\n\n\t\t}\n\n\t\tthis.update = (gameObjects)=>{\n\t\t\t\n\t\t\tlet physicsObjects = [];\n\n\t\t\tfor (let i in gameObjects){\n\t\t\t\tif(gameObjects[i] instanceof PhysicsEntity){\n\t\t\t\t\tphysicsObjects.push(gameObjects[i]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet collisions = []\n\n\t\t\tfor(let i in physicsObjects){\n\t\t\t\tfor(let j in physicsObjects){\n\t\t\t\t\tif(i != j){\n\n\t\t\t\t\t\tlet obj1 = physicsObjects[i];\n\t\t\t\t\t\tlet obj2 = physicsObjects[j];\n\n\t\t\t\t\t\t//initial comparison of positions for collision detection\n\t\t\t\t\t\tif(this.checkPositionOverlap(obj1, obj2)){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tlet doCollision = true;\n\t\t\t\t\t\t\tfor(let k in collisions){\n\t\t\t\t\t\t\t\tif(collisions[k] != [i, j]){\n\t\t\t\t\t\t\t\t\tdoCollision = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t\t//checks to make sure that the objects are moving at somewhat different speeds (prevents objects from getting stuck)\n\t\t\t\t\t\t\tif(calcPercentDifference(obj1.velocity.x,obj2.velocity.x) >= this.minVelocityPercentDif ||calcPercentDifference(obj1.velocity.y,obj2.velocity.y) >= this.minVelocityPercentDif ){\n\t\t\t\t\t\t\t\tif(doCollision){\n\n\t\t\t\t\t\t\t\t\t//here, the new velocities are calculated and updated\n\n\t\t\t\t\t\t\t\t\tif(obj1.isStatic == false && obj2.isStatic == false){ //done if neither object is static\n\t\t\t\t\t\t\t\t\t\tthis.executeCollision(obj1, obj2); //all the physics happens in here\n\t\t\t\t\t\t\t\t\t}else if(obj1.isStatic == true && obj2.isStatic == false){\n\t\t\t\t\t\t\t\t\t\tthis.staticDynamicCollision(obj1, obj2)\n\t\t\t\t\t\t\t\t\t}else if(obj1.isStatic == false && obj2.isStatic == true){\n\t\t\t\t\t\t\t\t\t\tthis.staticDynamicCollision(obj2, obj1)\n\t\t\t\t\t\t\t\t\t}else if(obj1.isStatic == true && obj2.isStatic == true){\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t\tcollisions.push([i, j])\n\t\t\t\t\t\t\t\t\tcollisions.push([j, i])\n\n\t\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\n\n\t\t}\n\n\n\n\t}", "function collidesWith( a, b )\n{\n return a.bottom > b.top && a.top < b.bottom;\n}", "function detectCollision(new_x, new_y) {\n var new_index = tu.getIndex(new_x, new_y, TILE_WIDTH, TILE_HEIGHT, MAP_WIDTH);\n var tileID = foreground[new_index];\n\n if (tileID == 1) return 1;\n else if (tileID == 2) return 2;\n else if (tileID == 4) return 3;\n else return 0; // no collision detected\n}", "function detectCollisions() {\n let dx;\n let dy;\n let d2;\n let r1;\n let r2;\n let dvx;\n let dvy;\n let inp;\n let pref;\n\n for (let i1 = 0; i1 < particleArray.length; i1++) {\n r1 = particleArray[i1].radius\n\n for (let i2 = i1 + 1; i2 < particleArray.length; i2++) {\n r2 = particleArray[i2].radius\n\n dx = (particleArray[i1].x - particleArray[i2].x)\n dy = (particleArray[i1].y - particleArray[i2].y)\n\n d2 = dx * dx + dy * dy\n\n // if distance is too large for collision cycle back\n if (Math.sqrt(d2) > r1 + r2) continue\n\n if (particleArray[i2].state == 2 && particleArray[i1].state == 1) {\n particleArray[i1].state = 2\n particleArray[i1].timeAtInfection = new Date\n } else if (particleArray[i2].state == 1 && particleArray[i1].state == 2) {\n particleArray[i2].state = 2\n particleArray[i2].timeAtInfection = new Date\n }\n\n dvx = (particleArray[i1].vx - particleArray[i2].vx)\n dvy = (particleArray[i1].vy - particleArray[i2].vy)\n inp = dvx * dx + dvy * dy\n\n // If inp > 0 the particles are overlaping and the distance is actually increasing!\n // In this case there is no collision taling place.\n\n if (inp > 0) continue\n\n // The radius of the particles is proportional to its mass!!\n pref = 2 * r2 / (r1 + r2) * inp / d2\n\n particleArray[i1].vx -= pref * dx\n particleArray[i1].vy -= pref * dy\n\n particleArray[i2].vx += r1 / r2 * pref * dx\n particleArray[i2].vy += r1 / r2 * pref * dy\n }\n }\n}", "handleCollision() {\n\n for (let i = 0; i < this.balls.length; i++) {\n\n this.balls[i].collideWithTable(this.table); //looks if collided with border\n this.balls[i].handlePocketCollision();\n\n for (let j = i + 1; j < this.balls.length; j++) {\n\n const ball1 = this.balls[i];\n const ball2 = this.balls[j];\n\n ball1.collideWithBall(ball2);\n }\n }\n }", "function checkCollisions() {\n allEnemies.forEach(function(enemy) {\n if (!player.crashed) {\n if (isCollision(player, enemy)) {\n collide();\n }\n }\n });\n\n allItems.forEach(function(item, index) {\n if (!player.crashed) {\n if (isCollision(player, item)) {\n allItems.splice(index, 1);\n gems++;\n updateStats();\n }\n }\n });\n }", "check_collision() {\n const rtx = this.x + 4;\n const rty = this.y + 59;\n const rpx = player.x + 31;\n const rpy = player.y + 57;\n if (rtx < rpx + player.width - 5 &&\n rpx < rtx + this.width - 5 &&\n rty < rpy + player.height - 15 &&\n rpy < rty + this.height - 15) {\n // Reset the game when collision happens\n allEnemies = [new Enemy(), new Enemy(), new Enemy()];\n player = new Player();\n }\n }", "CreateContactManifold(col1, col2)\n\t{\n\t\tif(col1 == null || col2 == null) return null;\n\t\t\n\t\tlet aTrans = col1.GetComponent(WorldPos);\n\t\tlet aPos = aTrans.position;\n\t\tlet aRect = col1.WorldRect(aPos);\n\t\t\n\t\tlet bTrans = col2.GetComponent(WorldPos);\n\t\tlet bPos = bTrans.position;\n\t\tlet bRect = col2.WorldRect(bPos);\n\t\t\n\t\tlet ab = bRect.Center.Sub(aRect.Center);\n\t\tlet aHalfWidth = aRect.Width * 0.5;\n\t\tlet bHalfWidth = bRect.Width * 0.5;\n\t\tlet xOverlap = aHalfWidth + bHalfWidth - Math.abs(ab.x);\n\t\t\n\t\tif(xOverlap > 0)\n\t\t{\n\t\t\tlet aHalfHeight = aRect.Height * 0.5;\n\t\t\tlet bHalfHeight = bRect.Height * 0.5;\n\t\t\tlet yOverlap = aHalfHeight + bHalfHeight - Math.abs(ab.y);\n\t\t\tif(yOverlap > 0)\n\t\t\t{\n\t\t\t\tlet manifold = new ContactManifold(col1, col2);\n\t\t\t\t\n\t\t\t\t//find min rect of collisions - this will be needed for determining the hit location\n\t\t\t\tlet right = Math.min(aRect.Right, bRect.Right);\n\t\t\t\tlet left = Math.max(aRect.Left, bRect.Left);\n\t\t\t\tlet top = Math.min(aRect.Top, bRect.Top);\n\t\t\t\tlet bottom = Math.max(aRect.Bottom, bRect.Bottom);\n\t\t\t\t\n\t\t\t\tif(xOverlap < yOverlap)\n\t\t\t\t{\n\t\t\t\t\t//points towards B\n\t\t\t\t\tif(ab.x < 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tmanifold.Normal = new Vector2(1, 0);\n\t\t\t\t\t}\n\t\t\t\t\telse \n\t\t\t\t\t{\n\t\t\t\t\t\tmanifold.Normal = new Vector2(-1, 0);\n\t\t\t\t\t}\n\t\t\t\t\tmanifold.Penetration = xOverlap;\n\t\t\t\t\ttop = top-((top-bottom)*0.5);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t//point towards B\n\t\t\t\t\tif(ab.y < 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tmanifold.Normal = new Vector2(0, 1);\n\t\t\t\t\t\t//HACK ALERT: Assuming gravity vector here and setting grounded state based on that!\n\t\t\t\t\t\tlet rb = col1.Entity.GetComponent(Rigidbody);\n\t\t\t\t\t\tif(rb && !col1.IsTrigger && !col2.IsTrigger) rb.IsGrounded = true;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tmanifold.Normal = new Vector2(0, -1);\n\t\t\t\t\t}\n\t\t\t\t\tmanifold.Penetration = yOverlap;\n\t\t\t\t\tleft = left+((right-left)*0.5);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tmanifold.Hit = new Vector2(left, top);\n\t\t\t\twindow.Debug.DrawPoint(manifold.Hit, \"magenta\");\n\t\t\t\treturn manifold;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "function collideElements(item){\n var list = {};\n var elements = [];\n for (var i = 0; i < 9; i++) {\n var hash = getHash(item[0]+(i%3-1)*ceilHeight, item[1]+(~~(i/3)-1)*ceilHeight);\n if(!list[hash]){\n list[hash]=1;\n var elements = spatialhashing[hash];\n for (var i = 0; elements&&i < elements.length; i++) {\n if(getHypo(item[1]-elements[i][1], item[0]-elements[i][0])<elements[i][2]+item[2]){\n return elements[i]\n }\n }\n }\n }\n\n}", "function collide(alpha) {\n var quadtree = d3.geom.quadtree(data.nodes);\n return function(d) {\n // the radius of the current node\n var d_radius = linearStateNodeScale(d.user_ids.length);\n\n\n var r = d_radius + maxNodeSize + padding,\n nx1 = d.x - r,\n nx2 = d.x + r,\n ny1 = d.y - r,\n ny2 = d.y + r;\n\n quadtree.visit(function(quad, x1, y1, x2, y2) {\n if (quad.point && (quad.point !== d)) {\n var x = d.x - quad.point.x,\n y = d.y - quad.point.y,\n l = Math.sqrt(x * x + y * y),\n r = d_radius + linearStateNodeScale(quad.point.user_ids.length) + padding;\n if (l < r) {\n l = (l - r) / l * alpha; // padding\n d.x -= x *= l;\n d.y -= y *= l;\n quad.point.x += x;\n quad.point.y += y;\n }\n }\n return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1;\n });\n };\n}", "checkItemsInPlayCollisions(ctx) {\n // NOTE: llama status will be normal only in the day\n if (this.llama.status === \"normal\") {\n return;\n }\n\n let sphericalObjects = this.itemsInPlay;\n\n for (let i = 0; i < sphericalObjects.length; i++) {\n for (let j = 0; j < sphericalObjects.length; j++) {\n if (sphericalObjects[i] != sphericalObjects[j]) {\n\n if (sphericalObjects[i] instanceof _other_objects_bacon_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"] || sphericalObjects[j] instanceof _other_objects_bacon_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]) {\n // NOTE: Bacon is not spherical\n continue;\n }\n\n if (sphericalObjects[i].status === \"available\" && sphericalObjects[j].status === \"available\") {\n if (this.areSpheresColliding(sphericalObjects[i], sphericalObjects[j])) {\n\n // NOTE: 1st line- no elastic response. 2nd line - elastic response\n // sphericalObjects[i].y_velocity = -sphericalObjects[i].y_velocity;\n this.resolveSphereSphereCollision(sphericalObjects[i], sphericalObjects[j]);\n }\n }\n }\n }\n }\n }", "function updateNodes(normalizer, relWidth, relHeight, nodes) {\n\t\n\t// Update position, velocity, opacity; prune faded nodes\n\tvar newNodes = [];\n\tnodes.forEach(function(node, index) {\n\t\t// Move based on velocity\n\t\tnode.posX += node.velX * driftSpeed;\n\t\tnode.posY += node.velY * driftSpeed;\n\t\t// Randomly perturb velocity, with damping\n\t\tnode.velX = node.velX * 0.99 + (Math.random() - 0.5) * 0.3;\n\t\tnode.velY = node.velY * 0.99 + (Math.random() - 0.5) * 0.3;\n\t\t// Fade out nodes near the borders of the space or exceeding the target number of nodes\n\t\tif (index >= idealNumNodes || node.posX < BORDER_FADE || relWidth - node.posX < BORDER_FADE\n\t\t\t\t|| node.posY < BORDER_FADE || relHeight - node.posY < BORDER_FADE)\n\t\t\tnode.opacity = Math.max(node.opacity - FADE_OUT_RATE, 0);\n\t\telse // Fade in ones otherwise\n\t\t\tnode.opacity = Math.min(node.opacity + FADE_IN_RATE, 1);\n\t\t// Only keep visible nodes\n\t\tif (node.opacity > 0)\n\t\t\tnewNodes.push(node);\n\t});\n\t\n\t// Add new nodes to fade in\n\tfor (var i = newNodes.length; i < idealNumNodes; i++) {\n\t\tnewNodes.push({ // Random position and radius, other properties initially zero\n\t\t\tposX: Math.random() * relWidth,\n\t\t\tposY: Math.random() * relHeight,\n\t\t\tradius: 0.25 * normalizer, // Skew toward smaller values\n\t\t\tvelX: 0.0,\n\t\t\tvelY: 0.0,\n\t\t\topacity: 0.0,\n\t\t});\n\t}\n\t\n\t// Spread out nodes a bit\n\tdoForceField(newNodes);\n\treturn newNodes;\n const color = colors[Math.floor(Math.random() * colors.length)];\n particles.push(new Particle(x, y, radius, color));\n }", "function collide(alpha) {\n\t var quadtree = d3.geom.quadtree(nodes);\n\t return function(d) {\n\t\t var r = d.radius + node_radius + Math.max(padding, cluster_padding),\n\t nx1 = d.x - r,\n\t nx2 = d.x + r,\n\t ny1 = d.y - r,\n\t ny2 = d.y + r;\n\t quadtree.visit(function(quad, x1, y1, x2, y2) {\n\t if (quad.point && (quad.point !== d)) {\n\t var x = d.x - quad.point.x,\n\t y = d.y - quad.point.y,\n\t l = Math.sqrt(x * x + y * y),\n\t r = d.radius + quad.point.radius + (d.choice === quad.point.choice ? padding : cluster_padding);\n\t if (l < r) {\n\t l = (l - r) / l * alpha;\n\t d.x -= x *= l;\n\t d.y -= y *= l;\n\t quad.point.x += x;\n\t quad.point.y += y;\n\t }\n\t }\n\t return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1;\n\t });\n\t };\n\t}", "function collide(alpha) {\n var quadtree = d3.geom.quadtree(nodes);\n return function(d) {\n var r = d.radius + maxRadius + Math.max(padding, clusterPadding),\n nx1 = d.x - r,\n nx2 = d.x + r,\n ny1 = d.y - r,\n ny2 = d.y + r;\n quadtree.visit(function(quad, x1, y1, x2, y2) {\n if (quad.point && (quad.point !== d)) {\n var x = d.x - quad.point.x,\n y = d.y - quad.point.y,\n l = Math.sqrt(x * x + y * y),\n r = d.radius + quad.point.radius + (d.cluster === quad.point.cluster ? padding : clusterPadding);\n if (l < r) {\n l = (l - r) / l * alpha;\n d.x -= x *= l;\n d.y -= y *= l;\n quad.point.x += x;\n quad.point.y += y;\n }\n }\n return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1;\n });\n };\n }", "function collision(top_x, bottom_x, top_y, bottom_y) {\n\t\tfor (var i = 0; i < rows; i++) {\n\t\t\tfor (var j = 0; j < cols; j++) {\n\t\t\t\tvar b = bricks[j][i];\n\t\t\t\tif (b.exists == 1) {\n\t\t\t\t\tif (top_y < (b.y + block_height) && bottom_y > b.y && top_x < (b.x + block_width) && bottom_x > b.x) {\n\t\t\t\t\t\tb.exists = 0;\n\t\t\t\t\t\tball.y_speed = -ball.y_speed;\n\t\t\t\t\t\tplayer1Score += 1;\n\t\t\t\t\t\tbrickcount -= 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "checkCollisions(position) {\n\n // AABB collision\n function checkCollision(obj1, obj2) {\n // TODO: remove these magic numbers\n // obj1 is the player and obj2 are the blocks\n let w1 = 32;\n let h1 = 40;\n let w2 = 32;\n let h2 = 32;\n let collideX = obj1.x < obj2.x + w2 && obj1.x + w1 > obj2.x;\n let collideY = obj1.y < obj2.y + h2 && obj1.y + h1 > obj2.y;\n return collideX && collideY;\n }\n\n // some fancy ES6 to get the objects that aren't the player\n let notPlayer = objects.filter(o => o.sprite !== \"player\");\n for(let o of notPlayer) {\n if(checkCollision(position, o.location)) {\n // if we collide return what we collided with\n return o;\n }\n }\n\n // otherwise return null\n return null;\n }", "function collision(obj1, obj2){\n\tif (obj1.x > obj2.x + obj2.width || obj1.x + obj1.width < obj2.x || obj1.y+obj1.height > obj2.y + obj2.height || obj1.y + obj1.height < obj2.y){\n\t\t\n\t} else {\n\t\tif (!collidesArr.includes(obj2.value)){\n\t\t\tcollidesArr.push(obj2.value)\n\t\t\tif (collidesArr.length === 2)\n\t\t\t\tcheckOrderForTwo(collidesArr)\n\t\t\tif (collidesArr.length === 3)\n\t\t\t\tcheckOrder(collidesArr)\n\t\t\t}\n\t\t}\n\t\t// console.log(`collides with ${obj2.name}`)\n\t\tconsole.log(collidesArr)\n\t}", "function updateSpawnCollision(b1, b2){\n\tvar collisionAngle = Math.atan2(b1.nextY - b2.nextY, b1.nextX - b2.nextX)\n\tb1.updateInfo();\n\n\n\tvar dx1 = b1.speed * Math.cos(b1.direction - collisionAngle);\n\tvar dy1 = b1.speed * Math.sin(b1.direction - collisionAngle);\n\n\tvar final_dx1 = ((b1.mass - b2.mass) * dx1)\n\t\t/(b1.mass + b2.mass);\n\tvar final_dy1 = dy1;\n\n\tb1.dx = Math.cos(collisionAngle) * final_dx1 +\n\t\tMath.cos(collisionAngle + Math.PI/2) * final_dy1;\n\tb1.dy = Math.sin(collisionAngle) * final_dx1 +\n\t\tMath.sin(collisionAngle + Math.PI/2) * final_dy1;\n}", "tidy(root) {\n let orderedNodes = [];\n this.postTraverse(root, orderedNodes);\n let modMap = {};\n let centerMap = {};\n let min_dist = 100;\n for (let node of orderedNodes) {\n centerMap[node.id] = 0;\n node.cx = 0;\n if (node.children.length != 0) {\n node.children[0].cx == 0;\n for (let i = 1; i < node.children.length; i++) {\n node.children[i].cx = node.children[i - 1].cx + min_dist;\n }\n centerMap[node.id] = (node.children[0].cx + node.children[node.children.length - 1].cx) / 2;\n }\n }\n // console.log(centerMap);\n for (let node of orderedNodes) {\n // console.log(node.label);\n //Set the top y value\n node.cy = node.depth * 75 + 50;\n let leftSiblings = (node.parents[0] != undefined && node.parents[0].children[0] !== node);\n // console.log(leftSiblings);\n // console.log(centeredValue);\n if (!leftSiblings) {\n node.cx = centerMap[node.id];\n modMap[node.id] = 0;\n }\n else {\n node.cx = node.parents[0].children[node.parents[0].children.indexOf(node) - 1].cx + min_dist;\n modMap[node.id] = node.cx - centerMap[node.id];\n }\n }\n this.shiftChildrenByMod(root, 0, modMap);\n modMap = this.clearModMap(modMap);\n //dealing with conflicts, twice.\n // modMap = this.fixConflicts(root, orderedNodes, modMap);\n modMap = this.fixConflicts(root, orderedNodes, modMap);\n this.fixOffScreen(root, modMap);\n root.cx = (root.children[0].cx + root.children[root.children.length - 1].cx) / 2;\n }", "function checkCollision() {\n for (let i = 0; i < players.length; i++) {\n for (let j = i + 1; j < players.length; j++) {\n let distX = players[i].x - players[j].x;\n let distY = players[i].y - players[j].y;\n let distance = Math.sqrt(distX * distX + distY * distY);\n\n if (distance < players[i].r + players[j].r) {\n let loserId;\n\n if (players[i].r > players[j].r) {\n loserId = players[j].id;\n players[j].x = 1000;\n\n initializePlayersInfo(players[j]);\n } else {\n loserId = players[i].id;\n players[i].x = 1000;\n initializePlayersInfo(players[i]);\n }\n\n // console.log(players[i].id + ' ' + distance);\n\n io.sockets.emit('loserId', loserId);\n\n console.log(loserId);\n }\n }\n }\n}", "function checkCollision(zombie) {\nif (zombie.getBoundingClientRect().top <= 0) {\nlives--;\nreturn true;\n}\nreturn false;\n}", "function draw() {\n\n d3.select(\"#collision-detection\").select(\"svg\").remove();\n\n var element = d3.select('#collision-detection').node(),\n width = element.getBoundingClientRect().width,\n height = element.getBoundingClientRect().height;\n\n var nodes = d3.range(300).map(function() { return {radius: Math.random() * 12 + 4}; }),\n root = nodes[0],\n color = d3.scale.category20b();\n\n var force = d3.layout.force()\n .gravity(0.05)\n .charge(function(d, i) { return i ? 0 : -2000; })\n .nodes(nodes)\n .size([width, height]);\n\n var svg = d3.select(\"#collision-detection\").append(\"svg\")\n .attr(\"width\", width)\n .attr(\"height\", height);\n\n\n root.radius = 0;\n root.fixed = true;\n force.start();\n\n svg.selectAll(\"circle\")\n .data(nodes.slice(1))\n .enter().append(\"circle\")\n .attr(\"r\", function(d) { return d.radius; })\n .style(\"fill\", function(d, i) { return color(i % 3); });\n\n force.on(\"tick\", function(e) {\n var q = d3.geom.quadtree(nodes),\n i = 0,\n n = nodes.length;\n\n while (++i < n) q.visit(collide(nodes[i]));\n\n svg.selectAll(\"circle\")\n .attr(\"cx\", function(d) { return d.x; })\n .attr(\"cy\", function(d) { return d.y; });\n });\n\n svg.on(\"mousemove\", mousemove);\n\n function mousemove() {\n\n var p1 = d3.mouse(this);\n root.px = p1[0];\n root.py = p1[1];\n force.resume();\n\n }\n\n function collide(node) {\n var r = node.radius + 16,\n nx1 = node.x - r,\n nx2 = node.x + r,\n ny1 = node.y - r,\n ny2 = node.y + r;\n return function(quad, x1, y1, x2, y2) {\n if (quad.point && (quad.point !== node)) {\n var x = node.x - quad.point.x,\n y = node.y - quad.point.y,\n l = Math.sqrt(x * x + y * y),\n r = node.radius + quad.point.radius;\n if (l < r) {\n l = (l - r) / l * .5;\n node.x -= x *= l;\n node.y -= y *= l;\n quad.point.x += x;\n quad.point.y += y;\n }\n }\n return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1;\n };\n }\n }", "function collide(alpha) {\n var quadtree = d3.geom.quadtree(nodes);\n return function (d) {\n var r = d.radius + maxRadius + Math.max(padding, clusterPadding),\n nx1 = d.x - r,\n nx2 = d.x + r,\n ny1 = d.y - r,\n ny2 = d.y + r;\n quadtree.visit(function (quad, x1, y1, x2, y2) {\n if (quad.point && (quad.point !== d)) {\n var x = d.x - quad.point.x,\n y = d.y - quad.point.y,\n l = Math.sqrt(x * x + y * y),\n r = d.radius + quad.point.radius + (d.cluster === quad.point.cluster ? padding : clusterPadding);\n if (l < r) {\n l = (l - r) / l * alpha;\n d.x -= x *= l;\n d.y -= y *= l;\n quad.point.x += x;\n quad.point.y += y;\n }\n }\n return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1;\n });\n };\n }", "function collide(alpha) {\n\tvar quadtree = d3.geom.quadtree(nodes);\n\treturn function(d) {\n\t var r = node_radius[ nodeType(d.id) ] + 16,\n nx1 = d.x - r,\n nx2 = d.x + r,\n ny1 = d.y - r,\n ny2 = d.y + r;\n\t quadtree.visit(function(quad, x1, y1, x2, y2) {\n\t\tif (quad.point && (quad.point !== d)) {\n\t\t var x = d.x - quad.point.x,\n\t\t y = d.y - quad.point.y,\n\t\t l = Math.sqrt(x * x + y * y),\n\t\t r = node_radius[ nodeType(d.id) ] + node_radius[ nodeType(quad.point.id) ];\n\t\t if (l < r) {\n\t\t\tl = (l - r) / l * alpha;\n\t\t\td.x -= x *= l;\n\t\t\td.y -= y *= l;\n\t\t\tquad.point.x += x;\n\t\t\tquad.point.y += y;\n\t\t }\n\t\t}\n\t\treturn x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1;\n\t });\n\t};\n }", "function checkCollisions() {\n\n allEnemies.forEach(function(enemy) {\n // From https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection\n var player_circle = {radius: enemy.radius, pos: enemy.getCenter()};\n var enemy_circle = {radius: player.radius, pos: player.getCenter()};\n\n var dx = player_circle.pos.x - enemy_circle.pos.x;\n var dy = player_circle.pos.y - enemy_circle.pos.y;\n var distance = Math.sqrt(dx * dx + dy * dy);\n\n if (distance < player_circle.radius + enemy_circle.radius) {\n Map.collided = true;\n Map.gameRunning = false;\n }\n });\n // Update score if you jump into the water.\n if (!Map.collided && player.pos.y <= Map.SPRITE_BEGINNING_Y_POS - Map.BLOCKHEIGHT * (Map.rows -1)) {\n Map.score += 1;\n reset();\n }\n }", "checkCollisions(){\n //current user id\n const uid = this.props.userkey;\n // current players gfx\n const player = this[`player_${uid}`];\n // getting list of boozied player\n const boozies = Object.keys(this.props.games[this.currentGame].players).filter((id)=>{\n return this.props.games[this.currentGame].players[id].playerstate === 'IT';\n });\n\n // checking for collision against boozied if current player is not boozied\n if(!boozies.includes(uid)){\n boozies.forEach((id)=>{\n if(this.circleHit(player, this[`player_${id}`])){\n //changing current player to boozied in db if caught\n const updates = {};\n updates[`/games/${this.currentGame}/players/${uid}/playerstate`] = 'IT';\n this.db.ref().update(updates);\n }\n });\n }\n }", "function circlesColliding(ball1, ball2, dt)\n{\n\t//compare the distance to combined radii\n\tvar dx = ball2.pos.x - ball1.pos.x;\n\tvar dy = ball2.pos.y - ball1.pos.y;\n\tvar radii = ball1.rad + ball2.rad;\n\n\tif ((dx * dx) + (dy * dy) <= radii * radii) {\n\n\t\tvar distance = Math.sqrt(((ball1.pos.x - ball2.pos.x)*(ball1.pos.x - ball2.pos.x)) + \n\t\t\t\t\t\t\t\t((ball1.pos.y - ball2.pos.y)*(ball1.pos.y - ball2.pos.y)));\n\n\t\tvar overLap = 0.5 * (distance - ball1.rad - ball2.rad);\n\t\tball1.pos.x -= (overLap * (ball1.pos.x - ball2.pos.x) / distance);\n\t\tball1.pos.y -= (overLap * (ball1.pos.y - ball2.pos.y) / distance);\n\n\t\tball2.pos.x += (overLap * (ball1.pos.x - ball2.pos.x) / distance);\n\t\tball2.pos.y += (overLap * (ball1.pos.y - ball2.pos.y) / distance);\n\n\t\t\n\t\t// dynamic collision\n\t\tdistance = Math.sqrt(((ball1.pos.x - ball2.pos.x)*(ball1.pos.x - ball2.pos.x)) + \n\t\t\t\t\t\t\t\t((ball1.pos.y - ball2.pos.y)*(ball1.pos.y - ball2.pos.y)));\n\n\t\tvar nx = (ball1.pos.x - ball2.pos.x) / distance;\n\t\tvar ny = (ball1.pos.y - ball2.pos.y) / distance;\n\n\t\tvar tx = -ny;\n\t\tvar ty = nx;\n\n\t\tvar tan1 = ball1.vel.x * tx + ball1.vel.y * ty;\n\t\tvar tan2 = ball2.vel.x * tx + ball2.vel.y * ty;\n\n\t\tvar dpNorm1 = ball1.vel.x * nx + ball1.vel.y * ny;\n\t\tvar dpNorm2 = ball2.vel.x * nx + ball2.vel.y * ny;\n\n\n\t\tvar m1 = (dpNorm1 * (ball1.mass - ball2.mass) + 2 * ball2.mass * dpNorm2)/ (ball1.mass + ball2.mass);\n\t\tvar m2 = (dpNorm2 * (ball2.mass - ball1.mass) + 2 * ball1.mass * dpNorm1)/ (ball1.mass + ball2.mass);\n\n\n\t\tball1.vel.x = tx * tan1 + nx * m1;\n\t\tball1.vel.y = ty * tan1 + ny * m1;\n\t\tball2.vel.x = tx * tan2 + nx * m2;\n\t\tball2.vel.y = ty * tan2 + ny * m2;\n\n\t}\n}", "function collide(alpha) {\n var quadtree = d3.geom.quadtree(nodes);\n return function (d) {\n var r = d.radius + maxRadius + Math.max(padding, clusterPadding),\n nx1 = d.x - r,\n nx2 = d.x + r,\n ny1 = d.y - r,\n ny2 = d.y + r;\n quadtree.visit(function (quad, x1, y1, x2, y2) {\n if (quad.point && quad.point !== d) {\n var x = d.x - quad.point.x,\n y = d.y - quad.point.y,\n l = Math.sqrt(x * x + y * y),\n r =\n d.radius +\n quad.point.radius +\n (d.cluster === quad.point.cluster ? padding : clusterPadding);\n if (l < r) {\n l = ((l - r) / l) * alpha;\n d.x -= x *= l;\n d.y -= y *= l;\n quad.point.x += x;\n quad.point.y += y;\n }\n }\n return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1;\n });\n };\n }", "function bodyCollision() {\n\tvar headID = segments[segments.length - 1].ID;\n\tvar headTop = $(headID).position().top;\n\tvar headLeft = $(headID).position().left;\n\tvar segmentID;\n\tvar segmentTop;\n\tvar segmentLeft;\n\n\tfor (i = 0; i < segments.length - 2; i++) {\n\t\tsegmentID = segments[i].ID;\n\t\tsegmentTop = $(segmentID).position().top;\n\t\tsegmentLeft = $(segmentID).position().left;\n\t\tif ((headTop === segmentTop) && (headLeft === segmentLeft)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}" ]
[ "0.63642544", "0.6354681", "0.6265527", "0.6175786", "0.61545223", "0.6125178", "0.60746783", "0.6014029", "0.5948296", "0.5934016", "0.5886665", "0.5883664", "0.5880635", "0.5880635", "0.5880635", "0.5843411", "0.5809456", "0.57995117", "0.57941675", "0.5793322", "0.57710433", "0.57682514", "0.57547665", "0.57517153", "0.57397807", "0.57296157", "0.5726533", "0.57051766", "0.57033116", "0.5699456", "0.56986845", "0.5677566", "0.5671318", "0.5670023", "0.5662565", "0.5662293", "0.5660889", "0.56553775", "0.5649731", "0.5649731", "0.564426", "0.5623376", "0.56161976", "0.56161976", "0.56107163", "0.5598751", "0.55931306", "0.5578947", "0.55744594", "0.5564495", "0.5555067", "0.5550866", "0.554365", "0.55409235", "0.55275726", "0.5525623", "0.55198306", "0.55108774", "0.55108774", "0.55108774", "0.55108774", "0.55079824", "0.5506999", "0.5506024", "0.5498078", "0.5481663", "0.5474", "0.5467663", "0.54640496", "0.5462499", "0.54579", "0.5454203", "0.5448109", "0.54466784", "0.54463595", "0.5443372", "0.5436898", "0.5428906", "0.5412694", "0.5408933", "0.5398988", "0.5394774", "0.53881776", "0.5383924", "0.5383367", "0.53824866", "0.5381855", "0.53787476", "0.53759485", "0.5369246", "0.5368443", "0.5355652", "0.5355076", "0.5337765", "0.5336709", "0.5335617", "0.5335553", "0.5333644", "0.5333103", "0.5322889", "0.53206974" ]
0.0
-1
Given two quantities a and b, returns the fraction to split the circle a + b.
function fraction(a, b) { var k = a / (a + b); if (k > 0 && k < 1) { var t0, t1 = Math.pow(12 * k * Math.PI, 1 / 3); for (var i = 0; i < 10; ++i) { // Solve for theta numerically. t0 = t1; t1 = (Math.sin(t0) - t0 * Math.cos(t0) + 2 * k * Math.PI) / (1 - Math.cos(t0)); } k = (1 - Math.cos(t1 / 2)) / 2; } return k; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function divide(a, b) {\n\t\ta = a + 0.0;\n\t\tb = b + 0.0;\n\t\tif(Math.abs(b) < 0.00001) {\n\t\t\tb = 0.0001;\n\t\t}\t\n\t\treturn a / b;\n\t}", "toFraction(a, b) {\n var r = Fraction(a, b);\n if (algebraicMode && r.den == 1)\n return r.num;\n else\n return r;\n }", "function divide(a, b) {\n return divide(a, b);\n}", "function divide(a, b) {\r\n // if (b === 0) {\r\n // throw 'Division by zero is undefined: ' + a + '/' + b;\r\n // }\r\n var sign = 1;\r\n if (a < 0) {\r\n a = -a;\r\n sign = -sign;\r\n }\r\n if (b < 0) {\r\n b = -b;\r\n sign = -sign;\r\n }\r\n var result = 0;\r\n while (a >= 0) {\r\n a -= b;\r\n result++;\r\n }\r\n return (result - 1) * sign;\r\n }", "function Bd(a,b){var c=pb(a[1]),d=pb(b[1]),e=(d-c)/2,f=pb(b[0]-a[0])/2,c=Math.sin(e)*Math.sin(e)+Math.sin(f)*Math.sin(f)*Math.cos(c)*Math.cos(d);return 2*Cd.radius*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))}", "function divide(a, b) {\n\t\tvar result = a / b;\n\t\treturn result;\n\t}", "function bifraction(a, b, c, x, y) {\n var frac = {};\n frac.numer1 = Number(a);\n frac.numer2 = Number(b);\n frac.denom = Number(c);\n \n // Variables affecting rendering.\n frac.fillColor1 = \"#33ff99\";\n frac.fillColor2 = \"#ff9933\";\n frac.emptyColor = \"#ffffff\";\n frac.circleRadius = 50;\n frac.circleSpacing = 10;\n frac.x = Number(x);\n frac.y = Number(y);\n\n frac.filledPath1 = function() {\n var ret = \"\";\n var a = this.numer1, b = this.numer2, c = this.denom, k;\n\n // Special case if c = 1 (representation is a circle)\n if (c == 1) {\n for (var i = 0; i < a; i++)\n ret = ret + circlePath(this.x + i * (2 * this.circleRadius + this.circleSpacing), this.y, this.circleRadius);\n return ret;\n }\n \n // Concatenate a whole bunch of wedges\n k = 0;\n while (k < a) {\n var iCircle, cx, cy, r, theta1, theta2;\n iCircle = Math.floor(k / c);\n if (iCircle < 0) iCircle = 0;\n cx = this.x + iCircle * (2 * this.circleRadius + this.circleSpacing);\n cy = this.y;\n r = this.circleRadius;\n theta1 = 2 * k * Math.PI / c;\n theta2 = 2 * (k + 1) * Math.PI / c;\n ret = ret + wedge(cx, cy, r, theta1, theta2).path();\n k = k + 1;\n }\n return ret;\n }\n\n frac.filledPath2 = function() {\n var ret = \"\";\n var a = this.numer1, b = this.numer2, c = this.denom, k;\n\n // Special case if c = 1 (representation is a circle)\n if (c == 1) {\n for (var i = a; i < a + b; i++)\n ret = ret + circlePath(this.x + i * (2 * this.circleRadius + this.circleSpacing), this.y, this.circleRadius);\n return ret;\n }\n \n \n // Concatenate a whole bunch of wedges\n k = a;\n while (k < a + b) {\n var iCircle, cx, cy, r, theta1, theta2;\n iCircle = Math.floor(k / c);\n if (iCircle < 0) iCircle = 0;\n cx = this.x + iCircle * (2 * this.circleRadius + this.circleSpacing);\n cy = this.y;\n r = this.circleRadius;\n theta1 = 2 * k * Math.PI / c;\n theta2 = 2 * (k + 1) * Math.PI / c;\n ret = ret + wedge(cx, cy, r, theta1, theta2).path();\n k = k + 1;\n }\n return ret;\n }\n\n frac.emptyPath = function() {\n var ret = \"\";\n var a = this.numer1, b = this.numer2, c = this.denom, k;\n var nCircles;\n if (a + b == 0) nCircles = 1;\n else nCircles = Math.ceil((a + b) / c);\n\n if ((c == 1) && (a + b == 0))\n return circlePath(this.x, this.y, this.circleRadius);\n\n // Concatenate a whole bunch of wedges\n k = a + b;\n while (k < nCircles * c) {\n var iCircle, cx, cy, r, theta1, theta2;\n iCircle = Math.floor(k / c);\n if (iCircle < 0) iCircle = 0;\n cx = this.x + iCircle * (2 * this.circleRadius + this.circleSpacing);\n cy = this.y;\n r = this.circleRadius;\n theta1 = 2 * k * Math.PI / c;\n theta2 = 2 * (k + 1) * Math.PI / c;\n ret = ret + wedge(cx, cy, r, theta1, theta2).path();\n k = k + 1;\n }\n return ret;\n }\n \n return frac;\n}", "function divide(a,b) {\n\treturn a / b\n}", "function div(a, b) {\n return ~~(a / b);\n}", "function divide(a,b){\n return a / b\n}", "function division(a, b) {\r\n\treturn a / b;\r\n}", "div (b) {\n\t\t\tconst d = b.x * b.x + b.y * b.y; return Complex.C ((this.x * b.x + this.y * b.y) / d, (this.y * b.x - this.x * b.y) / d);\n\t\t}", "function percentage(a, b){\n\t var increase = b - a;\n\t var step2 = increase / a;\n\t return step2 * 100;\n\t}", "function greatComDiv(a, b) {\n if ( ! b) {\n return a;\n }\n return greatComDiv(b, a % b);\n}", "gcd(a, b) {\n // Euclid's algorithm\n let n = new Decimal(a);\n let d = new Decimal(b);\n if (!(n.isInteger() && d.isInteger())) {\n throw new TypeError('gcd() invalid arguments');\n }\n while (!n.isZero()) {\n let r = n.clone();\n n = integer.rem(d, r);\n d = r;\n }\n return d;\n }", "function div(a, b) {\n if (b instanceof complex_1.Complex) {\n return _mul_two(a, b.inverse());\n }\n else {\n return _mul_two(a, 1 / b);\n }\n}", "function div(a, b) {\n return (a-(a%b))/b;\n}", "function percentage(a,b){\n return (a/b)*100;\n}", "function separationFunc(a, b) {\n //a and b should have ui field with height() method\n var height1 = calcHeight(a);\n var height2 = calcHeight(b);\n\n var dif = height1 / 2 + height2 / 2 + (a.parent == b.parent ? p.heightBetweenNodesOfOneParent : p.heightBetweenNodesOfDifferentParent);\n return dif;\n }", "function gcd(a,b) {\n if (Math.floor(a)!=a || Math.floor(b)!=b) return 1; // se i numeri non sono interi restituisce 1\n a = Math.abs(a); b = Math.abs(b);\n if (b > a)\n b = (a += b -= a) - b; // scambia le variabili in modo che b<a\n while (b !== 0) {\n var m = a % b;\n a = b;\n b = m;\n }\n return a;\n}", "function divide1(a, b) {\n return a / b; \n}", "div(a, b) {\n\t\tthis.registers[a] = Math.trunc(this.get(a) / this.get(b));\n\t}", "function extend_gcd_raw(a, b, x = { v: 0 }, y = { v: 0 }) {\n if (b === 0) {\n x.v = 1;\n y.v = 0;\n } else {\n extend_gcd(b, a % b, x, y);\n const x2 = x.v;\n x.v = y.v;\n y.v = x2 - ((a / b) | 0) * y.v;\n }\n return { x, y };\n}", "function division(a, b) {\n\treturn printResult(parseInt(a) / parseInt(b));\n}", "function percentage (a, b){\n let P= Math.round(a/(a+b)*1000)/10;\n return \"your percentage is \" + P + \"%\";\n}", "div(val) {\r\n let a = this.a * val.b;\r\n let b = val.a * this.b;\r\n return new Rational(a, b).reduce();\r\n }", "function GetQuotient(a,b){\n\treturn (a-a%b)/b;\n}", "function divide(a, b) {\n int1 = a / b;\n return int1;\n}", "function percentDiff(a, b) {\n let divideBy = (a > b) ? a : b;\n return Math.abs(a - b) / divideBy * 100;\n }", "function div(a,b)\n{\nreturn(a*b);\n}", "function gcd(a, b) {\n\tif (a == b) return a;\n\n\treturn (a>b) ? gcd(a-b, b) : gcd(a, b-a);\n}", "function GCD (a,b) {\n\t// TODO\t\n\tvar r=a%b;\t\n\twhile (r!=0) {\n\t\ta=b;\t\n\t\tb=r; \n\t\tr=a%b;\t\t\n\t}\n\treturn b;\n}", "function bnDivide(a) {\n var r = nbi();this.divRemTo(a, r, null);return r;\n }", "function bnDivide(a) {\n var r = nbi();this.divRemTo(a, r, null);return r;\n }", "function bnDivide(a) {\n var r = nbi();this.divRemTo(a, r, null);return r;\n }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }", "function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }" ]
[ "0.70612884", "0.6900385", "0.66337264", "0.64886814", "0.6479283", "0.64708656", "0.6453039", "0.64450073", "0.63730025", "0.62924194", "0.6288027", "0.6276519", "0.6257361", "0.6207109", "0.6181705", "0.6172507", "0.61696637", "0.6164338", "0.6155207", "0.61433804", "0.61411905", "0.61032236", "0.6089194", "0.6042026", "0.60124266", "0.6011982", "0.5965779", "0.5959955", "0.59533364", "0.5948902", "0.5946412", "0.5946002", "0.59156394", "0.59156394", "0.59156394", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796", "0.59088796" ]
0.73185223
28
Update the active topic on hashchange, perhaps creating a new topic.
function hashchange() { var name = decodeURIComponent(location.hash.substring(1)).trim(); updateActiveTopic(name && name != "!" ? findOrAddTopic(name) : null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n }", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(findTopic(name));\n}", "function updateActiveTopic(topic) {\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.select(\"#g-topic\").text((topic.count > maxMentions ? \"A sampling of \" : topic.count || \"No\") + \" mentions of \" + topic.name + \".\");\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.select(\"#g-topic\").text(\"Lucastimmons tweets\");\n }\n}", "changeTopic(newTopic) {\n let url = defaultUrl + '&category=' + newTopic;\n this.apiCall(url);\n }", "function topicChanged( topic, room, user ) {\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function setTopic(newTopic) {\n const oldTopic = topic;\n topic = topicToFileName(newTopic);\n const date = datepicker('getDate');\n fetchDates(topic, getYYYYMM(date));\n return oldTopic;\n }", "function switchTopic(key) {\n alert(\"Switching topics not yet implemented\");\n}", "function addNewTopic(topic) {\n\tif (topic != \"\") {\n\t\tconsole.log(\"Adding new task: \" + topic);\n\t\tvar topicId = Math.floor(100000 + Math.random() * 900000);\n\t\ttopicsDictionary[topicId] = {id: topicId, name: topic, time: 0};\n\n\t\tif (selectedTopicID == \"\" || selectedTopicID == null || isWorkingOnTask == false) {\n\t\t\tselectedTopicID = topicId;\n\t\t\tstoreSelectedTopicID();\n\t\t}\n\t\tstoreTopics();\n\t}\n}", "function addNewTopicToUX(uxBus, topic){\n //Make sure topic with such pkfp does not exist\n let topicsList = domUtil.$(\"#topics-list\")\n let topics = Array.from(domUtil.$$(\".side-block-data-list-item\", topicsList)).filter(item=>item.getAttribute(\"pkfp\") === topic.pkfp)\n if(topics.length > 0) return\n\n //Creating messages area\n let messageBlocksContainer = domUtil.$(\"#topic-message-blocks-container\")\n //Creating side panel elements\n let topicListItem = UI.bakeTopicListItem(topic, uxBus);\n let topicAssets = UI.bakeTopicAssets(topic, uxBus);\n console.log(\"Baked\");\n\n //Adding new elements to view\n domUtil.appendChildren(topicsList, [topicListItem, topicAssets])\n let topicMessageBlock = UI.bakeTopicMessagesBlock(topic.pkfp, topic.name)\n domUtil.appendChildren(messageBlocksContainer, topicMessageBlock)\n\n addEventListenersForMessagesWindow(uxBus, topicMessageBlock)\n uxTopics[topic.pkfp] = new TopicUXData()\n}", "handleUpdatedTopicStore( topicStore ) {\n\n this.setState( {\n isActive: this.props.id == topicStore.activeTopicId\n } );\n\n }", "function trackChange(){\n var currentHash = location.hash;\n if (currentHash !== _oldHash){\n _hub.publish(self, _topic, {\"path\" : currentHash, \"oldPath\" : _oldHash}); //Publish the hash change.\n _oldHash = currentHash;\n }\n }", "function setTopic( text ) {\n info.setTopic( text );\n}", "async updateTopic({ topic_id, memo }) {\n\t\tconst client = this.#client\n\t\tconst topic = await new TopicUpdateTransaction()\n\t\t\t.setTopicId(topic_id)\n\t\t\t.setTopicMemo(memo)\n\t\t\t.execute(client)\n\n\t\treturn topic\n\t}", "function processTopicSettingsUpdated(topic){\n console.log(\"Processing topic settings updated\");\n for(let participant of topic.participants){\n let nickname = participant.getNickname();\n let alias = participant.getAlias()\n Common.setParticipantAlias(topic, participant, alias)\n Common.setParticipantNickname(topic, participant, nickname)\n }\n\n for (let invite of topic.getInvites()){\n Common.setInviteAlias(invite)\n }\n\n}", "onTopicClick(topic) {\n if (topic.rowid === this.currentTopic) {\n return;\n }\n\n this.currentTopic = topic.rowid;\n localStorage.setItem('currentTopic', this.currentTopic);\n this.loadSelections();\n }", "function change_topic() {\n\tif (numAnswered < chosenTopics.length - 1) {\n\t\t//update progress bar\n\t\tnumAnswered++; //global\n\t\tset_progress();\n\t\t//reset input in text area\n\t\tdocument.getElementById(\"answer-input\").value=\"\";\n\t\t//change topic in header\n\t\tdocument.getElementById(\"topic-text\").innerHTML = chosenTopics[numAnswered].topicText;\n\t\tif (numAnswered === chosenTopics.length - 1){\n\t\t\tdocument.getElementById(\"send-button\").innerHTML = \"Finish\";\n\t\t}\n\t}\n\telse {\n\t\tprepare_modal();\n\t}\n}", "function selectTopic() {\n\t//Topic is different than existing active topic\n\tif (selectedTopicID != $(this).val()) {\n\t\tif (selectedTopicID != null && selectedTopicID != \"\") {\n\t\t\tstopTimer();\n\t\t\tunsetActiveTopic();\n\t\t}\n\n\t\tselectedTopicID = $(this).val();\n\t\tstoreSelectedTopicID();\n\n\t\tsetActiveTopic();\n\t\tstartTimer();\n\n\t\tdocument.title = \"Work Log - \" + topicsDictionary[selectedTopicID].name;\n\t} else {\n\t\ttoggleTimer(!isWorkingOnTask);\n\t}\n\n\trenderEvents();\n\tstoreLocalStorage(eventsLogList, topicsDictionary, selectedTopicID);\n}", "function addObserver(aTopic)\n{\n if (gActiveTopics.indexOf(aTopic) < 0)\n {\n gObsService.addObserver(gObserver, aTopic, false);\n gActiveTopics.push(aTopic);\n }\n}", "routeToTopic(nextTopic, target) {\n console.log('router.js routeToTopic is running, nextTopic:', nextTopic, 'target:', target);\n // check against active topic\n const prevTopic = this.store.state.activeTopic;\n\n if (!prevTopic || prevTopic !== nextTopic) {\n this.store.commit('setActiveTopic', nextTopic);\n this.store.commit('setActiveParcelLayer', this.activeParcelLayer());\n }\n\n if (!this.silent) {\n let address = this.getAddressFromState();\n // address = 'addr ' + address;\n const nextHash = this.makeHash(address, nextTopic);\n const lastHistoryState = this.history.state;\n this.history.replaceState(lastHistoryState, null, nextHash);\n }\n }", "static changeTopic() {\n const input = document.getElementById('subscription_topic');\n const topic = input.value;\n\n Controller.Api.post('/change_topic', { topic: topic })\n .then(response => {\n console.log(response.data);\n })\n .catch(error => {\n console.log(error);\n });\n\n console.log('topic: ', topic);\n input.value = '';\n }", "function newTopic(topicArray, topicsList) {\n //console.log('received: ', topicArray);\n if(typeof topicArray !== \"undefined\"){\n topicArray.forEach(function (topic, topicIndex) {\n var addToTopicsList = true;\n if (topicsList.length > 0) {\n\n topicsList.forEach(function (topicObject, index) {\n if (topicObject.topic == topic.term) {\n var newCount = topicObject.count + 1;\n topicObject.count = newCount;\n addToTopicsList = false;\n }\n });\n\n }\n if (addToTopicsList == true) {\n\n //then add it to topicsList\n var newTopic = {topic: topic.term, count: 1};\n topicsList.push(newTopic);\n }\n });\n\n }\n return topicsList;\n}", "function updateUserTopic(userId, topic) {\n return new Promise((resolve, reject) => {\n if (!topic) {\n reject(new Error(\"topic must be set\"));\n return;\n }\n const data = JSON.stringify({\n api_key: process.env.EMAIL_OCTOPUS_API_KEY,\n fields: {\n Topic: topic,\n },\n status: \"SUBSCRIBED\",\n });\n\n updateContact(userId, data)\n .then((result) => resolve(result))\n .catch((err) => reject(err));\n });\n}", "async function setNodewarTopic(message, topic) {\n console.log(\"Setting topic\")\n const conf = await DB.Connect(message.guild)\n .table(\"configuration\")\n .get(0)\n .run()\n const nodeWarChannel = message.member.guild.channels.find(\n \"name\",\n conf.nodeWarChannel\n )\n return nodeWarChannel.setTopic(topic)\n}", "function updateTopics(topics) {\n topics.forEach(function(d, i) { d.r = Math.max(12, r(d.count)); }); // min. collision\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n }", "routeToTopic(nextTopic, target) {\n // console.log('router.js routeToTopic is running');\n // check against active topic\n const prevTopic = this.store.state.activeTopic;\n\n if (!prevTopic || prevTopic !== nextTopic) {\n this.store.commit('setActiveTopic', nextTopic);\n this.store.commit('setActiveParcelLayer', this.activeParcelLayer());\n\n if (this.store.state.map) {\n const prevBasemap = this.store.state.map.basemap || null;\n const nextTopicConfig = this.config.topics.filter(topic => {\n return topic.key === nextTopic;\n })[0] || {};\n const nextBasemap = nextTopicConfig.parcels;\n if (prevBasemap !== nextBasemap) {\n this.store.commit('setBasemap', nextTopicConfig.parcels);\n }\n }\n }\n\n if (!this.silent) {\n const address = this.getAddressFromState();\n const nextHash = this.makeHash(address, nextTopic);\n const lastHistoryState = this.history.state;\n this.history.replaceState(lastHistoryState, null, nextHash);\n }\n }", "function changeTT(topic, message) {\n str = message.toString('utf-8');\n console.log('Received %s : %s', topic, str);\n\n value = parseInt(str,10);\n\n // Update HTML content\n document.getElementById(topic).innerHTML = value;\n\n ds = mapTTData.get(topic);\n // Update chart\n if (ds.data.length > 10) {\n ds.data.shift();\n }\n ds.data.push(value).toFixed(2);\n chartTT.update();\n}", "function onHashChange() {\n\t\tupdateActiveTab();\n\t\tupdateActiveSection();\n\t}", "function updateTopics(topics) {\n topics.forEach(function(d, i) { d.r = Math.max(12, r(d.count)); }); // min. collision\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n}", "function addTopicToSelected(topic) {\n // if the there are too many topics selected, tell the user\n if (topics.full()) {\n alert(\"You may only select up to 10 topics.\")\n return;\n }\n // update the selected topics\n updateSelected(topic);\n // add the topic\n topics.add(topic);\n}", "function openNewTabFromHash() {\n\tvar data = getTopicFromHash();\n\tif (data.topic_id != 0) {\n\t\tif (isTopicInATab(data)) {\n\t\t\tswitchToTab(isTopicInATab(data));\n\t\t}\n\t\telse {\n\t\t\topenNewTab(data.forum_id, data.topic_id);\n\t\t}\n\t}\n}", "function set_curr_topic(name, url){\n var txt = document.getElementById(\"topic_name\");\n txt.innerHTML = name;\n txt.url = url;\n report_history({ev_type:\"found_topic\", carac:{name:name, url:url}});\n}", "updateTopicStatus(courseId, topic, status, userId) {\n return __awaiter(this, void 0, void 0, function* () {\n if (topic.userTopicId) {\n return this.updateCourseTopicStatus(topic.userTopicId, status);\n }\n else {\n return this.addCourseTopic(courseId, topic.code, status, userId);\n }\n });\n }", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}", "function updateTopics(topics) {\n topics.forEach(function(d) {\n d.r = r(d.count);\n d.cr = Math.max(minRadius, d.r);\n d.k = fraction(d.parties[0].count, d.parties[1].count);\n if (isNaN(d.k)) d.k = .5;\n if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random();\n d.bias = .5 - Math.max(.1, Math.min(.9, d.k));\n });\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n updateArrows();\n tick({alpha: 0}); // synchronous update\n}" ]
[ "0.7695971", "0.73827994", "0.69993854", "0.68418825", "0.67827946", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.6475049", "0.64230907", "0.6278914", "0.61334515", "0.6126504", "0.60858613", "0.6065929", "0.6052896", "0.59918106", "0.5941889", "0.58773935", "0.58670515", "0.5729087", "0.57101285", "0.57091236", "0.5704048", "0.5631584", "0.563033", "0.5622305", "0.56144786", "0.56031644", "0.5588545", "0.55649424", "0.5549845", "0.55469626", "0.5518276", "0.5401944", "0.5377629", "0.5377629", "0.5377629", "0.5377629", "0.5377629", "0.5377629", "0.5377629", "0.5377629", "0.5377629", "0.5377629", "0.5377629" ]
0.7666164
29
Trigger a hashchange on submit.
function submit() { var name = this.search.value.trim(); location.hash = name ? encodeURIComponent(name) : "!"; this.search.value = ""; d3.event.preventDefault(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hashChanged() {\n var url = \"#\" + (document.location.hash.slice(1) || \"\");\n history.push(url);\n trigger(\"GET\", url);\n }", "function hashChanged(e){\n\t\trespondToState();\n\t}", "function onSubmitted(){\n\t\t\t\t\t\t\t\t\t\t\tlocation.hash = \"/tool/list\";\n\t\t\t\t\t\t\t\t\t\t}", "function hashchange(){\n\t\tgoTo(location.hash, false);\n\t}", "function onHashChange() {\n\t\tupdateActiveTab();\n\t\tupdateActiveSection();\n\t}", "function locationHashChanged() {\n var hash = location.hash.slice(1);\n router.handleURL(hash);\n}", "function handleHashChangeEvent() {\n\t var id = location.hash.replace('#', '');\n\t var instance;\n\t var $elem;\n\n\t if (!id) {\n\n\t // Check if we have currently opened modal and animation was completed\n\t if (current && current.state === STATES.OPENED && current.settings.hashTracking) {\n\t current.close();\n\t }\n\t } else {\n\n\t // Catch syntax error if your hash is bad\n\t try {\n\t $elem = $(\n\t '[data-' + PLUGIN_NAME + '-id=\"' + id + '\"]'\n\t );\n\t } catch (err) {}\n\n\t if ($elem && $elem.length) {\n\t instance = $[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)];\n\n\t if (instance && instance.settings.hashTracking) {\n\t instance.open();\n\t }\n\t }\n\n\t }\n\t }", "function trackChange(){\n var currentHash = location.hash;\n if (currentHash !== _oldHash){\n _hub.publish(self, _topic, {\"path\" : currentHash, \"oldPath\" : _oldHash}); //Publish the hash change.\n _oldHash = currentHash;\n }\n }", "_addHashchange() {\n\t\tif (this.options.hash) {\n\t\t\tthis._onHashchange = this._onHashchange.bind(this);\n\t\t\twindow.addEventListener('hashchange', this._onHashchange);\n\t\t}\n\t}", "function onHashChange() {\n\tconst method = location.hash.startsWith('#page=revisions&') ? 'show' : 'hide';\n\t$.fn[method].call($DIFF_BUTTONS);\n\n\tif (method == 'show' && DIFF) {\n\t\tDIFF.refreshDiffButtons();\n\t}\n}", "function handleHashChangeEvent() {\n var id = location.hash.replace('#', '');\n var instance;\n var $elem;\n\n if (!id) {\n\n // Check if we have currently opened modal and animation was completed\n if (current && current.state === STATES.OPENED && current.settings.hashTracking) {\n current.close();\n }\n } else {\n\n // Catch syntax error if your hash is bad\n try {\n $elem = $(\n '[data-' + PLUGIN_NAME + '-id=\"' + id + '\"]'\n );\n } catch (err) {}\n\n if ($elem && $elem.length) {\n instance = $[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)];\n\n if (instance && instance.settings.hashTracking) {\n instance.open();\n }\n }\n\n }\n }", "function handleHashChangeEvent() {\n var id = location.hash.replace('#', '');\n var instance;\n var $elem;\n\n if (!id) {\n\n // Check if we have currently opened modal and animation was completed\n if (current && current.state === STATES.OPENED && current.settings.hashTracking) {\n current.close();\n }\n } else {\n\n // Catch syntax error if your hash is bad\n try {\n $elem = $(\n '[data-' + PLUGIN_NAME + '-id=\"' + id + '\"]'\n );\n } catch (err) {}\n\n if ($elem && $elem.length) {\n instance = $[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)];\n\n if (instance && instance.settings.hashTracking) {\n instance.open();\n }\n }\n\n }\n }", "function handleHashChangeEvent() {\n var id = location.hash.replace('#', '');\n var instance;\n var $elem;\n\n if (!id) {\n\n // Check if we have currently opened modal and animation was completed\n if (current && current.state === STATES.OPENED && current.settings.hashTracking) {\n current.close();\n }\n } else {\n\n // Catch syntax error if your hash is bad\n try {\n $elem = $(\n '[data-' + PLUGIN_NAME + '-id=\"' + id + '\"]'\n );\n } catch (err) {}\n\n if ($elem && $elem.length) {\n instance = $[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)];\n\n if (instance && instance.settings.hashTracking) {\n instance.open();\n }\n }\n\n }\n }", "function handleHashChangeEvent() {\n var id = location.hash.replace('#', '');\n var instance;\n var $elem;\n\n if (!id) {\n\n // Check if we have currently opened modal and animation was completed\n if (current && current.state === STATES.OPENED && current.settings.hashTracking) {\n current.close();\n }\n } else {\n\n // Catch syntax error if your hash is bad\n try {\n $elem = $(\n '[data-' + PLUGIN_NAME + '-id=\"' + id + '\"]'\n );\n } catch (err) {}\n\n if ($elem && $elem.length) {\n instance = $[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)];\n\n if (instance && instance.settings.hashTracking) {\n instance.open();\n }\n }\n\n }\n }", "function handleHashChangeEvent() {\n var id = location.hash.replace('#', '');\n var instance;\n var $elem;\n\n if (!id) {\n\n // Check if we have currently opened modal and animation was completed\n if (current && current.state === STATES.OPENED && current.settings.hashTracking) {\n current.close();\n }\n } else {\n\n // Catch syntax error if your hash is bad\n try {\n $elem = $(\n '[data-' + PLUGIN_NAME + '-id=\"' + id + '\"]'\n );\n } catch (err) {}\n\n if ($elem && $elem.length) {\n instance = $[PLUGIN_NAME].lookup[$elem.data(PLUGIN_NAME)];\n\n if (instance && instance.settings.hashTracking) {\n instance.open();\n }\n }\n\n }\n }", "function poll() {\n var hash = get_fragment(),\n history_hash = history_get( last_hash );\n \n if ( hash !== last_hash ) {\n history_set( last_hash = hash, history_hash );\n \n $(window).trigger( str_hashchange );\n \n } else if ( history_hash !== last_hash ) {\n location.href = location.href.replace( /#.*/, '' ) + history_hash;\n }\n \n timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay );\n }", "function poll() {\n var hash = get_fragment(),\n history_hash = history_get( last_hash );\n \n if ( hash !== last_hash ) {\n history_set( last_hash = hash, history_hash );\n \n $(window).trigger( str_hashchange );\n \n } else if ( history_hash !== last_hash ) {\n location.href = location.href.replace( /#.*/, '' ) + history_hash;\n }\n \n timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay );\n }", "function poll() {\n var hash = get_fragment(),\n history_hash = history_get( last_hash );\n \n if ( hash !== last_hash ) {\n history_set( last_hash = hash, history_hash );\n \n $(window).trigger( str_hashchange );\n \n } else if ( history_hash !== last_hash ) {\n location.href = location.href.replace( /#.*/, '' ) + history_hash;\n }\n \n timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay );\n }", "function checkAndComputeHashChange(evt) {\n //Extracting hash, or null if there is nothing to extract\n var currentHash = null;\n\n // Current hash is superseeded by the event one...\n if(evt && evt.originalEvent && evt.originalEvent.newURL) {\n var newUrl = evt.originalEvent.newURL;\n currentHash = newUrl.substring(newUrl.indexOf('#') + 1);\n } else {\n currentHash = getCurrentPageHash();\n }\n\n if(previousHash != currentHash) {\n registerNewHash(currentHash);\n // Dispatch event\n var eventObject = {\n value: currentHash,\n old: previousHash\n };\n that.dispatch('change', eventObject);\n a.message.dispatch('a.hash.change', eventObject);\n previousHash = currentHash;\n store.set('previous', previousHash);\n }\n }", "function formSubmitted(e) {\n\n var action = e.target.getAttribute('action');\n\n if (action[0] === '#') {\n e.preventDefault();\n trigger('POST', action, e, serialize(e.target));\n }\n }", "function hashChange(measure, record) {\n window.location.hash = \"/\" + measure + \"/\" + record;\n}", "forward(path) {\n const event = new Event(\"hashchange\",{bubbles:false, cancelable:true})\n event.newURL = path;\n window.dispatchEvent(event);\n }", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(findTopic(name));\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n }", "function submit() {\n var name = this.search.value.trim();\n location.hash = name ? encodeURIComponent(name) : \"!\";\n this.search.value = \"\";\n d3.event.preventDefault();\n }", "function poll() {\n var hash = get_fragment(),\n history_hash = history_get( last_hash );\n \n if ( hash !== last_hash ) {\n history_set( last_hash = hash, history_hash );\n \n $(window).trigger( str_hashchange );\n \n } else if ( history_hash !== last_hash ) {\n location.href = location.href.replace( /#.*/, '' ) + history_hash;\n }\n \n timeout_id = window.setTimeout( poll, $.fn[ str_hashchange ].delay );\n}", "function poll() {\n var hash = get_fragment(),\n history_hash = history_get(last_hash);\n\n if (hash !== last_hash) {\n history_set(last_hash = hash, history_hash);\n\n $(window).trigger(str_hashchange);\n\n } else if (history_hash !== last_hash) {\n location.href = location.href.replace(/#.*/, '') + history_hash;\n }\n\n timeout_id = setTimeout(poll, $.fn[str_hashchange].delay);\n }", "function poll() {\n var hash = get_fragment(),\n history_hash = history_get(last_hash);\n\n if (hash !== last_hash) {\n history_set(last_hash = hash, history_hash);\n\n $(window).trigger(str_hashchange);\n\n } else if (history_hash !== last_hash) {\n location.href = location.href.replace(/#.*/, '') + history_hash;\n }\n\n timeout_id = setTimeout(poll, $.fn[str_hashchange].delay);\n }", "function dealWithHash () {\n\tif (!_ignoreHashChangeOnce) {\n\t\tvar hash = window.location.hash.substr(1);\n\t\tconsole.log('Hash changed to: '+hash);\n\t\tif (hash != '') {\n\t\t\tsetupAndSendAjaxRequest(hash);\n\t\t}else{\n\t\t\tsetupAndSendAjaxRequest('pages/home.html');\n\t\t}\n\t}\n\t_ignoreHashChangeOnce = false;\n}", "handleChangehashEvent(event) {\n this.setState({ newhashtag: event.target.value });\n }", "function locationHashChanged() {\n if (location.hash === \"\") {\n closePage();\n }\n}", "changed()\n {\n if (window.location.hash !== this.lastHash)\n {\n this.lastHash = window.location.hash;\n return true;\n }\n else\n {\n return false;\n }\n }", "function checkHash(e) {\n\tif (this.hash !== '') {\n\t\te.preventDefault();\n\n\t\tconst [hash] = [this.hash];\n\n\t\t$('html, body').animate({\n\t\t\tscrollTop: $(hash).offset().top\n\t\t}, 800, function initHash() {\n\t\t\twindow.location.hash = hash\n\t\t});\n\t}\n}", "function init() {\n $(window).bind('hashchange', hashChanged).trigger('hashchange');\n $(window).bind('submit', formSubmitted);\n }", "function checkHashValue() {\n if (location.hash) {\n handleHashValue();\n } else {\n queryInput.placeholder = QUERY_INPUT_PLACEHOLDER;\n }\n queryInput.focus();\n}", "function checkHash() {\r\n if (location.hash != \"\") {\r\n let hash = location.hash.match(/^#(.*)$/)[1];\r\n switch (hash) {\r\n case \"refreshed\":\r\n dom.connectWithStrava.click();\r\n break;\r\n }\r\n location.hash = \"\";\r\n }\r\n}", "function onHashChange() {\n // set location fragmention as uri-decoded text (from href, as hash may be decoded)\n location.fragmention = decodeURIComponent((location.href.match(/#(#|%23)(.+)/) || [0,0,''])[2].replace(/\\+/g, ' '));\n\n\n // conditionally remove stashed element fragmention attribute\n if (element) {\n element.removeAttribute('fragmention');\n\n // DEPRECATED: trigger style in IE8\n if (element.runtimeStyle) {\n element.runtimeStyle.windows = element.runtimeStyle.windows;\n }\n }\n\n // if fragmention exists\n if (location.fragmention) {\n // get element containing text (or return document)\n element = getElementByText(document, location.fragmention);\n\n // if element found\n if (element !== document) {\n // scroll to element\n element.scrollIntoView();\n\n // set fragmention attribute\n element.setAttribute('fragmention', '');\n element.setAttribute('tabindex', '-1');\n element.focus();\n\n // DEPRECATED: trigger style in IE8\n if (element.runtimeStyle) {\n element.runtimeStyle.windows = element.runtimeStyle.windows;\n }\n }\n // otherwise clear stashed element\n else {\n element = null;\n }\n }\n }", "function formSubmitHandler(event){\r\n console.log(\"formSubmitHandler\");\r\n event.preventDefault();\r\n var form = event.target || event.srcElement;\r\n var route = getFormRoute(form);\r\n var method = form.method.toLowerCase();\r\n switch(method){\r\n case \"get\":\r\n location.hash = getHashPath(route);\r\n break;\r\n case \"post\":\r\n case \"put\":\r\n // set cancelHashChange to skip the renderView on hashChange and\r\n // then proccess it manually.\r\n cancelHashChange = true;\r\n location.hash = getHashPath(route);\r\n sessionStorage[\"currentPostParams\"] = JSON.stringify(route.postParams);\r\n setTimeout(function(){\r\n viewRender(route);\r\n cancelHashChange = false;\r\n },0);\r\n case \"path\":\r\n case \"delete\":\r\n case \"option\":\r\n default:\r\n break;\r\n }\r\n return false;\r\n }", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n}", "hashChange(event) {\n\t\t// This support the abort a cicle\n\t\tif (this.engineIsRunning === true) {\n\t\t\tthis.engineIsRunning = false;\n\t\t\treturn;\n\t\t}\n\t\tthis.currentUrl = event ? event.newURL : window.location.href;\n\t\tthis.previousUrl = event ? event.oldURL : window.location.href;\n\t\t// Save the old routes if user abort and need restore it\n\t\tthis.oldRoutesBkp = this.cloneRoutes({source: this.oldRoutes});\n\t\t// Save a copy of currentRoutes as oldRoutes\n\t\tthis.oldRoutes = this.cloneRoutes({source: this.currentRoutes});\n\t\t// Clean current routes\n\t\tthis.currentRoutes = getEmptyRouteObjetc();\n\t\tthis.engine();\n\t}", "function onHashChange() {\n var index = exports.getFrameIndex();\n if (!changedFromWithin) {\n sozi.player.moveToFrame(index);\n }\n changedFromWithin = false;\n }", "function dispatchHash(hash) {\n\n if (!enabled) {\n\n return;\n }\n\n blocked = false;\n\n if (typeof route.leave === 'function') {\n\n blocked = !route.leave.call(route);\n }\n\n if (blocked) {\n\n // Restore previous hash.\n\n window.location.hash = '#' + last;\n\n return;\n\n } else {\n\n // Autoremove leave callback.\n\n route.leave = null;\n }\n\n last = hash;\n\n for (var i = 0; i < routes.length; i++) {\n\n var entry = routes[i];\n\n var match = hash.match(entry.regexp);\n\n if (match) {\n\n entry.cb.apply(null, match.slice(1, match.length));\n\n break;\n }\n }\n}", "function _watchHash() {\n\t\tvar $newHash = _getHash();\n\t\tif (_currentHash != $newHash) {\n\t\t\t_currentHash = $newHash;\n\t\t\t_this.notifyListeners(\"historyChange\", $newHash);\n\t\t}\n\t}" ]
[ "0.71174204", "0.7089558", "0.68358386", "0.6628981", "0.6533835", "0.6524384", "0.64782697", "0.64602304", "0.6450485", "0.64113677", "0.63756573", "0.63756573", "0.63756573", "0.63756573", "0.63756573", "0.6299319", "0.6299319", "0.6299319", "0.62894017", "0.62665874", "0.6234721", "0.61861986", "0.6184877", "0.61637217", "0.6146734", "0.61395985", "0.6134187", "0.611454", "0.61121637", "0.6100336", "0.609128", "0.6049211", "0.6036524", "0.6030428", "0.6025463", "0.5998039", "0.59947795", "0.5991896", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.5976809", "0.59724057", "0.59702533", "0.59384423", "0.5924181" ]
0.60647637
60
Clear the active topic when clicking on the chart background.
function clear() { location.replace("#!"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearSelected() {\n var query = \"#corpus-topics li.selected\";\n if (tenMode) {\n query = \"#corpus-ten-topics li.selected\"\n }\n d3.selectAll(query).each(function(){\n removeTopicFromSelected(this.dataset.topic);\n });\n}", "clearActive() {\n this.handleMenuItemChange(\"active\");\n }", "function clear(){\r\n\tmessages.push({command:\"clearHighlights\"});\r\n\tgetCurrentTabAndSendMessages();\r\n}", "function hideTopics() {\n svg.selectAll('.topic').remove();\n }", "clear() {\n this.active = false\n }", "function clearSlide()\n {\n var ok = confirm(\"Delete notes and board on this slide?\");\n if ( ok )\n {\n activeStroke = null;\n closeWhiteboard();\n\n clearCanvas( drawingCanvas[0].context );\n clearCanvas( drawingCanvas[1].context );\n\n mode = 1;\n var slideData = getSlideData();\n slideData.events = [];\n\n mode = 0;\n var slideData = getSlideData();\n slideData.events = [];\n }\n }", "function clearActive() {\n activeString = '';\n activeNum = undefined;\n displayActive();\n }", "onTopicClick(topic) {\n if (topic.rowid === this.currentTopic) {\n return;\n }\n\n this.currentTopic = topic.rowid;\n localStorage.setItem('currentTopic', this.currentTopic);\n this.loadSelections();\n }", "clearHighlight() {\n this.clearCharts();\n\n let infoSVG = d3.select('#info-svg');\n infoSVG.selectAll(\"text\").remove();\n\n this.updateTable(this.stateDataArray);\n\n }", "clearActiveChat(){\n const tabContents = document.getElementById(\"tabcontents\");\n while (tabContents.firstChild) {\n tabContents.removeChild(tabContents.firstChild);\n }\n }", "function clearTopics(e) {\n //topicList.innerHTML = '';\n\n // Faster\n while(topicList.firstChild) {\n topicList.removeChild(topicList.firstChild);\n }\n\n // Clear from LS\n clearTopicsFromLS();\n}", "function clearSelection() {\n activeSheet.clearSelectedMarksAsync();\n }", "function clearbtns() {\n topics = [];\n $(\"#gif-btns\").empty();\n }", "function clear()\n\t\t\t{\n\t\t\t\tctx.clearRect(0,0,canvas.width,canvas.height);\n\t\t\t\ttarget.children().filter('.pieLabel, .pieLabelBackground').remove();\n\t\t\t}", "function clear() {\r\n d3.select(\"#timelapse-chart\").remove();\r\n d3.select(\"#pause-button\").node().innerHTML = \"Pausar\";\r\n d3.select(\"#filters-div-container\").attr(\"class\", \"hidden\");\r\n}", "clearHighlight() {\n\n //TODO - your code goes here -\n }", "removeActiveMsgClick() {\n this.activeMsg = -1;\n }", "ClearChartElementHighlight() {\n this.chartElement.style.opacity = 1;\n }", "function clear() {\r\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\r\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\r\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function clear() {\n\t\t\t\tctx.clearRect(0, 0, canvasWidth, canvasHeight);\n\t\t\t\ttarget.children().filter(\".pieLabel, .pieLabelBackground\").remove();\n\t\t\t}", "function unselectPreviousFeaturesPointClick() {\n var i;\n for(i=0; i< selectedFeatures.length; i++) {\n selectedFeatures[i].setStyle(null);\n }\n selectedFeatures = [];\n\n }", "function clearAllHighlighted() {\n var canvas = document.getElementById('highlight');\n var context = canvas.getContext('2d');\n \n context.clearRect(0, 0, canvas.width, canvas.height);\n // Move the highlight canvas its original z-position (0)\n document.getElementById('highlight').style.zIndex = \"0\";\n}", "function clearCanvas(event) {\n Array.prototype.forEach.call(canvasCells, function (cell) {\n cell.style.backgroundColor = \"#FFFFFF\";\n });\n}", "function clearCanvas() {\n active = false;\n while(canvas.firstChild) { \n canvas.removeChild(canvas.firstChild); \n } \n}", "function clickedClear() {\n clear();\n panel.textContent = \"0\";\n }", "function displayCarear() {\n leftbar.empty();\n SubBtnGenerator(carearTopics);\n}", "function bgClicked(e) {\n setNewSource(null);\n setTempLine(null);\n setMouseListenerOn(false);\n }", "clearChosenOne() {\n this.main.innerHTML = \"\"\n this.bg.style.backgroundImage = \"\"\n }", "clearActiveSection() {\n if (this.activeSection) {\n this.activeSection.classList.remove(A11yClassNames.ACTIVE);\n this.activeSection.dispatchEvent(new Event(A11yCustomEventTypes.DEACTIVATE));\n this.activeSection.removeEventListener(A11yCustomEventTypes.UPDATE, this.handleActiveSectionUpdate);\n this.activeSection = null;\n }\n this.clearActiveElement();\n }", "function updateActiveTopic(topic) {\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.select(\"#g-topic\").text((topic.count > maxMentions ? \"A sampling of \" : topic.count || \"No\") + \" mentions of \" + topic.name + \".\");\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.select(\"#g-topic\").text(\"Lucastimmons tweets\");\n }\n}", "function resetCategories() \n{\n\tvar div = document.getElementById(\"categoryContainer\");\n\tdocument.getElementById(\"categoryTitle\").innerHTML = firebase.database().ref(strPath).parent.key;\n\tstrPath = strPath.substring(0, strPath.length - (firebase.database().ref(strPath).key.length) - 1); // Removes the last known subtopic from location string \n\n\tclearButtons(div);\n\tsetCategories(strPath);\n\tconsole.log(firebase.database().ref(strPath).key);\n\tif (firebase.database().ref(strPath).key == \"Categories\") \n\t{\n\t\tdocument.getElementById(\"backBtn\").setAttribute(\"disabled\", \"disabled\");\n\t};\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "clear() {\n this.Canvas.getLayerByName('menu').clear();\n }", "clear() {\n this.Canvas.getLayerByName('menu').clear();\n }", "function clearMap() {\n\t\n\t// Junk data \n\tdata = google.visualization.arrayToDataTable([\n\t\t['Place', 'Searches'],\n\t\t['', 0]\n\t]);\n\t\n\t// Remove the selected topic on the right sidebar\n\t$(\".topItem\").removeClass('active');\n\t\n\t// Remove the current query\n\tcurrentQ = '';\n\t\n\t// Redraw the now empty chart\n\tchart.draw(data, defaultOptions);\n}", "function clearActive() {\n\t Array.prototype.slice.call(document.querySelectorAll('.part')).forEach(function (jobDetail) {\n\t if (jobDetail.classList.contains('active')) {\n\t jobDetail.classList.remove('active');\n\t }\n\t });\n\t }", "function erase() {\n subsetOff();\n setxOff();\n document.getElementById(\"legend\").setAttribute(\"style\", \"display:none\");\n \n lefttab='tab1';\n tabLeft('tab1');\n \n jQuery.fn.d3Click = function () {\n this.children().each(function (i, e) {\n var mycol = d3.rgb(this.style.backgroundColor);\n if(mycol.toString()===varColor.toString()) {return;}\n var evt = document.createEvent(\"MouseEvents\");\n evt.initMouseEvent(\"click\", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);\n \n e.dispatchEvent(evt);\n });\n };\n $(\"#tab1\").d3Click();\n}", "collapse() {\n this._sideBar.currentTitle = null;\n }", "function ClearMessagePane() {}", "Clear( a_changed )\n {\n this.changed = false;\n this.indicator.style.backgroundColor = this.defaultBG;\n }", "clearSelection(){\n this.selected = null\n }", "clear(event) {\n var client = event.data.client\n $(\".\" + client.selectedClass).attr(\"style\", \"\");\n $(\".\" + client.selectedClass).removeClass(client.selectedClass);\n client.items.selected = Array();\n client.resetCounters()\n }", "function clear(chart) {\n\t\tvar ctx = chart.zoom.newLayer.getContext('2d');\n\t\tctx.clearRect(0, 0, chart.zoom.newLayer.width, chart.zoom.newLayer.height);\n\t}", "function clearCanvas() {\n drawBackground();\n}", "function click(d) {\n location.replace(\"#\" + encodeURIComponent(d === activeTopic ? \"!\" : d.name));\n d3.event.preventDefault();\n }", "clearDensityPlot () {\n // Clear density plot\n const canvas = this.axisElements['plot-density'].node()\n const context = canvas.getContext('2d')\n context.clearRect(0, 0, canvas.width, canvas.height)\n }", "function clearSelection(){\n pieceSelected = false;\n selectedPieceArray = [];\n}", "clearSelection() {\n this.currentlySelected = '';\n }", "clearToolbar() {\n if (super.clearToolbar) super.clearToolbar();\n this.clickableElements = {};\n }", "function clearCanvas() {\n pureweb.getClient().queueCommand(\"Clear\");\n}", "function clearTopicList() {\r\n// alert('entro en clear');\r\n// var select = document.getElementById(\"wlidpersona_turnar\");\r\n while (wlselect.length > 0) {\r\n wlselect.remove(0);\r\n }\r\n}", "function click(d) {\n location.replace(\"#\" + encodeURIComponent(d === activeTopic ? \"!\" : d.name));\n d3.event.preventDefault();\n}", "clearHighlight() {\n // ++++++++ BEGIN CUT +++++++++++\n d3.select('#country-detail').style('opacity', 0);\n // ++++++++ END CUT +++++++++++\n }", "clear(){\n this.clearHolder.addEventListener(\"click\", ()=>{\n this.createCanvas();\n document.querySelectorAll(\".tempPaint\").forEach(x=>x.remove())\n }) \n }", "reset() {\r\n this.active = 'normal';\r\n }" ]
[ "0.68818283", "0.64014804", "0.6398615", "0.6365971", "0.6179527", "0.6082558", "0.5980829", "0.59794503", "0.59765404", "0.597275", "0.59491104", "0.59434015", "0.5904077", "0.5872475", "0.58408123", "0.58096766", "0.58014303", "0.57997775", "0.57924306", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.5758625", "0.574566", "0.5742977", "0.5729665", "0.5729205", "0.5728216", "0.57177055", "0.57164115", "0.56939185", "0.56931", "0.5686365", "0.56793636", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.56784487", "0.5654292", "0.5654292", "0.5641183", "0.56262946", "0.5621708", "0.56207067", "0.5612108", "0.5597878", "0.5596188", "0.55900615", "0.5584227", "0.55823654", "0.55638874", "0.5559938", "0.55476546", "0.5545265", "0.5544769", "0.55403596", "0.55400544", "0.55278355", "0.5520081", "0.55132574", "0.55124664" ]
0.0
-1
Rather than flood the browser history, use location.replace.
function click(d) { location.replace("#" + encodeURIComponent(d === activeTopic ? "!" : d.name)); // PFS: 12/05/2015 parent.resizeIframeByHeight(parent.document.getElementsByName('iframe_a')[0],document.getElementById('interactiveABC').scrollHeight); d3.event.preventDefault(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function replaceURL(url){window.location.replace=url}", "function o(e){window.history.replaceState(null,\"\",r.state.url),window.location.replace(e)}", "function locationReplace(url) {\n window.history.replaceState(null, \"\", \"#\")\n window.location.replace(url)\n}", "function locationReplace(url) {\n window.history.replaceState(null, \"\", \"#\")\n window.location.replace(url)\n}", "function locationReplace(url) {\n window.history.replaceState(null, \"\", \"#\")\n window.location.replace(url)\n}", "function locationReplace(url) {\n window.history.replaceState(null, \"\", \"#\")\n window.location.replace(url)\n}", "function locationReplace(url) {\n window.history.replaceState(null, \"\", pjax.state.url)\n window.location.replace(url)\n }", "function locationReplace(url) {\n window.history.replaceState(null, \"\", pjax.state.url)\n window.location.replace(url)\n}", "function locationReplace(url) {\n window.history.replaceState(null, \"\", pjax.state.url)\n window.location.replace(url)\n}", "function locationReplace(url) {\n window.history.replaceState(null, \"\", pjax.state.url)\n window.location.replace(url)\n}", "function locationReplace(url) {\n window.history.replaceState(null, \"\", pjax.state.url);\n window.location.replace(url);\n }", "function back_beranda(url) {\n window.location.replace(url);\n}", "function redirect(url) {\n window.location.replace(url); \n}", "function replace_or_redraw( new_URL )\n{\n//var oBase = document.all.tags('base');\n//if (oBase && oBase.target) oBase.target = _self;\nif( navigator.appVersion.charAt( 0 ) < '3' )\n\tlocation = new_URL;\nelse\n\tlocation.replace( new_URL );\nreturn false;\n}", "function redirect (url) {\n window.location.replace(url);\n}", "function updatePageUrl() {\n var path = '/' + site.document.id;\n if (window.location.pathname !== path) {\n if (history) history.replaceState(null, null, path);\n else window.location.replace(path);\n }\n}", "function volver(){ javascript:history.go(-1); }", "function Redirect(url) {\n window.location.replace(url)\n}", "function loadUrl(newLocation){\n\twindow.location = newLocation;\n\treturn false;\n}", "function przekierujDo(path){\n if(window.location.pathname !== path) window.location.replace(path);\n}", "function revertToOriginalURL() {\n var original = window.location.href.substr(0, window.location.href.indexOf('#'))\n history.replaceState({}, document.title, original);\n }", "function goHome(){\n window.location.replace('/')\n}", "function refresh() {\n // do not use window.location.reload() because it may cause redundant POST request\n // do not use direct assigning to window.location.href\n // because each reload will be stored in browsing history\n // do not use window.location.href as a source, because it may contain garbage\n window.location.replace($('.inner-navbar__menu-center > a.pushed').attr('href'));\n }", "function tryAgain() {\n location.replace(\"index.html\");\n}", "function RedirectToIndex() {\n window.location.replace(\"/\");\n}", "function loadUrl(newLocation)\n {\n window.location = newLocation;\n return false;\n }", "function newGame() {\n var oldLocation = location.href;\n var newLocation = oldLocation.split(\"#\")[0];\n console.log(newLocation);\n location.replace(newLocation);\n console.log(location);\n}", "function redirect(location) { window.location.href = location;}", "function goBack() {\r\n window.location = '/';\r\n}", "function legacyRedirect() {\n let indexOf = window.location.href.indexOf('#');\n if (indexOf === -1) indexOf = window.location.href.indexOf('=');\n if (indexOf === -1 || indexOf === window.location.href.length - 1) return;\n if (window.location.href[indexOf + 1] === '*') return;\n\n const redirect = window.location.origin + '/'\n + window.location.href.substring(indexOf + 1) + '.htm';\n\n location.replace(redirect);\n}", "function reload() {\r\n\r\n\twindow.top.document.location.replace(window.top.document.location.href);\r\n\r\n}", "function gobacktohome(){\n location.reload();\n}", "function clear() {\n location.replace(\"#!\");\n }", "function homeredirect(){\n\n var xhttp = new XMLHttpRequest();\n xhttp.open(\"GET\", \"/\", true);\n xhttp.send();\n\n xhttp.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n window.location.replace(\"/\");\n }\n };\n}", "function navigate(url){\r\n history.pushState(null, null, url);\r\n handleNavigation();\r\n}", "function setLocation(url){\n window.location.href = url;\n}", "function navigateTo(url) {\n window.location = url;\n }", "_update() {\n window.location.pathname = this._current().url;\n }", "function redirect(url){\n //window.location.href(url);\n window.location.href = url;\n}", "function navToHistory() {\r\n location = \"history.html\"\r\n}", "handleRefresh() {\n window.location = window.location.pathname;\n }", "function\tForward(url)\n{\n\twindow.location.href = url;\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function clear() {\n location.replace(\"#!\");\n}", "function refresh_page() {\n window.location = '/home/index';\n}", "function handleBrowserBack() {\n console.log('Refreshing the page to re-read URL parameters.');\n location.reload();\n}", "function redirectToBack(){\n\t\thistory.go(-1);\n\t}", "shift(url, addToHistory) {\n if (addToHistory) window.history.pushState(null, null, `/${this.clearSlashes(url)}`);\n else window.history.replaceState(null, null, `/${this.clearSlashes(url)}`);\n this.current = `${this.clearSlashes(url)}`;\n }", "function forwardTo(location) {\n browserHistory.push(location);\n}", "function refreshPage() {\n history.push('/');\n window.location.reload();\n }", "function goBack(){\n window.location.replace(\"./index.html\");\n}", "function redirect(url){\r\n window.location.href= url;\r\n}", "function changeHashTo(location){\n if(window.location.href.indexOf(\"view\") || (window.location.href.indexOf(\"browse\"))){\n window.location.href = base_url+location;\n }else {\n window.location.hash = location;\n }\n }", "function goBackToStart() {\n location.reload();\n}", "function landing_page(){\n window.location.replace('./prototype.html');\n}", "function trx_addons_document_set_location(curLoc){\n \"use strict\";\n if (history.pushState===undefined || navigator.userAgent.match(/MSIE\\s[6-9]/i) != null) return;\n try {\n history.pushState(null, null, curLoc);\n return;\n } catch(e) {}\n location.href = curLoc;\n}", "function redirect(url) {\r\n url = url || 'index.html';\r\n location.href = url;\r\n }", "function redirectByUrl() {\n location.href = u;\n }", "fallback() {\n document.location = this.url;\n }", "fallback() {\n document.location = this.url;\n }", "function change(){\n window.location.href = (\"index.html\");\n\n}", "function setUrl(url) {\n\t\twindow.location = url; }", "navigate(path, {replace = false} = {}) {\n if (window.location.pathname != path) {\n if (replace) {\n this.options.context.history.replaceState(null, document.title, path);\n } else {\n //add entry to browser's session history stack (will set the location's hash)\n this.options.context.history.pushState(null, document.title, path);\n }\n this.match(path);\n }\n }", "navigate(path, {replace = false} = {}) {\n if (window.location.pathname != path) {\n if (replace) {\n this.options.context.history.replaceState(null, document.title, path);\n } else {\n //add entry to browser's session history stack (will set the location's hash)\n this.options.context.history.pushState(null, document.title, path);\n }\n this.match(path);\n }\n }", "function mForward (strURL) {\r\n\twindow.location.href = strURL;\r\n}", "function update_url_inplace(param, newvalue) {\n var newurl = new URL(window.location);\n var params = new URLSearchParams(newurl.search);\n params.set(param, newvalue);\n\n newurl.search = params.toString();\n var updated = newurl.toString();\n history.replaceState({path: updated}, '', updated);\n}", "function redirect (url) {\n window.location.href = url;\n}", "function notFoundErrorHandler() {\n history.replace(\"/\");\n }", "function inActive() {\n window.location.replace(\"/\");\n}", "function refreshPageIfBad() {\n if (window.location.href.includes('so=su')) {\n window.location.assign(window.location.href.replace('so=su', ''))\n }\n}", "function goPage(url){\n var index=url.indexOf('#');\n if(index==-1){\n url=url+window.location.hash;\n }\n reload(url);\n}", "function redirect(url){\n window.location.href =url;\n}", "function redireccionar() {\n location.reload();\n}" ]
[ "0.82390016", "0.81649625", "0.81170756", "0.81170756", "0.81170756", "0.81170756", "0.7828173", "0.7807103", "0.7807103", "0.7807103", "0.78008497", "0.7715696", "0.73246163", "0.7323378", "0.72504103", "0.7245687", "0.7239423", "0.71795017", "0.7047154", "0.7037156", "0.70259017", "0.70023185", "0.69585073", "0.6912728", "0.68826395", "0.68788105", "0.683241", "0.6765434", "0.67608386", "0.6752612", "0.6731823", "0.671575", "0.6713828", "0.6705423", "0.67049104", "0.6693762", "0.66915643", "0.66898376", "0.66822916", "0.667741", "0.66771233", "0.6676739", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66648537", "0.66506785", "0.66462076", "0.66457796", "0.6643258", "0.6631926", "0.66298664", "0.66184217", "0.6613101", "0.6609899", "0.65925753", "0.65793717", "0.6576523", "0.65745103", "0.65712166", "0.65571606", "0.65571606", "0.6557078", "0.6553434", "0.65480703", "0.65480703", "0.65478164", "0.6546295", "0.6546236", "0.65390766", "0.6534079", "0.6530651", "0.6530212", "0.65267885", "0.6520331" ]
0.0
-1
When hovering the label, highlight the associated node and vice versa. When no topic is active, also crosshighlight with any mentions in excerpts.
function mouseover(d) { node.classed("g-hover", function(p) { return p === d; }); if (!activeTopic) d3.selectAll(".g-mention p").classed("g-hover", function(p) { return p.topic === d; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseover(d) {\n node.classed(\"g-hover\", function(p) {\n return p === d;\n });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) {\n return p.topic === d;\n });\n }", "function highlightLabel(highlight) {\n d3.selectAll('.labels').transition().style('opacity', 0.2)\n .style('font-size', \"9.5px\").style('fill', '#B8CBED');\n\n highlight.forEach(function(d) {\n d3.selectAll('.lab-'+d).transition().style('opacity', 1)\n .style('font-size', \"13px\")\n .style('fill', '#5B6D8F')\n })\n }", "function highlight(props){\n //change stroke\n var selected = d3.selectAll(\".\" + props.name.replace(/ /g, \"_\"))\n .style(\"stroke\", \"black\")\n .style(\"stroke-width\", \"2\");\n\n setLabel(props);\n}", "function highlight(props){\n //change stroke\n var selected = d3.selectAll(\".\" + props.NAME_1)\n .style(\"stroke\", \"#54B6E4\")\n .style(\"stroke-width\", \"2\");\n setLabel(props);\n}", "function highlight(props){\r\n //change stroke\r\n var selected = d3.selectAll(\".\" + props.CODE)\r\n .style(\"stroke\", \"blue\")\r\n .style(\"stroke-width\", \"2\");\r\n setLabel(props);\r\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n}", "function highlight(props){\n //change stroke\n var selected = d3.selectAll(\".\" + props.adm1_code)\n .style(\"stroke\", \"#62030F\")\n .style(\"stroke-width\", \"3\");\n\n setLabel(props);\n } //last line of highlight function", "function labelMouseOver(tag) {\n d3.selectAll('marker#' + tag)\n .select('path')\n .classed('hovered', true);\n\n d3.selectAll('.' + tag)\n .selectAll('path, text')\n .classed('hovered', true);\n }", "function highlight(props){\n //change stroke\n var selected = d3.selectAll(\".\" + props.iso_a3) //or iso_a3?\n .style(\"stroke\", \"blue\")\n .style(\"stroke-width\", \"2\");\n //console.log(\"hello\", \".\" + props.iso_a3);\n // add dynamic label on mouseover\n setLabel(props);\n}", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n }", "function highlight(props){\n var selected = d3.selectAll(\".\" + props.name)\n .style(\"stroke\", \"#FED976\")\n .style(\"stroke-width\", \"2\");\n setLabel(props);\n }", "function node_mouseover(d) {\r\n if (drawing_line && d !== selected_node) {\r\n // highlight and select target node\r\n selected_target_node = d;\r\n }\r\n}", "function highlight(props){\n\n //Ids were stored in different forms on the map\n // and the barchart\n var selectThis;\n if(props.Id2){\n selectThis = \".id\" + props.Id2;\n }else{\n selectThis = \".\" + props[0];\n }\n //change stroke\n var selected = d3.selectAll(selectThis)\n .style({\n \"stroke\": \"black\",\n \"stroke-width\": \"2\"\n });\n\n setLabel(props);\n }", "highlight(on) { }", "highlightLabel(label) {\n // set text to display according to mode\n // debugger\n let text;\n if (this.state.mode === EVALUATION) {\n text = label.student_answer || DEFAULT_EVALUATION_LABEL_MESSAGE;\n } else {\n text = label.text || DEFAULT_LABEL_MESSAGE;\n }\n // set style to label\n this.setLabelStyle(label, { text, worldReferenceSize: this._.meshDiameter,\n style: this._.highlightedLabelStyle });\n }", "function highlight(props){\n var selected=d3.selectAll(\".\"+props.adm0_a3)\n .style({\n \"fill-opacity\":\"1\",\n \"stroke\":\"white\",\n \"stroke-width\":\"2\"\n })\n setLabel(props);\n}", "function highlight(props){\n\t\t//Change stroke\n\t\tlet selected = d3.selectAll(\".\" + props.name)\n\t\t\t.style(\"stroke\", \"blue\")\n\t\t\t.style(\"stroke-width\", \"2\");\n\n\t\tsetLabel(props);\n\t}", "_mouseOverNode(event, d) {\n this._grpBars.each(function (n) { n.highLight = false; });\n this._links.classed(\"CV-linkHL\", function (link) {\n if (link.source === d || link.target === d)\n return link.source.highLight = link.target.highLight = true;\n else\n return false;\n });\n this._grpBars.classed(\"CV-nodeHL\", function (node) { return node.highLight; });\n this._grpBars.append(\"text\")\n .text(\"\")\n .classed(\"CV-names\", true); // For showing names on mouseover\n let index = _findMaxValue(this._vRings);\n let x = this._ringScale(this._vRings[this._vRings.length - 1].pX) + this._vRings[index].barCircleScale(this._vRings[index].maxValue);\n this._grpBars.selectAll(\"text.CV-names\")\n .attr(\"x\", x)\n .attr(\"y\", 0)\n .attr(\"text-anchor\", \"start\")\n .text(function (n) {\n if (n.highLight === true) {\n if (_isTheFirstOccurence(n.id, d.cluster)) {\n d.cluster.push(n);\n }\n // let names = n.labels[0].split(\",\");\n let names = n.labels[1];\n // if (names.length === 1) {\n // names = n.labels[0].split(\".\");\n // if (names.length === 2) {\n // return names[1];\n // } else {\n // return names[2];\n // }\n // }\n return names;\n }\n return \"\";\n })\n .style(\"font-size\", \"10px\")\n .style(\"font-family\", \"Arial\")\n .style(\"color\", \"black\");\n function _isTheFirstOccurence(id, tab) {\n if (tab.length === 0)\n return true;\n else {\n for (let i = 0; i < tab.length; i++) {\n if (tab[i].id === id)\n return false;\n }\n return true;\n }\n }\n function _findMaxValue(_vRings) {\n let i, max = 0;\n for (i = 0; i < _vRings.length; i++) {\n if (_vRings[i].maxValue > max)\n max = i;\n }\n return max;\n }\n }", "function highlightNode(nodeId) {\n var node = myDiagram.findNodeForKey(nodeId++);\n // console.log(node);\n if (node !== null) {\n // make sure the selected node is in the viewport\n myDiagram.scrollToRect(node.actualBounds);\n // move the large yellow node behind the selected node to highlight it\n highlighter.location = new go.Point(\n node.location.x + 40,\n node.location.y + 40\n );\n // console.log(node.location)\n // console.log(highlighter.location)\n }\n}", "function highlightNode(d) {\r\n if (d3.event.defaultPrevented) return;\r\n // set new currently selected node\r\n tempCurrentNode = d.id;\r\n var tempNode = tempNodes_lookup[d.id];\r\n // if node is already in a conflict\r\n if (tempNode.conflicting) {\r\n kbNavigatorModals.showConflict(tempNode);\r\n return;\r\n }\r\n // if node is selected already\r\n if (tempNode.highlighted) {\r\n // untoggle node\r\n deselectDecisionOutcome(tempNode);\r\n } else {\r\n // if node is not selected check if outcome is excluded\r\n if (tempNode.excluded === false) {\r\n // if not excluded check if decision is selected\r\n if (tempNode.selectable) {\r\n // decision is not specified and outcome is not exlcuded\r\n // thus highlightin is easily possible\r\n selectDecisionOutcome(tempNode);\r\n } else {\r\n // decision is already selected ask if this outcome should\r\n // be chosen instead\r\n // may either select outcome or remain in before state\r\n kbNavigatorModals.changeOutcomeWihtinDecision(tempNode);\r\n }\r\n } else if (tempNode.excluded === true && tempNode.selectable === true) {\r\n // node is ecluded but decision has not been specified\r\n // ask with modal if outcome should be selected and outcome that\r\n // exclude it should be deselected\r\n kbNavigatorModals.forceExcludedOutcome(tempNode, true);\r\n } else if (tempNode.excluded === true && tempNode.selectable === false) {\r\n // node is excluded and decision is selected thus different\r\n // modal is used (boolean value)\r\n kbNavigatorModals.forceExcludedOutcome(tempNode, false);\r\n }\r\n }\r\n }", "function handleMouseOverText(e) {\n\t\t\t\te.currentTarget.addClassName('active');\n\t\t\t\tvar parent = $(e.currentTarget).parent().get(0);\n\n\t\t\t\ttheInterface.emit('ui:emphElement', {\n\t\t\t\t\tid : e.currentTarget.getAttribute('id'),\n\t\t\t\t\tlayer : parent.getAttribute('data-layer')\n\t\t\t\t});\n\t\t\t}", "function mouseOverFunction() {\n // Highlight circle\n var circle = d3.select(this);\n circle\n .style(\"fill\", \"#B3F29D\")\n .style(\"fill-opacity\", 0.5);\n\n // Find links which have circle as source and highlight\n svg.selectAll(\".link\")\n .filter(function(d) {\n return d.source.name === circle[0][0].__data__.name;\n })\n .style(\"stroke\", \"#B3F29D\");\n\n // Find labels which have circle as source and highlight\n svg.selectAll(\".label\")\n .filter(function(d) {\n if (d.name) {\n return d.name === circle[0][0].__data__.name;\n } else {\n return d.source.name === circle[0][0].__data__.name;\n }\n })\n .style(\"fill\",\"#B3F29D\");\n }", "function mouseover(d) {\n\n d3.select(\"#selected-name\")\n .text(d.data.name);\n\n d3.select(\"#explanation\")\n .style(\"visibility\", \"\");\n\n var sequenceArray = d.ancestors().reverse();\n sequenceArray.shift(); // remove root node from the array\n\n // Fade all the segments.\n d3.selectAll(\"path\")\n .style(\"opacity\", 0.3);\n\n // Then highlight only those that are an ancestor of the current segment.\n vis.selectAll(\"path\")\n .filter(function (node) {\n return (sequenceArray.indexOf(node) >= 0);\n })\n .style(\"opacity\", 1);\n}", "function mouseover(d) {\n const percentageString = `${d.value}`;\n const textForClosed = ' of them have been ';\n const textForOpen = ' of them are still ';\n\n const percentageStr = ' issues have been created by ';\n\n switch (d.name) {\n case 'open':\n d3.select('#percentage')\n .text(d.value);\n d3.select('#info-text-nbIssues')\n .text(textForOpen)\n .style('font-size', '1em');\n d3.select('#info-text-info-repo')\n .text(`${d.name}ed`);\n break;\n case 'closed':\n d3.select('#percentage')\n .text(d.value);\n d3.select('#info-text-nbIssues')\n .text(textForClosed)\n .style('font-size', '1em');\n d3.select('#info-text-info-repo')\n .text(d.name);\n break;\n default:\n d3.select('#percentage')\n .text(percentageString);\n d3.select('#info-text-nbIssues')\n .text(percentageStr)\n .style('font-size', '1em');\n d3.select('#info-text-info-repo')\n .text(`${d.name}.`);\n }\n\n d3.select('#explanation')\n .style('top', '240px');\n\n const sequenceArray = getAncestors(d);\n updateBreadcrumbs(sequenceArray, percentageString);\n\n // Fade all the segments.\n d3.selectAll('path')\n .style('opacity', 0.3);\n\n // Then highlight only those that are an ancestor of the current segment.\n vis.selectAll('path')\n .filter(node => (sequenceArray.indexOf(node) >= 0))\n .style('opacity', 1);\n}", "function highlightSingleNode(node) {\n d3.select('#type' + node.type + '-group' + node.id)\n .transition()\n .style('opacity', DEFAULT_NODE_EDGE_OPACITY);\n }", "function highlightTimeline(t_cy){\n t_cy.edges().forEach(function(target){\n var etopic = target.data('topic')[0];\n if(!(Object.keys(allTopics).includes(etopic))){\n allTopics[etopic] = cidx;\n cidx = (cidx + 3)%19;\n }\n var color = colorShade[allTopics[etopic]];\n target.style('line-color', color);\n target.style('target-arrow-color', color);\n });\n }", "function _labelHoverEnter() {\r\n\tvar menuItem = Utils.getObjForId(this);\t// this.view ;\r\n\tif( !menuItem || !menuItem.isSelectable() || !menuItem.isEnabled() ) return;\r\n\r\n\tmenuItem.fTopRowOuter.style.background = LookAndFeel.url(\"highlight.png\") + ' repeat';\r\n\tmenuItem.fTopRow.style.background = LookAndFeel.url(\"highlight_tr.png\") + ' no-repeat top right';\r\n\tmenuItem.fTopRowImage.style.display = \"block\";\r\n\r\n\tmenuItem.fBotRowOuter.style.background = LookAndFeel.url(\"highlight.png\") + ' repeat';\r\n\tmenuItem.fBotRow.style.background = LookAndFeel.url(\"highlight_br.png\") + ' no-repeat top right';\r\n\tmenuItem.fBotRowImage.style.display = \"block\";\r\n\r\n\tmenuItem.fMidRowOuter.style.background = LookAndFeel.url(\"highlight.png\") + ' repeat';\r\n\tmenuItem.fMidRow.style.background = LookAndFeel.url(\"highlight.png\") + ' repeat';\r\n\t// setting row content a must for IE\r\n\tif( menuItem.fMidRowContent.style )\r\n\t menuItem.fMidRowContent.style.background = LookAndFeel.url(\"highlight.png\") + ' repeat';\r\n\tmenuItem.fMidRowOuter.style.color = \"#EEEEEE\";\r\n\tif( menuItem.fSelectListener && menuItem.fSelectListener.onItemHover )\r\n\t menuItem.fSelectListener.onItemHover(menuItem, menuItem.fSelectListener);\r\n }", "function highlightGraphNode( node, on )\n {\n //if( d3.event.shiftKey ) on = false; // for debugging\n\n // If we are to activate a movie, and there's already one active,\n // first switch that one off\n if( on && activeMovie !== undefined ) {\n \t highlightGraphNode( nodeArray[activeMovie], false );\n }\n\n // locate the SVG nodes: circle & label group\n circle = d3.select( '#c' + node.index );\n label = d3.select( '#l' + node.index );\n\n // activate/deactivate the node itself\n circle\n\t.classed( 'main', on );\n label\n\t.classed( 'on', on || currentZoom >= SHOW_THRESHOLD );\n label.selectAll('text')\n\t.classed( 'main', on );\n\n // activate all siblings\n Object(node.links).forEach( function(id) {\n\td3.select(\"#c\"+id).classed( 'sibling', on );\n\tlabel = d3.select('#l'+id);\n\tlabel.classed( 'on', on || currentZoom >= SHOW_THRESHOLD );\n\tlabel.selectAll('text.nlabel')\n\t .classed( 'sibling', on );\n } );\n\n // set the value for the current active movie\n activeMovie = on ? node.index : undefined;\n }", "function node_mouseover(d) {\n d3.select(this).transition()\n .duration(150)\n .attr(\"r\", 10);\n if (drawing_line && d !== selected_node) {\n // highlight and select target node\n selected_target_node = d;\n }\n}", "function mouseovered(d) \n\t{\n\t\t// Handle tooltip\n\t\t// Tooltips should avoid crossing into the center circle\n\t\td3.selectAll(\"#tooltip\").remove();\n\t\td3.selectAll(\"#vis\")\n\t\t\t.append(\"xhtml:div\")\n\t\t\t.attr(\"id\", \"tooltip\")\n\t\t\t.style(\"opacity\", 0)\n\t\t\t.html(d.title);\n\t\tvar mouseloc = d3.mouse(d3.select(\"#vis\")[0][0]),\n\t\t\tmy = ((rotateit(d.x) > 90) && (rotateit(d.x) < 270)) ? mouseloc[1] + 10 : mouseloc[1] - 35,\n\t\t\tmx = (rotateit(d.x) < 180) ? (mouseloc[0] + 10) : Math.max(130, (mouseloc[0] - 10 - document.getElementById(\"tooltip\").offsetWidth));\n\t\tconsole.log(mx);\n\t\td3.selectAll(\"#tooltip\").style({\"top\" : my + \"px\", \"left\": mx + \"px\"});\n\t\td3.selectAll(\"#tooltip\")\n\t\t\t.transition()\n\t\t\t.duration(500)\n\t\t\t.style(\"opacity\", 1);\n\t\t\t\t\n\t\tnode.each(function(n) { n.target = n.source = false; });\n\t\t\n\t\tcurrnode = d3.select(this)[0][0].__data__;\n\t\t\n\t\tlink.classed(\"link--target\", function(l) { \n\t\t\t\tif (l.target === d) \n\t\t\t\t{ \n\t\t\t\t\treturn l.source.source = true; \n\t\t\t\t}\n\t\t\t\tif (l.source === d) \n\t\t\t\t{ \n\t\t\t\t\treturn l.target.target = true; \n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter(function(l) { return l.target === d || l.source === d; })\n\t\t\t.attr(\"stroke\", function(d){\n\t\t\t\tif (d[0].name == currnode.name)\n\t\t\t\t{\n\t\t\t\t\treturn color(d[2].cat);\n\t\t\t\t}\n\t\t\t\treturn color(d[0].cat);\n\t\t\t})\n\t\t\t.each(function() { this.parentNode.appendChild(this); });\n\t\t\n\t\td3.selectAll(\".link--clicked\").each(function() { this.parentNode.appendChild(this); });\n\t\t\n\t\tnode.classed(\"node--target\", function(n) { \n\t\t\treturn (n.target || n.source); \n\t\t});\n\t}", "function onEmphasis(){labelLine.ignore = labelLine.hoverIgnore;text.ignore = text.hoverIgnore;}", "function nodeMouseover(d) {\n svg.selectAll(\"g path\").classed(\"active\", function(p) {\n return p.source === d || p.target === d;\n });\n d3.select(this).classed(\"active\", true);\n }", "function handleHighlight(node, nodes, state, isHighlighted) {\n // Get related key\n let column = '';\n nodeByKey.forEach((key, value) => {\n if (key.name === node.name) {\n const value1 = value.slice(value.indexOf('[') + 2);\n column = value1.slice(0, value.indexOf(',') - 3);\n }\n });\n const position = keys.findIndex(key => key.id === column);\n\n // Highlight related nodes\n d3.selectAll('.node').classed('faded', isHighlighted);\n // d3.selectAll('.node-label').classed('faded', isHighlighted);\n d3.select(`.node-${node.index}`).classed(state, isHighlighted).classed('faded', false);\n // d3.select(`.node-label-${node.index}`).classed(state, isHighlighted).classed('faded', false);\n const relatedNodes = [];\n data.forEach(datum => {\n if (datum[column].includes(node.name)) {\n keys.forEach((key, i) => {\n // Get related nodes\n if (i !== position) {\n datum[key.id].forEach(item => {\n if (!relatedNodes.includes(item)) {\n const index = nodes.find(n => n.name === item).index;\n relatedNodes.push({ column: key.id, node_name: item, index: index });\n d3.select(`.node-${index}`).classed(state, isHighlighted).classed('faded', false);\n // d3.select(`.node-label-${index}`).classed(state, isHighlighted).classed('faded', false);\n }\n });\n } else {\n relatedNodes.push({ column: key.id, node_name: node.name, index: nodes.find(n => n.name === node.name).index });\n }\n });\n }\n });\n\n // Get related links\n d3.selectAll('.link').classed('faded', isHighlighted);\n keys.forEach((key, i) => {\n if (i < (keys.length - 1)) {\n const leftNodes = relatedNodes.filter(node => node.column === key.id);\n const rightNodes = relatedNodes.filter(node => node.column === keys[i + 1].id);\n leftNodes.forEach(ln => {\n rightNodes.forEach(rn => {\n d3.select(`.link-${ln.index}-to-${rn.index}`).classed(state, isHighlighted).classed('faded', false);\n });\n });\n }\n });\n\n // Highlight related liveProjects\n d3.selectAll('.live-project-toggle-wrapper').classed('faded', d => {\n if (isHighlighted && d3.select(`.node-title.node-${d.index}`).classed('faded')) {\n return true;\n } else {\n return false;\n }\n });\n}", "function beginHover(e) {\n e.target.classList.add('editor-highlight');\n}", "function node_mouseover(d) {\n d3.select(this).transition()\n .duration(150)\n .attr(\"r\", 10);\n //update the target node\n if (drawing_line && d !== selected_node) {\n // highlight and select target node\n selected_target_node = d;\n }\n}", "function drawHoveredNode(node) {\n drawNodes(ctx_hover, node_by_id[node.id], node.r, 1); //Also highlight the hovered node label (if it exists)\n\n renderNodeLabels(ctx_hover, [node_by_id[node.id]], 1);\n } //function drawHoveredNode", "function drawHoveredNode(node) {\n drawNodes(ctx_hover, node_by_id[node.id], node.r, 1); //Also highlight the hovered node label (if it exists)\n\n renderNodeLabels(ctx_hover, [node_by_id[node.id]], 1);\n } //function drawHoveredNode", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}" ]
[ "0.67012674", "0.64878684", "0.63921267", "0.6354405", "0.62633663", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62537956", "0.6189708", "0.6184352", "0.61283886", "0.61276996", "0.60864496", "0.6049012", "0.60483265", "0.6046043", "0.6028877", "0.6013981", "0.59830004", "0.5936692", "0.5934398", "0.59340054", "0.59085554", "0.58877635", "0.58820426", "0.58780444", "0.5871733", "0.58681685", "0.5867215", "0.5852278", "0.5820453", "0.5818088", "0.5784919", "0.57534283", "0.5746518", "0.57393605", "0.57308555", "0.57308555", "0.5727432", "0.5727432", "0.5727432", "0.5727432", "0.5727432", "0.5727432", "0.5727432" ]
0.6869039
28
When hovering the label, highlight the associated node and vice versa. When no topic is active, also crosshighlight with any mentions in excerpts.
function mouseout(d) { node.classed("g-hover", false); if (!activeTopic) d3.selectAll(".g-mention p").classed("g-hover", false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) {\n return p === d;\n });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) {\n return p.topic === d;\n });\n }", "function highlightLabel(highlight) {\n d3.selectAll('.labels').transition().style('opacity', 0.2)\n .style('font-size', \"9.5px\").style('fill', '#B8CBED');\n\n highlight.forEach(function(d) {\n d3.selectAll('.lab-'+d).transition().style('opacity', 1)\n .style('font-size', \"13px\")\n .style('fill', '#5B6D8F')\n })\n }", "function highlight(props){\n //change stroke\n var selected = d3.selectAll(\".\" + props.name.replace(/ /g, \"_\"))\n .style(\"stroke\", \"black\")\n .style(\"stroke-width\", \"2\");\n\n setLabel(props);\n}", "function highlight(props){\n //change stroke\n var selected = d3.selectAll(\".\" + props.NAME_1)\n .style(\"stroke\", \"#54B6E4\")\n .style(\"stroke-width\", \"2\");\n setLabel(props);\n}", "function highlight(props){\r\n //change stroke\r\n var selected = d3.selectAll(\".\" + props.CODE)\r\n .style(\"stroke\", \"blue\")\r\n .style(\"stroke-width\", \"2\");\r\n setLabel(props);\r\n}", "function highlight(props){\n //change stroke\n var selected = d3.selectAll(\".\" + props.adm1_code)\n .style(\"stroke\", \"#62030F\")\n .style(\"stroke-width\", \"3\");\n\n setLabel(props);\n } //last line of highlight function", "function labelMouseOver(tag) {\n d3.selectAll('marker#' + tag)\n .select('path')\n .classed('hovered', true);\n\n d3.selectAll('.' + tag)\n .selectAll('path, text')\n .classed('hovered', true);\n }", "function highlight(props){\n //change stroke\n var selected = d3.selectAll(\".\" + props.iso_a3) //or iso_a3?\n .style(\"stroke\", \"blue\")\n .style(\"stroke-width\", \"2\");\n //console.log(\"hello\", \".\" + props.iso_a3);\n // add dynamic label on mouseover\n setLabel(props);\n}", "function highlight(props){\n var selected = d3.selectAll(\".\" + props.name)\n .style(\"stroke\", \"#FED976\")\n .style(\"stroke-width\", \"2\");\n setLabel(props);\n }", "function mouseout(d) {\n node.classed(\"g-hover\", false);\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", false);\n }", "function node_mouseover(d) {\r\n if (drawing_line && d !== selected_node) {\r\n // highlight and select target node\r\n selected_target_node = d;\r\n }\r\n}", "function highlight(props){\n\n //Ids were stored in different forms on the map\n // and the barchart\n var selectThis;\n if(props.Id2){\n selectThis = \".id\" + props.Id2;\n }else{\n selectThis = \".\" + props[0];\n }\n //change stroke\n var selected = d3.selectAll(selectThis)\n .style({\n \"stroke\": \"black\",\n \"stroke-width\": \"2\"\n });\n\n setLabel(props);\n }", "highlightLabel(label) {\n // set text to display according to mode\n // debugger\n let text;\n if (this.state.mode === EVALUATION) {\n text = label.student_answer || DEFAULT_EVALUATION_LABEL_MESSAGE;\n } else {\n text = label.text || DEFAULT_LABEL_MESSAGE;\n }\n // set style to label\n this.setLabelStyle(label, { text, worldReferenceSize: this._.meshDiameter,\n style: this._.highlightedLabelStyle });\n }", "highlight(on) { }", "function highlight(props){\n var selected=d3.selectAll(\".\"+props.adm0_a3)\n .style({\n \"fill-opacity\":\"1\",\n \"stroke\":\"white\",\n \"stroke-width\":\"2\"\n })\n setLabel(props);\n}", "function highlight(props){\n\t\t//Change stroke\n\t\tlet selected = d3.selectAll(\".\" + props.name)\n\t\t\t.style(\"stroke\", \"blue\")\n\t\t\t.style(\"stroke-width\", \"2\");\n\n\t\tsetLabel(props);\n\t}", "_mouseOverNode(event, d) {\n this._grpBars.each(function (n) { n.highLight = false; });\n this._links.classed(\"CV-linkHL\", function (link) {\n if (link.source === d || link.target === d)\n return link.source.highLight = link.target.highLight = true;\n else\n return false;\n });\n this._grpBars.classed(\"CV-nodeHL\", function (node) { return node.highLight; });\n this._grpBars.append(\"text\")\n .text(\"\")\n .classed(\"CV-names\", true); // For showing names on mouseover\n let index = _findMaxValue(this._vRings);\n let x = this._ringScale(this._vRings[this._vRings.length - 1].pX) + this._vRings[index].barCircleScale(this._vRings[index].maxValue);\n this._grpBars.selectAll(\"text.CV-names\")\n .attr(\"x\", x)\n .attr(\"y\", 0)\n .attr(\"text-anchor\", \"start\")\n .text(function (n) {\n if (n.highLight === true) {\n if (_isTheFirstOccurence(n.id, d.cluster)) {\n d.cluster.push(n);\n }\n // let names = n.labels[0].split(\",\");\n let names = n.labels[1];\n // if (names.length === 1) {\n // names = n.labels[0].split(\".\");\n // if (names.length === 2) {\n // return names[1];\n // } else {\n // return names[2];\n // }\n // }\n return names;\n }\n return \"\";\n })\n .style(\"font-size\", \"10px\")\n .style(\"font-family\", \"Arial\")\n .style(\"color\", \"black\");\n function _isTheFirstOccurence(id, tab) {\n if (tab.length === 0)\n return true;\n else {\n for (let i = 0; i < tab.length; i++) {\n if (tab[i].id === id)\n return false;\n }\n return true;\n }\n }\n function _findMaxValue(_vRings) {\n let i, max = 0;\n for (i = 0; i < _vRings.length; i++) {\n if (_vRings[i].maxValue > max)\n max = i;\n }\n return max;\n }\n }", "function highlightNode(nodeId) {\n var node = myDiagram.findNodeForKey(nodeId++);\n // console.log(node);\n if (node !== null) {\n // make sure the selected node is in the viewport\n myDiagram.scrollToRect(node.actualBounds);\n // move the large yellow node behind the selected node to highlight it\n highlighter.location = new go.Point(\n node.location.x + 40,\n node.location.y + 40\n );\n // console.log(node.location)\n // console.log(highlighter.location)\n }\n}", "function handleMouseOverText(e) {\n\t\t\t\te.currentTarget.addClassName('active');\n\t\t\t\tvar parent = $(e.currentTarget).parent().get(0);\n\n\t\t\t\ttheInterface.emit('ui:emphElement', {\n\t\t\t\t\tid : e.currentTarget.getAttribute('id'),\n\t\t\t\t\tlayer : parent.getAttribute('data-layer')\n\t\t\t\t});\n\t\t\t}", "function highlightNode(d) {\r\n if (d3.event.defaultPrevented) return;\r\n // set new currently selected node\r\n tempCurrentNode = d.id;\r\n var tempNode = tempNodes_lookup[d.id];\r\n // if node is already in a conflict\r\n if (tempNode.conflicting) {\r\n kbNavigatorModals.showConflict(tempNode);\r\n return;\r\n }\r\n // if node is selected already\r\n if (tempNode.highlighted) {\r\n // untoggle node\r\n deselectDecisionOutcome(tempNode);\r\n } else {\r\n // if node is not selected check if outcome is excluded\r\n if (tempNode.excluded === false) {\r\n // if not excluded check if decision is selected\r\n if (tempNode.selectable) {\r\n // decision is not specified and outcome is not exlcuded\r\n // thus highlightin is easily possible\r\n selectDecisionOutcome(tempNode);\r\n } else {\r\n // decision is already selected ask if this outcome should\r\n // be chosen instead\r\n // may either select outcome or remain in before state\r\n kbNavigatorModals.changeOutcomeWihtinDecision(tempNode);\r\n }\r\n } else if (tempNode.excluded === true && tempNode.selectable === true) {\r\n // node is ecluded but decision has not been specified\r\n // ask with modal if outcome should be selected and outcome that\r\n // exclude it should be deselected\r\n kbNavigatorModals.forceExcludedOutcome(tempNode, true);\r\n } else if (tempNode.excluded === true && tempNode.selectable === false) {\r\n // node is excluded and decision is selected thus different\r\n // modal is used (boolean value)\r\n kbNavigatorModals.forceExcludedOutcome(tempNode, false);\r\n }\r\n }\r\n }", "function mouseOverFunction() {\n // Highlight circle\n var circle = d3.select(this);\n circle\n .style(\"fill\", \"#B3F29D\")\n .style(\"fill-opacity\", 0.5);\n\n // Find links which have circle as source and highlight\n svg.selectAll(\".link\")\n .filter(function(d) {\n return d.source.name === circle[0][0].__data__.name;\n })\n .style(\"stroke\", \"#B3F29D\");\n\n // Find labels which have circle as source and highlight\n svg.selectAll(\".label\")\n .filter(function(d) {\n if (d.name) {\n return d.name === circle[0][0].__data__.name;\n } else {\n return d.source.name === circle[0][0].__data__.name;\n }\n })\n .style(\"fill\",\"#B3F29D\");\n }", "function mouseover(d) {\n\n d3.select(\"#selected-name\")\n .text(d.data.name);\n\n d3.select(\"#explanation\")\n .style(\"visibility\", \"\");\n\n var sequenceArray = d.ancestors().reverse();\n sequenceArray.shift(); // remove root node from the array\n\n // Fade all the segments.\n d3.selectAll(\"path\")\n .style(\"opacity\", 0.3);\n\n // Then highlight only those that are an ancestor of the current segment.\n vis.selectAll(\"path\")\n .filter(function (node) {\n return (sequenceArray.indexOf(node) >= 0);\n })\n .style(\"opacity\", 1);\n}", "function mouseover(d) {\n const percentageString = `${d.value}`;\n const textForClosed = ' of them have been ';\n const textForOpen = ' of them are still ';\n\n const percentageStr = ' issues have been created by ';\n\n switch (d.name) {\n case 'open':\n d3.select('#percentage')\n .text(d.value);\n d3.select('#info-text-nbIssues')\n .text(textForOpen)\n .style('font-size', '1em');\n d3.select('#info-text-info-repo')\n .text(`${d.name}ed`);\n break;\n case 'closed':\n d3.select('#percentage')\n .text(d.value);\n d3.select('#info-text-nbIssues')\n .text(textForClosed)\n .style('font-size', '1em');\n d3.select('#info-text-info-repo')\n .text(d.name);\n break;\n default:\n d3.select('#percentage')\n .text(percentageString);\n d3.select('#info-text-nbIssues')\n .text(percentageStr)\n .style('font-size', '1em');\n d3.select('#info-text-info-repo')\n .text(`${d.name}.`);\n }\n\n d3.select('#explanation')\n .style('top', '240px');\n\n const sequenceArray = getAncestors(d);\n updateBreadcrumbs(sequenceArray, percentageString);\n\n // Fade all the segments.\n d3.selectAll('path')\n .style('opacity', 0.3);\n\n // Then highlight only those that are an ancestor of the current segment.\n vis.selectAll('path')\n .filter(node => (sequenceArray.indexOf(node) >= 0))\n .style('opacity', 1);\n}", "function highlightSingleNode(node) {\n d3.select('#type' + node.type + '-group' + node.id)\n .transition()\n .style('opacity', DEFAULT_NODE_EDGE_OPACITY);\n }", "function highlightTimeline(t_cy){\n t_cy.edges().forEach(function(target){\n var etopic = target.data('topic')[0];\n if(!(Object.keys(allTopics).includes(etopic))){\n allTopics[etopic] = cidx;\n cidx = (cidx + 3)%19;\n }\n var color = colorShade[allTopics[etopic]];\n target.style('line-color', color);\n target.style('target-arrow-color', color);\n });\n }", "function _labelHoverEnter() {\r\n\tvar menuItem = Utils.getObjForId(this);\t// this.view ;\r\n\tif( !menuItem || !menuItem.isSelectable() || !menuItem.isEnabled() ) return;\r\n\r\n\tmenuItem.fTopRowOuter.style.background = LookAndFeel.url(\"highlight.png\") + ' repeat';\r\n\tmenuItem.fTopRow.style.background = LookAndFeel.url(\"highlight_tr.png\") + ' no-repeat top right';\r\n\tmenuItem.fTopRowImage.style.display = \"block\";\r\n\r\n\tmenuItem.fBotRowOuter.style.background = LookAndFeel.url(\"highlight.png\") + ' repeat';\r\n\tmenuItem.fBotRow.style.background = LookAndFeel.url(\"highlight_br.png\") + ' no-repeat top right';\r\n\tmenuItem.fBotRowImage.style.display = \"block\";\r\n\r\n\tmenuItem.fMidRowOuter.style.background = LookAndFeel.url(\"highlight.png\") + ' repeat';\r\n\tmenuItem.fMidRow.style.background = LookAndFeel.url(\"highlight.png\") + ' repeat';\r\n\t// setting row content a must for IE\r\n\tif( menuItem.fMidRowContent.style )\r\n\t menuItem.fMidRowContent.style.background = LookAndFeel.url(\"highlight.png\") + ' repeat';\r\n\tmenuItem.fMidRowOuter.style.color = \"#EEEEEE\";\r\n\tif( menuItem.fSelectListener && menuItem.fSelectListener.onItemHover )\r\n\t menuItem.fSelectListener.onItemHover(menuItem, menuItem.fSelectListener);\r\n }", "function highlightGraphNode( node, on )\n {\n //if( d3.event.shiftKey ) on = false; // for debugging\n\n // If we are to activate a movie, and there's already one active,\n // first switch that one off\n if( on && activeMovie !== undefined ) {\n \t highlightGraphNode( nodeArray[activeMovie], false );\n }\n\n // locate the SVG nodes: circle & label group\n circle = d3.select( '#c' + node.index );\n label = d3.select( '#l' + node.index );\n\n // activate/deactivate the node itself\n circle\n\t.classed( 'main', on );\n label\n\t.classed( 'on', on || currentZoom >= SHOW_THRESHOLD );\n label.selectAll('text')\n\t.classed( 'main', on );\n\n // activate all siblings\n Object(node.links).forEach( function(id) {\n\td3.select(\"#c\"+id).classed( 'sibling', on );\n\tlabel = d3.select('#l'+id);\n\tlabel.classed( 'on', on || currentZoom >= SHOW_THRESHOLD );\n\tlabel.selectAll('text.nlabel')\n\t .classed( 'sibling', on );\n } );\n\n // set the value for the current active movie\n activeMovie = on ? node.index : undefined;\n }", "function node_mouseover(d) {\n d3.select(this).transition()\n .duration(150)\n .attr(\"r\", 10);\n if (drawing_line && d !== selected_node) {\n // highlight and select target node\n selected_target_node = d;\n }\n}", "function mouseovered(d) \n\t{\n\t\t// Handle tooltip\n\t\t// Tooltips should avoid crossing into the center circle\n\t\td3.selectAll(\"#tooltip\").remove();\n\t\td3.selectAll(\"#vis\")\n\t\t\t.append(\"xhtml:div\")\n\t\t\t.attr(\"id\", \"tooltip\")\n\t\t\t.style(\"opacity\", 0)\n\t\t\t.html(d.title);\n\t\tvar mouseloc = d3.mouse(d3.select(\"#vis\")[0][0]),\n\t\t\tmy = ((rotateit(d.x) > 90) && (rotateit(d.x) < 270)) ? mouseloc[1] + 10 : mouseloc[1] - 35,\n\t\t\tmx = (rotateit(d.x) < 180) ? (mouseloc[0] + 10) : Math.max(130, (mouseloc[0] - 10 - document.getElementById(\"tooltip\").offsetWidth));\n\t\tconsole.log(mx);\n\t\td3.selectAll(\"#tooltip\").style({\"top\" : my + \"px\", \"left\": mx + \"px\"});\n\t\td3.selectAll(\"#tooltip\")\n\t\t\t.transition()\n\t\t\t.duration(500)\n\t\t\t.style(\"opacity\", 1);\n\t\t\t\t\n\t\tnode.each(function(n) { n.target = n.source = false; });\n\t\t\n\t\tcurrnode = d3.select(this)[0][0].__data__;\n\t\t\n\t\tlink.classed(\"link--target\", function(l) { \n\t\t\t\tif (l.target === d) \n\t\t\t\t{ \n\t\t\t\t\treturn l.source.source = true; \n\t\t\t\t}\n\t\t\t\tif (l.source === d) \n\t\t\t\t{ \n\t\t\t\t\treturn l.target.target = true; \n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter(function(l) { return l.target === d || l.source === d; })\n\t\t\t.attr(\"stroke\", function(d){\n\t\t\t\tif (d[0].name == currnode.name)\n\t\t\t\t{\n\t\t\t\t\treturn color(d[2].cat);\n\t\t\t\t}\n\t\t\t\treturn color(d[0].cat);\n\t\t\t})\n\t\t\t.each(function() { this.parentNode.appendChild(this); });\n\t\t\n\t\td3.selectAll(\".link--clicked\").each(function() { this.parentNode.appendChild(this); });\n\t\t\n\t\tnode.classed(\"node--target\", function(n) { \n\t\t\treturn (n.target || n.source); \n\t\t});\n\t}", "function onEmphasis(){labelLine.ignore = labelLine.hoverIgnore;text.ignore = text.hoverIgnore;}", "function nodeMouseover(d) {\n svg.selectAll(\"g path\").classed(\"active\", function(p) {\n return p.source === d || p.target === d;\n });\n d3.select(this).classed(\"active\", true);\n }", "function handleHighlight(node, nodes, state, isHighlighted) {\n // Get related key\n let column = '';\n nodeByKey.forEach((key, value) => {\n if (key.name === node.name) {\n const value1 = value.slice(value.indexOf('[') + 2);\n column = value1.slice(0, value.indexOf(',') - 3);\n }\n });\n const position = keys.findIndex(key => key.id === column);\n\n // Highlight related nodes\n d3.selectAll('.node').classed('faded', isHighlighted);\n // d3.selectAll('.node-label').classed('faded', isHighlighted);\n d3.select(`.node-${node.index}`).classed(state, isHighlighted).classed('faded', false);\n // d3.select(`.node-label-${node.index}`).classed(state, isHighlighted).classed('faded', false);\n const relatedNodes = [];\n data.forEach(datum => {\n if (datum[column].includes(node.name)) {\n keys.forEach((key, i) => {\n // Get related nodes\n if (i !== position) {\n datum[key.id].forEach(item => {\n if (!relatedNodes.includes(item)) {\n const index = nodes.find(n => n.name === item).index;\n relatedNodes.push({ column: key.id, node_name: item, index: index });\n d3.select(`.node-${index}`).classed(state, isHighlighted).classed('faded', false);\n // d3.select(`.node-label-${index}`).classed(state, isHighlighted).classed('faded', false);\n }\n });\n } else {\n relatedNodes.push({ column: key.id, node_name: node.name, index: nodes.find(n => n.name === node.name).index });\n }\n });\n }\n });\n\n // Get related links\n d3.selectAll('.link').classed('faded', isHighlighted);\n keys.forEach((key, i) => {\n if (i < (keys.length - 1)) {\n const leftNodes = relatedNodes.filter(node => node.column === key.id);\n const rightNodes = relatedNodes.filter(node => node.column === keys[i + 1].id);\n leftNodes.forEach(ln => {\n rightNodes.forEach(rn => {\n d3.select(`.link-${ln.index}-to-${rn.index}`).classed(state, isHighlighted).classed('faded', false);\n });\n });\n }\n });\n\n // Highlight related liveProjects\n d3.selectAll('.live-project-toggle-wrapper').classed('faded', d => {\n if (isHighlighted && d3.select(`.node-title.node-${d.index}`).classed('faded')) {\n return true;\n } else {\n return false;\n }\n });\n}", "function beginHover(e) {\n e.target.classList.add('editor-highlight');\n}", "function node_mouseover(d) {\n d3.select(this).transition()\n .duration(150)\n .attr(\"r\", 10);\n //update the target node\n if (drawing_line && d !== selected_node) {\n // highlight and select target node\n selected_target_node = d;\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}", "function updateActiveTopic(topic) {\n d3.selectAll(\".g-head\").attr(\"class\", topic ? \"g-head g-has-topic\" : \"g-head g-hasnt-topic\");\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.selectAll(\".g-head a\").text(topic.name);\n d3.select(\".g-democrat .g-head span.g-count\").text(formatCount(topic.parties[0].count));\n d3.select(\".g-republican .g-head span.g-count\").text(formatCount(topic.parties[1].count));\n } else {\n node.classed(\"g-selected\", false);\n updateMentions(sampleMentions());\n d3.selectAll(\".g-head a\").text(\"various topics\");\n d3.selectAll(\".g-head span.g-count\").text(\"some number of\");\n }\n}" ]
[ "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.66999817", "0.64884716", "0.6391434", "0.6353626", "0.62625694", "0.6252868", "0.6189775", "0.61834115", "0.6127539", "0.6127281", "0.60842", "0.6049085", "0.6048379", "0.6047816", "0.60278106", "0.6013435", "0.5980934", "0.5935414", "0.5933406", "0.59327507", "0.59068584", "0.5885416", "0.5879976", "0.58762133", "0.58714837", "0.5868049", "0.586502", "0.5849554", "0.5818621", "0.58175427", "0.57819986", "0.5750832", "0.5744711", "0.5736665", "0.5728003", "0.5728003", "0.5728003", "0.5728003", "0.5728003", "0.5728003", "0.5728003", "0.5728003", "0.5728003" ]
0.62592727
61
myNames.filter(name => name[0] === 'R'); console.log(filteredNames); // => ['Rich', 'Ray'] < DO NOT EDIT BETWEEN THESE LINES TASK: DEFINE YOUR FILTER FUNCTION BELOW:
function filter(arr, fn) { let newArray = []; arr.forEach(function(word) { if (fn(word) === true) { newArray.push(word); } }); // for (let i = 0; i < arr.length; i++) { // if (fn(arr[i]) === true) { // newArray.push(arr[i]); // } // } return newArray; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function namesA (arr) {\n var newArr = arr.filter(function(element){\n return element[0] === \"A\";\n });\n}", "function filterByName(searchForName, personList) {\n searchForName = searchForName.toLowerCase();\n return personList.filter((person) => {\n console.log(person)\n // Only needs to check if letters typed so far are included in name, not equal to name. \n return person.name.toLowerCase().includes(searchForName);\n });\n}", "function getNameWithLetter(arrayOfNames,letter){\n return arrayOfNames.filter(function(name){\n return name.includes(letter);\n })\n}", "function _filterByName(theArray, theString){\n let filteredArray = theArray.filter(item => item.toLowerCase().includes(theString.toLowerCase()))\n return filteredArray\n }", "function myFilter(array, callback) {\n var filteredNames = [];\n for (let i = 0; i < array.length; i++) {\n if (callback(array[i], i, array)) filteredNames.push(array[i]);\n }\n return filteredNames;\n}", "function filteredCharacters(arr) {\n return arr.filter(item => {\n if (!searchTerm) {\n return item\n }\n if (item.name.toLowerCase().includes(searchTerm)) {\n return item\n }\n })\n }", "elementosMachingWithString(str, array){\r\n let st = str;\r\n if(st === undefined){st = ''}\r\n return array.filter((ele) => ele.getName().toLowerCase().match(st.toLowerCase()));\r\n }", "function peopleInTheIlluminati(arr) {\n const result = arr.filter(function(str) {\n if (peopleInTheIlluminati.member == true) {\n return arr;\n }});\n return result;\n}", "function namesOnly(arr){\n const justNames = arr.map((obj) => {\n return obj.name\n })\n return justNames\n}", "function matchName(arr, string) {\n return arr.filter(function (driver) {\n return driver.name === string;\n })\n}", "function namesOnly(arr){\r\n return arr.map(names => names.name)\r\n }", "getArtistsByName(name){\n return this.artists.filter( artist => artist.name.toUpperCase().includes(name.toUpperCase()));\n }", "function filter(array) {\n\tlet passed = [];\n\tfor (let element of array) {\n\t\tpassed.push(element.name);\n\t }\n\treturn passed;\n}", "function namesOnly(arr){\n return arr.map(names => {\n return names.name\n })\n }", "function namesOnly(arr){\r\n const result = arr.map(function(namesOnly){\r\n return namesOnly.name\r\n });\r\n return result;\r\n }", "function filterByName(dogs, name) {\n return dogs.filter(function(dog) {\n return dog.name.toLowerCase().startsWith(name.toLowerCase());\n })\n}", "getArtistsByName(artistName){\n return this.artists.filter((artist) => artist.getName().toLowerCase().includes(artistName.toLowerCase()));\n }", "function filterNames() {\n //3.1. get value of filterInput and convert it to upper case for comparision\n let filterValue = filterInput.value.toUpperCase();\n\n //3.2. get ul containing all the names\n let nameList = document.querySelector('.list');\n\n //3.3. get all the names from the nameList in a array\n let namesArray = Array.from(nameList.querySelectorAll('.list__item'));\n\n //3.4. loop through namesArray to compare filterValue with the names in the namesArray\n for (let i = 0; i < namesArray.length; i++){\n //3.4.1. get currentname\n let currentname = namesArray[i].innerText.toUpperCase();\n //3.4.2 compare both the names\n if(currentname.indexOf(filterValue) > -1){\n //if matched do nothing\n namesArray[i].style.display ='';\n }else{\n //else display none\n namesArray[i].style.display ='none';\n }\n }\n}", "function filterContacts(){\n\n var searchBox = document.getElementById(\"searchBox\");\n\n if(searchBox.value.length>1){\n\n var subSetContacts = USER_ARRAY.filter(function(contact){\n return contact.getFullName().toLowerCase().indexOf(searchBox.value.toLowerCase()) > -1;\n });\n\n console.log(\"result of filter\",subSetContacts);\n generateList(subSetContacts);\n\n }else if(searchBox.value.length==0){\n generateList(USER_ARRAY);\n }\n\n}", "filteredBirds() {\n return this.birds.filter(\n (bird) => {\n let filterBirdResult = true\n if (this.filterName !== \"\") {\n filterBirdResult = bird.name.includes(this.filterName)\n\n }\n return filterBirdResult\n\n }\n )\n\n }", "function namesOnly(arr) {\n return arr.map(function (arr) {\n return arr.name\n })\n}", "function filterTheNames(data) {\n let filteredNames = data.filter((name) => {\n return (\n name != '-' &&\n name != '/' &&\n name != '' &&\n name != 'geen' &&\n name != 'nvt' &&\n name.indexOf(' ') < 1 // https://stackoverflow.com/q/17616624 - Checks if there are 1 or more whitespaces\n );\n });\n return filteredNames;\n}", "function peopleWhoBelongToTheIlluminati(arr){\n var newArr = arr.filter(function(item){\n return item.member === true\n })\n console.log(newArr)\n}", "function bouncer(arr) {\n var filter = arr.filter(word => word);\n return filter;\n }", "filteredBirds() {\n return vm.birds.filter(\n (bird) => {\n let filterBirdResult = true\n if (this.filterName !== \"\") {\n filterBirdResult = bird.name.includes(vm.filterName)\n\n }\n return filterBirdResult\n\n }\n )\n\n }", "function namesOnly(arr){\n namesOnly = arr.map(function(profile){\n return profile.name\n\n })\n //console.log(namesOnly)\n}", "function removeName(name) {\r\n array.forEach(function (element) {\r\n if (`${element.firstName} ${element.middleName} ${element.lastName}` == name) {\r\n array.splice(element, 1);\r\n console.log(array);\r\n }\r\n });\r\n}", "function matchName (drivers, string) {\n return drivers.filter(obj => {\n return obj.name === string\n })\n}", "function filterName(name) {\n return name.toLowerCase().replace(/ /g, '');\n}", "function femaleCodersList(arr) {\n let filtered = arr.filter(n => n.gender === \"f\")\n return filtered.map( n => n.name)\n}", "function findMatching(list, name) {\n return list.filter(function (dName){\n return dName.toLowerCase() === name.toLowerCase();\n });\n}", "filterSearchData(searchDataAr) {\n let filteredAr = searchDataAr.filter(item => item.name.toLowerCase().includes(this.state.filter.toLowerCase()) === true)\n return filteredAr\n }", "filteredAnimals() {\n const { animals, chosenLetter } = this.state\n const sortedArray = [...animals]\n sortedArray.sort((a, b) => (a.name > b.name) ? 1 : -1)\n console.log(sortedArray)\n return sortedArray.filter(animal => {\n if (animal.name.charAt(0) === chosenLetter || chosenLetter === '')\n return animal\n })\n }", "function allTheNames(dataArr) {\n const result = [];\n dataArr.forEach((person,index) => \n person.name ? result[index] = person.name : null);\n return result;\n}", "function startsWithString(array,string){\n var list=[];\n for(var i=0;i<array.length;i++){\n if(array[i].name.startsWith(string))\n list.push(array[i]);\n }\n return list;\n\n}", "getStudentDetailByName(name) {\n let selectedStudent = studentsFullList.filter(student => student.name.toLowerCase().includes(name.toLowerCase()));\n if (selectedStudent.length == 0) {\n console.log(`No result found`);\n } \n return selectedStudent;\n }", "function getFirstLettersArray(pUsersArray){\n\tvar auxLettersArray = [];\n\tpUsersArray.filter(function(user) {\n\t\tauxLettersArray.push(user.Name.charAt(0));\n\t});\t\t\n\n\treturn auxLettersArray;\t\n}", "getFilteredPlayers() {\n const {players, filter} = this.state;\n if (players.length < 1 || filter.length < 1) {\n return players;\n } else {\n return players.filter(player=>{\n return (player.first_name + \" \" + player.last_name).toLowerCase()\n .indexOf(filter.toLowerCase()) > -1;\n })\n }\n }", "function removeItem(array, name) {\n return array.filter( (item, index) => item !== name);\n}", "function searchByName(people) {\n let firstName = promptFor(\"What is the person's first name?\", chars);\n let lastName = promptFor(\"What is the person's last name?\", chars);\n\n let foundPerson = people.filter(function (person) {\n if (person.firstName.toLowerCase() === firstName.toLowerCase() && person.lastName.toLowerCase() === lastName.toLowerCase()) {\n return true;\n } else {\n return false;\n }\n });\n return foundPerson;\n}", "function filter(array, condition) { \n var persons = []\n for(let i = 0; i < array.length; i ++) { \n if(condition(array[i])) {\n persons.push(array[i])\n }\n }\n \n return persons\n}", "function findMatching(drivers, name) {\n //console.log(drivers)\n //console.log(name)\n //console.log(drivers.filter(n => {return n === (name || name.toDownCase)}))\n let matchingName = drivers.filter((n) => {\n return n === name || n === name.toLowerCase() || n === name.toUpperCase();\n }); //should return array of matching\n //only return works once, remember to make the methods with () <-- remember this! Kevin Webster\n return matchingName;\n}", "function queryUserName(name){\n var results = users.filter(function(o){\n if(o.name.toLowerCase().indexOf(name.toLowerCase()) > - 1){\n return o;\n }\n });\n showUserResults(results);\n}", "function matchName(drivers, string) {\n return drivers.filter (n => n.name === string)\n}", "filteredFruits(){\n return this.fruits.filter((element)=> {\n return element.match(this.filterInputText)\n })\n }", "function searchJoke(filterArray) {\n var searchReg = new RegExp('^A');\n return filterArray.filter(function (joke) { return searchReg.test(joke.value); });\n}", "function nameFilter(element, index, array) {\n var $item = $(\"#\" + element);\n\n if (visible.filterOn.length > 0 && visible.items[element].name.toLowerCase().indexOf(visible.filterOn.toLowerCase()) === -1) {\n return false;\n }\n return true;\n }", "function searchCoffeeNames(e) {\n e.preventDefault();\n var userCoffeeName = document.getElementById(\"user-search\").value;\n var filteredNames = [];\n coffees.forEach(function(coffee) {\n\n if(coffee.name.toLowerCase().includes(userCoffeeName.toLowerCase())){\n filteredNames.push(coffee);\n\n }\n });\n divBody.innerHTML = renderCoffees(filteredNames);\n}", "function checkTheNames(data) {\n let checkedNames = data.map((name) => {\n if (\n name == '-' ||\n name == '/' ||\n name == '' ||\n name == 'geen' ||\n name == 'nvt' ||\n name.indexOf(' ') > 0\n ) {\n return null;\n }\n return name;\n });\n capitalizeTheNames(checkedNames); // Invoking the function\n // console.log('(3) Namenlijst met hoofdletter', capitalizeTheNames(checkedNames)); // List of ALL names, with uppercased first letter\n\n return checkedNames;\n}", "function filter(pred, xs) {\r\n var res = [], i = 0, l = xs.length, isStr = xs.charAt;\r\n for(; i < l; ++i)\r\n if(pred(isStr ? xs.charAt(i) : xs[i]))\r\n res.push(xs[i]);\r\n return isStr ? res.join(\"\") : res;\r\n}", "searcForName(name, array){\r\n return array.find((ele) => ele.getName().toLowerCase() === name.toLowerCase());\r\n\r\n }", "function filterNames() {\n // Get the input value\n\n let filterValue = document.getElementById('filterInput').value.toUpperCase();\n\n // Get the ul\n\n let ul = document.getElementById('names');\n\n // Get the lis from ul , an array would also be created from this\n let li = ul.querySelectorAll('li.collection-item');\n\n // Loop through \n\nfor( let i=0; i < li.length; i++) {\n let a = li[i].getElementsByTagName('a')[0];\n if(a.innerHTML.toUpperCase().indexOf(filterValue) > -1) {\n li[i].style.display = '';\n } else {\n li[i].style.display = 'none'\n }\n}\n}", "function peopleOfAge(arr) {\n const result = arr.filter(function(str) {\n if (peopleOfAge.age >= 18) {\n return arr;\n }});\n return result;\n}", "function filterNames(event) {\n let searchString = event.target.value.toLowerCase()\n\n $lis.forEach((li) => {\n if (li.querySelector('a').innerText.toLowerCase().includes(searchString)) {\n li.style.display = ''\n }\n else {\n li.style.display = 'none'\n }\n })\n}", "function filterByName(element)\r\n{\r\n _upObject.filterByName(element.value, \"name\");\r\n}", "function filter(kataKunci) {\n var filteredItems = []\n for (var j = 0; j < items.length; j++) {\n var item = items[j];\n var namaItem = item[1]\n var isMatched = namaItem.toLowerCase().includes(kataKunci.toLowerCase())\n\n if(isMatched == true) {\n filteredItems.push(item)\n }\n }\n return filteredItems\n}", "function filterByWord(array, string){ \n let promoFlavors = [] \n for (let i = 0; i < array.length; i++) { \n if (array[i].includes(string)) { \n promoFlavors.push(array[i]); \n } \n }\n return promoFlavors;\n}", "function filterStudents(searchString) {\n let newData = [];\n for (let i = 0; i < data.length; i++) {\n const name = `${data[i].name.first} ${data[i].name.last}`\n if (name.toLowerCase().includes(searchString.value.toLowerCase())) {\n newData.push(data[i]);\n }\n }\n return newData;\n}", "function findCraftAstronauts(craftName, people){\n let result = [];\n result = people.filter(function(astr){\n return astr.craft.toLowerCase() == craftName.toLowerCase();\n })\n return result = result.map(function(astr){\n return astr.name;\n });\n}", "function $UUq2$var$filter(xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n\n return res;\n} // String.prototype.substr - negative index don't work in IE8", "function filterArray(someArr, word) {\n return someArr.filter(function (item) {\n if (item.type != word) {\n return item;\n }\n });\n}", "function dramaMoviesCall(someArray) {\n return someArray.filter((movie) => movie.genre.indexOf('Drama') !== -1);\n}", "filterEmployee() {\n this.filteredEmployees = this.employeeData.slice();\n let inputField = document\n .getElementById(\"search-field\")\n .value.toLowerCase();\n if (inputField && inputField.length) {\n this.filteredEmployees = this.filteredEmployees.filter(\n employee =>\n employee.name.first.toLowerCase().indexOf(inputField) > -1 ||\n employee.name.last.toLowerCase().indexOf(inputField) > -1\n );\n }\n ui.displayEmployees();\n }", "function onlySpielbergMovies(movies){\n return movies.filter(function(movie){\n return movie.director===\"Steven Spielberg\";\n });\n}", "function searchNameText(e) {\n\tcardsList.innerHTML = ''; // clear the container for the new filtered cards\n\tbtnLoadMore.style.display = 'none';\n\tlet keyword = e.target.value;\n\tlet arrByName = dataArr.filter(\n\t\t(card) => { \n\t\t\treturn( \n\t\t\t\tcard.name.toLowerCase().indexOf(keyword.toLowerCase()) > -1 ||\n\t\t\t\tcard.artist.toLowerCase().indexOf(keyword.toLowerCase()) > -1 ||\n\t\t\t\tcard.setName.toLowerCase().indexOf(keyword.toLowerCase()) > -1 \n\t\t\t\t)\n\t\t}\t\n\t);\n\trenderCardList(arrByName);\n\tconsole.log(arrByName);\n}", "function matchName(drivers, stringName) {\n return drivers.filter(driver => driver.name.toLowerCase() === stringName.toLowerCase())\n}", "function allWithPro (arr,substr) {\n return arr.filter(function(element) { \n return element.toLowerCase().startsWith(substr);\n })\n}", "function scanAndFilter(freightItems, forbiddenString) {\n // This is an array variable you can override with your filtered array\n let filteredItems = [];\n \n /*\n Replace this comment with your code.\n Use the array filter() function to replace filteredItems with a new array of\n strings that don't include the value of forbiddenString\n */\n freightItems.filter(function(item, index, array) {\n console.log(`${item} at ${index} is in ${array}`)\n // if true item is pushed to results and the iteration continues\n if (item != forbiddenString){\n filteredItems.push(item);\n }\n console.log(forbiddenString)\n // returns empty array if nothing found\n });\n\n\n return filteredItems;\n }", "function trim_names(name, list) {\n\t\tvar result = [];\n\t\tfor(var i = 0; i < list.length; ++i) {\n\t\t\tif (list[i].name.indexOf(name) != -1) {\n\t\t\t\tresult.push({'id': list[i].id, 'name': list[i].name});\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}", "function searchByName(people){\n let firstName = promptFor(\"What is the person's first name?\", firstNameValidation, people);\n let lastName = promptFor(\"What is the person's last name?\", lastNameValidation, people);\n\n let foundPerson = people.filter(function(potentialMatch){\n if(potentialMatch.firstName === firstName && potentialMatch.lastName === lastName){\n return true;\n }\n else{\n return false;\n }\n })\n return foundPerson[0];\n}", "function matchName(drivers, string) {\n const newDrivers = drivers.filter(name => {\n return name.name === string\n });\n return newDrivers\n}", "function names(arr) {\n return names.name;\n}", "function filterLowerCases(letters) {\n return letters.filter(letter => {\n debugger;\n return letter === letter.toLowerCase();\n // ===return letters.filter(letter => leter === letter.toLowerCase());\n });\n}", "function namesOnly(arr){\n var newArr = arr.map(function(item){\n if(item.age >= 18){\n return (`${item.name} can go to The Matrix`)\n }else{\n return(`${item.name} is under age!!`)\n }\n })\n console.log(newArr)\n}", "confrimButton(userInput){\n \n var obj = this.state.names.filter( e => e.includes(userInput))\n this.setState({filteredNames: obj})\n \n }", "function productSuggestion() {\n var name = document.getElementById(\"name\").value;\n var list = products.map(function (product) {\n if (product.name.indexOf(name) != -1) {\n return product.name;\n }\n });\n console.log(name);\n}", "function filtra(array) {\n return array.filter(function (director, index) {\n return index === array.indexOf(director);\n });\n }", "function filterByName(val){\n return val.speaker == this;\n }", "function getCar(arrayOfCars, carName){\n return arrayOfCars.filter(function(car){\n return car.name.includes(carName);\n }).map(function(car){\n return car.name;\n })\n}", "function findNamesBeginningWith(names, char) {\n if (!names) throw new Error(\"names is required\");\n if (!char) throw new Error(\"char is required\");\n\n return names.filter(n => n[0] === char);\n}", "function filterLetters(array, letter) {\n\treturn array.filter(function(value) {\n\t\treturn value.toLowerCase() === letter.toLowerCase();\n\t}).length;\n}", "function useFilter1(inputArr) {\n inputArr.filter((obj) => {\n if (obj.gender == \"male\") {\n console.log(obj)\n }\n })\n}", "function matchingFriendsLetter(array, person, letter){\n var messg;\n var count = 0;\n var wholeMssg;\n var matchingFriends;\n customers.filter(function(value, index, arr){\n if(value.name === person){\n matchingFriends = value.friends;\n }\n \n return matchingFriends;\n });\n matchingFriends.filter(function(e, i, c){\n if(e.name.charAt(0).toLowerCase() === letter.toLowerCase()){\n count++;\n messg = e.name;\n wholeMssg = person + \" has \" + count + \" friend(s) whose name starts with the letter \" + letter;\n }\n else {\n wholeMssg = person + \" does not have any friends with names starting with the letter \" + letter;\n }\n \n \n });\n \n return wholeMssg;\n \n }", "function filterEmployeesbyName() {\n // Sorts users by first name, then second if first name is similar, and if both are identical, then sort by ID.\n \n \n return;\n}", "handleForCodeList(event) {\n try {\n this.forCodeFilteredList = [];\n if (event.detail.value) {\n let forCodeRec;\n forCodeRec = event.detail.value;\n if (forCodeRec.length > 2) {\n forCodeRec = forCodeRec.toUpperCase();\n // for (let i = 0; i < this.forcodeinternallist.length; i++) {\n // if ((this.forcodeinternallist[i].Name.toUpperCase()).startsWith(forCodeRec.toUpperCase())) {\n // this.forCodeFilteredList.push(this.forcodeinternallist[i]);\n // }\n // }\n this.forCodeFilteredList = this.forcodeinternallist.filter(obj => obj.Name.toUpperCase().startsWith(forCodeRec));\n }\n }\n } catch (error) {\n console.log('error---------->', error);\n }\n }", "function search(nameKey, array) {\n let res;\n for (var i = 0; i < array.length; i++) {\n if (array[i].name === nameKey) {\n res = array[i];\n }\n }\n if (res) {\n return res;\n }\n nameKey = capitalize(nameKey);\n for (i = 0; i < array.length; i++) {\n if (array[i].name === nameKey) {\n res = array[i];\n }\n }\n return res;\n}", "function findSubmissionByName(array, name) {\n let result = array.find(({ name }) => name === \"Joan\");\n return result;\n}", "function getOnlyNames(authors_array){\n array = new Array();\n\n for(i=0; i<authors_array.length; i++){\n array.push(authors_array[i].author);\n }\n return array;\n}", "function firstname (lista) {\n filtro = lista.filter(function(name){\n return name.nombre[0]== \"J\";\n });\n \n union = filtro.map(function(i){\n return i.nombre[0] + \" \" + i.apellido[0];\n });\n \n ordenado = union.sort();\n \n for (lista of ordenado) {\n document.write (\"l) Nombres con J ---> \" + union + \"<br/>\");\n }\n}", "function filter (array,fn) {\n return array.filter(fn)\n}", "function directorMovies(){\nconst director = movies.filter(function(movies){\n return movies.director == \"Steven Spielberg\"\n})\n\nspielBergMovies = []\n\nfor (let i = 0; i<director.length; i+=1){\n spielBergMovies.push(director[i].title)\n}\nconsole.log(\"Steven Spielberg movies has \"+ spielBergMovies.length+ \" movies: \"+ spielBergMovies )\n}", "function filterNames() {\r\n //Search value, list items, pokemon names\r\n const filterValue = searchResult.value.toLowerCase(); //Gets search value\r\n const pokemonListLi = pokemonList.querySelectorAll('li'); //Gets list items\r\n const pokemonListNames = pokemonList.querySelectorAll('.pokemon-name'); //Gets pokemon names\r\n\r\n for (let i = 0; i < pokemonListNames.length; i++) {\r\n /*if at least one value of search appears in name, list item stays\r\n if value of search never occurs, list item is hidden*/\r\n if (pokemonListNames[i].textContent.toLowerCase().indexOf(filterValue) > -1) {\r\n pokemonListLi[i].style.display = '';\r\n } else {\r\n pokemonListLi[i].style.display = 'none';\r\n }\r\n }\r\n}", "function arrayNames(person){\n let array = [];\n person.forEach(element => {\n array.push(fullName(element))\n });\n return array;\n }", "filterFunc (searchExpression, value) {\n const itemValue = value.name\n\n return (!searchExpression || !itemValue)\n ? false\n : itemValue.toUpperCase().indexOf(searchExpression.toUpperCase()) !== -1\n }", "function cityNames(array) {\n\n// // 2. Iterate over the city values, only returning the city names. (Use map)\n \nlet names = cities.map(myObject => myObject.name)\nreturn names;\n\n}", "function names() {\n let names = ['Github', 'Google', 'Facebook', 'Reddit', 'Stackoverflow'];\n\n /* .forEach is an array method; it accepts a callback as its only argument */\n /* .forEach calls the callback for each element in the array */\n /* when .forEach calls the callback, it passes the current element as the first argument of the callback */\n return names;\n \n}", "function matchName (list, name) {\n return list.filter(function (driver) {\n return driver.name.toLowerCase() === name.toLowerCase();\n });\n}", "function findMatches(wordToMatch, names){\n\t\treturn names.filter(restaurants => {\n\t\t\tconst regex = new RegExp (wordToMatch, 'gi');\n\t\t\treturn restaurants.name.match(regex)\n\t\t});\n\t}", "function matchName(darray, driver) {\n return darray.filter(d => d.name === driver);\n}", "handleSearch(e) {\n const input = e.target.previousSibling.value;\n let newNameList = [];\n this.props.info.names.map(algo => {\n input.split(\" \").map(name => {\n if (algo.toLowerCase().indexOf(name.toLowerCase()) !== -1) {\n newNameList.push(algo);\n }\n return true;\n });\n return true;\n });\n\n this.setState({ filteredNames: newNameList });\n }" ]
[ "0.7429913", "0.71968865", "0.7112225", "0.7028007", "0.6914757", "0.6825245", "0.6774952", "0.66575575", "0.65211946", "0.6514764", "0.6483694", "0.6471839", "0.6434838", "0.64284486", "0.6391881", "0.63863933", "0.6370566", "0.63263726", "0.6302567", "0.62834924", "0.6245646", "0.6230271", "0.6224127", "0.62162375", "0.6203145", "0.6189703", "0.61822283", "0.61801255", "0.6166879", "0.60891163", "0.60664994", "0.6060048", "0.6056726", "0.6031719", "0.6031057", "0.6026268", "0.60219", "0.6016651", "0.6016478", "0.600572", "0.5998125", "0.599236", "0.599227", "0.597325", "0.5971834", "0.5966797", "0.59457594", "0.5944906", "0.5940818", "0.59398824", "0.59308165", "0.5924373", "0.5921409", "0.59202635", "0.590763", "0.5901702", "0.5897243", "0.5895466", "0.5886235", "0.588166", "0.58676857", "0.5859888", "0.58485633", "0.5846427", "0.58264846", "0.5813118", "0.5809597", "0.5805836", "0.5804805", "0.5799664", "0.57872164", "0.57860506", "0.5773647", "0.57640463", "0.5762762", "0.57600904", "0.57590747", "0.57581043", "0.57535", "0.57507825", "0.5747373", "0.5744771", "0.57427907", "0.5739134", "0.57357633", "0.5732806", "0.5731657", "0.5728799", "0.5696073", "0.5691229", "0.56907594", "0.56897956", "0.5689529", "0.56811076", "0.56732845", "0.5669323", "0.56684136", "0.5658463", "0.56566757", "0.5646826" ]
0.60248697
36
TODO: parse away the Finnishpart of the message? TODO: set some fallbackimage? jscs:disable maximumLineLength,requireCamelCaseOrUpperCaseIdentifiers
render() { const item = this.props.item; const fallbackImage = 'https://storage.googleapis.com/futurice-event-app/assets/wappu-team-says.jpg'; if (!item) { return <Loader />; } return ( <View style={styles.container}> <View style={styles.card}> <View style={styles.imgWrap}> <Image source={{ uri: item.picture || fallbackImage}} style={styles.img} > <View style={styles.imgColorLayer} /> </Image> </View> <View style={styles.textContainer}> <Text style={styles.text__title}>WAPPU TEAM SAYS: </Text> <ParsedText style={styles.text} parse={ [ {type: 'url', style: styles.url, onPress: this.handleUrlPress} ] } > {item.message} </ParsedText> </View> <Text style={styles.timestampText}> {time.getTimeAgo(item.created_time)} </Text> </View> </View> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "TheMessage(msg) {\n return;\n }", "function parseOldMessage(message) {\n console.log(\"**************************** \" + message);\n var legalContent = message.replace(incomingFilter, '');\nvar front = legalContent.substr(0, legalContent.indexOf(':'));\nvar content = legalContent.substr(legalContent.indexOf(':')+1);\nvar frontParts = front.split(' ');\n\nvar frontPart1 = frontParts[0];\nvar frontPart2 = frontParts[1];\nif (frontPart1) {\nif (typeof frontPart1 != 'undefined' && frontPart1 == 'From' && typeof frontPart2 != 'undefined' && content != 'undefined') {\n bot.emit('whisper', frontPart2, content, message);\n} else if (typeof frontPart1 != 'undefined' && typeof frontPart2 === 'undefined' && content != 'undefined') {\n bot.emit('chat', frontPart1, content, message);\n}\n} else {\n bot.emit('nonSpokenChat', legalContent);\n}\n }", "function ProcessMessage(receivedMessage, messageContent)\r\n{\r\n\t// Give help\r\n\tif (messageContent == 'помощь')\r\n\t{\r\n\t\tvar str = '';\r\n\t\tstr += '**м!мехпомощь** - показать инструкцию по строительству меха\\n';\r\n\t\tstr += '**м!битвапомощь** - показать инструкцию по сражениям\\n';\r\n\t\tstr += '**м!битва** - отправить меха в сражение\\n';\r\n\t\tstr += '**м!инв** - показать баланс и инвентарь\\n';\r\n\t\tstr += '**м!мех** - показать комплектацию меха\\n';\r\n\t\tstr += '**м!уст** ***x*** ***y*** - установить *x*-й предмет в слот меха *y*: м!уст 3 пр\\n';\r\n\t\tstr += '**м!ул** ***x*** - улучшить *x*-й предмет в инвентаре: м!ул 4\\n';\r\n\t\tstr += '**м!прод** ***x*** - продать *x*-й из инвентаря за полцены: м!прод 5\\n';\t\r\n\t\tstr += '**м!проднеуст** - продать все неустановленные на мехе предметы за полцены\\n';\t\r\n\t\tstr += '**м!куп** ***x*** - купить случайный предмет за удвоенную цену (не менее 20Ю): м!куп 80\\n';\t\r\n\r\n\t\treceivedMessage.channel.send(str);\r\n\t}\r\n\t// Give help on building mechs\r\n\telse if (messageContent == 'мехпомощь')\r\n\t{\r\n\t\tvar str = ':white_small_square:Ваш мех состоит из семи частей:\\n';\r\n\t\tstr += ':white_small_square:Центральный торс (ЦТ), Левый/Правый Торс (ЛТ/ПТ), Левая/Правая Рука (ЛР/ПР), Левая/Правая Нога (ЛН/ПН).\\n';\r\n\t\tstr += \":white_small_square:Ядро можно установить только в ЦТ. Оно определяет вместимость меха по энергии и массе, а также Базовую Скорость.\\n\";\r\n\t\tstr += ':white_small_square:Оружие можно устанавливать в боковые Торсы и Руки, броню - в боковые Торсы и Ноги.\\n';\r\n\t\tstr += ':white_small_square:Характеристика оружия - Урон в Минуту, равный произведению Урона на Выстрелы в Минуту.\\n';\r\n\t\tstr += \":white_small_square:Броня обеспечивает Переднюю и Заднюю Защиты. Чем мех легче, тем он быстрее.\\n\";\r\n\t\tstr += \":white_small_square:Отношение Скоростей вашего и вражеского мехов определяет преимущество.\\n\";\r\n\t\tstr += \":white_small_square:Оно позволяет частично наносить урон Задней Защите, обычно более слабой.\\n\";\r\n\r\n\t\treceivedMessage.channel.send(str);\r\n\t}\r\n\t// Give help on combat\r\n\telse if (messageContent == 'битвапомощь')\r\n\t{\r\n\t\tvar str = ':white_small_square:Вы можете отправить своего меха сразиться с вражеским:\\n';\r\n\t\tstr += \":white_small_square:Перед сражением вы увидите сравнение характеристик мехов.\\n\";\r\n\t\tstr += \":white_small_square:В зависимости от Скоростей, вы или противник получите преимущество.\\n\";\r\n\t\tstr += \":white_small_square:Обладатель преимущества будет наносить процент своего Урона по Задней Защите противника, равный проценту преимущества.\\n\";\r\n\t\tstr += \":white_small_square:За счёт, впрочем, Урона по Передней Защите.\\n\";\r\n\t\tstr += ':white_small_square:Рассчитывается время уничтожения мехов через Переднюю и Заднюю защиты.\\n';\r\n\t\tstr += \":white_small_square:Если ваш мех уничтожается быстрее, вам засчитывается поражение.\\n\";\r\n\t\tstr += \":white_small_square:Если быстрее уничтожается вражеский мех, то вы - победитель в сражении.\\n\";\r\n\t\tstr += \":white_small_square:За каждую победу вы получаете новую деталь со стоимостью, равной стоимости деталей вражеского меха.\\n\";\r\n\t\tstr += \":white_small_square:Оснащайте свой мех новыми деталями или продавайте их, чтобы улучшить старые!\\n\";\r\n\r\n\t\treceivedMessage.channel.send(str);\r\n\t}\r\n\t// Give an item\r\n\t/*else if (messageContent == 'add')\r\n\t{\r\n\t\tAddItem(receivedMessage, 10);\r\n\t}*/\r\n\t// Give 10 items\r\n\t/*else if (messageContent == 'massadd')\r\n\t{\r\n\t\tAddItem(receivedMessage, 10); AddItem(receivedMessage, 10);\r\n\t\tAddItem(receivedMessage, 10); AddItem(receivedMessage, 10);\r\n\t\tAddItem(receivedMessage, 10); AddItem(receivedMessage, 10);\r\n\t\tAddItem(receivedMessage, 10); AddItem(receivedMessage, 10);\r\n\t\tAddItem(receivedMessage, 10); AddItem(receivedMessage, 10);\r\n\t}*/\r\n\t// Check inventory\r\n\telse if (messageContent == 'инв')\r\n\t{\r\n\t\tShowInventory(receivedMessage);\r\n\t}\r\n\t// Check mech\r\n\telse if (messageContent == 'мех')\r\n\t{\r\n\t\tShowMech(receivedMessage);\r\n\t}\r\n\t// Upgrade an item\r\n\telse if (messageContent.startsWith('ул '))\r\n\t{\r\n\t\tvar index = messageContent.substr(3);\r\n\t\tUpgradeItem(receivedMessage, index - 1);\r\n\t}\r\n\t// Sell an item for 1/2x funds\r\n\telse if (messageContent.startsWith('прод '))\r\n\t{\r\n\t\tvar index = messageContent.substr(5);\r\n\t\tSellItem(receivedMessage, index - 1);\r\n\t}\r\n\t// Buy an item for 3x funds\r\n\telse if (messageContent.startsWith('куп '))\r\n\t{\r\n\t\tBuyItem(receivedMessage);\r\n\t}\r\n\t// Sell unused items\r\n\telse if (messageContent == 'проднеуст')\r\n\t{\r\n\t\tSellNotInstalled(receivedMessage);\r\n\t}\r\n\t// Install an item\r\n\telse if (messageContent.startsWith('уст '))\r\n\t{\r\n\t\tvar data = messageContent.substr(4);\r\n\t\tPutItem(receivedMessage, data);\r\n\t}\r\n\t// Encounter\r\n\telse if (messageContent == 'битва')\r\n\t{\r\n\t\tEncounter(receivedMessage);\r\n\t}\r\n\t// PvP\r\n\telse if (messageContent.startsWith('пвп '))\r\n\t{\r\n\t\tpvp(receivedMessage);\r\n\t}\r\n\r\n\t//\r\n\telse\r\n\t{\r\n\t\treceivedMessage.channel.send('Команда не распознана!');\r\n\t}\r\n}", "getMessageText() {\n return ``;\n }", "function getMessage() {\n\n}", "constructor() {\n this.messageText = \"Bershka was created in 1998 as a new brand of the Spanish group Inditex\";\n }", "get message() { return this._message; }", "parseMessage(message) {\n // there are two :'s, first for seperating message data; second for content\n const colonIndex = message.indexOf(\":\");\n const data = message.substr(0, colonIndex - 1); // get data 'til :\n const messageObj = this.parseObject(data, Message);\n const channelIndex = message.indexOf(\"PRIVMSG\") + \"PRIVMSG\".length + 1; // 1 for the space\n const lastColonIndex = message.lastIndexOf(\":\");\n const channel = message.substring(channelIndex, lastColonIndex - 1);\n const content = message.substring(lastColonIndex + 1);\n messageObj.channel = channel;\n messageObj.content = content.replace(\"\\r\\n\", \"\"); // remove default empty line\n return messageObj;\n }", "function showsCareAgentOflineMsg(message){\n if(\n message.includes(\"Im Moment kann nicht gechattet werden. Versuchen Sie es später erneut.\") ||\n message.includes(\"ただいまチャットできません。 後でもう一度お試しください。\") ||\n message.includes(\"지금은 채팅을 할 수 없습니다. 나중에 다시 시도하십시오.\") ||\n message.includes(\"No podemos chatear en estos momentos. Inténtelo de nuevo más tarde.\") ||\n message.includes(\"我们现在无法聊天。 请稍后重试。\") ||\n message.includes(\"我們目前無法聊天。 請稍後再試一次。\") ||\n message.includes(\"Não podemos conversar neste momento. Tente novamente mais tarde.\") ||\n message.includes(\"Não podemos conversar agora. Tente novamente mais tarde.\") ||\n message.includes(\"We kunnen momenteel niet chatten. Probeer het later opnieuw.\") ||\n message.includes(\"Nous ne pouvons pas discuter pour le moment. Veuillez réessayer ultérieurement.\") ||\n message.includes(\"Vi kan ikke chatte lige nu. Prøv igen senere.\") ||\n message.includes(\"Emme voi chatata juuri nyt. Yritä myöhemmin uudelleen.\") ||\n message.includes(\"Non possiamo chattare al momento Riprova più tardi.\") ||\n message.includes(\"Vi kan ikke chatte akkurat nå. Prøv på nytt senere.\") ||\n message.includes(\"В настоящее время чат недоступен. Повторите попытку позже.\") ||\n message.includes(\"Vi kan inte chatta just nu. Försök igen senare.\") ||\n message.includes(\"เราไม่สามารถสนทนาได้ในตอนนี้ ลองอีกครั้งในภายหลัง\") ||\n message.includes(\"Nie możemy w tej chwili rozmawiać na czacie Spróbuj ponownie później.\") ||\n message.includes(\"Momenálne nemôžeme četovať. Skúste to znova.\") ||\n message.includes(\"Não podemos conversar agora. Tente novamente mais tarde.\") ||\n message.includes(\"We can't chat right now. Try again later.\")\n ){\n return true;\n } else {\n return false;\n }\n}", "processSimpleMessageAccessories (e) {\n\t\t\tif (e.instance.props.message.content) {\n\t\t\t\tlet message = new BDFDB.DiscordObjects.Message(e.instance.props.message);\n\t\t\t\tfor (let word of e.instance.props.message.content.split(/\\n|\\s|\\r|\\t|\\0/g)) if (word.indexOf(\"https://\") > -1 || word.indexOf(\"http://\") > -1) {\n\t\t\t\t\tword = word.indexOf(\"<\") == 0 && word.indexOf(\">\") == word.length-1 ? word.slice(1,-1) : word;\n\t\t\t\t\tif (!this.isEmbedded(message.embeds, word)) this.injectEmbed(e.instance, message.embeds, word);\n\t\t\t\t}\n\t\t\t\te.instance.props.message = message;\n\t\t\t}\n\t\t}", "_processMessage(message)\n{\n try\n {\n let data = JSON.parse(message);\n if (undefined === data.e)\n {\n return;\n }\n switch (data.e)\n {\n case 'depthUpdate':\n this._processOrderBookUpdate(data);\n return;\n case 'aggTrade':\n this._processTrades(data);\n return;\n case '24hrTicker':\n this._processTicker(data);\n return;\n case 'kline':\n this._processKline(data);\n return;\n }\n }\n catch (e)\n {\n logger.error(e.stack);\n return;\n }\n}", "handleMessage(message = '', ...args) {\n const parsed = parseArgs(message, this.parseOptions);\n parsed.text = message;\n return super.handleMessage(parsed, ...args);\n }", "function regular(msg) {\n var moj_kljuc;\n var plainMsg;\n const {clients}=ClientStore.getState()\n\n if(clients&&clients[msg.clientID].key)\n {\n moj_kljuc= clients[msg.clientID].key;\n plainMsg= decrypt(msg.content, moj_kljuc)\n msg.content=plainMsg;\n }\n console.log(\"msg\", msg);\n ServerActionCreator.serverNewMsg(msg)\n\n}", "function parseMessage(s) {\n var r = s.toString('binary').match(/^\\s*([\\S\\s]*?)\\r\\n\\r\\n([\\S\\s]*)$/);\n if (r) {\n var m = parse(r[1]);\n if (m) {\n if (m.headers['content-length']) {\n var c = Math.max(0, Math.min(m.headers['content-length'], r[2].length));\n m.content = r[2].substring(0, c);\n }\n else {\n m.content = r[2];\n }\n if (!m.headers.via) {\n m.headers.via = [];\n }\n return m;\n }\n }\n}", "function createBodyText(message) {\n\n ARTEMIS.log.info(\"loading message:\" + message);\n if (message.text) {\n var body = message.text;\n var lenTxt = \"\" + body.length;\n message.textMode = \"text (\" + lenTxt + \" chars)\";\n return body;\n }\n else if (message.BodyPreview) {\n var code = Core.parseIntValue(localStorage[\"ARTEMISBrowseBytesMessages\"] || \"1\", \"browse bytes messages\");\n var body;\n message.textMode = \"bytes (turned off)\";\n if (code != 99) {\n var bytesArr = [];\n var textArr = [];\n message.BodyPreview.forEach(function (b) {\n if (code === 1 || code === 2) {\n // text\n textArr.push(String.fromCharCode(b));\n }\n if (code === 1 || code === 4) {\n // hex and must be 2 digit so they space out evenly\n var s = b.toString(16);\n if (s.length === 1) {\n s = \"0\" + s;\n }\n bytesArr.push(s);\n }\n else {\n // just show as is without spacing out, as that is usually more used for hex than decimal\n var s = b.toString(10);\n bytesArr.push(s);\n }\n });\n var bytesData = bytesArr.join(\" \");\n var textData = textArr.join(\"\");\n if (code === 1 || code === 2) {\n // bytes and text\n var len = message.BodyPreview.length;\n var lenTxt = \"\" + textArr.length;\n body = \"bytes:\\n\" + bytesData + \"\\n\\ntext:\\n\" + textData;\n message.textMode = \"bytes (\" + len + \" bytes) and text (\" + lenTxt + \" chars)\";\n }\n else {\n // bytes only\n var len = message.BodyPreview.length;\n body = bytesData;\n message.textMode = \"bytes (\" + len + \" bytes)\";\n }\n }\n return body;\n }\n else {\n message.textMode = \"unsupported\";\n return \"Unsupported message body type which cannot be displayed by hawtio\";\n }\n }", "serializeI18nHead() {\n const MEANING_SEPARATOR = '|';\n const ID_SEPARATOR = '@@';\n const LEGACY_ID_INDICATOR = '␟';\n let metaBlock = this.metaBlock.description || '';\n if (this.metaBlock.meaning) {\n metaBlock = `${this.metaBlock.meaning}${MEANING_SEPARATOR}${metaBlock}`;\n }\n if (this.metaBlock.customId) {\n metaBlock = `${metaBlock}${ID_SEPARATOR}${this.metaBlock.customId}`;\n }\n if (this.metaBlock.legacyIds) {\n this.metaBlock.legacyIds.forEach(legacyId => {\n metaBlock = `${metaBlock}${LEGACY_ID_INDICATOR}${legacyId}`;\n });\n }\n return createCookedRawString(metaBlock, this.messageParts[0].text, this.getMessagePartSourceSpan(0));\n }", "serializeI18nHead() {\n const MEANING_SEPARATOR = '|';\n const ID_SEPARATOR = '@@';\n const LEGACY_ID_INDICATOR = '␟';\n let metaBlock = this.metaBlock.description || '';\n if (this.metaBlock.meaning) {\n metaBlock = `${this.metaBlock.meaning}${MEANING_SEPARATOR}${metaBlock}`;\n }\n if (this.metaBlock.customId) {\n metaBlock = `${metaBlock}${ID_SEPARATOR}${this.metaBlock.customId}`;\n }\n if (this.metaBlock.legacyIds) {\n this.metaBlock.legacyIds.forEach(legacyId => {\n metaBlock = `${metaBlock}${LEGACY_ID_INDICATOR}${legacyId}`;\n });\n }\n return createCookedRawString(metaBlock, this.messageParts[0].text, this.getMessagePartSourceSpan(0));\n }", "handleText (message, prefix, roles, author, channel) {\n\t\t// If it is not a valid command ignore\n\t\tif (message == `${prefix}${this.brother_prefix}` || message == `${prefix}${this.brother_prefix} help`) {\n\t\t\treturn new MessageResponse(true, brother_help(), false)\t\t\n\t\t}\n\t\t// Check if this is an add command\n\t\tif (!(message.startsWith(`${prefix}${this.brother_prefix}`))) {\n\t\t\treturn new MessageResponse(false, \"Unrelated\", false)\t\t\t\n\t\t}\n\t\t// Split the message like command line args\n\t\tconst split_message = message.match(/(\".*?\"|[^\\s]+)+(?=\\s*|\\s*$)/g)\n\n\t\tif (! (arr_com(this.modifiers, roles) || this.gods.includes(author.id))) {\n\t\t\treturn new MessageResponse(this.errors, `You do not have permission to modify BigBrother settings`, false)\n\t\t}\n\n\t\tif (split_message[1] == \"analyze\") {\n\t\t\treturn this.describeImage(split_message[2])\n\t\t}\n\n\t\treturn new MessageResponse(false, \"Unrelated\", false)\n\t}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x8c7f65e2;\n this.SUBCLASS_OF_ID = 0xc4910f88;\n\n this.noWebpage = args.noWebpage || null;\n this.message = args.message;\n this.entities = args.entities || null;\n this.replyMarkup = args.replyMarkup || null;\n }", "validateMessage (data) {\n\t\t// since we stored the original text and code, use those and add the escaped html we\n\t\t// expect to see in the email output\n\t\tthis.post.text = ESCAPED_HTML + this.originals.text;\n\t\tlet marker = this.post.markers[0];\n\t\tmarker.code = ESCAPED_HTML + this.originals.code;\n\t\tmarker.preContext = ESCAPED_HTML + this.originals.preContext;\n\t\tmarker.postContext = ESCAPED_HTML + this.originals.postContext;\n\t\treturn super.validateMessage(data);\n\t}", "function prepareMessage(message) {\n var html = '';\n html += '<div class=\"mssgIn\">';\n html += '<p class=\"from\">'+jid+'</p>';\n html += '<p class=\"body\">'+message+'</div>';\n html += '</div>'; \n }", "_extractMessages(data) {\n // split the set of messages into lines, each representing a user or system message \n let lines = data.replace(/\\d{1,2}\\/\\d{1,2}\\/\\d{1,2},\\s\\d{1,2}:\\d{1,2}\\s-\\s/g, `${DEFAULT_LINE_SPLITTER}$&`);\n lines = lines.split(new RegExp(DEFAULT_LINE_SPLITTER, 'g')).filter(m => m).map(m => m.replace(/\\n$/, ''));\n\n const messages = [];\n\n // for each line parses the information as best as possible, creates an object Message and adds it to the messages array\n for (let line of lines) {\n let lastIndex = 0;\n let index = line.match(/,/).index;\n\n const date = line.slice(lastIndex,index).trim();\n lastIndex = index+1;\n index = line.match(/-/).index;\n\n const time = line.slice(lastIndex,index).trim();\n lastIndex = index+1;\n\n line = line.replace(/:/,'$');\n\n let user = DEFAULT_USER;\n // tries to get the message's text\n const match = line.match(/:/); // Fails if a system message contains ':', e.g. 5/7/17, 22:41 - Alvaro created group \"Grupo: de salir (official)\"\n if (match) {\n user = line.slice(lastIndex, match.index).trim();\n lastIndex = match.index+1;\n }\n\n const message = line.slice(lastIndex).trim();\n\n const isMedia = message == \"<Media omitted>\";\n const isUserMessage = user != \"System\";\n\n messages.push(new Message(date, time, user, message, isMedia, isUserMessage));\n }\n\n return messages;\n }", "protected internal function m252() {}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x3dcd7a87;\n this.SUBCLASS_OF_ID = 0x53fb4010;\n\n this.noWebpage = args.noWebpage || null;\n this.message = args.message;\n this.entities = args.entities || null;\n this.replyMarkup = args.replyMarkup || null;\n }", "function processMessage(node,msg) {\n var result = {};\n var f;\n f = msg.payload.trim();\n if (f) {\n try {\n result = processFragment(node,f);\n }\n catch (err) {\n result = {\"aisOriginal\": [f], \"errorInfo\": \"Javascript \"+err.name+\": \"+err.message};\n }\n if (result===null) {\n // Partial message\n msg.payload = undefined;\n msg.resultCode = 2;\n } else {\n if (result.errorInfo) {\n // Erroneous message\n msg.payload = undefined;\n msg.errorInfo = result.errorInfo;\n msg.originalAisMessage = result.aisOriginal;\n msg.resultCode = 3;\n } else {\n // Message decoded successfully\n msg.originalAisMessage = result.aisOriginal;\n delete result.aisOriginal;\n msg.payload = result;\n msg.payload.talkerId = msg.originalAisMessage[0].slice(1,3);\n msg.payload.sentenceId = msg.originalAisMessage[0].slice(3,6);\n msg.resultCode = 0;\n addTextFields(msg);\n }\n }\n } else {\n // Empty message\n msg.payload = undefined;\n msg.resultCode = 1;\n }\n node.send(msg);\n}", "constructor(message){\n\t\tthis.message = message;\n\t}", "constructor(message){\n\t\tthis.message = message;\n\t}", "function getLocalMessage(code){\n\tvar currentLanguage = LANGUAGE_ENGLISH;\n\tvar msg = '';\n\t\n\tif(code == MSG_ADD_DOG_NO_NAME){\n\t\tmsg = 'What a looovely dog!! What’s his name?';\n\t} else if(code == MSG_ADD_DOG_NO_BREED){\n\t\tmsg = 'Your dog is amaaazing!! What’s his breed?';\n\t} else if(code == MSG_ADD_DOG_NO_AGE){\n\t\tmsg = 'Your dog is adorable! How old is he?';\n\t} else if(code == MSG_ADD_DOG_NO_SIZE){\n\t\tmsg = 'Our scientists insist that you must declare your dog’s size as it is crucial for the Dog Fuel results!!';\n\t} else if(code == MSG_ADD_DOG_NO_GENDER){\n\t\tmsg = 'Hey there Pack leader, is that lovely dog a boy OR a girl?';\n\t} else if(code == MSG_ADD_DOG_NO_MATING){\n\t\tmsg = 'Love is in the air.. So is your dog in search for a Mate or not?';\n\t} else if(code == MSG_ADD_DOG_NO_PHOTO){\n\t\tmsg = 'Pack leader, we need a stunning pic of your doggie!';\n\t} else if(code == MSG_ADD_NOTE_NO_TITLE){\n\t\tmsg = 'Your dog insists that this note should have a tittle!';\n\t} else if(code == MSG_ADD_NOTE_NO_DESCRIPTION){\n\t\tmsg = 'Shouldn’t this note have a description?';\n\t} else if(code == MSG_ADD_NOTE_NO_DATE){\n\t\tmsg = 'Hey Pack leader, write down the note’s date please!!';\n\t} else if(code == MSG_ADD_NOTE_NO_TIME){\n\t\tmsg = 'Hey Pack leader, mark the note’s time please!!';\n\t} else if(code == MSG_ADD_PLACE_NO_NAME){\n\t\tmsg = 'Wouldn’t it be lovely if you named this place?';\n\t} else if(code == MSG_ADD_PLACE_NO_CATEGORY){\n\t\tmsg = 'Woof!! Mark the place using the right Category!';\n\t} else if(code == MSG_ADD_PLACE_NO_PHOTO){\n\t\tmsg = 'Woof! We need a picture of this place / incident!';\n\t} else if(code == MSG_FIND_FRIENDS_NO_CONTACTS_ACCESS){\n\t\tmsg = 'Woof! Dogsquare needs your permission to access your contacts. No worries we are not spying on you!';\n\t} else if(code == MSG_CAMERA_PROBLEM){\n\t\tmsg = 'Ooops! There seems to be a problem with your camera..';\n\t} else if(code == MSG_PWD_CHANGE_NO_PASSWORD){\n\t\tmsg = 'Hey Pack leader the current password is missing here!';\n\t} else if(code == MSG_PWD_CHANGE_NO_NEW_PASSWORD){\n\t\tmsg = 'Hey Pack leader,the new password is missing here!';\n\t} else if(code == MSG_RUN_NO_DOGS){\n\t\tmsg = 'Wouldn’t it be great if you selected at least one dog to go out with you !! Simply go to the right menu and pick from the pack!';\n\t} else if(code == MSG_RUN_END){\n\t\tmsg = 'Hey Pack leader, it is important that you Start your activity first!';\n\t} else if(code == MSG_REGISTER_NO_NAME){\n\t\tmsg = 'Don’t be so shy and tell us your first name..';\n\t} else if(code == MSG_REGISTER_NO_SURNAME){\n\t\tmsg = 'The Dogsquare Supercomputer says we need your surname too!';\n\t} else if(code == MSG_REGISTER_NO_EMAIL){\n\t\tmsg = 'Missing email!! The only thing a dog can’t actually find';\n\t} else if(code == MSG_REGISTER_NO_PASSWORD){\n\t\tmsg = 'Your Dog knows that you forgot to set up the password! But he can’t help us only you can.';\n\t} else if(code == MSG_REGISTER_NO_DOB){\n\t\tmsg = 'Hey don’t be shy and write down your date of birth..';\n\t} else if(code == MSG_REGISTER_NO_COUNTRY){\n\t\tmsg = 'Where are you from Pack leader?';\n\t} else if(code == MSG_REGISTER_NO_GENDER){\n\t\tmsg = 'What’s your Gender Pack Leader?';\n\t} else if(code == MSG_REGISTER_INVALID_EMAIL){\n\t\tmsg = 'Woof! That email address is wrong!';\n\t} else if(code == MSG_REGISTER_NO_PHOTO){\n\t\tmsg = 'Your super cool profile picture is missing!';\n\t} else if(code == MSG_REGISTER_NO_TERMS){\n\t\tmsg = 'For this relationship to work you must Agree to the Terms of Use & Privacy Policy..';\n\t} else if(code == MSG_RUN_NOT_ENDED){\n\t\tmsg = 'Hey Pack leader you must STOP your current activity to do that!';\n\t} else if(code == MSG_NO_MUTUAL_FOLLOWERS){\n\t\tmsg = 'Unfortunately You guys are not mutual followers..who knows things might change..';\n\t} else if(code == MSG_NOT_AVAILABLE_WITH_FACEBOOK){\n\t\tmsg = 'You can’t do this when logged in with Facebook.';\n\t} else if(code == MSG_NO_INTERNET_CONNECTION){\n\t\tmsg = 'Ooops! There seems to be a problem with your Internet connection!';\n\t} else if(code == MSG_FACEBOOK_ERROR){\n\t\tmsg = 'Ooops! There seems to be a problem with our Facebook access!';\n\t} else if(code == MSG_APP_REMINDER){\n\t\tmsg = 'Hey Pack Leader dont be Lazy! Move your Dog and go for a walk! DOG FUEL IS EARNED NOT GIVEN !!';\n\t} else if(code == MSG_APP_PASSPORT_REMINDER){\n\t\tmsg = 'Pack Leader you will be notified 24hours\\n in advance and in case you forget there\\n is a second reminder 1 hour before the\\n event takes place';\n\t}\n \n\treturn msg;\n}", "static get is() {return \"bbm-chat-header\";}", "function message() {\n _message.apply(null, messageArgs(arguments));\n }", "function ParseMsg(msg) {\n var data = new Object();\n msg = \".\" + msg; // Adding one character to make it easier to match the spec in EJU handbook.\n data.ProtoVer = msg.substr(2, 3);\n data.IDEvent = msg.substr(5, 20);\n data.Gender = msg.substr(25, 1);\n data.Category = msg.substr(26, 4);\n data.AgeGroup = msg.substr(30, 1);\n data.Round = msg.substr(21, 1);\n data.ContestID = msg.substr(32, 3);\n data.TimerFlag = msg.substr(35, 1);\n data.TimerMinute = msg.substr(36, 1);\n data.TimerSecond = msg.substr(37, 2);\n data.NationWhite = msg.substr(39, 3);\n data.IDWhite = msg.substr(42, 15);\n data.NameWhiteShort = msg.substr(57, 4);\n data.WRLWhite = msg.substr(61, 3);\n data.NameWhiteLong = msg.substr(64, 30);\n data.IpponWhite = msg.substr(94, 1);\n data.WazaWhite = msg.substr(95, 1);\n data.YukoWhite = msg.substr(96, 1);\n data.PenaltyWhite = msg.substr(97, 1);\n data.TimerOasaeWhite = msg.substr(98, 1);\n data.TeamScoreWhite = msg.substr(100, 1);\n data.NationBlue = msg.substr(101, 3);\n data.IDBlue = msg.substr(104, 15);\n data.NameBlueShort = msg.substr(119, 4);\n data.WRLBlue = msg.substr(123, 3);\n data.NameBlueLong = msg.substr(126, 30);\n data.IpponBlue = msg.substr(156, 1);\n data.WazaBlue = msg.substr(157, 1);\n data.YukoBlue = msg.substr(158, 1);\n data.PenaltyBlue = msg.substr(159, 1);\n data.TimerOsaeBlue = msg.substr(160, 2);\n data.TeamScoreBlue = msg.substr(162, 1);\n data.GoldenScore = msg.substr(163, 1);\n data.Winner = msg.substr(164, 1);\n data.IDReferee = msg.substr(165, 15);\n data.IDJudge1 = msg.substr(180, 15);\n data.IDJudge2 = msg.substr(195, 15);\n data.MatSending = msg.substr(210, 1);\n data.DisplayMode = msg.substr(211, 1); // 1 Logo, 6 Timer\n return (data);\n}", "function buildMessage ( ) {\n message += '<p class=\"quote\">' + randomQuote.quote + '</p>';\n message += '<p class=\"source\">' + randomQuote.source;\n if (\"citation\" in randomQuote) {\n message += '<span class=\"citation\">' + randomQuote.citation + '</span>';\n }\n if (\"year\" in randomQuote) {\n message += '<span class=\"year\">' + randomQuote.year + '</span>';\n }\n if (\"type\" in randomQuote) {\n message += '<span class=\"type\"> (' + randomQuote.type + ')</span>';\n }\n message += '</p>'\n}", "static get is() { return 'lingo-live-write-message'; }", "static metadataFromMessage(attributes) {\n return {\n name: attributes['googclient_schemaname'],\n encoding: attributes['googclient_schemaencoding'],\n };\n }", "message() {\n //we must allocate a pointer in memory for the string result\n const pointer = module.__retain(module.__allocString(message));\n return pointer;\n }", "static _sanitizeErrorMessage(message) {\n if (message === 'Network Error') {\n return 'Cross origin request to Authorization Server failed - please check configuration'\n }\n \n return message;\n }", "makeMessage(content) {\n const username = this.state.currentUser.name\n const type = 'postMessage';\n return {\n type,\n username,\n content\n }\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x764cf810;\n this.SUBCLASS_OF_ID = 0xc4910f88;\n\n this.message = args.message;\n this.entities = args.entities || null;\n this.replyMarkup = args.replyMarkup || null;\n }", "function parseOldMessage(message) {\n var legalContent = message.replace(incomingFilter, '');\n var match, username, content;\n if (match = legalContent.match(/^<(?:.+? )?(.+?)> (.*)$/)) {\n // spoken chat\n username = match[1];\n content = match[2];\n bot.emit('chat', username, content, message);\n } else if (match = legalContent.match(/^(?:.+? )?(.+?) (?:whispers to you:|whispers) (.*)$/)) {\n // whispered chat\n username = match[1];\n content = match[2];\n bot.emit('whisper', username, content, message);\n }\n }", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin)\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin)\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin)\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function SeamonkeyImportMail() {}", "function message(reason, position, origin) {\n var message = new VMessage(reason, position, origin);\n\n if (this.path) {\n message.name = this.path + ':' + message.name;\n message.file = this.path;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message\n}", "getMessageProps() {\n throw new Error('Not implemented, Override is required.')\n }", "function verifyGithubMessage () {\n\t// TODO: implement\n}", "constructor(message) {\n\t\tsuper(message);\n\t}", "function buildMessage (post) {\n let data = {\n 'response_type': 'in_channel',\n 'text': '<'+post.url+'|'+ post.title +'>',\n 'unfurl_links': true,\n 'unfurl_media': true,\n 'attachments': [\n {\n 'pretext': post.selftext,\n 'text': 'Fresh from ' + post.subreddit_name_prefixed + '! <https://www.reddit.com'+post.permalink+'|See on Reddit>',\n 'author_name': 'posted by ' + post.author.name + ' | Score: ' + post.score + ' | Comments: ' + post.num_comments,\n 'ts': post.created,\n 'footer': 'The Morning Bunch :green_heart:',\n 'color': '#439FE0'\n }\n ]\n };\n if(post.over_18) {\n // will need to change this again, to update the text\n data = {\n 'response_type': 'ephemeral',\n 'text': 'Oops, we can\\'t show you this content :flushed:',\n 'attachments': [\n {\n 'text': ':thinking_face: You may want to try something else.',\n 'footer': 'The Morning Bunch :green_heart:',\n 'color': 'danger'\n }\n ]\n }\n }\n return data;\n}", "makeMessage(item) {\n let count =\n item.count === \"1\" || item.count === \"\"\n ? \"\"\n : \"\\n\\n\" + item.count + \" مرات \";\n\n let reference = !item.reference ? \"\" : \"\\n\\n\" + \" رواة \" + item.reference;\n\n return (\n \"[ - \" + item.category + \" - ]\" + \"\\n\\n\" + item.zekr + count + reference\n );\n }", "function BaseMessage() {\n\n setuptools.lightbox.build('muledump-about', 'You are on the latest release.<br>');\n\n }", "function Message(text){\r\n this.createdBy = currentLocation.what3words;\r\n this.latitude = currentLocation.latitude;\r\n this.longitude = currentLocation.longitude;\r\n this.createdOn = Date.now();\r\n this.expiresOn = this.createdOn + (1000 /*sec*/ * 60 /*min*/ * 15 /*hour*/ * 1 /*day*/ * 1);\r\n this.text = text;\r\n this.own = true;\r\n}", "function findName(data) {\n\t\tvar i1 = data.message.indexOf('%')+1;\n\t\tvar i2 = data.message.indexOf('%', i1);\n\t\tvar targetName = data.message.slice(i1, i2);\n\t\tdata.message = data.message.slice(i2+1);\n\t\treturn targetName;\n\t}", "function parseI18nMeta() {\n var meta = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var customId;\n var meaning;\n var description;\n meta = meta.trim();\n\n if (meta) {\n var idIndex = meta.indexOf(I18N_ID_SEPARATOR);\n var descIndex = meta.indexOf(I18N_MEANING_SEPARATOR);\n var meaningAndDesc;\n\n var _ref15 = idIndex > -1 ? [meta.slice(0, idIndex), meta.slice(idIndex + 2)] : [meta, ''];\n\n var _ref16 = Object(C_Users_Abid_Loqmen_Desktop_NGforce_thesis_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_ref15, 2);\n\n meaningAndDesc = _ref16[0];\n customId = _ref16[1];\n\n var _ref17 = descIndex > -1 ? [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)] : ['', meaningAndDesc];\n\n var _ref18 = Object(C_Users_Abid_Loqmen_Desktop_NGforce_thesis_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_ref17, 2);\n\n meaning = _ref18[0];\n description = _ref18[1];\n }\n\n return {\n customId: customId,\n meaning: meaning,\n description: description\n };\n} // Converts i18n meta information for a message (id, description, meaning)", "textForApiErrorCode(message) {\n\n if (message == undefined) {\n return getTranslatedMessage(\"site_err_occupied\");\n }\n if (message.indexOf(\"the request transport encountered an error communicating with Stitch: Network request failed\") != -1) {\n return getTranslatedMessage(\"site_err_no_internet\");\n }\n if (message.indexOf(\"method called requires being authenticated\") != -1) {\n return getTranslatedMessage(\"site_err_expired_session\");\n }\n if (message.indexOf(\"invalid username/password\") != -1) {\n return getTranslatedMessage(\"site_err_credentials\");\n }\n if (message.indexOf(\"failed to confirm user\") != -1) {\n return getTranslatedMessage(\"site_err_invalid_user\");\n }\n if (message.indexOf(\"password must be between 6 and 128 characters\") != -1) {\n return getTranslatedMessage(\"site_err_password_size\");\n }\n if (message.indexOf(\"name already in use\") != -1) {\n return getTranslatedMessage(\"site_err_user_already_exists\");\n }\n if (message.indexOf(\"invalid token data\") != -1) {\n return getTranslatedMessage(\"site_err_invalid_token\");\n }\n if (message.indexOf(\"already confirmed\") != -1) {\n return getTranslatedMessage(\"site_err_email_already_registered\");\n }\n if (message.indexOf(\"userpass token is expired or invalid\") != -1) {\n return getTranslatedMessage(\"site_err_expired_token\");\n }\n if (message.indexOf(\"user not found\") != -1) {\n return getTranslatedMessage(\"site_err_user_not_exists\");\n }\n if (message.indexOf(\"bad argument\") != -1) {\n return getTranslatedMessage(\"site_err_bad_request\");\n }\n\n return getTranslatedMessage(\"site_err_unknown_error\") + \" (\" + message + \")\";\n }", "handleMessage(arg) {\n const message = Message.getFromMessage(arg);\n switch (message.title) {\n case Message.installedMessageLastRoundTitle:\n this.learntHasInstalledUpdate(message);\n break;\n default:\n return message;\n }\n return null;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x3380c786;\n this.SUBCLASS_OF_ID = 0x53fb4010;\n\n this.message = args.message;\n this.entities = args.entities || null;\n this.replyMarkup = args.replyMarkup || null;\n }", "function resolve_message(message){\n //is the users question about the bot\n for( question in response_file ){\n if( -1 !== message.indexOf(question) ){\n for( var keyword in response_file[question] ){\n if( -1 !== message.indexOf( keyword) ){\n return response_file[question][keyword];\n }\n }\n }\n }\n return \"I don't understand what you mean.\"\n}", "handleMessage(e){\n\n console.log(\"received message with id: \", e.data.id, \"; message was: \", e);\n\n switch (e.data.id) {\n\n case \"quantization\":\n this._quantOpt = e.data.quantOpt;\n this._quantBits = e.data.quantBits;\n break;\n\n case \"reverseK\":\n this._reverseKOpt = e.data.reverseKOpt;\n break;\n\n case \"perfectSynth\":\n this._perfectSynthOpt = e.data.perfectSynthOpt;\n break;\n\n case \"resampling\":\n this._resamplingFactor = e.data.resampFactor;\n this._resampler.update(this._resamplingFactor);\n break;\n\n case \"voicedThreshold\":\n this._confidenceTonalThreshold = e.data.voicedThreshold;\n break;\n\n case \"pitchFactor\":\n this._pitchFactor = e.data.pitchFactor;\n break;\n\n case \"voiceMap\":\n // Voiced / Unvoiced Synthesis\n this._unvoicedMix = e.data.unvoicedMix;\n this._confidenceTonalThreshold = e.data.voicedThreshold;\n // Resampling (vocal tract length)\n if (e.data.vocalTractFactor != this._resamplingFactor){\n this._resamplingFactor = e.data.vocalTractFactor;\n this._resampler.update(this._resamplingFactor);\n }\n // Pitch modifier\n this._pitchFactor = e.data.pitchFactor;\n // Vibrato\n //e.data.vibratoEffect;\n break;\n\n case \"options\":\n // Receive all options\n this._perfectSynthOpt = e.data.perfectSynthOpt;\n this._quantOpt = e.data.quantOpt;\n this._quantBits = e.data.quantBits;\n this._reverseKOpt = e.data.reverseKOpt;\n if (e.data.vocalTractFactor != this._resamplingFactor){\n this._resamplingFactor = e.data.vocalTractFactor;\n this._resampler.update(this._resamplingFactor);\n }\n this._confidenceTonalThreshold = e.data.voicedThreshold;\n this._pitchFactor = e.data.pitchFactor;\n break;\n\n\n default: // any unknown ID: log the message ID\n console.log(\"unknown message received:\")\n console.log(e.data)\n }\n }", "on_message(message) {\r\n }", "on_message(message) {\r\n }", "on_message(message) {\r\n }", "function getMessage() {\n return message;\n }", "function message(reason, position, origin) {\n var filePath = this.path\n var message = new VMessage(reason, position, origin)\n\n if (filePath) {\n message.name = filePath + ':' + message.name\n message.file = filePath\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n}", "function formatMessage(txt) {\n return txt\n}", "function message(text) {\r\n this.createdBy = currentLocation.what3words;\r\n this.latitude = currentLocation.latitude;\r\n this.longitude = currentLocation.longitude;\r\n this.createdOn = new Date();\r\n this.exipresOn = new Date(Date.now() + 15 * 60 * 1000);\r\n this.text = text;\r\n this.own = true;\r\n}", "function formatMessage(username, message) {\n\tmessage = \"@\" + username + \" \" + message;\n\treturn (message.length <= 140) ? message : (message.substring(0,137) + \"...\");\n}", "function SpecialMessage(props) {\n return e('div', {className: 'message'}, props.message);\n}", "function u(a,b,c){this.code=ua+a;this.message=b||va[a]||\"\";this.a=c||null}", "function parseMessage(buffer){\n var result={malformed:true}\n , actionMatch\n , str = buffer.toString()\n , match = messagePattern.exec(str) \n ;\n \n if(!match || isNaN(Date.parse(match[2]))) return result;\n\n //result.pri = match[1];\n result.time = new Date(match[2]);\n result.cat = match[3].toUpperCase();\n //result.severity = match[4];\n //result.logId = match[5];\n //result.revision = match[6];\n // I have not removed these commented properties for later they might be used, and one could just uncomment them.\n result.event = match[7].toUpperCase();\n if(actionPattern.test(match[8])){\n actionMatch = actionPattern.exec(match[8]);\n result.action = actionMatch[1].toUpperCase();\n result.message = actionMatch[2];\n }else{\n result.message = match[8];\n } \n delete result.malformed;\n result.message = match[0]; // complete message is requested in requirements.\n return result;\n}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xfd8e711f;\n this.SUBCLASS_OF_ID = 0x33d47f45;\n\n this.noWebpage = args.noWebpage || null;\n this.replyToMsgId = args.replyToMsgId || null;\n this.message = args.message;\n this.entities = args.entities || null;\n this.date = args.date;\n }", "function message() {\n return `Hello! We only serve whirled peas. Generated: ${new Date().toString()}`\n}", "function message(reason, position, origin) {\n var filePath = this.path;\n var message = new VMessage(reason, position, origin);\n\n if (filePath) {\n message.name = filePath + ':' + message.name;\n message.file = filePath;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message;\n}", "function message(reason, position, origin) {\n var filePath = this.path;\n var message = new VMessage(reason, position, origin);\n\n if (filePath) {\n message.name = filePath + ':' + message.name;\n message.file = filePath;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message;\n}", "function message(reason, position, origin) {\n var filePath = this.path;\n var message = new VMessage(reason, position, origin);\n\n if (filePath) {\n message.name = filePath + ':' + message.name;\n message.file = filePath;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message;\n}", "function message(reason, position, origin) {\n var filePath = this.path;\n var message = new VMessage(reason, position, origin);\n\n if (filePath) {\n message.name = filePath + ':' + message.name;\n message.file = filePath;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message;\n}", "function message(reason, position, origin) {\n var filePath = this.path;\n var message = new VMessage(reason, position, origin);\n\n if (filePath) {\n message.name = filePath + ':' + message.name;\n message.file = filePath;\n }\n\n message.fatal = false;\n\n this.messages.push(message);\n\n return message;\n}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x1cc6e91f;\n this.SUBCLASS_OF_ID = 0x21ca8ed8;\n\n this.media = args.media;\n this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);\n this.message = args.message;\n this.entities = args.entities || null;\n }", "function isKnownMessage(data, name) {\n return data && data.type === 'parse' && data.source && data.source.startsWith('loaders.gl');\n}", "function messageParser(messageData){\n // console.log(`Message: ${messageData.message}`);\n const parsedInput = messageData.message.split(\" \");\n\n if(parsedInput.includes(keyWords[0])){\n // ...messageData is copied instead of referenced. @Pyro240\n outgoingQEnforcer.addItem(messageMutator(messageData, \n `${keyWords[0]} ${keyWords[0]} ${keyWords[0]} ${keyWords[0]}`));\n }\n else if(parsedInput.includes(keyWords[1])){\n outgoingQEnforcer.addItem(messageMutator(messageData, \n `PJSalt PJSalt PJSalt PJSalt`));\n }\n\n if(parsedInput[0][0] === \"!\"){ commandParser(messageData); }\n \n}", "static get __resourceType() {\n\t\treturn 'MessageHeader';\n\t}", "function prepareEventMessage(message, status, use_placeholder, summary) {\n\tif (summary) {\tmessage = message.replace(summary, (use_placeholder) ? '[-SUMMARY-]' : ''); }\n\tif (status.durration.parsed !== null) { message = message.replace(status.durration.parsed, (use_placeholder) ? '[-DATES-]' : ''); }\n\tif (status.alt_instructions.raw !== null) { message = message.replace(status.alt_instructions.raw, (use_placeholder) ? '[-ALT-INSTRUCT-]' : ''); }\n\tif (status.ad_message !== null) {\tmessage = message.replace(status.ad_message, (use_placeholder) ? '[-AD-MESSAGE-]' : ''); }\n\n\treturn message.trim();\n}", "static parse(message) {\n let i = 0;\n const keys = {};\n for (const k in messageParse_1.DEFAULT_DELIMITERS) {\n keys[k] = false;\n }\n const entities = [];\n const tempEntities = {};\n while (i < message.length) {\n let foundIndex = -1;\n let foundDelim = undefined;\n for (const key of Object.keys(messageParse_1.DEFAULT_DELIMITERS)) {\n const index = message.indexOf(key, i);\n if (index > -1 && (foundIndex === -1 || index < foundIndex)) {\n foundIndex = index;\n foundDelim = key;\n }\n }\n if (foundIndex === -1 || foundDelim == undefined) {\n break;\n }\n if (!keys[foundDelim]) {\n tempEntities[foundDelim] = new messageParse_1.DEFAULT_DELIMITERS[foundDelim]({\n offset: foundIndex,\n length: -1,\n language: \"\",\n });\n keys[foundDelim] = true;\n }\n else {\n keys[foundDelim] = false;\n tempEntities[foundDelim].length =\n foundIndex - tempEntities[foundDelim].offset;\n entities.push(tempEntities[foundDelim]);\n }\n message = message.replace(foundDelim, \"\");\n i = foundIndex;\n }\n return [message, entities];\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xfae69f56;\n this.SUBCLASS_OF_ID = 0x8680d126;\n\n this.message = args.message;\n }", "_createMessage() {\n let messageArr = ['абонент', 'абонента', 'абонентов'];\n\n function createMessage(number, startWord) {\n let endMessage = null;\n let startMessage = (number === 1) ? startWord : (startWord + \"o\");\n\n if(number === 1) {\n endMessage = messageArr[0];\n } else if (number == 12\n || number == 13\n || number == 14) {\n\n endMessage = messageArr[2];\n } else if( number.toString()[number.toString().length - 1] === '2'\n || number.toString()[number.toString().length - 1] === '3'\n || number.toString()[number.toString().length - 1] === '4') {\n\n endMessage = messageArr[1];\n } else {\n endMessage = messageArr[2];\n }\n\n return startMessage + \" \" + number + \" \" + endMessage;\n }\n\n noty({\n text: createMessage( (this._correctData.length), 'Загружен'),\n type: 'success',\n timeout: '3000'\n });\n\n if(this._inCorrectData.length) {\n noty({\n text: createMessage( (this._inCorrectData.length - 1), 'Не загружен'),\n type: 'error',\n timeout: '3000'\n });\n }\n }", "constructor(shortName, longName = undefined) {\r\n\t\tthis.name = shortName;\r\n\t\tif (longName) {\r\n\t\t\tthis.message = longName;\r\n\t\t}\r\n\t}", "function parsePythonMessage(msg) {\n \tvar obj = JSON.parse(msg);\n \tvar _type = obj[\"type\"];\n\n\tswitch(_type) {\n\t\tcase \"progress-message\":\n\t\t\tcurrRun.statusMessage = obj[\"content\"];\n\t\t\tbreak;\n\t\tcase \"progress\":\n\t\t\tcurrRun.total = parseInt(obj[\"content\"]);\n\t\t\tbreak;\n\t} \t\n }", "handleMessages(messages) {\n\n }", "function makeMessageSelf(message)\n{\n\tvar html = '<div class=\"message\">';\n\thtml += '<img class=\"avatar_self\" src=\"images/avatar1.png\" alt=\"' + username + '\">';\n\thtml = html + '<div class=\"from_user_self\">' + username + '</div>';\n\n\t// Show emoticon message\n\tif(message.substring(0,9) == \"emoticon:\")\n\t{\n\t\tvar image = message.substring(9);\n\t\thtml = html + '<img src=\"images/emoticons/' + image + '\" class=\"emoticon_self_message\">';\n\t}\n\n\t// Show image message\n\telse if(message.substring(0,7) == \"upload:\")\n\t{\n\t\tvar imageURI = message.substring(7);\n\t\thtml = html + '<img scr=\"' + imageURI + '\" class=\"image_self_message\">';\n\t}\n\n\t// Show text message\n\telse\n\t\thtml = html + '<div class=\"from_message_self\">' + message + '</div>';\n\thtml += \"</div>\";\n\treturn html;\n}", "private public function m246() {}", "function AnalyzeMessage(msg) {\r\n // Parse needed data\r\n let originalContent = msg.textContent.split(\"(\")[0].trim();\r\n let textmsg = originalContent.toLowerCase();\r\n let types = msg.classList;\r\n let sender = msg.getAttribute(\"data-sender\");\r\n let chatroomMembers = ChatRoomCharacter.map(el => el.MemberNumber.toString());\r\n let commandCall = (cursedConfig.commandChar + cursedConfig.slaveIdentifier + \" \").toLowerCase();\r\n let isMistress = cursedConfig.mistresses.includes(sender.toString());\r\n let isClubOwner = Player.Owner && Player.Ownership && (Player.Ownership.MemberNumber == sender);\r\n let isOwner = cursedConfig.owners.includes(sender.toString()) || isClubOwner;\r\n let isOnEntry = types.contains(\"ChatMessageEnterLeave\") && sender == Player.MemberNumber;\r\n let isActivated = !(cursedConfig.mistressIsHere && cursedConfig.disaledOnMistress)\r\n && ((cursedConfig.enabledOnMistress && cursedConfig.ownerIsHere) || !cursedConfig.enabledOnMistress);\r\n\r\n //Ignores special types for compatibility or LARP\r\n if (types.contains(\"ChatMessageGlobal\") || types.contains(\"ChatMessageLocalMessage\") || types.contains(\"ChatMessageServerMessage\")) {\r\n return;\r\n }\r\n\r\n // Clears whisper text\r\n if (sender == Player.MemberNumber && (types.contains(\"ChatMessageWhisper\") || types.contains(\"ChatMessageChat\"))) {\r\n textmsg = textmsg.split(\":\");\r\n textmsg.shift();\r\n textmsg = textmsg.join(\":\");\r\n }\r\n\r\n // Clears stuttering + * from emote and action\r\n textmsg = textmsg.replace(/[A-Za-z]-/g, \"\").replace(/^\\*/g, \"\").replace(/\\*$/g, \"\");\r\n\r\n // Checks if player should be kneeling\r\n if (\r\n (types.contains(\"ChatMessageEnterLeave\") && cursedConfig.charData.some(u => u.Number == sender && u.isEnforced) || isOnEntry && chatroomMembers.some(el => cursedConfig.charData.some(u => u.Number == el && u.isEnforced)))\r\n && Player.CanKneel()\r\n && (!Player.Pose.includes(\"Kneel\") || !Player.Pose.includes(\"ForceKneel\"))\r\n ) {\r\n checkKneeling(sender);\r\n }\r\n\r\n // Sends intro if the wearer has one\r\n if (\r\n isOnEntry && cursedConfig.hasEntryMsg && !cursedConfig.hasFullMuteChat\r\n && isActivated && !cursedConfig.isMute && !cursedConfig.hasSound\r\n ) {\r\n cursedConfig.say = cursedConfig.entryMsg;\r\n /** @type {HTMLTextAreaElement} */ (document.getElementById(\"InputChat\")).value = cursedConfig.entryMsg;\r\n }\r\n\r\n // Sends activated messages to an owner who enters or if the wearer entered\r\n if (types.contains(\"ChatMessageEnterLeave\")) {\r\n //Warn only if the player is not aware\r\n if ((cursedConfig.owners.includes(sender) || cursedConfig.mistresses.includes(sender)) && chatroomMembers.includes(sender) && !cursedConfig.warned.includes(sender)) {\r\n sendWhisper(sender, { Tag: \"MsgCheckActiveMsg\", Param: [commandCall] });\r\n cursedConfig.warned.push(sender);\r\n }\r\n if (sender == Player.MemberNumber) {\r\n NotifyOwners({ Tag: \"MsgCheckActiveMsg\", Param: [commandCall] });\r\n // Pop saved messages while outside of room\r\n popChatSilent();\r\n // Kneels if you have cursedcollar to prevent login issues\r\n if (cursedConfig.hasCursedKneel)\r\n KneelAttempt();\r\n }\r\n }\r\n\r\n // Checks for commands to change settings if able to\r\n if (\r\n (types.contains(\"ChatMessageChat\") || types.contains(\"ChatMessageWhisper\"))\r\n && textmsg.toLowerCase().indexOf(commandCall.toLowerCase()) != -1\r\n && cursedConfig.blacklist.indexOf(sender) == -1\r\n && !Player.BlackList.includes(sender)\r\n ) {\r\n // Parses the command\r\n let command;\r\n let parameters;\r\n try {\r\n let commandString = textmsg.split(commandCall)[1];\r\n command = commandString.split(\" \")[0];\r\n parameters = commandString.split(\" \");\r\n parameters.shift();//THROWS HERE IF COMMAND IS BAD\r\n\r\n //Quit loop to prevent wearer from doing the rest (can't add self as owner)\r\n if (sender == Player.MemberNumber) {\r\n return;\r\n }\r\n\r\n //Global warning to prevent spam.\r\n if (types.contains(\"ChatMessageChat\") && ChatRoomCharacter.length > 2) {\r\n sendWhisper(sender, { Tag: \"MsgCheckErrorNonWhisper\" }, true);\r\n return;\r\n }\r\n\r\n // Do not allow blacklisted commands\r\n if (!CommandIsActivated(command, sender)) return;\r\n\r\n let needWarning = true;\r\n\r\n /* Will not cascade if a command was already found */\r\n\r\n // Verifies club owner commands\r\n if (isClubOwner && needWarning) {\r\n needWarning = ClubOwnerCommands({ command, parameters, sender, commandCall });\r\n }\r\n\r\n if (isOwner && needWarning) {\r\n needWarning = PrivateCommands({ command, parameters, sender });\r\n }\r\n\r\n // Verifies owner for private commands\r\n if (isOwner && needWarning) {\r\n needWarning = OwnerCommands({ command, parameters, sender, commandCall, isClubOwner });\r\n }\r\n\r\n //Verify mistress for private commands\r\n if ((isMistress || isOwner || cursedConfig.hasFullPublic) && needWarning) {\r\n needWarning = MistressCommands({ command, sender, parameters, isOwner, isClubOwner });\r\n }\r\n\r\n // Checks if public has access or mistress can do all\r\n if ((cursedConfig.hasPublicAccess || isMistress || isOwner) && needWarning) {\r\n needWarning = PublicCommands({ command, sender, commandCall, parameters, isOwner, isMistress });\r\n }\r\n\r\n //Perma commands for all\r\n if (needWarning) {\r\n needWarning = AllCommands({ command, sender, commandCall, parameters });\r\n }\r\n\r\n //Warn an attempt was made but no command was found\r\n if (needWarning) {\r\n sendWhisper(sender, {\r\n Tag: \"MsgCheckCommandInvalid\",\r\n Param: [\r\n isClubOwner ? \"Yes\" : \"No\",\r\n isOwner ? \"Yes\" : \"No\",\r\n isOwner || isMistress ? \"Yes\" : \"No\",\r\n cursedConfig.hasPublicAccess ? \"Yes\" : \"No\",\r\n cursedConfig.hasFullPublic ? \"Yes\" : \"No\"\r\n ]\r\n }, true);\r\n } else if (cursedConfig.isEatingCommands) {\r\n msg.style.display = \"none\";\r\n }\r\n\r\n } catch (err) { console.error(\"Curse: \" + err); }\r\n\r\n } else if (isActivated) {\r\n //Stuff that only applies to self\r\n if (sender == Player.MemberNumber) {\r\n //Mute\r\n if (cursedConfig.isMute && textmsg.length != 0 && types.contains(\"ChatMessageChat\")) {\r\n SendChat({ Tag: \"MsgCheckAngerMute\" });\r\n TriggerPunishment(1);\r\n }\r\n }\r\n\r\n let words = (textmsg.toLowerCase().replace(/(\\.)|(-)/g, \"\").replace(/(')|(,)|(~)|(\")|(!)|(\\?)/g, \" \").match(/[^\\s]+/g) || []);\r\n if (\r\n !!cursedConfig.triggerWord.word &&\r\n words.includes(cursedConfig.triggerWord.word) &&\r\n !types.contains(\"ChatMessageEmote\")\r\n ) {\r\n let isTriggered = cursedConfig.triggerWord.lastTrigger + cursedConfig.triggerWord.triggerDuration > Date.now();\r\n if (words.includes(\"unfreeze\") && sender != Player.MemberNumber) {\r\n if (isTriggered) {\r\n SendChat({ Tag: \"MsgCheckUnfreezeAction\" });\r\n }\r\n cursedConfig.triggerWord.lastTrigger = 0;\r\n } else {\r\n if (!isTriggered) {\r\n SendChat({ Tag: \"MsgCheckFreezeAction\" });\r\n } else {\r\n popChatSilent({ Tag: \"MsgCheckFreezeReset\" });\r\n }\r\n cursedConfig.triggerWord.lastTrigger = Date.now();\r\n }\r\n }\r\n }\r\n}", "respond (message)\n {\n throw new Error('Not implemented');\n }", "function ukip() {\n return message;\n}", "function formToMessageContent(formData){\n //Compile content to be posted\n var content = formData.Question\n if (formData.Code)\n content += \"\\n```\" + `${formData.Language}\\n${formData.Code}\\n` + \"```\" \n if (formData.Error)\n content += \"\\nError Message:\\n```\" + `\\n${formData.Error}\\n` + \"```\"\n if (content.length > discordConstants.messageMaxLength)\n throw Error(`Your message (${content.length} chars) is too long (${discordConstants.messageMaxLength} max)`);\n\n return content;\n}", "function formatMsg(data) {\r\n let fullmsg = \"\";\r\n data.message.message.map(msg => {\r\n fullmsg += msg.text;\r\n });\r\n return fullmsg.trim().replace(/ +/g, \" \");\r\n}", "getMessage() {\n var message = _message;\n _message = '';\n return message;\n }", "function finalMessage (name, printSign, message){\n return (\"Hello \" + name + \"! Your sign is \" + printSign + \" and your horoscope message is: \" + message);\n}", "deliver() {\n return \"Deliver by land in a box.\";\n }", "createInviteMessage() {\n if (this.props.isContentCreator) {\n return <h4 align=\"center\">Would you like to provide an argument to further support your view?</h4>;\n } else {\n const contentType = this.props.contentType.toLowerCase();\n\n return <h4 align=\"center\">{`Do you agree or disagree with this ${contentType}?`}</h4>;\n }\n }", "parseMessage(msg) {\n const data = msg.getData();\n let parsed_data;\n if (typeof data === 'string') {\n parsed_data = JSON.parse(data);\n } else {\n parsed_data = JSON.parse(data.toString('utf8'));\n }\n return parsed_data\n\n\n }", "function f(t,e){if(\"function\"==typeof t)return t(e);for(var r=0,n=Object.keys(e);r<n.length;r++){var o=n[r];\"message\"!==o&&(t=t.replace(\"{\"+o.toUpperCase()+\"}\",e[o]))}return t}", "function Tut_GetBlankMessage()\n{\n\t//crete a new object\n\tvar theMessage = new Object();\n\t//fill it in\n\ttheMessage.Type = __NEMESIS_MessageType_Basic;\n\ttheMessage.HTMLContent = \"\";\n\ttheMessage.SoundFile = null;\n\ttheMessage.EventTimer = 0;\n\ttheMessage.DisableModalConversionToTimer = false;\n\t//return it\n\treturn theMessage;\n}" ]
[ "0.6174593", "0.59013885", "0.5868048", "0.5834933", "0.5805863", "0.56934065", "0.5690003", "0.5679782", "0.56313413", "0.56300515", "0.5576313", "0.55373293", "0.5485271", "0.5461559", "0.5460439", "0.5451381", "0.5451381", "0.54372203", "0.54282784", "0.54224247", "0.54189205", "0.5417797", "0.53983444", "0.5391833", "0.5390179", "0.537952", "0.537952", "0.5375843", "0.5374505", "0.53676647", "0.53577316", "0.5354391", "0.53543526", "0.5352118", "0.53331417", "0.53266746", "0.5325474", "0.53192735", "0.53184474", "0.5314652", "0.5314652", "0.5314652", "0.53006405", "0.52997136", "0.52947134", "0.5292388", "0.5290156", "0.52711964", "0.52700543", "0.52605104", "0.52579916", "0.52557874", "0.52554274", "0.5249605", "0.52492964", "0.52434564", "0.5243452", "0.5241343", "0.5240642", "0.5240642", "0.5240642", "0.52343696", "0.52313095", "0.52285004", "0.5224215", "0.5222152", "0.52208143", "0.5219927", "0.521862", "0.5216618", "0.5216256", "0.5215473", "0.5215473", "0.5215473", "0.5215473", "0.5215473", "0.5212144", "0.5210019", "0.5207318", "0.52063286", "0.5205418", "0.519785", "0.5196618", "0.51859814", "0.5185499", "0.51844704", "0.5179819", "0.51760584", "0.5173328", "0.5169537", "0.5169403", "0.51689065", "0.51624554", "0.51611847", "0.51607126", "0.5155906", "0.5144886", "0.5143788", "0.5143011", "0.51419026", "0.51403445" ]
0.0
-1
a little function to help the stubbed out routes
function getThing (thing) { return function (req, res) { res.render(thing); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "doRoute() {\n let routename = 'HTTP:' + this.request.method + ':' + this.url.pathname;\n this.run(routename, this.restnio.routes, \n Parser.parseFullHttpParams, this.request, this.url);\n }", "route() {\n this.router\n .route('/:id/accounts')\n .get(validateToken, verifyIsClient, this.userController.getAccounts)\n .post(\n validateToken,\n verifyIsClient,\n createAccountValidator,\n validate,\n this.userController.createAccount,\n );\n\n this.router\n .route('/:id/accounts/:accountNumber/transactions')\n .get(validateToken, verifyIsClient, this.userController.accountHistory);\n\n this.router\n .route('/:id/transactions/:transId')\n .get(validateToken, verifyIsClient, this.userController.specificTranHist);\n\n this.router\n .route('/:id/accounts/:accountNumber')\n .get(validateToken, verifyIsClient, this.userController.specAcctDetails);\n\n this.router\n .route('/:id/confirmEmail/:token')\n .get(\n setHeadersparams2,\n validateToken,\n verifyIsClient,\n this.userController.confirmEmail,\n );\n\n this.router\n .route('/:id/changePassword')\n .patch(\n validateToken,\n verifyIsClient,\n changePasswordValidator,\n validate,\n this.userController.changePassword,\n );\n\n this.router\n .route('/:id/transactions/:accountNumber/transfer')\n .post(\n validateToken,\n verifyIsClient,\n transferFundValidator,\n validate,\n this.userController.transferFunds,\n );\n\n this.router\n .route('/:id/transactions/:accountNumber/airtime')\n .post(\n validateToken,\n verifyIsClient,\n airtimeValidator,\n validate,\n this.userController.buyAirtime,\n this.staffController.debitAccount,\n );\n\n this.router\n .route('/:id/upload')\n .post(upload.single('passport'), this.userController.uploadPassport);\n\n return this.router;\n }", "static registerLegacyRouteHandler() {}", "function main() {\n getRoutes();\n}", "_updateRouter(route) {\n\n /*\n (R.intersection(getMetods(route), verbs)).forEach(routeVerb => {\n route.log(`found route handler for '${routeVerb}' method`);\n route.router[routeVerb]('/', route[routeVerb].bind(route));\n });\n */\n\n this._getMethods(route).forEach(method => {\n let verb = this._startsWithVerb(method);\n if (verb) {\n let spec = this._routeify(method);\n if (spec) {\n route.log(`found route handler for '${spec.verb}' method`);\n route.router[spec.verb](spec.route, route[method].bind(route));\n }\n }\n });\n }", "initRoutes(app, ctx) {\n app.get(\"/register\", async (req, res, ctx) => {\n res.send(\n await ctx.call(\"webhooks.register\", {\n targetUrl: ctx.params.targetUrl,\n })\n );\n });\n app.get(\"/list\", async (req, res, ctx) => {\n res.send(await ctx.call(\"webhooks.list\"));\n });\n app.get(\"/update\", async (req, res, ctx) => {\n res.send(await ctx.call(\"webhooks.update\", { id: ctx.params.id }));\n });\n app.get(\"/delete\", async (req, res, ctx) => {\n res.send(\n await ctx.call(\"webhooks.delete\", {\n id: ctx.params.id,\n targetUrl: ctx.params.targetUrl,\n })\n );\n });\n app.get(\"/ip\", async (req, res, ctx) => {\n res.send(\n await ctx.call(\"webhooks.trigger\", {\n ip:\n req.headers[\"x-forwarded-for\"] ||\n req.socket.remoteAddress ||\n null,\n })\n );\n });\n // debug\n app.get(\"/helloTest\", async (req, res, ctx) => {\n res.send(await ctx.call(\"webhooks.hello\"));\n });\n app.get(\"/exptest\", (req, res) => {\n res.send(\"express routing\");\n });\n }", "initializeRouter() {\n this.testRouter.get('/', function (req, res) {\n res.status(200).json({\n test: \"Happy hacking!\"\n });\n })\n\n }", "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 }", "routes() {\n let router = express.Router();\n //palceholder route handler\n router.get('/', (req, res, next) => {\n res.json({\n message: 'Hello World!'\n });\n });\n this.express.use('/', router);\n }", "get(...args) {\n this.route('get', ...args);\n }", "setupRoute(route) {\n let controller = this.controllers[route.controller];\n let action = controller[route.action] || this.defaultAction;\n let authMethod = (req, res, next) => {\n return next();\n };\n if (route.authentication && route.authentication.controller && route.authentication.action) {\n authMethod = this.controllers[route.authentication.controller][route.authentication.action]();\n }\n this.router[route.method](route.url, authMethod, (req, res) => {\n let values = route.method === 'get' ? req.query : req.body;\n const validator = new Validator_1.default(route.params, Object.assign({}, values, req.files));\n validator.addCustomTypes(this.customTypes);\n try {\n if (validator.isValid() === false) {\n const errorMessage = `This request failed validation, please check the documentation for ${route.method.toUpperCase()} ${route.url}`;\n const err = new ErrorResponse_1.ErrorResponse({ req, res, errorMessage, errors: validator.getErrors(), status: 400 });\n return err.send();\n }\n }\n catch (e) {\n const errorMessage = e.message;\n const errors = [\n `Invalid route definition for ${route.method.toUpperCase()} ${route.url}`\n ];\n const err = new ErrorResponse_1.ErrorResponse({ req, res, errorMessage, errors, status: 501 });\n return err.send();\n }\n values = Object.assign(validator.values, req.params);\n let routeHandler;\n // streaming route\n if (route.streaming === true) {\n routeHandler = new StreamingRouteHandler_1.StreamingRouteHandler(values, action, req, res);\n }\n else {\n routeHandler = new DefaultRouteHandler_1.DefaultRouteHandler(values, action, req, res);\n }\n // handle route\n routeHandler.handle();\n });\n }", "onRoute (info) {\n openApi.addRoute(info, {\n basePath: env.REST_API_PREFIX\n })\n }", "function route() {\n this.method = this.req.method.toLowerCase();\n var n = w.map[this.method];\n if (!n) {\n this.reply4xx(404, \"no route for method: \"+this.req.method);\n this.end();\n return\n } else {\n this.url = w.dep.url.parse(this.req.url, true);\n this.query = this.url.query || {};\n this.context = {};\n for (var e in this.query) { this.context[e] = this.query[e] }\n this.context._work = this;\n this.context._js = [];\n this.context._css = [];\n \n var p = this.url.pathname.split('/');\n console.log(this.req.url, \"route to ===============> \" + this.req.method.toUpperCase(), p);\n \n for (var i = 1; i < p.length; ++i) {\n var segment = p[i];\n if (n.branches[segment]) { n = n.branches[segment]; continue };\n if (n.branches[':']) { //varname\n this.context[n.varname] = segment;\n console.log(\"//varname: \" + n.varname + \" = \" + this.context[n.varname]);\n n = n.branches[':'];\n continue\n };\n if (n.branches['*']) { //wildcard\n this.context['_location'] = p.slice(i).join('/');\n console.log(\"//wildcard: \" + this.context['_location']);\n n = n.branches['*'];\n break\n };\n this.reply4xx(404, \"no route to: \"+this.req.method+' '+this.req.url);\n this.end();\n return\n };\n };\n \n if (n.handler) {\n this.mapnode = n;\n n.handler.call(this);\n this.end();\n return\n }\n\n this.reply5xx(500, \"no handler found for: \"+this.req.method+' '+this.req.url);\n this.end();\n return\n}", "function routeHook(obj, args, router) {\r\n\t\tvar method = args[0].toUpperCase();\r\n\t\tvar path = args[1];\r\n\t\tvar route;\r\n\r\n\t\t// start request\r\n\t\tproxy.callback(args, -1, function(obj, args) {\r\n\t\t\tif(nf.paused) return;\r\n\r\n\t\t\tvar req = args[0];\r\n\t\t\tvar res = args[1];\r\n\t\t\tvar time = samples.time(\"Express Server\", path, true);\r\n\t\t\t\r\n\t\t\t// finish request\r\n\t\t\tproxy.after(res, 'end', function(obj, args) {\r\n\t\t\t\tif(!time.done()) return;\r\n\r\n\t\t\t\troute = route || (method + ' ' + (res.app.route === '/' ? '' : res.app.route) + path);\r\n\t\t\t\ttopFunctions.add('expressCalls', route, time.ms, time.cputime, req.tiers, req.graph);\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t}", "routing () {\n const notConnected = this.app.session.notConnected.bind(this.app.session)\n const connected = this.app.session.connected.bind(this.app.session)\n const connectedOrBuilder = this.app.session.connectedOrBuilder.bind(this.app.session)\n const admin = this.app.session.admin.bind(this.app.session)\n\n this.app.express.use('/api', express.Router()\n .post('/auth/login', notConnected, this.app.action.auth.login.routes)\n .post('/auth/forgot', notConnected, this.app.action.auth.forgotPassword.routes)\n .put('/auth/reset', notConnected, this.app.action.auth.resetPassword.routes)\n\n .delete('/auth/logout', connected, this.app.action.auth.logout.routes)\n\n .use('/invite', express.Router()\n .post('/', connected, admin, this.app.action.invitation.create.routes)\n )\n .use('/user', express.Router()\n .post('/', notConnected, this.app.action.user.create.routes)\n .get('/:id', connected, this.app.action.user.get.routes)\n .get('/', connected, this.app.action.user.list.routes)\n )\n .use('/manifest', express.Router()\n .post('/', connected, this.app.action.manifest.create.routes)\n .put('/:id', connected, this.app.action.manifest.update.routes)\n .put('/:id/maintainer', connected, admin, this.app.action.manifest.updateMaintainer.routes)\n .get('/:id', connectedOrBuilder, this.app.action.manifest.get.routes)\n .get('/', connected, this.app.action.manifest.list.routes)\n )\n .use('/build', express.Router()\n .post('/', connected, this.app.action.build.create.routes)\n .use('/:id', express.Router({ mergeParams: true })\n .get('/', connected, this.app.action.build.get.routes)\n\n // Middleware to authorize only builder\n .use('/', this.app.action.build.authorization.routes)\n // Empty endpoint for a client to verify his access\n .put('/', (req, res, next) => { res.json({}) })\n .put('/start', this.app.action.build.start.routes)\n .put('/stdout', this.app.action.build.stdout.routes)\n .put('/stderr', this.app.action.build.stderr.routes)\n .put('/end', this.app.action.build.end.routes)\n .put('/packages', this.app.action.build.packages.routes)\n )\n .get('/', connected, this.app.action.build.list.routes)\n )\n )\n\n this.app.express.use(this.errorHandler.bind(this))\n }", "function set_routes() {\n\n // Check your current user and roles\n app.get( '/status/:id', function( request, response ) {\n acl.userRoles( request.params.id || false, function( error, roles ){\n response.json( {'User': request.user ,\"Roles\": roles });\n });\n });\n\n // Only for users and higher\n app.all( '/secret', [ acl.middleware( 1, get_user_id) ],function( request, response ) {\n\n response.send( 'Welcome Sir!' +request.params.id);\n }\n );\n\tapp.use('/user',require('./routers/userR.js'));\n app.use('/event',require('./routers/eventR.js'));\n //accept error\n app.use(acl.middleware.errorHandler('json')); \n \n}", "static addNotSupportedRoute (server) {\n server.route({\n method: 'GET',\n path: '/test/not-supported',\n handler: NotSupportedController.index,\n options: {\n auth: false\n }\n })\n }", "function create(){\n \n var routes = {};\n \n function addRoute(name, method, pattern, handler) {\n if (typeof pattern === 'string') {\n pattern = new RegExp(\"^\" + pattern + \"$\");\n }\n \n var route = {\n name: name, \n method: method,\n pattern: pattern,\n handler: handler,\n plugins:{before:[], after:[]},\n //helpers :{} // delete TODO\n };\n \n routes[name] = route;\n return route;\n }\n \n // get the roote and save the match in response object\n function doRoute(req, context) {\n var uri = url_parse(req.url);\n var path = uri.pathname;\n for (var routeName in routes) {\n var route = routes[routeName];\n if (req.method === route.method) {\n var match = path.match(route.pattern);\n if (match && match[0].length > 0) {\n // TODO named properties params in response como query string\n context.response.matches = match;\n return route;\n }\n }\n }\n \n return false;\n }\n\n // add plugin to handler\n function addPlugin (){\n var args = Array.prototype.slice.call(arguments);\n var firstArg = args.shift(); \n if (typeof firstArg === 'string') {\n var route = routes[firstArg];\n } else {\n var route = firstArg; // Object\n }\n \n var hook = 'before';\n \n var last = args[args.length-1];\n if (typeof last === 'string'){\n args.pop();\n if(last === 'after' ){\n hook = 'after';\n }\n } \n \n if (hook === 'after'){\n Array.prototype.push.apply(route.plugins.after, args);\n } else {\n Array.prototype.push.apply(route.plugins.before, args);\n } \n }\n \n // application (router) Scope\n var modulePrototypesContainer = {\n modules : []\n }\n\n function addModule(rte, module){\n //var args = Array.prototype.slice.call(arguments);\n if (typeof rte === 'string') {\n var rte = routes[rte];\n }\n // plugins\n Array.prototype.push.apply(rte.plugins.after, module.after);\n Array.prototype.push.apply(rte.plugins.before, module.before);\n // helpers\n addHelpers(module, modulePrototypesContainer);\n }\n\n function createContext(req, res){\n var context = {};\n modulePrototypesContainer.modules.forEach(function(moduleName){\n var obj = Object.create(modulePrototypesContainer[moduleName]);\n obj.request = req;\n obj.response = res;\n context[moduleName] = obj;\n });\n\n context.request = req;\n context.response = res;\n return context;\n }\n\n function createChain(route){\n var beforeFuncs = route.plugins.before || [];\n var afterFuncs = route.plugins.after || [];\n var beforeAllFuncs = routes[ALLROUTES_CHAIN].plugins.before || [];\n var afterAllFuncs = routes[ALLROUTES_CHAIN].plugins.after || [];\n return [].concat(beforeAllFuncs, beforeFuncs, route.handler, afterFuncs, afterAllFuncs);\n \n }\n \n return {\n routes : routes,\n addRoute: addRoute,\n doRoute: doRoute,\n addPlugin: addPlugin,\n addModule: addModule,\n createChain: createChain,\n createContext: createContext,\n modulePrototypesContainer: modulePrototypesContainer,\n ALLROUTES_CHAIN : ALLROUTES_CHAIN\n\n };\n}", "_handleRoute(e) {\n this.log.logApi('_handleRoute', e);\n var _hash = location.hash.replace(/^#\\/|\\/$/gi, '/');\n var parser = document.createElement('a');\n parser.href = _hash;\n var _routeObj = null;\n var res = {};\n var req = {\n hostname: parser.hostname,\n host: parser.host,\n port: parser.port,\n protocol: parser.protocol,\n pathname: parser.pathname,\n hash: parser.hash,\n url: parser.href,\n query: parser.search,\n params: {}, //needs to be routes named params keys and value the values\n data: {} //Needs to be any other data sent along\n };\n\n req.query = this._getUrlQuery(parser.href);\n\n //Loop each regex route and match against hash, if match, invoke route handler function.\n for (var i = 0; i < this.routesRegex.length; i++) {\n _routeObj = this.routesRegex[i];\n\n //Test if route matches registered route\n if (_routeObj.regexp.test(_hash)) {\n _routeObj.current = _hash;\n\n _routeObj = this._setRouteParams(_routeObj);\n\n //setup request params / and data\n req.params = _routeObj.params;\n\n //Log\n this.log.logApi(_hash, _routeObj);\n /*\n PubSub.emit('route:success', {\n _routeObj, req, res\n });\n PubSub.emit('route:change', {\n _routeObj, req, res\n });\n */\n //Execute route handler\n this.execute(_routeObj.success, [req, res], _hash);\n } else {\n\n this.execute(_routeObj.error, [req, res], _hash);\n }\n }\n }", "function loadRoutes() {\n\n registerRoute(\"/access/denied\", Controllers.Access.prototype.denied)\n registerRoute(\"/users/register\", Controllers.Users.prototype.register,true)\n\n }", "constructor(routes){\n this.routes=routes;\n this._loadInitialRoute();\n }", "function Router() {\n return {\n /**\n * navigateToCart - navigate to cart in checkout\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToCart : function(info) {\n info = _.extend({\n route : 'cart'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * navigateToCustomer - navigate to customer views\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToCustomer : function(info) {\n info = _.extend({\n route : 'customer'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * navigateToCustomerSearchResult - navigate to customer search results\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToCustomerSearchResult : function(info) {\n info = _.extend({\n route : 'customer_search_result'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * customerLogout - log out a customer\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n customerLogout : function(info) {\n info = _.extend({\n route : 'customer_logout'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * presentChangeStorePasswordDrawer - change the store password\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n presentChangeStorePasswordDrawer : function(info) {\n info = _.extend({\n route : 'change_store_password'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * navigateToHome - navigate to Home\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToHome : function(info) {\n info = _.extend({\n route : 'home'\n }, info);\n\n return handleAppRoute(info);\n },\n\n /**\n * navigateToCategory - navigate to category\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToCategory : function(info) {\n info = _.extend({\n route : 'product_search_result',\n query : ''\n }, info);\n\n return handleAppRoute(info);\n },\n\n /**\n * navigateToProduct - navigate to a product (PDP)\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToProduct : function(info) {\n info = _.extend({\n route : 'product_detail'\n }, info);\n\n return handleAppRoute(info);\n },\n\n /**\n * navigateToProductSearch - navigate to product search results\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToProductSearch : function(info) {\n info = _.extend({\n route : 'product_search_result'\n }, info);\n\n return handleAppRoute(info);\n },\n\n /**\n * navigateToOrderSearchResult - navigate to order search results\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToOrderSearchResult : function(info) {\n info = _.extend({\n route : 'order_search_result'\n }, info);\n\n return handleAppRoute(info);\n },\n\n /**\n * presentAssociateLogin - present associate login\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n presentAssociateLogin : function(info) {\n info = _.extend({\n route : 'associate_login'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * presentCustomerSearchDrawer - present customer search dialog\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n presentCustomerSearchDrawer : function(info) {\n info = _.extend({\n route : 'customer_search'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * presentOrderSearchDrawer - present order search dialog\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n presentOrderSearchDrawer : function(info) {\n info = _.extend({\n route : 'order_search'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * presentProductSearchDrawer - present product search dialog\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n presentProductSearchDrawer : function(info) {\n info = _.extend({\n route : 'product_search'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * presentPrinterChooserDrawer - present printer chooser dialog\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n presentPrinterChooserDrawer : function(info) {\n info = _.extend({\n route : 'printer_chooser'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * associateLogout - perform associate logout\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n associateLogout : function(info) {\n info = _.extend({\n route : 'associate_logout'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * presentCreateAccountDrawer - present create account dialog\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n presentCreateAccountDrawer : function(info) {\n info = _.extend({\n route : 'create_account'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * checkPaymentDevice - check status of payment device\n *\n * @param {Boolean} verified - if verified\n * @return {Deferred} promise\n * @api public\n */\n checkPaymentDevice : function(verified) {\n return checkPaymentDevice(verified);\n },\n\n /**\n * paymentDeviceConnectionChecked - update device status\n *\n * @param {Boolean} connected - if connected\n * @api public\n */\n paymentDeviceConnectionChecked : function(connected) {\n if (connected != paymentDeviceConnected) {\n paymentDeviceConnected = connected;\n $.header.updateDeviceStatus(false, connected);\n if ($.no_payment_terminal) {\n $.no_payment_terminal.updateDeviceStatus(connected);\n }\n }\n },\n\n /**\n * startup - restart the application\n *\n * @api public\n */\n startup : function() {\n Alloy.eventDispatcher.trigger('app:startup', {\n login : true\n });\n },\n\n /**\n * showActivityIndicator - shows activity indicator until deferred is complete\n *\n * @param {Deferred} deferred\n * @api public\n */\n showActivityIndicator : function(deferred) {\n showActivityIndicator(deferred);\n },\n\n /**\n * showHideHamburgerMenu - show the hamburger menu popover\n *\n * @api public\n */\n showHideHamburgerMenu : function() {\n $.hamburger_menu.showHideHamburgerMenu();\n },\n\n /**\n * hideHamburgerMenu - hide the hamburger menu popover\n *\n * @api public\n */\n hideHamburgerMenu : function() {\n $.hamburger_menu.hideHamburgerMenu();\n },\n\n /**\n * navigate - dynamic routing based on info passed in\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigate : function(info) {\n // for dynamic routing\n return handleAppRoute(info);\n }\n };\n}", "initRoutes() {\n this.app.get(\n `${this.apiBasePath}/person/:personId/appearances`,\n (req, res, next) => {\n personController.getAppearances(req, res, next);\n },\n );\n\n this.app.get(\n `${this.apiBasePath}/person/:personId/movies`,\n (req, res, next) => {\n personController.getMovieAppearances(req, res, next);\n },\n );\n\n this.app.get(\n `${this.apiBasePath}/person/:personId/tv`,\n (req, res, next) => {\n personController.getTvAppearances(req, res, next);\n },\n );\n }", "function routes() {\n return [\n {path: /.*/, fn: allPages,template: 'templateAll',block: 'side.template.all'},\n {path: 'GET /template', fn: templatePage, template: 'templateShow',block: 'content.template'},\n {path: 'GET /templateSecure', fn: templatePage, permit: calipso.permission.Helper.hasPermission('template:permission'), template: 'templateShow',block: 'content.template'}\n ];\n}", "get routes(){\n\t\treturn {\n\t\t\t'get /': [actionFilter, 'index'],\n\t\t\t'get /home/about': 'about'\n\t\t}\n\t}", "function routeDontFound() {\n var dinamic = dinamicRoutes();\n dinamic.status && __webpack_require__(\"./src/ts/components sync recursive ^\\\\.\\\\/.*\\\\.ts$\")(\"./\" + dinamic.route.component + \".ts\").page();\n}", "forTesting(pattern, methods, handler) {\n pattern = pattern || `_test_${this.testRoutePatternCounter++}`;\n methods = methods || ['GET'];\n handler = handler || this.testsHandler;\n const route = this.route(pattern, methods, handler);\n this.commit();\n return route;\n }", "function dinamicRoutes() {\n var otherRoutes = routes.filter(function (item) { return item.path.includes(':'); });\n var getRouteCurrent = location.pathname.split('/');\n var request = {};\n otherRoutes.map(function (route) { return request = getRouteCurrent[1] == (route.path.split('/'))[1] ? { 'status': true, 'route': route } : { 'status': false }; });\n return request;\n}", "function dinamicRoutes() {\n var otherRoutes = routes.filter(function (item) { return item.path.includes(':'); });\n var getRouteCurrent = location.pathname.split('/');\n var request = {};\n otherRoutes.map(function (route) { return request = getRouteCurrent[1] == (route.path.split('/'))[1] ? { 'status': true, 'route': route } : { 'status': false }; });\n return request;\n}", "_setRegexRoutes() {\n var _out = [],\n _routeParams = [],\n _reg, _routeObj;\n\n var routeHandler = null;\n var routeErrorHandler = function() {};\n var routeSuccessHandler = function() {};\n var routeResolver = null;\n\n this.log.logApi('1. registerRoutes', this.routes);\n for (var _route in this.routes) {\n\n\n // TODO: Route handler can be a function or object\n if (this.utils.type(this.routes[_route]) === 'function') {\n routeSuccessHandler = this.routes[_route];\n }\n\n // TODO: If object, make sure callback prop exists,\n if (this.utils.type(this.routes[_route]) === 'object') {\n\n if (this.routes[_route].error) {\n routeErrorHandler.bind(this.routes[_route].error);\n }\n if (this.routes[_route].success) {\n routeSuccessHandler.bind(this.routes[_route].success);\n }\n\n\n\n console.warn('Found route callback');\n\n if (this.routes[_route].resolve) {\n routeSuccessHandler = this.routes[_route].resolve;\n console.warn('Found route resolver');\n }\n }\n\n // TODO: if object.resolve (Ensure objects key is added to params once resolved.)\n _routeParams = _route.replace('/', '').split('/');\n _reg = this._regexRoute(_route, _routeParams);\n _routeObj = {\n regexp: _reg,\n route: _route,\n success: routeSuccessHandler,\n error: routeErrorHandler\n };\n _out.push(_routeObj);\n //this.log.logApi('setRegexRoutes', _routeObj);\n }\n this.routesRegex = _out;\n return _out;\n }", "function checkRoute() {\n\n var path = getPath(),\n\n args = path.split('/');\n\n INFO.route = SESSION.route = path;\n\n if ( args.length < 1 ) return;\n\n // TODO: 0.7.0 -> customRoutes\n // if ( getKeys( CUSTOM_PATTERNS ).length ) extractRoute();\n\n matchRoute( args );\n}", "function setupRoutes(app, passport) {\n var loginWithLinkedIn = require('./routes/login/login-linkedin');\n var loginWithLGoogle = require('./routes/login/login-google');\n var loginWithLMicrosoft = require('./routes/login/login-microsoft');\n var loginWithPassword = require('./routes/login/login-with-password');\n var getCurrentUser = require('./routes/get-current-user');\n app.use('/login/linkedin', loginWithLinkedIn);\n app.use('/login/google', loginWithLGoogle);\n app.use('/login/microsoft', loginWithLMicrosoft);\n app.use('/technician/login', loginWithPassword);\n app.use('/getCurrentUser', getCurrentUser);\n /* router.get('/', function(req, res, next) {\n res.send('respond with a resource');\n }); */\n\n\n}", "function userRoutes() {\n return (open, closed) => {\n closed.route('/get-meta-data/module/:moduleName/screen/:screenName').get(\n joiGetSpecifications, // joi validation\n ctrl.getFileDynamically // controller function \n );\n };\n}", "init() {\n this.router.get(\"/\", (req, res, next) => {\n res.status(200).json(this._service.defaultMethod());\n });\n }", "static routes() {\n\n\t\tconst keys = ['all', 'delete', 'get', 'patch', 'post', 'put'];\n\n\t\treturn MapContainer.create(...keys);\n\t}", "function doRoute(req, context) {\n var uri = url_parse(req.url);\n var path = uri.pathname;\n for (var routeName in routes) {\n var route = routes[routeName];\n if (req.method === route.method) {\n var match = path.match(route.pattern);\n if (match && match[0].length > 0) {\n // TODO named properties params in response como query string\n context.response.matches = match;\n return route;\n }\n }\n }\n \n return false;\n }", "registerRoutes() {\n this.router.get(`/`, this.getAllAccounts.bind(this));\n }", "function addRoutes(api) {\n //api.post('/api/v2/outbound/:name', postItem);\n}", "all(_route, _f) {\n ['get', 'head', 'post', 'put', 'patch', 'delete'].forEach((_val) => {\n this._bindPathsToMap(_val, _route, _f);\n });\n }", "function routeDontFound() {\n var dinamic = dinamicRoutes();\n dinamic.status && __webpack_require__(\"./src sync recursive ^\\\\.\\\\/.*\\\\.ts$\")(\"./\" + project + \"/js/components/\" + dinamic.route.component + \".ts\").page();\n}", "function serverGetRoutes(routes){\n return new Promise((resolve,reject)=>{\n server.route(routes)\n resolve()\n })\n}", "extendRoutes (routes) {\n magentoRedirects.forEach(magentoRedirect => routes.push(magentoRedirect))\n\n let extendedRoutes = routes.map(route => {\n if (route.name === 'account') route.children = [] // remove it when iframe from my account will be removed\n\n if (route.name in routeReplacements) {\n const matchedReplacer = routeReplacements[route.name]\n const path = route.path\n\n route.path = path.replace(matchedReplacer.from, matchedReplacer.to)\n\n if (matchedReplacer.additionalRoute) {\n route.alias = path.replace(matchedReplacer.from, matchedReplacer.additionalRoute)\n }\n }\n\n return route\n })\n\n return extendedRoutes\n }", "on(...pageRoutes) {\n //increment the number of routes registered\n this.numRegistered += 1;\n for (const {route, handler} of pageRoutes) {\n if (Array.isArray(route)) {\n for (const path of route) {\n const [regPath, params] = getRegexFromRouteString(path);\n this.routes.set(path, {pathRoute: regPath, handler: handler, params: params});\n }\n } else {\n const [regPath, params] = getRegexFromRouteString(route);\n this.routes.set(route, {pathRoute: regPath, handler: handler, params: params})\n }\n }\n //route the current url once we've registed all the handlers\n if (this.numRegistered === this.numRoutes) {\n this.match(window.location.pathname);\n }\n }", "function createRoutes (router) {\n router\n .get('/', (_, response) => {\n response.end('')\n })\n .get('/user/:id', (request, response) => {\n response.end(request.params.id)\n })\n .post('/user', (request, response) => {\n response.end('')\n })\n}", "init(){\n this.routes.forEach((route)=>{\n this._proccessRegExp(route);\n }, this);\n\n let found = false;\n let routerObj = {\n pathFor: (name, parameter)=>{\n return this._pathFor(name, parameter);\n },\n\n goTo: (url, data, title)=>{\n return this._goTo(url, data, title);\n },\n\n historyMode: this._historyMode\n };\n this.routes.some((route)=>{\n if(this._requestPath().match(route.regExp)) {\n route.current = true;\n found = true;\n\n let request = {};\n request.param = this._processRequestParameters(route);\n request.query = this.query;\n request.uri = window.location.pathname;\n\n return route.callback.call(route.thisArg, request, routerObj);\n }\n },this)\n\n if(!found){\n if(!this._notFoundFunction) return;\n let request = {};\n request.uri = window.location.pathname;\n return this._notFoundFunction(request, routerObj);\n }\n }", "function route(req, res) {\n var req_obj = {\n request: req,\n response: res,\n url: url.parse(req.url, true),\n get_arguments: {},\n url_arguments: []\n }\n\n req_obj.get_arguments = req_obj.url.query;\n var path = req_obj.url.pathname;\n\n for (var i in ROUTES) {\n var route = ROUTES[i];\n if ('url' in route && route.url == path) {\n return handle_reponse(res, route.callback(req_obj));\n } else if ('pattern' in route && route.pattern.test(path)) {\n req_obj.url_arguments = route.pattern.exec(path);\n return handle_reponse(res, route.callback(req_obj));\n }\n }\n send_response_string(res, 404, \"404/Not found.\");\n}", "on(...pageRoutes) {\n //increment the number of routes registered\n this.numRegistered += 1;\n for (const {route, handler} of pageRoutes) {\n if (Array.isArray(route)) {\n for (const path of route) {\n const [regPath, params] = getRegexFromRouteString(path);\n this.routes.set(path, {pathRoute: regPath, handler: handler, params: params});\n }\n } else {\n const [regPath, params] = getRegexFromRouteString(route);\n this.routes.set(route, {pathRoute: regPath, handler: handler, params: params})\n }\n }\n //route the current url once we've registed all the handlers\n if (this.numRegistered === this.numHandlers) {\n this.match(window.location.pathname);\n }\n }", "function apiHandler(req, reply) {\n\n var rb = new RepresentationBuilder(settings.relsUrl);\n var resource = rb.create({}, req.url);\n\n // grab the routing table and iterate\n var routes = req.server.table();\n for (var i = 0; i < routes.length; i++) {\n var route = routes[i];\n\n // :\\\n var halConfig = route.settings.app && route.settings.app.hal;\n\n if (halConfig && halConfig.apiRel) {\n var rel = halConfig.apiRel;\n var href = routes[i].path;\n\n // grab query options\n if (halConfig.query) {\n href += halConfig.query;\n }\n\n // check if link is templated\n var link = new hal.Link(rb.resolve(rel), href);\n if (/{.*}/.test(href)) {\n link.templated = true;\n }\n\n // todo process validations for query parameters\n resource.link(link);\n }\n }\n\n // handle any curies\n rb.addCuries(resource);\n reply(resource).type('application/hal+json');\n }", "defineRoutes() {\n super.defineRoutes();\n this._router.post(this._resourceName + '/login', (req, res, next) => this.login(req, res, next));\n }", "router() { return rtr; }", "registerRoutes() {\n this.get(`/`, `version`);\n\n // Register routes for branch resources\n this.get(`/branches`, `branch-data`);\n this.get(`/branches/:id`, `branch-find`);\n this.post(`/branches`, `branch-create`);\n\n // Register routes for sales resource\n this.get(`/sales`, `sales-data`);\n this.get(`/sales/:id`, `sale-find`);\n this.post(`/sales`, `sale-create`);\n }", "function respond (args, first) {\n\n function test (route, i, routes) {\n return handle(route, args, i);\n }\n\n if (first) _.some(routes, test); \n else _.each(routes, test);\n}", "constructor() {\n // _routes will contain a mapping of HTTP method name ('GET', etc.) to an\n // array of all the corresponding Route instances that are registered.\n this._routes = new Map();\n }", "registerRoutes(){\n\t\tthis.routes.forEach(\n\t\t\t({match, serviceRoute}) => {\n\t\t\t\tthis.existsAuthServiceRoute = serviceRoute === this.authServiceRoute || !!this.existsAuthServiceRoute;\n\t\t\t\tthis.log.debug(`registerRoutes processes ${match}`);\n\t\t\t\tthis.app.use(\n\t\t\t\t\tmatch,\n\t\t\t\t\t(req, res, next) => {\n\t\t\t\t\t\tlet controller;\n\t\t\t\t\t\tthis.log.debug(`route recognized: registerRoutes gathers details for ${match}`)\n\t\t\t\t\t\tconst method = req.method;\n\t\t\t\t\t\tconst isSecure = req.secure;\n\t\t\t\t\t\tconst protocol = this.#isFakeSecure ? 'https' : req.protocol;\n\t\t\t\t\t\tconst xfProtocol = req.get('X-Forwarded-Proto');\n\t\t\t\t\t\tconst serviceVersion = req.serviceVersion;\n\t\t\t\t\t\tconst params = req.params;\n\t\t\t\t\t\tconst parsedParams = req.parsedParams;\n\t\t\t\t\t\tthis.log.debug(`method: ${method}`);\n\t\t\t\t\t\tthis.log.debug(`isSecure: ${isSecure}`);\n\t\t\t\t\t\tthis.log.debug(`protocol: ${protocol}`);\n\t\t\t\t\t\tthis.log.debug(`x-forwarded-protocol: ${xfProtocol}`);\n\t\t\t\t\t\tthis.log.debug(`serviceRoute: ${serviceRoute}`);\n\t\t\t\t\t\tthis.log.debug(`serviceVersion: ${serviceVersion}`);\n\t\t\t\t\t\tthis.log.debug({params}, 'params');\n\t\t\t\t\t\tthis.log.debug({parsedParams}, 'parsedParams');\n\t\t\t\t\t\tthis.log.debug({together: {...params, ...parsedParams}}, 'params and parsedParams');\n\t\t\t\t\t\tnew Promise(\n\t\t\t\t\t\t\t(resolve, reject) => {\n\t\t\t\t\t\t\t\tif(!this.existsAuthServiceRoute){\n\t\t\t\t\t\t\t\t\treject(\n\t\t\t\t\t\t\t\t\t\tnew Error('An auth service route has not been defined.')\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t).then(\n\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\tif(!serviceRoute){\n\t\t\t\t\t\t\t\t\tthrow new NoRouteFoundError('Please see the links property to learn which routes are available.');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t).then(\n\t\t\t\t\t\t\t() => this.controllerFactory.get(serviceRoute, serviceVersion)\n\t\t\t\t\t\t).then(\n\t\t\t\t\t\t\tcontrollerBuilt => {\n\t\t\t\t\t\t\t\tcontroller = controllerBuilt;\n\t\t\t\t\t\t\t\treturn controller.handleRequest(\n\t\t\t\t\t\t\t\t\tmethod, protocol, serviceVersion, {...params, ...parsedParams}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t).then(\n\t\t\t\t\t\t\tapiResponse => {\n\t\t\t\t\t\t\t\tif(apiResponse.serviceResponse.error instanceof ConfirmAuthorizationError){\n\t\t\t\t\t\t\t\t\treturn Promise.resolve(\n\t\t\t\t\t\t\t\t\t).then(\n\t\t\t\t\t\t\t\t\t\t() => this.getUnauthorizedError(\n\t\t\t\t\t\t\t\t\t\t\tmethod, protocol, serviceVersion, {...params, ...parsedParams}\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t).then(\n\t\t\t\t\t\t\t\t\t\tunAuthorizedError => {\n\t\t\t\t\t\t\t\t\t\t\tif(unAuthorizedError && !this.#isFakeAuthorized){\n\t\t\t\t\t\t\t\t\t\t\t\treturn apiResponse.serviceResponse.error.fail(unAuthorizedError);\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\treturn apiResponse.serviceResponse.error.proceed();\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).then(\n\t\t\t\t\t\t\t\t\t\tserviceResponse => controller.serviceToAPIResponseMap.get(serviceResponse)\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\treturn apiResponse;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t).catch(\n\t\t\t\t\t\t\te => {\n\t\t\t\t\t\t\t\tif(e instanceof NoRouteFoundError){\n\t\t\t\t\t\t\t\t\tserviceRoute = '';\n\t\t\t\t\t\t\t\t\treturn new DiscoverableF404ErrorAPIResponse(\n\t\t\t\t\t\t\t\t\t\tnew ErrorServiceResponse(\n\t\t\t\t\t\t\t\t\t\t\tserviceRoute, method, e, undefined, {...params, ...parsedParams}\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}else{\n\t\t\t\t\t\t\t\t\tthrow e;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t).then(\n\t\t\t\t\t\t\tapiResponse => this.respondExpectedResponse(res, apiResponse, serviceRoute)\n\t\t\t\t\t\t).catch(\n\t\t\t\t\t\t\te => this.respondUnexpectedError(res, e)\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);\n\t}", "match(route) {\n //match route against dictionary of defined paths to their relevant attributes\n for (let [path, {pathRoute, handler, params}] of this.routes) {\n const match = pathRoute.exec(route);\n //each route will be associated with a handler\n //this handler will handle all of the rendering associated with a new change\n if (match !== null) {\n //remove the first / from the route\n //loop through values and add each value with its associated parameter\n const routeParams = match.slice(1).\n reduce((allParams, value, index) => {\n allParams[params[index]] = value;\n return allParams;\n }, {});\n //split parameters using the ?varName=varVal \n this.currentPath = path;\n //check if we have any query parameters to parse\n if (window.location.search) {\n this.getQueryParameters(window.location.search, routeParams);\n }\n handler(route, routeParams);\n //we don't want to execute more than route once we've matched one\n //if it can match multiple ones so we break\n break;\n }\n\n }\n }", "async handleRoute (req, res) {\n // Check for handlers for the matching HTTP method and path\n const handlers = this.routes[req.method][req.url]\n if (handlers) { // If there are assigned handlers, run them\n await this.callHandlers(handlers, req, res)\n } else {\n // Return 404 error if no matching route handlers are found\n res.error(`Route ${req.method} ${req.url} Not Found`, 404)\n }\n }", "startLinkRouting() {}", "constructor(routes) {\n this.routes = [];\n this.route = this.route.bind(this);\n\n if (Array.isArray(routes)) {\n routes.forEach(x => {\n this.route(x.path, ...(Array.isArray(x.action) ? x.action : [x.action]));\n });\n } else if (typeof routes === 'function') {\n routes(this.route);\n }\n }", "function router(request , response){\r\n let requestObject = extractPathName(request , response);\r\n let requestURLPathName = requestObject.pathname;\r\n if(requestObject.parameters || requestObject.optionalParams)\r\n {\r\n if(requestObject.parameters && requestObject.optionalParams)\r\n {\r\n request.params = requestObject.parameters;\r\n request.optionalParams = requestObject.optionalParams;\r\n }\r\n else if(requestObject.parameters)\r\n {\r\n request.params = requestObject.parameters;\r\n }\r\n else if(requestObject.optionalParams)\r\n {\r\n request.optionalParams = requestObject.optionalParams;\r\n }\r\n }\r\n switch(requestURLPathName)\r\n {\r\n //If we get a request for /params path then we are going to call the paramsURLRouter method\r\n case \"/params/:paramOne/:paramTwo\" :\r\n paramsURLRouter.paramsURLRouter(request , response);\r\n break;\r\n //If we get a request for /params path then we are going to call the baseURLRouter method\r\n case \"/\" :\r\n baseURLRouter.baseURLRouter(request , response);\r\n break;\r\n //If a request to invalid path is received then following functionality will be called\r\n default :\r\n console.log(\"Invalid request URL\");\r\n break;\r\n }\r\n\r\n}", "function routes(router) {\n\n\t\tconst pathwaysManager = new AuthorizedRoute((id, section, subId) => {\n\t\t\trequire(['./components/manager'], function () {\n\t\t\t\trouter.setCurrentView('pathways-manager', {\n\t\t\t\t\tanalysisId: id,\n\t\t\t\t\tsection: section,\n\t\t\t\t\texecutionId: section === 'results' ? subId : null,\n\t\t\t\t\tsourceId: section === 'executions' ? subId : null,\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tconst pathwaysManagerVersion = new AuthorizedRoute((id, version) => {\n\t\t\trequire(['./components/manager'], function () {\n\t\t\t\trouter.setCurrentView('pathways-manager', {\n\t\t\t\t\tanalysisId: id,\n\t\t\t\t\tsection: 'design',\n\t\t\t\t\tversion: version\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tconst pathwaysBrowser = new AuthorizedRoute(() => {\n\t\t\trequire(['./components/browser'], function () {\n\t\t\t\trouter.setCurrentView('pathways-browser');\n\t\t\t});\n\t\t})\n\n\t\treturn {\n\t\t\t'pathways': pathwaysBrowser,\n\t\t\t'pathways/:id:': pathwaysManager,\n\t\t\t'pathways/:id:/version/:version:': pathwaysManagerVersion,\n\t\t\t'pathways/:id:/:section:': pathwaysManager,\n\t\t\t'pathways/:id:/:section:/:subId:': pathwaysManager // for executions\n\t\t};\n\t}", "function handler(url, routes) {\n if (typeof routes == 'function' || !routes){\n\treturn routes;\n } \n return handler(url.slice(1), routes[url[0]]);\n}", "function route(handle, pathname, response, postData) {\n console.log(\"The route for path: %s, data: %s\", pathname, postData);\n if ( pathname == '/') {\n response.write(\"The index pages is blank.\");\n response.end();\n return;\n }else if ( pathname == '/ws') {\n var wsclient = response;\n var message = postData;\n wsclient.send(\"I have got your message whose length is \" + postData.length);\n // Handle message\n handleWSMsg(wsclient, message);\n return;\n }else if ( pathname == '/callapi' ) {\n //This is for remote call api in internet browser.\n if ( postData === null || postData.length === 0 ){\n response.writeHead(404, {'Content-Type': 'text/plain'});\n response.write(\"Invalid callapi\");\n response.end();\n return;\n }\n var postDataJSON=JSON.parse(postData);\n var args=postDataJSON.args;\n var apiPathArr=postDataJSON.api.split(\".\");\n var sendresponse = function(){\n response.writeHead(200, {\"Content-Type\": mimeTypes[\"js\"]});\n response.write(JSON.stringify(Array.prototype.slice.call(arguments)));\n response.end();\n }\n args.unshift(sendresponse);\n handle[apiPathArr[0]][apiPathArr[1]].apply(null, args);\n return;\n }else if ( pathname.lastIndexOf(\"/callapp/\", 0) === 0) {\n // This is for remote open app in internet browser.\n // request url: /callapp/ + appID + / + request file name\n var url = pathname.replace(/^\\//, '').split('/'),\n sAppID = url[1],\n sFilename = path.join.apply(this, url.slice(2));\n // var sAppName=pathname.substring(9, pathname.indexOf('/', 10));\n // var sFilename=pathname.substring(9 + sAppName.length + 1, pathname.length);\n /* var runapp=null; */\n // var app;\n // for(var i = 0; i < config.AppList.length; i++) {\n // app = config.AppList[i];\n // if (app.name == sAppName) {\n // runapp=app;\n // break;\n // }\n /* } */\n\n var runapp = appManager.getRegistedInfo(sAppID),\n rootPath = (runapp.local ? '' : config.APPBASEPATH);\n if(runapp === null) {\n console.log(\"Error no app \" + sAppID);\n response.writeHead(404, {\n 'Content-Type': 'text/plain'\n });\n response.write(\"This request URL \" + pathname + \" was not found on this server.\");\n response.end();\n return;\n }\n\n if(sFilename === \"index.html\") {\n getRealFile(path.join(rootPath, runapp.path, sFilename), response);\n } else if(sFilename === \"lib/api.js\") {\n getRealFile(path.join(rootPath, runapp.path, \"lib/api_remote.js\"), response);\n } else if(sFilename.lastIndexOf(\"lib/api/\", 0) === 0 \n && sFilename.indexOf(\".js\", sFilename.length - 3) !== -1) {\n var modulename = sFilename.substring(8, sFilename.length - 3);\n getRemoteAPIFile(handle, modulename, response);\n } else {\n getRealFile(path.join(rootPath, runapp.path, sFilename), response);\n }\n return;\n } else {\n //Use api_remote.js for /lib/api.js\n var realPath;\n if (pathname == \"/lib/api.js\") {\n pathname = \"./lib/api_remote.js\";\n getRealFile(pathname, response);\n return;\n }else if (pathname.lastIndexOf(\"/lib/api/\", 0) === 0 && pathname.indexOf(\".js\", pathname.length - 3) !== -1) {\n var modulename = pathname.substring(9, pathname.length - 3);\n getRemoteAPIFile(handle, modulename, response);\n return;\n }else {\n getRealFile(pathname, response);\n return;\n }//end of /lib/api/***.js\n }//end of if callapi callapp and else\n}", "init() {\n this.router.post('/generate', (request, response, next) => {\n this.generateKeys(request, response, next);\n });\n this.router.get('/keys/:platform', (request, response, next) => {\n this.getKeys(request, response, next);\n });\n this.router.get('/validate', (request, response, next) => {\n this.validate(request, response, next);\n });\n this.router.get('/platforms', (request, response, next) => {\n this.getStatus(request, response, next);\n });\n // TODO: chenge post to delete\n this.router.delete('/delete', (request, response, next) => {\n this.deleteKey(request, response, next);\n });\n this.router.put('/status', (request, response, next) => {\n this.updateStatus(request, response, next);\n });\n }", "createRoutes() {\n this.routes['/asciimo'] = (req, res) => {\n var link = \"http://i.imgur.com/kmbjB.png\";\n res.send(\"<html><body><img src='\" + link + \"'></body></html>\");\n };\n }", "function _setRoutesMap(router) {\n // function _getRoutesMap() {\n\n var global = function () {\n if (scope.type === 'realm') {\n _navigateToPage('realm', scope.data);\n } else if (scope.type === 'error') {\n _navigateToPage('error');\n } else {\n _navigateToPage('global', config.permissions.realms.realm_list);\n }\n };\n\n var realm = function (realmId, realmTab, realmSection) {\n // console.log(\">> url realm handler \")\n // console.log(arguments)\n\n // TODO - Array.from()\n // var args = Array.prototype.slice.call(arguments);\n\n var tabs = config.permissions.ui.realm;\n // console.log(tabs)\n\n // var defaultArgs = [args[0], tabs[0].name];\n var defaultRoute = \"/realm/\" + arguments[0] + \"/\" + tabs[0].name;\n\n // default \"subpage\" is status tab\n if (!realmTab) {\n // console.log(\">>> no tab >> set first as default\")\n // args = defaultArgs;\n router.setRoute(defaultRoute);\n return;\n }\n\n // console.log(realmTab);\n var tabValid = false;\n for (var t in tabs) {\n var tab = tabs[t];\n if (realmTab == tab.name) {\n // console.log(\">>> Yes!\", tab.name)\n tabValid = true;\n\n var sections = tab.sections;\n var firstSection = sections[0].name.replace(tab.name + \"-\", \"\");\n\n if (realmSection) {\n // console.log(realmSection);\n var sectionValid = false;\n\n if (sections.length <= 1) {\n // console.log(\">>> WARNING - HAS SECTION PARAM... BUT THE TAB IS JUST ONE SECTIONS\")\n router.setRoute(\"/realm/\" + arguments[0] + \"/\" + arguments[1]);\n return;\n }\n\n for (var s in sections) {\n var section = sections[s];\n if (tab.name + \"-\" + realmSection == section.name) {\n // console.log(\">>> Yes!\", section.name)\n sectionValid = true;\n break;\n }\n }\n\n if (!sectionValid) {\n // console.log(\">>> WARNING - SECTION NOT VALID\")\n router.setRoute(\"/realm/\" + arguments[0] + \"/\" + arguments[1] + \"/\" + firstSection);\n // router.setRoute(defaultRoute);\n return;\n }\n \n } else if (sections.length > 1) {\n router.setRoute(\"/realm/\" + arguments[0] + \"/\" + arguments[1] + \"/\" + firstSection); \n return;\n }\n\n break;\n }\n }\n\n if (!tabValid) {\n // console.log(\">>> WARNING - TAB NOT VALID\")\n // args.splice();\n // args = defaultArgs;\n router.setRoute(defaultRoute);\n return;\n \n } else {\n // console.log(\"### Final args\")\n // console.log(args)\n // _navigateToPage.apply(this, args);\n var context = [];\n for (var arg in arguments) {\n context.push(arguments[arg]);\n }\n _navigateToPage(\"realm\", context);\n }\n\n };\n\n var host = function (realmId, hostId) {\n _navigateToPage('host', arguments);\n };\n\n var error = function () {\n _navigateToPage('error');\n };\n\n // var urls = {\n // // global page\n // '/': global,\n // // realm page\n // '/realm/:realmId': realm,\n // '/realm/:realmId/:realmTab': realm,\n // '/realm/:realmId/:realmTab/:tabSection': realm,\n // // '/realm/:realmId/status': realm,\n // // // '/realm/:realmId/assets': realmAssets,\n // // '/realm/:realmId/assets/hosts': realm,\n // // '/realm/:realmId/assets/host-groups': realm,\n // // '/realm/:realmId/assets/business-processes': realm,\n // // '/realm/:realmId/geomap': realm,\n // // host page\n // '/realm/:realmId/host/:hostId': host,\n // // error page\n // '/error': error\n // };\n // return urls;\n\n // global page\n router.on('/', global);\n\n // realm page (subpages)\n router.on('/realm/:realmId', realm);\n router.on('/realm/:realmId/:realmTab', realm);\n router.on('/realm/:realmId/:realmTab/:tabSection', realm);\n\n // host page (subpages)\n router.on('/realm/:realmId/host/:hostId', host);\n \n // error page\n router.on('/error', error);\n \n }", "function createRoute(client) {\n ss.http.route(client.route, function(req, res){ \n res.serveClient(client.name) \n });\n}", "function router(req, res) {\n\tif (req.url !== '/') {\n\t\t// URL module helps us focus on specific parts of the url, like the path in this case\n\t\tvar parsedUrl = url.parse(req.url);\n\t\tvar route = (parsedUrl) ? parsedUrl.pathname : '';\n\t\tswitch (route) {\n\t\t\tcase '/allHeroes':\n\t\t\tcase '/hero':\n\t\t\t\t// All hero API requests go to the hero router\n\t\t\t\theroRouter(parsedUrl, res);\n\t\t\tdefault:\n\t\t\t\t// Assume all other requests are requests for files\n\t\t\t\tfileRouter(parsedUrl, res);\n\t\t}\n\t}\n\telse {\n\t\t// There isn't really a path, so we'll serve the index html to be the default page\n\t\tvar indexPage = fs.readFileSync('./index.html');\n\t\t// Setting code & content type for a good html page\n\t\tres.writeHead(200, {'content-type': 'text/html'});\n\t\tres.end(indexPage);\n\t}\n}", "_loadInitialRoute(){\n\n /*con esta constante y el window.location.pathname.split() estamos \n separar en un arreglo de dos elementos la ruta por ejemplo quedaría \n [/,contacto ] entonces podriamos acceder a cualquiera de estos elementos\n */\n const pathNameSplit = window.location.pathname.split('/');\n /*en esta funcion lo que estamos haciendo es segmentar \n estamos usando el operador ternario diciendo que si el tamaño del arreglo dado es mayor a uno \n solo accedamos al indice 1 que sería del ejemplo anterior [/, contacto] sería el contacto si es que el elemento\n es solo uno por ejemplo [/] entonces al path segs se le da un string vació */\n const pathSegs = pathNameSplit.length > 1 ? pathNameSplit.slice(1) : '';\n\n /* con el ...pathsegs lo que estamos pasando es a todo un obejto iterable por parametro */\n this.loadRoute(...pathSegs)\n }", "function router() { // private function\n\n var path = location.hash; \n console.log('path is ' + path);\n // prints something like /home\n\n // Use the url like an index (JS associative array notation) to find the desired\n // component (function) to run. The component will place content in the content\n // area. If a link is clicked for which a route was never set, give error message.\n if (!routes[path]) {\n document.getElementById(contentId).innerHTML = \"<p>Error: unknown link '\" + path +\n \"' never added to the routing table.</p>\";\n } else {\n routes[path](contentId);\n }\n }", "function router(app) {\n\n}", "match(route) {\n //match route against dictionary of defined paths to their relevant attributes\n for (let [path, {pathRoute, handler, params}] of this.routes) {\n const match = pathRoute.exec(route);\n //each route will be associated with a handler\n //this handler will handle all of the rendering associated with a new change\n if (match !== null) {\n //remove the first / from the route\n //loop through values and add each value with its associated parameter\n const routeParams = match.slice(1).\n reduce((allParams, value, index) => {\n allParams[params[index]] = value;\n return allParams;\n }, {});\n this.currentPath = path;\n //check if we have any query parameters to parse\n if (window.location.search) {\n this.getQueryParameters(window.location.search, routeParams);\n }\n handler(route, routeParams);\n //we don't want to execute more than route once we've matched one\n //if it can match multiple ones so we break\n break;\n }\n\n }\n }", "routes() {\n this.app.use(indexRoutes_1.default);\n this.app.use(\"/api/games\", gamesRoutes_1.default); //Le decimos la ruta de la cual tiene acceso a esa peticion\n //Defecto es '/'\n }", "init() {\n this.router.route('/')\n .get(this.getAll)\n .post(this.postHero);\n this.router.route('/:id')\n .get(this.getOne);\n }", "routes() {\n this.app.use(index_routes_1.default);\n this.app.use('/api/photos', photos_routes_1.default);\n this.app.use('/api/users', users_routes_1.default);\n }", "function route(pathname,response,postData){\n if (typeof requestHandler.handle[pathname] === 'function') {\n\n requestHandler.handle[pathname](response,postData);\n response.end();\n }\n else {\n console.log(\"No request handler found for \" +pathname);\n response.writeHead(404, {\"Content-Type\": \"text/plain\"});\n response.write(\"404 Not found\");\n\n }\n}", "function updateRoute() {\n\n}", "allRoutesInfo(server) {\n\n if (server == null) {\n console.error('Can not print All Routes info, the \\'server\\' instance was not provided');\n return;\n }\n\n console.log('\\n==== ALL ROUTES BEGIN >>>>');\n\n ['GET', 'PUT', 'DELETE', 'POST'].forEach((httpMethod) => {\n console.log(httpMethod + ' paths:');\n server.router.routes[httpMethod].forEach((value) => {\n console.log(value.spec.path);\n });\n });\n\n console.log('<<<< ALL ROUTES END ====\\n');\n\n }", "function initRouters() {\n var r = new DefaultRouter({ App: _shim });\n _shim.reg('Routers', 'DefaultRouter', r);\n }", "function httpRouter(req, res) {\n let url = parse(req.url).pathname.trim();\n switch(typeof methods[req.method + url] === \"function\" && req.method) {\n case \"GET\":\n case \"POST\":\n case \"DELETE\":\n case \"PUT\":\n case \"PATCH\":\n case \"OPTIONS\":\n case \"HEAD\":\n methods[req.method + url](req, res);\n break;\n default:\n res.writeHead(404, {\"content-type\": \"text/html\"});\n res.end(`${req.method} ${url} not found`);\n }\n}", "function setupRoutes(app){\n const APP_DIR = `${__dirname}/app`\n const features = fs.readdirSync(APP_DIR).filter(\n file => fs.statSync(`${APP_DIR}/${file}`).isDirectory()\n )\n\n features.forEach(feature => {\n const router = express.Router()\n const routes = require(`${APP_DIR}/${feature}/routes.js`)\n\n routes.setup(router)\n app.use(`/${feature}`, router)\n })\n}", "function mock_resp(path, handler)\n{ this.__api_map[path] = handler;\n}", "gotoListPage() {\n goto.route('/snippets');\n }", "function AboutRoute(db) {\n //var ctrl = new AboutCtrl(db);\n \n return [\n {\n method: 'GET',\n path: '/',\n handler: (request, h) => {\n \n return 'Hello, world!';\n }\n },\n {\n method: 'GET',\n path: '/{name}',\n handler: (request, h) => {\n \n return 'Hello, ' + encodeURIComponent(request.params.name) + '!';\n }\n }\n ];\n}", "function API(router, baseurl) {\n var wildcard = require('wildcard');\n var express = require('express');\n var expressRouter = express.Router();\n\n // handle requests to manage the routesets\n var bodyParser = require('body-parser');\n var jsonParser = bodyParser.json();\n\n expressRouter.route('/')\n .get(function (req, res) {\n res.send({\n routesets: baseurl+'/routesets'\n });\n });\n\n expressRouter.route('/routesets')\n .get(function(req, res) {\n router.getRouteSets(req.query.all !== undefined)\n .then(function (routesets) {\n res.send(\n routesets.map(function (rs) {\n return {\n name: rs.name,\n routes: rs.routes,\n self: baseurl + '/routesets/' + rs.name\n };\n }).filter(function (rs) {\n return (!req.query.name || wildcard(req.query.name,rs.name));\n })\n );\n })\n .catch(function (err) {\n res.status(500).send(err);\n });\n })\n .post(jsonParser, function(req,res) {\n var rs = req.body;\n if(!rs || !rs.name) {\n res.status(400).send('name is required');\n } else {\n router.getAppRouteSet(rs.name,true).then(function(routeset) {\n routeset.setRoutes(rs.routes);\n return routeset.store();\n }).then(function() {\n res.status(201).send('Created');\n }).catch(function (err) {\n res.status(500).send(err);\n });\n\n }\n });\n\n expressRouter.route('/routesets/:name')\n .get(function(req, res) {\n var rsName = req.params.name;\n var rs;\n if(rsName === '_default_') {\n rs = Promise.resolve(router.defaultRouteSet);\n } else {\n rs = router.getAppRouteSet(rsName);\n }\n\n rs.then(function(routeset) {\n res.send(\n {\n name: routeset.name,\n routes: routeset.routes,\n self: baseurl+'/routesets/' + routeset.name\n }\n );\n }).catch(function(err) {\n res.sendStatus(404);\n });\n })\n .put(jsonParser, function(req,res) {\n var rsName = req.params.name;\n var rs = req.body;\n\n if(rsName === '_default_') {\n res.status(400).send('_default_ cannot be update via the API');\n } else {\n router.getAppRouteSet(rsName,true).then(function (routeset) {\n routeset.setRoutes(rs.routes);\n return routeset.store();\n }).then(function(routeset) {\n res.send(\n {\n name: rsName,\n routes: routeset.routes,\n self: baseurl+'/routesets/' + rsName\n }\n );\n }).catch(function (err) {\n console.error(err);\n console.error(err.stack);\n res.status(500).send(err);\n });\n\n }\n })\n .delete(jsonParser, function(req,res) {\n var rsName = req.params.name;\n\n if(rsName === '_default_') {\n res.status(400).send('_default_ cannot be update via the API');\n } else {\n router.getAppRouteSet(rsName,true).then(function (routeset) {\n delete router.appRouteSets[rsName];\n return routeset.delete();\n }).then(function() {\n res.sendStatus(200);\n }).catch(function (err) {\n console.error(err);\n console.error(err.stack);\n res.status(500).send(err);\n });\n\n }\n });\n\n return expressRouter;\n}", "function setPublicRoutes() {\n}", "function userRoutes() {\n return (open, closed) => {\n };\n}", "function init_router(next) {\n var config = nodeca.config.router, pointer, default_mount, unknown_methods;\n\n pointer = nodeca.runtime.router = new Pointer();\n\n // calculate default mount points\n default_mount = {host: '//' + nodeca.config.listen.host, path: ''};\n\n if (80 !== +nodeca.config.listen.port) {\n default_mount.host += ':' + nodeca.config.listen.port;\n }\n\n if (nodeca.config.listen.path && '/' !== nodeca.config.listen.path) {\n default_mount.path += nodeca.config.listen.path.replace(/^\\/+$/g, '');\n }\n\n //\n // validate routes\n unknown_methods = _.filter(_.keys(config.map || {}), function (api_path) {\n return !HashTree.get(nodeca.server, api_path);\n });\n\n if (unknown_methods.length) {\n next(new Error(\"Router map contains unknown server api methods: \" +\n unknown_methods.join(', ')));\n return;\n }\n\n //\n // fill in routes\n _.each(config.map || {}, function (routes, api_path) {\n var prefix = config.mount[api_path.split('.').shift()];\n\n if (!prefix) {\n prefix = default_mount.host + default_mount.path;\n } else if ('//' !== prefix.substr(0, 2)) {\n prefix = default_mount.host + prefix;\n }\n\n _.each(routes, function (params, pattern) {\n if ('#' === pattern[0]) {\n // skip non-server routes\n return;\n }\n\n pointer.addRoute(pattern, {\n name: api_path,\n prefix: prefix,\n params: fix_params_regexps(params),\n meta: {\n name: api_path,\n func: HashTree.get(nodeca.server, api_path)\n }\n });\n });\n });\n\n //\n // fill in redirects\n _.each(config.redirects || {}, function (options, old_pattern) {\n var code, link_to;\n\n // redirect provided as a function\n if (_.isFunction(options.to)) {\n pointer.addRoute(old_pattern, {\n params: fix_params_regexps(options.params),\n meta: {\n name: '!redirect!',\n func: function (params, cb) {\n options.to.call(nodeca, params, cb);\n }\n }\n });\n return;\n }\n\n // create detached route - to build URLs\n code = options.to.shift();\n link_to = Pointer.createLinkBuilder(options.to.shift(), options.params);\n\n pointer.addRoute(old_pattern, {\n params: fix_params_regexps(options.params),\n meta: {\n name: '!redirect!',\n func: function (params, cb) {\n var url = link_to(params);\n\n if (!url) {\n cb(new Error('Invalid redirect.'));\n return;\n }\n\n cb({redirect: [code, url]});\n }\n }\n });\n });\n\n //\n // validate direct invocators\n unknown_methods = _.filter(_.keys(config.direct_invocators || {}), function (api_path) {\n return !HashTree.get(nodeca.server, api_path);\n });\n\n if (unknown_methods.length) {\n next(new Error(\"Direct invocators contains unknown server api methods: \" +\n unknown_methods.join(', ')));\n return;\n }\n\n //\n // fill in direct invocators\n _.each(config.direct_invocators || {}, function (enabled, api_path) {\n if (!enabled) {\n // skip disabled invocators\n return;\n }\n\n pointer.addRoute(default_mount + '/!' + api_path + '(?{query})', {\n params: { query: /.*/ },\n meta: {\n name: api_path,\n func: HashTree.get(nodeca.server, api_path)\n }\n });\n });\n\n next();\n}", "buildRouter(routes) {\n for (let resource in routes) {\n this.buildRoute(routes[resource], resource, (route, controller)=> {\n let appRoute = new Route(controller);\n appRoute.createRoute(route);\n });\n }\n }", "function processRoutes()\n {\n if(!app.routes){\n Ext.global.console.warn(\"No routes were found. Consider defining routes object in your Ext.application definition.\");\n return;\n }\n \n Ext.iterate(app.routes, function(route, value)\n {\n value = value.split('#');\n route = removeSlash(route, true);\n \n routes.push({\n controller : Ext.String.capitalize(value[0]),\n action : value[1],\n sections : route.split('/')\n });\n });\n }", "function prepareRoutes(route, baseUrl) {\r\n if (!route.url) {\r\n route.url = route.path;\r\n if (baseUrl) {\r\n route.url = baseUrl.concat('/', route.path);\r\n }\r\n }\r\n\r\n if (route.childRoutes) {\r\n for (var i = 0; i < route.childRoutes.length; i++) {\r\n route.childRoutes[i] = prepareRoutes(route.childRoutes[i], route.url);\r\n }\r\n if (!route.indexRoute) {\r\n route.indexRoute = {\r\n onEnter: (nextState, replace) => {\r\n replace(formatURL(route.childRoutes[0].url, nextState.params));\r\n }\r\n };\r\n }\r\n }\r\n return route;\r\n}", "async intercept(_ctx, _next) {\n let routeData = { match: false };\n switch (_ctx.request.method.toLowerCase()) {\n case 'head': routeData = this._travel('head', _ctx); break;\n case 'get': routeData = this._travel('get', _ctx); break;\n case 'post': routeData = this._travel('post', _ctx); break;\n case 'put': routeData = this._travel('put', _ctx); break;\n case 'patch': routeData = this._travel('patch', _ctx); break;\n case 'delete': routeData = this._travel('delete', _ctx); break;\n }\n\n if (routeData.match) {\n _ctx.request.route = routeData;\n await routeData.match(_ctx, _next, routeData);\n }\n await _next();\n }", "viewRoute() {\n\n this.router.use(auth.isLoggedIn());\n \n this.router.get('/signup', signup);\n this.router.get('/login', login);\n this.router.get('/forgot-password', forgotPassword);\n this.router.get('/reset-password', resetPassword);\n this.router.get('/forgot-password/success', forgotPasswordSuccess);\n this.router.get('/team', team);\n this.router.get('/volunteer', volunteer);\n this.router.get('/', home);\n this.router.get('/about-us', about);\n this.router.post('/', (req, res, next) => (req.page='home', next()), home);\n\n \n this.router.get(\n '/donor',\n auth.authenticateApp(),\n auth.authorizeApp('donor'),\n (req, res, next) => res.redirect('/donor/dashboard')\n );\n \n this.router\n .get(\n '/donor/dashboard',\n auth.authenticateApp(),\n auth.authorizeApp('donor'),\n (req, res, next) => ((req.page = 'dashboard'), next()),\n donorDashboard\n );\n \n this.router\n .get(\n '/donor/donations',\n auth.authenticateApp(),\n auth.authorizeApp('donor'),\n (req, res, next) => ((req.page = 'donations'), next()),\n donorDashboard\n );\n \n this.router\n .get(\n '/donor/donations/verify',\n auth.authenticateApp(),\n auth.authorizeApp('donor'),\n verifyMonetaryDonation\n )\n \n return this.router;\n}", "function init(router) {\n router.route('/categories').get(getCategories);\n router.route('/categories/:categoryCode').get(getCategoriesByCategoryCode);\n router.route('/categories/:categoryCode/types').get(getTypesByCategoryCode);\n router.route('/categories/:categoryCode/types/:typeCode').get(getTypesByCategoryAndTypeCode);\n router.route('/categories/:categoryCode/types/:typeCode/subtypes').get(getSubTypesByCategoryCodeAndTypeCode);\n router.route('/categories/:categoryCode/types/:typeCode/subtypes/:subTypeCode').get(getSubTypesByCategoryCodeTypeCodeAndSubTypeCode);\n router.route('/categories/:categoryCode/typedesc/:typeDesc/subtypedesc/:subTypeDesc').get(getSubTypeCodeByCategoryCodeTypeCodeAndSubType);\n\n router.route('/tenants').get(getTenantsByTenantCode);\n router.route('/tenants/:tenantCode').get(getTenantsByTenantCode);\n\n router.route('/priorities').get(getPrioritiesByPriorityCode);\n router.route('/priorities/:priorityCode').get(getPrioritiesByPriorityCode);\n\n router.route('/statuses').get(getStatus);\n router.route('/statuses/:statusCode').get(getStatusByStatusCode);\n router.route('/statuses').post(postStatusByArrayOfStatusCodes);\n}", "setupRoutes() {\n this.app.use(this.express.static(__dirname + '/www'));\n this.app.use(this.express.static(__dirname + '/module1/www'));\n this.app.use(this.express.static(__dirname + '/module2/www'));\n this.app.use(this.express.static(__dirname + '/module3/www'));\n this.app.use(this.express.static(__dirname + '/module4/www'));\n this.app.use(this.express.static(__dirname + '/module5/www'));\n this.app.use(this.express.static(__dirname + '/projects/www'));\n this.app.use(this.express.static(__dirname + '/module1/frontend'));\n this.app.use(this.express.static(__dirname + '/module2/frontend'));\n this.app.use(this.express.static(__dirname + '/module3/frontend'));\n this.app.use(this.express.static(__dirname + '/module4/frontend'));\n this.app.use(this.express.static(__dirname + '/module5/frontend'));\n \n this.app.all('/meta/*', function(req, res, next) {\n var path = req.path.substr('/meta/'.length);\n var dirname = require('path').dirname(path);\n var filename = require('path').basename(path);\n if (require('fs').existsSync(dirname + '/meta.json')) {\n res.send(require('fs').readFileSync(dirname + '/meta.json', \n 'utf8'));\n }\n else {\n res.send('{}');\n }\n });\n\n this.app.all('/readings/*', function(req, res, next) {\n var path = req.path.substr('/readings/'.length);\n var dirname = require('path').dirname(path);\n var filename = require('path').basename(path);\n filename = filename.split('.');\n filename.splice(-1, 0, 'modified');\n filename = filename.join('.');\n try {\n if (require('fs').existsSync(dirname + '/' + \n filename)) {\n res.send(require('fs').readFileSync(dirname + '/' + \n filename, 'utf8'));\n } else {\n res.send(require('fs').readFileSync(__dirname + '/' + \n path, 'utf8'));\n }\n } catch(e) {\n res.send('');\n }\n });\n \n this.app.all('/reset/*', function(req, res, next) {\n var path = req.path.substr('/reset/'.length);\n var dirname = require('path').dirname(path);\n var filename = require('path').basename(path);\n filename = filename.split('.');\n filename.splice(-1, 0, 'modified');\n filename = filename.join('.');\n try {\n if (require('fs').existsSync(__dirname + '/' + dirname + '/' + \n filename)) {\n require('fs').unlinkSync(__dirname + '/' + dirname + \n '/' + filename);\n } else {\n console.info('An error: file not found?');\n }\n res.send();\n } catch(e) {\n res.send('');\n }\n });\n \n this.app.all('/run/*', function(req, res, next) {\n res.send('Node runner is being worked on. Check back soon.');\n return;\n // TODO:\n var status = '';\n var file = req.path.substr('/run/'.length);\n // open the log file for writing\n var log = __dirname + '/' + file.replace(/\\\\/g, '/')\n .replace(/\\//g, '_') + '.log';\n require('fs').writeFileSync(log, '');\n var ws = require('fs').createWriteStream(log);\n let original = process.stdout.write;\n process.stdout.write = process.stderr.write = ws.write.bind(ws);\n\n // run the file now\n require(__dirname + '/' + file);\n \n // begin the read\n let sent = false;\n var rs = require('fs').createReadStream(log);\n res.set('etag', (new Date()).getTime());\n rs.on('data', function(data) {\n res.write(data);\n });\n rs.on('end', function() {\n res.end();\n try {require('fs').unlinkSync(log);} catch(e) {console.log(e);}\n try {ws.end();} catch(e) {console.log(e);}\n process.stdout.write = process.stderr.write = original;\n sent = true;\n });\n setTimeout(() => {\n if (!sent) {\n rs.pause();\n ws.end();\n res.send();\n try {require('fs').unlinkSync(log);} catch(e) {}\n }\n }, 60000);\n });\n \n this.app.post('/save/*', function(req, res, next) {\n var path = req.path.substr('/save/'.length);\n var dirname = require('path').dirname(path);\n var filename = require('path').basename(path);\n let data = '';\n req.on('data', function(datum) {\n data += datum;\n });\n req.on('end', function() {\n filename = filename.split('.');\n filename.splice(-1, 0, 'modified');\n filename = filename.join('.');\n require('fs').writeFileSync(dirname + '/' + filename, data);\n res.send();\n });\n });\n }", "function routing() {\n switch (document.location.hash) {\n case '':\n ajaxRequestWithCallback('views/home.html', importInViewForHome);\n break;\n case \"#game\":\n ajaxRequestWithCallback('views/game.html', importInViewAndStartGame);\n break;\n case \"#score\":\n ajaxRequestWithCallback('views/score.html', importInViewAndShowScore);\n break;\n case \"#controls\":\n ajaxRequestWithCallback('views/controls.html', importInViewAndShowControls);\n break;\n case \"#modal\":\n ajaxRequestWithCallback('views/modal.html', importInViewAndSaveScore);\n break;\n default:\n ajaxRequestWithCallback('views/pageNotFound.html', importInView);\n break;\n }\n }", "function route() { // main loop!\n\tlet current = getCurrent();\n\n\tif ( current !== hashRoute ){\n\t\thashRoute = current;\n\t\trenderNav(); // render proper nav for any page change per user, one line to handle ALL requirements.\n let [i, idStr] = hashRoute.split(\"/\");\n\t\tif ( hashRoute == \"#home\" ){\n home();\n\t\t} else if ( hashRoute == \"#register\" ){\n\t\t\tregister();\n\t\t} else if ( hashRoute == \"#logout\" ){\n logout();\n\t\t} else if ( hashRoute.includes(\"recepie\") ){\n\t\t\trecepieInfo( idStr );\n\t\t} else if ( hashRoute.includes(\"edit\") ){\n\t\t\trecepieEdit( idStr );\n\t\t} else if ( hashRoute.includes(\"archive\") ){\n\t\t\tdeleteRecepie( idStr );\n\t\t} else if ( hashRoute.includes(\"like\") ){\n\t\t\tlikeRecepie( idStr );\n } else if ( hashRoute == \"#share\" ){\n\t\t\trecepieShare();\n\t\t} else if ( // !user || \n // !userObj ||\n // window.location.hash == \"\" ||\n hashRoute == \"#login\"\n ){\n login();\n\t\t} else if( hashRoute == \"#makeFood\" ){\n makeFood(); // for testing\n }\n\t}\n\tsetTimeout( route, 150 );\n}", "findRoute(ctx) {\n const url = ctx.request.url();\n const method = ctx.request.method();\n const hostname = ctx.request.hostname();\n /*\n * Profiling `route.match` method\n */\n const matchRoute = ctx.profiler.profile('http:route:match');\n const route = this.router.match(url, method, hostname || undefined);\n matchRoute.end();\n /*\n * Raise error when route is missing\n */\n if (!route) {\n throw new utils_1.Exception(`Cannot ${method}:${url}`, 404, 'E_ROUTE_NOT_FOUND');\n }\n /*\n * Attach `params`, `subdomains` and `route` when route is found. This\n * information only exists on a given route\n */\n ctx.params = route.params;\n ctx.subdomains = route.subdomains;\n ctx.route = route.route;\n ctx.routeKey = route.routeKey;\n }", "function route() {\n\t\tvar o = status(); //get current hash object.\n\t\tif (o) {\n\t\t\t_callControllerFromObj(o.id, o.params);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "routes() {\n this.app.use('/images', express.static('uploads'));\n this.app.use('/users/', userRoutes);\n this.app.use('/tokens/', tokenRoutes);\n this.app.use('/shop/', shopRoutes);\n this.app.use('/products/', productRoutes);\n this.app.use('/order/', orderRoutes);\n this.app.use('/address/', addressRoutes);\n this.app.use(\"/creditCard/\", creditCardRoutes)\n }", "route(req) {\n // find first matching route\n const route = this.routes.find(r => {\n const url = new URL(req.url)\n return r.method === req.method.toLowerCase() && \n url.pathname.match(r.pathRegexp)\n })\n\n // run this route's handler\n if (route) {\n return route.handler(req);\n }\n\n // otherwise serve 404\n return NotFoundHandler(req)\n }", "function loadAppRoutes(app){\n\t//To support JSON-encoded bodies\n\tapp.use(bodyParser.json());\n\n\t//To support URL-encoded bodies\n\t//app.use(bodyParser.urlencoded({extended:true}));\n\n\t//Load routes which require no authorization (publicly available)\n\tapp.use(\"/public\", publicRoutes);\n\n\t//Load routes which require authorization (secured access)\n\tapp.use(\"/secure\", securedRoutes);\n\n\t//TEST route for checking successful deployment\n\tapp.get(\"/\", function(req,res){\n\t\tres.send(\"Hello! You have reached the index.\");\n\t});\n}" ]
[ "0.66899425", "0.66037214", "0.65785885", "0.6513291", "0.6469461", "0.64280224", "0.64121205", "0.63814133", "0.63707966", "0.6364794", "0.6332877", "0.62410223", "0.623515", "0.6202859", "0.6200318", "0.620011", "0.6199692", "0.61903125", "0.6168049", "0.6104129", "0.6099752", "0.6094785", "0.6065142", "0.6063361", "0.606011", "0.6056496", "0.60500836", "0.6015372", "0.6015372", "0.6013467", "0.6012496", "0.6011558", "0.6010608", "0.5999472", "0.5991878", "0.5984339", "0.5977111", "0.59697664", "0.59608424", "0.5958997", "0.5953114", "0.59483814", "0.59423745", "0.5941676", "0.5941579", "0.5935569", "0.59306556", "0.59230024", "0.59084785", "0.590698", "0.5905677", "0.5905222", "0.5896209", "0.58937114", "0.5893248", "0.5886589", "0.58744603", "0.5872293", "0.5867986", "0.5858822", "0.5858301", "0.5846835", "0.5832864", "0.5831227", "0.5813175", "0.5812727", "0.5809402", "0.5803285", "0.5802623", "0.58022106", "0.5801525", "0.578823", "0.57849354", "0.5783937", "0.5780259", "0.57651156", "0.5764989", "0.575333", "0.57513636", "0.5750042", "0.5742209", "0.57411754", "0.5735047", "0.57324374", "0.57270193", "0.57264245", "0.57251", "0.5721881", "0.57179815", "0.5715373", "0.5714307", "0.5693217", "0.5689197", "0.5684503", "0.56791216", "0.5675033", "0.5664985", "0.5663389", "0.56619734", "0.5655115", "0.5654099" ]
0.0
-1
update is same as create for now.
async function updatePushIdea(pushIdeaObject) { return createPushIdea(pushIdeaObject); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update(){}", "update(){}", "update(){}", "update(now) {\n throw new Error('You have to implement the \"update\" method!');\n }", "update(id) {\n\n }", "async function UpdateNew() {}", "async createOrUpdate () {\n\t\tif (this.existingModel) {\n\t\t\tawait this.update();\n\t\t}\n\t\telse {\n\t\t\tawait this.create();\n\t\t}\n\t}", "update(id, data, params) {}", "async update() {}", "updateCreate (state, payload) {\n // like update, but creates the object at location if it doesn't exist\n // basically like create w/o the checker\n // USE THIS SPARINGLY, most likely a state obj doesn't exist b/c of typo or race condition\n // if(!silent)\n // debug('Store.updateCreate', 'Creating', payload, state)\n console.log('UPDATECREATE', payload)\n\n // iterator \n Object.keys(payload).map((name, i) => {\n // const value = Object.values(payload)[0]\n // preserve things like functions, not just data w/ object.create\n state[name] = payload[name]\n })\n\n // single object\n // const name = Object.keys(payload)[0]\n // const value = Object.values(payload)[0]\n // state[name] = value\n }", "createOrUpdate(body, res) {\n if (body.id !== undefined) {\n this.update(body, res)\n } else {\n this.create(body, res);\n }\n }", "get updateCreate () {\n\t\treturn this._updateCreate;\n\t}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "function update() {}", "update(t) {}", "update(id, user) {\n return 1;\n }", "update() {\n throw new Error(\"Not Implemented\");\n }", "update()\n\t{ \n\t\tthrow new Error(\"update() method not implemented\");\n\t}", "async function updateCourse(id) \n{\n \n // Creating an async await class to get the course by the id \n const course = await COURSE\n .findById(id); \n \n console.log(id); \n\n // if the course is empty, return a \"null\" value \n if ( !course ) return; \n\n // Changing the values \n // course.isPublished = true; \n // course.author = 'Changed Author'; \n\n course.set({\n isPublished: true, \n name: \"Python Course\", \n author: 'Mbonu Chinedu', \n price: 100.23\n }); \n\n // Saving the new changed values \n const resultOfSavedModifedCourse = await course.save();\n console.log(resultOfSavedModifedCourse); \n\n}", "updateCreate (state, payload) {\n // like update, but creates the object at location if it doesn't exist\n // basically like create w/o the checker\n // USE THIS SPARINGLY, most likely a state obj doesn't exist b/c of typo or race condition\n // if(!silent)\n // debug('Store.updateCreate', 'Creating', payload, state)\n // console.log('UPDATECREATE', payload)\n\n // iterator \n Object.keys(payload).map((name) => {\n // const value = Object.values(payload)[0]\n // preserve things like functions, not just data w/ object.create\n state[name] = payload[name]\n })\n\n // single object\n // const name = Object.keys(payload)[0]\n // const value = Object.values(payload)[0]\n // state[name] = value\n }", "async update({ params, request, response }) {\n }", "async update() {\n throw new Error(\"Operation not supported.\");\n }", "async updateOrCreate(attributes, values) {\r\n if (_.isNil(attributes)) {\r\n throw new Exception('attributes should not empty', 1000);\r\n }\r\n\r\n const item = await this.Models().findOne({\r\n where: attributes\r\n });\r\n\r\n let result;\r\n\r\n if (item) {\r\n result = await item.update(values);\r\n } else {\r\n result = await this.Models().create(values);\r\n }\r\n return result;\r\n }", "update () {}", "async update ({ params, request, response }) {\n }", "async update ({ params, request, response }) {\n }", "async update ({ params, request, response }) {\n }", "async update ({ params, request, response }) {\n }", "async update ({ params, request, response }) {\n }", "async update ({ params, request, response }) {\n }", "async update ({ params, request, response }) {\n }", "async update({ params, request, response }) {\n }", "updated() {}", "async update({ params, request, response }) {}", "update(updater) {\n if (typeof updater === \"function\") {\n this.data = updater(this.data);\n } else {\n this.data = Object.assign({}, this.data, updater);\n }\n\n this.persist();\n }", "function update() {\n // ... no implementation required\n }", "update(id, level) {\n // CRUD - Create, Read, Update, Delete\n }", "_update() {\n }", "update(instance, {\n question, student, moderated, visible, moderatorComments, retired,\n }) {\n const docID = this.getID(instance);\n const updateData = {};\n if (question) {\n updateData.question = question;\n }\n if (student) {\n updateData.studentID = Users.getID(student);\n }\n if (_.isBoolean(moderated)) {\n updateData.moderated = moderated;\n }\n if (_.isBoolean(visible)) {\n updateData.visible = visible;\n }\n if (moderatorComments) {\n updateData.moderatorComments = moderatorComments;\n }\n if (_.isBoolean(retired)) {\n updateData.retired = retired;\n }\n this._collection.update(docID, { $set: updateData });\n }", "static update(request, response) {\r\n\r\n itemsModel.getById(request.body.id)\r\n .then( data => {\r\n if (data.length > 0) {\r\n\r\n //recupera do body os campos que serao atualizados na tabela\r\n const conditions = [\r\n {\r\n field: 'id',\r\n value: request.body.id\r\n },\r\n {\r\n field: 'title',\r\n value: request.body.title\r\n },\r\n {\r\n field: 'descr',\r\n value: request.body.descr\r\n },\r\n {\r\n field: 'photo',\r\n value: request.body.photo\r\n },\r\n {\r\n field: 'category',\r\n value: request.body.category\r\n },\r\n ];\r\n\r\n //chama rotina para atualizacao dos dados\r\n itemsModel.update(conditions) \r\n response.sendStatus(200);\r\n console.log('Item has been updated. ID: ', request.body.id); \r\n } else {\r\n response.sendStatus(404);\r\n console.log('Item not found. ID: ', request.body.id);\r\n }\r\n })\r\n .catch(err => {\r\n response.sendStatus(500);\r\n console.log('Error updating Item by ID: ', request.body.id, err);\r\n });\r\n \r\n }", "update(req, res, next) {\n res.status(200).json({\n msg: 'Not implemented yet!'\n }).end()\n }", "update(attributes) {\n console.log(attributes)\n\n self.attributes = Object.assign({}, self.attributes, attributes)\n self.persist()\n }", "update(body, res) {\n this.model.findOne({where: {id: body.id}}).then(object => {\n if (object !== null) {\n object.update(body).then(object => res.status(200).json({\n type: 'success',\n message: `updated!`,\n data: object\n }));\n } else {\n res.status(200).json({\n type: 'success',\n message: `not found!`,\n data: null\n })\n }\n }).catch(e => res.status(200).json({\n type: 'Error',\n message: e.message,\n data: e\n }));\n }", "update()\n {\n \n }", "update(puppy) {\n return http.put('/editPuppy', puppy); // pass the id??? Embedded in the puppy object\n }", "setCreated(created) { }", "updateWith(data) {\n this.formattedTime(data.formattedTime);\n this.updatedAt(data.updatedAt);\n this.state(data.state);\n this.commentAmount(data.commentAmount);\n this.message(data.message);\n return this.isDeleted(data.isDeleted);\n }", "function update (kind, id, newData, userId, cb) {\n \n console.log('update('+kind+', '+id+', '+JSON.stringify(newData)+', '+userId+')');\n \n var nonIndexedFields = [];\n if (kind == 'User')\n nonIndexedFields = ['password'];\n /*\n else if (kind == 'Beacon')\n nonIndexedFields = [];\n else if (kind == 'Special')\n nonIndexedFields = [];\n else if (kind == 'Property')\n nonIndexedFields = [];\n else if (kind == 'Store')\n nonIndexedFields = [];\n else if (kind == 'Impression')\n nonIndexedFields = [];\n */\n \n if (newData.id) {\n delete newData.id; // do not save id into a non-key field\n }\n \n newData.updated_on = sys.getNow();\n newData.updated_by = userId;\n \n if (id) {\n read(kind, id, function (err, currentData) {\n if (err) {\n if (cb) {\n cb(err);\n }\n return;\n }\n \n if (!currentData.created_on) {\n currentData.created_on = sys.getNow();\n }\n if (!currentData.created_by) {\n currentData.created_by = userId;\n }\n \n for (var prop in newData) {\n if (currentData[prop] != newData[prop]) {\n currentData[prop] = newData[prop];\n }\n }\n \n if (currentData.id) {\n delete currentData.id; // do not save id into a non-key field\n }\n \n let key = ds.key([kind, parseInt(id, 10)]);\n\n const entity = {\n key: key,\n data: toDatastore(currentData, nonIndexedFields)\n };\n \n ds.save(entity, (err) => {\n if (err) {\n if (cb) {\n cb(err);\n }\n } else {\n read(kind, id, cb);\n }\n });\n });\n } else {\n \n let key = ds.key(kind);\n const entity = {\n key: key,\n data: toDatastore(newData, nonIndexedFields)\n };\n\n ds.save(entity, (err, a) => {\n // We don't know the id of the new Entity, so look up the last one to be created\n try {\n console.log('a: ' + a);\n console.log('a obj: ' + JSON.stringify(a));\n } catch (ex) {\n console.log(ex);\n }\n if (cb)\n cb(err, err ? null : newData);\n });\n }\n}", "update(object) { \n debug('update', object);\n return this._doPut(this._singleResourceURI(object.uid), object);\n }", "async function update(req, res) {}", "update(objUpdate) {\n if(!objUpdate.id) return new Error('item missing id property');\n if(this.warehouse[objUpdate.id]) {\n this.warehouse[objUpdate.id] = Object.assign({}, objUpdate);\n return objUpdate;\n }\n else {\n return new Error('id not found');\n }\n }", "function update(data) {\n console.log('+++ TODO');\n }", "async update () {\n\t\t// do the update\n\t\tif (!this.ops) {\n\t\t\tthis.ops = {\n\t\t\t\t$set: this.attributes\n\t\t\t};\n\t\t\tdelete this.ops.$set.id;\n\t\t}\n\t\tthis.updateOp = await this.collection.applyOpById(\n\t\t\tthis.id,\n\t\t\tthis.ops,\n\t\t\t{ version: this.modelVersion }\n\t\t);\n\t}", "async function updatecourse(id){\r\n const course= await Course.findById(id);\r\n \r\n if(!course) return;\r\n\r\n course.isPublished=true;\r\n course.author='meghana';\r\n\r\n const result= await course.save();\r\n console.log(result)\r\n\r\n //OR\r\n // course.set({\r\n // isPublished:true,\r\n // author:'meghana'\r\n // });\r\n\r\n}", "update(startingData) {}", "_update(update) {\n Channel._preprocessUpdate(update, this._sid);\n\n let updated = false;\n for (let key in update) {\n let localKey = fieldMappings[key];\n if (!localKey) {\n continue;\n }\n\n if (localKey === fieldMappings.status) {\n this._status = filterStatus(update.status);\n } else if (localKey === fieldMappings.attributes) {\n if (!JsonDiff.isDeepEqual(this._attributes, update.attributes)) {\n this._attributes = update.attributes;\n updated = true;\n }\n } else if (update[key] instanceof Date) {\n if (!this[localKey] || this[localKey].getTime() !== update[key].getTime()) {\n this['_' + localKey] = update[key];\n updated = true;\n }\n } else if (this[localKey] !== update[key]) {\n this['_' + localKey] = update[key];\n updated = true;\n }\n }\n\n // if uniqueName is not present in the update - then we should set it to null on the client object\n if (!update.status && !update.uniqueName) {\n if (this._uniqueName) {\n this._uniqueName = null;\n updated = true;\n }\n }\n\n if (updated) { this.emit('updated', this); }\n }", "async doUpdate () {\n\t\tif (Object.keys(this.changes).length === 0) {\n\t\t\t// nothing to save\n\t\t\treturn;\n\t\t}\n\t\t// do the update\n\t\tconst op = { $set: this.changes };\n\t\tthis.updateOp = await new ModelSaver({\n\t\t\trequest: this.request,\n\t\t\tcollection: this.collection,\n\t\t\tid: this.existingModel.id\n\t\t}).save(op);\n\t\tObject.assign(this.existingModel.attributes, this.changes);\n}", "update(add) {\r\n\t\tconst conf = _.assign({}, this.conf, add || {})\r\n\r\n this.set.title(conf)\r\n // this.set.meta(conf)\r\n\t}", "update() {\n this.checkOkToUpdate();\n\n if (true) {\n let key = DB._getDbKey(this.obj.toModel(), this.collection);\n\n if (key != this.key) {\n console.log(\"Old key: \", this.key, \"New key: \", key);\n throw \"Update should not change key!\";\n }\n }\n\n if (this.state == ObjectStates.COMMITTED) {\n this.state = ObjectStates.UPDATE_PENDING;\n this.db._addDirty(this, this.collection);\n }\n }", "updateToAll() {}", "async update (req, res, id) {\n throw new Error('update: Implementation Missing!')\n }", "update(data) {\n this.data = data || this.data;\n this._updateID++;\n }", "function testUpdate(){\n UserModel.findByIdAndUpdate({_id:'5c016964c01b2f04cc7e514d'}, {name: 'John'}, {new: true},function(err, user){\n console.log('findByIdAndUpdate', err, user)\n })\n}", "async save(isCreated){\n \n let sql = '';\n // insert\n if(isCreated){\n \n sql = `INSERT INTO ${this.tableName} (tenTheLoai,moTa) VALUES ('${this.columns.tenTheLoai}','${this.columns.moTa}')`;\n try {\n let results = await database.excute(sql);\n this.id = results.insertId;\n } catch (error) {\n throw error;\n }\n }\n\n // update\n else{\n sql = `UPDATE ${this.tableName} SET moTa='${this.columns.moTa}',tenTheLoai='${this.columns.tenTheLoai}' `+\n `WHERE id = ${this.id}`;\n try {\n let rs = await database.excute(sql);\n this.id = rs.id; \n } catch (error) {\n throw error;\n }\n }\n }", "update() {\n return update.call(this);\n }", "updateRecord(recordId: number, newRecord: Object) {\n // Asserting all values in record are valid\n if (!this._assertRecordValid(newRecord)) {\n return\n }\n\n // Retrieving old record\n let oldRecord: Object = this.crudStore.getData().get(recordId)\n\n // Iterating over the new record to update and setting the invisible fields\n // value's so that they cannot change since invisible fields are not editable\n // in any circumstance\n for (let field: any of (this.crudStore.getSchema(): List<Object>)) {\n // Asserting current field invisible, if yes saving the old value\n if (field.invisible) {\n newRecord[field.id] = oldRecord[field.id]\n }\n }\n \n // Asserting store is a server store\n if (this.crudStore.type === 'server') {\n // Executing record update action to server\n this.crudStore.executeServerDatabaseAction('update', newRecord)\n }\n else {\n // Updating record in temporary store\n this.crudStore.setData(this.crudStore.getData().set(recordId, newRecord));\n }\n }", "async update (req, h) {\n\n const dog = await Dog.findById(req.params.id);\n\n if (!dog) return Boom.notFound('Dog not found', {\n id: req.params.id,\n });\n\n dog.set({\n name: req.payload.name,\n breed: req.payload.breed,\n age: req.payload.age,\n image: req.payload.image\n });\n return dog.save().then((product, err) => {\n if (err) return Boom.badRequest(err)\n console.log('err ', err);\n console.log('dog', dog);\n return { message: 'Dog data updated successfully', dog: dog };\n });\n }", "async update ({ params, request, response }) {\n const product = await Product.find(params.id)\n const data = request.only([\n \"name\", \n \"description\", \n \"price\"\n ])\n product.merge(data)\n if (product) {\n response.status(200).json({\n success: 'Product Updated',\n data: data\n })\n await product.save()\n } else {\n response.status(304).send({ error: 'Product Not Updated' })\n }\n }", "function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }", "function update(){\n\n //create another object and copy. then delete the '_id' property of the new copy\n var forUpdate = {};\n Object.assign(forUpdate, updateModule);\n delete forUpdate._id;\n \n db.modules.update({_id: mongo.helper.toObjectID(updateModule._id)}, {$set: forUpdate}, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }", "async update(req, res) {\n const teste = await Teste.findByIdAndUpdate(req.params.id, req.body, { new: true });\n return res.json(teste);\n }", "updated(_changedProperties) { }", "async createOrUpdate(key, value) {\n let record = await this.getRecord(key);\n let newValue = this.convertValue(value);\n if (!isNone(record)) {\n record.value = newValue;\n } else {\n record = this.store.createRecord('keyvalue', {\n key: key,\n value: newValue\n });\n }\n\n record.save();\n }", "function update() {\n\t\t\n\t}", "async update({request, response, params: {id}}) {\n\n const name = await nameService.findNameBy('id', id);\n\n if (name) {\n name.status = request.input('status')\n console.log(name)\n name.save()\n\n return response.status(200).send({\n status: 200,\n message: \"name updated\"\n })\n }\n else{\n return response.status(400).send({\n status: 400,\n message: \"invalid name id\"\n })\n }\n }", "async store(data) {\n console.log('filling', data);\n this.fill(data);\n this.property('updatedAt', Date.now());\n await this.save();\n }", "update(dt) {\n logID(1007);\n }", "update(field, value) {\n return new code.Update(field, value);\n }", "handleSaveChange(event) {\n let data= Object.assign({}, this.state.dataConfig);\n api.modifyStation(data._id, data, (err, result) => {\n if (err) {\n Notification(\n \"error\",\n \"Error\",\n err.data === undefined ? err : err.status + \" \" + err.data._error_message,\n );\n } else {\n let tmp = {}\n tmp['_id'] = result._id;\n tmp['seed'] = result.seed; \n let temp = Object.assign({}, this.state.temp); \n temp.seed = tmp\n this.setState({temp: temp}) \n \n // // --------sau khi thay doi va update ok\n Notification(\"success\", \"Edit Station\", \"Edit station is successfully\");\n }\n });\n }", "static update(request, response) {\r\n\r\n clientsModel.getById(request.body.id)\r\n .then( data => {\r\n if (data.length > 0) {\r\n\r\n //recupera do body os campos que serao atualizados na tabela\r\n const conditions = [\r\n {\r\n field: 'id',\r\n value: request.body.id\r\n },\r\n {\r\n field: 'name',\r\n value: request.body.name\r\n },\r\n {\r\n field: 'email',\r\n value: request.body.email\r\n },\r\n {\r\n field: 'password',\r\n value: request.body.password\r\n },\r\n {\r\n field: 'countrycode',\r\n value: request.body.countrycode\r\n },\r\n {\r\n field: 'areacode',\r\n value: request.body.areacode\r\n },\r\n {\r\n field: 'telephone',\r\n value: request.body.telephone\r\n },\r\n {\r\n field: 'zipcode',\r\n value: request.body.zipcode\r\n },\r\n ];\r\n\r\n //chama rotina para atualizacao dos dados\r\n clientsModel.update(conditions) \r\n response.sendStatus(200);\r\n console.log('Client has been updated. ID: ', request.body.id); \r\n } else {\r\n response.sendStatus(404);\r\n console.log('Client not found. ID: ', request.body.id);\r\n }\r\n })\r\n .catch(err => {\r\n response.sendStatus(500);\r\n console.log('Error updating Client by ID: ', request.body.id, err);\r\n });\r\n \r\n }", "function updateFactory(model){\n new update(model)\n}", "initUpdateEndpoint() {\n this.router.put('/:id', (req, res) => {\n if (!req.body.id) {\n try {\n req.body.id = parseInt(req.params.id);\n } catch (error) {\n return this.sendErr(res, 400, error.message);\n }\n }\n return this.getDAO().update(req.body, { user: req.user })\n .then(user => res.status(200).send(user))\n .catch(err => {\n debug('[update]', err.message);\n return this.sendErr(res, 400, err.message);\n });\n });\n }", "function update(data) {\n\t\tdebug('update request', data);\n\t\tif (!data[pk]) return emit(routes.read, {\"error\": \"no id attribute in update data for \" + routes.read});\n\t\tvar id = data[pk];\n\t\tdelete data[pk]; // ok\n\t\tdata = normalize(data);\n\t\tvar query = table.update(data).where(\n\t\t\ttable[pk].equals(id)\n\t\t).returning(\"*\").toQuery();\n\t\tdb.query(query.text, query.values, function(err, resp){\n\t\t\tdebug('update resp:', err);\n\t\t\tif (err) {\n\t\t\t\temit(routes.update, {\"error\": \"db error\"}); // TODO better specific error reporting\n\t\t\t} else {\n\t\t\t\tdebug(resp.rows);\n\t\t\t\tbroadcast(routes.update, resp.rows);\n\t\t\t}\n\t\t});\n\t}", "static update({ id, name, phone, email, sex }) {\r\n return new Promise(async resolve => {\r\n try {\r\n \r\n if( !ObjectID.isValid( id )){\r\n return resolve({ error : true , message : 'params_invalid' });\r\n }\r\n let listUser = await USER_COLL.findByIdAndUpdate( id, {\r\n name, phone, email, sex\r\n }\r\n ,{\r\n new: true\r\n });\r\n \r\n if(!listUser){\r\n return resolve({error: true, message:'cannot_update_list'});\r\n }\r\n return resolve({error: false, message:'update_data_success', data: listUser});\r\n\r\n\r\n } catch (error) {\r\n return resolve({ error: true, message: error.message });\r\n }\r\n })\r\n}", "update(delta) {}", "async update ({ params, request, response }) {\n let { id } = params\n let material = await RawMaterial.find(id)\n //console.log(request.all())\n //request.only(['code', 'name', 'lot', 'quantity', 'unit', 'description', 'supplier', 'vat', 'purchaseOrderNo', 'unitCost', 'totalAmount', 'SKU', 'purchaseDate'])\n await material.merge(request.only(['code', 'name', 'lot', 'quantity', 'unit', 'description', 'supplier', 'vat', 'purchaseOrderNo', 'unitCost', 'totalAmount', 'SKU', 'purchaseDate']))\n return await material.save()\n \n }", "static async updatePut(req, res, next) {\n try {\n const { title, description, status, due_date } = req.body\n const [count, data] = await ToDo.update(\n { title, description, status, due_date },\n {\n where: {\n id: +req.params.id,\n UserId: +req.decoded.id,\n },\n returning: true,\n }\n )\n if (count === 0) {\n throw { status: 404 }\n } else {\n res.status(200).json(data[0])\n }\n } catch (err) {\n next(err)\n }\n }", "$beforeUpdate(opt, queryContext) {\r\n // The existence of the column must be checked as the user could create the database schema in the 1.0 version\r\n if (this.updated_at) {\r\n this.updated_at = knex.fn.now();\r\n }\r\n }", "update(newData: Object) {\n this.dbUpdater.checkOkToUpdate();\n\n if (!this.db.transactionIsValid(newData)) {\n throw \"invalid transaction\";\n }\n\n if (newData.guid) {\n if (newData.guid != this.data.guid) {\n throw \"Cannot change transaction GUID.\";\n }\n } else {\n // Specifying GUID in new data is not necessary.\n // TODO: should we extend this to all properties; ie. automatically merge\n // and remove properties with {property: null}?\n newData.guid = this.data.guid;\n }\n\n let oldDate = this.data.date;\n let oldByTimeKey = this._byTimeKey();\n\n // Validation complete, commit change.\n\n Object.freeze(newData);\n this.data = newData;\n\n this.db.atomic(() => {\n if (oldDate != newData.date) {\n this.db.transactionsByTime.delete(oldByTimeKey);\n this.db.transactionsByTime.add(this._byTimeKey(), this);\n }\n\n this._subtractEntries(oldDate);\n this._createEntries(true);\n this.dbUpdater.update();\n });\n }", "async update ({ params, request, response }) {\n const {name, observetion } = request.all()\n const client = await Client.findOrFail(params.id)\n client.name = name\n client.observetion = observetion\n await client.save()\n return response.status(200).send(client)\n\n }", "async doUserUpdate () {\n\t\tconst now = Date.now();\n\t\tconst op = {\n\t\t\t$set: {\n\t\t\t\tisRegistered: true,\n\t\t\t\tmodifiedAt: now,\n\t\t\t\tregisteredAt: now,\n\t\t\t\t\"preferences.acceptedTOS\": true\n\t\t\t}, \n\t\t\t$unset: {\n\t\t\t\tconfirmationCode: true,\n\t\t\t\tconfirmationAttempts: true,\n\t\t\t\tconfirmationCodeExpiresAt: true,\n\t\t\t\t'accessTokens.conf': true,\n\t\t\t\tinviteCode: true,\n\t\t\t\tneedsAutoReinvites: true,\n\t\t\t\tautoReinviteInfo: true\n\t\t\t}\n\t\t};\n\n\t\tif (this.passwordHash) {\n\t\t\top.$set.passwordHash = this.passwordHash;\n\t\t}\n\n\t\t['email', 'username', 'fullName', 'timeZone'].forEach(attribute => {\n\t\t\tif (this.data[attribute]) {\n\t\t\t\top.$set[attribute] = this.data[attribute];\n\t\t\t}\n\t\t});\n\t\tif (this.data.email) {\n\t\t\top.$set.searchableEmail = this.data.email.toLowerCase();\n\t\t}\n\n\t\tif ((this.user.get('teamIds') || []).length > 0) {\n\t\t\tif (!this.user.get('joinMethod')) {\n\t\t\t\top.$set.joinMethod = 'Added to Team';\t// for tracking\n\t\t\t}\n\t\t\tif (!this.user.get('primaryReferral')) {\n\t\t\t\top.$set.primaryReferral = 'internal';\n\t\t\t}\n\t\t\tif (\n\t\t\t\t!this.user.get('originTeamId') &&\n\t\t\t\tthis.teamCreator && \n\t\t\t\tthis.teamCreator.get('originTeamId')\n\t\t\t) {\n\t\t\t\top.$set.originTeamId = this.teamCreator.get('originTeamId');\n\t\t\t}\n\t\t}\n\n\t\tthis.request.transforms.userUpdate = await new ModelSaver({\n\t\t\trequest: this.request,\n\t\t\tcollection: this.request.data.users,\n\t\t\tid: this.user.id\n\t\t}).save(op);\n\t}", "function update(req, res) {\n Profile.findByIdAndUpdate(req.params.id, req.body, {new: true})\n .then((profile) => {\n res.redirect(`/profiles/${profile._id}`)\n })\n .catch((err) => {\n console.log(err)\n res.redirect('/')\n })\n}", "update(req,res){\n res.status(200).json(\n {\n sucess: true,\n messages: 'Estructura base PUT',\n errors: null,\n data: [{}, {}, {}]\n }\n );\n }" ]
[ "0.79754823", "0.79754823", "0.79754823", "0.68861467", "0.68571585", "0.6806252", "0.65711987", "0.6549048", "0.6492383", "0.6458585", "0.6443829", "0.63978976", "0.63844573", "0.63844573", "0.63844573", "0.63844573", "0.63844573", "0.63844573", "0.63844573", "0.63844573", "0.63844573", "0.637888", "0.6355491", "0.6336313", "0.6328231", "0.6317464", "0.62579876", "0.6251189", "0.62344193", "0.6233317", "0.6222214", "0.6220574", "0.6210931", "0.6210931", "0.6210931", "0.6210931", "0.6210931", "0.6210931", "0.6210931", "0.6196236", "0.6192989", "0.61770546", "0.61215127", "0.6106533", "0.6044539", "0.6031334", "0.6029397", "0.6023774", "0.6021884", "0.60150456", "0.6008811", "0.6002017", "0.59920704", "0.597483", "0.5973296", "0.5971082", "0.5963651", "0.59476244", "0.5924987", "0.5912121", "0.59024525", "0.5889804", "0.5878704", "0.58632463", "0.5845231", "0.584341", "0.5818899", "0.5817886", "0.5816138", "0.58139586", "0.5795899", "0.5792649", "0.57882106", "0.57854635", "0.5777188", "0.57762486", "0.57747334", "0.57747334", "0.5773993", "0.57725656", "0.5769858", "0.5768367", "0.57508343", "0.5748435", "0.5739469", "0.57261336", "0.5721072", "0.57207704", "0.56963414", "0.5694767", "0.569329", "0.56908315", "0.56880665", "0.5685506", "0.5684526", "0.5680927", "0.56775445", "0.5673895", "0.56736165", "0.56690884", "0.566742" ]
0.0
-1
The fight function starts below this comment
function fight() { if (players[0].health < 1 && players[1].health < 1) { return false; } //Gives a minimum damage rating (10) to the maximum rating in the fighter variable (20) var minDamage1 = players[0].damage * .5; var minDamage2 = players[1].damage * .5; //Outputs a random number between 10 and 20 for Damage var f1 = Math.floor(Math.random() * (players[0].damage - minDamage1) + minDamage1); var f2 = Math.floor(Math.random() * (players[1].damage - minDamage2) + minDamage2); //updates health for the players with the new result players[0].health -= f1; players[1].health -= f2; // Calls the winnerCheck function var finalResult = winnerCheck(); console.log(finalResult); // This prints the outcome thus far to the console if (finalResult === "no winner yet") { round++; document.getElementById("kabal").innerHTML = players[0].name + ": " + players[0].health; document.getElementById("kratos").innerHTML = players[1].name + ": " + players[1].health; document.getElementById("round_number").innerHTML = "Round " + round + ": COMPLETE!"; } else { document.getElementById("kabal").innerHTML = "&nbsp;"; document.getElementById("kratos").innerHTML = "&nbsp;"; document.getElementById("round_number").innerHTML = finalResult; console.log(button); button.innerHTML = "Finished!!!"; button.setAttribute('onclick', null); } } //This is where the fight function ends
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fight (){\n\t//object variable to refence the current defenders stats\n\tvar defend = characters[defender];\n\n\t//object variable to refence the players characters stats\n\tvar player = characters[player_char];\n\n\t//change player's hp by the current defenders counter attack stat\n\tplayer[\"hp\"] -= defend[\"cnter_atk\"];\n\n\t//change the current defender hp based on the players attack stat\n\tdefend[\"hp\"] -= player[\"atk\"];\n\n\t//change the players attack stat by adding the players base attack to the grand total\n\tplayer[\"atk\"] += player[\"base_atk\"];\n\n\t//if the player hp is less then or equal to zero\n\tif (player[\"hp\"] <= 0){\n\t\t// remove the players icon image and replace it with a game over message\n\t\t$( \"div\" ).remove( \"#\"+ player_char);\n\t\t$(\"#your_char\")\n\t\t\t.html(\"<div id=\\\"defeat\\\"><p>You are Dead!</p></div>\");\n\t//else if the defender hp is less than or equal to zero\n\t}else if(defend[\"hp\"] <= 0){\n\t\t//increment number of victories\n\t\tnum_victories++;\n\t\t//if number of victories equal 3 than\n\t\tif (num_victories == 3){\n\t\t\t//remove the defender icon and display a victory message\n\t\t\t$( \"div\" ).remove( \"#\"+defender);\n\t\t\t$(\"#defender\")\n\t\t\t.html(\"<div id=\\\"victory\\\"><p>You Win!</p></div>\");\n\t\t//else remove the defender icon from the page\n\t\t}else{\n\t\t\t$( \"div\" ).remove( \"#\"+defender);\n\t\t}\n\t\t//set defender name to \"\" to allow the player to select the next defender\n\t\tdefender = \"\";\n\t}\n}", "function fight() {\n // Update interface with fighters' name and hp's\n refreshDomElement($outputDiv, playersArray[0].name + ' and ' + playersArray[1].name + ' are going to fight !');\n\n // Choose first attacker and add new property on chosen player\n var first = randomIntFromInterval(1, 2);\n player1 = playersArray[0];\n player2 = playersArray[1];\n\n if (first === 1) {\n player1.start = 1;\n } else {\n player2.start = 1;\n }\n\n // Round function\n round();\n}", "function betterAutoFight() {\n //Manually fight instead of using builtin auto-fight\n if (game.global.autoBattle) {\n if (!game.global.pauseFight) {\n //pauseFight(); //Disable autofight\t\n }\n }\n lowLevelFight = game.resources.trimps.maxSoldiers < (game.resources.trimps.owned - game.resources.trimps.employed) * 0.5 && (game.resources.trimps.owned - game.resources.trimps.employed) > game.resources.trimps.realMax() * 0.1 && game.global.world < 5 && game.global.sLevel > 0;\n if (game.upgrades.Battle.done && !game.global.fighting && game.global.gridArray.length !== 0 && !game.global.preMapsActive && (game.resources.trimps.realMax() <= game.resources.trimps.owned + 1 || game.global.soldierHealth > 0 || lowLevelFight || game.global.challengeActive == 'Watch')) {\n fightManual();\n }\n //Click Fight if we are dead and already have enough for our breed timer, and fighting would not add a significant amount of time\n if (game.upgrades.Battle.done && !game.global.fighting && getBreedTime() < 2 && ((game.global.lastBreedTime/1000) > autoTrimpSettings.GeneticistTimer.value || getBreedTime(true) < 0.1 ) && game.global.soldierHealth == 0 && typeof game.global.dailyChallenge.plague == 'undefined')\n fightManual();\n }", "function fight_stairs() {\n \n}", "function fighter(player) {\n var y = player.y - 1;\n\tvar x = player.x - 1;\n\n for(var idx = y; idx < y+3; idx++) {\n \tfor(var idx2 = x; idx2 < x+3; idx2++) {\n if(idx === player.y && idx2 === player.x) {\n } else {\n var area = mapArrays[idx][idx2];\n if(area.terrainType === \"monster\") {\n if(area.monsterType === \"super golem\") {\n currentEnemy = superGolem;\n } else if(area.monsterType === \"dragon\") {\n currentEnemy = dragon;\n } else if(area.monsterType === \"random\") {\n currentEnemy = getMonster();\n }\n combatStarter(currentEnemy);\n if(area.monsterType === \"dragon\") {\n userCommands = [\"attack\", \"potion\", \"equip\"];\n commandDisplayer();\n }\n placedMonsterCombat = true;\n currentEnemyY = area.y;\n currentEnemyX = area.x;\n break;\n }\n }\n }\n }\n}", "function larryFight(h, d) {}", "function fight (){\n\t\t$(\"#fightButton\").on(\"click\", function(){\n\t\t\tdarkSide.health -= lightSide.currentAttack;\n\t\t\tlightSide.attackMod();\n\t\t\tlightSide.health -= darkSide.counterAttack;\n\t\t\tmakeChar(\"#lightSideDiv\", \"<div>\", lightSide, true)\n\t\t\tmakeChar(\"#darkSideDiv\", \"<div>\", darkSide, true)\n\n\t\t\t// $(\"#darkSideDiv\").attr(\"<p>\", darkSide.health);\n\t\t\tif (darkSide.health <= 0) {\n\t\t\t\tcounter--;\n\t\t\t\tif (counter === 0) {\n\t\t\t\t\talertBox(\"The force is strong with you - you win!\");\n\t\t\t\t}\n\t\n\t\t\t\telse {\n\t\t\t\t\tdarkSide = undefined;\n\t\t\t\t\t$(\"#darkSideDiv\").empty();\n\t\t\t\t\talertBox(\"You are victorious! Select another character to fight.\");\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tif(lightSide.health <= 0){\n\t\t\t\talertBox(\"You are not a Jedi yet - GAME OVER.\");\n\t\t\t\t//Change button to \"play again\"\n\t\t\t}\n\t\t});\n\t}", "function fight() {\n\n if (readyToFight && isGameActive) {\n console.log(\"AI Fighter\");\n console.log(aiPlayer);\n console.log(\"Human Fighter\");\n console.log(humanPlayer);\n\n // Human attack AI\n aiPlayer.healthPoint -= humanPlayer.currentAttackPoint;\n\n // AI attacks human\n humanPlayer.healthPoint -= aiPlayer.counterAttackPoints;\n\n //Human power increase by baseAttachPoint\n humanPlayer.currentAttackPoint += humanPlayer.baseAttackPoint;\n\n // update the interface\n $(\"#ptext\" + humanPlayer.id).html(\"HP: \" + humanPlayer.healthPoint);\n $(\"#ptext\" + aiPlayer.id).html(\"HP: \" + aiPlayer.healthPoint);\n\n // check if the human is still alive\n if (humanPlayer.healthPoint <= 0) {\n humanPlayer.isAlive = false;\n gameOverMessage(humanPlayer.isAlive);\n }\n\n // check if the AI is alive\n if (aiPlayer.healthPoint <= 0) {\n\n aiPlayer.isAlive = false;\n readyToFight = false;\n isAIPlayerSelected = false;\n\n // the current AI is dead, ask the user to select the next one\n var msg = aiPlayer.characterName + \" is dead. Select the next enemy!\";\n $(\"#instructions-3\").html(msg);\n $(\"#ptext\" + aiPlayer.id).html(msg);\n setGameInfo(msg);\n } else{\n setGameInfo(\"\");\n\n }\n }\n\n // Check if there are any enemies left. if none, then send the win message if you are still alive\n var numberOFEnemiesRemaining = numberOFEnemiesRemainingToFight();\n if (numberOFEnemiesRemaining <= 0 && humanPlayer.isAlive) {\n gameOverMessage(humanPlayer.isAlive);\n }\n\n\n \n}", "function fight() {\n var whoWins;\n var winningNum = Math.floor(Math.random() * 2);\n whoWins = winningNum;\n if (whoWins === 1 && player.hp > 0) {\n console.log(\"You killed the sea monster!!\")\n youWon();\n getItem();\n } else {\n player.hp = 0;\n console.log(\"ohh no!It was a good fight but not good enough.YOU GOT EATEN! Game Over.\");\n }\n }", "function fight(){\n console.log(\"FIGHT!\");\n\n\n //calculate amount of damage each player will inflict.\n var minimumDamageP1 = fighters[0].damage * .5;\n var minimumDamageP2 = fighters[1].damage * .5;\n var player1ActualDamage = Math.floor(Math.random()*(fighters[0].damage-minimumDamageP1)+minimumDamageP1);\n var player2ActualDamage = Math.floor(Math.random()*(fighters[1].damage-minimumDamageP2)+minimumDamageP2);\n\n //inflict damage\n\n\n var score = document.querySelector('#kabal p');\n scoreToString = String(fighters[0].health=fighters[0].health-player1ActualDamage);\n score.innerHTML = fighters[0].name+' : '+scoreToString;\n\n var score1 = document.querySelector('#kratos p');\n scoreToString1 = String(fighters[1].health=fighters[1].health-player2ActualDamage);\n score1.innerHTML = fighters[1].name+' : '+scoreToString1;\n\n console.log(fighters[0].name+\": \"+fighters[0].health + \" \" + fighters[1].name+\":\"+fighters[1].health);\n winnerCheck();\n round++;\n stringOfRound = String(round);\n var roundGet = document.querySelector('#round');\n roundGet.innerHTML = 'Round:'+stringOfRound+' FIGHT!';\n }", "function fight() {\n var rand = Math.random();\n //depending on item type, do different amounts of damage\n if (inventory.Items === \"Used Dagger\") {\n var dmg = (Math.floor(rand * 10) + 1);\n } else if (inventory.Items === \"Cool Mace\") {\n var dmg = (Math.floor(rand * 50) + 25);\n } else if (inventory.Items === \"AWESOME MAGIC SWORD OF SLAYING\") {\n var dmg = (Math.floor(rand * 50) + 75);\n }\n //subtract damage done from baddie\n baddie.hitPoints -= dmg;\n console.log(\"You attack the \" + baddie.type + \" with your \" + inventory.Items + \". You do \" + dmg + \" damage to the creature! It has \" + baddie.hitPoints + \" health left.\");\n //baddie death logic\n\n if (baddie.hitPoints > 0) {\n //if baddie is still alive, it attacks\n enemyAttack();\n } else {\n enemyDie();\n }\n}", "static wonderingFightBack(/*Unit*/ unit, /*Grid*/ grid, /*Unit*/ theHero, /*Array<Unit>*/ allies) {\n\n /*Hex[]*/\n let possibleMoves = grid.getMovableHexes(unit, 1);\n\n if (possibleMoves.length) {\n\n //If Helene is near, most likely attack!\n for (let hex of possibleMoves) {\n if (hex.content === theHero) {\n if (Math.random() > 0.36) {\n grid.goTo(hex, unit);\n return;\n }\n }\n }\n\n //maybe do nothing?\n if (Math.random() > 0.50) {\n return;\n }\n\n //else lets get rolling\n let randomMove = possibleMoves[Math.floor(Math.random() * possibleMoves.length)];\n if (randomMove.content && allies.indexOf(randomMove.content) !== -1) {\n //maybe do nothing?\n if (Math.random() > 0.50) {\n return;\n }\n //lets give him a chance, or else! (rerandom - perhaps we will not kick an ally!)\n return possibleMoves[Math.floor(Math.random() * possibleMoves.length)];\n\n }\n return randomMove;\n\n }\n }", "function fight(){\n var character = characters.getCharacterObjectByName(selectedCharacterId);\n var defender = characters.getCharacterObjectByName(selectedDefenderId);\n defender.health -= character.attack;\n character.attack += character.baseAttack;\n character.health -= defender.counterAttack;\n characters.setCharacterByObject(character);\n characters.setCharacterByObject(defender);\n characters.updateCharacterHtml();\n if (character.health <= 0){\n alert(\"game over\");\n characters.gameReset();\n }\n else if (defender.health <= 0){\n $(\"#\" + defender.name).remove();\n hasPickedDefender = false;\n if ($(\"#enemies-available-to-attack\").has(\".character\").length === 0) {\n alert(\"You have won!\");\n characters.gameReset();\n }\n else {\n alert(defender.name + \" has been defeated. Select a new defender. \");\n }\n }\n\n}", "function fight() {\n //the HTML to tell the user what the names and healths of both fighters are at the beginning of the fight using array access notation and dot notation to access the values of the object keys.\n fighter1_txt.innerHTML = fighters[0].name + \":\" + fighters[0].health;\n fighter2_txt.innerHTML = fighters[1].name + \":\" + fighters[1].health;\n\n //determines the minimum damage each player will deal in a round and stores the results\n var minDamage1 = fighters[0].damage * .5;\n var minDamage2 = fighters[1].damage * .5;\n\t\t\t\n\t\t// this calculates the damage a player will deal in a round: random damage formula = Math.floor(Math.random() * (max - min) + min) || random damage formula === \"Round number to the nearest integer\"(\"Generate a random number between 0 and 1\" times (max damage that can be dealt - minimum damage that can be dealt) plus 10)\n var f1 = Math.floor(Math.random() * (fighters[0].damage - minDamage1) + minDamage1);\n var f2 = Math.floor(Math.random() * (fighters[1].damage - minDamage2) + minDamage2);\n\n //subtracts the damage value dealt in the round from each player and stores the new values for each player's health back into the objects' keys in the array. This is playerOneHealth-=f2 and playerTwoHealth-=f1 because each player is dealing damage to the other not to themselves.\n fighters[0].health -= f2;\n fighters[1].health -= f1;\n\t\t\t\n //reports to the console the current round in the fight\n console.log(\"~ Round \" + round + \" Results ~\");\n \n //reports to the console the player's name and their health after a round using array access notation and dot notation for the object.\n console.log(fighters[0].name + \": \" + fighters[0].health + \" | \" + fighters[1].name + \": \" + fighters[1].health);\n\n //checks for the victor of the fight by running the winnerCheck() function at the end of each round and stores the value that was output by the function into a variable\n var result = winnerCheck();\n \n //reports to the console the results of the round in the fight or the fight itself depending on the value of the variable.\n console.log(\"Verdict = \" + result);\n \n //once the fight starts, the HTML on the page prompting to start the fight changes to a title announcing the results of the round and overall fight.\n round_txt.innerHTML = \"ROUND #\" + round + \" Results:\";\n \n //the round is incremented by 1.\n round++;\n \n //if the result of the round is that neither player won -\n if (result === \"no winner\") { \n //the user is alerted of both players' healths at the end of the round by having the new values that have been stored be displayed dynamically on the page.\n fighter1_txt.innerHTML = \"<b>\" + fighters[0].name + \"</b>: <span style = 'color: #558151; text-shadow: 2px 0px #ccc;'>\" + fighters[0].health + \"</span>\";\n fighter2_txt.innerHTML = \"<b>\" + fighters[1].name + \"</b>: <span style = 'color: #558151; text-shadow: 2px 0px #ccc;'>\" + fighters[1].health + \"</span>\";\n //otherwise if there is a result other than \"no winner\" \n } else {\n //alert the user through the page of the result of the fight.\n fighter1_txt.innerHTML = \"<b><span style = 'color: #558151; text-shadow: 2px 0px #ccc;'>\" + result + \"</span></b>\";\n fighter2_txt.innerHTML = \"\";\n\t\t\t\t\n //this disables the button/event after the fight is over.\n button.removeEventListener(\"click\", fight, false);\n \n //this changes the text in the fight button to show the fight is done.\n document.querySelector('.buttonstyle').innerHTML = \"DONE!\";\n }\n }", "function fighting() {\n enemies.forEach((enemy, index_enemy) => {\n allies.forEach((ally, index_ally) => {\n if (enemies[index_enemy].combat && allies[index_ally].combat == true) {\n enemies[index_enemy].hp = enemies[index_enemy].hp - allies[index_ally].damage / 60;\n allies[index_ally].hp = allies[index_ally].hp - enemies[index_enemy].damage / 60;\n hit_sound.volume = 0.5;\n hit_sound.play();\n //console.log(\"Enemy HP: \" + enemies[index_enemy].hp);\n //console.log(\"Ally HP: \" + allies[index_ally].hp);\n document.querySelector(\"img.wizard[data-id='\" + enemy.id + \"']\").src = \"zombie_action2.png\";\n document.querySelector(\"img.ally[data-id='\" + ally.id + \"']\").src = \"adventurer_action2.png\";\n }\n if (enemies[index_enemy].hp < 0) {\n enemies.splice(index_enemy, 1);\n death_sound.volume = 0.2;\n death_sound.play();\n points = points + 30;\n updatePoints();\n document.querySelector(\"img.wizard[data-id='\" + enemy.id + \"']\").remove();\n }\n if (allies[index_ally].hp < 0) {\n allies.splice(index_ally, 1);\n death_sound.volume = 0.2;\n death_sound.play();\n document.querySelector(\"img.ally[data-id='\" + ally.id + \"']\").remove();\n }\n\n });\n });\n // Laat ze doorlopen als combat voorbij is\n allies.forEach((ally, index_ally) => {\n allies[index_ally].combat = false;\n });\n enemies.forEach((enemy, index_enemy) => {\n enemies[index_enemy].combat = false;\n });\n\n}", "function fight () {\n\t\n\tdocument.querySelector(\".message\").innerHTML = \"You attack \" + currentVillain.name + \" for \" + mainHero.attack + \" damage. \"\n\n\t//reduces villains health\n\tcurrentVillain.health = currentVillain.health - mainHero.attack;\n\n\t//increases hero's attack power\n\tmainHero.attack = mainHero.attack + mainHero.baseAttack;\n\n\tconsole.log(currentVillain);\n\tconsole.log(mainHero);\n\n\t\n\t//this if statement will run if the villain hasn't died yet\n\tif (currentVillain.health > 0) {\n\t\tmainHero.health = mainHero.health - currentVillain.counter;\n\t\t$ (\".message\").append(\"<br>\" + currentVillain.name + \" counters for \" + currentVillain.counter + \" damage.\")\n\t}\n\n\t//this will update each character's bars\n\tupdatePlayerBars(mainHero,mainHero.healthClass,mainHero.attackClass);\n\tupdateEnemyBars(currentVillain,currentVillain.healthClass,currentVillain.attackClass);\n\n\t\n\t//this if statement will run if the villain has died\n\tif (currentVillain.health <= 0) {\n\t\tattackTime = false;\n\t\t$ (\".duelArea\").empty();\n\n\t\tif (fightersRemaining.length === 0) {\n\t\t\tgameOver = true;\n\t\t\tdocument.querySelector(\".message\").innerHTML = \"You are victorious\";\n\t\t}\n\t}\n\n\n\tif (mainHero.health <= 0) {\n\t\tgameOver = true;\n\t\tconsole.log(\"sorry game over\");\n\t\tdocument.querySelector(\".message\").innerHTML = \"Game Over\"\n\t}\n\n\n}", "function fightLoop() {\n if(fightHandler.endFight === \" \") {\n fightHandler.chooseAction();\n \n fightLoop2();\n \n function fightLoop2() {\n if(fightHandler.actionChosen) {\n fightHandler.chooseTarget();\n \n fightLoop3();\n \n function fightLoop3() {\n if(fightHandler.targetChosen) {\n fightHandler.determineAction();\n fightHandler.checkEnd();\n fightHandler.endTurn();\n setTimeout(fightLoop, 0);\n } else {\n setTimeout(fightLoop3, 0);\n }\n }\n } else {\n setTimeout(fightLoop2, 0);\n }\n };\n } else {\n fightHandler.determineEnd();\n }\n}", "function fight0() {\r\n\tplayerAttack();\r\n\tenemyAttack();\r\n\tprintArray2(logArray);\r\n\tget(\"combat-log\").innerHTML = logFinished;\r\n\tgoToBottomOfLog(myDiv);\r\n}", "function fightEnemy() {\r\n\tcurrHpPerc = Math.floor((currentHp / playerDetails.hp) * 100);\r\n\tget(\"player-hp\").style.width = currHpPerc + \"%\";\r\n\tlogArray = [ ]; //wipe log array\r\n\tstartCombat();\r\n}", "fightEm(){\n // this.character.reposition(320-50,288);\n // this.character2.reposition(320+50,288,576,0);\n // this.character.makeRandomChar();\n // this.character2.makeRandomChar();\n // this.character.reposition(320-50,450);\n // this.character2.reposition(320+50,450,576,0);\n // this.character.makeRandomChar();\n // this.character2.makeRandomChar();\n this.winScreen.visible=false;\n this.loseScreen.visible=false;\n\n if(!this.battleActive){\n\n this.buildBackground();\n this.character.reposition(320-50,475);\n this.character2.reposition(320+50,475,576,0);\n\n this.character2.flipIt();\n\n\n this.character.makeRandomChar(0,0,0);\n\n\n this.character2.makeRandomChar(1,1,1);\n this.battleActive= true;\n this.battleMode();\n }\n\n }", "function attackIt() {\n while (true) {\n var flag = hero.findFlag();\n if (flag) {\n if (flag.color == \"green\") {\n break;\n }\n hero.jumpTo(flag.pos);\n hero.pickUpFlag(flag);\n }\n \n if (hero.canCast(\"summon-burl\")) hero.cast(\"summon-burl\");\n if (hero.canCast(\"summon-undead\")) hero.cast(\"summon-undead\");\n if (hero.canCast(\"raise-dead\")) hero.cast(\"raise-dead\");\n \n var enemy = hero.findNearestEnemy();\n if (enemy && enemy.type != \"sand-yak\") {\n var distance = hero.distanceTo(enemy);\n if (distance < 25 && hero.canCast(\"fear\"))\n hero.cast(\"fear\", enemy);\n else if (distance < 30 && hero.canCast(\"chain-lightning\")) hero.cast(\"chain-lightning\", enemy);\n else if (distance < 30 && hero.canCast(\"poison-cloud\")) hero.cast(\"poison-cloud\", enemy);\n else if (distance < 15 && hero.canCast(\"drain-life\"))\n hero.cast(\"drain-life\", enemy);\n else hero.attack(enemy);\n }\n \n if (hero.health < hero.maxHealth / 2) {\n var friend = hero.findNearest(hero.findFriends());\n if (friend && friend.type != \"burl\" && hero.canCast(\"drain-life\") && hero.distanceTo(friend) <= 15)\n hero.cast(\"drain-life\", friend);\n }\n }\n}", "function FightLocal() {\n \n this.go=function(command,data) {\n var hit;\n var parsed={};\n\n view2.pMessage.put(\"\");\n view2.eMessage.put(\"\");\n \n // player's strike\n if( global.isActive(\"A\") && command==\"cell\" && data ) {\n parsed = view2.parseGridId(data);\n if ( parsed.prefix != \"e\" ) return;\n hit=enemy.respond([parsed.row,parsed.col]);\n //alert(\">\"+hit);\n player.reflect(hit);\n view2.pStat.showStrikesHits(model.playerStat.strikes,model.playerStat.hits);\n displayResponce( hit, [parsed.row,parsed.col], view2.eBoard, model.enemyBasin, view2.eStat, model.enemyStat, view2.pMessage );// enemy.display\n if ( arbiter.checkout(hit) ) return;\n // fall-through\n }\n \n // LocalScript's strike\n if ( global.isActive(\"B\") && command==\"enemyStrike\" && data.length==2 ) {\n hit=player.respond(data);\n enemy.reflect(hit);\n view2.eStat.showStrikesHits(model.enemyStat.strikes,model.enemyStat.hits);\n displayResponce( hit, data, view2.pBoard, model.playerBasin, view2.pStat, model.playerStat, view2.eMessage );//player.display\n if (hit==\"n\")\n console.log( \"Enemy repeats itself on \"+data+\" that is \"+model.playerBasin.get(data[0],data[1]) );// this is not to happen\n if ( arbiter.checkout(hit) ) return;\n // fall-through\n }\n \n if ( global.getStage()!=\"finish\" ) { // some command out of order\n console.log( \"Out of order: player=\"+global.getActive()+\" command=\"+command+\" data=\"+data+\" stage=\"+global.getStage() );\n return;\n }\n // fall-through\n\n // fight finished\n displayElement(\"finish\");\n global.setState(\"finish\");\n if ( global.isActive(\"A\") ) {\n global.setWinner(\"A\");\n view2.pMessage.put('<span class=\"'+\"win\"+'\">YOU HAVE WON !');\n }\n else {\n global.setWinner(\"B\");\n view2.eMessage.put('<span class=\"'+\"lose\"+'\">ENEMY HAS WON !');\n }\n return; \n };\n}", "function gm_attack(direction, pow1id, pow2id, zid, room, opponent_team, card1, normal_attack, underdog, tiebreaker, bribe, ambush) { /* (ttt.up, ) */\r\n\tlet spiked = false;\r\n\tlet reach_target = false;\r\n\tlet target_team = null;\r\n\t//if (direction(zid)>=0)\r\n\t\t//console.log(\"0/2 gm_attack: \",direction(zid),\" \",room.game.board[direction(zid)][0]);\r\n\tif (direction(zid)>=0 && room.game.board[direction(zid)][0]!=\"\") { /* has card */\r\n\t\t//console.log(\"1/2 gm_attack: \",direction(zid),\" \",room.game.board[direction(zid)][0]);\r\n\t\tlet target_card_id = null;\r\n\t\tlet target_zone_id = null;\r\n\t\tif (room.game.board[direction(zid)][2]===opponent_team) { /* is enemy card */\r\n\t\t\ttarget_card_id = parseInt(room.game.board[direction(zid)][1])-1;\r\n\t\t\ttarget_zone_id = direction(zid);\r\n\t\t\tif (room.game.board[direction(zid)][0]===opponent_team) { /* whose deck is it from? */\r\n\t\t\t\ttarget_team = opponent_team;\r\n\t\t\t} else {\r\n\t\t\t\ttarget_team = (opponent_team===\"X\"?\"O\":\"X\");\r\n\t\t\t}\r\n\t\t} else \r\n\t\tif (room.game.board[direction(zid)][2]===(opponent_team===\"X\"?\"O\":\"X\")) { /* is allied card */\r\n\t\t\tif ((card1[4]===6 || card1[5]===6) && direction(direction(zid))>=0 && room.game.board[direction(direction(zid))][2]===opponent_team) { // [R]each\r\n\t\t\t\ttarget_card_id = parseInt(room.game.board[direction(direction(zid))][1])-1;\r\n\t\t\t\ttarget_zone_id = direction(direction(zid));\r\n\t\t\t\treach_target = true;\r\n\t\t\t\tif (room.game.board[direction(direction(zid))][0]===opponent_team) { /* whose deck is it from? */\r\n\t\t\t\t\ttarget_team = opponent_team;\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttarget_team = (opponent_team===\"X\"?\"O\":\"X\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (target_card_id!=null) {\r\n\t\t\t//console.log(\"2/2 gm_attack: \",card2);\r\n\t\t\tlet card2 = null; \r\n\t\t\tif (room.game.players[0].team===target_team) { \r\n\t\t\t\tcard2 = room.game.players[0].deck[target_card_id]; \r\n\t\t\t}\r\n\t\t\telse if (room.game.players[1].team===target_team) { \r\n\t\t\t\tcard2 = room.game.players[1].deck[target_card_id];\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tconsole.log(\"\\n{we should never get here #1}\\n\");\r\n\t\t\t}\r\n\t\t\tif (card2!=null) { /* we are gm_attacking this card */\r\n\t\t\t\tlet has_chain = (card2[4]==7 || card2[5]==7);\r\n\t\t\t\tlet pow1 = card1[pow1id];\r\n\t\t\t\tlet pow2 = card2[pow2id];\r\n\t\t\t\tlet cost1 = card1[0]+card1[1]+card1[2]+card1[3];\r\n\t\t\t\tlet cost2 = card2[0]+card2[1]+card2[2]+card2[3];\r\n\t\t\t\tif (pow1>pow2) { /* [N]ormal gm_attack */\r\n\t\t\t\t\tnormal_attack[0]+=1;\r\n\t\t\t\t\tnormal_attack[1]+=pow2;\r\n\t\t\t\t\tnormal_attack[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (pow1===pow2 && cost1<cost2) { /* [U]nderdog */\r\n\t\t\t\t\tunderdog[0]+=1;\r\n\t\t\t\t\tunderdog[1]+=pow2;\r\n\t\t\t\t\tunderdog[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (pow1===pow2) { /* [T]iebreaker */\r\n\t\t\t\t\ttiebreaker[0]+=1;\r\n\t\t\t\t\ttiebreaker[1]+=pow2;\r\n\t\t\t\t\ttiebreaker[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (cost1===cost2) { /* [B]ribe */\r\n\t\t\t\t\tbribe[0]+=1;\r\n\t\t\t\t\tbribe[1]+=pow2;\r\n\t\t\t\t\tbribe[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (true) { /* [A]mbush */\r\n\t\t\t\t\tambush[0]+=1;\r\n\t\t\t\t\tambush[1]+=pow2;\r\n\t\t\t\t\tambush[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif((card2[4]===9 || card2[5]===9) && reach_target===false && pow1<pow2) {\r\n\t\t\t\t\tspiked = true;\r\n\t\t\t\t}\r\n\t\t\t\treturn spiked;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn spiked;\r\n}", "function fight(){\n alert(\"Superman\"+\":\"+fighter1Health+\" *START* \"+\"Batman\"+\":\"+fighter2Health); //start of fight input plyer name\n for (var i = 0; i < 10; i++)\n {\n //random formula is - Math.floor(Math.random() * (max - min) + min);\n var minDamage1 = fighter1Damage * .5; //varibale to calculate player one damage \n var minDamage2 = fighter2Damage * .5; //varibale to calculate player two damage \n var f1 = Math.floor(Math.random()*(fighter1Damage-minDamage1)+minDamage1); //calculates the damage of player one.\n var f2 = Math.floor(Math.random()*(fighter2Damage-minDamage2)+minDamage2); //calculates the damage of player two.\n\n //inflict damage\n fighter1Health-=f1; //check player one health \n fighter2Health-=f2; //check player 2 health\n\n console.log(\"Superman\"+\": \"+fighter1Health + \" \" + \"Batman\"+\":\"+fighter2Health); //prints on screen the players health\n\n //check for victor\n var result = winnerCheck(); //variable to check for winner of fight\n console.log(result); //prints to console the result (winner)\n if (result===\"no winner\") //if no winner then game starts over.\n {\n round++;\n alert(\"Superman\"+\":\"+fighter1Health+\" *ROUND \"+round+\" OVER\"+\"* \"+\"Batman\"+\":\"+fighter2Health);\n\n } else{\n alert(result);\n break;\n };\n\n };\n }", "function fight(){\t\t// function is calling the parameters from above and placing it into a function called fight()\n\n fighter1_txt.innerHTML = fighters[0].name + \":\" + \" \" + fighters[0].health; // Displays .name + . health for fighter is displayed\n fighter2_txt.innerHTML = fighters[1].name + \":\" + \" \" + fighters[1].health; // Displays .name + . health for fighter two is displayed\n\n //calculates fighter [0] random number + .damage (20) * .5 first then rounds it to the nearest number\n var f1 = Math.floor(Math.random() * fighters[0].damage + fighters[0].damage * .5);\n //calculates fighter [0] random number + .damage (20) * .5 first then rounds it to the nearest number\n var f2 = Math.floor(Math.random() * fighters[1].damage + fighters[1].damage * .5);\n\n fighters[0].health -=f1;\t\t//this will subtract the calculated hit to the fighter [0] health\n fighters[1].health -=f2;\t\t//this will subtract the calculated hit to the fighter [1] health\n\n console.log(fighters[0].health, fighters[1].health); // displays results to the console\n\n\n var result = winnerCheck();\t\t//outputs the count of the rounds until the function below results if no winner or a winner\n console.log(result);\t\t//Prints results to the console\n\n round_txt.innerHTML = \"ROUND #\" + round + \" \" + \"Results:\"; //rounds will be displayed in the html page\n round++; // round equals 1++ keeps adding a 1\n if (result === \"no winner\") // if results = winnerCheck === \"no winner\"\n {\n fighter1_txt.innerHTML = fighters[0].name + \":\" + \" \" + fighters[0].health; // fighter1 txt equals fighter name + health results\n fighter2_txt.innerHTML = fighters[1].name + \":\" + \" \" + fighters[1].health; // fighter2 txt equals fighter name + health results\n\n }else{ // else loop\n fighter1_txt.innerHTML = result; // fighter1 [0] equals results\n fighter2_txt.innerHTML = \"\"; // fighter2 [1] equals empty string\n\n button.removeEventListener(\"click\", fight, false); // Event Listener is going to be called by the fight function when user clicks button\n\n document.querySelector('#buttonblue').innerHTML = 'DONE!!!'; // not sure what this does I know it's calling the class buttonblue from the html page\n }\n }", "function battle(fighter1, fighter2) {\n function atteptHit(attacker, defender) {\n let random = Math.floor(Math.random() * Math.floor(100));\n let missedMes = `Ooops, ${attacker.name} missed`\n\n if(random < 25) {\n return missedMes\n } else if (random >= 25 && !attacker.applySpecialAttack) {\n return attacker.attack(defender)\n } else if (random >= 25 && random <= 80) {\n return attacker.attack(defender)\n } else if (random > 80) {\n return attacker.applySpecialAttack(defender)\n }\n }\n\n while (fighter1.getHealthPoints() > 0 && fighter2.getHealthPoints() > 0) {\n \n console.log(atteptHit(fighter1, fighter2))\n\n if (fighter2.getHealthPoints() > 0) {\n console.log(atteptHit(fighter2, fighter1))\n }\n \n }\n}", "function fightingmessage(topline){\n\tif(topline){\n\t\tif(monout == p1){\n\t\t\toutput(0, \"You are battling a wild \" + encpok + \"!\");\n\t\t} else {\n\t\t\toutput(0, monout + \" is battling a wild \" + encpok + \"!\");\n\t\t}\n\t}\n\toutput(1, \"(A) Attack (S) Switch\");\n\toutput(2, \"(D) Catch (F) Flee\");\n\tif(isininv(items[\"helixfossil\"])){\n\t\toutput(2, \"<br>(X) Use Helix Fossil\", true);\n\t}\n\toutput(3, \"HP: \" + encpok.curhp + \" / \" + encpok.maxhp);\n}", "fight() {\n this.inFight = true;\n this.fightTween = game.add.tween(this);\n // Small delay to allow the player to finish his movement, -1 for looping\n this.fightTween.to({}, Phaser.Timer.SECOND, null, false, 150, -1);\n this.fightTween.onStart.add(function fightAction() { this.fightAction(); }, this);\n this.fightTween.onLoop.add(function fightAction() { this.fightAction(); }, this);\n this.fightTween.start();\n }", "function attack(p, o) {\n //store fitghters base attack\n //store the oponent counter attack\n var fightersBase = fighter.attackPower;\n var oponentsCounter = oponent.oponentCounter;\n\n var fightersAddedAttack = 0;\n fightersAddedAttack += fightersBase;\n\n oponent.health = oponent.health - fightersAddedAttack;\n fighter.health -= oponentsCounter;\n\n if (fighter.health <= 0) {\n // losses = losses + 1\n window.location.reload()\n }\n else if (oponent.health <= 0) {\n $('#' + oponent.id).remove()\n document.getElementById(\"attack\").disabled = true;\n wins++;\n fighter.health += 25\n $(\"#wins\").text(wins)\n console.log(wins)//debugging\n\n } else {\n //oponents\n if (oponent.name == 'Luke Skywalker') {\n $('#lHealth').text(oponent.health)\n\n } else if (oponent.name == 'Yoda') {\n $('#yHealth').text(oponent.health)\n }\n else if (oponent.name == 'Darth Sidious and Darth Vader') {\n $('#dHealth').text(oponent.health)\n }\n else if (oponent.name == 'General Grevious') {\n $('#gHealth').text(oponent.health)\n }\n\n //fighters\n if (fighter.name == 'Luke Skywalker') {\n $('#lHealth').text(fighter.health)\n\n } else if (fighter.name == 'Yoda') {\n $('#yHealth').text(fighter.health)\n\n } else if (fighter.name == 'Darth Sidious and Darth Vader') {\n $('#dHealth').text(fighter.health)\n\n } else if (fighter.name == 'General Grevious') {\n $('#gHealth').text(fighter.health)\n }\n }\n if (oponent.name == 'Luke Skywalker') {\n $(\"#notesBox\").text(\"No one beats Luke Skywalker!\")\n\n } else if (oponent.name == 'Yoda') {\n $(\"#notesBox\").text(\"Too Old!\")\n }\n else if (oponent.name == 'Darth Sidious and Darth Vader') {\n $(\"#notesBox\").text(\"Feel the dark side of the force!\")\n }\n else if (oponent.name == 'General Grevious') {\n $(\"#notesBox\").text(\"Die Jedi Scum!\")\n }\n\n if (wins >= 3) {\n alert(\"You Win!\")\n window.location.reload()\n }\n}", "attack(youHero) {\n if (this.name === ennemies[0].name) {\n if (Math.floor(Math.random() * Math.floor(9)) / 10 <= this.accuracy) {\n \n console.log(\n youHero.name +\n \" got hit with an alien Z * mizzle, their health is down to\"\n );\n console.log((youHero.hull += -7)); /// had it set to this . mizzle but somehting was not working with it or the random number so I hard coded it... sorry\n defeat(youHero); /// like above -_- but did you die?\n } else {\n console.log(this.name + \" can not hit the side of a barn\"); /// so you know who next target is when they appear but miss\n console.log(\n \"Ha! those aliens shoot like stormtroopers \" +\n youHero.name +\n \"took no damage. Hull power = \" +\n youHero.hull\n ); /// you know they missed\n defeat(youHero); /// no damage awesome but return to your move with this\n }\n } else {\n console.log(\"dead aliens can't shoot\"); // not sure how they would but just in case if simulating in console log with pre typed functions...\n //return to your move\n defeat(youHero);\n }\n }", "function fight(){\t\t// function is calling the parameters from above and placing it into a funtion called fight()\n \t\t\n alert(playerOneName[0]+\":\"+playerOneName[2]+\" *START* \"+playerTwoName[0]+\":\"+playerTwoName[2]);\t\t//prompt opens up advising player to start\n \n //(local variables)\n for (var i = 0; i < 10; i++)\t\t//for loop: i= equals 0/ if i is less then 10 keep looping/ i++ means its going to adding to the rounds\n {\n \n var minDamage1 = playerOneName[1] * .5;\t\t// playerone damage number and multipling it in half\n var minDamage2 = playerTwoName[1] * .5;\t\t// playertwo damage number and multipling it in half\n \n //random formula is - Math.floor(Math.random() * (max - min) + min);\n var f1 = Math.floor(Math.random()*(playerOneName[1]-minDamage1)+minDamage1);\t\t//(Player1Damage-minDamage)is first then the complete parentheses is next. This equation will result in a decimal and we use Math.floor to turn it into a interger.\n var f2 = Math.floor(Math.random()*(playerTwoName[1]-minDamage2)+minDamage2);\t\t//(Player2Damage-minDamage)is first then the complete parentheses is next. This equation will result in a decimal and we use Math.floor to turn it into a interger.\n\n playerOneName[2]-=f1;\t\t//this will subtract the hit to the player1's health\n playerTwoName[2]-=f2;\t\t//this will subtract the hit to the player1's health\n\n console.log(playerOneName[2]+\" \"+playerTwoName[2]);\t\t//Prints results to the console\n\n var result = winnerCheck();\t\t//outputs the count of the rounds until the function below resuts in no winner or a winner\n \n console.log(result);\t\t//Prints results to the console\n if (result===\"no winner\"){\n round++;\n alert(playerOneName[0]+\":\"+playerOneName[2]+\" *ROUND \"+round+\" OVER\"+\"* \"+playerTwoName[0]+\":\"+playerTwoName[2]);\n } else{\n alert(result);\n \n break;\t\t//breaks out of the function once the results have been completed\n };\n\n };\n }", "function attackMode () {\n\n if (f1x === true && f2x === true ) {\n fighter1.hasCans = fighter1.hasCans - fighter2.eatsCans;\n fighter2.hasCans = fighter2.hasCans - fighter1.eatsCans;\n printFighter1Stats(fighter1);\n printFighter2Stats(fighter2);\n if(fighter1.hasCans <= 0) {\n fighter1.hasCans = 0;\n printFighter1Stats(fighter1);\n $('#fightresults').html(`Time to buy groceries, Luke! ${fighter1.name} is out of cans!`);\n $(\"#again\").removeClass(\"hidden\");\n $(\"#attack\").addClass(\"hidden\");\n }\n\n if(fighter2.hasCans <= 0){\n fighter2.hasCans = 0;\n printFighter2Stats(fighter2);\n $('#fightresults').html(`Time to buy groceries, Luke! ${fighter2.name} is out of cans!`);\n $(\"#again\").removeClass(\"hidden\");\n $(\"#attack\").addClass(\"hidden\");\n }\n }\n else {\n alert(\"I can't do your work for you. Create two players.\");\n }\n\n }", "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}", "function strongAttackHandler() {\n attackMonster(modeStrongAttack);\n\n}", "function ourTurn(){\n if (Pokemon.theirAttack.hp <= Pokemon.ourAttack.power) {\n Pokemon.results.theirFaint = true;\n console.log(`${Pokemon.theirAttack.name} fainted ${Pokemon.results.theirFaint}`);\n Pokemon.results.theirAttackPower = 0;\n return 0;\n } else {\n Pokemon.results.theirAttackPower = Pokemon.theirAttack.power;\n $('#instructions-text').text(`You did ${Pokemon.ourAttack.power} damage. Click fight or switch button.`);\n // Add: they have X hit points left here...\n return Pokemon.theirAttack.hp - Pokemon.ourAttack.power;\n }\n }", "function fight() { //need a function calculating the fight\n console.log(\"In the fight function\"); //prints to console that the fight FN is\n //printing off\n alert(playerOneName + \":\" + playerOneHealth + \" *START* \" + playerTwoName + \":\" + playerTwoHealth);\n //alert for player to start of game\n for (var i = 0; i < 10; i++) { //formula for random number damage to hit player\n //Random formula is - Math.floor(random() * (max - min) + min);\n\n var minDamage1 = playerOneDmg * .5; //minimal dmg to player one\n var minDamage2 = playerTwoDmg * .5; //minimal dmg to player two\n var f1 = Math.floor(Math.random() * (playerOneDmg - minDamage1) + minDamage1); //dmg formula to players\n var f2 = Math.floor(Math.random() * (playerTwoDmg - minDamage2) + minDamage2); //each players health\n\n //console.log(f1);\n //console.log(f2);\n\n //inflict Damage\n playerOneHealth -= f1; //deducts the damage from players health\n playerTwoHealth -= f2; //deducts the damage from the players health\n\n // console.log(playerOneHealth);\n // console.log(playerTwoHealth);\n\n console.log(playerOneName + \":\" + playerOneHealth + \" \" + playerTwoName + \":\" + playerTwoHealth);\n //this will print out to console the player's\n //name and health with each round\n var results = winnerCheck(); //checking to see if we have a winner yet\n console.log(results); //printing to console results of winner check\n //calling winnerCheck FN\n if (results === \"no winner\"){ //if no winner alerting user to number of round\n //players health/name\n round++; //adds 1 to each sequential round\n alert(playerOneName + \":\" + playerOneHealth + \" *ROUND \" + round + \" OVER* \" + playerTwoName + \":\" + playerTwoHealth);\n //formats the alert for the user\n }else{ //offers a conditional\n alert(results); //alert with the winning results\n break; //ends the game.\n }\n\n }\n\n }", "function farm() {\n var lowest_health = lowest_health_partymember();\n\n //If we have a target to heal, heal them. Otherwise attack a target.\n if (lowest_health != null && lowest_health.health_ratio < 0.8) {\n if (distance_to_point(lowest_health.real_x, lowest_health.real_y) < character.range) {\n heal(lowest_health);\n } else {\n move_to_target(lowest_health);\n }\n } else {\n let player = get_player(\"Sozaw\");\n if (player != null) {\n var target = get_target_of(player);\n }\n if (target != null && is_monster(target)) {\n if (player != null && target != null && target.s.cursed == undefined && in_attack_range(target)) {\n if (target.hp > 6000) {\n curse(target)\n }\n }\n if (distance_to_point(target.real_x, target.real_y) < character.range) {\n if (can_attack(target)) {\n attack(target);\n }\n }\n } else {\n let player = get_player(\"Sozaw\");\n if (player != null && distance_to_point(player.real_x, player.real_y) > 300) {\n ask_location(\"Sozaw\")\n }\n if (player != null && distance_to_point(player.real_x, player.real_y) < 300) {\n stop(move)\n move(\n character.x + ((player.x - character.x) - 20),\n character.y + ((player.y - character.y) - 20));\n }\n else {\n if (player == null && !smart.moving) {\n ask_location(\"Sozaw\")\n }\n }\n }\n }\n}", "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}", "async tryFight(channel, player, target) {\n\t\tlet player1 = await sql.getPlayerByUsername(channel, player);\n\t\tlet embed = new Discord.RichEmbed();\n\t\t\n\t\tif(target) {\n\t\t\tlet player2 = await sql.getPlayer(channel, target);\n\t\t\tlet offer = player1.offers.find(o => o.playerId == player2.id && \n\t\t\t\t(o.type == enums.OfferTypes.Fight || o.type == enums.OfferTypes.Taunt));\n\t\t\tif(!offer && !player2.isNemesis && !player2.isHenchman) {\n\t\t\t\t// If they haven't offered, send a challenge\n\t\t\t\tembed.setTitle('BATTLE CHALLENGE')\n\t\t\t\t\t.setColor(0x00AE86)\n\t\t\t\t\t.setDescription(`**${player1.name}** has issued a battle challenge to **${player2.name}**! ${player2.name}, enter \\`!fight ${player1.name}\\` to accept the challenge and begin the battle.`);\n\t\t\t\tawait sql.addOffer(player1, player2, enums.OfferTypes.Fight);\n\t\t\t\treturn {\n\t\t\t\t\tembed: embed,\n\t\t\t\t\tping: player2.config.ping ? player2.userId : null\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\t// FIGHT\n\t\t\t\tembed.setTitle(`${player1.name.toUpperCase()} vs ${player2.name.toUpperCase()}`)\n\t\t\t\t\t\t.setColor(0x00AE86);\n\t\t\t\treturn this.fight(player1, player2, offer ? offer.type == enums.OfferTypes.Taunt : false, embed);\n\t\t\t}\n\t\t} else {\n\t\t\tawait sql.addOffer(player1, null, enums.OfferTypes.Fight);\n\t\t\tembed.setTitle('BATTLE CHALLENGE')\n\t\t\t\t.setColor(0x00AE86)\n\t\t\t\t.setDescription(`**${player1.name}** wants to fight anyone! The next person to enter \\`!fight ${player1.name}\\` will accept the challenge and begin the battle.`);\n\t\t\treturn {embed: embed};\n\t\t}\n\t}", "function fight(posNew, posOld) {\n\n if (posNew.x === posOld.x \n && posNew.y <= posOld.y + 1 && posNew.y >= posOld.y - 1 ||posNew.y === posOld.y \n && posNew.x <= posOld.x + 1 && posNew.x >= posOld.x - 1) {\n move = false;\n hover = false;\n fightingArea(); // Info.js (70) When the players fight, the board game is hidden\n scores = 0;\n fightPlayerOne(); // Info.js (110)\n fightPlayerTwo(); // Info.js (126)\n }\n}", "function Fight(player_a, player_b){\n\n this.getKeypress = function(eval){\n if(player_a.npc == true){if(eval.which >= 37 && eval.which <= 41) player_b.addUserInput(eval);}\n else{if(eval.which >= 37 && eval.which <= 41) player_a.addUserInput(eval);}\n\n if(eval.which == 32) console.log(fight.turn());\n }\n\n\n player_a.drawPlayer(0); //draw health boxes\n player_b.drawPlayer(0);\n\n this.turn = function(){\n this.checkWin();\n //generate Fight Sequences\n player_a.generateFightSequence();\n player_b.generateFightSequence();\n\n //compare fight sequences\n var lengthA = player_a.fightSequence.length;\n var lengthB = player_b.fightSequence.length;\n\n var minLength;\n if(lengthA < lengthB) minLength = lengthA; //set minimum fight sequence length\n else{minLength = lengthB;}\n\n for(var i = 0; i < minLength; i++){ //only compare where both sequences are defined\n this.decide(player_a.fightSequence[i], player_b.fightSequence[i]);\n player_a.drawPlayer(player_a.fightSequence[i]);\n player_b.drawPlayer(player_b.fightSequence[i]);\n }\n\n //reset player fight sequence\n player_a.resetSequence();\n player_b.resetSequence();\n return \"Player A: \" + player_a.hitpoints + \" | Player B: \" + player_b.hitpoints;\n }\n\n this.decide = function(a, b){\n var a_hitpoints = player_a.hitpoints;\n var a_defense = player_a.defense;\n var a_damage = player_a.damage;\n\n var b_hitpoints = player_b.hitpoints;\n var b_defense = player_b.defense;\n var b_damage = player_b.damage;\n if(a == 38){ //player A attck\n if(b == 40){ //block - subract (defense / 2) from damage\n a_damage -= (b_defense / 8);\n if(a_damage < 0)a_damage = 0; //check for negative numbers\n b_hitpoints -= a_damage;\n }\n else if(b == 39){ //dodge right\n if((Math.floor(Math.random() * 10) % 2) == 1){ //hit\n b_hitpoints -= (a_damage * 4);\n }\n }\n else if(b == 37){ //dodge left\n if((Math.floor(Math.random() * 10) % 2) == 1){ //hit\n b_hitpoints -= (a_damage * 4);\n }\n }\n else{b_hitpoints -= a_damage;}\n }\n\n player_b.hitpoints = b_hitpoints;\n this.checkWin();\n\n if(b == 38){ //player B attck\n if(a == 40){ //block - subract (defense / 2) from damage\n b_damage -= (a_defense / 8);\n if(b_damage < 0)b_damage = 0; //check for negative numbers\n a_hitpoints -= b_damage;\n }\n else if(a == 39){ //dodge right\n if((Math.floor(Math.random() * 10) % 2) == 1){ //hit\n a_hitpoints -= (b_damage * 4);\n }\n }\n else if(a == 37){ //dodge left\n if((Math.floor(Math.random() * 10) % 2) == 1){ //hit\n a_hitpoints -= (b_damage * 4);\n }\n }\n else{a_hitpoints -= b_damage;}\n\n }\n\n player_a.hitpoints = a_hitpoints;\n this.checkWin();\n\n\n return \"Player A: \" + player_a.hitpoints + \" | Player B: \" + player_b.hitpoints;\n }\n\n this.checkWin = function(){\n if(player_a.hitpoints < 0 || player_b.hitpoints < 0){\n var h = document.createElement(\"H1\"); // Create a <h1> element\n var t = document.createTextNode(\"Game Over\"); // Create a text node\n h.appendChild(t);\n h.style.color = \"green\";\n h.style.textAlign=\"center\";\n h.style.position = 'absolute';\n h.style.top = 300;\n document.body.appendChild(h);\n }\n }\n\n\n}", "async fight(player1, player2, taunted, embed) {\n\t\tlet channel = player1.channel;\t\n\t\tlet world = await sql.getWorld(channel);\n\n\t\t// Give the attacked player a ping if they want one\n\t\tlet ping = null;\n\t\tif(player2.config.ping) {\n\t\t\tping = player2.userId;\n\t\t}\n\t\t\n\t\t// If fighters are training - take them out of training and power them up\n\t\tawait this.completeTraining(player1);\n\t\tawait this.completeTraining(player2);\n\n\t\t// Bean bonuses\n\t\tlet level1 = this.getPowerLevel(player1);\n\t\tlet level2 = this.getPowerLevel(player2);\n\n\t\tif(player2.isNemesis) {\n\t\t\t// Someone attacked the Nemesis, summon henchmen!\n\t\t\tlet henchmenMessages = [];\n\t\t\tlet henchmen = await sql.getHenchmen(channel);\n\t\t\tfor(let i in henchmen) {\n\t\t\t\tlet h = await sql.getPlayerById(henchmen[i].id);\n\t\t\t\tif(!h.status.find(s => s.type == 0) && h.id != player1.id) {\n\t\t\t\t\t// Living henchman, send energy\n\t\t\t\t\tlet boost = this.getPowerLevel(h) * (1 - 0.2 * henchmen[i].defeats);\n\t\t\t\t\tif(boost > 0) {\n\t\t\t\t\t\thenchmenMessages.push(`${h.name} boosts ${player2.name}'s energy by ${numeral(boost.toPrecision(2)).format('0,0')}!`);\n\t\t\t\t\t}\n\t\t\t\t\tlevel2 += boost;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(henchmenMessages.length > 0) {\n\t\t\t\tembed.addField('The Nemesis summons henchmen!', henchmenMessages.join('\\n'));\n\t\t\t}\n\t\t}\n\t\tembed.addField('Power Levels', `${player1.name}: ${numeral(level1.toPrecision(2)).format('0,0')}\\n${player2.name}: ${numeral(level2.toPrecision(2)).format('0,0')}`);\n\t\t\n\t\t// Randomize, then adjust skill ratings\n\t\tlet skill1 = (Math.random() + Math.random() + Math.random() + Math.random()) / 2;\n\t\tlet skill2 = (Math.random() + Math.random() + Math.random() + Math.random()) / 2;\n\t\t\n\t\tconst history = await sql.getHistory(player1.id, player2.id);\n\t\tif(history) {\n\t\t\t// Calculate revenge bonus from losing streak\n\t\t\tconst revengePlayerId = history[0].winnerId == player1.id ? player2.id : player1.id;\n\t\t\tlet battles = 0;\n\t\t\twhile(battles < history.length && history[battles].loserId == revengePlayerId) {\n\t\t\t\tbattles++;\n\t\t\t}\n\t\t\tif(player1.id == revengePlayerId) {\n\t\t\t\tconsole.log(`${player1.name} skill +${battles}0% due to revenge bonus`);\n\t\t\t\tskill1 *= 1 + 0.1 * battles;\n\t\t\t}\n\t\t\tif(player2.id == revengePlayerId) {\n\t\t\t\tconsole.log(`${player2.name} skill +${battles}0% due to revenge bonus`);\n\t\t\t\tskill2 *= 1 + 0.1 * battles;\n\t\t\t}\n\t\t}\n\n\t\tif(player1.isNemesis) {\n\t\t\tskill2 *= 1.15;\n\t\t}\n\t\tif(player2.isNemesis) {\n\t\t\tskill1 *= 1.15;\n\t\t}\n\t\t\n\t\tif(player1.isHenchman) {\n\t\t\tskill2 *= 1.075;\n\t\t}\n\t\tif(player2.isNemesis) {\n\t\t\tskill1 *= 1.075;\n\t\t}\n\t\t\n\t\tconsole.log(`${player1.name}: PL ${Math.floor(level1 * 10) / 10}, Skill ${Math.floor(skill1 * 10) / 10}`);\n\t\tconsole.log(`${player2.name}: PL ${Math.floor(level2 * 10) / 10}, Skill ${Math.floor(skill2 * 10) / 10}`);\n\t\t\n\t\t// Final battle scores!\n\t\tlet score1 = Math.sqrt(level1 * skill1);\n\t\tlet score2 = Math.sqrt(level2 * skill2);\n\t\t\n\t\tlet battleLog = '';\n\t\tif(skill1 < 0.8) {\n\t\t\tbattleLog += `${player1.name} underestimates ${this.their(player1.config.pronoun)} foe!`;\n\t\t} else if(skill1 > 1.2) {\n\t\t\tbattleLog += `${player1.name} surpasses ${this.their(player1.config.pronoun)} limits!`;\n\t\t} else if(skill1 > 1.5) {\n\t\t\tbattleLog += `${player1.name} goes *even further beyond!*`;\n\t\t} else {\n\t\t\tbattleLog += `${player1.name} fights hard!`;\n\t\t}\n\t\tbattleLog += ` Battle rating: ${numeral(score1.toPrecision(2)).format('0,0')}\\n`;\n\t\t\n\t\tif(skill2 < 0.8) {\n\t\t\tbattleLog += `${player2.name} underestimates ${this.their(player2.config.pronoun)} foe!`;\n\t\t} else if(skill2 > 1.2) {\n\t\t\tbattleLog += `${player2.name} surpasses ${this.their(player2.config.pronoun)} limits!`;\n\t\t} else if(skill2 > 1.5) {\n\t\t\tbattleLog += `${player2.name} goes *even further beyond!*`;\n\t\t} else {\n\t\t\tbattleLog += `${player2.name} fights hard!`;\n\t\t}\n\t\tbattleLog += ` Battle rating: ${numeral(score2.toPrecision(2)).format('0,0')}\\n`;\n\t\t\n\t\tembed.addField('Ready? Fight!', battleLog);\n\t\n\t\t// Determine winner - player[0] defeats player[1]\n\t\tlet players = [];\n\t\tif(score1 > score2) {\n\t\t\tplayers = [player1, player2];\n\t\t\tskills = [skill1, skill2];\n\t\t} else {\n\t\t\tplayers = [player2, player1];\n\t\t\tskills = [skill2, skill1];\n\t\t}\n\t\t\n\t\tlet nemesisHistory = players[1].isNemesis ? await sql.getNemesisHistory(channel) : null;\n\t\tlet output = await this.handleFightOutcome(world, players[0], players[1], skills[0], skills[1], \n\t\t\ttaunted && players[1].id == player2.id, nemesisHistory);\n\t\tembed.addField('Results', output);\n\n\t\treturn {\n\t\t\tembed: embed,\n\t\t\tping: ping\n\t\t};\n\t}", "function fight() { //declaring beginning of function\n\n //random formula is - Math.floor(Math.random() * (max - min) + min);\n var minDamage1 = players[0].damage * .5; //calculating the minimum amount of damage player 1 takes (the information from the object created in the players array)\n var minDamage2 = players[1].damage * .5; //calculating the minimum amount of damage player 2 takes (the information from the object created in the players array)\n var f1 = Math.floor(Math.random() * (players[0].damage - minDamage1) + minDamage1); //calculating the amount of damage done to player 1 by subtracting minimum damage from player damage (getting player damage from the object created in players array)\n var f2 = Math.floor(Math.random() * (players[1].damage - minDamage2) + minDamage2); //calculating the amount of damage done to player 2 by subtracting minimum damage from player damage (getting player damage from the object created in players array)\n\n //inflict damage\n players[0].health = players[0].health - f1; //subtract the amount of damage done from the player's \"initial health\", each round the \"initial health\" is changed to the result of this calculation (replacing the health key with the new amount of health for playerOne)\n players[1].health = players[1].health - f2; //subtract the amount of damage done from the player's \"initial health\", each round the \"initial health\" is changed to the result of this calculation (replacing the health key with the new amount of health for playerTwo)\n //console.log(players[0].health, players[1].health); //checking to see if correct math is done (to see why health is displayed as the same)\n\n //check for victor\n var result = winnerCheck(); //variable declared to check if there is a winner by using the winnerCheck() function\n console.log(result); //prints out to the console if there is a winner\n if (result === \"no winner\") //checks the variable result to see if it equals \"no winner\"\n { //if there is no winner, this block of code is ran\n round++; //round number increases\n document.getElementById('kabal').innerHTML = players[0].health; //changing HTML to player's current health\n document.getElementById('kratos').innerHTML = players[1].health; //changing HTML to player's current health\n document.getElementById('round').innerHTML = 'Round ' + round + ' is over!'; //changing HTML so it tells the user what round is done.\n\n\n } else { //if there is a winner, then this block of code is ran\n\n //console.log(document.getElementById('scores').innerHTML);\n document.getElementById('scores').innerHTML = result; //changing the innerHTML of the id scores to the result of winnerCheck() if there is a winner, or both die\n document.getElementById('scores').style.textAlign = 'center'; //centering the text of the result.\n document.getElementById('round').innerHTML = result;\n //alert(result); //an alert with the winner's name is sent to the user\n button.innerHTML = 'Done!';\n button.setAttribute('onclick', null);\n //break; // ends the game\n };\n\n }", "function heroAttack() {\n if(!fightOver) {\n document.getElementById('herocard').classList.add(\"hAttAnim\");\n document.getElementById('herocard').classList.remove(\"cardIntro\");\n document.getElementById('villainCard').classList.remove(\"vAttAnim\");\n setTimeout(punchSound, 700);\n setTimeout(monsterAttack, 1500);\n setTimeout(battleSim, 3000);\n}\nelse {\n window.alert(\"The fight is over, fool!\");\n}\n}", "function C012_AfterClass_Jennifer_StartFight() {\n\tCurrentTime = CurrentTime + 50000;\n\tActorSetCloth(\"Clothed\");\n\tPlayerClothes(\"Clothed\");\n}", "function attack(){\n\t//generate sound effect\n\tvar context = new (window.AudioContext || window.webkitAudioContext)();\n\tvar os = context.createOscillator(); \n\tos.type = 'sine';\n\tos.frequency.value = 100;\n\tos.connect(context.destination);\n\tos.start(); \n\tos.stop(context.currentTime + 0.5);\n\t\n\t//screen shacking effect\n\tdocument.getElementById(\"arena\").style.marginLeft = \"20%\";\n\tsetTimeout(() => { document.getElementById(\"arena\").style.marginLeft = \"0\"; }, 500);\n\n\t//Next Robot\n\tif(monster < 3){\n\t\tsetTimeout(() => { monster += 1; }, 500);\n\t}\n\telse{\n\t\t//Ends a Victorious Game\n\t\tdocument.getElementById('subtitle').innerText=\"All enemies in the area were defeated Mission 1 Completed\"\n \t \tdocument.getElementById('story').innerText=\" Receiving update from headquaters - READY FOR NEXT MISSION \"\t\n\t\tmonster = 0;\n\t\tbegin = false;\n\t}\t\n}", "function fight(){\r\n alert(playerOne[0]+\":\"+playerOne[2]+\" *START* \"+playerTwo[0]+\":\"+playerTwo[2]);\r\n for (var i = 0; i < 10; i++)// for loop\r\n // alert to user player one and player two name and health\r\n {\r\n //random formula is - Math.floor(Math.random() * (max - min) + min);\r\n var minDamage1 = playerOne[1] * .5;\r\n var minDamage2 = playerTwo [1]* .5;\r\n var f1 = Math.floor(Math.random()*(playerOne[1]-minDamage1)+minDamage1);\r\n var f2 = Math.floor(Math.random()*(playerTwo[1]-minDamage2)+minDamage2);\r\n\r\n\r\n\r\n //inflict damage\r\n playerOne[2]-=f1;\r\n playerTwo[2]-=f2;\r\n\r\n console.log(playerOne[0]+\": \"+playerOne[2]+ \" \" + playerTwo[0]+\":\"+playerTwo[2]);\r\n\r\n // print player one and two health and name to console.log\r\n\r\n //check for victor\r\n var result = winnerCheck();// assign the function winnerCheck to the variable result\r\n console.log(result); //print result to console.log\r\n if (result===\"no winner\")\r\n {\r\n round++;\r\n alert(playerOne[0]+\":\"+playerOne[2]+\" *ROUND \"+round+\" OVER\"+\"* \"+playerTwo[0]+\":\"+playerTwo[2]);\r\n\r\n } else{\r\n alert(result);\r\n break;\r\n };\r\n\r\n };\r\n }", "function Game(){\nif(shaman.hp==0) finishGame();\n\nshaman.mp+=shaman.mp_reg;\nif (shaman.mp>shaman.max_mp) shaman.mp = shaman.max_mp;\n\tgenWave();\n\tfor(var k=0; k<shaman.debuffs.length; k++){\n\t\tshaman.debuffs[k].action(k);\n\t}\n\tfor(var j = 0; j<Spells.length; j++){\n\t\tSpells[j].action();\n\t}\n\tfor(var i = 0; i<Enemies.length; i++){\n\t\tEnemies[i].action();\n\t}\n\tdrawGame();\n}", "attackTarget(attack) {\n _gameService.attackTarget(attack)\n draw()\n }", "function fightmonster() {\n\tvar rand4 = Math.ceil(Math.random() * 10);\n\tif (rand4 == 10) {\n\t\tmonsterhealth = monsterhealth - (power * 3);\n\t\tdocument.getElementById(\"fightmess\").innerHTML = \"Your team did x3 power damage!!\";\n\t\tmessagetime = 2;\n\t} else {\n\t\tmonsterhealth = monsterhealth - power;\n\t}\n\tpower = 0;\n\tif (monsterhealth <= 0){\t\n\t\tkillmonster(2);\n\t} else { killtick++; }\n\tdocument.getElementById(\"money\").innerHTML = money;\n\tdocument.getElementById(\"monster\").innerHTML = monsterhealth;\n\tdocument.getElementById(\"rep\").innerHTML = reputation;\n\tmonsterbar();\n}", "function eatFungus()\n\t\t\t{\n\t\t\t\tfungusBank -= 1;\n\t\t\t\tstamina = (stamina * 10 + 5) / 10;\n\t\t\t\tif (stamina > 10)\n\t\t\t\t{\n\t\t\t\t\tstamina = 10;\n\t\t\t\t}\n\t\t\t\thunger = (hunger * 10 + 10) / 10;\n\t\t\t\tif (hunger > 10)\n\t\t\t\t{\n\t\t\t\t\thunger = 10;\n\t\t\t\t}\n\t\t\t\thealth = (health * 10 - 5) / 10;\n\t\t\t\tif (health < 0)\n\t\t\t\t{\n\t\t\t\t\thealth = 0;\n\t\t\t\t}\n\t\t\t\taction(0,1,0);\n\t\t\t\tadvanceTime();\n\t\t\t\tupdateDisp();\n\t\t\t}", "function startFight(activePlayer, passivePlayer) {\n let hidingButton = (player) => $(`#${player.character}Buttons`).hide();\n let showingButton = (player) => $(`#${player.character}Buttons`).show();\n let defend = () => $(`#${activePlayer.character}`).attr('defend', 'true');\n let attack = () => {\n let currenthealth = passivePlayer.health;\n if (document.getElementById(`${passivePlayer.character}`).hasAttribute('defend')) {\n passivePlayer.health = currenthealth - (activePlayer.weapon.damage / 2);\n } else {\n passivePlayer.health = currenthealth - activePlayer.weapon.damage;\n }\n if(passivePlayer.health <= 0) {\n $(`#${passivePlayer.character}Health`).text(`Health Point: 0`); \n } else {\n $(`#${passivePlayer.character}Health`).text(`Health Point: ${passivePlayer.health}`);\n }\n }\n\n function switchTurn() {\n let oldActive = activePlayer;\n activePlayer = passivePlayer;\n passivePlayer = oldActive;\n }\n\n hidingButton(passivePlayer);\n\n $(`.attack`).click(function () {\n if (document.getElementById(`${activePlayer.character}`).hasAttribute('defend')) {\n $(`#${activePlayer.character}`).removeAttr('defend');\n }\n attack();\n //Check if the game is over \n if (hasWinner(passivePlayer)) {\n hidingButton(activePlayer);\n hidingButton(passivePlayer);\n $(`#${activePlayer.character}Status`).text('WINNER');\n $(`#${passivePlayer.character}Status`).text('LOSER');\n } else {\n switchTurn();\n hidingButton(passivePlayer);\n showingButton(activePlayer);\n }\n });\n\n $(`.defend`).click(function () {\n defend();\n switchTurn();\n hidingButton(passivePlayer);\n showingButton(activePlayer);\n });\n\n }", "function vehicleShaking(action) {\r\n\r\n\r\n\tif ( gameobj.sittight >= 6) {\r\n\r\n\t\ttextDialogue(john,\"John: Hey! Hold onto something tight this looks like its going to be a rough ride!\", 4000);\r\n\t\ttextDialogue(narrator,\"SHIP LANDING NOISES!\", 5000);\r\n\r\n\t\tsetTimeout(winnerWinner, 6000);\r\n\t} else {\r\n\t\ttextDialogue(narrator, \"Narocube: Holy shit, what is that, how can something so large be alive\", 4000);\r\n\t\ttextDialogue(narrator, \"Narocube: It must be some sort of queen animal\", 5000);\r\n\t\ttextDialogue(enemy, (enemy.name + \": I WILL DEVOUR YOUR EVERY BEING\"), 6000);\r\n\t\t//if the queen dies you win, if you die you loose\r\n\t\tenemy = new monsterBoss();\r\n\t\tif (queen.health != 0) {\r\n\t\t\tif (gameobj.helpedJohn === true){\r\n\t\t\t\ttextDialogue(john,\"John: Hey! Let me get the first shot on her!\", 7000);\r\n\r\n\t\t\t\tCRhit = CRhitRoll(john, enemy, 0); //rolls for critical hit. if damage, comes back true\r\n\r\n\t\t\t\tif( CRhit ) {\r\n\t\t\t\t\ttextDialogue(narrator, \"Narocube: He got a critical hit, John did 2x damage now!\",8000);\r\n\t\t\t\t\ttextDialogue(enemy, (enemy.name + \": OUCH YOU LITTLE SHITS, YOU'RE GOING TO PAY\"), 9000);\r\n\t\t\t\t\ttextDialogue(narrator, (\"Narocube:\" + enemy.name + \"'s new health is \" + enemy.health), 10000);\r\n\t\t\t\t} else{\r\n\t\t\t\t\ttextDialogue(john,\"John: Alright, direct hit!\", 8000);\r\n\t\t\t\t\ttextDialogue(narrator, (\"Narocube: Oh wow the queens life is now\" + enemy.health), 9000);\t\r\n\t\t\t\t\ttextDialogue(enemy, (enemy.name + \": OH, I GUESS THAT STINGS\"), 10000);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsetTimeout(fightMonster, 11000);\r\n\r\n\t\t\t//John shoots first then you fighter her\r\n\t\t\t} else {\r\n\r\n\t\t\t\tsetTimeout(fightMonster, 7000);\r\n\t\t\t\tsetTimeout(winnerWinner, 8000);\r\n\t\t\t}\r\n\t\t\t//fight her\r\n\t\t} else {\r\n\t\t\ttextDialogue(narrator, \"Narocube: You actually did it! She's DEAD\", 1000);\r\n\t\t\tsetTimeout(winnerWinner, 11000);\r\n\t\t}\r\n\t}\r\n}", "function takeTurn () {}", "updateFighterAction(f1) {\n\n // if no input applied and we were running, switch to idle\n let inputApplied = game.inputsApplied.indexOf(f1.playerId) >= 0;\n if (!inputApplied && f1.action === Fighter.ACTIONS.RUN)\n f1.action = Fighter.ACTIONS.IDLE;\n\n // end-of-action handling\n if (f1.progress === 0) {\n f1.progress = 99;\n\n // end of dying sequence\n if (f1.action === Fighter.ACTIONS.DIE) {\n game.removeObjectFromWorld(f1);\n return;\n }\n\n // if no input applied on this turn, switch to idle\n if (!inputApplied && f1.action === Fighter.ACTIONS.FIGHT)\n f1.action = Fighter.ACTIONS.IDLE;\n }\n }", "function attackMonsterHandler () {\n attackMonster(modeAttack);\n}", "dontEatBreakfast() {\n console.clear();\n console.log(\"Angry that you never use it, your Waffle Iron attacks!\");\n console.log(\"The waffle iron uses 'face press'!\");\n \n //Health && check\n let waffleAttack = this.randomInt(25, 1); // Random Integer between 1 and 25\n if(this.player.isDead(waffleAttack)) {\n this.endGame(this.player);\n }\n \n //User attack choice\n this.newLine();\n let waffleChoices = [\"Unplug the waffle iron\", \"Splash water\", \"Jump on it\", \"Just walk away\"];\n let index = this.choiceSelection(waffleChoices, \"Which action do you take? \");\n \n //Array\n this.questionsPush(this.player, \"Which action do you take against the waffle iron?\");\n \n while (!waffleChoices[index]) {\n console.clear();\n console.log(\"I do not understand\");\n index = this.choiceSelection(waffleChoices, \"Which action do you take? \");\n }\n\n switch(index) {\n case 0:\n this.unplugWaffleIron();\n break;\n \n case 1:\n this.splashWater();\n break;\n\n case 2:\n this.jumpOnIt();\n break;\n \n case 3:\n this.walkAway();\n break;\n }// End of waffleBattle Validity check\n\n this.travel();\n }", "function battle(victimStrength, attackerStrength){\nif (victim.strength === attacker.strength) {\n console.log(\"Dead\");\n}\nelse if (victim.strength < attacker.strength) {\n console.log(\"Also dead\");\n}\nelse {\n console.log(\"Alive\");\n}\n}", "function SarahFightSophie() {\n\tSophie.Name = \"Sophie\";\n\tKidnapStart(Sophie, SarahBackground, 10, \"SarahFightSophieEnd()\");\n}", "static doFight(key, defenderUserId){\n let ost = parseInt(KB.buffer);\n if(isNaN(ost) || ost === 0){\n return Lands.choosingOpponent();\n }\n\n //console.info(\"doFight(\" + ost + \", \" + defenderUserId + \")\");\n\n //Test if we have enought ost men\n if(game.getCurrentUser().getOst() < ost){\n game.addError(Errors.notEnoughtOst());\n return Lands.choosingOpponent();\n }\n\n\n let result = null;\n let promiseCombat = null;\n if(defenderUserId == 0){\n promiseCombat = Combat.execute(game.getBarbares(), game.getCurrentUser(), ost);\n } else {\n promiseCombat = Combat.execute(game.getUserById(defenderUserId), game.getCurrentUser(), ost);\n }\n\n //Resolve promise\n promiseCombat.then((result)=>{\n\n //add 1 to counter of current attacks\n Lands.nbAttacks++;\n\n KB.listen([\n {key: Const.KEYBOARD_RETURN, callback: Lands.choosingOpponent}, // ↩\n ]);\n\n //else choose number of soldier\n Party.refreshWithTemplate(tpl_5_combat_result, result);\n });\n }", "function fight(fighter,improvedFighter,...points){\r\n\r\n for( let i = 0; (i < points.length) ; i++){\r\n fighter.hit(improvedFighter,points[i]);\r\n if(improvedFighter.health == 0){\r\n return fighter;\r\n }else{\r\n \tif( (++i) < points.length ){\r\n \t\timprovedFighter.hit(fighter,points[i]);\r\n \t}\r\n }\r\n if(fighter.health == 0){\r\n return improvedFighter;\r\n } \r\n }\r\n return (null);\r\n}", "function multiFight() {\n while ((0,kolmafia__WEBPACK_IMPORTED_MODULE_0__.inMultiFight)()) {\n (0,kolmafia__WEBPACK_IMPORTED_MODULE_0__.runCombat)();\n }\n\n if ((0,kolmafia__WEBPACK_IMPORTED_MODULE_0__.choiceFollowsFight)()) (0,kolmafia__WEBPACK_IMPORTED_MODULE_0__.visitUrl)('choice.php');\n}", "function init(){\n\t//log fight\n\tconsole.log(\" ** FIGHT ** \");\n\n\n\t//Define doms\n\tvar fighter1_txt = document.getElementById(\"kabal\").getElementsByTagName(\"p\")[0];\n\tvar fighter2_txt = document.getElementById(\"kratos\").getElementsByTagName(\"p\")[0];\n\tvar round_txt = document.getElementsByTagName(\"h4\")[0];\n\tvar button = document.getElementById(\"fight_btn\");\n\tconsole.log(button);\n\n\t// Define Variables in an Object\n\tvar fighters = [\n\t{name:'Spiderman', damage:20, health:100},\n\t\n\t{name:'Superman', damage:20, health:100}\n\t];\n\n\t//variable for starting round\n\tvar rd = 1;\n\n\t//Add text for page\n\tfighter1_txt.innerHTML = fighters[0].name + \":\" + fighters[0].health;\n\tfighter2_txt.innerHTML = fighters[1].name + \":\" + fighters[1].health;\n\tround_txt.innerHTML = \"Click to START Fight!\";\n\n\t//click event for start button\n\tbutton.addEventListener(\"click\",fight, false);\n\n\t// Fight Function\n\tfunction fight(){\n\t\n\t\t//Start match - display name/health\n\t\tfighter1_txt.innerHTML = fighters[0].name + \":\" + fighters[0].health;\n\t\tfighter2_txt.innerHTML = fighters[1].name + \":\" + fighters[1].health;\n\t\t//random formula to generate damage\n\t\tvar minDam1 = fighters[0].damage * .5;\n\t\tvar minDam2 = fighters[1].damage * .5;\n\t\tvar f1 = Math.floor(Math.random() * fighters[0].damage + minDam1);\n\t\tvar f2 = Math.floor(Math.random() * fighters[1].damage + minDam2);\n\t\t//generate damage on players\n\t\tfighters[0].health = fighters[0].health - f1;\n\t\tfighters[1].health = fighters[1].health - f2;\n\t\t\n\t\t//Update health of players\n\t\tconsole.log(\"Round \" + rd + \":\" + fighters[0].name + \": \" +fighters[0].health + \" vs \" + fighters[1].name + \": \" + fighters[1].health + \".\");\n\t\t\n\t\t//check if either player has died\n\t\tvar results = winnerCheck();\n\t\tconsole.log(results);\n\t\t\n\t\t//output round information\n\t\tround_txt.innerHTML = \"ROUND \" + rd + \" completed\";\n\t\t//increment round\n\t\trd++;\n\t\t\n\t\t//if statement to check for winner\n\t\tif (results === \"no winner\"){\n\t\t\tfighter1_txt.innerHTML = fighters[0].name + \":\" + fighters[0].health;\n\t\t\tfighter2_txt.innerHTML = fighters[1].name + \":\" + fighters[1].health;\n\t\t}else{\n\t\t\tfighter1_txt.innerHTML = '<span style = \"margin-left:250px; width: 100%;\">' + results + '</span>';\n\t\t\tfighter2_txt.innerHTML = \"\";\n\t\t\t//disable event listener to end button click\n\t\t\tbutton.removeEventListener(\"click\",fight,false);\n\t\t\t//change button appearance to reflect \"done\"\n\t\t\tdocument.querySelector('.buttonblue').innerHTML = \"DONE!!\";\n\t\t}\n\t};//end fight function\n\n\n\tfunction winnerCheck(){\n\t\n\t\tvar results = \"no winner\";\n\t\tif (fighters[0].health < 1 && fighters[1].health < 1)\n\t\t{\n\t\t\tresults = \"YOU BOTH DIE!!!\";\n\t\t\t\n\t\t}else if (fighters[0].health < 1){\n\t\t\t\n\t\tresults = fighters[1].name + \"WINS!!!\";\n\t\t\n\t\t}else if (fighters[1].health < 1){\n\t\t\n\t\tresults = fighters[0].name + \"WINS!!!\";\n\t}\n\treturn results;\n\t}//end winnerCheck function\n\n}//end init function", "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}", "function enemyAttack() {\n //depending on baddie type, deal different damage\n if (baddie.type === \"Ancient Dragon\") {\n var dmg = (Math.floor((Math.random() * 20)) + 30);\n } else if (baddie.type === \"Prowler\") {\n var dmg = (Math.floor((Math.random() * 20)) + 15);\n } else {\n var dmg = (Math.floor((Math.random() * 20)) + 5);\n }\n //subtract dmg from inventory.Health\n inventory.Health -= dmg;\n console.log(\"The \" + baddie.type + \" hits you for \" + dmg + \"! You now have \" + inventory.Health + \" health left!\")\n //player death logic\n if (inventory.Health > 0) {\n //if player is still alive, they can run or fight\n fightOrFlight();\n } else {\n die();\n }\n}", "function fight(attacker, victim) {\n const def = victim.lvl.defence;\n let dmg = 0;\n for (let i = 0; i < attacker.lvl.strength; i++) {\n const rand = Math.floor(Math.random() * 8) + 2;\n if (rand >= def) {\n dmg++;\n }\n }\n\n return dmg;\n }", "function wolfAndWitchHitsBack(){\n\n if(wolf && witch && !stickThrown){\n hitByWitch()\n hitByWolf()\n }\n\n else if(witch && wolf && stickThrown){\n hitByWitch()\n text.innerHTML += '<p> Vargen är iväg och hämtar pinnen du kastade. </p>'\n }\n\n else if( wolf && !witch && !stickThrown){\n\n text.innerHTML += '<p><br> Vargen: \"Du dödade häxan din lille skit! Hon som skulle bjuda mig på mat!\"</p>'\n hitByWolf()\n }\n\n else if(witch && !wolf){\n hitByWitch()\n }\n\n else{\n text.innerHTML += '<p> <br> Lugnet lägger sig över slagfältet. </p>'\n fightTheWitch()\n }\n\n if(healthPoints >= 1){\n if(pikachuFight){\n fightingPikachu() \n }\n fightTheWitch()\n }\n \n}", "function walk(){\n console.log(\"Walking along\")\n \n let fightChance = Math.floor(Math.random() * 3) + 1;\n console.log(\"You arrive at a crossroads. After studying the paths you chose the \" + fightChance + \" path\");\n\n switch(fightChance) {\n case 1:\n enemyEncounter()\n break;\n case 2:\n console.log(\"You need to keep walking\")\n break;\n default:\n console.log(\"After a short water break, you start walking again\")\n break;\n };\n}", "function fight(player1, player2, player1Health, player2Health) {\n while (true) {\n let attacker = chooseOption(player1, player2);\n if (attacker === player1) {\n player2Health = attackPlayer(player2Health);\n logHealth(player2, player2Health);\n if (isDead(player2Health)) {\n logDeath(player1, player2);\n break;\n }\n }\n else {\n player1Health = attackPlayer(player1Health);\n logHealth(player1, player1Health);\n if (isDead(player1Health)) {\n logDeath(player2, player1);\n break;\n\n }\n\n }\n }\n}", "function shallNot(){\n if(fighterSelected.charName === \"Gandalf\"){\n if(defenderSelected.charName === \"Balrog\"){\n pass.play();\n }\n }\n}", "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}", "function fighterStats(name, hp, atk, def) {\n this.name = name;\n this.hp = hp;\n this.hp2 = hp;\n this.atk = atk;\n this.def = def;\n\n /** Takes damage from an enemy@param{int} damage The damage taken*/\n this.takeDamage = function(damage) {\n var damageTaken = Math.abs(damage - this.def);\n if(damage <= this.def) {\n damageTaken = 1;\n }\n this.hp2 = this.hp2 - damageTaken;\n this.hp2 = this.hp2 < 0 ? 0 : this.hp2;\n console.log(damageTaken);\n // console.log('You have taken ' + damage + 'damage!');\n }\n}", "function strongAttackHandler(){\n attackMonster('STRONG_ATTACK');\n\n /*const damage = dealMonsterDamage(STRONG_ATTACK_VALUE);\n currentMonsterHealth -= damage;\n const playerDamage = dealPlayerDamage(MONSTER_ATTACK_VALUE);\n currentPlayerHealth -= playerDamage;\n\n //11\n if(currentMonsterHealth <=0 && currentPlayerHealth > 0){\n alert('You won!');\n\n }else if (currentPlayerHealth <=0 && currentMonsterHealth > 0){\n alert('You have Lost'); //Player loses if Monster Health is above 0.\n }\n else if (currentPlayerHealth <=0 && currentMonsterHealth <= 0 ){\n alert('You have a draw');\n }*/\n\n\n }", "function attack(){\n\tif(canAttack){\n\n\t\t//Weapon Sound\n\t\tvar randWeapon = Math.floor(Math.random()*AUDIO_WEAPON.length);\n\t\tchangeAudio(AUDIO_WEAPON[randWeapon]);\n\n\t\t//Player stats\n\t\t//var playerHP = parseInt($(\"#avatar_HP_0\").html());\n\t\tvar playerName = $(\"#avatar_NAME_0\").html();\n\t\tvar playerNum = $(\"#avatarContainer_0\").attr('value');\n\t\tvar playerAttack = AVATAR_STATS[playerNum][\"ATTACK\"];\n\t\tvar totalPlayerAttack = playerAttack+playerPower;\n\n\t\t//CPU stats\n\t\tvar cpuName = $(\"#currentEnemy_NAME\").html();\n\t\t//var cpuHP = parseInt($(\"#currentEnemy_HP\").html());\n\t\tvar cpuNum = $(\"#currentEnemyContainer\").attr('value');\n\t\tvar cpuAttack = AVATAR_STATS[cpuNum][\"DEFENSE\"];\n\n\t\t//Game logic/math\n\t\tcurrentEnemyHP -= totalPlayerAttack;\n\t\tcurrentPlayerHP -= cpuAttack;\n\t\t$(\"#currentEnemy_HP\").html(\"HP: \"+currentEnemyHP);\n\t\t$(\"#avatar_HP_0\").html(\"HP: \"+currentPlayerHP);\n\t\tplayerPower+=playerAttack;\n\n\t\t//Message box results\n\t\t$(\"#playerText\").html(\"You hit \"+cpuName+\" for \"+totalPlayerAttack+\" damage!\");\n\t\t$(\"#cpuText\").html(cpuName+\" hit you for \"+cpuAttack+\" damage!\");\n\n\t\tif(!gameOver){\n\n\t\t\t//Tie condition\n\t\t\tif (currentPlayerHP<= 0 && currentEnemyHP <=0 && enemyNum.length<1){\n\t\t\t\t//$(\"#currentEnemyContainer\").css({\"display\":\"none\"});\n\t\t\t\t$(\"#avatar_IMG_0\").addClass(\"dead\");\n\t\t\t\t$(\"#avatar_HP_0\").html(\"DEFEATED\");\n\t\t\t\t$(\"#currentEnemy_IMG\").addClass(\"dead\");\n\t\t\t\t$(\"#currentEnemy_HP\").html(\"DEFEATED\");\n\n\t\t\t\tcanAttack=false;\n\t\t\t\tgameOver=true;\n\t\t\t\t$(\"#playerText\").html(\"There was a tie! You and \"+cpuName+\" have both been defeated\");\n\t\t\t\t$(\"#cpuText\").html(\"Press Start a new game to play again!\");\n\t\t\t}\n\n\t\t\t//Lose condition\n\t\t\telse if(currentPlayerHP <= 0){\n\t\t\t\t//$(\"#currentEnemyContainer\").css({\"display\":\"none\"});\n\t\t\t\t$(\"#avatar_IMG_0\").addClass(\"dead\");\n\t\t\t\t$(\"#avatar_HP_0\").html(\"DEFEATED\");\n\t\t\t\tif(currentPlayerHP <= 0 && currentEnemyHP <= 0){\n\t\t\t\t\t$(\"#currentEnemy_IMG\").addClass(\"dead\");\n\t\t\t\t\t$(\"#currentEnemy_HP\").html(\"DEFEATED\");\n\t\t\t\t}\n\t\t\t\tcanAttack=false;\n\t\t\t\tgameOver=true;\n\t\t\t\tnewEnemy=false;\n\t\t\t\t$(\"#playerText\").html(\"You have been defeated by \"+cpuName+\" !!\");\n\t\t\t\t$(\"#cpuText\").html(\"Press Start a new game to play again!\");\n\t\t\t\tlosses+=1;\n\t\t\t\t$(\"#losses\").html(losses);\n\t\t\t}\n\n\t\t\t//Win condition\n\t\t\telse if(currentEnemyHP <= 0 && enemyNum.length<1 && currentPlayerHP >0 ){\n\t\t\t\t//$(\"#currentEnemyContainer\").css({\"display\":\"none\"});\n\t\t\t\t$(\"#currentEnemy_IMG\").addClass(\"dead\");\n\t\t\t\t$(\"#currentEnemy_HP\").html(\"DEFEATED\");\n\t\t\t\tcanAttack=false;\n\t\t\t\tgameOver=true;\n\t\t\t\t$(\"#playerText\").html(\"You have defeated all enemies. Congratulations!!\");\n\t\t\t\t$(\"#cpuText\").html(\"Press Start a new game to play again!\");\n\t\t\t\twins+=1;\n\t\t\t\t$(\"#wins\").html(wins);\n\n\t\t\t}\n\n\t\t\t//Enemy defeated, select another enemy\n\t\t\telse if(currentEnemyHP <= 0 && enemyNum.length>0){\n\t\t\t\tcanAttack=false;\n\t\t\t\t$(\"#currentEnemyContainer\").css({\"display\":\"none\"});\n\t\t\t\t$(\"#playerText\").html(\"You have defeated \"+cpuName+\"!!\");\n\t\t\t\t$(\"#cpuText\").html(\"Select another enemy to defeat..\");\n\n\t\t\t\tnewEnemy=true;\n\t\t\t\t\n\n\t\t\t}\n\t\t}\n\t}\n}", "function fight() {\n window.alert(\"The fight has begun \" + playerName + \"!\");\n}", "function fighterDefeat(){\n $(\".chosenFighter\").parent().fadeTo(\"slow\", 0.1);\n minas.play();\n \n battle = false; \n\n \n}", "function walk(){\n var chance = Math.ceil(Math.random() * 4) // random number between 1-4 .floor does 0-3, .ceil does 1-4\n if(chance === 3){\n //attack stuff//\n if(hasGrenade === false){\n console.log(\"\\n [SHADE] We are being attacked! \")\n sleep.msleep(1000)\n monsterSummon()\n // monsterBattle()\n } else if(hasGrenade === true){\n bossFight()\n }\n }else if(chance === 4){\n randomEvent()\n }else{\n console.log(\"\\n [SHADE] Good progress, make another choice. \")\n }\n}", "function routeFrame(enemyFighter) {\n\n return 'flying';\n }", "async function exitfight(result){\r\n // --- gets the pet row from the database\r\n let petrow = await sql.get(ownedpet, petname)\r\n let frow = await sql.get(`SELECT * FROM fights WHERE user = \"${petrow.owner}\" AND pet = \"${petrow.name}\"`).catch(allerrors)\r\n if(result == \"eko\"){\r\n //starts taming process if the enemy is ko instead of showing default end screen\r\n endfight = \"taming\"\r\n return fightcollector.stop()\r\n }\r\n\r\n endfight = \"y\" //tells the embed updater to stop\r\n\r\n //changes xp amount based on outcome\r\n switch(result){\r\n //for knocking out or killing the enemy, add good xp\r\n case`eko`:\r\n case`win`: await addxp(goodxp, message.author.id, petrow.name); break;\r\n //for a tie add a little xp\r\n case`tie`: await addxp(medxp, message.author.id, petrow.name); break;\r\n //for fleeing, a loss or being knocked out, add minimal xp\r\n case`flee`: await addxp(badxp, message.author.id, petrow.name); break;\r\n case`ko`:\r\n case`defeat`: await addxp(badxp, message.author.id, petrow.name); break;\r\n }\r\n\r\n // --- creates a new embed\r\n femb = new Discord.RichEmbed()\r\n .setTitle(`Fight over!`)\r\n .setThumbnail(`https://i.imgur.com/ln2EYpy.png`)\r\n //changes the description based on the outcome\r\n .setDescription((`${petrow.name} fought a **lvl. ${enemylvl} ${encounter}** ${result == `draw` ? `to a draw` : result == `win` ? `and won` : result == \"defeat\" ? `and lost` : result == \"ko\" ? `and was knocked out` : result == \"eko\" ? `and knocked out the enemy` : `and escaped`}!\\n\\nYour pet gained ${result == `draw` ? `some` : result == `win` || result == `eko` ? `a lot of` : `a little`} experience!\\n${xplvlchange}\\n⁣`))\r\n //adds the roundrecap (what happened last round)\r\n if(frow[`round`+frow.round] == `` || frow.round-1 < 1){/*If no round recap is defined or this is the first round, it doesn't add anything*/}\r\n else{femb.addField(`Round ${frow.round-1}:`, `${frow[`round`+frow.round]}\\n⁣`)}\r\n if(frow[`round`+(frow.round+1)] == ``){/*If no next round recap is defined it doesn't add anything*/}\r\n else{femb.addField(`Round ${frow.round}:`, `${frow[`round`+(frow.round+1)]}\\n⁣`)}\r\n //adds the stats\r\n femb.addField(`${petrow.name}'s stats:`, `<:health:503148983917608971> Health: ${petrow.health} (${petrow.maxhealth})\\n<:shields:503149009142022144> Shields: ${petrow.shields}\\n<:attack:560103116989661211> Strength: ${petrow.attack}\\n<:stamina:559102664080752640> Stamina: ${petrow.stamina}\\n<:torpor:698554042271531011> Torpidity: ${petrow.torpidity} (${petrow.maxtorpidity})\\n⁣`, true)\r\n femb.addField(`Wild ${encounter}'s stats:`, `<:health:503148983917608971> Health: ${frow.ehealth} (${frow.emaxhealth})\\n<:shields:503149009142022144> Shields: ${frow.eshields}\\n<:attack:560103116989661211> Strength: ${frow.eattack}\\n<:stamina:559102664080752640> Stamina: ${frow.estamina}\\n<:torpor:698554042271531011> Torpidity: ${frow.etorp}/${frow.emaxtorp}\\n⁣`, true)\r\n //edits the message with the new embed\r\n encmsg.edit(femb).catch(allerrors)\r\n //stops the reaction collector\r\n fightcollector.stop()\r\n }", "attackClicked() {\n if (this.state===\"battleMode\") {\n // Reduce character HP by opponent's counter value\n this.playerHP -= this.opponentCounterAtk;\n // Reduce opponent HP by character's current attack value\n this.opponentHP -= this.playerCurrentAtk;\n\n // Write damage done to #combatLog\n let oppName = $(\"#battleZone > .opponent > .name\").text();\n $(\"#combatLog\").text(\"You attacked \"+oppName+\" for \"+this.playerCurrentAtk+\" damage, \"+oppName+\" attacked you for \"+this.opponentCounterAtk+\" damage\");\n\n // Increase character's current attack by base attack value\n this.playerCurrentAtk += this.playerBaseAtk;\n\n // Update character cards with new Atk and HP\n $(\"#battleZone > .player >> .atk\").text(this.playerCurrentAtk);\n $(\"#battleZone > .player >> .hp\").text(this.playerHP);\n $(\"#battleZone > .opponent >> .hp\").text(this.opponentHP);\n\n // if (playerHP == 0) DEFEAT\n if (this.playerHP<=0) {\n $(\"#combatLog\").append(\"<div>You were defeated by \"+oppName+\"</div>\");\n \n // Go to final state\n this.endGame();\n }\n // else if (opponentHP == 0) Win Match -> remove current opponent\n else if (this.opponentHP<=0) {\n $(\"#battleZone > .opponent\").remove();\n\n let winMsg = \"You defeated \"+oppName;\n\n // if (opponentsRemaining) pick next opponent\n if ( $(\"#opponentSelect\").children().length > 0 ) {\n winMsg += \", choose your next opponent\";\n\n // Allow next opponent to be selected\n this.state = \"oppSelect\"\n } else { // else WIN GAME\n winMsg += \", you are the true master of the Dark Side!\";\n\n // Go to final state\n this.endGame();\n }\n $(\"#combatLog\").append(\"<div>\"+winMsg+\"</div>\");\n \n }\n \n }\n }", "function attackDefender() {\r\n $(\"#attackResult\").html(`</div class = \"strike\"> ${defenderName} has been attacked for ${attackCurrent} health points. </div>\r\n <br>\r\n <br>\r\n </div class = \"returned\"> ${defenderName} counter attacked for ${counterAttack} health points. </div>`\r\n );\r\n\t\t\r\n\t\t\r\n\t\t// updates the hero hp displayed below image\r\n hpHero -= counterAttack;\r\n\t\t$(\".hero .healthpoints\").html(\"HP: \" + hpHero);\r\n\t\t$(\".hero #healthbar\").css(\"width\" , hpHero/heroTotalHealth*100+\"%\");\r\n \r\n // updates the defender hp displayed below image\r\n hpAttacker -= attackCurrent;\r\n\t\t$(\".defender .healthpoints\").html(\"HP: \" + hpAttacker);\r\n\t\t$(\".defender #healthbar\").css(\"width\" , hpAttacker/defenderTotalHealth*100+\"%\");\r\n\r\n // sets conditions for winning and losing\r\n // hero loses if hp goes to less than 0\r\n\t\tif (hpHero <= 0) {\r\n\t\t\theroDefeated();\r\n\t\t\t$(\"#attack\").hide();\r\n\t\t}\r\n\r\n // the other guy also loses if hp goes to less than 0\r\n\t\tif (hpAttacker <= 0) {\r\n\t\t\tdefenderDefeated(defenderName);\r\n\t\t}\r\n\r\n // hero wins only if he defeats all three other fighters AND has hp greater than 0\r\n\t\tif (defeatedDads.length >= 3 && hpHero >0 ) {\r\n\t\t\t$(\"#attack\").hide();\r\n\t\t\t$(\"#defTitle\").show();\r\n\t\t\t$(\"#challengers\").hide();\r\n\t\t\t$(\".defender\").hide();\r\n\t\t\t$(\".hero\").append(\r\n\t\t\t\t`<div> We have a WINNER!!! </div>`\r\n\t\t\t);\r\n\t\t}\r\n\r\n // the current value of the hero's attack is then added to the base attach, \r\n // effectively multiplying the number of attacks by the base attack value\r\n\t\tattackCurrent += attackBase;\r\n\t}", "function fightSequence (characterChosen, characterDefender) {\n var playersCharacter = Object.assign ({}, characterChosen);\n var computersCharacter = Object.assign ({}, characterDefender);\n\n //>1. print Health and Attack to jumbotron <p>\n //>2. when attack is clicked\n //>3. playersCharacter.health - computersCharacter.CounterAttack: computersCharacter.health - playersCharacter.attack\n //>4. playersCharacter.attack += playersCharacter.attack\n //>5. check to see if each have 0 health with checkIfDead()\n //>6. if playersCharacter is dead <you loose!>, if computersCharacter is dead > check to see if any characters still left, if not you win! IF yes update screen by starting form >1. (will most likely have to be called again with new computersCharacter parameter)\n }", "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}", "function attackCalc(attacker) {\n\n var physDiff = titan.def - attacker.str;\n\n var atkDiff = attacker.atk - physDiff;\n\n var multiplier = function (min,max){\n return Math.floor(Math.random(1)*(max-min+1)+min);\n };\n\n var defenderHpDown = titan.hp - (atkDiff * multiplier(3,4) + multiplier(25, 90));\n\n var damageDone = titan.hp - defenderHpDown;\n\n titan.hp = defenderHpDown;\n\n var hit = new Audio();\n hit.src = \"./sounds/effects/hit.wav\";\n hit.play();\n\n $('#damageAnnouncer').html(attacker.name + \" did \" + damageDone + \" damage to the \" + titan.name + \".\");\n\n $('#foeBar').html(\"-\" + damageDone);\n\n setTimeout(function(){\n $('#foeBar').html(\" \");\n }, 2000);\n\n if (titan.hp < 1) {\n $('#damageAnnouncer').html(attacker.name + \" has defeated the \" + titan.name + \"!\");\n titan.KO = true;\n };\n\n healthCheck();\n\n healthBarsUpdate();\n\n if(!gameOver()) {\n readNextToken();\n }\n\n}", "function Combat(enemy)\n{\n var victory;\n //inform the on what enemy they are fighting\n alert(\"You encounter a \" + enemy.name + \"!\");\n while(enemy.health > 0 && playerStatus.health > 0)\n {\n //create hit random variable to simiulate random phenomena during combat\n var hit = Math.random() * 100;\n //prompt the user to do something\n var fight = prompt(\"what are you going to do? \\n attack with something \\n run away \\n defend\").toLowerCase();\n //create a switch statement to help determine what the player does in battle\n switch(fight)\n {\n // the uesr wishes to attack, but does not specify how\n case 'attack':\n var attack = prompt(\"What are you attacking with?\").toLowerCase();\n switch(attack)\n {\n case'sword':\n case'attack sword':\n case'attack with sword':\n if(hit >= 20 || enemy.stun == true)\n {\n alert(\"You easily stab your sword through the \" + enemy.name + \"!\");\n enemy.health -=2;\n }\n else\n {\n alert(\"The \" + enemy.name + \" is faster than you thought, he manges to dodge your sword swipe!\");\n }\n break;\n case'dagger':\n case'attack dagger':\n case'attack with dagger':\n if(hit >= 30 && inventory.sword == true)\n {\n alert(\"You manage to slash the \" + enemy.name + \" with your dagger.\");\n enemy.health --;\n }\n else if(inventory.sword == false)\n {\n alert(\"You don't have a sword!\"); \n }\n else\n {\n alert(\"The \" + enemy.name + \" jumps away before you can hit it!\");\n }\n break;\n case'bow':\n case'attack bow':\n case'attack with bow':\n if(hit <= 30 && inventory.bow == true)\n {\n alert(\"Nice Shot!, your arrow goes straight through the \" + enemy.name + \"'s heart\");\n enemy.health == 0;\n }\n else if(hit >= 50 && inventory.bow == true)\n {\n alert(\"You manage to hit the \" + enemy.name + \" in the leg!\");\n enemy.health --;\n enemy.stun = true;\n }\n else if(inventory.bow == false)\n {\n alert(\"You don't have a Bow!\");\n }\n else\n {\n alert(\"Almost instantly, the \" + enemy.name + \" manages to dodge your arrow!\");\n }\n break;\n case'fist':\n case'attack with fist':\n case'attack fist':\n case'nothing':\n case'attack with nothing':\n if(hit >= 50)\n {\n alert(\"You somehow manage to punch the \" + enemy.name +\"!\")\n }\n else\n {\n alert(\"You're careless unarmed attack is easily countered by \" + enemy.name + \"!\");\n playerStatus.health--;\n }\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t\t\n \n }\n break;\n case'sword':\n case'attack sword':\n case'attack with sword':\n if(hit >= 20 || enemy.stun == true)\n {\n alert(\"You easily stab your sword through the \" + enemy.name + \"!\");\n enemy.health -=2;\n }\n else\n {\n alert(\"The \" + enemy.name + \" is faster than you thought, he manges to dodge your sword swipe!\");\n }\n break;\n case'dagger':\n case'attack dagger':\n case'attack with dagger':\n if(hit >= 30 && inventory.sword == true)\n {\n alert(\"You manage to slash the \" + enemy.name + \" with your dagger.\");\n enemy.health --;\n }\n else if(inventory.sword == false)\n {\n alert(\"You don't have a sword!\"); \n }\n else\n {\n alert(\"The \" + enemy.name + \" jumps away before you can hit it!\");\n }\n break;\n case'bow':\n case'attack bow':\n case'attack with bow':\n if(hit <= 30 && inventory.bow == true)\n {\n alert(\"Nice Shot!, your arrow goes straight through the \" + enemy.name + \"'s heart\");\n enemy.health == 0;\n }\n else if(hit >= 50 && inventory.bow == true)\n {\n alert(\"You manage to hit the \" + enemy.name + \" in the leg!\");\n enemy.health --;\n enemy.stun = true;\n }\n else if(inventory.bow == false)\n {\n alert(\"You don't have a Bow!\");\n }\n else\n {\n alert(\"Almost instantly, the \" + enemy.name + \" manages to dodge your arrow!\");\n }\n break;\n case'run':\n case'run away':\n if(hit <= 50)\n {\n alert(\"You manage to run away, all the way back to the Town Square!\");\n playerStatus.energy --;\n TownSquare();\n }\n else\n {\n alert(\"You try your best to get away, but you can't lose the \" + enemy.name + \". You can see the town but decide it is better to not lead the enemy into town.\");\n }\n break;\n case'defend':\n case'block':\n if(inventory.shield == 'none')\n {\n if(hit >= 60)\n {\n alert(\"Even without a shield, you still manage to fend off the \" + enemy.name + \"'s attack\");\n enemy.stun == true;\n \n }\n else\n {\n alert(\"Without a shield, you can't do anything to stop the \" + enemy.name + \"'s attack. He manages to scratch your arm\");\n playerStatus.health --;\n enemy.stun == true;\n }\n }\n else\n {\n alert(\"You easily defend against the attack with a shield, and easily stun the \" + enemy.name);\n enemy.stun == true;\n }\n break;\n case'fist':\n case'attack with fist':\n case'attack fist':\n case'nothing':\n case'attack with nothing':\n if(hit >= 50)\n {\n alert(\"You somehow manage to punch the \" + enemy.name + \"!\")\n }\n default:\n alert(\"I don't understand\" + enemyFight );\n }\n if(enemy.stun == false && enemy.health >0)\n {\n enemy.attack();\n }\n else\n {\n alert(\"The enemy is stunned and can't attack!\");\n }\n }\n if(playerStatus.health <= 0)\n {\n alert(\"You suddenly feel really sleepy, You decide to take a permanent nap.\");\n GameOver();\n }\n else\n {\n alert(\"You have defeated the \" + enemy.name);\n victory = true;\n return victory;\n }\n}", "function betray(name){\n attackXY(); \n swingAxe();\n}", "function BossActions(){\r\n\t//move\r\n\tif(!collisionWall(canniLeader, backWall) && theEnd === true){\r\n\t\tsoundEfx[\"CannibalWalk\"].play();\r\n\t\tcanniLeader.animation = \"left\"; \r\n\t\tcanniLeader.frameRate = canniLeader.moveRate;\r\n\t\tcanniLeader.x -= 5;\r\n\t}\r\n\telse if(!collisionWall(canniLeader, endWall) && theEnd === false){\r\n\t\tcanniLeader.x += 5;\r\n\t\tsoundEfx[\"CannibalWalk\"].play();\r\n\t\tcanniLeader.animation = \"right\";\r\n\t\tcanniLeader.frameRate = -canniLeader.moveRate;\r\n\t}\r\n\telse soundEfx[\"CannibalWalk\"].pause();\r\n\t//boss defeated\r\n\tif(collisionBoss() && hiding !== true){\r\n\t\thealthHunger[\"Health\"].width = 0;\r\n\t}\r\n\t//hit the wall\r\n\tif(collisionWall(canniLeader, backWall)){\r\n\t\t\ttheEnd = false;\r\n\t}\r\n\telse if(collisionWall(canniLeader, endWall)){\r\n\t\t\ttheEnd = true;\r\n\t}\r\n}", "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 }", "function timeTick() {\t\n\tif (messagetime != 0) {\n\t\tmessagetime--;\n\t}else{\n\t\tdocument.getElementById(\"fightmess\").innerHTML = \"\";\n\t}\n\tif (manualmessagetime != 0) {\n\t\tmanualmessagetime--;\n\t}else{\n\t\tdocument.getElementById(\"action\").innerHTML = \"&nbsp; <br> &nbsp;\";\n\t}\n\tif (deadmonsterflag == false){\n\t\tcalculatePower();\n\t\tif (power > 0)\n\t\t\tfightmonster();\t\t\t\n\t} else { power = 0; }\n\tupdatesaves();\n\tprintall();\t\n\tsetupHeroes();\n \ttickCount++;\t\t\n}", "function fight () {\n var id = setInterval(\n () => {\n if (Jug1.life > 0 && Jug2.life > 0) {\n let num = Math.round(Math.random()*10)\n let move = document.getElementById(\"move\")\n\n if (num > 5){\n move.classList.remove(\"ataque\")\n move.classList.remove(\"defensa\")\n Jug1.drinkColacao();\n let power = document.getElementById(\"power1\")\n let width = power.style.width.slice(0, -1)\n let num = parseFloat(width)\n let num2 = num + 10;\n let string = num2.toString()\n power.style.width = string + \"%\";\n defend()\n winner()\n } else {\n move.classList.remove(\"defensa\")\n move.classList.remove(\"ataque\")\n Jug2.getDefend(Jug1.getAttack());\n let life2 = document.getElementById(\"life2\")\n let width = life2.style.width.slice(0, -1)\n let num = parseFloat(width)\n let num2 = num - Jug1.power;\n let string = num2.toString()\n life2.style.width = string + \"%\";\n attack()\n winner()\n }\n } else {\n clearInterval(id)\n\n }}, 2500\n )\n\n var id2 = setInterval(\n () => {\n if (Jug1.life > 0 && Jug2.life > 0){\n let num = Math.round(Math.random()*10)\n let move = document.getElementById(\"move2\")\n \n if (num > 5){\n move.classList.remove(\"defensa\")\n move.classList.remove(\"ataque2\")\n Jug2.drinkNesquik(); \n let life2 = document.getElementById(\"life2\")\n let width = life2.style.width.slice(0, -1)\n let num = parseFloat(width)\n let num2 = num + 10;\n let string = num2.toString()\n life2.style.width = string + \"%\";\n defend2()\n winner()\n } else {\n move.classList.remove(\"defensa\")\n move.classList.remove(\"ataque2\")\n Jug1.getDefend(Jug2.getAttack());\n let life1 = document.getElementById(\"life1\")\n let width = life1.style.width.slice(0, -1)\n let num = parseFloat(width)\n let num2 = num - Jug2.power;\n let string = num2.toString()\n life1.style.width = string + \"%\";\n attack2()\n winner()\n }\n } else {\n clearInterval(id2)\n }\n console.log(Jug1);\n console.log(Jug2);\n }, 2500\n )\n}", "attack (enemy) {\n\n this.moraleBuff ();\n\n var atkRoll = this.atk * Math.random();\n var defRoll = enemy.def * Math.random();\n var dmg = (atkRoll - defRoll);\n\n if (dmg > 0) {\n var rndDmg = Math.floor(dmg);\n window.socket.emit('attack', rndDmg);\n this.armyMorale(3);\n enemy.takeDmg(rndDmg);\n return 1;\n\n } else {\n window.socket.emit('attackMiss');\n console.log('Swing and a miss, morale bar will not change');\n return 0;\n }\n // enemy.troops -= 100;\n\n }", "function turn(atkType) {\n console.log(\"Kachow\");\n let coinFlip = Math.floor(Math.random() * 2);\n if (coinFlip === 0) {\n character1.attack(character2, atkType);\n //display the messages set to console.log in the atk function in the message space.\n if (character2.hp === 0) {\n endGame();\n }\n character2.attack(character1, atkType);\n //display the messages set to console.log in the atk function in the message space.\n if (character1.hp === 0) {\n endGame();\n }\n } else {\n character2.attack(character1, atkType);\n //display the messages set to console.log in the atk function in the message space.\n if (character1.hp === 0) {\n endGame();\n }\n character1.attack(character2, atkType);\n //display the messages set to console.log in the atk function in the message space.\n if (character2.hp === 0) {\n endGame();\n }\n }\n return;\n }", "function fight(perso1, perso2, perso_actuel) \n{\n\t// déclaration des perso\n \tif (perso_actuel === perso1) \n\t{\n \tthis.cible = perso2;\n \t} \n\telse if (perso_actuel === perso2) \n\t{\n\t\tthis.cible = perso1;\n\t}\n \t// variable choix => 2 choix possibles = attaquer ou défendre\n \tlet choix;\n \twhile (this.cible.sante > 0 && perso_actuel.sante > 0)\n\t{\n\t\t// boucle qui test les points de vie des persos 1 et 2\n\t \tlet choix = prompt(perso_actuel.nom + \" : Pressez 1 pour attaquer ou 2 pour défendre : \");\n\t \t// déroulement de l' attaque\n\t \tfunction attaquer()\n\t\t{\n\t\t\t// posture de la cible\n\t\t\tif (perso_actuel.posture == 1) \n\t\t\t{\n\t\t\t\tthis.cible.degat = this.cible.degat * 2;\n\t\t\t\tperso_actuel.posture = 0;\n\t\t\t}\n\t\t\tif (this.cible.sante > 0) \n\t\t\t{\n\t\t\t\t// la cible à des points de vie\n\t\t\t\talert(perso_actuel.nom + \" attaque \" + this.cible.nom + \" et lui fait \" + perso_actuel.degat + \" points de dégâts\");\n\t\t\t\tthis.cible.sante = this.cible.sante - perso_actuel.degat; \n\t\t\t\t// les points de vie de la cible sont diminué de la valeur des dégâts de l'arme\n\t\t\t\tif (this.cible.sante > 0) \n\t\t\t\t{\n\t\t\t\t\t// gérer ici le changement de perso\n\t\t\t\t\talert(this.cible.nom + \" a encore \" + this.cible.sante + \" points de vie\");\n\t\t\t\t} \n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\tthis.cible.sante = 0; // si la cible n'a plus de point de vie\n\t\t\t\t\talert(this.cible.nom + \" est mort !\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.cible.sante <= 0) \n\t\t\t{ \n\t\t\t\t// permet de recommencer la partie\n\t\t\t\talert(this.cible.nom + \" ne peut pas attaquer : il est mort! La partie est terminé. Pour rejouer rafraîchissez la page !\"); \n\t\t\t}\n\t\t\tperso_actuel.updateInfo();\n\t\t};\n \t// déroulement de la défense\n \tfunction defendre() \n\t\t{\n\t\t\t// posture de notre perso\n\t\t\tif (perso_actuel.posture == 0) \n\t\t\t{\n\t\t\t\t// si notre perso est en posture d' attaque\n\t\t\t\tperso_actuel.posture = 1; // on la passe en posture de défense\n\t\t\t\tthis.cible.degat = this.cible.degat / 2; // les dégats de la cible sont divisé par 2\n\t\t\t\talert(perso_actuel.nom + \" passe en posture défensif, les dégats de \" + this.cible.nom + \" sont réduit de 50%.\")\n\t\t\t\t//console.log(this.cible.degat);\n\t\t\t\tperso_actuel.updateInfo();\n\t\t\t}\n \t};\n\t\tif (choix == 1) \n\t\t{\n\t\t\t// si choix 1 on attaque\n\t\t\tattaquer();\n\t\t}\n\t\tif (choix == 2) \n\t\t{ \n\t\t\t// si choix 2 on défend\n\t\t\tdefendre();\n\t\t}\n\t\t// intervertir les 2 variables\n\t\t[perso_actuel, this.cible] = [this.cible, perso_actuel]\n\t\t//console.log(perso_actuel);\n\t\t//console.log(\"Alien PV \" + perso1.sante + \" \" + \"Predator PV \" + perso2.sante)\n\t};\n \tperso_actuel.updateInfo();\n}", "function attackDefender(){\n\tif(yourCharacter.characterHealth>0 && enmChr.characterHealth>0){\n\t\tvar yourDamage = Math.ceil(Math.random()*(yourCharacter.characterHealth/20));\n\t\tvar enmDamage = Math.ceil(Math.random()*(enmChr.characterHealth/4));\n\t\tyourCharacter.characterHealth -= yourDamage;\n\t\tenmChr.characterHealth -= enmDamage;\n\t\t$(\".myDefender\").text(enmChr.characterName);\n\t\t$(\"#defDamage\").text(enmDamage);\n\t\t$(\"#atkDamage\").text(yourDamage);\n\n\t\tvar $yourCharacter = $(\"#yourCharacter\").find(\".yourChrStyle\")\n\t\t\t\t\t\t\t\t\t\t\t\t.find(\":nth-child(3)\");\n\n\t\tvar $defenderChr = $(\"#defender\").find(\".defenderStyle\")\n\t\t\t\t\t\t\t\t\t\t\t\t.find(\":nth-child(3)\");\n\n\t\t$yourCharacter.text(yourCharacter.characterHealth);\n\t\t$defenderChr.text(enmChr.characterHealth);\n\t\tnew Audio('assets/sounds/attackSound.mp3').play();\n\n\t\t//Condition to check whether current game ends or is still played on\n\t\tif(enmChr.characterHealth<=0 && enemiesAvailableLength > 0 && yourCharacter.characterHealth > 0) {\n\t\t\tgameStatus = PLAYER_TO_SELECT_DEFENDER;\n\t\t\t$(\"#defender\").empty();\n\t\t\t$(\"#attackSumm\").removeClass(\"attackStatusDisp\");\n\t\t\t$(\"#attackSumm\").addClass(\"attackStatus\");\n\n\t\t\t$(\".myDefender\").text(\"\");\n\t\t\t$(\"#defDamage\").text(\"\");\n\t\t\t$(\"#atkDamage\").text(\"\");\n\n\t\t}else if(yourCharacter.characterHealth<=0){\n\t\t\tgameStatus = YOU_LOSE;\n\t\t\tgameOver();\n\t\t}else if(enmChr.characterHealth<=0 && enemiesAvailableLength == 0 && yourCharacter.characterHealth > 0){\n\t\t\tgameStatus = YOU_WIN;\n\t\t\tgameOver();\n\t\t}\n\t}\n}", "function subtractHealth() {\n fighterObj.health = fighterObj.health - enemyObj.counterAttack;\n enemyObj.health = enemyObj.health - fighterObj.attackNew;\n fighterObj.attackNew = fighterObj.attackNew + fighterObj.attack;\n\n\n\n\n\n if (fighterObj.health <= 0) {\n $(\".info-pop-up-text\").text(enemyObj.name + \" killed you!\");\n $(\"#resetLoose\").css(\"display\", \"block\");\n $(\".info-pop-up\").css(\"display\", \"flex\");\n\n\n }\n\n if (enemyObj.health <= 0) {\n $(\".enemy-display\").empty();\n $(\".info-pop-up-text\").text(enemyObj.name + \" is dead! Pick your next enemy!\");\n $(\".info-pop-up\").css(\"display\", \"flex\");\n $(\".resetWin\").css(\"display\", \"none\");\n setTimeout(function () {\n $(\".info-pop-up\").css(\"display\", \"none\");\n\n }, 2500);\n\n $(\".enemyDisplay\").empty();\n enemyChosen = false;\n defeatedFighters.push(enemyObj);\n }\n\n if (defeatedFighters.length == 3) {\n $(\".info-pop-up-text\").css(\"color\", \"red\");\n $(\".ultimate-win\").css(\"display\", \"flex\");\n $(\".info-pop-up\").css(\"display\", \"none\");\n $(\".ultimate-win-text\").text(\" You are the supreme winner\");\n $(\".resetWin\").css(\"display\", \"flex\");\n\n }\n }", "attack(input){\n print(\"astral cage!\")\n let w = Vars.world.tiles.width*8\n let h = Vars.world.tiles.height*8\n sfx.barrierflash.at(input.x,input.y)\n effects.astralBarrier.at(input.x,input.y)\n Time.run(30, () => {\n Geometry.iterateLine(0,0,0,0,h,40,(x, y) => {\n effects.astralMarker.at(x, y, 0, {x: w, y:y})\n Time.run(30, () => {\n effects.astralCage.at(x, y, 0, {x: w, y:y})\n Sounds.laserblast.at(Vars.player.x,Vars.player.y)\n });\n })\n Geometry.iterateLine(0,0,0,w,0,40,(x, y) => {\n effects.astralMarker.at(x, y, 0, {x: x, y:h})\n Time.run(90, () => {\n effects.astralCage.at(x, y, 0, {x: x, y:h})\n Sounds.laserblast.at(Vars.player.x,Vars.player.y)\n });\n })\n });\n }", "function triggerEnemyAttack () {\n // a new function is called setTimeout is declared in order to create a pause\n // after the user clicks their chosen attack method. \n // an if statement is used with a native js math code that spits out a random number.\n // I am not sure at all how this function works but it basically reads... If the random\n // number * 10 > 6 then it will run the enemy predefined special Attack and will apply\n // the damages to the human player.\n // IF the special attack is run then the computer will show \"enemy special attack\" because\n // jQuery is using .html to print the text in it's given parameter to the the status div. \n setTimeout(function(){\n if (Math.floor(Math.random() * 10 ) > 6){\n enemy.specialAttack(player); \n $('.status').html('Enemy special attack!')\n // if the random answer to the problem above is actually less than 6 than the computer will\n // run the else statement which will use the primary attack instead and use the same \n // .html trigger thingy to print its content to its related div, status. \n } else {\n enemy.primaryAttack(player); \n $('.status').html('Enemy attack!')\n }\n // after the above code is run, the player info will render. This was defined up above and is just\n // being used over and over. \n // the ,2000 = 2seconds and is native js code. It is placed almost outside verything else in this function\n // but before the last curly brace so that the timing delay applies to the whole enemy attack.\n renderPlayerInfo(player);\n renderEnemyInfo(enemy);\n }, 2000)\n}", "function StartFishing() {\n\n DebugStart()\n // How far to look for trees from the player\n var range = 16;\n AutoFisherman(range);\n}", "function setdmg1(maxhit) //Prevents additional action if hp2 is 0\n{\n //document.getElementById(\"test\").innerHTML=\"\";\n if (hp1 != 0)\n {\n elem=document.getElementById(\"player1\");\n var rand = Math.floor(Math.random()*(maxhit+1));\n var chance = Math.floor(Math.random()*(monsterAccuracyLevel-1));\n if (chance == 0) rand = 0;\n if (monsterAbbreviation == \"nope\" && protectedpray) rand = 0; \n else if (monsterAbbreviation == \"nope\" && attackcount == 6 && phase == 3) { //Araxxor phase 3 swipe\n\trand = 25 + Math.floor(Math.random()*21);\n\tattackcount = 0;\n }\n else if (monsterAbbreviation == \"nope\" && attackcount >= 6 && attackcount < 9 && phase == 1) { //Araxxor phase 1 web\n\tif (reflected == 0) {\n\t\thp2+=15;\n\t\tif (hp2 > 1000) hp2 = 1000;\n\t\t$(\"#greenhp2\").css({\"width\": (hp2*monsterHPbarDRAINAGE)});\n\t}\n\trand = reflected;\n\tif (attackcount == 8) {\n\t\tmonsterDefenceRank = 2.5;\n\t}\n }\n else if (monsterAbbreviation == \"nope\" && attackcount >= 13 && phase == 1) { //Araxxor phase 1 cacoon\n\tif (prayer == \"mage\" && attackcount == 13) protectcacoon = true; //I wouldn't reach this else if condition if I use protectedpray bool\n\t//if (protectcacoon == false) rand = 20; //Old implementation\n\t//else rand = 10;\n\trand = 20;\n\tif (attackcount == 15) {\n\t\tprotectcacoon = false;\n\t\tnotfrozen = true;\n\t\tplayer1frozen.src=\"gifs/invisible.gif\"; \n\t\tattackcount = 0;\n\t}\n }\n else if (mageatk && monsterAbbreviation == \"ogre\") {\n\t rand = 5;\n\t mageatk = false;\n\t monsterDefenceRank = 3;\n\t if (stopcount == 0) {\n\t\t $(\"#msg\").css({\"opacity\": defaultopacity});\n\t\t document.getElementById(\"msg\").innerHTML=\"Your accuracy has been weakened by the ice.\"; \n\t\t gamemsg = setInterval(function () {\n\t\t\t defaultopacity -= 0.002;\n\t\t\t if (defaultopacity < -100) defaultopacity = 0; //To prevent non-stop decrementation\n\t\t\t $(\"#msg\").css({\"opacity\": defaultopacity});\n\t\t }, 10);\t\n\t stopcount++;\n\t }\n }\n else if (monsterAbbreviation == \"jad\") { \n\t if (protectedpray && jadhardmode != \"Normal\") rand = Math.round(rand/2);\n\t else if (protectedpray) rand = 0;\n\t if (!protectedpray && jadhardmode == \"Hard\") rand = 50 + Math.round(rand*0.48);\n\t if (!protectedpray && jadhardmode == \"Impossible\") rand = 97;\n\t if (protectedpray && jadhardmode == \"Impossible\" && rand < 20) rand += 30;\n }\n else if (monsterAbbreviation == \"brid\") { \n\t if (protectedpray) rand = 0;\n }\n else if (monsterAbbreviation == \"ele\") {\n\t monsterDefenceRank -= 0.01;\n\t monsterAccuracyLevel += 0.01;\n }\n if (rand >= hp1) //Sets what rand is based on hp1\n {\n rand = hp1;\n if (hp1 == 0)//Prevents additional 0s that randomly appear\n {\n rand = null;\n }\n }\n hp1 = hp1 - rand; //This line is the reason why \"if (hp1==0)\" appears twice\n\t\tif (monsterAbbreviation == \"drag\") {\n\t\t\tchance2 = Math.floor(Math.random()*100);\n\t\t\tif (chance2 % 2 == 0) {attackGIFname = \"atk\";}\n\t\t\telse {attackGIFname = \"atk2\";}\n\t\t}\n\t\tif (monsterAbbreviation == \"brid\") {\n\t\t\tif (attackcount <= 5) {\n\t\t\t\tif (attackGIFname == \"atk2\") {attackGIFname = \"atk\"; magerangeatk = \"range\";}\n\t\t\t\telse if (attackGIFname == \"atk\") {attackGIFname = \"atk2\"; magerangeatk = \"mage\";}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tchance2 = Math.floor(Math.random()*100);\n\t\t\t\tif (chance2 % 2 == 0) {attackGIFname = \"atk\"; magerangeatk = \"range\";} \n\t\t\t\telse {attackGIFname = \"atk2\"; magerangeatk = \"mage\";}\n\t\t\t}\n\t\t\tattackcount++;\n\t\t\tif (attackcount == 10) attackcount = 0;\n\t\t}\n\t\telse if (monsterAbbreviation == \"jad\") {\n\t\t\tchance2 = Math.floor(Math.random()*100);\n\t\t\tif (chance2 % 2 == 0) {attackGIFname = \"atk\"; magerangeatk = \"mage\";}\n\t\t\telse {attackGIFname = \"atk2\"; magerangeatk = \"range\"; }\n\t\t}\n\t\telse if (monsterAbbreviation == \"nope\") {\n\t\t\tchance2 = Math.floor(Math.random()*100);\n\t\t\tif (attackcount == 5 && phase == 3) { //Araxxor mechanic checks for protectedpray so magerangeatk is needed\n\t\t\t\tattackGIFname = \"swipe\"; magerangeatk = \"melee\";\n\t\t\t}\n\t\t\telse if (attackcount == 5 && phase == 1) { \n\t\t\t\tattackGIFname = \"web1\"; magerangeatk = \"reflect\";\n\t\t\t\treflected = 0;\n\t\t\t\tmonsterDefenceRank = 10;\n\t\t\t}\n\t\t\telse if (attackcount == 6 && phase == 1) { \n\t\t\t\tattackGIFname = \"web2\"; \n\t\t\t}\n\t\t\telse if (attackcount == 7 && phase == 1) { \n\t\t\t\tattackGIFname = \"web3\"; \n\t\t\t}\n\t\t\telse if (attackcount == 12 && phase == 1) { \n\t\t\t\tstopatk1();\n\t\t\t\tstopdmg1();\n\t\t\t\tnotfrozen = false;\n\t\t\t\tmagerangeatk = \"bleed\";\n\t\t\t\tattackGIFname = \"cacoon1\";\t\t\n\t\t\t\tplayer1frozen=document.getElementById(\"player1frozen\");\n\t\t\t\tsetTimeout(function () \n\t\t\t\t{ \n\t\t\t\t\tplayer1frozen.src=\"gifs/cacoon.png\"\n\t\t\t\t}, 1000);\n\t\t\t}\n\t\t\telse if (attackcount == 13 && phase == 1) { \n\t\t\t\tattackGIFname = \"cacoon2\"; \n\t\t\t\tif (protectcacoon == true) attackcount++; //New implementation makes cacoon hit 2x instead of 3x if protected\n\t\t\t}\n\t\t\telse if (attackcount == 14 && phase == 1) { \n\t\t\t\tattackGIFname = \"cacoon3\"; \n\t\t\t}\n\t\t\telse if (phase >= 2) {\n\t\t\t\tif (chance2 % 2 == 0) {attackGIFname = \"atk3\"; magerangeatk = \"melee\";}\n\t\t\t\telse {attackGIFname = \"atk4\"; magerangeatk = \"range\"; }\t\n\t\t\t}\n\t\t\telse if (chance2 % 2 == 0) {attackGIFname = \"atk\"; magerangeatk = \"melee\";}\n\t\t\telse {attackGIFname = \"atk2\"; magerangeatk = \"range\"; }\n\t\t\tif (phase == 3 || phase == 1) attackcount++;\n\t\t}\n\t\telse if (monsterAbbreviation == \"ogre\") {\n\t\t\tchance2 = Math.floor(Math.random()*100);\n\t\t\tif (chance2 % 2 == 0) {\n\t\t\t\tif (prayer != \"mage\") { //Using protectedpray code mechanic works too, but no need (too much work for this monster)\n\t\t\t\t\tstopatk1();\n\t\t\t\t\tstopdmg1();\n\t\t\t\t\tnotfrozen = false;\n\t\t\t\t\tmageatk = true;\n\t\t\t\t\tattackGIFname = \"atk2\"; //Same as stand animation, but stand is used in other code so using it here will cause disruptions\n\t\t\t\t\tif (typeof(freezeanimation) != 'undefined') clearInterval(freezeanimation);\n\t\t\t\t\ticeopacity = 0;\n\t\t\t\t\topacityone = false;\n\t\t\t\t\tfreezeanimation = setInterval(function () {\n\t\t\t\t\t\tplayer1frozen=document.getElementById(\"player1frozen\");\n\t\t\t\t\t\tplayer1frozen.src=\"gifs/barrage.png\"\n\t\t\t\t\t\tif (opacityone) iceopacity -= 0.005;\n\t\t\t\t\t\telse iceopacity += 0.005;\n\t\t\t\t\t\tif (iceopacity > 1) opacityone = true;\n\t\t\t\t\t\tif (iceopacity < -100) iceopacity = 0; //To prevent non-stop decrementation \n\t\t\t\t\t\t$(\"#player1frozen\").css({\"opacity\": iceopacity});\n\t\t\t\t\t}, 10);\t\t\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tnotfrozen = true;\n\t\t\t\t\tattackGIFname = \"atk\";\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tnotfrozen = true;\n\t\t\t\tattackGIFname = \"atk\";\n\t\t\t}\n\t\t}\n\t\telse attackGIFname = \"atk\";\t \t\n\t\telem3=document.getElementById(\"player2\");\n\t\telem3.src=\"gifs/\" + monsterAbbreviation + attackGIFname +\".gif\";\n if (hp1 == 0) //Prevents eating when dead\n {\n\twon = false;\n if (monsterAbbreviation == \"me\") player1killpoints = 0;\n\tdocument.getElementById(\"killsPVM\").innerHTML=player1killpoints;\n player2kills += 1;\n\tdocument.getElementById(\"deathsPVM\").innerHTML=player2kills; \n stopatk1();\n\tstopatk2();\n\tsetTimeout(function () \n\t{\n\tstopdmg1(); \n\tstopdmg2();\t\n\t}, 1);\n\t$(\".item1\").css({\"display\": \"none\"}); \t\t\t\t\t\t\t \n document.getElementById(\"player2\").removeAttribute(\"onclick\");\t\t\n\tallowattack = false;\n setTimeout(function () \n { \n\t $(\"#hphp1\").css({\"display\": \"none\"});\n elem.src=\"gifs/rangedeath.gif\";\t\n }, 3000);\n\t setTimeout(function () \n { \n\t player1frozen=document.getElementById(\"player1frozen\"); \n\t player1frozen.src=\"gifs/invisible.gif\";\n\t elem.src=\"gifs/youlose.gif\"; \n\t $(\"#restart\").css({\"visibility\": \"visible\"});\n }, 5000);\n }\n document.getElementById(\"hpcount1\").innerHTML=hp1;//Note: Always make sure that the logic is correct before outputting\n $(\"#redhp1\").css({\"height\": 50 - hp1/2}); \n $(\"#hitsplat1\").css({\"visibility\": \"visible\"});\n if (rand == 0) \n {\n $(\"#hitsplat1\").css({\"background-image\": \"url('images/dmg0.gif')\"});\n $(\".singledigitdmg1\").css({\"display\": \"none\"});\n $(\".leftsplathalf1\").css({\"display\": \"none\"});\n $(\".rightsplathalf1\").css({\"display\": \"none\"});\n } \n else {$(\"#hitsplat1\").css({\"background-image\": \"url('images/dmg.gif')\"});}//The else must be there for damages to not stay blue\n if (rand < 10 && rand > 0) //Single digit damage number\n { //dmg#-width,0-6,1-4,2-6,3-5,4-5,5-5,6-6,7-5,8-6,9-6,\n $(\".leftsplathalf1\").css({\"display\": \"none\"});\n $(\".rightsplathalf1\").css({\"display\": \"none\"}); \n if (rand == 0 || rand == 2 || rand == 6 || rand == 8 || rand == 9)\n {\n $(\".singledigitdmg1\").attr(\"width\", \"6\"); //Adjusting the gif width of the single digit number\n $(\".singledigitdmg1\").css({\"margin-left\": \"9px\"}); //Adjusting the position of the single digit number\n }\n else if (rand == 3 || rand == 4 || rand == 5 || rand == 7)\n {\n $(\".singledigitdmg1\").attr(\"width\", \"5\");\n $(\".singledigitdmg1\").css({\"margin-left\": \"9.5px\"});\n }\n else \n {\n $(\".singledigitdmg1\").attr(\"width\", \"4\");\n $(\".singledigitdmg1\").css({\"margin-left\": \"10px\"});\n }\n $(\".singledigitdmg1\").css({\"display\": \"\"});\n $(\".singledigitdmg1\").attr(\"src\", \"images/\" + rand + \".gif\");\n }\n else if (rand >= 10)\n {//dmg#-width,0-6,1-4,2-6,3-5,4-5,5-5,6-6,7-5,8-6,9-6,\n leftdigit = Math.floor(rand / 10); //Split 2 digit damages to a left number and right number\n rightdigit = rand % 10;\n $(\".singledigitdmg1\").css({\"display\": \"none\"});\n if (leftdigit == 0 || leftdigit == 2 || leftdigit == 6 || leftdigit == 8 || leftdigit == 9) //Adjusting the gif width of the number\n {$(\".leftsplathalf1\").attr(\"width\", \"6\");}\n else if (leftdigit == 3 || leftdigit == 4 || leftdigit == 5 || leftdigit == 7)\n {$(\".leftsplathalf1\").attr(\"width\", \"5\");}\n else {$(\".leftsplathalf1\").attr(\"width\", \"4\");}\n if (rightdigit == 0 || rightdigit == 2 || rightdigit == 6 || rightdigit == 8 || rightdigit == 9)\n {$(\".rightsplathalf1\").attr(\"width\", \"6\");}\n else if (rightdigit == 3 || rightdigit == 4 || rightdigit == 5 || rightdigit == 7)\n {$(\".rightsplathalf1\").attr(\"width\", \"5\");}\n else {$(\".rightsplathalf1\").attr(\"width\", \"4\");}\n $(\".leftsplathalf1\").css({\"display\": \"\"});\n $(\".leftsplathalf1\").attr(\"src\", \"images/\" + leftdigit + \".gif\");\n $(\".rightsplathalf1\").css({\"display\": \"\"}); \n $(\".rightsplathalf1\").attr(\"src\", \"images/\" + rightdigit + \".gif\");\n }\n $(\"#greenhp1\").css({\"width\": (hp1*10/33)});\n if (monsterTime > 2000) \n {\n\t setTimeout(function () //Commented out because hits are too fast\n\t { \n\t\t\t$(\".singledigitdmg1\").css({\"display\": \"none\"});\n\t\t\t$(\".leftsplathalf1\").css({\"display\": \"none\"});\n\t\t\t$(\".rightsplathalf1\").css({\"display\": \"none\"});\n\t\t\t$(\"#hitsplat1\").css({\"visibility\": \"hidden\"});\n\t }, 2000);\n }\n }\n}", "bhv_flank() {\n if (this.bhv_time == 1) {\n console.log(\"flank\");\n this.dash_dist = Math.abs(this.pos[0] - playerInstance.pos[0]);\n }\n this.accel = this.dash_dist * 0.03;\n\n\n if (this.bhv_time >= 17) {\n this.behavior = this.bhv_normal;\n this.bhv_time = Math.floor( 31 + Math.random() * 10 );\n }\n }", "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}" ]
[ "0.7551381", "0.7526175", "0.7301798", "0.7214418", "0.7212308", "0.7207419", "0.71878284", "0.71682334", "0.7104167", "0.70825624", "0.70531666", "0.70528215", "0.7044688", "0.70057124", "0.69881123", "0.69550425", "0.69237685", "0.69204074", "0.6885222", "0.6883091", "0.6820775", "0.6792312", "0.6790285", "0.678166", "0.67688113", "0.67505336", "0.67502683", "0.6738545", "0.6728151", "0.6723525", "0.6696839", "0.66789585", "0.6678398", "0.6677286", "0.66757387", "0.66710156", "0.6666152", "0.66563433", "0.6647867", "0.66408694", "0.6639438", "0.66320395", "0.66277856", "0.6578441", "0.6540883", "0.6536935", "0.65360945", "0.65355116", "0.653465", "0.65075684", "0.65008885", "0.64945", "0.6486331", "0.6470007", "0.64587617", "0.6456106", "0.64524937", "0.6443356", "0.64413345", "0.64371413", "0.64058346", "0.6400753", "0.6395927", "0.63948244", "0.6391187", "0.63794243", "0.63777095", "0.6369501", "0.6368792", "0.63564396", "0.6354617", "0.6353555", "0.6347515", "0.63216865", "0.6312771", "0.62943184", "0.6279738", "0.6273164", "0.6272316", "0.6256251", "0.62467206", "0.6239863", "0.62392557", "0.62250876", "0.6220635", "0.62163925", "0.6209739", "0.620938", "0.62006605", "0.6199958", "0.6192827", "0.618866", "0.6187987", "0.61865354", "0.61860716", "0.6185007", "0.61843896", "0.6183949", "0.61766565", "0.617458", "0.6173497" ]
0.0
-1
This is where the winnerCheck function begins
function winnerCheck(){ console.log("in winnerCheck function"); var result = "no winner yet"; if (players[0].health < 1 && players[1].health < 1) { result="Draw"; } else if (players[0].health < 1) { result = players[1].name + " Wins!!!"; } else if (players[1].health < 1) { result = players[0].name + " Wins!!!"; } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "check_winner() {\n //check all horizontal\n let player_won = false;\n let winner;\n let where_string;\n if (this.check_winner_row(0)) {\n player_won = true;\n winner = this.board_spaces[0].get_top();\n where_string = 'on row 1';\n } else if (this.check_winner_row(4)) {\n player_won = true;\n winner = this.board_spaces[4].get_top();\n where_string = 'on row 2';\n } else if (this.check_winner_row(8)) {\n player_won = true;\n winner = this.board_spaces[8].get_top();\n where_string = 'on row 3';\n } else if (this.check_winner_row(12)) {\n player_won = true;\n winner = this.board_spaces[12].get_top();\n where_string = 'on row 4';\n }\n //check all vertical\n else if (this.check_winner_column(0)) {\n player_won = true;\n winner = this.board_spaces[0].get_top();\n where_string = 'on column 1';\n } else if (this.check_winner_column(1)) {\n player_won = true;\n winner = this.board_spaces[1].get_top();\n where_string = 'on column 2';\n } else if (this.check_winner_column(2)) {\n player_won = true;\n winner = this.board_spaces[2].get_top();\n where_string = 'on column 3';\n } else if (this.check_winner_column(3)) {\n player_won = true;\n winner = this.board_spaces[3].get_top();\n where_string = 'on column 4';\n }\n //check diagonals\n else if (this.check_winner_diagonal_left(0)) {\n player_won = true;\n winner = this.board_spaces[0].get_top();\n where_string = 'on the top left diagonal';\n } else if (this.check_winner_diagonal_right(3)) {\n player_won = true;\n winner = this.board_spaces[3].get_top();\n where_string = 'on the top right diagonal';\n }\n if (player_won) {\n alert(`Player ${winner} won ${where_string}`)\n }\n }", "function check_winner(){ //NOT FUNCTIONING YET //see if there's a winner\n\tconsole.log(\"check winner run\"); \n\tconsole.log('value of i is _'+ i);\n\tfor(var i = 0; i < win_options.length; i++){\n\t\tfor(var j=0; j <win_options[i].length; j++){\n\t\n\t\t\tif(player_clicks[win_options[i][0]]==player_clicks[win_options[i][1]]\n\t\t\t\t&&\n\t\t\t\tplayer_clicks[win_options[i][1]]==player_clicks[win_options[i][2]]){\n\t\t\t\twin_confirmation();\n\t\t\t\twinner_found = 1;\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t}\n\t}\n}", "function checkForWinner() {\n\t\t// each click runs checkForWinner function\n\t\tfor (var i = 0; i < winningCombo.length; i++) {\n\t\t\tif (square[winningCombo[i][0]].innerText !== \"\" &&\n\t\t\t\tsquare[winningCombo[i][0]].innerText === square[winningCombo[i][1]].innerText &&\n\t\t\t\tsquare[winningCombo[i][1]].innerText === square[winningCombo[i][2]].innerText) {\n\t\t\t\talert('You won ' + square[winningCombo[i][2]].innerText + \". Great job!\");\n\t\t\t\treturn;\n\t\t\t\twinner = square[winningCombo[i][2]].innerText;\n\t\t\t};\n\t\t}\n\t}", "checkForWinner() {\n if (this.primaryWinConditionsCheck()) {\n this.endGame();\n }\n }", "function winner() {\n let hasWinner = false;\n let playerNumber = -1; // -1 for no winner\n let gameOver = false;\n let gameWinner = \"none\";\n\n if (winnerX()) { //Detect Whether X has won the game\n hasWinner = true;\n playerNumber = 1;\n player1Score++;\n }\n else if (winnerO()) { //Detect Whether X has won the game\n hasWinner = true;\n playerNumber = 2;\n player2Score++;\n }\n //Determine if all cells of the board are filled (Tie)\n else if (allFilled()) {\n hasWinner = \"Tie\";\n playerNumber = \"Tie\";\n }\n else\n hasWinner = false\n\n //Check for gameover\n // -A player has more wins than half the total rounds\n //Add 1 to the score because the value hasn't been updated yet\n if (playerNumber != -1) {\n //If the winner is player 1 or 2, check if the score before and after updating (+1) wins the game\n if (player1Score >= Math.floor((span_bestOf.innerText / 2) + 1)) { //Player 1 has won the game\n gameOver = true;\n }\n else if (player2Score >= Math.floor((span_bestOf.innerText / 2) + 1)) { //Player 2 has won the game\n gameOver = true;\n }\n else if (currentRound >= span_bestOf.innerText) { //The maximum rounds have been reached and the game is tied\n gameOver = true;\n }\n }\n\n if (gameOver) {\n if (player1Score > player2Score)\n gameWinner = \"player 1\";\n else if (player2Score > player1Score)\n gameWinner = \"player 2\";\n else\n gameWinner = \"Tie\";\n }\n\n\n const winnerData = {\n hasWinner,\n playerNumber,\n gameOver,\n gameWinner\n }\n\n return winnerData;\n\n}", "function checkwinner(){\n winner = 0;\n for (check = 0; check < winning.length;check++){\n a = winning[check][0];\n b = winning[check][1];\n c = winning[check][2];\n if ((board[a] == board[b]) &&\n (board[b] == board[c]) &&\n (board[a] != EMPTY)){\n winner = board[a];\n $(\"hr\").removeClass();\n $(\"hr\").addClass(winning[check][3]);\n $('.lines').hide().fadeIn('fast');\n\n\n if (winner == me){$('.winner2').html('I won !Play again?');}\n else {$('.winner2').html('Congratulations! You Won Play again?');}\n $('.winner').hide().fadeIn(3000);\n $('.yesno').hide().fadeIn('fast');\n }\n\n }\n if ((choices.length==0) && (winner ==0)){\n $('hr').removeClass();\n $('.winner').hide().fadeIn(1000);\n $('.yesno').hide().fadeIn('slow');\n $('.winner2').html('It was a draw Play again?');\n }\n }", "function checkWinner() {\n if (winner != e) return;\n for (var i = 0; i < 3; i++)\n if (board[i][0] == board[i][1] && board[i][1] == board[i][2])\n if (board[i][0] != e) winner = currPlayer;\n for (var i = 0; i < 3; i++)\n if (board[0][i] == board[1][i] && board[1][i] == board[2][i])\n if (board[0][i] != e) winner = currPlayer;\n if (board[0][0] == board[1][1] && board[1][1] == board[2][2])\n if (board[0][0] != e) winner = currPlayer;\n if (board[0][2] == board[1][1] && board[1][1] == board[2][0])\n if (board[1][1] != e) winner = currPlayer;\n if (checkFull() && winner == e) winner = tie;\n //print(winner);\n}", "function winner() {\n let p1Count = 0;\n let p2Count = 0;\n let retVal = false;\n\n for (y = 0; y < 8; y++)\n for (x = 0; x < 8; x++) {\n if (board[y][x] == PLAYER1)\n p1Count++;\n if (board[y][x] == PLAYER2)\n p2Count++;\n }\n\n DK_SCORE.value = p1Count;\n LT_SCORE.value = p2Count;\n\n if (boxesTaken > 63) {\n if (p1Count > p2Count)\n PopUpMessage(\"Dark Player won\");\n if (p1Count < p2Count)\n PopUpMessage(\"Light Player won\");\n if (p1Count == p2Count)\n PopUpMessage(\"It's a tie!\");\n retVal = true;\n }\n\n return retVal;\n}", "checker() {\n //assume we have a winner\n this.finish = true;\n\n //worst case: every hand is equal, both decks exhausted, there is no winner\n if(!this.deck1.length && !this.deck2.length) {\n this.winner = 'no winner';\n }\n //if deck1 empty, winner is player2\n else if(!this.deck1.length) {\n this.winner = 'Player 2';\n //if deck2 empty, winner is player1\n } else if(!this.deck2.length) {\n this.winner = 'Player 1';\n } else {\n //continue game\n this.finish = false;\n }\n }", "function CheckWinner(){\n // player X\n // 00 10 20\n if(board[0][0] === players[0] && board[1][0] === players[0] && board[2][0] === players[0]){\n console.log(players[0] + ' WIN !!!')\n createP('X WIN !!')\n game = 'end'\n noLoop()\n }\n // 01 11 21\n else if(board[0][1] === players[0] && board[1][1] === players[0] && board[2][1] === players[0]){\n console.log(players[0] + ' WIN !!!')\n game = 'end'\n createP('X WIN !!')\n noLoop()\n }\n // 02 12 22\n else if(board[0][2] === players[0] && board[1][2] === players[0] && board[2][2] === players[0]){\n console.log(players[0] + ' WIN !!!')\n game = 'end'\n winner = players[0]\n createP('X WIN !!')\n noLoop()\n }\n // 00 01 02\n else if(board[0][0] === players[0] && board[0][1] === players[0] && board[0][2] === players[0]){\n console.log(players[0] + ' WIN !!!')\n createP(player[0],' WIN !!')\n game = 'end'\n winner = players[0]\n createP('X WIN !!')\n noLoop()\n }\n // 10 11 12\n else if(board[1][0] === players[0] && board[1][1] === players[0] && board[1][2] === players[0]){\n console.log(players[0] + ' WIN !!!')\n game = 'end'\n winner = players[0]\n createP('X WIN !!')\n noLoop()\n }\n // 20 21 22\n else if(board[2][0] === players[0] && board[2][1] === players[0] && board[2][2] === players[0]){\n console.log(players[0] + ' WIN !!!')\n game = 'end'\n winner = players[0]\n createP('X WIN !!')\n noLoop()\n }\n // 00 11 22\n else if(board[0][0] === players[0] && board[1][1] === players[0] && board[2][2] === players[0]){\n console.log(players[0] + ' WIN !!!')\n game = 'end'\n winner = players[0]\n createP('X WIN !!')\n noLoop()\n }\n // 20 11 02\n else if(board[2][0] === players[0] && board[1][1] === players[0] && board[0][2] === players[0]){\n console.log(players[0] + ' WIN !!!')\n game = 'end'\n winner = players[0]\n createP('X WIN !!')\n noLoop()\n }\n\n // player O\n // 00 10 20\n if(board[0][0] === players[1] && board[1][0] === players[1] && board[2][0] === players[1]){\n console.log(players[1] + ' WIN !!!')\n game = 'end'\n winner = players[1]\n createP('O WIN !!')\n noLoop()\n }\n // 01 11 21\n else if(board[0][1] === players[1] && board[1][1] === players[1] && board[2][1] === players[1]){\n console.log(players[1] + ' WIN !!!')\n game = 'end'\n winner = players[1]\n createP('O WIN !!')\n noLoop()\n }\n // 02 12 22\n else if(board[0][2] === players[1] && board[1][2] === players[1] && board[2][2] === players[1]){\n console.log(players[1] + ' WIN !!!')\n game = 'end'\n winner = players[1]\n createP('O WIN !!')\n noLoop()\n }\n // 00 01 02\n else if(board[0][0] === players[1] && board[0][1] === players[1] && board[0][2] === players[1]){\n console.log(players[1] + ' WIN !!!')\n game = 'end'\n winner = players[1]\n createP('O WIN !!')\n noLoop()\n }\n // 10 11 12\n else if(board[1][0] === players[1] && board[1][1] === players[1] && board[1][2] === players[1]){\n console.log(players[1] + ' WIN !!!')\n game = 'end'\n winner = players[1]\n createP('O WIN !!')\n noLoop()\n }\n // 20 21 22\n else if(board[2][0] === players[1] && board[2][1] === players[1] && board[2][2] === players[1]){\n console.log(players[1] + ' WIN !!!')\n game = 'end'\n winner = players[1]\n createP('O WIN !!')\n noLoop()\n }\n // 00 11 22\n else if(board[0][0] === players[1] && board[1][1] === players[1] && board[2][2] === players[1]){\n console.log(players[1] + ' WIN !!!')\n game = 'end'\n winner = players[1]\n createP('O WIN !!')\n noLoop()\n }\n // 20 11 02\n else if(board[2][0] === players[1] && board[1][1] === players[1] && board[0][2] === players[1]){\n console.log(players[1] + ' WIN !!!')\n game = 'end'\n winner = players[1]\n createP('O WIN !!')\n noLoop()\n }\n else if(longMatch === 9 && winner === null){\n console.log('DRAW !!!!')\n game = 'end'\n createP('DRAW !!')\n noLoop()\n }\n}", "function getWinner() {\n \n // var token = [\"x\", \"o\"];\n // for (var i = 0; i < tokens.length; i++)\n // var t = tokens[i];\n // var winner_found = false\n // if \n\n // if(t == \"x\") {\n // // player 1 wins, increase p1 score, return\n // } else {\n // //player 2 wins, increase p2 score, return\n // }\n\n // checks for x win\n if (\n ((self.gameBoard.boxes[0].isX) \n && (self.gameBoard.boxes[1].isX) \n && (self.gameBoard.boxes[2].isX)) \n || ((self.gameBoard.boxes[3].isX) \n && (self.gameBoard.boxes[4].isX) \n && (self.gameBoard.boxes[5].isX)) \n || ((self.gameBoard.boxes[6].isX)\n && (self.gameBoard.boxes[7].isX) \n && (self.gameBoard.boxes[8].isX)) \n || ((self.gameBoard.boxes[0].isX) \n && (self.gameBoard.boxes[3].isX) \n && (self.gameBoard.boxes[6].isX)) \n || ((self.gameBoard.boxes[1].isX) \n && (self.gameBoard.boxes[4].isX) \n && (self.gameBoard.boxes[7].isX)) \n || ((self.gameBoard.boxes[2].isX) \n && (self.gameBoard.boxes[5].isX) \n && (self.gameBoard.boxes[8].isX)) \n || ((self.gameBoard.boxes[0].isX) \n && (self.gameBoard.boxes[4].isX) \n && (self.gameBoard.boxes[8].isX)) \n || ((self.gameBoard.boxes[2].isX) \n && (self.gameBoard.boxes[4].isX) \n && (self.gameBoard.boxes[6].isX))\n ){\n /*\n changes gameStatus & p1 score if x has won\n stops looking for a win or tie\n */\n self.gameBoard.gameStatus = self.gameBoard.player1.myName + \" wins!\";\n self.gameBoard.p1++;\n self.gameBoard.$save(self.gameBoard.p1);\n return;\n }\n \n // checks for o win\n if (\n ((self.gameBoard.boxes[0].isO) \n && (self.gameBoard.boxes[1].isO) \n && (self.gameBoard.boxes[2].isO)) \n || ((self.gameBoard.boxes[3].isO) \n && (self.gameBoard.boxes[4].isO) \n && (self.gameBoard.boxes[5].isO)) \n || ((self.gameBoard.boxes[6].isO) \n && (self.gameBoard.boxes[7].isO) \n && (self.gameBoard.boxes[8].isO)) \n || ((self.gameBoard.boxes[0].isO) \n && (self.gameBoard.boxes[3].isO) \n && (self.gameBoard.boxes[6].isO)) \n || ((self.gameBoard.boxes[1].isO) \n && (self.gameBoard.boxes[4].isO) \n && (self.gameBoard.boxes[7].isO)) \n || ((self.gameBoard.boxes[2].isO) \n && (self.gameBoard.boxes[5].isO) \n && (self.gameBoard.boxes[8].isO)) \n || ((self.gameBoard.boxes[0].isO) \n && (self.gameBoard.boxes[4].isO) \n && (self.gameBoard.boxes[8].isO)) \n || ((self.gameBoard.boxes[2].isO) \n && (self.gameBoard.boxes[4].isO) \n && (self.gameBoard.boxes[6].isO))\n ){\n /*\n changes gameStatus & p2 score if o has won\n stops looking for a win or tie\n */\n self.gameBoard.gameStatus = self.gameBoard.player2.myName + \" wins!\";\n self.gameBoard.p2++;\n self.gameBoard.$save(self.gameBoard.p2);\n return;\n }\n \n // checks for tie\n var cellEmpty = false;\n for (var i = 0; i < self.gameBoard.boxes.length; i++) {\n if ((self.gameBoard.boxes[i].isX === false) \n && (self.gameBoard.boxes[i].isO === false)) {\n cellEmpty = true;\n }\n }\n if (cellEmpty === false) {\n /*\n changes gameStatus & tie count if it is a tie\n */\n self.gameBoard.gameStatus = \"It's a tie!\"\n self.gameBoard.$save(self.gameBoard.gameStatus);\n self.gameBoard.tie++;\n self.gameBoard.$save(self.gameBoard.tie);\n }\n \n }", "function checkWinner() {\n if (winnerCalled()) {\n gameOver();\n }\n}", "function gameOn() {\n\n var possibleWins = [];\n\n // Check to see if computer has won --------- //\n\n if (pcMoves.length >= 3) {\n for (var a = 0; a < 8; a++) {\n\n var winCheck = 0;\n\n for (var b = 0; b < 3; b++) {\n if (pcMoves.indexOf(winningArray[a][b]) >= 0) {\n winCheck += 1;\n }\n\n if (winCheck == 3) {\n winner = true;\n alert(\"Computer wins. Welcome your new robot overlords.\");\n if (playerIcon == \"<img src='http://www.collinferry.com/codepen/o.png'>\") {\n clear(1);\n } else {\n clear();\n }\n }\n\n }\n\n }\n\n }\n\n // Check to see if human has won --------- //\n\n if (humanMoves.length >= 3) {\n\n for (var a = 0; a < 8; a++) {\n\n var winCheck = 0;\n\n for (var b = 0; b < 3; b++) {\n\n if (humanMoves.indexOf(winningArray[a][b]) >= 0) {\n winCheck += 1;\n }\n\n if (winCheck == 3) {\n winner = true;\n alert(\"You Win! Humans prevail over AI...for now!\");\n if (playerIcon == \"<img src='http://www.collinferry.com/codepen/o.png'>\") {\n clear(1);\n } else {\n clear();\n }\n }\n\n }\n\n }\n\n }\n \n // Check for tie --------- //\n\n if ((takenSquares.length == 9) && (winner === false)) {\n alert(\"Game over! It's a Tie!\");\n if (playerIcon == \"<img src='http://www.collinferry.com/codepen/o.png'>\") {\n clear(1);\n } else {\n clear();\n }\n }\n\n }", "function checkWin(checkAgainst){\n //strategy: forEach the winstates and check if either the player or the cpu has all of the points in a given winstate, if a player or CPU has TWO points in a given winstate, checkWin returns the third point in the winstate for a block or a victory\n //console.log('checking wins against ' + checkAgainst);\n \n //{console.log('turn: '+turns+' checkwin running with '+checkAgainst);}\n var counter=0;\n var winmove='';\n var foundwin=false;\n if(playertestflag=true){console.log('testing for player win on turn: '+turns);}\n winstates.forEach(function(test){\n if(playertestflag=true){console.log('testing: '+test);}\n counter=0;\n var moveArr=[];\n //console.log('checking: '+test);\n for(var i=0;i<checkAgainst.length;i++){\n // console.log('I am comparing '+test+'with '+checkAgainst[i]);\n if(playertestflag=true){console.log('checking:'+checkAgainst[i]);}\n if (test.indexOf(checkAgainst[i])>-1){\n if(playertestflag=true){console.log('found match: '+checkAgainst[i]);}\n // console.log(checkAgainst[i]+ ' is a part of '+test);\n \n counter++;\n \n if(playertestflag=true){console.log('found match: '+checkAgainst[i]+'count: '+counter);}\n if(counter>1){\n // console.log('i found a potential winning move and am checking if it is available');\n if(playertestflag=true){console.log('I am running checkavl against'+test);}\n if((checkavl(test).length>0)){\n moveArr=checkavl(test);\n if(playertestflag=true){console.log('writing to moveArr '+ moveArr+' with length: '+moveArr.length);}\n }\n //console.log('potential winmove, still looking for third: '+moveArr);\n //console.log('checkwin found a potential match on winstate: '+test+' match value: '+checkAgainst[i]+' counter: '+counter+' moveArr: '+moveArr);\n }\n }\n else{\n if(counter>1){\n //console.log('checkwin found a potential winning move: '+checkAgainst[i]);\n }\n }\n if(counter==2){\n //console.log('move here to win or block: ' + moveArr);\n if(foundwin===false){\n if( moveArr[0]!==undefined){\n winmove=moveArr[0];\n \n console.log('winmove has been written as:' +winmove);\n console.log('wrote undefined')\n }\n }\n }\n if (counter==3){\n // console.log('Win! - this is running - the next line should be true');\n winmove=true;\n // console.log(winmove);\n foundwin=true;\n \n } }\n \n });\n \n if(turns>3){\n // console.log('turn: '+turns+' checkwin returning'+winmove);\n }\n console.log('did I find a win?'+foundwin);\n console.log('I will return'+winmove)\n return winmove; \n}", "function checkWin() {\n if (userScore === numToMatch) {\n wins++;\n $(\"#wins\").text(\"Success: \" + wins);\n reset();\n } else if (userScore > numToMatch) {\n losses++\n $(\"#losses\").text(\"Fails: \" + losses);\n reset();\n }\n }", "function winnerCheck(){\n\tconsole.log(\"Inside winnerCheck Function\"); //This logs to the console that the winnerCheck function is currently happening \n\t\t//Inside the winner check function\n\t\tvar result = \"No Winner!\"; //Default state of 'result' variable is that ther is no winner\n\t\t//If either player's health has gone lower than 1, result variable will return that both players have died to the result variable, which will alert the user\n\t\tif(kabal[0].health < 1 && kratos[0].health < 1){\n\t\t\t\n\t\t\tresult = \"You Both Die.\";\n\t\t\t\n\t\t}else if(kratos[0].health < 1){\n\t\t\t\n\t\t\tresult = kratos[0].health + \" Wins!\"\n\t\t\t\n\t\t}else if(kratos[0].health < 1){\n\t\t\t\n\t\t\tresult = kabal[0].health + \" Wins!\"\n\t\t\t\n\t\t}; //Ends the if-else for winnerCheck \n\t\t\n\t\treturn result; //Returns the results of the winner check\n\t}", "function checkWinner(){\n \n\n //var result = '';\n //var userCounter = 0;\n \n //Iterate through win condition array\n /*for (var i = 0; i < winCondition.length; i++ ){\n //Checks winCondition first, player selections second.\n //Iterate through userChoices array \n for(var x = 0; x < userChoices.length; x++){\n result = $.inArray(userChoices[x], winCondition[i]);\n console.log(userChoices[x] + 'userChoice' + winCondition[i])\n console.log('result: ' + result);\n //First control flow: Increment userCounter if userChoices are found within winCondition array. \n if (result !== -1) {\n userCounter++;\n console.log(\"userCounter: \" + userCounter);\n } \n if (userCounter == 3) {\n alert('You win!');\n break;\n }\n };\n };\n\n \n*/ \n //outline all win conditions. Tried other methods. Really wanted to use array comparison, but couldn't\n //find a way to make it happen. \n //Win conditions for 'x' player\n if ($('#zero').hasClass('x') && $('#one').hasClass('x') && $('#two').hasClass('x') || \n $('#three').hasClass('x') && $('#four').hasClass('x') && $('#five').hasClass('x') ||\n $('#six').hasClass('x') && $('#seven').hasClass('x') && $('#eight').hasClass('x') ||\n $('#zero').hasClass('x') && $('#three').hasClass('x') && $('#six').hasClass('x') ||\n $('#zero').hasClass('x') && $('#four').hasClass('x') && $('#eight').hasClass('x') ||\n $('#one').hasClass('x') && $('#four').hasClass('x') && $('#seven').hasClass('x') ||\n $('#two').hasClass('x') && $('#five').hasClass('x') && $('#eight').hasClass('x') ||\n $('#two').hasClass('x') && $('#four').hasClass('x') && $('#six').hasClass('x')\n ) {\n winner = 'You won!';\n $(\"#player-score\").html(parseInt($(\"#player-score\").html(), 10)+1);\n //Win conditions for 'o' player\n } else if ($('#zero').hasClass('o') && $('#one').hasClass('o') && $('#two').hasClass('o') || \n $('#three').hasClass('o') && $('#four').hasClass('o') && $('#five').hasClass('o') ||\n $('#six').hasClass('o') && $('#seven').hasClass('o') && $('#eight').hasClass('o') ||\n $('#zero').hasClass('o') && $('#three').hasClass('o') && $('#six').hasClass('o') ||\n $('#zero').hasClass('o') && $('#four').hasClass('o') && $('#eight').hasClass('o') ||\n $('#one').hasClass('o') && $('#four').hasClass('o') && $('#seven').hasClass('o') ||\n $('#two').hasClass('o') && $('#five').hasClass('o') && $('#eight').hasClass('o') ||\n $('#two').hasClass('o') && $('#four').hasClass('o') && $('#six').hasClass('o')\n ) {\n winner = 'Computer won!';\n $(\"#opponent-score\").html(parseInt($(\"#opponent-score\").html(), 10)+1);\n //If board is full with no win conditions outlined above\n } else if(countTurn >= 9){\n alert('Cat scratch fever.');\n //Add to cat-record score\n $(\"#cat-record\").html(parseInt($(\"#cat-record\").html(), 10)+1);\n }\n\n }", "function checkwinner(){\n winner = 0;\n for (check = 0; check < winning.length;check++){\n a = winning[check][0];\n b = winning[check][1];\n c = winning[check][2];\n if ((board[a] == board[b]) &&\n (board[b] == board[c]) &&\n (board[a] != EMPTY)){\n winner = board[a];\n $(\"hr\").removeClass();\n $(\"hr\").addClass(winning[check][3]);\n $('.lines').hide().fadeIn('fast');\n\n\n if (winner == me){$('.winner2').html('I won !Play again?');}\n else {$('.winner2').html('Congratulations! You Won Play again?');}\n $('.winner').hide().fadeIn(3000);\n $('.yesno').hide().fadeIn('fast');\n }\n\n }\n if ((choices.length==0) && (winner ==0)){\n $('hr').removeClass();\n $('.winner').hide().fadeIn(1000);\n $('.yesno').hide().fadeIn('slow');\n $('.winner2').html('It was a draw Play again?');\n }\n}", "function winnerCheck(){\r\t\t// check using a console.log() if this function is working \r\t\t// console.log(\"in winnerCheck FN\");\r\r\t\t// create a \"no winner\" outcome and set it to a variable named result\r\t\tvar result = \"no winner\";\r\r\t\t// use a conditional statement to check if both players' health fell below 0\r\t\tif (p1[2] < 1 && p2[2] < 1) {\r\t\t\t// if above is true, both players lose\r\t\t\tresult = \"You both lost\";\r\t\t\t// since they both didn't lost then check if one of the players' health is below 0 to determine the loser and the other the winner\r\t\t} else if (p1[2] < 1) {\r\t\t\tresult = p2[0] + \" Wins!\";\r\t\t} else if (p2[2] < 1) {\r\t\t\tresult = p1[0] + \" Wins!\";\r\t\t}\r\t\t// return the value to the result variable to make this function reuseable\r\t\treturn result;\r\t}", "function checkWin(player) {\n // Variables to keep track of win, start at true and are proved false\n var horizontalWin = true;\n var verticalWin = true;\n var d1Win = true;\n var d2Win = true;\n\n // Check horizontally\n for(var cIndex = 0; cIndex < NUM_COLS; cIndex++) {\n // Check each column at the same row value\n if(!boxes[row][cIndex].classList.contains(player)) {\n horizontalWin = false;\n }\n }\n\n // Check vertically\n for(var rIndex = 0; rIndex < NUM_ROWS; rIndex++) {\n // Check each row at the same column value\n if(!boxes[rIndex][column].classList.contains(player)) {\n verticalWin = false;\n }\n }\n\n // Check if the latest piece was placed in a position that could win\n // diagonally\n if((row === column) || (Math.abs(row - column) === NUM_ROWS - 1)) {\n for(var d = 0; d < NUM_ROWS; d++) {\n // Check diagonally from top left to bottom right\n if(!boxes[d][d].classList.contains(player)) {\n d1Win = false;\n }\n\n // Check diagonally from bottom left to top right\n if(!boxes[NUM_ROWS - d - 1][d].classList.contains(player)) {\n d2Win = false;\n }\n }\n }\n\n // Couldn't have won diagonally\n else {\n d1Win = false;\n d2Win = false;\n }\n\n //console.log(\"H: \" + horizontalWin + \", V: \" + verticalWin + \", D: \" + d1Win + \", \" + d2Win);\n\n // Player wins\n if(horizontalWin || verticalWin || d1Win || d2Win) {\n if(player === xClass) {\n victoryText.textContent = \"X Player Wins!\";\n // Increase score of X player\n xScore.textContent = Number(xScore.textContent) + 1\n }\n else {\n victoryText.textContent = \"O Player Wins!\";\n // Increase score of O player\n oScore.textContent = Number(oScore.textContent) + 1\n }\n\n $(victoryText).show('slow');\n gameOver = true;\n return true;\n }\n\n // If all spaces are taken and nobody has won\n if(boxCount === NUM_ROWS * NUM_COLS) {\n victoryText.textContent = \"Cat's Game\";\n $(victoryText).show('slow');\n gameOver = true;\n }\n\n // Didn't win... yet\n return false;\n\n }", "function checkWinner() { \n console.log(\"checkWinner was called\");\n\n const board = getBoard();\n\n let diagWin = checkDiagonal1(board);\n if (diagWin !== null) return diagWin;\n\n diagWin = checkDiagonal2(board);\n if (diagWin !== null) return diagWin;\n\n const rowWin = checkRow(board);\n if (rowWin !== null) return rowWin;\n\n const colWin = checkColumns(board);\n if( colWin !== null) return colWin;\n\n if (playerCount > 8) \n return \"nobody\";\n else\n return null;\n}", "checkForWinner(){\n console.log('Checking for winner.');\n for (let condition of this.winStates){\n let winningCondition = true;\n for (let position of condition){\n if (this.gameState[position[0]][position[1]] != this.currentPlayer.token) {\n winningCondition = false;\n }\n }\n if (winningCondition) {\n console.log('We have a winner!');\n console.log(`Condition is: ${condition}`);\n this.gameStatus = 'won';\n this.winner = this.currentPlayer;\n\n // If we've gotten here, then we need to create a `win` event and\n // dispatch it.\n\n let winEvent = new Event('win');\n document.dispatchEvent(winEvent);\n\n return true; // Return a value to stop processing the additional move count check.\n }\n }\n this.moveCount++;\n console.log(`Reviewed move ${this.moveCount}.`)\n if (this.moveCount >= 9) {\n console.log(`This game is a draw at ${this.moveCount} moves.`);\n this.gameStatus = 'draw';\n\n let drawEvent = new Event('draw');\n document.dispatchEvent(drawEvent);\n }\n }", "checkWinner() {\n this.checkInHorizontal(player.getPlayerColor()[0]);\n this.checkInVertical(player.getPlayerColor()[0]);\n this.checkInDiagonalTopLeftBottomRight(player.getPlayerColor()[0]);\n this.checkInDiagonalTopRightBottomLeft(player.getPlayerColor()[0]);\n\n //If board is full of pawns and no-one win then send that is draw \n const drawMessage = 'Game ended with draw';\n if (this.checkdraw()) {\n socket.emit('gameEnded', {\n room: this.getRoomId(),\n message: drawMessage,\n });\n this.endGameMessage(drawMessage);\n }\n }", "function winCheck() {\n if ((square[0].textContent === square[1].textContent) && (square[1].textContent === square[2].textContent)) {\n winner = true;\n return winner;\n } else if ((square[3].textContent === square[4].textContent) && (square[4].textContent === square[5].textContent)) {\n winner = true;\n return winner;\n } else if ((square[6].textContent === square[7].textContent) && (square[7].textContent === square[8].textContent)) {\n winner = true;\n return winner;\n } else if ((square[0].textContent === square[3].textContent) && (square[3].textContent === square[6].textContent)) {\n winner = true;\n return winner;\n } else if ((square[1].textContent === square[4].textContent) && (square[4].textContent === square[7].textContent)) {\n winner = true;\n return winner;\n } else if ((square[2].textContent === square[5].textContent) && (square[5].textContent === square[8].textContent)) {\n winner = true;\n return winner;\n } else if ((square[0].textContent === square[4].textContent) && (square[4].textContent === square[8].textContent)) {\n winner = true;\n return winner;\n } else if ((square[2].textContent === square[4].textContent) && (square[4].textContent === square[6].textContent)) {\n winner = true;\n return winner;\n } else {\n winner = false;\n return winner;\n }\n\n }", "function checkForWinner(){\n let boardState = [];\n function updateBoardState (filledClass) {\n //Check Columns\n for(let i = 0; i < 3; i++){\n boardState.push($box.eq(i).hasClass(filledClass) && $box.eq(i+3).hasClass(filledClass) && $box.eq(i+6).hasClass(filledClass));\n }\n //Check Rows\n for(let i = 0; i < 7; i += 3){\n boardState.push($box.eq(i).hasClass(filledClass) && $box.eq(i+1).hasClass(filledClass) && $box.eq(i+2).hasClass(filledClass));\n }\n //Check Diagonals\n boardState.push($box.eq(0).hasClass(filledClass) && $box.eq(4).hasClass(filledClass) && $box.eq(8).hasClass(filledClass));\n boardState.push($box.eq(2).hasClass(filledClass) && $box.eq(4).hasClass(filledClass) && $box.eq(6).hasClass(filledClass));\n }\n updateBoardState('box-filled-1');\n updateBoardState('box-filled-2');\n\n //Check if all boxes have been selected\n function isBoardFull(){\n let board = $box.map((index, currBox) => {\n let $currBox = $(currBox);\n return isEmpty($currBox);\n });\n return !board.get().includes(true);\n }\n\n if(boardState.includes(true)){\n if($('.active').attr('id') === 'player1'){\n $('#finish').addClass('screen-win-one');\n $('.message').append('Winner');\n $('#finish').show();\n } else {\n $('#finish').addClass('screen-win-two');\n $('.message').append('Winner');\n $('#finish').show();\n }\n } else if(isBoardFull()) {\n $('.message').append('It\\'s a Tie!');\n $('#finish').addClass('screen-win-tie');\n $('#finish').show();\n }\n }", "function check_winner() {\r\n var scores = global_scores;\r\n var winning_move;\r\n\r\n for (var i = 0; i < scores.length; i++) {\r\n if (scores[i] == grid_size) {\r\n return 1; // X won\r\n }\r\n else if (scores[i] == -(grid_size)) {\r\n return 2; // O won\r\n }\r\n }\r\n\r\n if (moves == (grid_size * grid_size)) {\r\n return 3; // Draw\r\n }\r\n\r\n return 0; // No winner yet\r\n}", "function winDetection(item) {\n\n //keep track of moves to determine a draw\n moveCount++\n\n //id of the current item\n var itemId = $(item).attr(\"id\");\n\n //store the current counter\n var counter = $(item).attr(\"data-counter\"); // e.g. X / O\n\n //possible winning combinations based on counter location\n var winningCombos = {\n \"one\": [[\"two\", \"three\"], [\"five\", \"nine\"], [\"four\", \"seven\"]],\n \"two\": [[\"one\", \"three\"], [\"five\",\"eight\"]],\n \"three\": [[\"one\", \"two\"], [\"five\", \"seven\"], [\"six\", \"nine\"]],\n \"four\": [[\"one\", \"seven\"], [\"five\",\"six\"]],\n \"five\": [[\"four\", \"six\"], [\"two\", \"eight\"], [\"one\", \"nine\"], [\"three\",\"seven\"]],\n \"six\": [[\"three\", \"nine\"], [\"four\", \"five\"]],\n \"seven\": [[\"one\", \"four\"], [\"three\", \"five\"], [\"eight\", \"nine\"]],\n \"eight\": [[\"seven\", \"nine\"],[\"two\", \"five\"]],\n \"nine\": [[\"three\",\"six\"], [\"seven\",\"eight\"], [\"one\", \"five\"]]\n }\n\n var winner = false;\n\n winningCombos[itemId].forEach(function(item){\n\n if ( $(\"#\" + item[0]).attr(\"data-counter\") === counter && $(\"#\" + item[1]).attr(\"data-counter\") === counter ) {\n\n\n winner = true;\n\n // $(\"#\" + itemId).addClass(\"canvas-result\");\n // $(\"#\" + item[0]).addClass(\"canvas-result\");\n // $(\"#\" + item[1]).addClass(\"canvas-result\");\n\n gameBoard.hide();\n gameEnd = true;\n\n if (counter === playerCounter) {\n resultText.text(\"Winner!\").addClass(\"win\").removeClass(\"lose draw\");\n\n } else {\n resultText.text(\"Sorry, you lost!\").addClass(\"lose\").removeClass(\"win draw\");\n }\n\n return true;\n\n }\n\n return false;\n });\n\n if (moveCount === 9) {\n gameBoard.hide();\n gameEnd = true;\n\n resultText.text(\"It's a draw!\").addClass(\"draw\").removeClass(\"lose win\");\n resultsContainer.slideToggle(600);\n\n } else if (winner) {\n resultsContainer.slideToggle(600);\n }\n\n\n }", "checkForWin() {\n if ((this.state.availCells.length <= 4) && (this.state.winner === '')) {\n this.winCheck()\n } else {\n this.nextTurn()\n }\n }", "function checkWin(){\n\t//ROW WIN CONDITIONS\nif (oneV === twoV && twoV === threeV && oneV === threeV) {\n\tconsole.log('WINNER');\n\twhoPlayerTemp = (whoPlayer+'Wins');\n\tconsole.log(whoPlayerTemp);\n\t\tif (whoPlayerTemp === \"playerOneWins\") {\n\t\tplayerOneWins += 1;\n\t\t} else {\n\t\t\tplayerTwoWins +=1;\n\t\t}\n\t} else if (fourV === fiveV && fourV === sixV && fiveV === sixV) {\n\tconsole.log('WINNER');\n\twhoPlayerTemp = (whoPlayer+'Wins');\n\t\tif (whoPlayerTemp === \"playerOneWins\") {\n\t\t\tplayerOneWins += 1;\n\t\t} else {\n\t\t\tplayerTwoWins +=1;\n\t\t}\n\t} else if (sevenV === eightV && sevenV === nineV && eightV === nineV) {\n\tconsole.log('WINNER');\n\twhoPlayerTemp = (whoPlayer+'Wins');\n\t\tif (whoPlayerTemp === \"playerOneWins\") {\n\t\t\tplayerOneWins += 1;\n\t\t} else {\n\t\t\tplayerTwoWins +=1;\n\t\t}\n\t//COLUMN WIN CONDITIONS\n\t} else if (oneV === fourV && oneV === sevenV && fourV === sevenV) {\n\tconsole.log('WINNER');\n\twhoPlayerTemp = (whoPlayer+'Wins');\n\t\tif (whoPlayerTemp === \"playerOneWins\") {\n\t\t\tplayerOneWins += 1;\n\t\t} else {\n\t\t\tplayerTwoWins +=1;\n\t\t}\n\t} else if (twoV === fiveV && twoV === eightV && fiveV === eightV) {\n\tconsole.log('WINNER');\n\twhoPlayerTemp = (whoPlayer+'Wins');\n\t\tif (whoPlayerTemp === \"playerOneWins\") {\n\t\t\tplayerOneWins += 1;\n\t\t} else {\n\t\t\tplayerTwoWins +=1;\n\t\t}\n\t} else if (threeV === sixV && threeV === nineV && sixV === nineV) {\n\tconsole.log('WINNER');\n\twhoPlayerTemp = (whoPlayer+'Wins');\n\t\tif (whoPlayerTemp === \"playerOneWins\") {\n\t\t\tplayerOneWins += 1;\n\t\t} else {\n\t\t\tplayerTwoWins +=1;\n\t\t}\n\t//CROSS WIN CONDITIONS\n\t} else if (oneV === fiveV && oneV === nineV && fiveV === nineV) {\n\tconsole.log('WINNER');\n\twhoPlayerTemp = (whoPlayer+'Wins');\n\t\tif (whoPlayerTemp === \"playerOneWins\") {\n\t\t\tplayerOneWins += 1;\n\t\t} else {\n\t\t\tplayerTwoWins +=1;\n\t\t}\n\t} else if (threeV === fiveV && threeV === sevenV && fiveV === sevenV) {\n\tconsole.log('WINNER');\n\twhoPlayerTemp = (whoPlayer+'Wins');\n\t\tif (whoPlayerTemp === \"playerOneWins\") {\n\t\t\tplayerOneWins += 1;\n\t\t} else {\n\t\t\tplayerTwoWins +=1;\n\t\t}\n\t}\n\t$('#p2Score').text(playerTwoWins);\n\t$('#p1Score').text(playerOneWins);\n\t// checkTie();\n\tbestOfFiveWinner();\n}", "function checkWinner() {\n\t// Check if all cells are active\n\tlet count = 0;\n\tfor (let cell of gridCells) {\n\t\tif (cell.classList.contains(\"active\")) {\n\t\t\tcount++;\n\t\t }\n\t\t}\n\t// If all cells are active and no winner is found below, there's a tie (ie. gameStatus remains \"tie\")\n\tif (count === 9) {\n\t gameStatus = \"Tie\";\n\t// Otherwise the game is still going\n\t} else {\n\t gameStatus = \"Playing\";\n\t}\n\t\n\t// Iterate through all winning combos to see if a winner exists\n\tfor (let i = 0; i < winningCombos.length; i++) {\n\t\tif (\n\t\t\twinningCombos[i][0].textContent === playerX.playerChoice\n\t\t\t&& winningCombos[i][1].textContent === playerX.playerChoice\n\t\t\t&& winningCombos[i][2].textContent === playerX.playerChoice\n \t) \n\t\t{\n\t\t\t// If a winner, set the board to game over\n\t\t\tgameStatus = \"Win X\";\n\t\t\tgameOver();\t\n \t} \n\t\telse if (\n\t\t\twinningCombos[i][0].textContent === playerO.playerChoice\n\t\t\t&& winningCombos[i][1].textContent === playerO.playerChoice\n\t\t\t&& winningCombos[i][2].textContent === playerO.playerChoice\n\t\t) \n\t\t{\n\t\t\t// If a winner, set the board to game over\n\t\t\tgameStatus = \"Win O\";\n\t\t\tgameOver();\t\n\t\t}\n \t}\n}", "function winnerCheck() {\n \n\t //result is defaulted to \"no winner\"\n var result = \"no winner\";\n \n //if both players' healths are less than 1 or equal to 0 or less, then both players die at the end of the round.\n if (fighters[0].health < 1 && fighters[1].health < 1) {\n result = \"Both Fighters Die!\";\n \n\t\t//otherwise if player 1's health is less than 1 or equal to 0 or less, then player 2 is declared the winner of the fight.\n } else if (fighters[0].health < 1) {\n result = fighters[1].name + \" WINS!!!\";\n \n\t\t//otherwise if player 2's health is less than 1 or equal to 0 or less, then player 1 is declared the winner of the fight.\n } else if (fighters[1].health < 1) {\n result = fighters[0].name + \" WINS!!!\";\n }\n\t\t//return the value of the result variable outside of the function.\n return result;\n }", "function checkRoundWinner() {\n var activePlayer = players[activePlayerIndex];\n var boardScores = getCurrentBoardRowScores();\n var winningScoreValue = activePlayer.scorePoints * 3;\n var isWinningCombination = boardScores.indexOf(winningScoreValue) > 0;\n\n if (isWinningCombination) {\n activePlayer.winningRounds++;\n return $(document).trigger('roundWinner', activePlayer);\n } else {\n return boardHasEmptySpaces() ? switchActivePlayer() : setTimeout(clearBoard, 800);\n }\n}", "function checkWinner() {\n\tlet arrOfX = [];\n\tlet arrOfO = [];\n\ttd.map((curr, index) => {\n\t\tcurr = curr.innerHTML;\n\t\tif (curr === 'X') {\n\t\t\tarrOfX.push(index);\n\t\t} else if (curr === 'O') {\n\t\t\tarrOfO.push(index);\n\t\t}\n\t});\n\n\tfor (let i = 0; i < winCombo.length; i++) {\n\t\tif (arrOfX.length >= 3 && winCombo[i].every((elem) => arrOfX.indexOf(elem) > -1)) {\n\t\t\tendGame = true;\n\t\t\tplScore.innerHTML = Number(plScore.innerHTML) + 1;\n\t\t\tmsgPl.style.opacity = 1;\n\t\t\tbreak;\n\t\t} else if (arrOfO.length >= 3 && winCombo[i].every((elem) => arrOfO.indexOf(elem) > -1)) {\n\t\t\tendGame = true;\n\t\t\taiScore.innerHTML = Number(aiScore.innerHTML) + 1;\n\t\t\tendGameChecker();\n\t\t\tmsgAi.style.opacity = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (arrOfX.length === 5 && arrOfO.length === 4) {\n\t\tif (!endGame) {\n\t\t\tdrScore.innerHTML = Number(drScore.innerHTML) + 1;\n\t\t\tmsgDr.style.opacity = 1;\n\t\t}\n\t}\n}", "function checkWinner() {\n\n // Select any random icon \n const computerChoice = pickRandomChoice();\n \n // Display user and computer choice\n updateSelection(user_select, userChoice);\n updateSelection(computer_select, computerChoice);\n\n //GAME RULES \n // Draw game if user and computer have the same choice\n if(userChoice === computerChoice){ \n winner.innerText = 'draw';\n }\n\n // Check if User Win \n else if(\n (userChoice === 'paper' && computerChoice === 'rock') || (userChoice === 'rock' && computerChoice === 'scissors')\n ||\n (userChoice === 'scissors' && computerChoice === 'paper')\n ) {\n // Display User Win\n updateScore();\n winner.innerText = 'you win';\n }\n \n // Else Computer Win\n else {\n \n // Display User Lost\n updateComscore();\n winner.innerText = 'you loss';\n }\n}", "function winnerCheck(n, playerName) {\r\n\r\n\t\tif (\r\n\r\n\t\t\t(grid[0][0] == n && grid[0][1] == n && grid[0][2] == n) ||\r\n\t\t\t(grid[1][0] == n && grid[1][1] == n && grid[1][2] == n) ||\r\n\t\t\t(grid[2][0] == n && grid[2][1] == n && grid[2][2] == n) ||\r\n\r\n\t\t\t(grid[0][0] == n && grid[1][0] == n && grid[2][0] == n) ||\r\n\t\t\t(grid[0][1] == n && grid[1][1] == n && grid[2][1] == n) ||\r\n\t\t\t(grid[0][2] == n && grid[1][2] == n && grid[2][2] == n) ||\r\n\r\n\t\t\t(grid[0][0] == n && grid[1][1] == n && grid[2][2] == n) ||\r\n\t\t\t(grid[0][2] == n && grid[1][1] == n && grid[2][0] == n)\r\n\r\n\r\n\t\t) {\r\n\r\n\t\t\tif (playerName === player1Name) {\r\n\r\n\t\t\t\t$('.popWindow').css('display', 'block')\r\n\r\n\t\t\t\t$('.close').click(function () {\r\n\r\n\t\t\t\t\t$('.popWindow').css('display', 'none')\r\n\r\n\t\t\t\t});\r\n\r\n\t\t\t\t$('#msg').text(playerName + \" won the game!\");\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t$('.popWindow').css('display', 'block')\r\n\r\n\t\t\t\t$('.close').click(function () {\r\n\r\n\t\t\t\t\t$('.popWindow').css('display', 'none')\r\n\r\n\t\t\t\t});\r\n\r\n\t\t\t\t$('#msg').text(playerName + \" won the game!\")\r\n\r\n\t\t\t}\r\n\r\n\t\t\twinner = 1;\r\n\t\t\tcount = 0;\r\n//Changes the play button from Start Game to Play Again\r\n\t\t\t$(\"#playButton\").text(\"Play again\");\r\n\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t}", "function checkWinner(currentPlayer) {\r\n \r\n var players = [computerPiece, playerPiece]\r\n \r\n // loop through with X and O to find winning combinations\r\n\r\n for (var i in players) {\r\n if(oneclick.innerHTML==players[i] && twoclick.innerHTML==players[i] && threeclick.innerHTML==players[i] ) { youWon(players[i]); }\r\n if(fourclick.innerHTML==players[i] && fiveclick.innerHTML==players[i] && sixclick.innerHTML==players[i] ) { youWon(players[i]); }\r\n if(sevenclick.innerHTML==players[i] && eightclick.innerHTML==players[i] && nineclick.innerHTML==players[i] ) { youWon(players[i]); }\r\n if(oneclick.innerHTML==players[i] && fourclick.innerHTML==players[i] && sevenclick.innerHTML==players[i] ) { youWon(players[i]); }\r\n if(twoclick.innerHTML==players[i] && fiveclick.innerHTML==players[i] && eightclick.innerHTML==players[i] ) { youWon(players[i]); } \r\n if(threeclick.innerHTML==players[i] && sixclick.innerHTML==players[i] && nineclick.innerHTML==players[i] ) { youWon(players[i]); } \r\n if(oneclick.innerHTML==players[i] && fiveclick.innerHTML==players[i] && nineclick.innerHTML==players[i] ) { youWon(players[i]); } \r\n if(threeclick.innerHTML==players[i] && fiveclick.innerHTML==players[i] && sevenclick.innerHTML==players[i] ) { youWon(players[i]); } \r\n }\r\n\r\n // Check for tie by searching for 9 filled boxes\r\n var list = $(\"div[class='one']\").filter(function(i,v){\r\n return $.trim($(v).text()).length == 1;\r\n })\r\n if(list.length==9){\r\n youTied(currentPlayer);\r\n }\r\n\r\n}", "function checkWinningCondition(currentBoard) {\r\n// checking for horizontal conditions\r\nvar INDIA=HEARTS;\r\nvar RUSSIA=DABS;\r\n if(BOARD_SIZE === 9){\r\n for(var i = 0; i <=6; i += 3){\r\n if (currentBoard[i] === INDIA && currentBoard[i + 1] === INDIA && currentBoard[i + 2] === INDIA)\r\n return 2;\r\n if (currentBoard[i] === RUSSIA && currentBoard[i + 1] === RUSSIA && currentBoard[i + 2] === RUSSIA)\r\n return 3;\r\n }\r\n\r\n // Check for vertical wins\r\n for (i = 0; i <= 2; i++) {\r\n if (currentBoard[i] === INDIA && currentBoard[i + 3] === INDIA && currentBoard[i + 6] === INDIA)\r\n return 2;\r\n if (currentBoard[i] === RUSSIA && currentBoard[i + 3] === RUSSIA && currentBoard[i + 6] === RUSSIA)\r\n return 3;\r\n }\r\n\r\n // Check for diagonal wins\r\n if ((currentBoard[0] === INDIA && currentBoard[4] === INDIA && currentBoard[8] === INDIA) ||\r\n (currentBoard[2] === INDIA && currentBoard[4] === INDIA && currentBoard[6] === INDIA))\r\n return 2;\r\n\r\n if ((currentBoard[0] === RUSSIA && currentBoard[4] === RUSSIA && currentBoard[8] === RUSSIA) ||\r\n (currentBoard[2] === RUSSIA && currentBoard[4] === RUSSIA && currentBoard[6] === RUSSIA))\r\n return 3;\r\n\r\n // Check for tie\r\n for (i = 0; i < BOARD_SIZE; i++) {\r\n if (currentBoard[i] !== INDIA && currentBoard[i] !== RUSSIA)\r\n return 0;\r\n }\r\n return 1;}\r\n else if(BOARD_SIZE===16){\r\n for (i = 0; i <= 12; i += 4) {\r\n if (currentBoard[i] === INDIA && currentBoard[i + 1] === INDIA && currentBoard[i + 2] === INDIA && currentBoard[i + 3] === INDIA)\r\n return 2;\r\n if (currentBoard[i] === RUSSIA && currentBoard[i + 1] === RUSSIA && currentBoard[i + 2] === RUSSIA && currentBoard[i + 3] === RUSSIA)\r\n return 3;\r\n }\r\n\r\n // Check for vertical wins\r\n for (i = 0; i <= 3; i++) {\r\n if (currentBoard[i] === INDIA && currentBoard[i + 4] === INDIA && currentBoard[i + 8] === INDIA && currentBoard[i + 12] === INDIA)\r\n return 2;\r\n if (currentBoard[i] === RUSSIA && currentBoard[i + 4] === RUSSIA && currentBoard[i + 8] === RUSSIA && currentBoard[i + 12] === RUSSIA)\r\n return 3;\r\n }\r\n\r\n // Check for diagonal wins\r\n if ((currentBoard[0] === INDIA && currentBoard[5] === INDIA && currentBoard[10] === INDIA && currentBoard[15] === INDIA) ||\r\n (currentBoard[3] === INDIA && currentBoard[6] === INDIA && currentBoard[9] === INDIA && currentBoard[12] === INDIA))\r\n return 2;\r\n\r\n if ((currentBoard[0] === RUSSIA && currentBoard[5] === RUSSIA && currentBoard[10] === RUSSIA && currentBoard[15] === RUSSIA) ||\r\n (currentBoard[3] === RUSSIA && currentBoard[6] === RUSSIA && currentBoard[9] === RUSSIA && currentBoard[12] === RUSSIA))\r\n return 3;\r\n\r\n // Check for tie\r\n for (i = 0; i < BOARD_SIZE; i++) {\r\n if (currentBoard[i] !== INDIA && currentBoard[i] !== RUSSIA)\r\n return 0;\r\n }\r\n return 1;\r\n }\r\n else{\r\n for (i = 0; i <= 20; i += 5) {\r\n if ((currentBoard[i] === INDIA && currentBoard[i + 1] === INDIA && currentBoard[i + 2] === INDIA && currentBoard[i + 3] === INDIA) ||\r\n (currentBoard[i + 1] === INDIA && currentBoard[i + 2] === INDIA && currentBoard[i + 3] === INDIA && currentBoard[i + 4] === INDIA))\r\n return 2;\r\n if ((currentBoard[i] === RUSSIA && currentBoard[i + 1] === RUSSIA && currentBoard[i + 2] === RUSSIA && currentBoard[i + 3] === RUSSIA ) || \r\n (currentBoard[i + 1] === RUSSIA && currentBoard[i + 2] === RUSSIA && currentBoard[i + 3] === RUSSIA && currentBoard[i + 4] === RUSSIA))\r\n return 3;\r\n }\r\n\r\n // Check for vertical wins\r\n for (i = 0; i <= 4; i++) {\r\n if ((currentBoard[i] === INDIA && currentBoard[i + 5] === INDIA && currentBoard[i + 10] === INDIA && currentBoard[i + 15] === INDIA)|| \r\n (currentBoard[i + 5] === INDIA && currentBoard[i + 10] === INDIA && currentBoard[i + 15] === INDIA && currentBoard[i + 20] === INDIA))\r\n return 2;\r\n if ((currentBoard[i] === RUSSIA && currentBoard[i + 5] === RUSSIA && currentBoard[i + 10] === RUSSIA && currentBoard[i + 15] === RUSSIA) ||\r\n (currentBoard[i + 5] === RUSSIA && currentBoard[i + 10] === RUSSIA && currentBoard[i + 15] === RUSSIA&& currentBoard[i + 20] === RUSSIA))\r\n return 3;\r\n }\r\n\r\n // Check for diagonal wins\r\n if ((currentBoard[0] === INDIA && currentBoard[6] === INDIA && currentBoard[12] === INDIA && currentBoard[18] === INDIA) ||\r\n (currentBoard[6] === INDIA && currentBoard[12] === INDIA && currentBoard[18] === INDIA && currentBoard[24] === INDIA) ||\r\n (currentBoard[1] === INDIA && currentBoard[7] === INDIA && currentBoard[13] === INDIA && currentBoard[19] === INDIA) ||\r\n (currentBoard[5] === INDIA && currentBoard[11] === INDIA && currentBoard[17] === INDIA && currentBoard[23] === INDIA) ||\r\n (currentBoard[4] === INDIA && currentBoard[8] === INDIA && currentBoard[12] === INDIA && currentBoard[16] === INDIA) ||\r\n (currentBoard[8] === INDIA && currentBoard[12] === INDIA && currentBoard[16] === INDIA && currentBoard[20] === INDIA) ||\r\n (currentBoard[3] === INDIA && currentBoard[7] === INDIA && currentBoard[11] === INDIA && currentBoard[15] === INDIA) ||\r\n (currentBoard[9] === INDIA && currentBoard[13] === INDIA && currentBoard[17] === INDIA && currentBoard[21] === INDIA))\r\n return 2;\r\n\r\n if ((currentBoard[0] === RUSSIA && currentBoard[6] === RUSSIA && currentBoard[12] === RUSSIA && currentBoard[18] === RUSSIA) ||\r\n (currentBoard[6] === RUSSIA && currentBoard[12] === RUSSIA && currentBoard[18] === RUSSIA && currentBoard[24] === RUSSIA) ||\r\n (currentBoard[1] === RUSSIA && currentBoard[7] === RUSSIA && currentBoard[13] === RUSSIA && currentBoard[19] === RUSSIA) ||\r\n (currentBoard[5] === RUSSIA && currentBoard[11] === RUSSIA && currentBoard[17] === RUSSIA && currentBoard[23] === RUSSIA) ||\r\n (currentBoard[4] === RUSSIA && currentBoard[8] === RUSSIA && currentBoard[12] === RUSSIA && currentBoard[16] === RUSSIA) ||\r\n (currentBoard[8] === RUSSIA && currentBoard[12] === RUSSIA && currentBoard[16] === RUSSIA && currentBoard[20] === RUSSIA) ||\r\n (currentBoard[3] === RUSSIA && currentBoard[7] === RUSSIA && currentBoard[11] === RUSSIA && currentBoard[15] === RUSSIA) ||\r\n (currentBoard[9] === RUSSIA && currentBoard[13] === RUSSIA && currentBoard[17] === RUSSIA && currentBoard[21] === RUSSIA))\r\n return 3;\r\n\r\n // Check for tie\r\n for (i = 0; i < BOARD_SIZE; i++) {\r\n if (currentBoard[i] !== INDIA && currentBoard[i] !== RUSSIA)\r\n return 0;\r\n }\r\n return 1;\r\n }\r\n}", "function checkWinner() {\n if(resistanceWins == 3) {\n winner = true;\n return true;\n } else if(spyWins == 3) {\n return true;\n }\n return false;\n}", "function winnerCheck(){\n\t\tconsole.log(\"in winnerCheck FN\");\n\t\t//local variable which could be overriden by the following conditional statement\n\t\tvar result=\"no winner\";\n\t\t\n\t\t//conditional statement which checks for a winner\n\t\tif(fighter1[2]<1&&fighter2[2]<1){ //if fighter ones health, stored in index 2, is less than 1 && fighter twos health, stored in index 2, is less than 1\n\t\t\tresult = \"You Both Die\";\t\n\t\t}else if(fighter1[2]<1){ //if fighter1's health is less than 1, \n\t\t\tresult =fighter2[0]+\" \"+\"WINS!!!\"\n\t\t}else if(fighter2[2]<1){ //if fighter2' health is less than 1,\n\t\t\tresult=fighter1[0]+\" \"+\"WINS!!!\"\n\t\t};\n\t\t//sets result for winnerCheck function\n\t\treturn result;\n\t}", "function checkForWin () {\n for (var j = 0; j < boardSize.length; i++){\n if ((boardSize[j].isMine) && (boardSize[j].hidden) === true){\n } else if ((boardSize[j].isMine) && (boardSize[j].isMarked) === true){\n } else {\n return;\n }\n }\n lib.displayMessage('You win!');\n\n // You can use this function call to declare a winner (once you've\n // detected that they've won, that is!)\n // lib.displayMessage('You win!')\n}", "function checkWinner() {\n stopLoop();\n Game.powerUpCanvas.font = \"italic 36px calibri\";\n\n if (Game.players[1].score > Game.players[0].score) {\n Game.powerUpCanvas.fillStyle = \"Purple\";\n Game.powerUpCanvas.fillText(\"Purple player wins!\", 100, 250);\n }\n\n else if (Game.players[0].score > Game.players[1].score) {\n Game.powerUpCanvas.fillStyle = \"Green\";\n Game.powerUpCanvas.fillText(\"Green player wins!\", 500, 250);\n Game.players[0].srcX = 326;\n Game.players[0].srcY = 1182;\n }\n else if (Game.players[1].score === Game.players[0].score) {\n Game.powerUpCanvas.fillText(\"Draw!\", 390, 250);\n }\n}", "checkForWin() {\n if (!this.grid.lastPlacedChip) {\n return;\n }\n const connections = this.grid.getConnections({\n baseChip: this.grid.lastPlacedChip,\n minConnectionSize: Game.winningConnectionSize\n });\n if (connections.length > 0) {\n // Mark chips in only the first winning connection, and only mark the\n // first four chips of this connection (since only a connect-four is\n // needed to win\n connections[0].length = Game.winningConnectionSize;\n connections[0].forEach((chip) => {\n chip.winning = true;\n });\n this.winner = this.grid.lastPlacedChip.player;\n this.winner.score += 1;\n this.emit('game:declare-winner', this.winner);\n this.endGame();\n }\n }", "function checkWinner(playerSelection, computerSelection) {\n if (playerSelection !== computerSelection) {\n for (i = 0; i < rules.length; i++) {\n // check which rule contains both player hand and computer hand\n if (rules[i].toLowerCase().indexOf(playerSelection) >= 0 && rules[i].toLowerCase().indexOf(computerSelection) >= 0) {\n // when rule begins with player hand then player wins\n if (rules[i].toLowerCase().indexOf(playerSelection) === 0) {\n afterTurnMessage.innerHTML = `Player wins! ${rules[i]}`;\n previousWinner = \"player\";\n previousPlayerSelection = playerSelection;\n incrementPlayerScore();\n } else { // when rule doesn't begin with player hand then computer wins\n afterTurnMessage.innerHTML = `Computer wins! ${rules[i]}`;\n previousWinner = \"computer\";\n previousComputerSelection = computerSelection;\n incrementComputerScore();\n }\n }\n }\n } else { // if player and computer have the same hand\n afterTurnMessage.innerHTML= \"It's a draw!\";\n previousWinner = \"draw\";\n }\n}", "function winnerCheck(){\n console.log(\"In the winner check function\");\n var result=\"no winner\";\n if (fighter1[2]<1 && fighter2[2]<1) //if player 1 health is less than one AND player 2 health is less than 1, then there will be a result that both players die\n {\n\n result = \"You Both Die\";//If there is a No Winner, then announce it is a tied game and both players die\n } else if(fighter1[2]<1){ //if above condition is not met, then if player 1 health is less than one, then player 2 wins\n result =fighter2[0]+\" WINS!!!\"\n } else if (fighter2[2]<1) //if above condition is not met, then if player 2 health is less than one, then player 1 wins\n {\n result = fighter1[0]+\" WINS!!!\"\n };\n return result; //return winnerCheck information to results variable to use that information again\n }", "function checkForWin() {\r\n if (game_1.isWinningState(board)) {\r\n var winner = game_1.detectWinner(board);\r\n view_1.displayGameOver(winner);\r\n }\r\n else if (game_1.isDrawState(board)) {\r\n view_1.displayGameOver(null);\r\n }\r\n}", "function winChecker(gameField){\r\n if (gameField[0][0] === gameField[0][1] && gameField[0][1] === gameField[0][2] && gameField[0][0] != \"\" ) {\r\n document.getElementById('winner').innerHTML = gameField[0][0] + \" wins!\";\r\n disableAllbuttons();\r\n showButton(\"new_game\");\r\n return true;\r\n }\r\n\r\n if (gameField[1][0] === gameField[1][1] && gameField[1][1] === gameField[1][2] && gameField[1][0] != \"\") {\r\n document.getElementById('winner').innerHTML = gameField[1][0] + \" wins!\";\r\n disableAllbuttons();\r\n showButton(\"new_game\");\r\n return true;\r\n }\r\n\r\n if (gameField[2][0] === gameField[2][1] && gameField[2][1] === gameField[2][2] && gameField[2][0] != \"\") {\r\n document.getElementById('winner').innerHTML = gameField[2][0] + \" wins!\";\r\n disableAllbuttons();\r\n showButton(\"new_game\");\r\n return true;\r\n }\r\n if (gameField[0][0] === gameField[1][0] && gameField[1][0] === gameField[2][0] && gameField[0][0] != \"\") {\r\n document.getElementById('winner').innerHTML = gameField[0][0] + \" wins!\";\r\n disableAllbuttons();\r\n showButton(\"new_game\");\r\n return true;\r\n }\r\n if (gameField[0][1] === gameField[1][1] && gameField[1][1] === gameField[2][1] && gameField[0][1] != \"\") {\r\n document.getElementById('winner').innerHTML = gameField[0][1] + \" wins!\";\r\n disableAllbuttons();\r\n showButton(\"new_game\");\r\n return true;\r\n }\r\n if (gameField[0][2] === gameField[1][2] && gameField[1][2] === gameField[2][2] && gameField[0][2] != \"\") {\r\n document.getElementById('winner').innerHTML = gameField[0][2] + \" wins!\";\r\n disableAllbuttons();\r\n showButton(\"new_game\");\r\n return true;\r\n }\r\n if (gameField[0][0] === gameField[1][1] && gameField[1][1] === gameField[2][2] && gameField[0][0] != \"\") {\r\n document.getElementById('winner').innerHTML = gameField[0][0] + \" wins!\";\r\n disableAllbuttons();\r\n showButton(\"new_game\");\r\n return true;\r\n }\r\n if (gameField[0][2] === gameField[1][1] && gameField[1][1] === gameField[2][0] && gameField[0][2] != \"\") {\r\n document.getElementById('winner').innerHTML = gameField[0][2] + \" wins!\";\r\n disableAllbuttons();\r\n showButton(\"new_game\");\r\n return true;\r\n }\r\n return false;\r\n}", "function findWinner() {\n if (computerScore >= 121) {\n state = \"computerWon\";\n gameSequence();\n return true;\n } else if (playerScore >= 121) {\n state = \"playerWon\";\n gameSequence();\n return true;\n } else {\n return false;\n }\n\n}", "function checkWinner() {\n const board = checkBoard();\n // win values\n const exesWin = 6;\n const ohsWin = 15;\n let turnsTaken = 0;\n\n // winning conditions\n const rowOne = board[0] + board[1] + board[2];\n const rowTwo = board[3] + board[4] + board[5];\n const rowThree = board[6] + board[7] + board[8];\n const colOne = board[0] + board[3] + board[6];\n const colTwo = board[1] + board[4] + board[7];\n const colThree = board[2] + board[5] + board[8];\n const diagOne = board[2] + board[4] + board[6];\n const diagTwo = board[0] + board[4] + board[8];\n\n // see if the board is full.\n for (let i = 0; i < board.length; i++) {\n if (board[i] !== 0) {\n turnsTaken++;\n }\n }\n\n // if board is full, there is a tie\n if (turnsTaken === 9) {\n winnerAlert(3);\n\n } else if (rowOne === exesWin || rowTwo === exesWin || rowThree === exesWin ||\n colOne === exesWin || colTwo === exesWin || colThree === exesWin ||\n diagOne === exesWin || diagTwo === exesWin) {\n\n winnerAlert(1);\n\n } else if (rowOne === ohsWin || rowTwo === ohsWin || rowThree === ohsWin ||\n colOne === ohsWin || colTwo === ohsWin || colThree === ohsWin ||\n diagOne === ohsWin || diagTwo === ohsWin) {\n\n winnerAlert(2);\n }\n}", "function winner() {\n var playerTotal = playerHand.calculatePoints();\n if (playerHand.calculatePoints() < dealerHand.calculatePoints()) {\n var dealerTotal = dealerHand.calculatePoints();\n $('#messages').append('Dealer wins');\n $('#again-button').show();\n $('#hit-button, #stand-button').attr('disabled', true);\n } else if (dealerHand.calculatePoints() < playerHand.calculatePoints()) {\n $('#messages').append('You win!');\n $('#again-button').show();\n $('#hit-button, #stand-button').attr('disabled', true);\n } else {\n $('#messages').append('Push');\n }\n }", "function check(){\n if(score < compNum){\n return;\n }\n if (score == compNum){\n alert(\"win!\");\n wins ++;\n $(\"#wins\").text(wins);\n roundReset();\n }\n if(score > compNum) {\n alert(\"lose!\");\n losses ++;\n $(\"#losses\").text(losses);\n roundReset();\n }\n }", "function checkForWin () {\nfor(var x = 0; x<board.cells.length;x++){\nif(board.cells[x].isMine === true && board.cells[x].isMarked === false){\n\treturn;\n\t}else if(board.cells[x].isMine === false && board.cells[x].hidden === true){\n\t\treturn;\n\t}\n\n}\n\t\n // You can use this function call to declare a winner (once you've\n // detected that they've won, that is!)\n lib.displayMessage('You win!')\n}", "function checkWinner(player, x, y) {\n if (isWinning(player, x, y) ) {\n playSound('pacman_intermission.wav');\n player.winCount++;\n animUpdateScoreboard();\n updateLocalStorage(player);\n $('.battlefield li').off('click', computeAndCheckWinner);\n alert(player.name + ' wins!');\n // animation on Clear button to make it stand out, disappears on click\n\n } else if (usedFields.length === 9){\n playSound('pacman_death.wav');\n return alert('Tie game!');\n $('.battlefield li').off('click', computeAndCheckWinner);\n // animation on Clear button to make it stand out\n }\n}", "function checkWinner(board) {\n for (var i = 0; i < winningCombos.length; i++) {\n var combo = winningCombos[i];\n if (playerOccupiesCircles('X', combo, board)) {\n updateScoreboard();\n return 'X';\n }\n if (playerOccupiesCircles('O', combo, board)) {\n updateScoreboard();\n return 'O';\n }\n }\n return null;\n}", "gameWon() {\n if (this._gameBoard[0] == this._currentPlayer && this._gameBoard[1] == this._currentPlayer && this._gameBoard[2] == this._currentPlayer ||\n this._gameBoard[3] == this._currentPlayer && this._gameBoard[4] == this._currentPlayer && this._gameBoard[5] == this._currentPlayer ||\n this._gameBoard[6] == this._currentPlayer && this._gameBoard[7] == this._currentPlayer && this._gameBoard[8] == this._currentPlayer ||\n this._gameBoard[0] == this._currentPlayer && this._gameBoard[3] == this._currentPlayer && this._gameBoard[6] == this._currentPlayer ||\n this._gameBoard[1] == this._currentPlayer && this._gameBoard[4] == this._currentPlayer && this._gameBoard[7] == this._currentPlayer ||\n this._gameBoard[2] == this._currentPlayer && this._gameBoard[5] == this._currentPlayer && this._gameBoard[8] == this._currentPlayer ||\n this._gameBoard[0] == this._currentPlayer && this._gameBoard[4] == this._currentPlayer && this._gameBoard[8] == this._currentPlayer ||\n this._gameBoard[2] == this._currentPlayer && this._gameBoard[4] == this._currentPlayer && this._gameBoard[6] == this._currentPlayer) {\n this._gameOver = true;\n if (this._currentPlayer == 'X') {\n this._xWins += 1;\n } else {\n this._yWins += 1; \n }\n }\n //checks to see if the game is tied\n var isTie = true;\n for (var i = 0; i < this._gameBoard.length; i++) {\n if (this._gameBoard[i] == \"\") { //there is an empty spot on the board\n isTie = false; \n }\n }\n if (isTie) {\n this._gameOver = true;\n this._ties += 1;\n }\n this._tiedGame = isTie;\n }", "function checkVictory() {\n var winningShape = currentShape ? currentShape : player;\n for (row = 0; row < 3; row++) {\n if (board[row][0] == board[row][1] && board[row][1] == board[row][2]) {\n if (board[row][0] == 'X' || board[row][0] == 'O') {\n addPointsToWinner(winningShape);\n }\n }\n }\n for (col = 0; col < 3; col++) {\n if (board[0][col] == board[1][col] && board[1][col] == board[2][col]) {\n if (board[0][col] == 'X' || board[0][col] == 'O') {\n addPointsToWinner(winningShape);\n }\n }\n }\n if (board[0][0] == board[1][1] && board[1][1] == board[2][2]) {\n if (board[0][0] == 'X' || board[0][0] == 'O') {\n addPointsToWinner(winningShape);\n }\n }\n if (board[0][2] == board[1][1] && board[1][1] == board[2][0]) {\n if (board[0][2] == 'X' || board[0][2] == 'O') {\n addPointsToWinner(winningShape);\n }\n }\n if (isMovesLeft() == false) {\n declareWinner('none');\n }\n}", "function _checkResults() {\n\t\t// decrement number of moves\n\t\t_numOfMoves--;\n\t\t\n\t\t// check if moves have expired and winner has not been found\n\t\tif(_numOfMoves === 0 && !_winnerFound) {\n\t\t\t_cat = true;\n\t\t\t$(\"#outcome\").html('Cat! Click on board to start new game.');\n\t\t}\n\t\t\n\t\tif(_winnerFound) {\n\t\t\t$(\"#outcome\").html(_winner + \" is the winner! Click on board to start new game.\");\n\t\t}\n\t}", "function winnerCheck(){\r\n var result=\"no winner\";\r\n if (playerOne[2]<1 && playerTwo[2]<1)\r\n {\r\n result = \"You Both Die\";\r\n } else if(playerOne[2]<1){\r\n result =playerTwo[0]+\" WINS!!!\"\r\n } else if (playerTwo[2]<1)\r\n {\r\n result = playerOne[0]+\" WINS!!!\"\r\n };\r\n return result;\r\n }", "function checkWin() {\n checkWinCount += 1;\n\n if (Math.abs(gameBoard[0] + gameBoard[1] + gameBoard[2]) === 3){\n winner(); \n } else if (Math.abs(gameBoard[3] + gameBoard[4] + gameBoard[5]) === 3){\n winner(); \n } else if(Math.abs(gameBoard[6] + gameBoard[7] + gameBoard[8]) === 3){\n winner(); \n } else if(Math.abs(gameBoard[0] + gameBoard[3] + gameBoard[6]) === 3){\n winner();\n } else if(Math.abs(gameBoard[1] + gameBoard[4] + gameBoard[7]) === 3){\n winner();\n } else if(Math.abs(gameBoard[2] + gameBoard[5] + gameBoard[8]) === 3){\n winner(); \n } else if(Math.abs(gameBoard[0] + gameBoard[4] + gameBoard[8]) === 3){\n winner();\n } else if(Math.abs(gameBoard[2] + gameBoard[4] + gameBoard[6]) === 3){\n winner();\n } else if (checkWinCount === 9){\n drawMatch();\n }\n}", "function checkForWin() {\r\n // You can use this function call to declare a winner (once you've\r\n // detected that they've won, that is!)\r\n // lib.displayMessage('You win!')\r\n for (let i = 0; i < board.cells.length; i++) {\r\n const cell = board.cells[i];\r\n if ((cell.isMine && !cell.isMarked) || (!cell.isMine && cell.hidden)) {\r\n return;\r\n }\r\n }\r\n lib.displayMessage(\"You win!\");\r\n}", "function checkWinner() {\n //compare moves array to winning solutions\n //solution1\n if (\n playerMoves[0] === playerMoves[1] &&\n playerMoves[1] === playerMoves[2] &&\n playerMoves[0] !== undefined\n ) {\n winner = playerMoves[0];\n console.log(`${winner} is the winner`);\n alert(`${winner} is the winner`);\n }\n //solution2\n else if (\n playerMoves[3] === playerMoves[4] &&\n playerMoves[4] === playerMoves[5] &&\n playerMoves[3] !== undefined\n ) {\n winner = playerMoves[3];\n console.log(`${winner} is the winner`);\n alert(`${winner} is the winner`);\n }\n //solution3\n else if (\n playerMoves[6] === playerMoves[7] &&\n playerMoves[7] === playerMoves[8] &&\n playerMoves[6] !== undefined\n ) {\n winner = playerMoves[6];\n console.log(`${winner} is the winner`);\n alert(`${winner} is the winner`);\n }\n\n //solution4\n else if (\n playerMoves[0] === playerMoves[3] &&\n playerMoves[3] === playerMoves[6] &&\n playerMoves[0] !== undefined\n ) {\n winner = playerMoves[0];\n console.log(`${winner} is the winner`);\n alert(`${winner} is the winner`);\n }\n\n //solution5\n else if (\n playerMoves[1] === playerMoves[4] &&\n playerMoves[4] === playerMoves[7] &&\n playerMoves[1] !== undefined\n ) {\n winner = playerMoves[1];\n console.log(`${winner} is the winner`);\n alert(`${winner} is the winner`);\n }\n\n //solution6\n else if (\n playerMoves[2] === playerMoves[5] &&\n playerMoves[5] === playerMoves[8] &&\n playerMoves[2] !== undefined\n ) {\n winner = playerMoves[2];\n console.log(`${winner} is the winner`);\n alert(`${winner} is the winner`);\n }\n\n //solution7\n else if (\n playerMoves[0] === playerMoves[4] &&\n playerMoves[4] === playerMoves[8] &&\n playerMoves[0] !== undefined\n ) {\n winner = playerMoves[0];\n console.log(`${winner} is the winner`);\n alert(`${winner} is the winner`);\n }\n\n //solution8\n else if (\n playerMoves[2] === playerMoves[4] &&\n playerMoves[4] === playerMoves[6] &&\n playerMoves[2] !== undefined\n ) {\n winner = playerMoves[2];\n console.log(`${winner} is the winner`);\n alert(`${winner} is the winner`);\n } else {\n return;\n }\n}", "function checkWinner() {\r\n\t\t//check rows, cols, diags\r\n\t\t//if empty is 9, then we declare draw and end the game\r\n\r\n\t\tfor(var i = 0; i < winCombo.length; i++) {\r\n\t\t\tif(board[winCombo[i][0]].innerHTML != \" \" &&\r\n\t\t\t\tboard[winCombo[i][0]].innerHTML == board[winCombo[i][1]].innerHTML &&\r\n\t\t\t\tboard[winCombo[i][1]].innerHTML == board[winCombo[i][2]].innerHTML ) {\r\n\t\t\t\tboard[winCombo[i][0]].style.color = \"red\";\r\n\t\t\t\tboard[winCombo[i][1]].style.color = \"red\";\r\n\t\t\t\tboard[winCombo[i][2]].style.color = \"red\";\r\n\t\t\t\tcleanBgColor();\r\n\t\t\t\tdocument.getElementById(\"message\").innerHTML = board[winCombo[i][0]].innerHTML + \" wins!\";\r\n\t\t\t\tendGame();\r\n\t\t\t}\r\n\t\t}\t\t\r\n\t\r\n\t\t//check if the game is a draw \r\n\t\tif (empty == 0) {\r\n\t\t\tdocument.getElementById(\"message\").innerHTML = \"It's a draw.\";\r\n\t\t\tendGame();\r\n\t\t}\r\n\t}", "function checkMoves() {\n if (picked.length !== null) {\n if (opponentPicked.length !== null) {\n checkWinner();\n }\n }\n }", "function checkWinner() {\n if(playerPosition <= 0) {\n alert('Player 1 Wins!')\n } else if(compPosition <= 0) {\n alert('Computer Wins!')\n }\n }", "function declareWinner() {\n\n if (gameOn === true) {\n if (winner(board, player)) {\n winnerMsg.innerHTML = \"Player wins!\";\n gameOn = false;\n playerWins.innerHTML = playerWinsNum++;\n } else if (winner(board, computer)) {\n winnerMsg.innerHTML = \"Computer wins!\";\n gameOn = false;\n computerWins.innerHTML = computerWinsNum++;\n } else if (validMoves().length === 0) {\n winnerMsg.innerHTML = \"It's a draw!\";\n gameOn = false;\n draws.innerHTML = drawsNum++;\n }\n }\n}", "function checkForWin() {\n var isWinner = true\n\n for (let i = 0; i < board.cells.length; i++) {\n var cell = board.cells[i]\n\n if (cell.isMine && !cell.isMarked || cell.hidden && !cell.isMine) {\n isWinner = false\n }\n }\n\n if (isWinner) {\n // You can use this function call to declare a winner (once you've\n // detected that they've won, that is!)\n lib.displayMessage('You win!');\n winAudio.play();\n }\n}", "function CheckForWinner(game) {\n // Check for horizontal wins\n for (i = 0; i <= 6; i += 3) {\n if (game[i] === HUMAN_PLAYER && game[i + 1] === HUMAN_PLAYER && game[i + 2] === HUMAN_PLAYER)\n return 2;\n if (game[i] === COMPUTER_PLAYER && game[i + 1] === COMPUTER_PLAYER && game[i + 2] === COMPUTER_PLAYER)\n return 3;\n }\n\n // Check for vertical wins\n for (i = 0; i <= 2; i++) {\n if (game[i] === HUMAN_PLAYER && game[i + 3] === HUMAN_PLAYER && game[i + 6] === HUMAN_PLAYER)\n return 2;\n if (game[i] === COMPUTER_PLAYER && game[i + 3] === COMPUTER_PLAYER && game[i + 6] === COMPUTER_PLAYER)\n return 3;\n }\n\n // Check for diagonal wins\n if (CheckDiagonalWin(HUMAN_PLAYER, game))\n return 2;\n\n if (CheckDiagonalWin(COMPUTER_PLAYER, game))\n return 3;\n\n // Check for tie\n for (i = 0; i < BOARD_SIZE; i++) {\n if (game[i] !== HUMAN_PLAYER && game[i] !== COMPUTER_PLAYER)\n return 0;\n }\n return 1;\n}", "function winCheck() {\n if (userScore === computerPick) {\n wins++;\n $(\"#wins\").html(\"Wins: \" + wins);\n alert(\"Winning isn’t everything, it’s the ONLY thing\");\n newGame();\n }\n\n else if (userScore > computerPick) {\n losses++;\n $(\"#losses\").html(\"Losses: \" + losses);\n alert(\"...if you ain't first, you're last\");\n newGame();\n };\n }", "function _checkMoves() {\n\t\t\n\t\t// iterate through the rows\n\t\tfor(row = 0; row < _rows; row++) {\n\t\t\t\n\t\t\t// iterate through the cols\n\t\t\tfor (col = 0; col < _cols; col++) {\n\t\t\t\t\n\t\t\t\t// check top and bottom\n\t\t\t\tif(row - 1 >= 0 && typeof _board[row - 1][col] !== \"undefined\"\n\t\t\t\t && row + 1 < _rows && typeof _board[row + 1][col] !== \"undefined\"){\n\t\t\t\t\t\n\t\t\t\t\tif(_board[row - 1][col] === _board[row][col] && _board[row + 1][col] === _board[row][col]) {\n\t\t\t\t\t\t_winnerFound = true;\n\t\t\t\t\t\t_winner = _board[row][col];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// check left and right\n\t\t\t\tif(col - 1 >= 0 && typeof _board[row][col - 1] !== \"undefined\"\n\t\t\t\t && col + 1 < _cols && typeof _board[row][col + 1] !== \"undefined\"){\n\t\t\t\t\t\n\t\t\t\t\tif(_board[row][col - 1] === _board[row][col] && _board[row][col + 1] === _board[row][col]) {\n\t\t\t\t\t\t_winnerFound = true;\n\t\t\t\t\t\t_winner = _board[row][col];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// check diagonals\n\t\t\t\tif(col - 1 >= 0 && col + 1 < _cols && row - 1 >= 0 && row + 1 < _rows){\n\n\t\t\t\t\tif(typeof _board[row - 1][col - 1] !== \"undefined\"\n\t\t\t\t\t && typeof _board[row + 1][col + 1] !== \"undefined\"\n\t\t\t\t\t && _board[row - 1][col - 1] === _board[row][col] \n\t\t\t\t\t && _board[row + 1][col + 1] === _board[row][col]) {\n\t\t\t\t\t\t_winnerFound = true;\n\t\t\t\t\t\t_winner = _board[row][col];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if(typeof _board[row - 1][col + 1] !== \"undefined\"\n\t\t\t\t\t && typeof _board[row + 1][col - 1] !== \"undefined\"\n\t\t\t\t\t && _board[row - 1][col + 1] === _board[row][col] \n\t\t\t\t\t\t&& _board[row + 1][col - 1] === _board[row][col]) {\n\t\t\t\t\t\t_winnerFound = true;\n\t\t\t\t\t\t_winner = _board[row][col];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t// if winner was found, then break out of loop\n\t\t\tif(_winnerFound) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t}", "function checkForWin () {\n for (i = 0; i < board.cells.length; i++) {\n if(\n board.cells[i].isMine && !board.cells[i].isMarked){\n return}\n else if (\n board.cells[i].isMarked && !board.cells[i].hidden){\n return}\n }\n\n // You can use this function call to declare a winner (once you've\n // detected that they've won, that is!)\n lib.displayMessage('You win!')\n}", "function checkForWinner() {\n if (state.userScore >= state.firstTo) {\n displayWinner('You are')\n } else if (state.computerScore >= state.firstTo) {\n displayWinner('Computer is')\n }\n}", "checkForWinner(){\n //if someone has a winning combination\n if(this.hasWinningCombo()){\n this.setState({\n gameOver: true,\n winner: this.state.currentTurn + \" wins!\",\n winnerShort: this.state.currentTurn\n });\n return true;\n }\n //if the board is full and no one its a draw\n else if(this.boardIsFull()){\n this.setState({\n gameOver: true,\n winner: \" It's a draw!\"\n }); \n return true;\n }\n //keep playing since no one won and the board isn't full\n else\n {\n return false;\n }\n }", "function checkWin() {\n var tieGame = true;\n\n for (var combo in lines) {\n if (lines[combo].length === 3) {\n if (lines[combo][0] === lines[combo][1] && lines[combo][1] === lines[combo][2]) {\n winner = lines[combo][0];\n setTimeout(endOfGame(winner + ' won the game!'), 700);    \n tieGame = false;\n win = true;\n         canMove = false;      \n }\n } else {\n tieGame = false;\n }\n }\n if (tieGame) {\n setTimeout(endOfGame('It was a Tie Game!'), 700);\n win = true;\n     canMove = false;  \n }\n }", "function hasWon() {\t\n\tif (leftHand.hasClass('rock') && rightHand.hasClass('scissors') ||\n\t\tleftHand.hasClass('paper') && rightHand.hasClass('rock') ||\n\t\tleftHand.hasClass('scissors') && rightHand.hasClass('paper')){\n\t\tplayerOneWin += 1;\n\t\tround += 1;\n\t\tleft.addClass('spinLeft').removeClass('alt leftLose');\n\t\tright.addClass('rightLose').removeClass('alt');\n\t\t$('#oneWinner').addClass('alt');\n\t} else if (rightHand.hasClass('rock') && leftHand.hasClass('scissors') ||\n\t\t\t \trightHand.hasClass('paper') && leftHand.hasClass('rock') ||\n\t\t\t\trightHand.hasClass('scissors') && leftHand.hasClass('paper')) {\n\t\tplayerTwoWin += 1;\n\t\tround += 1;\n\t\tright.addClass('spinRight').removeClass('alt rightLose');\n\t\tleft.addClass('leftLose').removeClass('alt');\n\t\t$('#twoWinner').addClass('alt');\n\t} else {\n\t\tleft.addClass('spinLeft').removeClass('alt leftLose');\n\t\tright.addClass('spinRight').removeClass('alt rightLose');\n\t\t$('#tie').addClass('alt');\n\t}\n\t// Adds score depending on win state\n\t$('#playerOneScore').text(playerOneWin);\n\t$('#playerTwoScore').text(playerTwoWin);\n\n\tsetTimeout(function(){\n\t\twinAll();\n\t}, 2000);\n\n\t//If player gets 5 wins the page reloads\n\tfunction winAll(){\n\t\tif (playerOneWin === 3) {\n\t\t\talert('Player One Wins! Click ok to restart.');\n\t\t\tlocation.reload();\n\t\t} else if (playerTwoWin === 3) {\n\t\t\talert('Player Two Wins! Click ok to restart');\n\t\t\tlocation.reload();\n\t\t}\n\t}\n}", "function checkWinOrLoss() {\n if (totalScore === randomNumToGuess) { // We have a winner\n wins++;\n initializeGame()\n }\n else if (totalScore > randomNumToGuess) { // We have a loser\n losses++;\n initializeGame();\n }\n else {\n updateUI;\n }\n }", "function winner() {\n if (dealer.calcSum() > player.calcSum() && dealer.calcSum() <= 21) {\n outcomes();\n console.log(\"Dealer wins!\");\n } else if(player.calcSum() > 21){\n outcomes();\n console.log(\"You bust!\");\n } else {\n outcomes();\n console.log(\"You win!\");\n player.money += betAmount*2;\n }\n } //winner ends", "function checkWinner(gameField) {\n // check for horizontal win\n for (var i = 0; i < 5; i++) {\n if (gameField[i][0] !== null && gameField[i][0] === gameField[i][1] && gameField[i][1] === gameField[i][2] && gameField[i][2] === gameField[i][3] && gameField[i][3] === gameField[i][4]) {\n return true;\n }\n } // check for vertical win\n\n\n for (var j = 0; j < 5; j++) {\n if (gameField[0][j] !== null && gameField[0][j] === gameField[1][j] && gameField[0][j] === gameField[2][j] && gameField[0][j] === gameField[3][j] && gameField[0][j] === gameField[4][j]) {\n return 1;\n }\n } // check for diagonal top-left-bottom-right\n\n\n if (gameField[0][0] !== null && gameField[0][0] === gameField[1][1] && gameField[0][0] === gameField[2][2] && gameField[0][0] === gameField[3][3] && gameField[0][0] === gameField[4][4]) {\n return 1;\n } // check for diagonal bottom-left-top-right\n\n\n if (gameField[4][0] !== null && gameField[4][0] === gameField[3][1] && gameField[4][0] === gameField[2][2] && gameField[4][0] === gameField[1][3] && gameField[4][0] === gameField[0][4]) {\n return 1;\n }\n\n return 0;\n} // Function for checking 3 by 3 grid for a tie", "checkVictory() {\n const turnsToCheck = this.turn === TURN.OH ? this.ohs : this.exs;\n\n // prettier-ignore\n const winning = [\n [0, 1, 2],\n [0, 3, 6],\n [0, 4, 8],\n [1, 4, 7],\n [2, 4, 6],\n [2, 5, 8],\n [3, 4, 5],\n [6, 7, 8],\n ];\n\n for (let i = 0; i < winning.length; i++) {\n this.won = winning[i].every((w) => turnsToCheck.includes(w));\n if (this.won) {\n this.ctx.fillStyle = '#00FF0040';\n this.ctx.fillRect(0, 0, this.gameWidth, this.gameHeight);\n return;\n }\n }\n }", "function checkWinner() {\n if (matchCount !== shapes.length) {\n\t\treturn;\n }\n\n\ttimer.stop();\n\n let ticks = timer.getTicks();\n let timeSpent = timer.getTime(ticks);\n MemoryStorage.setItem(Date.now(), ticks);\n\n showModal();\n}", "function checkWinner(id) {\r\n let boxCount = 1;\r\n let boxColor = $('#'+id).css(\"background-color\");\r\n checkRight();\r\n checkLeft();\r\n winCond();\r\n checkDown();\r\n checkUp();\r\n winCond();\r\n\r\n // Checks how many squares to the right of the box match a players color\r\n\r\n function checkRight() {\r\n let boxID = id;\r\n let boxIDArray = id.split('');\r\n boxIDArray[1] = parseInt(boxIDArray[1]) + 1;\r\n boxID = boxIDArray.join('');\r\n for(var i = 1; i <= 3; i++) {\r\n if($('#'+boxID).css(\"background-color\") === boxColor) {\r\n boxCount += 1;\r\n boxIDArray[1] = parseInt(boxIDArray[1]) + 1;\r\n boxID = boxIDArray.join('');\r\n } \r\n }\r\n }\r\n\r\n // Checks how many squares to the left of the box match a players color\r\n\r\n function checkLeft() {\r\n let boxID = id;\r\n let boxIDArray = id.split('');\r\n boxIDArray[1] = parseInt(boxIDArray[1]) - 1;\r\n boxID = boxIDArray.join('');\r\n for(var i = 1; i <= 3; i++) {\r\n if($('#'+boxID).css(\"background-color\") === boxColor) {\r\n boxCount += 1;\r\n boxIDArray[1] = parseInt(boxIDArray[1]) - 1;\r\n boxID = boxIDArray.join('');\r\n } \r\n }\r\n }\r\n\r\n // Checks how many squares below the box match a players color\r\n\r\n function checkDown() {\r\n let boxID = id;\r\n let boxIDArray = id.split('');\r\n boxIDArray[0] = nextChar(boxIDArray[0]);\r\n boxID = boxIDArray.join('');\r\n for(var i = 1; i <= 3; i++) {\r\n if($('#'+boxID).css(\"background-color\") === boxColor) {\r\n boxCount += 1;\r\n boxIDArray[0] = nextChar(boxIDArray[0]);\r\n boxID = boxIDArray.join('');\r\n } \r\n }\r\n }\r\n\r\n /* Checks how many squares above the box match a players color\r\n Stops at the top 'a' column to avoid error since 'a' is start of char set\r\n */ \r\n\r\n function checkUp() {\r\n let boxID = id;\r\n let boxIDArray = id.split('');\r\n if(boxIDArray[0] !== 'a') {\r\n boxIDArray[0] = prevChar(boxIDArray[0]);\r\n boxID = boxIDArray.join('');\r\n for(var i = 1; i <= 3; i++) {\r\n if($('#'+boxID).css(\"background-color\") === boxColor) {\r\n boxCount += 1;\r\n if(boxIDArray[0] !== 'a') {\r\n boxIDArray[0] = prevChar(boxIDArray[0]);\r\n boxID = boxIDArray.join('');\r\n } else {\r\n return;\r\n }\r\n } \r\n }\r\n }\r\n }\r\n\r\n /* After checking right/left or up/down determines if there the player had at least 4 in a row to win the game.\r\n Alerts the user that a player has won and disables all buttons so game is over and updates the score.\r\n Also checks to see if every box has been selected and if no winner declares a tie.\r\n */\r\n\r\n function winCond() {\r\n if(boxCount >= 4) {\r\n if(player === 1) {\r\n alert('Congrats ' + player1 + ' you win!!');\r\n player1Score += 1;\r\n $('.button').prop('disabled', true);\r\n \r\n } else if (player === 2) {\r\n alert('Congrats ' + player2 + ' you win!!');\r\n player2Score += 1;\r\n $('.button').prop('disabled', true);\r\n }\r\n $('#score').html('<h2>Score - ' + player1 + ': ' + player1Score + ' ' + player2 + ': ' + player2Score + ' ' + 'Ties: ' + ties + '</h2>'); // Updates the \r\n } else if(numOfButtons === boardWidth * boardHeight) {\r\n alert('It is a tie!!');\r\n ties += 1;\r\n }\r\n \r\n boxCount = 1; // Resets boxCount if there was no winner \r\n }\r\n changePlayer(); // Changes the player after a turn\r\n}", "checkWinner(squares){\n const winnerSquares = this.calculateWinner(squares);\n let winnerPlayer;\n let status;\n\n if (winnerSquares) {\n winnerPlayer = squares[winnerSquares[0]];\n status = 'Winner: ' + winnerPlayer;\n }\n else if (this.state.stepNumber === 0)\n status = 'Lets begin!';\n else if (this.state.stepNumber === 9)\n status = 'Drawn game';\n else \n status = 'Next player: ' + (this.state.xIsNext ? 'X' : 'O');\n\n return status;\n }", "function isWinner() {\n //store player if x or o or undefined//\n const tile0 = tiles[0].classList[2];\n const tile1 = tiles[1].classList[2];\n const tile2 = tiles[2].classList[2];\n const tile3 = tiles[3].classList[2];\n const tile4 = tiles[4].classList[2];\n const tile5 = tiles[5].classList[2];\n const tile6 = tiles[6].classList[2];\n const tile7 = tiles[7].classList[2];\n const tile8 = tiles[8].classList[2];\n\n const winningConditions = [\n //row are the same//\n [tile0, tile1, tile2],\n [tile3, tile4, tile5],\n [tile6, tile7, tile8],\n //column are the same//\n [tile0, tile3, tile6],\n [tile1, tile4, tile7],\n [tile2, tile5, tile8],\n //diagonally are the same//\n [tile0, tile4, tile8],\n [tile2, tile4, tile6],\n ];\n\n //any winning condition//\n winningConditions.some((tile) => {\n if (tile[0] && tile[0] === tile[1] && tile[0] === tile[2]) {\n playerDisplay.textContent = `Player ${tile[0]} won!`;\n modalHeader.textContent = \"\";\n modalText.textContent = `Player ${tile[0]} won`;\n isGameOver(true);\n //display previous button//\n return tile;\n } else {\n isDraw();\n }\n });\n}", "function checkForWinner() {\n const winningArrays = [\n // horizontal wins\n [0, 1, 2, 3], [1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [7, 8, 9, 10], [8, 9, 10, 11], \n [9, 10, 11, 12], [10, 11, 12, 13], [14, 15, 16, 17], [15, 16, 17, 18], [16, 17, 18, 19],\n [17, 18, 19, 20], [21, 22, 23, 24], [22, 23, 24, 25], [23, 24, 25, 26], [24, 25, 26, 27], \n [28, 29, 30, 31], [29, 30, 31, 32], [30, 31, 32, 33], [31, 32, 33, 34], [35, 36, 37, 38], \n [36, 37, 38, 39], [37, 38, 39, 40], [38, 39, 40, 41], \n\n // vertical wins\n [0, 7, 14, 21], [7, 14, 21, 28], [14, 21, 28, 35], [1, 8, 15, 22], [8, 15, 22, 29], [15, 22, 29, 36],\n [2, 9, 16, 23], [9, 16, 23, 30], [16, 23, 30, 37], [3, 10, 17, 24], [10, 17, 24, 31], [17, 24, 31, 38],\n [4, 11, 18, 25], [11, 18, 25, 32], [18, 25, 32, 39], [5, 12, 19, 26], [12, 19, 26, 33], [19, 26, 33, 40],\n [6, 13, 20, 27], [13, 20, 27, 34], [20, 27, 34, 41], \n\n // diagonal wins\n [21, 15, 9, 3], [28, 22, 16, 10], [22, 16, 10, 4], [35, 29, 23, 17], [29, 23, 17, 11], [23, 17, 11, 5], \n [36, 30, 24, 18], [30, 24, 18, 12], [24, 18, 12, 6], [37, 31, 25, 19], [31, 25, 19, 13],\n [38, 32, 26, 20], [3, 11, 19, 27], [2, 10, 18, 26], [10, 18, 26, 34], [1, 9, 17, 25], [9, 17, 25, 33], \n [17, 25, 33, 41], [0, 8, 16, 24], [8, 16, 24, 32], [16, 24, 32, 40], [7, 15, 23, 31], [15, 23, 31, 39],\n [14, 22, 30, 38]\n ]\n // now take the 4 values in each winning array and plug into our cells array\n for (let i = 0; i < winningArrays.length; i++) {\n const cellsOne = cells[winningArrays[i][0]]\n const cellsTwo = cells[winningArrays[i][1]]\n const cellsThree = cells[winningArrays[i][2]]\n const cellsFour = cells[winningArrays[i][3]]\n\n // now check these arrays to see if they have classList of player-one\n if (cellsOne.classList.contains('player-one') &&\n cellsTwo.classList.contains('player-one') &&\n cellsThree.classList.contains('player-one') &&\n cellsFour.classList.contains('player-one')) {\n\n result.innerHTML = 'Yellow Wins!'\n console.log('Yellow wins')\n score1 += 1\n document.querySelector('#score1').textContent = score1\n document.querySelector('h4').innerHTML = 'Game Over!'\n\n // Make all cells unclickable when there is a winner\n cells.forEach(cell => {\n cell.removeEventListener('click', handleClick)\n }) \n \n // and check these arrays to see if they have classList of player-two\n } if (cellsOne.classList.contains('player-two') &&\n cellsTwo.classList.contains('player-two') &&\n cellsThree.classList.contains('player-two') &&\n cellsFour.classList.contains('player-two')) {\n result.innerHTML = 'Blue Wins!'\n console.log('Blue wins')\n score2 += 1\n document.querySelector('#score2').textContent = score2\n document.querySelector('h4').innerHTML = 'Game Over!'\n\n // Make all cells unclickable when there is a winner\n cells.forEach(cell => {\n cell.removeEventListener('click', handleClick)\n }) \n } \n } \n }", "function getWinner() {\n if (b1 !== 'T' && this.b1.innerHTML === this.b2.innerHTML && this.b1.innerHTML === this.b3.innerHTML) {alert(`${this.b1.innerHTML} is WINNER!!!`);\n } else if (b4 !== 'T' && this.b4.innerHTML === this.b5.innerHTML && this.b4.innerHTML === this.b6.innerHTML) {alert(`${this.b4.innerHTML} is WINNER!!!`);\n } else if (b7 !== 'T' && this.b7.innerHTML === this.b8.innerHTML && this.b7.innerHTML === this.b9.innerHTML) {alert(`${this.b7.innerHTML} is WINNER!!!`);\n } else if (b1 !== 'T' && this.b1.innerHTML === this.b4.innerHTML && this.b1.innerHTML === this.b7.innerHTML) {alert(`${this.b1.innerHTML} is WINNER!!!`);\n } else if (b2 !== 'T' && this.b2.innerHTML === this.b5.innerHTML && this.b2.innerHTML === this.b8.innerHTML) {alert(`${this.b2.innerHTML} is WINNER!!!`);\n } else if (b3 !== 'T' && this.b3.innerHTML === this.b6.innerHTML && this.b3.innerHTML === this.b9.innerHTML) {alert(`${this.b3.innerHTML} is WINNER!!!`);\n } else if (b1 !== 'T' && this.b1.innerHTML === this.b5.innerHTML && this.b1.innerHTML === this.b9.innerHTML) {alert(`${this.b1.innerHTML} is WINNER!!!`);\n } else if (b3 !== 'T' && this.b3.innerHTML === this.b5.innerHTML && this.b3.innerHTML === this.b7.innerHTML) {alert(`${this.b3.innerHTML} is WINNER!!!`);\n } else if (gameHistory.length >= 9) {\n alert(`Cat's Scratch, Play Again!`);\n }\n}", "function checkgamewining() {\n console.log('CheckWining Start>');\n let personOnSide2 = side2.childElementCount;\n let personOnSide1 = side1.childElementCount;\n if ((personOnSide2 == '6') || (personOnSide1 == '0')) {\n alert(`You Won The Game\\n Time Played: ${playingHours}:${playingMinutes}:${playingSeconds}`);\n updateLeaderBoard();\n resetTheGame();\n startTheMatch();\n return true;\n } else {\n function checkboth(side_of, person_length) {\n let v = 0;//number of villans\n let s = 0;//number of saints\n let div_s = side_of.getElementsByTagName('div');\n for (let i = 0; i < person_length; i++) {\n if (div_s[i].innerHTML[0] == 'S') s += 1;\n else v += 1\n }\n if (s == 0) s = 4;\n if (person_length >= 2) return v > s; //if more than 1 person is on side\n return false;\n }\n if (checkboth(side2, personOnSide2) || checkboth(side1, personOnSide1)) {\n console.log('Lose');\n alert('You Loose the Game');\n return resetTheGame();//use to restart the game\n }\n }\n return false;\n}", "function checkWin() {\n //check if there is a winner\n return WINARR.some(function (arr) {\n return (\n playerChoices[arr[0]] === playerChoices[arr[1]] &&\n playerChoices[arr[0]] === playerChoices[arr[2]] &&\n playerChoices[arr[2]]\n );\n });\n}", "checkWin(player) {\n for (let i = 0; i < 3; i++) {\n //check horizontal wins\n if (player._letter === this._board[i][0] &&\n player._letter === this._board[i][1] &&\n player._letter === this._board[i][2]) {\n return true;\n }\n //check vertical wins\n if (player._letter === this._board[0][i] &&\n player._letter === this._board[1][i] &&\n player._letter === this._board[2][i]) {\n return true;\n }\n }\n\n //check wins on the diagonals\n if (player._letter === this._board[0][0] &&\n player._letter === this._board[1][1] &&\n player._letter === this._board[2][2]) {\n return true;\n }\n\n if (player._letter === this._board[0][2] &&\n player._letter === this._board[1][1] &&\n player._letter === this._board[2][0]) {\n return true;\n }\n\n //Check for a tie\n if (this._board.toString().length === 17) {\n return 'tie';\n }\n }", "checkForWin() {\n // Check four cells to see if they're all color of current player\n // - cells: list of four (y, x) cells\n // - returns true if all are legal coordinates & all match currPlayer\n const _win = cells =>\n cells.every(\n ([y, x]) =>\n y >= 0 &&\n y < this.height &&\n x >= 0 &&\n x < this.width &&\n this.board[y][x] === this.currPlayer\n );\n\n\n for (let y = 0; y < this.height; y++) {\n for (let x = 0; x < this.width; x++) {\n // get \"check list\" of 4 cells (starting here) for each of the different\n // ways to win\n const horiz = [[y, x], [y, x + 1], [y, x + 2], [y, x + 3]];\n const vert = [[y, x], [y + 1, x], [y + 2, x], [y + 3, x]];\n const diagDR = [[y, x], [y + 1, x + 1], [y + 2, x + 2], [y + 3, x + 3]];\n const diagDL = [[y, x], [y + 1, x - 1], [y + 2, x - 2], [y + 3, x - 3]];\n\n // find winner (only checking each win-possibility as needed)\n if (_win(horiz) || _win(vert) || _win(diagDR) || _win(diagDL)) {\n return true;\n }\n }\n }\n }", "function checkForWin () {\n \n for (let index =0; index < board.cells.length; index++){\n if (board.cells[index].isMine && !board.cells[index].isMarked){\n return \n }\n if (board.cells[index].isMarked && !board.cells[index].isMine && board.cells[index].hidden) {\n return\n }\n if (!board.cells[index].isMine && board.cells[index].hidden) {\n return\n }\n }\n // You can use this function call to declare a winner (once you've\n // detected that they've won, that is!)\n var audio = document.getElementsByClassName(\"win\")[0];\n audio.play();\n lib.displayMessage('You win!')\n}", "function winCheck() {\n\tif(matches === 8){\n\t\ttimerEnd();\n\t\taddRating(moves);\n\t\tpopUpModal();\n\t\tpopUp.classList.remove('display-none');\n\t}\n}", "primaryWinConditionsCheck() {\n super.primaryWinConditionsCheck();\n // <<-- Creer-Merge: primary-win-conditions -->>\n const alivePianos = this.game.furnishings.filter((f) => !f.isDestroyed && f.isPiano);\n if (alivePianos.length === 0) { // game over\n this.secondaryWinConditions(\"all pianos destroyed.\");\n }\n // check to see if one player has more score than the other can possibly get\n const winning = this.game.players[0].score > this.game.players[1].score\n ? this.game.players[0]\n : this.game.players[1];\n // this assumes they play every piano on every remaining turn\n const remainingTurns = this.game.maxTurns - this.game.currentTurn;\n const maxAdditionalScore = Math.ceil(alivePianos.length * remainingTurns / 2);\n if (winning.score > winning.opponent.score + maxAdditionalScore) {\n // then the losing player can't catch up to the winner's score,\n // so end the game early\n this.declareWinner(`Score (${winning.score}) high enough that the opponent can't `\n + `win in the remaining turns (${remainingTurns}).`, winning);\n this.declareLoser(\"Score too low to catch up to the winner in the number of remaining turns.\", winning.opponent);\n return true;\n }\n // <<-- /Creer-Merge: primary-win-conditions -->>\n return false; // If we get here no one won on this turn.\n }", "function whoWon(outcome) {\n let rockCheck = document.getElementsByName('rockImage');\n if (outcome == \"playerWin\") {\n playerScore++;\n playerScoreText.textContent = `Player: ${playerScore}`;\n scoring(playerScore, compScore);\n if (rockCheck != null) {\n window.setTimeout(removeCwClass, 1500);\n } \n \n } else if (outcome == \"compWin\") {\n compScore++; \n compScoreText.textContent = `Computer: ${compScore}`;\n scoring(playerScore, compScore);\n if (rockCheck != null) {\n window.setTimeout(removeCwClass, 1500);\n } \n } else if (outcome == \"tie\") {\n if (rockCheck != null) {\n window.setTimeout(removeCwClass, 1500);\n } \n }\n }", "function winner() {\n\nif (TL === \"x\" && TM === \"x\" && TR === \"x\") return \"one\"\nif (ML === \"x\" && MM === \"x\" && MR === \"x\") return \"one\"\nif (BL === \"x\" && BM === \"x\" && BR === \"x\") return \"one\"\n\nif (TL === \"x\" && ML === \"x\" && BL === \"x\") return \"one\"\nif (TM === \"x\" && MM === \"x\" && BM === \"x\") return \"one\"\nif (TR === \"x\" && MR === \"x\" && BR === \"x\") return \"one\"\n\nif (TL === \"x\" && MM === \"x\" && BR === \"x\") return \"one\"\nif (TR === \"x\" && MM === \"x\" && BL === \"x\") return \"one\"\n\n\nif (TL === \"o\" && TM === \"o\" && TR === \"o\") return \"two\"\nif (ML === \"o\" && MM === \"o\" && MR === \"o\") return \"two\"\nif (BL === \"o\" && BM === \"o\" && BR === \"o\") return \"two\"\n\nif (TL === \"o\" && ML === \"o\" && BL === \"o\") return \"two\"\nif (TM === \"o\" && MM === \"o\" && BM === \"o\") return \"two\"\nif (TR === \"o\" && MR === \"o\" && BR === \"o\") return \"two\"\n\nif (TL === \"o\" && MM === \"o\" && BR === \"o\") return \"two\"\nif (TR === \"o\" && MM === \"o\" && BL === \"o\") return \"two\"\n\n}", "function testWin(lastPlayerIsX){\n var pW; //possible winner\n if (lastPlayerIsX === true) {\n pW = \"X\";\n } else {\n pW = \"O\";\n }\n if (\n document.getElementById(\"a1\").innerHTML === pW &&\n document.getElementById(\"a2\").innerHTML === pW &&\n document.getElementById(\"a3\").innerHTML === pW ||\n document.getElementById(\"b1\").innerHTML === pW &&\n document.getElementById(\"b2\").innerHTML === pW &&\n document.getElementById(\"b3\").innerHTML === pW ||\n document.getElementById(\"c1\").innerHTML === pW &&\n document.getElementById(\"c2\").innerHTML === pW &&\n document.getElementById(\"c3\").innerHTML === pW\n ||\n document.getElementById(\"a1\").innerHTML === pW &&\n document.getElementById(\"b1\").innerHTML === pW &&\n document.getElementById(\"c1\").innerHTML === pW ||\n document.getElementById(\"a2\").innerHTML === pW &&\n document.getElementById(\"b2\").innerHTML === pW &&\n document.getElementById(\"c2\").innerHTML === pW ||\n document.getElementById(\"a3\").innerHTML === pW &&\n document.getElementById(\"b3\").innerHTML === pW &&\n document.getElementById(\"c3\").innerHTML === pW\n ||\n document.getElementById(\"a1\").innerHTML === pW &&\n document.getElementById(\"b2\").innerHTML === pW &&\n document.getElementById(\"c3\").innerHTML === pW ||\n document.getElementById(\"a3\").innerHTML === pW &&\n document.getElementById(\"b2\").innerHTML === pW &&\n document.getElementById(\"c1\").innerHTML === pW\n ) {\n\n document.getElementById(\"msg\").innerHTML = pW + \" is the winner!\";\n playing = false;\n playCount = 0;\n document.getElementById(\"resetButton\").disabled = false;\n }\n}", "function checkForWinnerPlayer(){\n var counter = 0;\n for (var i = 0; i < winners.length; i++){\n for (var j = 0; j < 3; j++) { \n if (alreadyChosenPlayer.indexOf(winners[i][j]) === -1) {\n break;\n }\n else {\n counter += 1;\n }\n if (counter === 3) {\n winner = \"player\";\n }\n }\n counter = 0;\n }\n}", "function checkForWin() {\n var winner = true;\n var youWin = document.getElementById(\"win\");\n for (var i = 0; i < board.cells.length; i++) {\n if (board.cells[i].isMine === true && board.cells[i].isMarked === false) {\n return \"\";\n }\n if (board.cells[i].isMine === false && board.cells[i].hidden === true) {\n return \"\";\n }\n }\n lib.displayMessage(\"You win!\");\n youWin.play();\n document.getElementById(\"fireworks.wav\").play();\n }", "function WON()\n{\n moveCounter++;\n pSwitch();\n if(moveCounter>4)\n {\n let winner=winnerCheck();\n if (winner!=null)\n {\n gameOver(winner,line,coordonate);\n } \n }\n}", "function checkForWin(){\n\tif((sq1.innerHTML !== \"\") && (sq1.innerHTML === sq2.innerHTML) && (sq1.innerHTML === sq3.innerHTML)) {\n\t\tgameOver = true;\n\t\tmarkWin(sq1, sq2, sq3);\n\t\twinner.innerHTML = \"Player \" + sq1.innerHTML + \" is the winner!\";\n\t}\n\telse if((sq4.innerHTML !== \"\") && (sq4.innerHTML === sq5.innerHTML) && (sq4.innerHTML === sq6.innerHTML)) {\n\t\tgameOver = true;\n\t\tmarkWin(sq4, sq5, sq6);\n\t\twinner.innerHTML = \"Player \" + sq4.innerHTML + \" is the winner!\";\n\t}\n\telse if((sq7.innerHTML !== \"\") && (sq7.innerHTML === sq8.innerHTML) && (sq7.innerHTML === sq9.innerHTML)) {\n\t\tgameOver = true;\n\t\tmarkWin(sq7, sq8, sq9);\n\t\twinner.innerHTML = \"Player \" + sq7.innerHTML + \" is the winner!\";\n\t}\n\telse if((sq1.innerHTML !== \"\") && (sq1.innerHTML === sq4.innerHTML) && (sq1.innerHTML === sq7.innerHTML)) {\n\t\tgameOver = true;\n\t\tmarkWin(sq1, sq4, sq7);\n\t\twinner.innerHTML = \"Player \" + sq1.innerHTML + \" is the winner!\";\n\t}\n\telse if((sq2.innerHTML !== \"\") && (sq2.innerHTML === sq5.innerHTML) && (sq2.innerHTML === sq8.innerHTML)) {\n\t\tgameOver = true;\n\t\tmarkWin(sq2, sq5, sq8);\n\t\twinner.innerHTML = \"Player \" + sq2.innerHTML + \" is the winner!\";\n\t}\n\telse if((sq3.innerHTML !== \"\") && (sq3.innerHTML === sq6.innerHTML) && (sq3.innerHTML === sq9.innerHTML)) {\n\t\tgameOver = true;\n\t\tmarkWin(sq3, sq6, sq9);\n\t\twinner.innerHTML = \"Player \" + sq3.innerHTML + \" is the winner!\";\n\t}\n\telse if((sq1.innerHTML !== \"\") && (sq1.innerHTML === sq5.innerHTML) && (sq1.innerHTML === sq9.innerHTML)) {\n\t\tgameOver = true;\n\t\tmarkWin(sq1, sq5, sq9);\n\t\twinner.innerHTML = \"Player \" + sq1.innerHTML + \" is the winner!\";\n\t}\n\telse if((sq3.innerHTML !== \"\") && (sq3.innerHTML === sq5.innerHTML) && (sq3.innerHTML === sq7.innerHTML)) {\n\t\tgameOver = true;\n\t\tmarkWin(sq3, sq5, sq7);\n\t\twinner.innerHTML = \"Player \" + sq3.innerHTML + \" is the winner!\";\n\t}\n}", "function didYouWin() {\n if (cells[0].textContent == player && cells[1].textContent == player && cells[2].textContent == player) {\n declareWinner(player);\n } else if (cells[3].textContent == player && cells[4].textContent == player && cells[5].textContent == player) {\n declareWinner(player);\n } else if (cells[6].textContent == player && cells[7].textContent == player && cells[8].textContent == player) {\n declareWinner(player);\n } else if (cells[0].textContent == player && cells[3].textContent == player && cells[6].textContent == player) {\n declareWinner(player);\n } else if (cells[1].textContent == player && cells[4].textContent == player && cells[7].textContent == player) {\n declareWinner(player);\n } else if (cells[2].textContent == player && cells[5].textContent == player && cells[8].textContent == player) {\n declareWinner(player);\n } else if (cells[0].textContent == player && cells[4].textContent == player && cells[8].textContent == player) {\n declareWinner(player);\n } else if (cells[2].textContent == player && cells[4].textContent == player && cells[6].textContent == player) {\n declareWinner(player);\n } else {\n // If no one wins the game on this move, check for a tie --\n tieGame();\n }\n}", "function checkWinner() {\n const p1Winscore = winScore === p1Score\n const p2Winscore = winScore === p2Score\n if (p1Winscore || p2Winscore) {\n p1BtnElm.setAttribute('disabled', 'disabled')\n p2BtnElm.setAttribute('disabled', 'disabled')\n }\n displayWinner(p1Winscore, p2Winscore)\n }", "function calcWinnerHit(){\n if (dealer.score > 21 || player01.score > 21){\n let dealerAce = checkForAces(dealer);\n let player01Ace = checkForAces(player01);\n\n if (dealer.score > 21 && dealerAce === false){\n // Update messageboard to announce winner\n let message = 'You win!!!';\n messages.push(message);\n let latestMessage = messages.length -1;\n // Uncomment the line below for debugging messageboard\n console.log('Latest Message: ',latestMessage);\n messageBoard.textContent = messages[latestMessage]; \n }\n // else if (dealerAce === true) {\n // for (let c in dealer.hand) {\n // // console.log('c=', dealer.hand[c]['card']);\n // let cardValue = dealer.hand[c]['card'];\n // let cardPoints = dealer.hand[c]['points'];\n // let aceIndex = dealer.hand.indexOf(cardValue);\n // console.log('ace-index =', aceIndex);\n // if (cardValue.startsWith('A') && cardPoints === 11) {\n // console.log(cardDealt.points);\n // console.log(\"I found an ACE in this hand\");\n // dealer.hand[c]['points'] = 1;\n // console.log(cardPoints);\n // }\n // else {\n // return false;\n // }\n \n // }\n // }\n\n\n if (player01.score > 21 && player01Ace === false){\n // Update messageboard to announce winner\n let message = 'The House wins.';\n messages.push(message);\n let latestMessage = messages.length -1;\n // Uncomment the line below for debugging messageboard\n // console.log('Latest Message: ',latestMessage);\n messageBoard.textContent = messages[latestMessage]; \n hitButton.disabled = true; \n standButton.disabled = true; \n }\n // else if (player01Ace === true) {\n // for (let c in player01.hand) {\n // // console.log('c=', dealer.hand[c]['card']);\n // let cardValue = player01.hand[c]['card'];\n // console.log('cardValue= ' + cardValue);\n // let cardPoints = player01.hand[c]['points'];\n // console.log('cardPoints= '+ cardPoints);\n // // let aceIndex = player01.hand.indexOf(cardValue);\n // let aceIndex = Object.getOwnPropertyDescriptor(player01.hand, cardValue);\n // console.log('ace-index = ' + aceIndex);\n // if (cardValue.startsWith('A') && cardPoints === 11) {\n // console.log('cardValue= ' + cardValue);\n // console.log('cardPoints= '+ cardPoints);\n // console.log('ace-index = ' + aceIndex);\n\n // console.log('cardDealtPoints = ' + cardDealt.points);\n // console.log(\"I found an ACE in this hand\");\n // player01.hand[c]['points'] = 1;\n // console.log('cardPoints= '+ cardPoints);\n // }\n // else {\n // return false;\n // }\n \n // }\n // }\n\n }\n}" ]
[ "0.79708654", "0.78941214", "0.7678011", "0.7586455", "0.7520717", "0.75167274", "0.750261", "0.7467108", "0.74580115", "0.74576217", "0.74502397", "0.7443073", "0.74408716", "0.74230456", "0.73953235", "0.7384824", "0.736292", "0.7356105", "0.73534864", "0.73356366", "0.7329579", "0.7324921", "0.732348", "0.7321657", "0.73156136", "0.73117715", "0.7309387", "0.7308322", "0.7308103", "0.7302577", "0.72872305", "0.7285458", "0.7257162", "0.72550005", "0.7251248", "0.72439426", "0.7229576", "0.7209135", "0.7203688", "0.71977496", "0.71889514", "0.7186647", "0.71788746", "0.7168922", "0.71601766", "0.71592486", "0.7158339", "0.7157817", "0.7143695", "0.71333253", "0.7131845", "0.7128182", "0.71231604", "0.7115179", "0.71135736", "0.71115947", "0.7109051", "0.71055096", "0.7096511", "0.70946217", "0.7086346", "0.7082261", "0.70816064", "0.7081198", "0.7074713", "0.7073896", "0.70637625", "0.7062558", "0.70612866", "0.7058938", "0.70566034", "0.7051185", "0.70503414", "0.7046242", "0.7044392", "0.7040153", "0.70375067", "0.70372164", "0.70340955", "0.70267934", "0.70199203", "0.7018825", "0.701564", "0.70143557", "0.7012832", "0.70127445", "0.7012412", "0.7010483", "0.70086753", "0.7004774", "0.7001155", "0.70007807", "0.6990733", "0.69906604", "0.69901884", "0.6989721", "0.6983599", "0.6974161", "0.69728404", "0.69720143" ]
0.72580844
32
This code is an example of sending a http request receive a response with in another http session. First post request come in to route point router.post('/token', ...); Then before send a reply back to client another request is generating using superagent l ibrary to once reply is coming in (with the .end method) the the reply to the "original" first request is send to the client using the promiseRes response object.
function getToken(promiseRes) { request .post('http://localhost:3000/promise/token') .send({name: "tsemach", game: "is the man"}) // sends a JSON post body .set('Accept', 'application/json') .end((err, res) => { // Calling the end function will send the request console.log("getToken: res = " + res.body.toString()); promiseRes.send({promise: 'done'}); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async send(request, response) {}", "async receive(request, response) {}", "static postReponse() {\n const reqMessage = JSON.parse(this.req.chunks[0]);\n\n this.res.writeHead(200);\n this.res.end();\n Bot.Functions.load(reqMessage.group_id);\n function send() {\n //ACTUAL BOT\n const resMessage = Bot.Bot.checkMessage(reqMessage);\n if (resMessage) {\n\n //STARTS SEND\n Bot.Bot.sendMessage(resMessage);\n }\n }\n setTimeout(send, 200);\n }", "route(req, res) {\n const parsedURL = url.parse(req.url, true)\n const route = parsedURL.pathname.replace(/^\\/+|\\/+$/g, '')\n\n const queryString = parsedURL.query\n const headers = req.headers\n const decoder = new StringDecoder('utf-8')\n\n let buffer = ''\n req.on('data', (data) => {\n buffer += decoder.write(data)\n })\n\n req.on('end', async () => {\n try {\n buffer += decoder.end()\n const request = new Request({ \n route: route,\n queryString: queryString,\n method: req.method,\n headers, headers,\n payload: buffer\n })\n\n let handler = this._router.handler(route, req.method)\n const response = await handler(request)\n let statusCode = response.statusCode()\n let payload = response.payload()\n\n statusCode = typeof(statusCode) == 'number' ? statusCode : 200\n payload = typeof(payload) == 'object' ? payload : {}\n \n res.setHeader('Content-Type', 'application/json')\n res.writeHead(statusCode)\n res.end(JSON.stringify(payload))\n } catch (err) {\n console.dir(err)\n res.writeHead(500)\n res.end(JSON.stringify({\n err: err,\n msg: 'internal server error'\n }))\n }\n })\n }", "sendRequest(options,data) {\n\n return new Promise((resolve,reject) =>\n {\n let req = http.request(options, res => {\n // console.log(`statusCode: ${res.statusCode}`)\n res.on('data', d => {\n d = d.toString('utf8');\n resolve(d)\n })\n })\n \n req.on('error', error => {\n console.log(error)\n console.log(\"Another player did not connect within 3 minutes, or the server is no longer available\")\n \n if (this.connected) {\n this.closeRequest().then((response =>{\n console.log(response)\n process.exit()\n }))\n }\n else {\n process.exit()\n }\n \n \n \n })\n \n if (data !== undefined) {\n // console.log(\"data wrote\")\n req.write(data)\n }\n \n req.end()\n });\n \n }", "function wrap(superagent, Promise) {\n\t /**\n\t * Request object similar to superagent.Request, but with end() returning\n\t * a promise.\n\t */\n\t function PromiseRequest() {\n\t superagent.Request.apply(this, arguments);\n\t }\n\n\t // Inherit form superagent.Request\n\t PromiseRequest.prototype = Object.create(superagent.Request.prototype);\n\n\t /** Send request and get a promise that `end` was emitted */\n\t PromiseRequest.prototype.end = function (cb) {\n\t var _end = superagent.Request.prototype.end;\n\t var self = this;\n\n\t return new Promise(function (accept, reject) {\n\t _end.call(self, function (err, response) {\n\t if (cb) {\n\t cb(err, response);\n\t }\n\n\t if (err) {\n\t err.response = response;\n\t reject(err);\n\t } else {\n\t accept(response);\n\t }\n\t });\n\t });\n\t };\n\n\t /** Provide a more promise-y interface */\n\t PromiseRequest.prototype.then = function (resolve, reject) {\n\t var _end = superagent.Request.prototype.end;\n\t var self = this;\n\n\t return new Promise(function (accept, reject) {\n\t _end.call(self, function (err, response) {\n\t if (err) {\n\t err.response = response;\n\t reject(err);\n\t } else {\n\t accept(response);\n\t }\n\t });\n\t }).then(resolve, reject);\n\t };\n\n\t /**\n\t * Request builder with same interface as superagent.\n\t * It is convenient to import this as `request` in place of superagent.\n\t */\n\t var request = function request(method, url) {\n\t return new PromiseRequest(method, url);\n\t };\n\n\t /** Helper for making an options request */\n\t request.options = function (url) {\n\t return request('OPTIONS', url);\n\t };\n\n\t /** Helper for making a head request */\n\t request.head = function (url, data) {\n\t var req = request('HEAD', url);\n\t if (data) {\n\t req.send(data);\n\t }\n\t return req;\n\t };\n\n\t /** Helper for making a get request */\n\t request.get = function (url, data) {\n\t var req = request('GET', url);\n\t if (data) {\n\t req.query(data);\n\t }\n\t return req;\n\t };\n\n\t /** Helper for making a post request */\n\t request.post = function (url, data) {\n\t var req = request('POST', url);\n\t if (data) {\n\t req.send(data);\n\t }\n\t return req;\n\t };\n\n\t /** Helper for making a put request */\n\t request.put = function (url, data) {\n\t var req = request('PUT', url);\n\t if (data) {\n\t req.send(data);\n\t }\n\t return req;\n\t };\n\n\t /** Helper for making a patch request */\n\t request.patch = function (url, data) {\n\t var req = request('PATCH', url);\n\t if (data) {\n\t req.send(data);\n\t }\n\t return req;\n\t };\n\n\t /** Helper for making a delete request */\n\t request.del = function (url) {\n\t return request('DELETE', url);\n\t };\n\n\t // Export the request builder\n\t return request;\n\t}", "httpPost(reqObj) {\n reqObj.jar = this.jar\n return new Promise((resolve, reject) => {\n this.request.post(reqObj)\n .then(function(body) {\n resolve(body)\n })\n .catch(function(e) {\n console.log('http post failed : ' + e.message)\n console.log(reqObj)\n process.exit(1)\n })\n })\n }", "function send_access_token_request(authentication_cache, user_input, res){\n\tlet base64data = Buffer.from(`${credentials.client_id}:${credentials.client_secret}`).toString('base64');\n\tlet authorization = `Basic ${base64data}`;\n\t\n\tlet post_data = querystring.stringify({//convert js obj to query string format: grant_type=client_credentials&foo=abcn\n\t\t'grant_type':'client_credentials'\n\t});\n\tlet options = {\n\t\tmethod:'POST',\n\t\theaders:{\n\t\t\t'Content-Type':'application/x-www-form-urlencoded',\n\t\t\t'Authorization':authorization,\n\t\t\t'Content-Length':Buffer.byteLength(post_data)//find length of post_data\n\t\t}\n\t};\n\tconst token_endpoint = 'https://api.petfinder.com/v2/oauth2/token';\n\tlet auth_sent_time = new Date(); //create a new Date object which represents the current date and time as of the time of instantiation.\n\tlet authentication_req = https.request(token_endpoint, options, function (authentication_res){\n\t\treceived_authentication(authentication_cache, authentication_res, user_input, auth_sent_time, res);\n\t});\n\t\n\tauthentication_req.on('error', function(e){\n\t\tconsole.error(e);\n\t});\n\tconsole.log(\"Requesting Token\");\n\tauthentication_req.end(post_data);//because this is a POST request, querystring is placed into the body of the request\n}", "function getAuthToken( userType, result )\n{\n let dataJSON = {};\n if(userType == 'basic')\n {\n dataJSON = { \"username\": \"basic-thomas\",\n \"password\": \"sR-_pcoow-27-6PAwCD8\" };\n }\n else\n {\n dataJSON = { \"username\": \"premium-jim\",\n \"password\": \"GBLtTyq3E_UNjFnpo9m6\" };\n }\n\n let dataString = JSON.stringify(dataJSON);\n // prepare the header\n var postheaders = {\n 'Content-Type' : 'application/json',\n 'Content-Length' : Buffer.byteLength(dataString, 'utf8')\n };\n\n// the post options\nvar optionspost = {\n host : auth_server_url,\n port : auth_server_port,\n path : '/auth',\n method : 'POST',\n headers : postheaders\n};\n\nvar reqPost = http.request(optionspost, function(res) {\n res.on('data', function(d) {\n // console.log('POST result:\\n' + d);\n let tok = JSON.parse(d);\n result({status:'success', data:tok});\n });\n});\n\n// write the json data\nreqPost.write(dataString);\nreqPost.end();\nreqPost.on('error', function(e) {\n // console.log(e);\n result(null, {status:'failed', msg: e})\n});\n}", "static request(request_data) {\n const result = {\n success: false,\n body: null,\n error: null\n };\n // let request_data = {\n // url: cfg.provider.requestTokenGarmin,\n // method: 'POST',\n // }\n // const headers = {};\n // request_data.headers = headers;\n return new Promise((resolve, reject) => {\n request(request_data, function (error, response, body) {\n if (!error) {\n result.success = true;\n }\n result.body = body;\n result.error = error;\n resolve(result);\n });\n });\n }", "function passRequest(data, res) {\n var responseToClient;\n // prepare all required request options\n var options = composeRequestOptions(data);\n // make request to one of the video servers and wait promise to be resolved\n request(options)\n .then( function (response) {\n // if HTTP OK is responded\n if (response.statusCode == 200) {\n //validate body of video server's response\n responseToClient = processVideoServerResponse(response.body);\n // if the response body (from the video servers),\n // contains the desired field, mark the response (now to the client) as ok (200)\n // otherwise mark response's code to 500,\n if (responseToClient.url != null) {\n res.statusCode = 200;\n }\n else\n res.statusCode = 500;\n // if video server responds with 500 mark response-to-client's status code to 500\n // NOTE: status code may change when the function runs again trying another server\n } else if(response.statusCode == 500) {\n res.statusCode = 500;\n }\n }).catch(\n function(error) {\n console.log(\"Error happened \" + error);\n responseToClient = error;\n res.statusCode = 500;\n }\n // this executes after promise resolves regardless of error or successful response\n // evaluate response to client's status code as a means of determining\n // whether to try again or send the response to client\n ).finally(\n function () {\n count++;\n // success, send response to client and return\n if(res.statusCode == 200) {\n count = 0;\n return res.end(JSON.stringify(responseToClient));\n }\n // this round is not successful but there are other other video servers to try, recursive call\n else if(res.statusCode == 500 && count < config.videoservers.length) {\n console.log(\"trying another server \" + count);\n return passRequest(data, res);\n }\n // all servers tried but no successful response, send 500 50 client\n else\n {\n res.statusCode = 500;\n count = 0;\n return res.end(JSON.stringify(finalErrorMessage));\n }\n }\n );\n}", "function makeHttpRequest(req,reqPath,sessionInfo,res, next,queryString){\n common.prepareCommonApiManagerRequest({request:req,sessionInfo:sessionInfo,identifier:'api'})\n .then((response) => {\n proxy({\n url: response.apiUrl+reqPath,\n timeout: 120000\n })(response.request, res, next);\n }).catch((error) => {\n res.status(500).send(error);\n });\n}", "ngrokHandler(req, res) {\n // check authorization against our unique token\n const authHeader = req.headers.authorization;\n if (authHeader !== this.ngrokAuth) {\n res.statusCode = 401;\n res.end();\n return;\n }\n\n if (req.method === 'POST') {\n // agent POSTs arguments as json body\n let body = '';\n // collect full request body first\n req.on('data', chunk => {\n body += chunk.toString();\n });\n req.on('end', async () => {\n try {\n const params = JSON.parse(body);\n const id = params.$activationId;\n delete params.$activationId;\n\n if (this.argv.verbose) {\n console.log();\n console.info(`Activation: ${id}`);\n console.log(params);\n } else {\n console.info(`Activation: ${id}`);\n }\n\n const startTime = Date.now();\n\n const result = await this.invoker.run(params, id);\n\n const duration = Date.now() - startTime;\n console.info(`Completed activation ${id} in ${duration/1000.0} sec`);\n if (this.argv.verbose) {\n console.log(result);\n }\n\n res.statusCode = 200;\n res.setHeader(\"Content-Type\", \"application/json\");\n res.end(JSON.stringify(result));\n\n } catch (e) {\n console.error(e);\n res.statusCode = 400;\n res.end();\n }\n });\n } else {\n res.statusCode = 404;\n res.end();\n }\n }", "function generalPOST ( genHost, genPath, post_data, err, res )\n{\n\t// check if arg param err does not exist\n\tif (typeof(err) != \"function\")\n\t{\n\t\terr = function(e) \n\t\t{\n\t\t\tif(debug) debugLog(\"Lost connection to \" + genHost + \"removing from ring\");\n\n\t\t\ttokenRing.removeRingMember(genHost);\n\n\t\t\tprocessApproval(genHost);\n\n\t\t\tif(debug) debugLog(\"generalPOST err called \"+ e);\n\t\t};\n\t}\n\n\t// check if arg param res does not exist\n\tif (typeof(res) != \"function\")\n\t{\n\t\tres = function(r) {} ;\n\t}\n\n\tvar dataString = JSON.stringify( post_data );\n\n\tvar headers = {\n\t\t'Content-Type': 'application/json',\n\t\t'Content-Length': dataString.length\n\t};\n\n\tvar post_options = {\n\t\thost: genHost,\n\t\tport: '3000',\n\t\tpath: genPath,\n\t\tmethod: 'POST',\n\t\theaders: headers\n\t};\n\n\tvar post_request = http.request(post_options, function(res){\n\t\tres.setEncoding('utf-8');\n\t\t\n\t\tvar responseString = '';\n\n\t\tres.on('data', function(data){\n\t\t\tresponseString += data;\n\t\t});\n\n\t\tres.on('end', function(){\n\t\t\t//var resultObject = JSON.parse(responseString);\n\t\t});\n\t});\n\t\n\tpost_request.on('error', err );\n\tpost_request.write(dataString);\n\tpost_request.end();\n}", "function answerReq(rt, res, next, result) {\n\t//res.setHeader('Content-Type', 'application/json');\n\tres.setHeader('Access-Control-Allow-Origin', '*');\n\t//res.setHeader('Access-Control-Allow-Headers', 'origin, X-Requested-With, content-type, accept');\n\tres.setHeader('Access-Control-Allow-Headers', '*');\n\tres.setHeader('Access-Control-Allow-Methods', 'GET, POST');\n\t\n\t// the codes below are mostly useful for url redirect\n\tvar moveOn = true;\n\tif (result._httpCode) {\n\t\tif (result._httpHeaders)\n\t\t\tres.writeHead( result._httpCode, result._httpHeaders );\n\t\telse\n\t\t\tres.writeHead( result._httpCode );\n\n\t\tif (!result._data) {\n\t\t\tmoveOn = false;\n\t\t\tres.end();\n\t\t}\n\t}\n\t\n\tif (moveOn) {\n\t\tvar postFix = rt ? rt.ep.postFix : undefined;\n\t\tif (postFix === 'txt') {\n\t\t\tres.setHeader('content-type', 'text/plain');\n\t\t\tres.end(result.value);\n\t\t}\n\t\telse {\n\t\t\tres.setHeader('content-type', 'application/json');\n\t\t\tres.end( JSON.stringify(result) );\n\t\t}\n\t\t\n\t\t// do loggin\n\t\tif (rt) {\n\t\t\t// we don't log /api/batch...\n\t\t\tvar ep = rt.ep;\n\t\t\tif (ep.app != 'api')\n\t\t\t\tlogging(rt, result);\n\t\t}\n\t}\n\t\n\tnext();\n}", "function generalPOST ( genHost, genPath, post_data,portNum, err, res )\n{\n if( typeof(portNum) == 'undefined' )\n {\n portNum = '3000';\n if (debug) console.log(\"Using default port\");\n }\n // check if arg param err does not exist\n if (typeof(err) != \"function\")\n {\n err = function(e) \n {\n if(debug) console.log(\"Lost connection to \" + genHost + \"removing from ring\");\n\n removeRingMember(genHost);\n\n// processApproval(genHost);\n\n if(debug) console.log(\"generalPOST err called \"+ e);\n };\n }\n\n // check if arg param res does not exist\n if (typeof(res) != \"function\")\n {\n res = function(r) {} ;\n }\n\n var dataString = JSON.stringify( post_data );\n\n var headers = {\n 'Content-Type': 'application/json',\n 'Content-Length': dataString.length\n };\n\n var post_options = {\n host: genHost,\n port: portNum,\n path: genPath,\n method: 'POST',\n headers: headers\n };\n\n var post_request = http.request(post_options, function(res){\n res.setEncoding('utf-8');\n \n var responseString = '';\n\n res.on('data', function(data){\n responseString += data;\n });\n\n res.on('end', function(){\n //var resultObject = JSON.parse(responseString);\n });\n });\n \n post_request.on('error', err );\n post_request.write(dataString);\n post_request.end();\n}", "outputResponse(status) {\n this.setState({ loading: true });\n this.generateBundle().then((priorAuthBundle) => {\n /*creating token */\n const tokenPost = new XMLHttpRequest();\n var auth_response;\n var self = this;\n tokenPost.open(\"POST\", tokenUri);\n tokenPost.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n var data = `client_id=app-login&grant_type=password&username=john&password=john123`\n tokenPost.send(data);\n tokenPost.onload = function () {\n if (tokenPost.status === 200) {\n try {\n auth_response = JSON.parse(tokenPost.responseText);\n console.log(\"auth res--1243-\", auth_response);\n } catch (e) {\n const errorMsg = \"Failed to parse auth response\";\n document.body.innerText = errorMsg;\n console.error(errorMsg);\n return;\n }\n /** creating cliam */\n const Http = new XMLHttpRequest();\n // const priorAuthUrl = \"https://davinci-prior-auth.logicahealth.org/fhir/Claim/$submit\";\n // const priorAuthUrl = \"http://cmsfhir.mettles.com:8080/drfp/fhir/Claim/$submit\";\n // const priorAuthUrl = \"http://cdex.mettles.com:9000/fhir/Claim/$submit\";\n var priorAuthUrl = \"http://cdex.mettles.com/payerfhir/hapi-fhir-jpaserver/fhir/Claim/$submit\";\n if (self.props.hasOwnProperty(\"claimEndpoint\") && self.props.claimEndpoint !== null) {\n priorAuthUrl = self.props.claimEndpoint;\n }\n\t\t if(priorAuthUrl === \"http://stdrfp.mettles.com:8080/drfp/fhir/Claim/$submit\"){\n\t\t priorAuthBundle = {\n \"resourceType\":\"Bundle\",\n \"id\": \"1234567890\",\n \"type\":\"collection\",\n \"entry\":[\n {\n \"resource\":{\n \"resourceType\":\"Claim\",\n \"status\":\"active\",\n \"type\":{\n \"coding\":[\n {\n \"system\":\"http://terminology.hl7.org/CodeSystem/claim-type\",\n \"code\":\"institutional\",\n \"display\":\"Institutional\"\n }\n ]\n },\n \"subType\":{\n \"coding\":[\n {\n \"system\":\"https://www.cms.gov/codes/billtype\",\n \"code\":\"32\",\n \"display\":\"Hospital Outpatient Surgery performed in an Ambulatory ​Surgical Center\"\n }\n ]\n },\n \"use\":\"preauthorization\",\n \"patient\":{\n \"reference\":\"Patient/1\"\n },\n \"created\":\"2019-07-12\",\n \"provider\":{\n \"reference\":\"Organization/516\"\n },\n \"insurer\":{\n \"reference\":\"Organization/415\"\n },\n \"facility\":{\n \"reference\":\"Location/235\"\n },\n \"priority\":{\n \"coding\":[\n {\n \"code\":\"normal\"\n }\n ]\n },\n \"supportingInfo\":[\n {\n \"sequence\":1,\n \"category\":{\n \"coding\":[\n {\n \"system\":\"http://hl7.org/us/davinci-pas/CodeSystem/PASSupportingInfoType\",\n \"code\":\"patientEvent\"\n }\n ]\n },\n \"timingPeriod\":{\n \"start\": \"2019-01-01\",\n \"end\":\"2019-01-30\"\n }\n },\n {\n \"sequence\":2,\n \"category\":{\n \"coding\":[\n {\n \"system\":\"http://hl7.org/us/davinci-pas/CodeSystem/PASSupportingInfoType\",\n \"code\":\"additionalInformation\"\n }\n ]\n },\n \"valueReference\":{\n \"reference\":\"DocumentReference/635\"\n }\n \n }\n ],\n \"item\":[\n {\n \"sequence\":3456,\n \"productOrService\":{\n \"coding\":[\n {\n \"system\":\"http://www.ama-assn.org/go/cpt\",\n \"code\":\"G0151\",\n \"display\":\"Physical Therapy\"\n }\n ]\n },\n \"quantity\":{\n \"value\":6\n },\n \"servicedPeriod\":{\n \"start\":\"2019-01-02\",\n \"end\":\"2019-01-15\"\n }\n },\n {\n \"sequence\":3457,\n \"productOrService\":{\n \"coding\":[\n {\n \"system\":\"http://www.ama-assn.org/go/cpt\",\n \"code\":\"G0299\",\n \"display\":\"Direct skilled services of a licensed nurse (RN)\"\n }\n ]\n },\n \"quantity\":{\n \"value\":12\n },\n \"servicedPeriod\":{\n \"start\": \"2019-01-03\",\n \"end\":\"2019-01-12\"\n }\n },\n {\n \"sequence\":3458,\n \"productOrService\":{\n \"coding\":[\n {\n \"system\":\"http://www.ama-assn.org/go/cpt\",\n \"code\":\"G0496\",\n \"display\":\"LPN training and/or education of a patient or family member\"\n }\n ]\n },\n \"quantity\":{\n \"value\":1\n },\n \"servicedPeriod\":{\n \"start\":\"2019-01-13\",\n \"end\":\"2019-01-13\"\n }\n }\n ],\n \"careTeam\":[\n {\n \"sequence\":1,\n \"provider\":{\n \"reference\":\"Practitioner/386\"\n },\n \"extension\":[\n {\n \"url\":\"http://terminology.hl7.org/ValueSet/v2-0912\",\n \"valueCode\":\"AT\"\n }\n ]\n },\n {\n \"sequence\":2,\n \"provider\":{\n \"reference\":\"Practitioner/387\"\n },\n \"extension\":[\n {\n \"url\":\"http://terminology.hl7.org/ValueSet/v2-0912\",\n \"valueCode\":\"OP\"\n }\n ]\n }\n ],\n \"diagnosis\":[\n {\n \"sequence\":123,\n \"diagnosisReference\":{\n \"reference\":\"Condition/234\"\n \n }\n \n }\n ],\n \"insurance\":[\n {\n \"sequence\":1,\n \"focal\":true,\n \"coverage\":{\n \"reference\":\"Coverage/29956\"\n }\n }\n ]\n }\n },\n {\n \"resource\":{\n \"resourceType\":\"Condition\",\n \"id\":\"234\",\n \"code\":{\n \"coding\": [\n {\n \"code\":\"M6281\",\n \"system\":\"http://hl7.org/fhir/sid/icd-10-cm\",\n \"display\":\"M6281,Muscle weakness\"\n }\n ]\n \n },\n \"subject\":{\n \"reference\":\"Patient/1\"\n }\n }\n },\n {\n \"resource\":{\n \"resourceType\":\"DocumentReference\",\n \"id\":\"635\",\n \"status\":\"current\",\n \"content\":[\n {\n \"attachment\":{\n \"contentType\": \"application/pdf\",\n \"data\" : \"JVBERi0xLjcNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIvTGFuZyhlbi1VUykgL1N0cnVjdFRyZWVSb290IDE0IDAgUi9NYXJrSW5mbzw8L01hcmtlZCB0cnVlPj4vTWV0YWRhdGEgMzggMCBSL1ZpZXdlclByZWZlcmVuY2VzIDM5IDAgUj4+DQplbmRvYmoNCjIgMCBvYmoNCjw8L1R5cGUvUGFnZXMvQ291bnQgMS9LaWRzWyAzIDAgUl0gPj4NCmVuZG9iag0KMyAwIG9iag0KPDwvVHlwZS9QYWdlL1BhcmVudCAyIDAgUi9SZXNvdXJjZXM8PC9Gb250PDwvRjEgNSAwIFIvRjIgOSAwIFIvRjMgMTEgMCBSPj4vRXh0R1N0YXRlPDwvR1M3IDcgMCBSL0dTOCA4IDAgUj4+L1Byb2NTZXRbL1BERi9UZXh0L0ltYWdlQi9JbWFnZUMvSW1hZ2VJXSA+Pi9NZWRpYUJveFsgMCAwIDYxMiA4MTYuOTZdIC9Db250ZW50cyA0IDAgUi9Hcm91cDw8L1R5cGUvR3JvdXAvUy9UcmFuc3BhcmVuY3kvQ1MvRGV2aWNlUkdCPj4vVGFicy9TL1N0cnVjdFBhcmVudHMgMD4+DQplbmRvYmoNCjQgMCBvYmoNCjw8L0ZpbHRlci9GbGF0ZURlY29kZS9MZW5ndGggMjE2OD4+DQpzdHJlYW0NCnic3Vrbbts4EH0PkH/Q00LahVlRdwFFgSRNii5gNE0CLNDNPri2kxjNrbLTIvv1OzPkUJIl2o5L52EDxLAlknPhmZkzlLw3p97bt2+GRx/fe+G7d97h+yPv+/5eKEL8K2XkhV4Gn4XMRJl51XR/76/fvfv9vcOL/b03J9KTUoSJd3G1vydhaOhJL45EEiVenqYihzt3MO7Dee5dz2FZ75p+FfrXh/29v/1hkPsHwSD3j4JB6c+9oPBH90HiT4LY94LS/4KXT4NB4n8MZNwYhQMegtSfBYPCv4cf18EgoymP8KOaBv94F3/u7x2Dpp/3937RKpmUIo6bVpEx2oaBW1lpJHJpk4XGjZ49txLzUJSpTeKSLO94eOR5DeBIt8CJYyGLjhKfAhn6C9jcG7B/WgECcv8P/Bh9BbAgDn4gRqZ4aTUy8M584RwdhbSp7hodIKS0yVLocCswK0VqNW4dOKKXgyPy4F4fMmQo5MvhGb9cg9gDUWHRp0RWFn1KnEFCOgjiCPJT4c/h38OUNsOPCX5MA0QifFnQtatnHjLCSfdqnMzUtTHcfMAvFXzBf5yNFxf1qnc475EHPeDcRxZU8eKPSkLho7g7vZBSY47zBX7dPpVEPW6K0kxk2So3KWMiDFpQAaNWa/0cRLHS++AJYnUC12ZotFKSKgRaihboq9WI16KfeK+am1UuQRyspXYExlwGyru8BAp4wgVqCY9awlyt6dIxSR5jVrc4Zvsc0S8rF2Fuk4VGEijuggH4amo8SviDD6idamfgLoBNpjTmJ14kL33FyW5hw9FVZCItOxrTliltWfkqMMqh8tcEedCdL4GuV8EglgoUOFjNH7GlaiBjgeZeEaYIlmowXa29NME7at6Y4vaWvpNPKoI1CZswgOiGQSYtNpxq4JlltHZTjtmxWnSkZLHZtJ4OV1jmAr/d6GAysVHvJCcCHQzKNnYGjR/2GqS+T3jR3+w6T9mi8ynEKpnAgAE/EIBqH1yCeiDyHCNwF6jJU4T7MmqmdSCrrAnKMwhAPeOlpb260QirswIl96PWyJ+1t27hxjIQvuvU0lbBU1AwsTU1uyHZm3czcJRaseiDaBOMKj3SdtzyfSsM1f5rcJtcVz0sR/pEa1253ShIfrF1o2otp9r34xuG4DNfqoSpj25BlCCxiW26rWMXyVb8xorkLBZpuk6JX5WVijjcVFbH4NQtnYJeJ4w7SgyBS8k2lzJcBwHxo8Vlmqyo4IGA6wczr2ZFzJNsrKjwNc6ckqKQ+iubsf35lavtAWTpGBMD17pZK6lUJlfNyDGDZjF5MWMaHmCmfgld+oVGuzca0wR9ZHGVY5qU5iIubbIMTUJn9FIlDSN2jgbXzhhkGmciLl7HNRyeSSjybo5YzSBVEbQxyDrZo5uuDJbWRMEJrn2C387Jz+tpkob/ENENcwZZhxAUbTogs83owNAZF6Cf06U2qK7nTRUe9Co0pY06ynttWtClqIYbqM6rww8eue7vhqFFpYi6mG0Wd+d1HYO7sIpeV+Yyt2VO5tj8vVSJ3K0SYSZkl+EgmI/PECsXxBEbeQ1AMzE9x+nxGYXTtnvUp5mUEXGvfs22x0O/LCB40iZrbAgDmb2omIli6JvDmHkdcIUhq3MKzQY72e6UBkbaCInz2IhlIvLM5ov+7rLRF+u6X5hB95xLNAfRuYzmHuP1qqpbz7NmRq0z/EWrH2v0bHV/r1tJAKkBbO7vqKlMy0Rk3dI37qFTNZVa6tFGbM0TO6xOuHX50Y1Y0czBOiNb+QcXD6/pJvbkorN/Pd3+8rmD0eKai9DdqvOG0+bY9oHJ8QabPex3T4+ZetdR11OCEmWhXW16Qb3g/3bTNVkyvMG+6TroOc7c9p+JKDKbr133ujk+0rLI6vCoU2XvcCP2to6bDWTSZbtUYBt4AWlLpFdxv12AO5ci65IQ65HR6sMY5zVJygL3yKLlOqpUuHvOlKbFBmyko0HplKylSSaSrhu+KCgBgO55i3Q6Zn5xzWxjpMkE3f9opiwIc2YU0ZSFeRx11KBBeGMVDYIVL5VCp4iZj5wz8C7m52Wyc/VgTmaMXm1u1K/7rKl7wYNUWjO6w5Cfyjd6iW+BaaEg0G5acoitXeO3G+NPuraghRY3tW9ZNNUw0qQmibtoWsIEn+5adl+XYTAdlXtu1AE+tjVt+Mykm2cV0LtIKHEsyp5qaSrgdEUO5GJmEicXwrE5mDdpWR9ej3SeNdc7py8Lvvpt2hzzqP9Nwa1m+vSgQ0x0be88IBJuDwTzUMSZzYFrX7jY4lWdValGxqJLdM+fVHxyFN/yrtQNCjpcVSzmiZpycPsz1qF8aw6G+AHwD0496lyIbx9xhN67bf3KXEhpMdSS4xq883yIah/ptOYaB5lFL7cHehE+fo4solwblRG4e0X1pStNjOks8HnVI8f6MFAjx+3Zc5xH+Lz8NbYjzlOQ0S/pxHQWbkWWITa0r2JdCWDLbYml/4FxK+JOzC6f86MIXdNcdE+7KIWhFGHUsfWS6hWXKFLUenbe6u46ncnyyzIbmar9ZhqVijsVbPcMq1/qHK2vPHB30z7gbpzzF0vviZhdou2dz53m9DiNRGl1vNujwzhNRRG9lqxMpJva1aUGW7yMuYIaJAXkjK4Wn3F3nxint5otNbk4NQONp7H6hTZ+btvmEDTjEw+8rvHP6/7bx74b6eKzaXE+8YngoP/VOj6OmhlKY5qCEVOXFlFR7+tVHb25saDBh2yfOlYrGgLVS2i42uEO+EMS5kggLdvUeFGHnLYcnxT4z5xCbQ/mmPvU9+tzEJLQe1TLaUe9+bSDjJtkvS+3mXbC2N1oQobvA9cNG3heFlZtHJ+QQHOYpBvK6qaGLV7FXZUakhwJ5SZa/Ac+9s0zDQplbmRzdHJlYW0NCmVuZG9iag0KNSAwIG9iag0KPDwvVHlwZS9Gb250L1N1YnR5cGUvVHJ1ZVR5cGUvTmFtZS9GMS9CYXNlRm9udC9CQ0RFRUUrQ2FsaWJyaS9FbmNvZGluZy9XaW5BbnNpRW5jb2RpbmcvRm9udERlc2NyaXB0b3IgNiAwIFIvRmlyc3RDaGFyIDMyL0xhc3RDaGFyIDEyMS9XaWR0aHMgMzQgMCBSPj4NCmVuZG9iag0KNiAwIG9iag0KPDwvVHlwZS9Gb250RGVzY3JpcHRvci9Gb250TmFtZS9CQ0RFRUUrQ2FsaWJyaS9GbGFncyAzMi9JdGFsaWNBbmdsZSAwL0FzY2VudCA3NTAvRGVzY2VudCAtMjUwL0NhcEhlaWdodCA3NTAvQXZnV2lkdGggNTIxL01heFdpZHRoIDE3NDMvRm9udFdlaWdodCA0MDAvWEhlaWdodCAyNTAvU3RlbVYgNTIvRm9udEJCb3hbIC01MDMgLTI1MCAxMjQwIDc1MF0gL0ZvbnRGaWxlMiAzNSAwIFI+Pg0KZW5kb2JqDQo3IDAgb2JqDQo8PC9UeXBlL0V4dEdTdGF0ZS9CTS9Ob3JtYWwvY2EgMT4+DQplbmRvYmoNCjggMCBvYmoNCjw8L1R5cGUvRXh0R1N0YXRlL0JNL05vcm1hbC9DQSAxPj4NCmVuZG9iag0KOSAwIG9iag0KPDwvVHlwZS9Gb250L1N1YnR5cGUvVHJ1ZVR5cGUvTmFtZS9GMi9CYXNlRm9udC9BcmlhbE1UL0VuY29kaW5nL1dpbkFuc2lFbmNvZGluZy9Gb250RGVzY3JpcHRvciAxMCAwIFIvRmlyc3RDaGFyIDMyL0xhc3RDaGFyIDEyMS9XaWR0aHMgMzYgMCBSPj4NCmVuZG9iag0KMTAgMCBvYmoNCjw8L1R5cGUvRm9udERlc2NyaXB0b3IvRm9udE5hbWUvQXJpYWxNVC9GbGFncyAzMi9JdGFsaWNBbmdsZSAwL0FzY2VudCA5MDUvRGVzY2VudCAtMjEwL0NhcEhlaWdodCA3MjgvQXZnV2lkdGggNDQxL01heFdpZHRoIDI2NjUvRm9udFdlaWdodCA0MDAvWEhlaWdodCAyNTAvTGVhZGluZyAzMy9TdGVtViA0NC9Gb250QkJveFsgLTY2NSAtMjEwIDIwMDAgNzI4XSA+Pg0KZW5kb2JqDQoxMSAwIG9iag0KPDwvVHlwZS9Gb250L1N1YnR5cGUvVHJ1ZVR5cGUvTmFtZS9GMy9CYXNlRm9udC9BcmlhbC1Cb2xkTVQvRW5jb2RpbmcvV2luQW5zaUVuY29kaW5nL0ZvbnREZXNjcmlwdG9yIDEyIDAgUi9GaXJzdENoYXIgMzIvTGFzdENoYXIgMTIyL1dpZHRocyAzNyAwIFI+Pg0KZW5kb2JqDQoxMiAwIG9iag0KPDwvVHlwZS9Gb250RGVzY3JpcHRvci9Gb250TmFtZS9BcmlhbC1Cb2xkTVQvRmxhZ3MgMzIvSXRhbGljQW5nbGUgMC9Bc2NlbnQgOTA1L0Rlc2NlbnQgLTIxMC9DYXBIZWlnaHQgNzI4L0F2Z1dpZHRoIDQ3OS9NYXhXaWR0aCAyNjI4L0ZvbnRXZWlnaHQgNzAwL1hIZWlnaHQgMjUwL0xlYWRpbmcgMzMvU3RlbVYgNDcvRm9udEJCb3hbIC02MjggLTIxMCAyMDAwIDcyOF0gPj4NCmVuZG9iag0KMTMgMCBvYmoNCjw8L0F1dGhvcihEZWVwdGhpIFJlZGR5KSAvQ3JlYXRvcij+/wBNAGkAYwByAG8AcwBvAGYAdACuACAAVwBvAHIAZAAgAGYAbwByACAATwBmAGYAaQBjAGUAIAAzADYANSkgL0NyZWF0aW9uRGF0ZShEOjIwMTkwNDIyMTUyNTQxLTA3JzAwJykgL01vZERhdGUoRDoyMDE5MDQyMjE1MjU0MS0wNycwMCcpIC9Qcm9kdWNlcij+/wBNAGkAYwByAG8AcwBvAGYAdACuACAAVwBvAHIAZAAgAGYAbwByACAATwBmAGYAaQBjAGUAIAAzADYANSkgPj4NCmVuZG9iag0KMjEgMCBvYmoNCjw8L1R5cGUvT2JqU3RtL04gMTkvRmlyc3QgMTMzL0ZpbHRlci9GbGF0ZURlY29kZS9MZW5ndGggNDIxPj4NCnN0cmVhbQ0KeJy1VMtq6zAQ3Rf6D/MHell+QCmUPriX0hDiQBehCzWZm5jaVlEUaP/+zkQudaGLOtCNz5nRnKOx5LGqQILWYBVoA0pq0Bkoa0Bb0DIDnRMjWoCRREswtgBdQSaJSshsBUaRWoIhk1yDMZArsighz3MgVko2hLKyoCihqFwVhJbMJWFewcWFmLNCwkLUYi6W768o6hgO63jbYifuVyCfQMy3YLjm8vL87AcSNV2ip0vMdEk2XWKnS/LpkmK6pJwuqU64ylOu/4T7V99/ANmgufHrQ4d9/FbKg7TgUTqCSZAlsAnyBEWCMkHS0SwdQSVILubo8gRDJ6NdlwFx4X0UC9/ig3vlCeMe5y5Qf7zKw8YZbq1MNqPVGb7Fe3wHNVjfkVfvI4oZP277zWewpNJn/yZqXEfxB90GQ+Ks+eB/+7bpsd457pATVz05uNj4fohDbP45Isfo0YeXZ+9fPk+UM/sdYuQmo3hw6+BH8fWOnqP4pnGt344SddtscFSb9qGybXCduGu2h4DDu84O3X7Ffz355XRnrsP9KoW/e53nZ/8BwfFz9Q0KZW5kc3RyZWFtDQplbmRvYmoNCjM0IDAgb2JqDQpbIDIyNiAwIDAgMCAwIDAgMCAwIDAgMCAwIDQ5OCAwIDMwNiAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDU3OSAwIDUzMyAwIDAgMCAwIDAgMjUyIDAgMCAwIDg1NSAwIDY2MiA1MTcgMCAwIDAgMCAwIDAgMCAwIDAgNDY4IDAgMCAwIDAgMCAwIDQ3OSA1MjUgMCA1MjUgNDk4IDAgNDcxIDUyNSAyMzAgMCAwIDAgMCA1MjUgNTI3IDUyNSAwIDM0OSAzOTEgMzM1IDAgNDUyIDAgMCA0NTNdIA0KZW5kb2JqDQozNSAwIG9iag0KPDwvRmlsdGVyL0ZsYXRlRGVjb2RlL0xlbmd0aCAzMTY2MS9MZW5ndGgxIDEwMDQyMD4+DQpzdHJlYW0NCnic7H0HXFRX2v45984MAzMDAwx1gBkcAXVUVCxYIiPNXhBGARtIEQ0qYo2VFDUhMU3Tm2lmE1OGQSOaZnrvplfTNruJKZu6Jsr/Ofedg+CqX7Lly7f/37zwzPOc95zz3tPvIYsL44wxKz50rKIgN7+ENZQsYLxyCmPGDwtyJ+SNyD6Yy/isHijQY3Jx5oCrHp61mzF+LmpVVC2sbPj+vO+GMTZ/FfKbq1Ysc+5teHMQY9uTGNPfX9swb+H699UhjC3SMWZxz6s/o1ap5ecxduubjBW9X1dTWf3TJT89gHhmxBtcB4flrqRDSOcj3b1u4bJVg593ZiP9OWPzLqxfXFV51uzLGxn7qY2xgdkLK1c19D6ajrbxOpR3LqxZVvnuzUmTGV/QT7RvUeXCmvMeeWwI4+5vGOsf07B46bJ2O9uE/hhF+YbGmoboed0SGFuD8t2/YGIsDIMezfo0et+ciBE/sARRjLH7vlj7nODXtxxe/cvhI02hXxoHIxnKFEaGegZ2lPHHwrb/cvjw9tAvtUidLOFO4Um0s63MylYxFTWtLJNtZixqMJ6rIFfVufnFTM+M+qv0WQiZQqy+xDYpzMiUCL2iKDpV0X3IerXvZ93XaC2ATSx2OpmHsbTnqA0h1yvpTsbbRZ66Rx8uespsuvBjreEvYrZuZC72T5gun1X+M/X+FVN07M5/d0zDGyePqZ/Aqn5PLF23f3/7/p2mPsSGd0l/j9X3O02nYzeqz7KFJ8yrYTd2id/UNX3KuGex+n/wrTpWn3956ljIj/ytz5JmMLAbdZecOK7uDlb7e2Kpjx+Lox46bhwms7EnrFPGkn7PM7rUPcJST5p39j/Oqzqf5XdJv8Zm/t5n6gayq35H2Youz/uFzfq9z/u/aOpjbNDxvuP7GvB1jBV/nW38n+KizG8e2xPZqeZGl83K/9lYyjNd46qprOhEdfR3d/Urd//j+tQtP/ma7VxGH03lDG/9z+V/S5nOpl7Hup0074aT553IlDtZvvIpnVvgMUobG63pK1gv5S+snlf94ztS+YzVAwWyHv8R6X4sl39M72FlI3N0lN10TP//bFj7jL/wR7ciaEELWtDIlGt42EnzKtih/822nLANS/EOAf7odnQ2dRA7/49uQ9BObcpfT3x/+0/X/SNN/ZUV/tFtCFrQ/ltM9/Dv+28fJzLlB/pvG6rhxD978h3swi7PXEhpdTkrV97smnfSZ7SxKf9iM4MWtKAFLWhBC1rQgha0oAUtaP8FJn/GPJWd7OdMYeJnTS3Ob/x5M2hBC1rQgha0oAUtaEELWtCCFrSgBS1o/3nj/9JvyQctaEELWtCCFrSgBS1oQQta0IIWtKAFLWhBC1rQgha0oAUtaEELWtCCFrSgBS1oQQta0IIWtKAFLWhBC1rQgha0oAXt32ft+/7oFvwvmRpAEv21IF6KFJQ6ien4CDhymYfptb8xZGHdmJv1YaNYHhvLJrIprJzNZTVsPmtgy9gKdgbbzu7i/ZN7Jw9KHpo8InmkM9Rpda52bnA2pz3Xrv0lIMRwdokxGTEqWTWbxxaxxt8Qg7f/wJguSi1of7T9xfbP2n9CzLRjneHj+KT2KuVxNuiLzfLrUMbHcz/edLDy440fnBb4i0gju4zAYA3ZbBj8ub9lxNRx6hVsPJvOFR7BE3kKn8LL+Sy+gq/j5/EL+MX8ambgP2plfzz+bzAhrQT+YpPCTm2809OOM91pyGj8DW3VCgNRndKZARZ/kQW9OEGNDV2agV7iE/3Ep9bTjhytx2DqM+P7Ne+Tv7Fdf5yp/4mgvDa4Y05iv2XHME/5po3LljYuaVi8aGH96Qvm182rrameO2f2rJkzystKvSXFU4umTJ40ccL4cWPHjC4syM/LHeXJGXnaiOHDhmYPGTwos2+f3j3S07q7ujnibZHWCIspLNQYYtDrVIWz3gWuwgqnL73Cp0t3jRnTR6RdlXBUdnJU+JxwFXYt43NWaMWcXUt6ULL2uJIeKunpKMmtzhFsRJ/ezgKX0/d8vsvZxsuLSqG35LvKnL5Dmp6oaV26lrAgkZqKGs6C+Lp8p49XOAt8hSvqmgsq8hGvxRSW58qrCevTm7WEmSBNUL4eroYW3mMk14TSo2BYi8KMFvFYn5pWUFntm1JUWpBvT00t03wsT4vlM+T5QrRYzvmizex8Z0vv/c0XtFnZ3Aq3udpVXTmz1KdWolKzWtDcvNkX6fb1dOX7eq7+JB5drvH1duUX+NwuBBs/teMB3KdPs7qczT8wNN516MuunsqAx5Bm/YEJKbrYMUzIl5qhbWgh+peaKtpyfpuHzUXC11RUSmknm2v3M0+mu8ynVIic/TInxitymmROR/UKV6qYqoKKwPeKunhf01xnn94Yfe07Dd/Id/rU9Iq5VXWCK2uaXfn5NG4lpT5PPoSnMtDXgpZ+mShfWYFOzBfDUFTqy3Q1+GyuXCoAh1PMwfziUq1KoJrPludjFVWBWr7MgnzRLmdBc0U+NVDEchWV7mVZ7R+2DHTaW7PYQFYm2uGLzcOkpBc0l1bX+hwV9mqsz1pnqT3V5ynD8JW5SmvKxCy5rL6eH+JxqdoTtVro23GlZWHR85A0o7NUsatlYrbgcBbiw5U7AhlWTJeWFDOaO8JZyu1MFsNTAiWE6hIHCTUtb4zIUkXVvDH21LJUslM0yR5okz7NZ+wUywpHR5voOSdtGpUWDerpLKjJ79TALkH1gQYGop24nYoYi8CDUcMopnOMzFLTsHPhUxBGc4lZjHf62BRnqavGVebCGvJMKRV9E2Otze/4Ytf4ovJSbbYDq6SkS4rysynlY6nIlgklD2uw0G2X06qlR2vpjuSY47LHymyXaFdzc3ULU9PEUra3cE3o884v8012l7l8c92uVNHOPr1bjMycWlKRh71aiOPOVVjpwkulsLmyrb1pbnOLx9PcUFBRNwz7otk1trrZVVw6wq41fmrpOvtq8ewoNp6PL8lFKIXltrj4uUUtHn5ucXnpXitjznNLSv0KV/IqcstauiOvdK8TLwDNqwivcIqEUyREpKlIGLXy9r0expq0XJ3m0NJVbZxpPqP0cVbVppDPSg9K1x7kwZu5qk1HOR5ZWgefkXxNVLpHoLQROVaRs4/hRcK0TLIWJgbYE6b3GD2hHrNiUTCkwuWHZx/KhnLWauYWbm9BzKmau403tYR67Hu1SFMDJZtQUviaOnxouSjWKRCeRx33HuuBt7y01cwQX/tEiVxhWIXxdVhDeJ8UOKvF+ltbVtdcUSZODxaLtYpv7uOukcynuEaixQazL8xVk+szuXKFP0f4c8hvEP4QrHweyzHZ4tBtrnDhIMaOKWV2TntNFSGdbe3tJaWpz9sPlaViL80Eykt9oW683PRp41ButEAF3KN9TVWVoh3MWyrqhqSNrSrDvpQBUWSsLxQRQgMRUKJQqyP2GypVYa1VujQJN46OpjJfmVs8tHR+mbZfrT42xjXMZ0inmPp08aDMsuYo1wDt8MFeD0vbLCgUbWPFpeSxI4mHldEghZjR8ioXsqoqnLRGirGX6WURZidPDc58XXqNhjB7IJOJbqlpJkuYL7QvAuJbaFNfcebo00LKyqjxWmpzoACebfWZ0KL0TkMZqIDRQdZY0RZ8b0ZTRdGHRZiiNjbVtQpHp2i0FikE2T5L2thKvN2ovgkeV7asbBSHoCkQ4zHyhoiemzHuOBLa2m9znZHayXB2iLefWH/MvhcblZU1H+/wzXD36W083mvR3M3NRsuJK9B4GS0drDmVtCrxVgCLBaetN2eBeFW6xrUok9wac42bx7nwBlHSBHDRUbF9Up3VZaIUmjxFO8tOWoh3KiRe01rwZutwmeKBFE1ms29e12RdR7JQAJfBtL50h0BXxFmLtbLA7qvHypRFxIw4m51W1zCX+NAqjxaowCR1bAssf6w6sWmaqpylc7HYEbCwormwWVxRqyoDwxZ4km+Ru0tI7AuOxYNAoju+pinOijJnBa6mvKg0NdWO3Qh21uKe6qoUr4Ip1J8p5dpVpbJZLHGGm0qZ3ReCF1NtZY0rFW8QnziBaPRFG3WBbcPszc2uZp+2bwtRGOHTse3GCsJ3g9tVWSOu0LXiBl2j1S1Ec7XREdHsBS7s5Rq4tbHEwOHomys+qprFBX1WhRsjEdkc1ewc2owjeBbeHrr0qmkVeFWJN5JTm+pKO1IYhLEiVYZAVDA0TRSkLSBas9DdMisk7ZhH+17spsJGLSpaNrXUN0UW0faTEEvcPiUuG5mi83xqeak8p1SRPRbD68GqsovaTp9SUhqYHq3+WFHVLieMqsGjvUMC+6vjbSPfQzPtGNOT+vFyUEcVK08pT+CHMIfyZIDfY9nK28yrvAV+A/xmgF8HvwY+AH4V/Ar4ZfBD4AfBD4DvZ16mU95hA4ESQO1Q1cAtwAFAz05HJM5MqM+ZTXmE5QPVwDJgG6BH2QeRdwsicuZUztkVGs/HYULPluIsKc6UokmKDVKsl2KdFGulWCPFainOkGKVFCulWCHFcimWSbFUiiVSNEixWIpFUiyUol6K06VYIMV8KeqkmCdFrRQ1UlRLUSXFXCkqpaiQYo4Us6WYJcVMKWZIUS5FmRSlUkyXYpoUXilKpCiWYqoURVJMkWKyFJOkmCjFBCnGSzFOirFSjJFitBSFUhRIkS9FnhS5UoySwiNFjhQjpThNihFSDJdimBRDpciWYogUg6UYJMVAKbKkGCBFfyn6SZEpRV8p+kjRWwq3FL2k6ClFDykypEiXIk2K7lK4pOgmRaoUTikcUqRIkSxFkhR2KRKlSJAiXoo4KWKliJHCJkW0FFFSREphlSJCinApLFKYpTBJESZFqBRGKUKkMEihl0InhSqFIgWXggUEb5fiqBRHpPhVil+kOCzF36X4WYqfpPhRih+k+F6K76T4mxTfSvGNFF9L8ZUUh6T4UoovpPirFH+R4nMp/izFZ1J8KsUnUnwsxUdSHJTiQyk+kOJ9Kd6T4l0p3pHibSnekuJNKd6Q4nUpXpPigBSvSvGKFC9L8ZIUL0rxghTPS/GcFM9K8YwUT0vxlBRPSvGEFI9L8ZgUj0rxiBQPS7FfioekeFCKB6S4X4r7pNgnxV4p2qTYI8W9UuyWYpcUrVL4pWiRwifFPVLcLcVdUtwpxU4p7pDidin+JMVtUuyQ4lYpbpHiZilukuJGKbZLcYMU10txnRTXSnGNFFdLcZUUV0pxhRSXS3GZFNuk2CrFpVJcIsXFUlwkxYVSbJHiAinOl6JZivOkOFeKzVJskmKjFPLaw+W1h8trD5fXHi6vPVxee7i89nB57eHy2sPltYfLaw+X1x4urz1cXnu4vPZwee3h8trD5bWHN0oh7z9c3n+4vP9wef/h8v7D5f2Hy/sPl/cfLu8/XN5/uLz/cHn/4fL+w+X9h8v7D5f3Hy7vP1zef7i8/3B5/+Hy/sPl/YfL+w+X9x8u7z9c3n+4vP9wef/h8v7D5f2Hy/sPl/cfLq89XF57uLz2cHnb4fK2w+Vth8vbDpe3HS5vO1zedri87XB52+F5rUK0Kef4U0Y6cGf2p8SAzqLUmf6UYaAmSm0gWu9PMYPWUWot0Rqi1URn+JNHgVb5k/NAK4lWEC2nvGWUWkrUSM4l/uRcUAPRYqJFVGQhUT3R6f6kAtACovlEdUTziGr9SfmgGkpVE1URzSWqJKogmkM0m+rNotRMohlE5URlRKVE04mmEXmJSoiKiaYSFRFNIZpMNIloItEEovFE4/z2saCxRGP89nGg0USFfvt4UIHfPgGUT5RHlEt5o6iehyiH6o0kOo1oBJUcTjSMqg8lyiYaQjSYaBAFG0iURVEGEPUn6kfBMon6Ur0+RL2J3ES9iHoS9SDKoNDpRGkUszuRi6gbhU4lclI9B1EKUTJREpGdKNGfOAmUQBTvT5wMiiOKJWcMkY2c0URRRJGUZyWKIGc4kYXITHkmojCiUMozEoUQGfwJU0B6f0IRSEekklOhFCdiGvF2oqNaEX6EUr8S/UJ0mPL+TqmfiX4i+pHoB398Ceh7f3wx6DtK/Y3oW6JvKO9rSn1FdIjoS8r7guiv5PwL0edEfyb6jIp8SqlPKPUxpT4iOkj0IeV9QPQ+Od8jepfoHaK3qchblHqT6A1/3HTQ6/64aaDXiA6Q81WiV4heJnqJirxI9AI5nyd6juhZomeoyNNET5HzSaIniB4neozoUSr5CKUeJtpP9BDlPUj0ADnvJ7qPaB/RXqI2KrmHUvcS7SbaRdTqj80B+f2xM0AtRD6ie4juJrqL6E6inUR3+GNxXvPbKcqfiG6jvB1EtxLdQnQz0U1ENxJtJ7qBgl1PUa4jupbyriG6mugqoiupwhWUupzoMqJtlLeVolxKdAnlXUx0EdGFRFuILqCS51Oqmeg8onOJNhNt8sdUgjb6Y+aCziE62x9TCzqL6Ex/jBfU5I/BYcw3+GMGg9YTraPqa6neGqLV/phq0BlUfRXRSqIVRMuJlhEtpdCNVH0JUYM/pgq0mIItopILieqJTidaQDSf6tURzaOW1VL1GqJqKllFNJeokqiCaA7RbOr0LGrZTKIZ1OlyCl1GDyolmk7NnUYP8lKUEqJioqlERX6bBzTFbxNPmOy3ieU9yW87GzTRb+sDmkBFxhON89twL+BjKTWGaDQ5C/229aACv20zKN9v2wDK89uaQLn+qELQKCIPUQ7RSH8U3u/8NEqN8EeWgYYTDfNHiqUxlCjbHzkaNMQfWQoa7I8sBw2ivIFEWf7I3qABVLK/P1J0rJ8/UuzNTKK+VL0PPaE3kZuC9SLqScF6EGUQpROl+SPFKHUnclHMbhQzlYI5KYqDKIXqJRMlEdmJEokS/NZZoHi/dTYozm+dA4oliiGyEUUTRVGFSKpgJWcEUTiRhchMJU1UMoycoURGohAiA5XUU0kdOVUihYgTMU97xFyHwNGIKseRiGrHr9C/AIeBv8P3M3w/AT8CPwDfw/8d8DfkfYv0N8DXwFfAIfi/BL5A3l+R/gvwOfBn4LPweY5Pw+scnwAfAx8BB+H7EPwB8D7wHtLvgt8B3gbeAt60nO54w9Lf8Tr4NUu944Al3fEq8Ar0yxa34yXgReAF5D8P33OWhY5noZ+Bfhr6KcsCx5OW+Y4nLHWOxy3zHI+h7qOI9wjwMOBp34/Ph4AHgQfMSxz3mxsd95mXOvaZlzn2Am3AHvjvBXYjbxfyWuHzAy2AD7jHdIbjbtNqx12mtY47TescO03rHXcAtwN/Am4DdgC3mvo4bgHfDNyEOjeCt5tOd9wAfT30dcC10Ncg1tWIdRViXQnfFcDlwGXANmArcCnqXYJ4F4dNclwUNtlxYdg8x5awWx0XhN3m2KimOc5Rsx1n82zHWd4m75k7m7wbvOu863eu85rWcdM6+7rx69as27nunXWeKEPYWu9q75qdq71neFd6V+1c6d2nbGK1ykbPCO+Kncu9uuW25cuWq98v5zuX8/zlvN9yrrDl1uXO5ap5mbfRu3Rno5c1TmlsavQ16ob7Gj9sVFgjD2tr39/aaE8pBHvWNlqshUu8i70NOxd7F9Uu9C5AA+dnz/PW7Zznrc2u9tbsrPZWZc/1VmZXeOdkz/LO3jnLOzO73DtjZ7m3LLvUOx3lp2WXeL07S7zF2UXeqTuLvJOzJ3knwT8xe7x3ws7x3nHZY7xjd47xjs4u9Bag8yzJmuRMUq2iAZOS0BJm57n97B77h/Zv7Dpm99n329WoiERHotIzIoHnTU7gixM2JFyUoEbEvxiveOJ79i6MiHsx7oO4r+N00Z64nn0LWaw11hmrxoi+xU4sKdQ4J5+4/yCtr45YV3phRAyPiHHEKAVfx/BNTOVOzhm3glQjyuziMY5C9QEufiFPzzi/mJW4x7cZ2dTxPuOUGT5+ri+tWHx6isp9hnN9zFs+o7SF8wvLtN9J8NnEL5Vo6Y1btrDk3PG+5OJSv7p9e3Ju2Xhfk9Aej6bbhWYoUuaevXT5Unep5zQW+WHkN5FqzEPWF61KRASPiGiPUDwRaHxEuCNcER/t4aonvP+QwgiLw6KIj3aLGuuxwCP6l2GeUlIYYXKYFG+OabJJ8Zhy8go9pj79Cv+hn62in/Rk97LZ+Ji9dJlb+0aqjC8XSbfwiu+ly5AWX8u1NHOf0qgYaM5S2DLpXHbqWv/Xjf/RDfjvN/pNnlHtyjmsWjkbOAs4E2gCNgDrgXXAWmANsBo4A1gFrARWAMuBZcBSYAnQACwGFgELgXrgdGABMB+oA+YBtUANUA1UAXOBSqACmAPMBmYBM4EZQDlQBpQC04FpgBcoAYqBqUARMAWYDEwCJgITgPHAOGAsMAYYDRQCBUA+kAfkAqMAD5ADjAROA0YAw4FhwFAgGxgCDAYGAQOBLGAA0B/oB2QCfYE+QG/ADfQCegI9gAwgHUgDugMuoBuQCjgBB5ACJANJgB1IBBKAeCAOiAViABsQDUQBkYAViADCAQtgBkxAGBAKGIEQwADoAd2odnyqgAJwgLFqDh8/ChwBfgV+AQ4Dfwd+Bn4CfgR+AL4HvgP+BnwLfAN8DXwFHAK+BL4A/gr8Bfgc+DPwGfAp8AnwMfARcBD4EPgAeB94D3gXeAd4G3gLeBN4A3gdeA04ALwKvAK8DLwEvAi8ADwPPAc8CzwDPA08BTwJPAE8DjwGPAo8AjwM7AceAh4EHgDuB+4D9gF7gTZgD3AvsBvYBbQCfqAF8AH3AHcDdwF3AjuBO4DbgT8BtwE7gFuBW4CbgZuAG4HtwA3A9cB1wLXANcDVwFXAlcAVwOXAZcA2YCtwKXAJcDFwEXAhsAW4ADgfaAbOA84FNgObgI2selQTx/7n2P8c+59j/3Psf479z7H/OfY/x/7n2P8c+59j/3Psf479z7H/OfY/x/7n2P+8EcAZwHEGcJwBHGcAxxnAcQZwnAEcZwDHGcBxBnCcARxnAMcZwHEGcJwBHGcAxxnAcQZwnAEcZwDHGcBxBnCcARxnAMcZwHEGcJwBHGcAxxnAcQZwnAEcZwDH/ufY/xz7n2Pvc+x9jr3Psfc59j7H3ufY+xx7n2Pvc+z9P/oc/i+3sj+6Af/lxpYu7XQxExY/ZzZjLOR6xo5u7fIvSqawBWwpa8LXJraFbWUPsXfYXHY21FVsO9vBbmc+9jB7mr3xG/51ym+2o2foFzKzuocZWDRj7YfbDx3dAbTpwzt5tiIVrXMe87Rb2786zvfV0a3t1qNthigWptW1KK/A+x0/0n4Yr1yk2weLtLIZOkKr8W3I9UfvOXrbcWNQxMrZDDaTzWIVrBL9r2Z1bD5G5nRWzxayRVpqEfLEvxWqRWoOSuF40fSxUotZA9DIlrHlbAW+GqCXBlIib4mWXs5W4msVO4OtZmvYWrYu8LlS86xFzmotvQpYzzZgZs5kZ2lKMnnOZuewjZi1zexcdt4pU+d1qGZ2PrsA83whu+ikekuX1MX4uoRdivWwjV3GLmdXYl1cw649znuF5r+aXc9uwJoReZfBc4OmRO797Am2m93N7mH3amNZhVGjEZHjUquNYQPGYC16eHanFtP4rewYrfXou+hbc6Cnq+A/q1ONFYFxFCXPRkmKQvMgoqw7biQuRh9IH+sRpS7T+n/M23lUTuWV43Ftp5G5RksJdbz3ZPpydh124I34FKMq1E3QpG7QdGf/9R1lt2vpm9kt7FbMxW2akkyeHdC3sT9hb9/BdrI78XVMd1bEd7O7tJnzsRbmZ61sF2byXraHtWn+U+WdyN8a8Ps7PHvZPnYfVsiDbD9OmkfwJT0PwPdQwPuY5qP0I+xRpEUpSj3BnsQJ9Qx7lj3HXmSPI/WC9vkUUi+xV9ir7A1ugXqZ/QWfR9hL+k9YOBuFH//3YZyvZbPZ7H/n6Xa86RNZDNve/nP7yvaf1TGslpfgAnknZmkXuwA/sS86VpI7WJjuI2Zju9p/VGeCexx5W1939Kb2r5kep+ZS9RWccioLYUPZRDaJXeHb6C69n1lwS4llw/ju3TH5+cY+IQ/iBqIwJ+4wRsZ5nidCp1j2JCbmuPYMMmxRI8e28T67ckK24Haec+T9Iy9kHnn/UNTQzEM8872D7x+0fvtC5NDMrIMHDvbvZ/fYEi176lF1kGtP/SDVsKVejcwR9T2h9TkeJWRLPYLE57gTX3C/kOl+wY0w7n79y3hkaqQGW7gSEmIzuLr1VQZlpA/OyhowUhk0MN3VLVzRfAMHDxmpZg1IUVSb9IxURJqrr/xark4+YlDWu3KmZelTEiNsFoNeSYqP6jMizVo8I21E3+QQNcSg6o0hPYbkdhtfX9Dt7ZDI5JjY5CijMSo5NiY5MuTIO/rww3/Th/+Sp6v/ZZtqGD4zp7t6ZZhR0RkMbSnxCb2Gp46dFhFt1ZmirZGxxpCoSHOP/JlHNsUkiRhJMTEU68hEDKer/bBuvd7GurF09q4Y972se/vnu8xWPsHVFhDpbe3f7DJBmKQIg/AkCpVmFZ8W7dOsfXp68DSR3dvEJ3Z3pad9bzaZ47slu8IsPFZnZmarWbnH9ZDrRZfqMrvMUclTo7x6L8vJyYkaOjQzc9asyLihkZCRWdZDAyKz+vfj7lmBt7/bbfekIKQ57fv6zjE7x4mXgTrCuBEFk5cWG2vQZixDTVXDVVe39PTBQzhNU1yIS03VLTdya5rDkRYdqlt85LMFali0Kyk5LYIbuV9nSchIcfZKDNet4R/wR06LtYfr1BBzKB9+9OlQS6hOH26P1flN4UZVNUaYthxZwzirbP9GZ9anYE1r67k1iQ13Y0RbrXwi+JvWCI2/bLVo/FWrWePPWzFs7gfxg3I4i+eZLJWl897+6GLdfbwXG8T68b4todOwwA8cEuCZB7Whsb7+GJZ1S2p8G89srU+NTm/jvXfVRxcP0rXxXq31g0L7if9hox41saofcwuIIbGFGzqtTkNMYLWKdRxjS1HEshbDozMreqPNM2fN2PXPXjSx+PKXN2QvKC+0G/Wqzmgyhg+YvGTytC3VQwZVXTxj4tKigREhYQZ1jzU+KtzWM8Necsu319346z0zY5y97OHRiVG2pOjQjMyMgk0Pr13zwIZR6ZnphkjxD8fZne2HeSlWYgyrFOO1Jyductw9cSoLjBkLjJnGFo1/FGPGAmPG9uGH+rD2/Xti+MQw61RtSfFMN41P/36z7K2aE+uDek77MjKwMWN4qdGWmhDfzWYMjUmNS0i1GRON5hC9PsRs1L0tFbXS4MZpNYK9LlrpsVaMbBipWPr1i8vMDOsbH58YaG5ioLmJgeYmBpqbGGhuYpsSicXc32wOi7eKFkeIDxQMC0OpsHgUCRM9Yu37PQmie90HF5ni4yyZ8f37Ghw9ihxeuW1yorDSs9DXA4HOYr1bO1Tk0NMys7LEPpqFY++EMeKPBekyNC4utgk2DHdFHhsvcdphx/AssXe0oTO4jTZHQlxqtFE5mqWaYpJtMSk2k3J0NDfanAnxzuiQ3vY6Z7/u8aF8pZ5vMiU60hMWRtijzcdGeN4v20LCQlQdVg6OtKs6/Dt6dTcn9rD/Ol3dkdIrwRQanRwj/m1b+yHd5/pU3JUz2HXaLCTaxCDaxCDabBhEWxQG0SYG0damZHlCnawfbpcqSwnMTkpgdlICGzAlsAFTArOTch82YBhL4D39EcWuNu5u0WPTHcrp2HAHZsmFZW+JSGjjPXfVRxTrRUl/vV7bZTnaG+O48z9kYNfdpft83Nb3t1362vn547a9v+2iA1sKdmfMuLKh4co5PdPLr2hccvXsHsrl1/3aMmf6jh+3X3X4njnTbv3u9kUPnD+p5IL75jXuP39iyUX3i/+fCKxK9UmsyiTWk90gRqSluyHQVUOgq4bAQjQEFqIh0FWDWIhxkcliAJPFACZbzRY+IdmJvGTxq0IsMq2Nh7UaDGZ0z9QaU2QWyy7waj2gDYNcbmI0DKL07noUjxHld9VrFbDGOt6iYky6rqjUASk6bWhckWJU1Cc9K+9atTU0OjVBbMReiTym18T5Cyf03D18+qzeN1wzaV5hd3Vr5bWLRhzt27FU7ujRLSQuZ+YZ0ycvGBh+5O89Rldhtw5nTN2GcenJcrRR6RbZxtNb7UXmjDae0aIvwZwOwDfa7e9mF3m765GpF7mYxxIxjwPwLbdFarf0QWIqh/BUOampA2JjxLkZwqHUbTq8DY7oEp1qWJRF8R7xh4WH6nSh4WHKS3aHLiwy/MjdyqrIqDHR9iij05VmiU1wxKg7jJF2HItRRoczw5qQmGL7dXY3zKkVc/qJLp11Zz3YEtH63fFxGeZ0S5vCPaFx6U74Telhbcpwj5WlpyX3yvjZjLdgTVSdvo7eppmH8ALkCZnxBw5GDh0aNTTR+h4JcQOyooY54+f6Y3XozZnpRqUur8uM1JCur0ud9rpU3w5RrempqWk2ozr9qGeqLiy6e1KyK1wx8vk6c3xGSoIrPspkVNcp9/B5I2Lx6lQN5tBDX4Sajao+PClGfdwUHqJyXHTMxqajYeL/c+NGfNyMn4JTmJtls1ptxtKz7lNUZmIOJbY1JsbUu005Df01JWZ81L9/SNpn1uqsH0LmaVtTdHioWJEQB60HB9A9r3/GR/UoaU37rN5aHZL1Qz1Ka7tTdHUoLUedNrGBhahos5miqsfWY3SnpXlzUlaBt+r/MfYlUG5UZ7q1qiRVSVWlUpV2qbRvLalbrV7Ua3W73a3e3HZ7X9ob3XZwytiNWRLbgWCzhEAyGDDEJJkJczJJ5pyZgME2TkgmeecZEoY0E95JmJeEcGDehLBME5J5YXnY8ru3qtSt9gLYuEqlurfq3u//779f0Vf9n85YzImmtt2yrkGItUaz4+XIn8Tc8q5/PF3uS4mdvrbVA//ySstAcwBtLq1bXoxwgTD+7XAgMnBNX3KgI2c3Z5ZtQB+JdqSk6k98ua7qaLY/765+W8r2QF249+K7+FGiESj8z0IUnnAjybNYj2JlpI8Kgd4AFoicRR0Kze/CPpCbGpuwpoazaMtJ6lpoGEzNawcgqX4FjYIzAekjNcBrHawqv6sJ+0BtomD7J1TQ4RJ7gKiTVsTV7AH8qNlbGp5qU5+4dXDoi0+qhfUjnV4LEN4UneidUgYPrGoorLt5uHt9d8pmAlbC1wJhb9gvDN393JHbfvHVEc4f9kbDDi9vDsWCbbsfmtr50HRzMBo08X4oyyAXnAdc4EBCSI/uCQhYGXgRXsypWCzuD+3Tvg/J3TVxrBv0jN39oWqfJn0fquTupeI3WkfbeiFzfvjLP//KRxoZ+S//j6MDj6fW3qUeu2/XnRsbsNC9v7izT6fY8tt/csvkvbs7zr/TNPMwpA0cnx2MrwHZoHGoF5DGqTgtsiALiMX7fiJh8nxgm05+YFrkS7QwB21SgyuFhPd9FTSzeT5QbdMmsApNdUxZL2zqeTIa5i/5CIZB0aYLf4RzwBwUTRHgmqpuR3dTNLREwecT6HdN4PsBgDalz4fifA6HhzVXf0FxXoH3cFT1HyjOA2emXnwHf4coIgqyX7NYg0HWDWsqkRR7FmtXrC3Rv3pI8LfRCotKOnY5AU+dbLzWmCWcn851QMoU4DxpT/SvqtahA/Y4pXbsaoR9nlAbr63NF/SqV5SLrNbaxkfrhSzvNFG6PVJjT/wdkrIQbNPY3rF1X95Rarvm7lX5Hcn/quGAbpNkjg+vXLMufetz9w5P3PfcoWXXr21zWvF7BR9nDsQDXXuOb9z50O4WSUSDAAIICxUIVa9xBiiHV6DH7n324K0v3DchhkJCSKM8kMj/DiRyAdmkUT7KwMJTV4yG25sQV2YmBheZ5TIxDG2z14o68Z/MzDAxfS1eLnqX2l9h/jIrFXxX+4j/u1kEBqvspKpBzc4CmhKYsG6P7DSj/0E5ZbcnLJpdC2g8W+2ofcb/ssAr16DfrH02ZoiOghmKSEz3BREwMys3o80F0BZOQLu6qhk9WhuLBY4AjGVhBPh/m/RPJuTiRYQHb9pC3oElkO+DpW3CErzxfnIGrK12ZA98/6kGMZcEPs1FxRKxFay5XKRkhVc8EmmZzkk0HkhMBz7DGVBDG1aH2gGMXsBaAHGg7yAnspc2r9m8l1q8hs77OItXEskZSpBdHtlBYdV7iGgK+NUWvHoCoxyyxxNyUAm3GmoIA3M3TaBFxhNO+3d5Yos43Hz+dobBTRYTfvj83Qvf/iwiQ1P3Qgn7eTDjpeVIjePeBfToRMY0jgs7YMmrnwDu3POKDfG3ztAZlzzt+gy+2/Cg63lNoevvG56xPmMTFItJNJFIRp2Qry6brSBJruY8vkhZ/N2I90AowVXfSE0kURRDKd4vuQNwtod5n5M3V7Nr0xgK/pgcfpc7wJv6I3IojNGjj4xFRkZHIhf+pX6uZtbNVWOrHp1MrV27LoX+FVgBBAEOUAPsuvgOMQDkELTvK3DeP0GcGDDlkCA4QqucfYLdBYxL9iR57RI1oJniLDDFd0FTnAUm3LWf3hQf6Lv1RwcPPnWoq/+LPzp44+nDyhPhkc9t2PD50ag8Cs4Hx8JY8Mi/HVsxcNe/3nnL3H0rBu589m82PKB2KfseWLX5ob2d/fuPQ+0FKLYHcHAA2DArdAvG9DTmRHgw+C5AMj75V5Jk4u+J08xn6s1og2IsmQQik2TE+Huq1uSTDGfJFcSpUiKZSNT02p7SNX8z82BtGSbcqC06IHdsViJP9veIBen+v+0cbvJgf1h9ZHOheqyeJCaKaV4xM1LZyZNkdW+obRQx5vMNMJ9moBWmdZlgxcRTTVyWL8HtCIlOHqo/1p/lX+/sdJXfg9ymr8eaRfZaEdpk5Zc0Re3IdvKvq6ClXH5PNdpCzlywx2qrMZnM45e7CTXrzOWSpDoLDf+GWYz7fWHRiq9jY419pd21+QPt7t1+x+bGQMtYky8XD3MbrdR/iY2jyvGv9qwoegQKLEPcYqf/khkoeKsTC3g8Hw4kBnf3QduNo8ONSupNrwd7JdqV9VS/7ynAX48ZvvgOdh5w6Shyu45LP+Y4nSglSvYA3H2B2MEitSmWcs+HgWVkdhcQXPwZWWgUMAFINJvGupqxBqDRIjkaSAVNxp4sa31tajnb86GqdRdg/ydVgYSda4wNLDfQRzfeDP421fhbj0kuXF8a3DFh5zt3fXV187axFo4iMQxYDHRucEdXbqwtlB3cNLVpKFPacriSmVzWZNfuWyhLunuyOak0uBuGNm3dNNSAJkdumGhw+PwczYmcM+C0BKIBKd2ZSHcX4pnm5Tv6lGtH0pzkYWnezQnA3vMGvGK8OZDtySdTxYGtUML5AX/1AP6SkQ5ttSAEYKcnJZbgzqL2J33TVm2VFNHCuT8/A900wgdvnFK1O3BxFLW5m6J12rLOOQNGUg9rr75mcYQ93pDTXH2tZhphb0Ba47+Lh88fWaD6LdAVc/h4iuJ9cHRhMLqXgfyNIKOaHY64APx/Oh1xyVaXCEwjxUq7AjMSaWhIBxC/mr+lO1uap/XUwn231gCyeC2uAnyq1jrdUgQ+F4VdR1hdiVAk42aI6tdNBBuTQ1En8JSKGNAnFmckEAjbCCqoBxvtDP6M5LNpwcjzj+JbrDboXfkkMHboPx7Q/MchnT9dwJSzMV64TyXmRuCqtTChGbfJMWOqDb7w5/KvXwMjh+NeuLUwbnQR4sWhC83CwtA9FiHi8oQFc/UUQ7GJSDAuWojz2P8Fw476I3E7SaPHqwtoo7dgE7pfSFuqjegvzbSJIFgPHPsAsLHjgCvSuqX1A4TDdpyRneAvkoBbxayyxh6eaWtCUwO7DUceCBvD0Ia8Intgq9MqaEYmdH2w++Nc+sQC09S59HE41AsH3CHCzNnQ/6iGOQ7qKUxlBMaEm1mmGsYQO7vcAWzKUDDMSi6fgM2FYwLkItZpS7Oi6BEuNEWgNN1ycR7vxf9Vk6bvaZErme0P9Rf6cdriKjEMOl6CMcASjFyVOJZDx0pn0fcVO5JMsgjKIDA+g3TASA5o2gEjODbjTOvnU7BPx1nMrDh51zNIiSthnT8toUgJLZXyfZmzKFAxv4ygkQgReCs/0v0yM04gBcNLmYLxgsLU7NapWpjrXHbrVLmgR3eKgJm3TvkUG+1CS65nVPi8iPZASUUiqESAZ+YDb6n5Eab7ZRU+110wXJptW6dgVKGQndJtDxOMJrS0mBaDz80thjY2viE0k4PSZZUEnQG8l/P7vCF757FVQwdW5Xpu+N61h6WmFeXuHcNNjJkB3qevf92u0o4vrUl8+ysD0/2hjSv79nW7GcZkYphNvYPxwV19Y/tH4oOllS0+IKfMnIf1BLzRgNCw9pY151y53vTg6v4BQKMTgEa/JmeRDNKNnNHiLsD0tYZbjbhZqxFHazVQh9ca6q1n0Q8Un5iFocesDKP6kIpZGFfLclqwH7MqFkS0traECRIIePJMYsQ3yI2VwceT5Di0ZKDSdJVrYbXsIvJTvqf0fgnYUbGoelcS9gVsPa6ZOVCLusp1tk5SvNyD0DMeNeuH4iVJU6C/br7mvqns8OBg0uzwiU6/wwRsXGDAO8yp0UoltfOe9anvi6V1ityjLE8OHF7Ws6HNg/7xxqdvH+QTHenrzAxc04yZbK8Zchf+kG6PciuOPn7j8iPT3Y5Mf7F6YvX6rmsOwXWwHWD8DXIvkkDKyI+0dRDq7URpXxlyfxlGwMscBw8AtzKEsfw0+iEwAAsXX4XYF4zYZsGIbRaMFVEwaFKAUFuF8CBdTvoIewaC5B4BS4l40j5OjkGNogHduxDONQKYGtKKtdbRDXueUt0jdtj3lKp1hkpHA3qJ71DPzcAoWzSbE4l6K7MN/wawm50wEzd0YvM1965PFXce2zZxVKGcIYi25TvLvjDQC7AFWPeFu5XBpKcG7c3j68aPntx5w9O3Dy1fhtGUDQY+bdSF5QDVnYeVgSMzAOVlTQDdKYDuCSBlskgJeUtDN1No7W3d14oLkC8FGUAmCOEGDkDWANFtgLA3aPKm4Sz64emB7LezGExSnYZ8WyLO6rATRpRcu6a1sy5wCIh3ONzwsy8S9xHYTwn0lwRKEP7Cy4kR91vb7fvtmN3yln/cMHg0WTN7fU3IFH+f1YPpUEJomRolQjT8TL1Je0ai8DLgdbv7LRWxc3aMxe1+y1uqX2P4c1CwaBJmKluzAurCVOLS9BYmJls1WlD4iaTnwhPBwf2rlOnhAgM8UhzDKbp13ayy77vXd3TNfuuaPce3576Df/7m7i09EQzDkuHRz63Li16RsnscNoFlaI9b6Dl49uANP7ht+cCBr28QjjyYH5tpg1HMluoD+N34z5EeZAWyDZU0/EVHbgjy8pAZwDckcwI6NtTce/biBxDOXoOLwfnVM/BWLzUBPio21oGOTfgIthFvpiiIOWB5H6yWt4EPuWbK56OacwQC25ZgimgDfMUGmQPdNmTiCg3OcbaRwttHfsusfkMUt7fjb3ZVMnL/b9pHNv9GnjACN72a3J9/SRc92eY5KPhdQIsWAD148CU3lwX/ZWsHaMYntecyI79VGVFc/YYKH96Fv6nCx7f3/0ZtH5E3/0YFrzDCPL26AuCeXZBQwAOVJF0+JZImYJ5KLuDKiHVeWhtQEqVW7agvKqCO0VJiQSnAwGwimbTjxhV+t8DeFvUXp764ou0an8PV1/r2sv2T+dJnvzO798TOBi7cJDcVivFQrLTltrH0UAjleL5anZlqHCq4ZjY3VQqu1dtWvSmn3Zbbbxqd6fHhN0RDsfWFFZ9b3RCQHPlgNI9ZsXD3xs6e/Wub4srGUrinvdnjGWvo3p6IT/WPH1yTs5jD1T9v2S23D6c27gq1VS5s7ejFzJ5cOiX2LQs09miyD/DHN8Dq7EZWIndpVmUxuBL+WgxityODcCXZUgFksn242LMySET74C6r3MgoOJ2OjrnfJnWy6fKLb24Gq+gc1NFFLdBhq+uZg11PqbmRKOwMdEZ0jHS/rZIGUXQZBp6wKMaWOg8tS8JtmKvl6jKtTX1UbbpmdavTjGOEyWKy5IavHVB29MvpkaGhZE3MpYeWD6XNDij+eOoyQRffe2J7A+0QbSznZJygheARvN0zYzPpcowdP/rYzgM/PDrExzvTey26CW+pvq+Jvl6gYLocaSD6gOV4Ali93wLau6hnBk/1ltCMYKgFoaaqBUOXC4YuF6DqdgVpqHhoKAtpKBVpTSDS8J4VUWCqOZiBFqXpqdxIbNAzpikSzc1FC0aiWVfYmhZ5MuPJwcYA94XmWtQp6ygvDZ1BTWyirhDs0y1sEf+W2aGrYnd+uLHn8AC41NKqNQ09dN/wpkNjYY+ZhqqXNmPs+NaB2Ia1F+6pfVOvlkeHu3fdvQNy4h0X/x+6iiwgIhJGvqvn3KMT0X1RXDIsS8nASbsWtLMmhCRDYkkGsNLT2CziR0QdTdHoJRp3xRrsIoDyjDWkgJ5wY+cpDzesYfjSfNbQBYYe1rTASQ9sBKx3rRWA7tnsFUOOAizEgZICiAi051JshIbOjiz8t4AOfjulY0GhjR2ZdBn80/kGuGA/qot8oh+cshoDrEU+jYFcOfJ52avr3giYFccB2y5wKFj/ReSsphtYBwd5Ex4MZn0XYiwYGC/y6ALPGswMzc0gDe0knWeh9NdZWONecP8pg201PrTmRjKe2HCNb6HcX+DbWgYXci4sszmpsy6t1vXR44e92U/HvOInMS+MEkoBjhp7ePwTmHcRvpvXTgDe3Q55dxOwcV4BKMIY4XMajv7eNJpyoGngm9rQBIMmzGiCQjM4msbQK+T9X71i3h+K32DBilrrCgrkpQUFP8SssCrjKRYZ3w/I6YH7XtmR6FkUM4x4AOuUAWthoUxgqvZHD1Kip1R2BAYpsQXr/dMEKfFXOg788/X7/uG61vKBfzoAzm3f9/XsmQDCNuzr3TNR2TMgo3+47gd3jvbfcup6cB4B58PDR3aWS9uOjI8c2VEubT0C0TtRfRD/NUAP+jgnaz5OuNVq8JrV4DVrbeVaDXysmqAUdfdGc3Tc8Lbu6VzRvxnmJq7q33y8ewN6fpJ7cwW2u7p7c//W1ECfEqvjP6foc1DpsfFVuZ1fhu5Ns+beDCYHDi7r2djmRd+86UdHh7hIKVrtqYlP4s2a8vl8pictjt3+2I3Lb5vuEoD2qT6yekPX9GF9hWPf1bz8OzUdtL8FTbAGpKyBJFuDljUwZyG0DkQBYhZReHCAGCNegHhcsWRHEqwoD4tjiB7DByx2DkC3qG1OZrWGVnWxpVtveml27UprVQPNhH0XM1nMZlcgJnoaWzqil67UeF9HOWALxwIMgaP4TinIWywWszM/1nbh8cvX6tHWgSSLm61Wi90HMFl1cR57AWAyjHLaamUKo72jE6O3jj42SvYZEPQZGPUZq7QP7vYUjGvOONPwjL6shGLFWJHxQcnng0LPBwWhD0pRH1y1vh/C/8EKsJWtMGTCKOB7BprOCfC8XuYxBmPyv2+zvs2v5Lfz+3m8jW/jpa7f9fnI9Ij0hs6sAL15XqtJ5OY5bVFnayVWeqR2UVcp8bb871Xe+raK8Bwv87hdf2K663eq9kxSeqPGxjBiqz0Wei911CE+deT2heatR1Y0rl/eKFkJE03R2d517ZmBoi+prFy7SkmmJw9NxiodaZHCcZyymiyR1uFCRkmLKWVy7WolidqXq4BLXB5nLCR4Ocon+xzR1niilApFsj3rulp2DDcwDpFjWImD+WHJIwnRRn+yJSVHMl1rEJ2a5F5yH3I/8t96fqYdfRmZQbYAzPuQ/eirp2Jp4dAdwKhVOlgPu7dvpk9gWaFvhhi/DRk/VAnN3zjYvmXP4Ojbkysnt0/un8Tzk/nJ9c3PJfaMrH9jcPwOdt5TuRu43CctukQtgkPzAjF4bQnATNc5h+6nOGC56GtF7hWYSNGCf0rpUOXG0Lyqv2hyFFBmkpuUJwFltHftaX5OBW8bXP+GCt7nYedVT8UCX/mEajHkcREcmhdJpb21lqI1GQlDI2a4EL+CgvpSeokfS1/JVXNw4ErU/VYTTHxINT+W3IsB/z+UKkhD00rwEOsgzTbzQU++P51a1uiNBsw4DM5HWkbqifzxLJJb+dkeT9YhuRq3HF0zeXhN5nWzzUI42D+2VqS430mZzCZiMy/xNM1aTPHRAyswuxwTvDw10rW+zedvGkwrI345eAXu6Ph43urYsTxhMrkrif59q/L5dbet3UrxXiEmV61T2yxWC2l3a1H3P2F7iX9GOpC7NfmZRvhozpAJOUNW5AxZkTM0e86QqzkoRhmXLTcfrQRs865KE2QjSmejOSg4m41Yz9w5LeMGHj2vgrYuxWWbV10VqkljAspgAi8317ukNqae5h9HNWyvmZPTedfgtBK4RafZF2qW4R9hwBKg3TbkivmdZtJCEpsDEc6+FOuXKAYWjzHgwyUYXbwIMcL/RBawBPo9BEEoLI79LaJnLP6Evwyw60M+o/mWhT4O/gBpNhjMsnA9MnhLtq/CZec7WypOGBCLj1v0gNgcWGVooQjTFtCd1Co4bKBpS3Ze7VRaKnGnFgPT2msxMO8cWCJQfmnVGXVVC1JdBObqoOHfC0pmLY8umKuFOiiujhv+lM97/uEFXSMuIuIIhPmrwmfgQrxI/G8gpL5j4GKHv7iVXbEBohKy9dv84C/Skl2DrKj0VTo75UpjBatssGfnWyoOyBLx8S11rARkUvHcVLkAnYNzhWa95FyTQQZ0Hv0xSIWrYDReadlgh0ACGB0GjNSWJYwG5E2RgxEt+MwlDHcJopeLnhqii8Uh/JU4knjRzAfTUIr0Bqt9dYBjOMUGU1eGHP0JoJEbmAHm1zWmtf+xdQiICBGICMi0Yc5uNVCvIwbv5G0229XIgaK1os3qxStztmm1xtmndM4msRpnm/oABfcgT2oUDPVMaAy9p7jHvmdqao8d962Av6XW34RAysZ9qwG+imt6vDLWU2mqZLNye2M71j6B+ObjFQKSUjSUi0HIXl06wBWgaRWNnJCWJ6e1RwXVxWch7Vw7IGt7fAKJ++bVeEUkNGqKNd2xSMte3QT7tMuijojhT7Gw0Jn6lcOHrrJyFsmILQu4wGePC1YOFeqIucgceL5+YX2MXKqn5NVXZt0DIB0jwP89BDztBtSme9rRi8CnoBl0LGSGx3gIDeofgqhkWHyicXYuRnK0s8M483DDSRv40Aa8Px5NcmiKRCMp8EV3BI1F0DD82BtGY2FU1r6V0ZiMJln0pjAaPnvxl4qFFythGdiG4OoNxQIUShhGyeEV1DJh+HwGdAynhsO0d5geqyVMjZ0pU5qHl9X/Q6GfpxuHU3Dziu80EkY5UnsRDV608Aw9s5oFjGKYgdRCyX1d3E1wtQnGdqJDKIZj1TnC5k0FgymPnai+QJCoWQi5AlHBQlQJ/CPMKoR9riBP4X9HWKwMdf4fYaaYMNut+HrGYcEBxTBwsFzwMgz2OqzGxcy0RhfgEx4GdInp1cY/QHxgzi0QUx+a9qFu6OMl3GjC3mrHkhbUC03qDi/qaQfnTg8aGvZYhWHrKDGBjOrVWOVeAEpWhwPC4lOYJY3cRisw9zCup0/ahASsSiotpMUFzUSSnBTW/DlTU9Er85jpsIXDqz8xc7FgMOK0kCiKf2DiI7I/xpuqpzmeZJx2tEw4rPgW0W0ncTNru5DHXhJoEnIj9H4HsGcwhfQhOWBh3KvJEkrsgD/6ikSjSOksulEJsPHjsuwTj8l5tDGv5LF83uo7nppte8B6A37AyB/BLAawSWH9Tn0INi7Hj6ugc148piJ5Lv9uHmdw0D/lO66mZq1tD6jaM4w0kpEdrVX4aKGsq2RGF83E+sQopviCYW98qqNhtDWUGlWXrbGFmhPxrlzQbHPYO6e7B6bK3jsnU50JR7GhoTeG/R+GoW2N8bTU0JvJL89JUV/Gb3OIfNQvOIPuQOt44YuMJEvJZCwJsFIBVt80CUgCaUO2aFhZQ41Po+th4AX9ssIjQshqb3g8MuvZaz/QfJK8oebml8tGWZMGCmwVaXhc1duRzSdV0LLm1JcvyVmarhgHpYxYk6i79Ng3w8pUl7+Yz7l9EU6ykybO63R6ObK4sVnZ1O79qi1UjMUHC6mhdLQY4vD3B2dXZq1S1N3F2GCIGveTsK4FHKrP5eKFlXsG4gMtcrr1x/lcqAQ3GlbAzA+aeLAeWvQqhCcsnpan0Q1AGeXQuxWOD+31WPDU49Js8etMHVdoWcVfLcwbNpJSj6vSLFP8usrUk14vqjCm+6kSiIDcBz1hXmJNhR1d/ZvLXrlvW2/TZIpitbmbvpQaSsVKIZYJFhOx4Tz2n/pc+wpNhYlruwYPTGQTCTRPmgkcSASyujqfl0vLorHBlnC2Ba6MITDn68DKiCN55LBWj5Mn4M9Y+3jelziLrldciE940G635I/JMD3nTt8vz1qOu2+oVTrPLmy51K1IiEHILjyogj5EHiwIAvXhoJ+cvl+VZ92W46r7hoXSZ7gSHIsrYTGXJ+n6LnFZJg+7zitUjznS/U2J3mLYajXbI9mmNvn48eTIZwcGgSq7i1g+EC3FBIxAvJ5kd0aiWUbw+j12xkLef3xwdkUmNbi1lR8cdaVKQZi9y6DvYzOkB+lCxpDNyOu6d7sKHUBSiAOdRLLIcnT1U01Z8Dfu64Y/mEgh43A5+JA16DolFSceLO9LrXpQEVeKmFg5xuYpvFVmUIaRlWOts/J6dP0xRUZl+HtdZroi34T0ZqfmZ3XsgNkx/9LUfNkoaPzVy6/xelk1WEZaTY7SVCYeVMELxFUPqojIgVcwTOWYqr3lVe0trcoxFb4HQC2jNrzuRW5N0Rj5UvCqLPfsVLYWH/qkbFzrZck48I+6PBmnddWW54zNMuqwh3vWtYTaHVZbQn4gP1byR4f3jVZ29QUbkn456pU8kZ71zf6CeIamf9zR5kv7bB0lf9Zny7cU7oq6RweyHVGW+B3wMLPufKXotTFWF+dwYyZMTLRHUstKASnRIqf6graCN9rpksrZQqXZZyLdf9fYxgeSzsYSF4hV9wSB7etLSlGZdctanTv2PHYLkGmNyKTG4ykHpKAfodENCov4+ZTLfjI7G9nrOkAeqKV4yvVFmqBF1n5SXWhTy+vUyzEgvxIfn9fBbqE4nxN4yWRbe7SSJnX5ZarJsfymxo5VRQn7T7CACbiK0fbKUCFXPV67rpdgmVSsZ3UZrOAd2PMoRn6k5XQUnXsl9LdgcgiYohUJod5THm6/Nq9XFutmYarFe0b1KNotMB3vC5AvhMvG3laXbPkryXrF2ohFL0vaIo35cCTfGF4cM+Y2mU0YBg5PZYLBdCYUNPA/BKRMg1EhG+MX8bcjfvvjydmYS95fg1/PVED0NZFqT9ofV+ta1OUlPgZ7OOCFpAR2CA5Z8LFUa3t0KAUuBDgPTzTsKW5v7pxsWoL6MET9wcUZMeBPf3M+1j3ZDmXmciAzHwWzEYDUNParOOH/9BgJAi1hsXoeYmejX9P1Yt1+FdbzkMrOktGv1RThJ4f/W7FH0xPXVyb2D0eSYzeuGLluOP4VNt6dz3SnnPC8Yi3+/rL9k7nk2N6hZftWNaRH9w6nhlqC/tJQQ2awFNgKR6uiH2DfBKOF+nyn7kc1WiH8oqbPnYgIlbm1sRAiSN9+7sYFlQ6TxfP1Kl3S9fli03qtDltnPyZUv0CLy7V679Zub0Mm5aqtB9IucRFv846uRa1eyaUGU7FmqNWHZieyFiHgrF4gYSWvyUJi83BtABI1NRYmPqtp9Wzpx7k81Ooa76EvarbfoLbHJeJFWKjYGK/1XHI2worB/eKBxSj7n8/p2+VsSes5dfH+p4it6wynb5hDX8QIijTTrMizQO5Jtal5olGXO5OICvawRAF9+r94t50iTSTtTgWq31vKcUOhlMtMmE12F5hFP/YMOg9m0Yt8SbfVy+ia03KD3MB4zqJrlQDCZI692vRuE9bUer+nTMZnrcd+yv+Sx3jpfkjOxbrjqaWFx0q8KXNM1beUxVvvV7W+vPWYFtYGtghPSvcbNNaLb7Ty46krR7Fbgelau6zbSwY0BEBkPta7sUXuzIcYE05ShDWQao3nejI9w71pubyqGGxOemkS3CFNUqwQKmazvSO9GfzmbH/OTbMs4xJtAkNyDjaS9IddrpTSkuzKShbGZgV3eIa0cba0Nxh1S3FtP10U4PUY+ShSRNZpVEeioSSkOiewdGhf8mEP/bCwL3uC0lfpHIwtz5378zO/hhvoFDG0T0g+rHoERaAfVoV9VPaESt2wEB7M9tZ2EcINW4Z0XBIclBYjMRrPo4+ZrFIwzG5fs4KmaWbcZFhv94Ar+h45402YCBOJ4Zzkps0mYstWNOEO+N1fIIGXToDDF9z+gLv6TlORJWgHmF0I+wWwWZxI0qhSdoRD8H9CIoTN4ehZdJNCU3I4bPPutx1A9usCFfUUvG5ooy1UKS/c18WpFtYLYk4ThRseKbBDlzqkWMjpY4Fn+UPc6oz4/VHRij9NkhbO75T8DhN+P4Z/CTNzPtIJpD/D2qp24HnCzJkZ/QvDM2YwP8Db1W2CgD5KmU04nAewvXaBeYRrVb8IeuZJs9nqOovefTosyRbJeRa9R2Gskn+/aGH3W67HbzIUxNKya52XrXWt3AuuprHFp60NXyxhblsoYUZX4NmMK8CixPjLwBkPet1+3kI8iN2JmfiA2x1kURJjbTRhtllPYhLrZAiMYujqjRj6FcoKwKAFDkpZBH9Kq6ygEQZJ1XZSzZ4yWXCmgvS+MqcXFJyy4Aq4dvd6X5lb9P70QgZ0Va1wofoYMWfUKVRPwmcTMjpK3rH02Tdrz56+5NnTV3n2aEO5PZMtt2erp8l4Wzbd1g6efQ7BUOvF99CXya1AGaSRuJYXJuO+cW4QoPz7F+BmUjKuaNfQRPj9C/UqC08s1GNc8psnP6bgb474HRSPmsWo3xcVzXaLJxUKpd0WizsdCqU8FvTGWoYV/yHjYEgTYJGPyuGsj6Z92XA456FpTw4iO39xHn2M2KaNsF3XthI2jciIiJXP0FwGjPdaBAyWO1fTtWfgl4oPbpjwwu/rtRJeutqgj1OsT5R8nAnlTULM74sIlMUixQL+hMticSX8gZhkQVvgjxbg4IBdZDgrSQLn4rwcSLpp2p0MBFIeq9WTAny9HD2F5bFuhEVkLZ+BUPQ8gWi7QiGlCHpehdXSC36PTihYh47lHXx1qwP8Qf/ebLOQ6IfJYCiRCJp478WLwPIYAM+dwyj8emBu3AfQuQffhT1C3lhPP19iiBsC9JsravTzKdo1pN9ccQn9ajbHJd9IInbUxLkcDjdrclmdYZc77LSg1buWfNeYwO+sERD9t9qnatPS7zgO7vxbhdvBGIcwimDBOvm6lk08gD2C/hMSQro0e9APfM6jisXJ+N3Ox8wEgxSa5y7MNWvBWX1huxnnY6pZAbfchWbvXHauubarTTRCKItyWFfE4IA9wtPPB8Lh4PM0a6d/EQyHA88z3H0B74tWmra+6A14/z973wHYVLn2f072LOluoePQAi1Q2tNFy6otbTqwi7aUqTTNaANpEpJ0IUIow7JR2Q6WOC8oIoIX0AJlKEtFcSCCAioCCioKCuV73vecpEkpyPW7/r/vu/+chybvfH7Pep/3nJycEHpUKpNJj4aCTNmEgfsmL4CIIxJxTu3TIwz9WrpM4MNKg5/l7OGDWt8wyNKh3UUUknlIt5MnUlw/3Q3jcN8USLxEbdtF3iH+fqHeUBLLJQKBRC4i80TeoeiLcqgkl/I56eg3A9qWoC9z8VESNYh8uvn6QBuUIDL4Yjnq9elGKAgdMYY3lldICCHiAsGqUaBFCpwr5BBFxEhiPFFFmIh6YhqJnylMNxZXG8oMqQ1TBk+JNttibFSFpodGlJsvyyfSs3hZCjrJL8kwxabJz0pKysrX2KYYhCGjxgWFDLPUFdYNnTw1e2rCBGN/Y9cxD4c97FNSHlDOGZgmSJP0ifWKrZtqfLg8LTY2rfxh49Q6YS9dZUQvIu5I3BFv5rYt8yH7kYR7v5Bohs+/MgMFSepfky+9F/ix678qInZ5ZERyUmJCFPvuy74Hsu+OfmGHesf3jv3CAPd6zw78HXjcj+ikJHoJevktMT4xvgcqtaUkwLExMT4+kVOCXm91RQ2cGc6xtzbRSQkJPcj4pKR48gDqbBuHXn9Do5egEncZvNBQa/skMTH+NFTI5VAoR9wegRdyV0Jc8q1cKC2l6SQOxQ5qE0LhOzTtsyQ6KRYKsPZDIFt9xL8AZwRb8D2dMXDt9Cb/CpHI3q0kgnpth6sQhbwofnz86Xhut/hu8b27t/ps58ze0rtVxJyeMV8DIOMu4983SPftEh8evzqeK2dG+3RvNaDxW0W9Ww0i9jTNcROfybBuz5EHBAYEMEkjqpfrxxkp6OQggPMmnLX0eaA4ptA+NjHpoabCDFsfhdhLKu4q7Vo2OK54YHezNjQlrqdM4S+WyrhlVKhMGBjonah5cnzlU4YBEZFeEX5UmEKooHrmTlDOmy2WK4QSWQDKgws5R8ggbIudBFM/xj3N/w7qLbg+hnOQ243/A9T3sv2HOFP556C+D9uumPMBp5p/Ds6WCvA6lnsF+wARYaJQr9aA7ZxZb8jDWnkW55NRiUeYe5Rgs62hAV6tBjTmTTkvrNUAo9ofi3JsQS5PRfVnf+ZEgB+J4lTLfdoGBoZwBFIxWdz2tr9M5k++EhgiV7RtJh/ykXO9Qqng0BBxF8h/5M3IUKprcFfKt3tQGx//vgMbA0QEXC9n4W+d9miNDEUPw4M8W3ycF/1xPgMu42wv69Fq6DAgyDEC75l3/6kSTqCQm8g5yielYUFBIQoBb2jbN4M5kG2DgsKlJJ+UcMTesM2HeUs4ZbqjnF+9FGIOyRcKtmzmiwQcrshbzjklFPM4HJ5EsKrtGFid9RrssH2Ysw+CHENICAVn1mYsOIQlCP2Wo4H5tih5x+coZJBAAek7DH14EubjC+cZnDNwGcTlwnUi51dHCePhqCAGERV4b+wXjP4jl0j0EwywXCKTwSRbYwOl3LBoVAqzejs+s2Ifhr+coMC/b/MWkdzZSNfn4NuldJ7zR/q6XtC6PO/HfDR9WqgI9vft5iW8QIq7BHRRBHiJyS9IUqgI8kcfroT5ZgdSwQrBu9zjQh//YJ9hEl+ZmHMWtIMD9Ey/tZOLrnN4Ah6U9zrbT3T1Bxbet37iyH26dhHwZd5y9I1PZj3AnhZJDGVsryDnot8FIedtEfm3ylGSCG91ftJy+SPkiTfk/q0G1LWVH95652ctjo8z7/iiZbd+Yx4b8/oL6HXTK4v86OJBg4sT/H3posGDhyf489TjV0wYeGTPQ8vgdd9g3YN9+hVoU4ZUoXcdyMquVfx7TGXs7zHtIEcT3kQopDcJ4d2jFf2eUqs/uGKzzOryIPhlxS2c1WQCiHr8I0qtBseoez8Lnuj+I0qcqT1zKpVlIi/0GV0XYVfvl7vRGTlxwQtD+/YLKMzvlRjhw7uVplZGtf3oNPynwX48r16pw5J7JgYJ227690xC/5mE85AhTbrhl9GjaYj82/8ULuLQwmsElxChS5M4OPfhdvfvns2puzVXeE2HZ73DEGm4O3F4f5lG3i9xg91oXefEi/0303yG+Hc/5gpELjSKpX2dkXCEk/Zj+sOdRIK70kKx61F1FzqGSDKOpdvtJC28J/3DlWQSJ9UxJM+9K/3eGXm9xFCX6r+fFA0O8o5y0i5EPpl3UMO9ybebG/2zc/LTY/qZIf/P2ylQzNJTTnqhIwUlBouA/O6g651T11ZX6jbgLnQsJB9of2hOaE7YgLAXwm44KLwifBuVArSqe0L3td3XRvAxTfgfoBUR+z3kof8+RQa60aT/Nj0T+fy/ia7/p1EP8p704N9IL3nofyP1/PVPqa1nW68pLjSTpflAS3o93Qld95CHPOQhD3no/z+KGnkHLWIo2g/TBKD3PeQhD3nIQx7ykIf+I+hLD3nIQx7ykIc85CEPechDHvKQhzzkIQ95yEMe8pCHPOSh/wD68T+d0I+scSII9ItccHAU+EkiLn7u0QvXUJlDePFeY8tcogfvbbbMcxnDJ4J4X7NlgUu7kKjj/c6WRUQf/lS2LCYoYRNblnDWOMdLiXLhOrYsI/oIr7NluZdA5JDTizAERDuemCJFAUvYMkkIA59myxxCGHSJLXOJoKCf2TLPZQyfkAVL2bLApV1IDAoOZMsiwj/gKbYsJhTBJWxZQhY7x0uJvsGVbFlG+AcvYMtyITd4HVv2IvpTG0ASkicG4Xz4ZrbM2JkpM3ZmyoydmTLPZQxjZ6YscGln7MyUGTszZcbOTJmxM1Nm7MyUGTszZblXEHWSLTN2fomgiASCJuKJVCgVEHpCTVgIE2GFPx1hg7ZMKFkIM35VQYseSkYiFnoyCAMQRZRAWxVRDX1WXNPCuxZG18GrBkbKiVwoVUKLlqiHEUXATQs8yohGXKKIfODcCHxrMaIBSlVYEgr+TDCmEeY6MCinzDSRCKVezloKEYPxVcDBDGMpwFUBDuKhJiayY4dBrRpaUW8tyGd16lMG7Xqsg+Gu8uiwHShiKNQroQe1qrAV3HVk+JhYTSmMUgu9aqyvw7r1MNeCW2phlAZbjYL2atxWQOSBTMg6ejzPiO06CM/X4hFaogYwkZU1+JViJXKMpXC7FftUD7I4vNeuB+q3gRR6mGkFK2RibfRYE71TDxX81cAMRkJGHxXGoFhf64Ej4qqCcYhXI9TqoWTDfrCCfpVQNmCZLNgWSF89vFaxlmK42rBODKYRa6TGkhoxihX7KQ97RQctKB5rsQWtmK+W9YUe68TYwoqjwgpcVWy8Io+Z2XYHSg3wMWD7mFkpjdBSg1EZnlZsqXYJEKIZ68KsDYdtGdkNOGpQJFSzkYukqoGxKsC34ZoR+9oR14zNGBTGj0ZWLxO2bSUe2S6xq0bIag14HqP1RKjH4rXr6s0ozK0Gc2jEdqhlV6mrvR3RZ2QjGenP+MWCo8ERo1rsaxS5Zqc2jIxV7Bgr1Caz3G2gBeOhOqeXVDhG0AqocdPLkXnUIIkK46tZ/FicXaqwr1DPnflq4B1al7OR44j8/sAlAfLd3SPdhjE1OBIRykSnD9pX5p15soqNa7NzNIpcxuNGGK/FsfP/Jt9KPBn3/0zGzQdJ1EQ0XmW92X6KyMFRYcKS2YDMENlxQPWYYnGWdY+cWDbe4qDciOOnCkcQ8ksjtKI1pMOyoLhx52rAMiAJ2kc4+HUWo1Yc52asO2MFxzzk1dHY8kymacSWZixjc3rbMdqRF9Rs7karPAbbAI0zs1HhmqfN2K5GNj8wXLRsXcXmZC3OKHqsISNdJZbD4eWOHrOxM5j4sdzRonPqEHNfmYDZFTTYpjZ292HWJ4Mb48TpqAGTReuxndR4PXVms3pWUz1eaQa8ppiVf6ft0RxmZ4mG8b3dIrhz7owMf9W2ruuD2d0pdn+2Yc+p3fbJjhq074od5RrkEgNIE0YX5mzBkSstzjMPDd57jTiPqO6qKRN7KreoYvKBiX1ltGLKtXi9MPlJg/cxPZtbGD5opAFn/7vHKJPFjaxn2rk7Voje5ayiGuc7PWtnlNXlOF9qWR0cZxgOK7tHdQz2jAqXNYTj/Kpjnuu4EqI75AUtztP1+IxCj72PvKqCNmShKpyPmL44luf4DrmzN7t627NF+9mAQ5p/ZXe6z92ACunAI9/Bgwp1RvMEaGP85Iga5uzEwO4i7dF9rx3OEZV33+WQ54qdK8fqci7C+JuJAi2LxWRtI+v3GKyzhd19HOcVzHlRFetnRxwzcWVmz3cYBBM+71ZhPR2RoiLad/mO+exv8IXTQiqsO7Kbns31GnatqtlzbSOW1XXP1OOzcSuOTVbGu/sWyqXu+zx4u7eLjTQuVwiu6+G++RHtVzWO0Z1nt5gO2c1h+46zDfiqQN9Bb4dc7edg7aumfSdy+DCGcFydoaswR13rEiFmfP1lwPFW7bLDMlJXYlm07E5V6/Slay5hfBjHetyKV4nBKYNjXbvH0v1b1XWHZ7R03WncY7rdEvXYjjV/0Y+O3aAWX10yltG6SKDBrwiz3S4TYITaZe+w3SMfM5lfgzVw7HgD3bK4CjiacMbp/KzbiPcIxy7jen3m2Cc6yynus6w4VzC+qmT17nzPVd3Foxan9lYcpUbMnVlFd175/tUIcOxvuYQS9xYR2VAbCbtlCW7JgzYKsmgJ9JRDLQtas6AlCkaUsv1R2FMj8T6UC+NG4D2O4VECr4VQH41zXDZB4TqqPQjjC4EXmqskRmEMJXArxSNLMO8CaM2HdyU7Ds3IhJYRUEflHJwFGbxCmMVcQ+SxeyIjaRm0U04N3aXKw4gOyQqgVgL8c9neDOCdh/kh+RF+Ni4XOuXMZiXNwDZCnBHPTJAoH9dQ6wh4L4ZxpRg/A+vMSFuIdciGfkYXJZYAIceyujLjkH3K2R7kIyRfPlC7VhnYBrlYmnb7ZcJ7MUiO+OdAbxneIYpgZhbWtBRbT8naDGmbj2vtWjGeysTaIKsiG2RBuQD+cpy2K8GvjCwlLtzcbTcS97ePYvTLYF8zseWKcI3xRiaulWFfod4Y1pclWI+OqCNxJCrxqAyscakzQrJx9DLSO6KTwShykYTBQ751lcUR1dQ91gjDxdE/gvX0nXZBVs/ANkFylTqR78YZrc1/11Vo+/VlHM4/6BND5pO3WHx+YCYaXqIS6PhUqkCvtpisJp2NyjRZzCaLyqY3GWOpDIOBKtFXVdusVInWqrXUaTWx8lxtpUVbTxWZtcayRrOWylc1mmptlMFUpVdTapO50YJmUIgznUj1Qm8pMVSJymCupnJVRrVJPRFah5mqjVRurcaKcMqq9VbK4MpHZ7JQQ/WVBr1aZaBYRBhjAlDKaqq1qLUUErdeZdFStUaN1kLZqrVUQV4Zla9Xa41W7SDKqtVS2ppKrUaj1VAGppXSaK1qi96M1MMYGq1NpTdYYzNVBn2lRY8wVFSNCRgCjspoBS4WvY7SqWr0hkaqXm+rpqy1lTaDlrKYAFdvrAKhYKhNWwMzjRowgMWotVhjqTwbpdOqbLUWrZWyaEELvQ0w1NYYylqjAruqVWYooyk1tQab3gwsjbU1WguMtGptmIGVMltM4A0kLXA3GEz1VDUYl9LXmFVqG6U3UjZka5AMpoCORsAy6ahKfRVmzADZtA02mKyfqI2lWDWjrFSNythIqWvBpYzcyHxGMLJFBbpY9FZkUa2qhqo1IxjgWAUtVv1kGG4zgUJ1SCUVBQ6oYbBQ8KirVRYQTGuJLdFW1RpUFmdcDXRAD0TxkFwOJkIu6B+bEO9meptFpdHWqCwTkR7Ypc7IrAKLm1Gz2gTqG/Vaa2x+rTpaZe0NXqRyLCaTrdpmMw+Mi6uvr4+tccyLheFxtkazqcqiMlc3xqltOpPRZmWHGmrVKituQOPaway1ZrNBD4GD+mKp0aZasFgjVQshZEPBipqRIdTgWps2htLorWYIYMahZoseetUwRAvvKnCj1lKjt9mAXWUj1soRjmAqiBuTxVHQIYSYO3WHONDUqm0xKBzrYG4MmuMAAP/UV+vV1S6S1QOo3qg21ELst0tvMkKkROt7M8vCZThwuJe0zCqCWAe/W20WvZoJSAcAjkMHr0HYAtF6QIE1gVKJBa0cjaneaDCpNO7WUzGmgsgCdcB9qFBrM0MW0GiRmmhMtdZgdrco5CWIXWY4coger5NqfaXehvKTvAxE1pnQakEis6aOoSpVVpDVZHRmCocTotlY0Bpj6/UT9WatRq+KNVmq4lAtDkaOZ3NKb3AvDgu8BhCbzpNgZ8nrQ3ZEPhpxHJl5ggl0QqaBtWSAxIbN7Z4mkSndEqVcXoycY8WLB/QGE2hhFoQ2WEYTQ+kskPTQEoGFWAU6IxuDrcCjMJ0yVUKyMyKjqHCidsTZ/WuBBFJZrSa1XoXiQ2NSQ8oy2lRMPtUbwDLRiKObtlQpm6mP98YSaXA2ZPzQ6TicZ1GzS7jFsOGGpHd0G/QQpww24mVhdipAwIsIaRiDcrleh9612CDmWlDIWo0XLLCurEWL14oa2SgBDeNAcasWpWiTWc9k1LuKyix4gGQWDWtpLER9tanmHjqiZVBrMYIwWsxAY4IcimWZoFXbHAHWHscQ/Bo9XngDmRBXVZrqtC4brtFkQ0uGSeZ6dhkzkcJ2WavRflCpdVu5KhdFLQjeaoNg0oOLnDvPvQyA1luukiotyi4bmVGipPJKqeKSovK8LGUWFZVRCvWoGGpkXllu0YgyCkaUZBSWjaaKsqmMwtHUg3mFWTGUclRxibK0lCoqofIKivPzlNCWV5iZPyIrrzCHGgrzCotgX8+DlQhMy4ooBMiyylOWImYFypLMXKhmDM3LzysbHUNl55UVIp7ZwDSDKs4oKcvLHJGfUUIVjygpLipVAnwWsC3MK8wuARRlgbKwDLbcQmijlOVQoUpzM/LzMVTGCJC+BMuXWVQ8uiQvJ7eMyi3Kz1JC41AlSJYxNF/JQIFSmfkZeQUxVFZGQUaOEs8qAi4leBgr3chcJW4CvAz4l1mWV1SI1MgsKiwrgWoMaFlS5pw6Mq9UGUNllOSVIoNklxQBe2ROmFGEmcC8QiXDBZmacvMIDEH1EaXKdlmylBn5wKsUTXYdHCu/ny0U75dxGq1OBWcusSqrucFz48Jz4+JfsK3nxsXfd+NCgv88Ny/+b968YLznuYHhuYHhuYHhuYHRMZt7bmK438RwWMdzI8NzI8NzI+N/340MieMZCDhuBxGzic4ODvvUAEFGw7sdP31wr4PHGyKTkTCGfPF+x8vlaDznvvl36YLH3zd/hQKN5943f29vPP6++fv6wnh4J9BTFDw8ngd/XfGrDxg6DspZ6H9TJZKwA6YRhSSHGEt2IXRkV8JKhhF2spiYR44hVpAPERvIOuJ18lFiFzmHOEjOJz4mFxNnyFXERbKF+I08QHK4w8guXAsZwl1ORvCGkH1AxCR3fDL1LviDcdBNI8oBXw34RsCfAvhzAX8p4K8D/NcAfxfgHwT844B/BvAvAv6vZAvJBXwvwO8G+L0BPw7wUwAv0x2f84gLfiDg9wT8RMAfBvijAF8H+DbAtwP+IsB/FvBfBvy3AP8g4J8A/K8B/wfAv0UuJsXkKtIf8CMBPw7w0wC/APBLAX8c4Fe743PPuuAHA3404KcAfjHg6wG/AfAfA/wnAX894G8B/HcA/yjgfwn4lwD/OjmH5JHzSV/ADwf8voA/APCVgF8G+BrAnwD4VsCf5o7Pr3TB7wb4fQF/EOCXA/4kwJ8O+I8D/rOA/yrgtwD+EcA/Bfg/AP4t8lFSAviBgB8F+EmAnwH4xYD/EODXAP5UwJ8J+AsAf6U7vuAPF/xQwB8I+A8CVQP+LMBfBvhbAH834B8H/POA/zM5BvR9iAwg68howO8P+FmAPwLw1YA/CfCnA/4KwN8K+AcA/wjgfwL451GeEAnhn0IRHZ01palJxCdFAnOzHY5ms4gkRTw7e4hEpEiyd+8GOFauFAlIkahhJj4a8Jwrzc3NV9AwASES3OSJFFS6/aaATwqEV0QNzc14kNBuR8Oar+CKCLVDDx5kbr5ut6NBAkHD4sUVdjM7yG5/7SAaxYhCMKLgGUw7OxkOswiDNTNyCLikgHeGGc0DpmZ7C604I+QRQl76lXQ4aAGfEPCbm4uLKUrUXkxPd1Ea4pwLHjrD5ZIi/po1a/gwTkBR12GGm83AGMLULDQjK9XdZmJSJN1t321fB7QEqBlIJCRF4tSsJjhgOFLyz2wn5pNisARrPFwTOa2HtKtYDNPNbtZzzPmL5gOu/NdaOphPxCNEvHQX+wna7Sdw2E9MkmKHAVwMKEYGFPIJIRgQWZASiwmxWET4AUUAofSKpoiFpFg0eCiePnSwKzPok5BiWQsca9PXpj+BaT6QWESKJYOHTkcHTBEAg+sQl9cZdoRY2MZhbNom5JNCUBdMt6JaIiAlIhixvRXGtm7HVR6PZ5sP1fk2oYAUogC/abdPgS6hcAqykR1aGtwmzpzJiMia1o7nsT0OHjOZSWx763Y0jEcKWfviMhjYXqFQnBHzCDGftXA6jcVFdgXDSlzKYGUJyZHwnVYGM5M8/hkej5QIFsMhZMJT0QZ/EjEhATu3W3oa2BpNk4hIiTgtg+GRkSYhSUm7qe0SKSmRt1S0VIDb1jxOPU7NBZoJJBGTEmkay8NxZBBpBLYLMjxjeYmQkIiw5RnTM8bgTQHjSgWkFFnQYXtc593F+EIoT0UmtMNSm+I+9d9hfWTXBrR6RFfu2/pSkiN1WN/N/FKn+UWs+aUSQiqRQT5H1B0o3T7Nnm6Hf+lSESkVh6nSMZd0VZiUJKUuHrBL5aS0S0tQS9Ca6DXRi3MX56LFOUs0S9QkkopJqTQELuFc3ZAB9RBCKgSu12dCdmH8IBURUtFt0uGI22zqBkeApWVCUiZmzInyUet23MCBY2A2asgeiIenZiFfZKUCb1G7M5qmdJje1MQEkVMmnOocfW55T9reg10i4sEewrrEjpMibEIVClGzGUwvEaSnX8dOSU9FmVcEHLKio8G4rhUFRclIjkzgtAfjGD52jEzY0TEyKSGTehFesNEjirfH2ytapkHEo6CXiUmZJJww2yuIFheqgJZwQsYBlBaXQ+ZFyhRnQs6EXBn8fsynhk8NB/MPH26df2D+XtlemUxKyuThxCSWs4MqWia1ACsR4Nzcv3fv3v03GVZiQia+bSftXDh5FxAyIgg/poTEuI1zo3jKfoFg6v79R+vkIlIuQXO++GYvOr75Ardw4RhUhVuqBqHUKB6s27+/raWlcrAM1abth2NKy1Ton9qRxd69cg4p57W0EIRTOZxdnf1MrtXhsg4zlDjh0WC063x6xjEVpeKG1pYzDSGy+Q1SPiyPiorrFcyRijcAtDmqCUT9gUKAZJ03B2FLyDkcuYvpQUo49+ELrvAFpFx0GB1gI4lYwfpY4XIdgK4jOBqDsYoth1iZchYqZ1hUlTFUZqPFEEPlWLQTY/C9+RgqX2Uz3qsP8ycxBvyFPgvvfgxc6DK6KfQJgbjP7NzZv8lJIWdNU+gMaJrGIcl4KS0W8Pt6cTld+QStEkj6CkCNphQOyVtTSg+nY1xaQtaF2UPgAgBREf70x4Q/j0WfFqYhoru7MOP5fVa422eb6NLTQyrKR1yuGxV9YX9e05qmoDK6ibeHbuK+vIbLITkc30QQcceb9T0mDaPgMhMdO2i5U1pYNARdj8XkjuAJfDkjSuN9aW9UEflKRqqs1Xpjlc1kjFfQXqhR6Css0WpqTEZNfBgdglokvv6dfv0tvjsdjvq5vkHt/WX6Gm2/UpuqxkwVZ2bQYYHy+P70ADolPiU5NSllDFRTXar09Nf/FslktAT1S325GUWZ8VF0T6YWZszUm9G3YrJKlZSytHAgnaVM7ZeQlZncLzEzY0B8TzqSUSikU4VKme8W0U1khKuBST7BbYIzeWiXcJrgQnT7z+dTftpzNf3kztTL5mce0PX+6scbt8/ue+G4/5Sr14Y3/tL0zurrh96ZfvDh07HWfu/N9zt8bvnvXfLeX7Kw+7CYs5umbhi0ccKN8dG6XkGzU71Pru47Yy83YssFzeFh312Y8cEp85sPCseOFJwsl8xYcWbOR7/O1pDPR9ySvLlt0v4Bj19844mHFz76ePUi+74P+4mVw0sOFe+yr78e/qVtXPN5ri66QG2L/ao1dEZcyxDdwMV9PvvYPGTF5H1nqzaM92tb9+0jvW5F/vKy+vagN/cPXT0953Lo1Q9SJZ+dM2/Qnm7RfWQqmzY84dTJ7MW/G7YnG3xer3+42+W4zfO7Bi7o3hC6YX3ZVytCXhlA63zm+XK4sIzWN5FisAifDgWThnrxAnh+i75YMP6HtJzdK3/YlnDmQFWP2qN9HsQhFBrJC6ID7H6RSdc/K8k2Sy6n/1H3x5a+r+1N3tKFLkMDwnkF9IN03pqcNcrZmewteLXF0OEWvHmiHrXGsd8Gs8Y53Yi8iJ0IQRkLQ+hRAhGsSz5fSJK8fHoYneuo05zZg+96jx8DaC334GyjfZG8PXkoBFmWXFGH9chFUWLeMzgz82rG2Kta6trUQYnb05YG/r5Il7By0cfzCpPXa4c89+u4/e/9Mu+Hm7ui3qo62OK78a23nv/c/ujnUSnR0urgN869ezHiepeeTTt/kz0Z2WPrjl0T1+9s8x6zf8i6lc0PLNs5zWfU7YWjl8inPTte8U4/3aJVJ6Z/8+UIIjt2Ys6pyQOkJ7/K26P4YumMPeGrvq/a83SOpZIcrqvJXxPbZ+LyW8cEJ9MkUfvWbvomcnDyigzLxMynHkkLGPPJB88uPrtxrijsl6HNZPXo4pX0tRuns2ua/R+lxhzfoqwtmBVq+2XmqklbJtUP8zPOHBWmn9Ay4eixTQ+cok4NOPtI2qBDLaOfnP19YMThiQuIm6l0k4CELHbBJYu1XphzffL04gu3cRZrdbWaFLLY1L8lV0TTvZhFH+7ar9FSpfoq/F0wcCz6EnA8TmYpdGp8fAINlMQks/Yqbftb5GP7uXfp/9Ns1Dx3e4+9wkWr7I3+N3tV3LQ0x/z+y/rlzcuyt60/NH5O3MDE2LDHG36f8lJ4E7l18qGuO7nvZV/ct/K3P3ihP82S3I4wrv2pasi+qKDz0eHXeEsy1JfO/tN//mXfVclfpprLTIMubVSK6bzdby+iV8oO1b37m3VpQP0H83YsOSCaRV0OezH56qQ9Z2zEg3M//OLxiyca2hb8vrGieciut8I3VS5/Z9/MzYs3nXi17/GyP5I/PzLpiW/Cbl+aNPHQNFGd7YxieO5HV4mDufnrhcnnR8tvTXn64Ddjzs66dmJVl/CFz5+bGbj7xHurQ8kDt3Jf8H0icXn33ITre3qsI15/u/S9GcbeY6f/mGq0/7zjkq/0oiMb2cEiU5h00xOlG+fGnC8inSuV65KuDp2onHmsYsD3t6v2jPvw4I5Xtu31XUGXoG5vHuSi53JoZbycljJbC6+gqLgkPolOQFW+b9+ERJqOT+irTqWTKpO1qn5JAyqT+iUlJKb2S03sn9BPk5ocr1MlJCQn6dRuKTDXqDlfzD/e9HJgSkrE1poX36vlLL17Cuw0Q5nMVpwFIVwgjiGKIYBR/I5HL/3olH50Kk6BKpcUOIKGkxWXFKj8UwBHFrwHhI2WIcF9SfI2jwOnvu7LmdvEIQlBQPjJkXuKD0YWrRve8Mnl67eO7Pq45eqNbuWXSw/qc/gftx669PXNlWOXjvdOjW7hK33PrGps3ql75eSOi5wRkduGRDZk1Gy6fpUYs2Tl3JDD4qXvrwrJol/aEHDgnzljr/VNmrd60aiUvYUhr0a8pzjyaZPipeQrmyIOLurx/PR5p6NCzulC56TF3h7JLdhtnLEm4eIbW+KKyx8SbPaffzBUvc0qO3ticq8ufZYpX0iYkbYsbWRefeScts2KA3PPi/yH7+s7Jn7sgAnLXnyueeKyaNPV1k3f71IGHq4snL61rGvOwhUbalqMUfuvR4UfvEy9JN189ah01ZKvJzyjn7G2/yc1VNusj2/v3b68v7htiN/uFX4vtcw+/GPT7ldG9MgM2po7q2H2+zc+fOaB4M/85ny7YHV1j+bqQS8dsBf2+lbUPV996+kn/QsSt5ZXFH0y7K3UhbdjT20e/1zmxHcbjm3eMXHRDMNjlpe/3/DH6lNdTwy4qXm3Jk10fsqMzRt3rv/nI8eWlT83edQhn5zKD7v/eHNwa7z0t7g0zYYUU0XxA9uyFhetkc57e+qoXw9UPaY6+eyK1oPzD5lyvmqJXXJ586+v0TWXJuS9eGFZ3cFdota2Qdc2WVMEr5cfC/5ox7Ul7z0W8pN9Aln0Zrfp1i3Hx0Y8MHBU0OnmH6pa816I+6LnvCEPv38pKevx0J2Py+qa0n5s/bTfWh5nYe6NH09xjnHXwSYghE3gR2YTkKgCqpNw7g/peAY7HqdTifiJXnOe/ClGQwYHcCEa44PpQLdGsTNYIQz7MnmzR3veLDGZIHlC6Op1erXKpqUyam3VJove1oiSO51CJ9GJ8QnJifQASO4J8biaSKPq/9wp9J/l99VrDZtPn8x9os+UibHBX+36+uy+lcMjizcePRVU2KPLDx+88EH+RhtNeV8Ufly21D9vSbehT2xaMY7u9Tkx8btHdl2aI+zymxdvxZU5h8MPJfZ47JmffqkKibn5yLfNod9/W7h+7e7I0vcW/K48Jn7/4Vfff20ob92N5w1PVn0S/UV26Wuz3z8fnR0b9Y/ZRSNKZOe4MX9MWLyYNj7282j6md+nnli+5bvuy6de/9D3Z9G20pqSN5SLV+cSw3J03lG9dS8uP3dcMH3YuhszX/DO8RM3rZ55eURDG7kqtFg0i1DQ2Ze3fRmZvaO1X9nqV8MaMuLrDz91etCMJ9eqOFtD5Ztv/vbU6+TRiAfLbt/g791DSR35/RWwyAt0F2fG4dNceHPJ552eXaL0HdqFx4P4m00rBGJ2T/AnUQtBT1/B5Obpi+npC+x+Xv9oqkgvj1p+vqfvzT5fSUqXjj733Fr1c6q/PTybFI0bA9YOW7NhY7511C9C31gtXcxsCnk07ENrMtdkzH7g/s+Lnd3ooRCUyvGGUOayIeTS2XSWy4aQ+q+cEyM9Mhmu93k+DLZWLJ+7dxw3q/+pC29srD95tHF4Abk51jZpbI3M95Wjbz+yaHvsRz7r5tdUbh/JOVRI+RavPDU5/euRO14dtSrkq1By9j92NPw07/1Lg8gfvn57kYR/cEHu11dK/U8VvfLEuW8XTPjYvvubJT8J4mZxLzzep0eE+Y9fb55rWBkr/034tXlnUOEzCydKLEu3rx3wdFW/fcO9vq8c90DAinnUA18LuybcOBw/rC5+SF+L9OD35iG3Z0l8T++RqBZe+WR74MXCedP2Jfd9eP07F3c+Kh36yEellu4/0O/taNCOG0sGSvy8Pvzcb8W1wW/pRm3pF/ftjVmzDw8v/+4Z8xLDPwbkf/Rr4zsvB02u7P3juqd6Jwnqu1a+OySsJrzpivRAzI5jmVvO37j06Nazz71oS95euG9SpM9/FXOeYU1laRwPIRQJAlIcBZEOoYWbAFKULiUiRUB674gERUpA0CQwFEHa0msibRSQLiwtIMIAykg3yEhTpEgTUFkF3YAzwCq7O/thHz+ee59T7r3ve373/573HGF/6BmjmKuWWhrsjVVV5XpunbnqX7CBfNgcDsB1Vp3VlrMzh5+vV2NOfK5hXeeJxCAZiT0vLKYjaGc5b7pcOJae3a3o3YQT8aU9suTPR8rEt4qYPKi4pBRF9HeoRhPZCkn3tFdYvbduIS9Xfh6/0Bkj0OXalM0dweoMVpIss4ire8U3XVPe7VSNMaEZVIMbliSVF2CKqwgpfpwjiRFsfvxSyF/o0QSrGCESYTmsm2/4zUmDrowl1MQHKhfvKGhIp0fna/R8UepvCNEvTO1W1mQ9LiL5o1SOCvziUc8utrwtAE8XBOBpHP9EAVN8/w4KqL+VAbjI/8tUjASArw4p+lccck8RICjYkEcCsgpfoXFqp4gAtos/XLHgwd+zA7zNDjCFHRSfK1756MNyAl5KRt/Ds+jJ1K8+MOfLVecS85yzNLxXRyvPCUHV32xjPPlCzrODlQxdkX+YTlveqTBExY5QH4g6HOgccSPJXvByWQ4qa87dtn8807iSQaKtbOSu+P2gQ2XPUiy67Tlp5lz9Z5FGwqxSM8X0hk+rztbakB/Bqf2K3dcee60pWhOPrmvVT8g7l6CdZTGFBCdmyQHVv228HKM7PGQdWIASnTncTGALaE5SWv70UtyShUfPFHYnyGeCVbEWZUteXNRICB25Xnk9nGtEuSLGZjbKIIxzlShl8Sr+tOR9afP2WuXPyIEqaqWKyrJE+Rv92ViJd/qmCXyyQm0KaOebxvVZzKXHBcIer9dTh9/+YLfSa0SKSYpobOHzFbI7BnvwRAQmL5SmcO7U0+CKxPsnBIruui448FyahKGy7SKnhGwG+HSVjR7VmKkIUq/0BVlJDQm8vGLDfEEroGoDNNlYAsbbjbZwVDVxDV7UnVEgMs8JoBqP1Z0N1nzV2uYTNOEzIzhO0kpvX354wmw09PaCHgooKo4dX7DKLdt8Ue461ZqKu744vKg7gxItYoMVFoW4YV/fcsTYVUqFPTPLsiYFwGBvF73aYHEScapyBq2TP5+NenTofPtggYaUb/IH9AaG11yCzcY+OUPZQDrseXnkT2M5+usp5Y1ahMtp/RPDkTG77FyksHPuAPztwfNAXXJ8twI7GMJ4kgFkvJPVpgFS+1eufgfl/YrHR1IRjIjX+Ds7jf7kfNGviD6BKBnA8ivctiOoBgQ9gm446n8K+lD8luK1FGfdFSV2gLQdErmDOdt9mDMCDAH9fZhT/2uY+w/t+wK43O3B80JwqQAuCcAl7L4kODWACwVU/uwOTHVU+r/JLGdvp2uUJ/PwcvAJdLpyDe7u6wWo7jYABmROInm5QedB2+fQbScQ2u0kEH5NOA2klK79kQrrspsQDOflPkiIua2GF6RNmARywgfIvm78mdCUI5NOienqKSH9gYzxrS52cAnljTafPq/Qz80qswzdp0nad/PWPEadSPyyBak2LmHxIdFahhfJjInB/Zy6J9bOqEcb9ZZveb5UpoOLZr5W4ioYrOEOSFKYmnPuOquECRJYYwspjPcNvb3+WBisJfbwFktD/l0axsxF94/u8GSCmIqYpznKieeQB9oyLeVV6HpL3JqW+Njm6d4m2WW00P3pMpHF3hdrTGXpsNQ0PSYl6Cp91DBPG/LY1Eq75G9WOdUoBYYOhocdpfenK0dGOSIvaJrLI6+KcN6sWBfZGJNQ5PVIq7SIckd7F9X6tqnS0BZSicGU8Spseq7Qliq9d5NxN094c4RoFvlPq4q55LXZGDmGt3E7nUoNH3++trF6lJghMtlTkNq7ZOOk9tKKLitCmTaAto+2wo+HvdnBoWbl9w4uSPO42q9MsKUxF6mF1PdE6xQyaJio1WSxllpwSFeHJR3L0wsSba/ILFDRDDgp29F/505uUBD/R51knuJP2gLYdzkbJM9a3dSpN34YzoV5ufTAY7pfhqsE3P1el33cjH4Dxc57nC7bBBYh52PHx/28nBKU+rJN9Q1IWDN+IuYIki9oWY2hQuXTL0/ybVqJkZlmV031dTRb1Lsy/a0YsDqeW4G5rU1eXpe6jK6xHQ4y7EHgIeUAHlICpqICcMk/GlwHhwP31kYIuEfbk88fRnyIGsG4f+GFMoq9EhTBBOy/ywEI7FWEIChTG2ppSC7GDMS2CE1ZuHJRxhB4ukIGnPdVYUSYAiYEMSzswH1KJt8fLUAUxgr+W8822d0nxvsNmyF4KpC/SHolOK861zHYQqdvdrEubJXTqil5DRQ9GfH2RdNxsuWy55U6jxiNakirsDaQjgC931QHfDrb6P1cNk5lgY4+h9A+N2+4slykWZbb036vxzrmnrRye0tKi2sa/ZrdQmmmoTNtg8NHXWHtTxo46FLMOS/f99q2L85h8kjXmpALupo/ubG7JK4Z0Mubc3VX5k7Ejz/urn2ylJ0Q+6ZFMYN91ph+i/yBLN6ApEsNZh0xLsEYZdondPQ4eBtMH9/g1b6Y8YV7+tMLm6E55pvBP6PUBQzCbNRjcRvuvRIOcSDdkkTpUw467ZktQxgmxmhRMyvL+sxyWk0ucZ9G/ZSn7Tr/WCXiwTDK74ng3jeiReDBHJRLR3ZMM/aHCfGDF9r22aQNcGy/SUL3FgypKJ3v3qFBMO8EjhFIGYQcUk5G3vI7i/SHMptGO/lh4BxSEdfrPWri604pfiOZtm2Fk1GNNZp0ZhquEx6XOjRjbM8yrkBfefdRs/SiPhp7S7DeZayF4xMsOkP0GdeJwzNhiSZVYOhxrwnuMZIPXd5UD9/vLhZJasEdko6XFF5d/7A+ih59TUyKL4xeHWnUcHXd9Kp2kO1jIXQRRhXGBxoWIFn5pU/Ea9zvsK66bTnm4POjINT9GoheoF8vhEc/et56IuNWmr8g3tJTkrHU11hBNN+4ayW/3Dt2dCMn/e2m5tvm5YEQziYRYbPmZT9brMfwOneKdwjTlgQ0oiaN0eJy4xl7t9zRwavrNy60nBEfjouK7A6w33DTaFCjUfUcfYvBcXg8Fm0fFW15JhqXofXuajgI9E/5jgVGDQplbmRzdHJlYW0NCmVuZG9iag0KMzYgMCBvYmoNClsgMjc4IDAgMCAwIDAgMCA2NjcgMCAzMzMgMzMzIDAgMCAwIDMzMyAyNzggMCAwIDU1NiAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCA2NjcgMCA3MjIgNzIyIDY2NyA2MTEgMCAwIDAgMCAwIDAgODMzIDAgMCA2NjcgMCA3MjIgNjY3IDYxMSAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCA1NTYgNTU2IDUwMCA1NTYgNTU2IDI3OCA1NTYgNTU2IDIyMiAwIDUwMCAyMjIgODMzIDU1NiA1NTYgNTU2IDU1NiAzMzMgNTAwIDI3OCA1NTYgNTAwIDcyMiAwIDUwMF0gDQplbmRvYmoNCjM3IDAgb2JqDQpbIDI3OCAwIDAgMCAwIDAgMCAwIDMzMyAzMzMgMCAwIDAgMCAyNzggMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgNzIyIDcyMiA3MjIgMCA2NjcgMCAwIDAgMjc4IDAgMCAwIDgzMyAwIDc3OCA2NjcgNzc4IDcyMiA2NjcgNjExIDAgMCAwIDAgMCA2MTEgMCAwIDAgMCAwIDAgNTU2IDAgNTU2IDYxMSA1NTYgMzMzIDYxMSA2MTEgMjc4IDAgNTU2IDI3OCA4ODkgNjExIDYxMSA2MTEgMCAzODkgNTU2IDMzMyA2MTEgNTU2IDc3OCAwIDU1NiA1MDBdIA0KZW5kb2JqDQozOCAwIG9iag0KPDwvVHlwZS9NZXRhZGF0YS9TdWJ0eXBlL1hNTC9MZW5ndGggMzA4Mz4+DQpzdHJlYW0NCjw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+PHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iMy4xLTcwMSI+CjxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+CjxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiICB4bWxuczpwZGY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGRmLzEuMy8iPgo8cGRmOlByb2R1Y2VyPk1pY3Jvc29mdMKuIFdvcmQgZm9yIE9mZmljZSAzNjU8L3BkZjpQcm9kdWNlcj48L3JkZjpEZXNjcmlwdGlvbj4KPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyI+CjxkYzpjcmVhdG9yPjxyZGY6U2VxPjxyZGY6bGk+RGVlcHRoaSBSZWRkeTwvcmRmOmxpPjwvcmRmOlNlcT48L2RjOmNyZWF0b3I+PC9yZGY6RGVzY3JpcHRpb24+CjxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiICB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iPgo8eG1wOkNyZWF0b3JUb29sPk1pY3Jvc29mdMKuIFdvcmQgZm9yIE9mZmljZSAzNjU8L3htcDpDcmVhdG9yVG9vbD48eG1wOkNyZWF0ZURhdGU+MjAxOS0wNC0yMlQxNToyNTo0MS0wNzowMDwveG1wOkNyZWF0ZURhdGU+PHhtcDpNb2RpZnlEYXRlPjIwMTktMDQtMjJUMTU6MjU6NDEtMDc6MDA8L3htcDpNb2RpZnlEYXRlPjwvcmRmOkRlc2NyaXB0aW9uPgo8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiAgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iPgo8eG1wTU06RG9jdW1lbnRJRD51dWlkOjJFQzE1NjkyLTBCMTctNEY5Qi05ODg5LUQ5ODlEQTM0RUY3NTwveG1wTU06RG9jdW1lbnRJRD48eG1wTU06SW5zdGFuY2VJRD51dWlkOjJFQzE1NjkyLTBCMTctNEY5Qi05ODg5LUQ5ODlEQTM0RUY3NTwveG1wTU06SW5zdGFuY2VJRD48L3JkZjpEZXNjcmlwdGlvbj4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCjwvcmRmOlJERj48L3g6eG1wbWV0YT48P3hwYWNrZXQgZW5kPSJ3Ij8+DQplbmRzdHJlYW0NCmVuZG9iag0KMzkgMCBvYmoNCjw8L0Rpc3BsYXlEb2NUaXRsZSB0cnVlPj4NCmVuZG9iag0KNDAgMCBvYmoNCjw8L1R5cGUvWFJlZi9TaXplIDQwL1dbIDEgNCAyXSAvUm9vdCAxIDAgUi9JbmZvIDEzIDAgUi9JRFs8OTI1NkMxMkUxNzBCOUI0Rjk4ODlEOTg5REEzNEVGNzU+PDkyNTZDMTJFMTcwQjlCNEY5ODg5RDk4OURBMzRFRjc1Pl0gL0ZpbHRlci9GbGF0ZURlY29kZS9MZW5ndGggMTM1Pj4NCnN0cmVhbQ0KeJw1zrsNwlAMhWHf8E5unogZmIQVGICGSagoEAyQkjVgCVpEiYQo6JGCOT+48CdL9pHNvLoueK/NvhzhKsJbpCeRrUVcwhbOIl+JYgFPUV7MEg+bWQElVFBDDr/Nxu+q238KkEAP+jCAIYxgDBNIIYPo0c1Dn03vYvcS+ygOc9FuzD5mJxOHDQplbmRzdHJlYW0NCmVuZG9iag0KeHJlZg0KMCA0MQ0KMDAwMDAwMDAxNCA2NTUzNSBmDQowMDAwMDAwMDE3IDAwMDAwIG4NCjAwMDAwMDAxNjYgMDAwMDAgbg0KMDAwMDAwMDIyMiAwMDAwMCBuDQowMDAwMDAwNTA4IDAwMDAwIG4NCjAwMDAwMDI3NTEgMDAwMDAgbg0KMDAwMDAwMjkxOSAwMDAwMCBuDQowMDAwMDAzMTU4IDAwMDAwIG4NCjAwMDAwMDMyMTEgMDAwMDAgbg0KMDAwMDAwMzI2NCAwMDAwMCBuDQowMDAwMDAzNDI2IDAwMDAwIG4NCjAwMDAwMDM2NTMgMDAwMDAgbg0KMDAwMDAwMzgyMSAwMDAwMCBuDQowMDAwMDA0MDUzIDAwMDAwIG4NCjAwMDAwMDAwMTUgNjU1MzUgZg0KMDAwMDAwMDAxNiA2NTUzNSBmDQowMDAwMDAwMDE3IDY1NTM1IGYNCjAwMDAwMDAwMTggNjU1MzUgZg0KMDAwMDAwMDAxOSA2NTUzNSBmDQowMDAwMDAwMDIwIDY1NTM1IGYNCjAwMDAwMDAwMjEgNjU1MzUgZg0KMDAwMDAwMDAyMiA2NTUzNSBmDQowMDAwMDAwMDIzIDY1NTM1IGYNCjAwMDAwMDAwMjQgNjU1MzUgZg0KMDAwMDAwMDAyNSA2NTUzNSBmDQowMDAwMDAwMDI2IDY1NTM1IGYNCjAwMDAwMDAwMjcgNjU1MzUgZg0KMDAwMDAwMDAyOCA2NTUzNSBmDQowMDAwMDAwMDI5IDY1NTM1IGYNCjAwMDAwMDAwMzAgNjU1MzUgZg0KMDAwMDAwMDAzMSA2NTUzNSBmDQowMDAwMDAwMDMyIDY1NTM1IGYNCjAwMDAwMDAwMzMgNjU1MzUgZg0KMDAwMDAwMDAwMCA2NTUzNSBmDQowMDAwMDA0ODQzIDAwMDAwIG4NCjAwMDAwMDUwOTYgMDAwMDAgbg0KMDAwMDAzNjg0OSAwMDAwMCBuDQowMDAwMDM3MTMyIDAwMDAwIG4NCjAwMDAwMzc0MTUgMDAwMDAgbg0KMDAwMDA0MDU4MSAwMDAwMCBuDQowMDAwMDQwNjI2IDAwMDAwIG4NCnRyYWlsZXINCjw8L1NpemUgNDEvUm9vdCAxIDAgUi9JbmZvIDEzIDAgUi9JRFs8OTI1NkMxMkUxNzBCOUI0Rjk4ODlEOTg5REEzNEVGNzU+PDkyNTZDMTJFMTcwQjlCNEY5ODg5RDk4OURBMzRFRjc1Pl0gPj4NCnN0YXJ0eHJlZg0KNDA5NjINCiUlRU9GDQp4cmVmDQowIDANCnRyYWlsZXINCjw8L1NpemUgNDEvUm9vdCAxIDAgUi9JbmZvIDEzIDAgUi9JRFs8OTI1NkMxMkUxNzBCOUI0Rjk4ODlEOTg5REEzNEVGNzU+PDkyNTZDMTJFMTcwQjlCNEY5ODg5RDk4OURBMzRFRjc1Pl0gL1ByZXYgNDA5NjIvWFJlZlN0bSA0MDYyNj4+DQpzdGFydHhyZWYNCjQxOTM5DQolJUVPRg==\",\n \"size\": 56160\n }\n }\n ]\n }\n },\n {\n \"resource\":{\n \n \n \"resourceType\":\"Patient\",\n \"id\":\"1\",\n \"identifier\":[\n {\n \"use\":\"usual\",\n \"type\":{\n \"coding\":[\n {\n \"system\":\"http://hl7.org/fhir/sid/us-medicare\",\n \"code\":\"MC\"\n }\n ]\n },\n \"value\":\"246748159A\"\n }\n ],\n \"active\":true,\n \"name\":[\n {\n \"use\":\"official\",\n \"family\":\"Beideman\",\n \"given\":[\n \"Daniel\"\n ]\n }\n ],\n \"gender\":\"male\",\n \"birthDate\":\"1953-11-27\",\n \"deceasedBoolean\":false,\n \"address\":[\n {\n \"line\":[\n \"117 Emily St\"\n ],\n \"city\":\"Elizabeth City\",\n \"state\":\"NC\",\n \"postalCode\":\"279093317\",\n \"country\":\"US\"\n }\n ]\n }\n },\n {\n \"resource\":{\n \"resourceType\":\"Organization\",\n \"id\":\"415\",\n \"identifier\":[\n {\n \"system\":\"urn:ietf:rfc:3986\",\n \"value\":\"2.16.840.1.113883.13.34.110.1.110.11\"\n }\n ],\n \"name\":\"Palmetto GBA\"\n }\n },\n {\n \"resource\":{\n \"resourceType\":\"Location\",\n \"id\":\"235\",\n \n \"type\":[\n {\n \"coding\":[\n {\n \"system\":\"http://terminology.hl7.org/CodeSystem/v3-RoleCode\",\n \"code\":\"PTRES\",\n \"display\":\"Patient's Residence\"\n }\n ]\n }\n ],\n \n \"managingOrganization\":{\n \"reference\":\"Organization/516\"\n }\n }\n },\n {\n \"resource\":{\n \"resourceType\":\"Organization\",\n \"id\":\"516\",\n \"identifier\":[\n {\n \"system\":\"http://hl7.org.fhir/sid/us-npi\",\n \"value\":\"1568461820\"\n }\n ],\n \"name\":\"Rest Haven ILLIANA Christian Co\",\n \"address\":[\n {\n \"use\":\"work\",\n \"line\":[\n \"18601 North Creek Dr A\"\n ],\n \"city\":\"Tinley Park\",\n \"state\":\"IL\",\n \"postalCode\":\"604776398\"\n }\n ],\n \"contact\":[\n {\n \"name\":[\n {\n \"use\":\"official\",\n \"family\":\"Randall\",\n \"given\":[\n \"Janice\"\n ]\n }\n ],\n \"telecom\":[\n {\n \"system\":\"phone\",\n \"value\":\"803-763-5900\",\n \"use\":\"home\"\n }\n ]\n }\n ]\n }\n },\n {\n \"resource\":{\n \"resourceType\":\"Practitioner\",\n \"id\":\"386\",\n \"identifier\":[\n {\n \"system\":\"http://hl7.org.fhir/sid/us-npi\",\n \"value\":\"1821034307\"\n }\n ],\n \"name\":[\n {\n \"use\":\"official\",\n \"family\":\"Ather\",\n \"given\":[\n \"Syed\"\n ]\n }\n ],\n \"address\":[\n {\n \"use\":\"work\",\n \"line\":[\n \"10661 S Roberts Rd 103\"\n ],\n \"city\":\"Palos Hills\",\n \"state\":\"IL\",\n \"postalCode\":\"604651954\"\n }\n ]\n }\n },\n {\n \"resource\":{\n \"resourceType\":\"Practitioner\",\n \"id\":\"387\",\n \"identifier\":[\n {\n \"system\":\"http://hl7.org.fhir/sid/us-npi\",\n \"value\":\"1881767572\"\n }\n ],\n \"name\":[\n {\n \"use\":\"official\",\n \"family\":\"Goldenburg\",\n \"given\":[\n \"Richard\"\n ]\n }\n ],\n \"address\":[\n {\n \"use\":\"work\",\n \"line\":[\n \"1 Medical Center Dr\"\n ],\n \"city\":\"Morgantown\",\n \"state\":\"WV\",\n \"postalCode\":\"26506\"\n }\n ]\n }\n },\n {\n \"resource\":{\n \"resourceType\":\"Coverage\",\n \"id\":\"29956\",\n \"meta\":{\n \"versionId\":\"1\",\n \"lastUpdated\":\"2019-07-11T06:27:08.949+00:00\",\n \"profile\":[\n \"http://hl7.org/fhir/us/davinci-deqm/STU3/StructureDefinition/coverage-deqm\"\n ]\n },\n \"identifier\":[\n {\n \"system\":\"http://benefitsinc.com/certificate\",\n \"value\":\"10138556\"\n }\n ],\n \"status\":\"active\",\n \"type\":{\n \"coding\":[\n {\n \"system\":\"http://terminology.hl7.org/CodeSystem/v3-ActCode\",\n \"code\":\"HIP\",\n \"display\":\"health insurance plan policy\"\n }\n ]\n },\n \"policyHolder\":{\n \"reference\":\"Patient/1\"\n },\n \"subscriber\":{\n \"reference\":\"Patient/1\"\n },\n \"subscriberId\":\"246748159A\",\n \"beneficiary\":{\n \"reference\":\"Patient/1\"\n },\n \"relationship\":{\n \"coding\":[\n {\n \"code\":\"self\"\n }\n ]\n },\n \"payor\":[\n {\n \"reference\":\"Organization/415\"\n }\n ]\n }\n }\n ]\n}\n\n\t\t }\n console.log(\"claim final--\", JSON.stringify(priorAuthBundle));\n Http.open(\"POST\", priorAuthUrl);\n Http.setRequestHeader(\"Content-Type\", \"application/fhir+json\");\n // Http.setRequestHeader(\"Authorization\", \"Bearer \" + auth_response.access_token);\n // Http.send(JSON.stringify(pBundle));\n Http.send(JSON.stringify(priorAuthBundle));\n Http.onreadystatechange = function () {\n if (this.readyState === XMLHttpRequest.DONE) {\n var message = \"\";\n self.setState({ displayQuestionnaire: false })\n if (this.status === 200) {\n var claimResponseBundle = JSON.parse(this.responseText);\n var claimResponse = self.state.claimResponse;\n console.log(\"lllllll\")\n if (claimResponseBundle.hasOwnProperty('entry')) {\n claimResponseBundle.entry.forEach((res) => {\n if (res.resource.resourceType === \"ClaimResponse\") {\n claimResponse = res.resource;\n }\n })\n }\n self.setState({ claimResponseBundle })\n self.setState({ claimResponse })\n console.log(self.state.claimResponseBundle, self.state.claimResponse);\n self.setState({ claimMessage: \"Prior Authorization has been submitted successfully\" })\n message = \"Prior Authorization \" + claimResponse.disposition + \"\\n\";\n message += \"Prior Authorization Number: \" + claimResponse.preAuthRef;\n } else {\n self.setState({ \"claimMessage\": \"Prior Authorization Request Failed.\" })\n message = \"Prior Authorization Request Failed.\"\n }\n self.setState({ loading: false });\n console.log(message);\n //alert(message);\n console.log(this.responseText);\n }\n }\n } else {\n const errorMsg = \"Token post request failed. Returned status: \" + tokenPost.status;\n document.body.innerText = errorMsg;\n console.error(errorMsg);\n return;\n }\n };\n }).catch((error) => {\n console.log(\"unable to generate bundle\", error);\n })\n }", "function postReq(name, user, start, end){\n/*\n request for new session\n /session/new/:name/:user/:start/:end\n\n*/\n fetch('/session/new/'+name+'/'+user+'/'+start+'/'+end,\n {\n method: 'post',\n body: fd\n }).then(function(response){\n return response.json();\n })\n .then(function(resp){\n console.log(resp);\n if(resp.status == 400){\n confirm(resp.error)\n }\n else if(resp.status == 200){\n var uid = resp.userId;\n var path = resp.path+'/'+user;\n //console.log(path);\n //let session_path = \"/session/\" + id.toHexString();\n window.location.replace(path);\n }\n });\n}", "function makePromiseRequest(request, route, arg) {\n var args = [route];\n var i = 1;\n // the number of arguments depends on the type of the request (only for POST and PUT)\n if (arg !== undefined) {\n args[1] = arg\n i++;\n }\n return new Promise(resolve => {\n args[i] = (err, req, res, result) => {\n resolve(result);\n };\n request.apply(client, args);\n });\n}", "sendHTTPRequest(options) {\n return new Promise((resolve, reject) => {\n const request = https.request(options, response => {\n let data = '';\n console.log(`Status Code : ${response.statusCode}`)\n if(response.statusCode == 200) {\n response.on('data', (chunk) => {\n data += chunk;\n }).on('end', () => {\n resolve(JSON.parse(data));\n });\n }else\n reject(response);\n });\n request.on('error', error => {\n reject(error);\n });\n request.end();\n });\n }", "function handshake(code, ores) {\n\n //set all required post parameters\n var data = querystring.stringify({\n grant_type: \"authorization_code\",\n code: code,\n redirect_uri: OauthParams.redirect_uri,//should match as in Linkedin application setup\n client_id: OauthParams.client_id,\n client_secret: OauthParams.client_secret// the secret\n });\n\n var options = {\n host: 'www.linkedin.com',\n path: '/oauth/v2/accessToken',\n protocol: 'https:',\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Content-Length': Buffer.byteLength(data)\n }\n };\n console.log(options);\n var req = http.request(options, function (res) {\n var data = '';\n res.setEncoding('utf8');\n res.on('data', function (chunk) {\n data += chunk;\n\n });\n res.on('end', function () {\n //once the access token is received store in DB\n insertTodb(JSON.parse(data), function (id) {\n //need to find better way and proper authetication for the user\n //ores.redirect('http://localhost:5000/dashboard/' + id);\n getData(id, (err)=>{\n console.log(\"data fetched\")\n })\n });\n });\n req.on('error', function (e) {\n console.log(\"problem with request: \" + e.message);\n });\n\n });\n req.write(data);\n req.end();\n\n\n}", "httpPost(path, on_response, data = null) {\n const client = new net.Socket();\n let buffer = \"\";\n client.connect(this._server.port, this._server.host, function() {\n client.write(\"POST /\" + path + \" HTTP/1.1\\r\\n\");\n //console.log({data, l:_raw_size(data)})\n if(null != data) {\n client.write(\"Content-Type: application/x-www-form-urlencoded; charset=UTF-8\\r\\n\");\n client.write(\"Content-Length: \" + _raw_size(data) + \"\\r\\n\");\n \n client.write(\"Connection: Close\\r\\n\");\n client.write(\"\\r\\n\");\n client.write(data);\n } else {\n client.write(\"Content-Type: charset=UTF-8\\r\\n\");\n client.write(\"Connection: Close\\r\\n\");\n client.write(\"\\r\\n\");\n }\n });\n client.on('data', function(response) {\n buffer += response\n });\n client.on('end', function() {\n _on_response(client, buffer, on_response);\n });\n client.on('close', empty_fun);\n }", "function send_request(req_type, req_body) {\n const http_method = 'POST';\n const server_path = 'main.py';\n let xhr = new XMLHttpRequest();\n xhr.open(http_method, server_path, true);\n xhr.setRequestHeader('Content-Type', 'application/json');\n xhr.setRequestHeader(\"req_type\", req_type);\n xhr.setRequestHeader(\"Authorization\", auth_token);\n xhr.send(JSON.stringify(req_body));\n return xhr;\n}", "function requestRemote(requestOptions, req, res, proxy) {\n\n var headers;\n var body;\n var remoteRequest = http.request(requestOptions, function(remoteResponse) {\n remoteResponse.headers['proxy-agent'] = 'Proxy Agent';\n headers = res._header;\n // write out headers to handle redirects\n res.writeHead(remoteResponse.statusCode, '', remoteResponse.headers);\n // change resonse here\n remoteResponse.pipe(res);\n // send the connection\n res.pipe(remoteResponse);\n });\n remoteRequest.on('error', function(e) {\n console.log('error in request: failed to fetch');\n res.writeHead(502, 'Proxy fetch failed');\n res.end();\n remoteRequest.end();\n });\n\n req.pipe(remoteRequest);// to the server.\n res.on('close', function() {\n remoteRequest.abort();\n });\n\n }", "doRequest(method, data, additionalPath, additionalHeaders) {\r\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\r\n return new Promise((resolve, reject) => {\r\n const headers = additionalHeaders || {};\r\n let uri = this._networkEndPoint.getUri();\r\n let path = this._networkEndPoint.getRootPath();\r\n if (!stringHelper_1.StringHelper.isEmpty(additionalPath)) {\r\n const stripped = `/${additionalPath.replace(/^\\/*/, \"\")}`;\r\n path += stripped;\r\n uri += stripped;\r\n }\r\n const options = {\r\n protocol: `${this._networkEndPoint.getProtocol()}:`,\r\n hostname: this._networkEndPoint.getHost(),\r\n port: this._networkEndPoint.getPort(),\r\n path: path,\r\n method: method,\r\n headers,\r\n timeout: this._timeoutMs > 0 ? this._timeoutMs : undefined\r\n };\r\n if ((method === \"GET\" || method === \"DELETE\") && !objectHelper_1.ObjectHelper.isEmpty(data)) {\r\n options.path += data;\r\n }\r\n const req = this._httpClientRequest(options, (res) => {\r\n let responseData = \"\";\r\n res.setEncoding(\"utf8\");\r\n res.on(\"data\", (responseBody) => {\r\n responseData += responseBody;\r\n });\r\n res.on(\"end\", () => {\r\n if (res.statusCode === 200) {\r\n resolve(responseData);\r\n }\r\n else {\r\n this._logger.info(\"<=== NetworkClient::Received Fail\", { code: res.statusCode, data: responseData });\r\n reject(new networkError_1.NetworkError(`Failed ${method} request`, {\r\n endPoint: uri,\r\n errorResponseCode: res.statusCode,\r\n errorResponse: responseData || res.statusMessage\r\n }));\r\n }\r\n });\r\n });\r\n req.on(\"error\", (err) => {\r\n this._logger.error(\"<=== NetworkClient::Errored\");\r\n reject(new networkError_1.NetworkError(`Failed ${method} request`, {\r\n endPoint: uri,\r\n errorResponse: err\r\n }));\r\n });\r\n req.on(\"timeout\", (err) => {\r\n this._logger.error(\"<=== NetworkClient::Timed Out\");\r\n reject(new networkError_1.NetworkError(`Failed ${method} request, timed out`, {\r\n endPoint: uri\r\n }));\r\n });\r\n if (method !== \"GET\" && method !== \"DELETE\" && !objectHelper_1.ObjectHelper.isEmpty(data)) {\r\n req.write(data);\r\n }\r\n req.end();\r\n });\r\n });\r\n }", "relayMsgToDevice(imsi, message){\n\n let self = this;\n log.L3(dl,'Sending message to device: ', message);\n let path = '/api/device/' + imsi + '/message';\n\n return new Promise(function (resolve, reject) {\n let postRequest = null,\n data = JSON.stringify({\"message\": message.trim()});\n let postOptions = {\n hostname: self.url,\n path: path,\n method: 'POST',\n headers:\n {\n 'Cache-Control': 'no-cache',\n Authorization: self.bearerToken,\n 'Content-Type': 'application/json',\n 'Content-Length': data.length\n }\n };\n postRequest = https.request(postOptions, function (res) {\n res.setEncoding('utf8');\n res.on('data', function (chunk) {\n log.L3(dl, 'Response from the NB-IoT Relay Service: ', chunk);\n resolve([res.statusCode, chunk])\n });\n });\n postRequest.on('error', function (e) {\n log.Err(dl, imsi, ': Problem with POST request: ' + e.message);\n reject(e)\n });\n log.L3(dl, 'Sending POST request to NRS - data: ', data);\n postRequest.write(data);\n postRequest.end();\n\n });\n\n }", "function requestP(optionsEndPoint){\n\n const protocol = 'https'\n const host = process.env.AUTH0_DOMAIN\n const path_req = '/oauth/token'\n const path_audience = '/api/v2/'\n\n var urlToSend = url.format({\n protocol:protocol,\n host:host,\n pathname:path_req\n })\n var urlAudience = url.format({\n protocol:protocol,\n host:host,\n pathname:path_audience\n })\n\n var options = {\n method: 'POST',\n url: urlToSend,\n headers: {'content-type': 'application/x-www-form-urlencoded'},\n form: {\n grant_type: 'client_credentials',\n client_id: process.env.AUTH0_API_CLIENT_ID,\n client_secret: process.env.AUTH0_API_CLIENT_SECRET,\n audience: urlAudience\n }\n };\n\n return new Promise((resolve, reject)=>{\n\n //request API key\n request(options, function (error, response, body) {\n if (error){\n reject(error)\n } else if(response.statusCode!=200){\n reject(new Error(`Network request returned status code ${response.statusCode}`));\n }\n \n let token = JSON.parse(body).access_token\n \n let auth_token = 'Bearer ' + token\n\n optionsEndPoint.headers.authorization = auth_token; \n\n //request end point\n request(optionsEndPoint, function (err, res, body2) {\n if (err){\n reject(err)\n } else if(res.statusCode!=200){\n reject(new Error(`Network request returned status code ${response.statusCode}`));\n }else{\n resolve(body2)\n }\n \n });\n \n });\n\n })\n}", "onRequest(request, reply) {\n const { events } = this;\n\n events.emit('onRequest', request, reply);\n\n reply.from(request.url, {\n onResponse: (request, reply, res) => {\n events.emit('onProxyResponse', request, reply, res);\n reply.send(res);\n },\n });\n }", "function randomHTTPRequestWithPromise (input1, input2) {\n\tconst URL = API_URL + '?' + FIRST_PARAM + input1.toString() + '&' + SECOND_PARAM + input2.toString();\n\treturn new Promise(function (resolve, reject) {\n\t\trequest(URL, function (error, response, body) {\n\t\t\tif (error) {\n\t\t\t\treject('Something went wrong...');\n\t\t\t}\n\t\t\tconst data = {\n\t\t\t\tmessage:'Request Number: ' + input1.toString(), \n\t\t\t\tbody: body\n\t\t\t};\n\t\t\tresolve(data);\n\t\t});\n\t});\n}", "processRequest(req, res, next) {\n Promise.resolve()\n .thenReturn(this.createProcessInfo(req))\n // .thenReturn(this.validateCommonParam(req))\n .then(() => this.validateCommonParam(req))\n .then(() => this.authenticate(req, res))\n .then(() => this.authorize(req))\n .then(() => this.execute(req, res))\n // .then((result) => this.prepareResponse(req, res, result))\n // .then((result) => this.prepareCommonResponse(req, res, result))\n // .then((result) => this.sendJSONresponse(req, res, 200, result))\n // .then(next)\n .catch((ex) => {\n // FIXME: Use others HTTP Status Code to indicate an error state to the client.\n this.sendJSONresponse(req, res, 200, { status: { code: ex.errorCode, message: ex.message } });\n })\n .done()\n }", "function makeRequest(){\n output('Sending the request...');\n var options = {\n method: $method.value,\n headers: {\n Accept: document.getElementById('accept').value\n },\n followRedirect: $followRedirect.checked\n };\n if(options.method === 'POST'){\n options.body = $requestBody.value;\n }\n client.request($url.value, options, function(error, response){\n if(error){\n genericError();\n } else {\n displayResponse(response);\n \n if(response.statusCode === 401){\n $authStatus.classList.remove('loggedin');\n $tokenDisplay.value = '';\n \n } else {\n $authStatus.classList.add('loggedin');\n $tokenDisplay.value = 'Bearer ' + client.getAccessToken();\n }\n }\n });\n}", "middleware (opts={}) {\n let correlationHeader = opts.correlationHeader || this.correlationHeader;\n let formatReq = opts.formatReq || this.formatReq;\n let formatRes = opts.formatRes || this.formatRes;\n let correlationGen = opts.correlationGen || this.correlationGen;\n let requestIdHeader = opts.requestIdHeader || this.requestIdHeader;\n\n return async (ctx, next) => {\n let res = ctx.res;\n let reqTime = new Date();\n let reqId = UUID.v4();\n let classname = (ctx.request.headers[correlationHeader]) ? 'service_request' : 'client_request';\n let correlationId = ctx.request.headers[correlationHeader] || correlationGen();\n ctx.request.headers[correlationHeader] = correlationId;\n ctx.request.headers[requestIdHeader] = correlationId;\n\n let done = (evt) => {\n let resTime = new Date();\n res.removeListener('finish', onFinish);\n res.removeListener('close', onClose);\n let logBase = {\n requestId : reqId,\n classname : classname,\n correlationId : correlationId,\n resolutionTime : resTime - reqTime,\n requestTime : reqTime.toString(),\n responseTime : res.toString(),\n formatRes : formatReq,\n formatRes : formatRes,\n };\n\n logBase.message = formatReq(ctx);\n this.log('informational', this.buildReqLog(ctx, logBase));\n let resLevel = (ctx.response.status >= 400 ? 'informational' : 'error');\n logBase.message = formatRes(ctx);\n this.log(resLevel, this.buildResLog(ctx, logBase));\n };\n\n let onFinish = done.bind(null, 'finish');\n let onClose = done.bind(null, 'close');\n res.once('finish', onFinish);\n res.once('close', onClose);\n\n try {\n await next();\n } catch (err) {\n throw err;\n }\n }\n }", "function proxy_reply(res, code, headers, ret) {\n\t\tif (headers) {\n\t\t\tres.set(t.deployer.copy_headers(headers));\t\t\t\t\t// copy headers for our response\n\t\t}\n\t\tif (!ret) {\n\t\t\treturn res.status(code).send();\n\t\t} else {\n\t\t\treturn res.status(code).send(ret);\n\t\t}\n\t}", "function __dispatchRemoteBrowser(req, resPromise) {\n\n\t// assemble the final url\n\tvar url = ((req.urld.protocol) ? (req.urld.protocol + '://') : '') + req.urld.authority + req.urld.relative;\n\n\t// make sure our payload is serialized\n\tlocal.http.serializeRequestHeaders(req.headers);\n\tif (req.body !== null && typeof req.body != 'undefined') {\n\t\treq.headers['content-type'] = req.headers['content-type'] || 'application/json';\n\t\tif (typeof req.body !== 'string') {\n\t\t\treq.body = local.http.contentTypes.serialize(req.body, req.headers['content-type']);\n\t\t}\n\t}\n\n\t// create the request\n\tvar xhrRequest = new XMLHttpRequest();\n\txhrRequest.open(req.method, url, true);\n\n\tfor (var k in req.headers) {\n\t\tif (req.headers[k] !== null && req.headers.hasOwnProperty(k))\n\t\t\txhrRequest.setRequestHeader(k, req.headers[k]);\n\t}\n\n\tvar clientResponse, streamPoller=0, lenOnLastPoll=0;\n\txhrRequest.onreadystatechange = function() {\n\t\tif (xhrRequest.readyState >= XMLHttpRequest.HEADERS_RECEIVED && !clientResponse) {\n\t\t\tclientResponse = new ClientResponse(xhrRequest.status, xhrRequest.statusText);\n\t\t\tclientResponse.on('close', function() {\n\t\t\t\tif (xhrRequest.readyState !== XMLHttpRequest.DONE)\n\t\t\t\t\txhrRequest.abort();\n\t\t\t});\n\n\t\t\tif (xhrRequest.getAllResponseHeaders()) {\n\t\t\t\txhrRequest.getAllResponseHeaders().split(\"\\n\").forEach(function(h) {\n\t\t\t\t\tif (!h) { return; }\n\t\t\t\t\tvar kv = h.toLowerCase().replace('\\r','').split(': ');\n\t\t\t\t\tclientResponse.headers[kv[0]] = kv[1];\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// a bug in firefox causes getAllResponseHeaders to return an empty string on CORS\n\t\t\t\t// (not ideal, but) iterate the likely headers\n\t\t\t\tvar extractHeader = function(k) {\n\t\t\t\t\tvar v = xhrRequest.getResponseHeader(k);\n\t\t\t\t\tif (v)\n\t\t\t\t\t\tclientResponse.headers[k.toLowerCase()] = v.toLowerCase();\n\t\t\t\t};\n\t\t\t\textractHeader('Accept-Ranges');\n\t\t\t\textractHeader('Age');\n\t\t\t\textractHeader('Allow');\n\t\t\t\textractHeader('Cache-Control');\n\t\t\t\textractHeader('Connection');\n\t\t\t\textractHeader('Content-Encoding');\n\t\t\t\textractHeader('Content-Language');\n\t\t\t\textractHeader('Content-Length');\n\t\t\t\textractHeader('Content-Location');\n\t\t\t\textractHeader('Content-MD5');\n\t\t\t\textractHeader('Content-Disposition');\n\t\t\t\textractHeader('Content-Range');\n\t\t\t\textractHeader('Content-Type');\n\t\t\t\textractHeader('Date');\n\t\t\t\textractHeader('ETag');\n\t\t\t\textractHeader('Expires');\n\t\t\t\textractHeader('Last-Modified');\n\t\t\t\textractHeader('Link');\n\t\t\t\textractHeader('Location');\n\t\t\t\textractHeader('Pragma');\n\t\t\t\textractHeader('Refresh');\n\t\t\t\textractHeader('Retry-After');\n\t\t\t\textractHeader('Server');\n\t\t\t\textractHeader('Set-Cookie');\n\t\t\t\textractHeader('Trailer');\n\t\t\t\textractHeader('Transfer-Encoding');\n\t\t\t\textractHeader('Vary');\n\t\t\t\textractHeader('Via');\n\t\t\t\textractHeader('Warning');\n\t\t\t\textractHeader('WWW-Authenticate');\n\t\t\t}\n\n\t\t\t// parse any headers we need\n\t\t\tif (clientResponse.headers.link)\n\t\t\t\tclientResponse.headers.link = local.http.parseLinkHeader(clientResponse.headers.link);\n\n\t\t\tif (req.stream) {\n\t\t\t\t// streaming, fulfill ahead of response close\n\t\t\t\tfulfillResponsePromise(resPromise, clientResponse);\n\n\t\t\t\t// start polling for updates\n\t\t\t\tstreamPoller = setInterval(function() {\n\t\t\t\t\t// new data?\n\t\t\t\t\tvar len = xhrRequest.responseText.length;\n\t\t\t\t\tif (len > lenOnLastPoll) {\n\t\t\t\t\t\tlenOnLastPoll = len;\n\t\t\t\t\t\tclientResponse.write(xhrRequest.responseText, true);\n\t\t\t\t\t}\n\t\t\t\t}, req.streamPoll || 500);\n\t\t\t}\n\t\t}\n\t\tif (xhrRequest.readyState === XMLHttpRequest.DONE) {\n\t\t\tclientResponse = clientResponse || new ClientResponse(xhrRequest.status, xhrRequest.statusText);\n\t\t\tif (streamPoller)\n\t\t\t\tclearInterval(streamPoller);\n\t\t\tclientResponse.write(xhrRequest.responseText, true);\n\t\t\tclientResponse.end();\n\n\t\t\tif (!req.stream) {\n\t\t\t\t// wasnt streaming, fulfill now that full response is collected\n\t\t\t\tfulfillResponsePromise(resPromise, clientResponse);\n\t\t\t}\n\n\t\t}\n\t};\n\txhrRequest.send(req.body);\n}", "function handleApiRequest (promise, req, res) {\n promise.then(requestSucceeded, requestFailed);\n function requestSucceeded (resultData) {\n res.type('json').send(resultData);\n }\n function requestFailed (error) {\n if (typeof error == 'number') {\n res.status(error).end();\n } else {\n res.status(500).send('Error: ' + error);\n }\n }\n}", "function makeRequest(verb, url, data) {\n\n\n return new Promise((resolve, reject) => {\n if(verb ===\"POST\" && !data){\n reject({error: 'No data'});\n }\n if(verb !== 'POST' && verb !== 'GET'){\n reject({error: 'Invalid request verb'});\n }\n\n let request = new XMLHttpRequest();\n request.open(verb, url);\n request.onreadystatechange = () => {\n if (request.readyState === 4) {\n if (request.status === 0 || request.status === 200 || request.status === 201) {\n resolve(JSON.parse(request.response));\n } else {\n reject(JSON.parse(request.response));\n }\n }\n };\n if (verb === 'POST') {\n \n request.setRequestHeader('Content-Type', 'application/json');\n request.send(JSON.stringify(data));\n } else {\n request.send();\n }\n });\n}", "_handleIncomingRequest(req, res) {\n var reqOptions;\n \n // Assign serial number to the request being processed. Just for logging purposes.\n let reqSerialNo = this._reqiestSerialNumber;\n this._reqiestSerialNumber += 1;\n \n // Parse request target and append absent parts from CONNECT (if one was received) request parameters.\n try {\n let targetURL = urlUtils.parse(req.url);\n if(targetURL === undefined || targetURL === null) {\n throw new Error(\"Invalid URL.\");\n }\n \n var host = targetURL.host;\n var port = targetURL.port;\n var proto = targetURL.protocol;\n if(!host) {\n // Deduce target host:port from incoming request.\n let s = req.socket;\n if(s) {\n host = s._originTargetHost\n if(!port) {\n port = s._originTargetPort;\n }\n if(!proto) {\n proto = s._originTargetProto;\n }\n }\n }\n if(!host) {\n throw new Error(\"Invalid URL.\");\n }\n if(!port) {\n port = 80;\n }\n if(!proto) {\n proto = 'http:';\n }\n var path = targetURL.path;\n if(!path) {\n path = '/';\n }\n \n if(kDebug) {\n debuglog('Incoming request [%d] for: %s//%s:%d%s %s', reqSerialNo, proto, host, port, path, util.inspect(req.headers, {showHidden: false, depth: 1}));\n }\n \n // Compose options for request to the original HTTP server.\n reqOptions = {\n protocol: proto,\n hostname: host,\n port: port,\n path: path,\n method: req.method,\n headers: req.headers\n };\n \n // Let observers alter outgoing request options.\n this.emit('requestOptions', reqOptions, req, res);\n } catch(e) {\n // Something has gone wrong during original request options preparation - report HTTP/400 'Bad request' error to the client.\n debuglog('Failed to prepare original request [%d] options: %s', reqSerialNo, e);\n if(res.socket) {\n this._reportBadRequest(res.socket, e.message);\n return;\n }\n res.destroy(e);\n return;\n }\n \n if(kDebug) {\n debuglog('Outgoing request [%d]: %s', reqSerialNo, util.inspect(reqOptions, {showHidden: false, depth: 1}));\n }\n\n // Submit request to original HTTP server.\n let origResponseHandler = (origResp) => {\n if(kDebug) {\n debuglog('Original response [%d] for %s//%s:%d%s: %d %s', reqSerialNo, reqOptions.protocol, reqOptions.hostname, reqOptions.port, reqOptions.path, origResp.statusCode, util.inspect(origResp.headers, {showHidden: false, depth: 1}));\n }\n \n // Notify observers on a response, received from the original server.\n this.emit('responseHeader', origResp);\n\n // Pass origin response headers through a validator. Node.js validates headers, set for ServerResponse object, though it doesn't validate \"incoming\" header values. As a result, invalid (having non UTF-8 characters, for example) header field, coming from original server, causes client blow up.\n // Collect original server response headers and combine duplicates.\n var key;\n var headers = new Map();\n origResp.rawHeaders.forEach((currentValue, index) => {\n if((index & 1) == 0) {\n key = currentValue;\n return;\n }\n let existingVal = headers.get(key);\n if(existingVal === undefined) {\n headers.set(key, currentValue);\n return;\n }\n if(typeof existingVal == 'string') {\n headers.set(key, [existingVal, currentValue]);\n return;\n }\n existingVal.push(currentValue);\n });\n \n // Push original response headers to the client response.\n headers.forEach((val, key) => {\n // Be optimistic about header value being valid.\n try {\n res.setHeader(key, val);\n } catch(e) {\n debuglog('Failed to set header: %s: %s:\\n%s', key, val, e);\n // Header contains invalid character(s). Escape them.\n var escapedVal;\n if(typeof val == 'string') {\n escapedVal = val.replace(/[^a-zA-Z0-9,.:;=&@\\-+\\/()\\\\[\\] ]+/g, (c) => { return escape(c); });\n } else {\n escapedVal = val.map((v) => {\n return v.replace(/[^a-zA-Z0-9,.:;=&@\\-+\\/()\\\\[\\] ]+/g, (c) => { return escape(c); });\n });\n }\n \n try {\n res.setHeader(key, escapedVal);\n } catch(ee) {\n // Did at most I could. Skip the header.\n debuglog('Skipping invalid header. Failed to set it, even with escaping: %s: %s:\\n%s', key, val, ee);\n }\n }\n });\n \n // Start feeding original server's response to the client.\n res.writeHead(origResp.statusCode, origResp.statusMessage);\n \n // Prepare for data/error propagation from original to client response object.\n origResp.on('data', (d) => {\n debuglog('Got original response [%d] body chunk of length: %d.', reqSerialNo, d.length);\n this.emit('responseData', origResp, d);\n res.write(d);\n })\n .on('error', (e) => {\n this.emit('responseError', origResp, e);\n debuglog('Error in original response [%d]: %s', reqSerialNo, e);\n })\n .on('end', () => {\n debuglog('Original response [%d] processing finished.', reqSerialNo);\n this.emit('responseFinish', origResp);\n res.end();\n });\n };\n \n let requestor = (reqOptions.protocol == 'http:') ? http : https;\n var origReq\n try {\n origReq = requestor.request(reqOptions, origResponseHandler)\n } catch(e) {\n debuglog('Failed to compose request to original server [%d]: %s', reqSerialNo, e);\n if(res.socket) {\n this._reportBadRequest(res.socket, e.message);\n return;\n }\n res.destroy(e);\n return;\n }\n \n origReq.on('error', (e) => {\n debuglog('Error in original request [%d]: %s', reqSerialNo, e);\n this.emit('requestError', origReq, e);\n origReq.removeAllListeners('abort');\n })\n .on('abort', () => {\n debuglog('Original request [%d] aborted.', reqSerialNo);\n this.emit('requestError', origReq, new Error('Aborted.'));\n });\n\n // Capture premature client connection closure and force original request aborted in that case.\n res.once('close', () => {\n debuglog('Premature client response connection closed [%d].', reqSerialNo);\n origReq.abort();\n });\n \n // Propagate client request data/error events to the original request.\n req.on('data', (d) => {\n debuglog('Got client request [%d] body chunk of length: %d.', reqSerialNo, d.length);\n this.emit('requestData', req, d);\n origReq.write(d);\n })\n .on('error', (e) => {\n debuglog('Error in client request [%d]: %s', reqSerialNo, e);\n origRequest.abort();\n })\n .on('end', () => {\n debuglog('Client request [%d] processing finished.', reqSerialNo);\n origReq.end();\n });\n \n req.on('upgrade', (req, socket, head) => {\n this._reportBadRequest(socket, 'Upgrade protocol is not supported yet.');\n origRequest.abort();\n });\n }", "_wrapAndRequest(request, resolve, reject) {\n if (this.getAuthToken()) {\n request.set('Authorization', this.getAuthToken());\n }\n request.end(function (err, result) {\n if (err) {\n reject({status: err.status, result: (result) ? result.body : null});\n } else {\n resolve(result.body);\n }\n });\n }", "function promisePost(url){\n return new Promise(function(resolve, reject){\n\n var xhr2 = new XMLHttpRequest();\n xhr2.open(\"POST\", \"http://localhost:3000/api/cameras/order\", true);\n xhr2.setRequestHeader(\"Content-Type\", \"application/json\");\n\n xhr2.onreadystatechange = function() {\n \n if (xhr2.readyState === 4) {\n resolve(xhr2.response);\n \n } else if (this.readyState == 4 && this.status == 404){\n reject(Error('erreur 404' + request.statusText)); \n }\n }\n \n xhr2.send(JSON.stringify(body));\n })//fin de la fonction Promise 1ere partie\n}", "request(verb, requestUrl, data, headers) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._disposed) {\n throw new Error(\"Client has already been disposed.\");\n }\n let info = this._prepareRequest(verb, requestUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n let maxTries = (this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1) ? this._maxRetries + 1 : 1;\n let numTries = 0;\n let response;\n while (numTries < maxTries) {\n response = yield this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (let i = 0; i < this.handlers.length; i++) {\n if (this.handlers[i].canHandleAuthentication(response)) {\n authenticationHandler = this.handlers[i];\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1\n && this._allowRedirects\n && redirectsRemaining > 0) {\n const redirectUrl = response.message.headers[\"location\"];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n yield response.readBody();\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, redirectUrl, headers);\n response = yield this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n yield response.readBody();\n yield this._performExponentialBackoff(numTries);\n }\n }\n return response;\n });\n }", "request(verb, requestUrl, data, headers) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._disposed) {\n throw new Error(\"Client has already been disposed.\");\n }\n let info = this._prepareRequest(verb, requestUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n let maxTries = (this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1) ? this._maxRetries + 1 : 1;\n let numTries = 0;\n let response;\n while (numTries < maxTries) {\n response = yield this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (let i = 0; i < this.handlers.length; i++) {\n if (this.handlers[i].canHandleAuthentication(response)) {\n authenticationHandler = this.handlers[i];\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1\n && this._allowRedirects\n && redirectsRemaining > 0) {\n const redirectUrl = response.message.headers[\"location\"];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n yield response.readBody();\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, redirectUrl, headers);\n response = yield this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n yield response.readBody();\n yield this._performExponentialBackoff(numTries);\n }\n }\n return response;\n });\n }", "function send(req, _res){\n client.send(req.body).then(\n (res) => {\n //Handle successful API call\n logger.info(res)\n },\n (err) => {\n //Handle error making API call\n logger.error(err)\n })\n}", "function sendResponse (res, body) {\n res.set({\n 'Content-Type': `application/json`\n })\n .send(JSON.stringify({\n payload: body,\n renewedToken: res.renewedToken\n }));\n}", "function onRequest(c_req, c_res) {\n\n console.log('Method used: ' + c_req.method);\n\n //sleep.msleep(options.delay);\n var parsedURL = url.parse(c_req.url);\n\n var reqOptions = {\n\n host: options.server,\n path: parsedURL.path,\n port: options.port,\n localport: options.local_port,\n max_requests: options.max_requests\n };\n\n // get clients browser record\n var br_rec = c_req.headers[\"user-agent\"];\n\n // ensure this browser has its record in our browserRecords\n if (browserRecords[br_rec] === undefined) {\n browserRecords[br_rec] = [];\n }\n\n // delete the timestamps older than 10 minutes (= 10 * 60 * 1000 miliseconds)\n if (browserRecords[br_rec].length > 0 && browserRecords[br_rec][0] <= (Date.now() - (10 * 60 * 1000))) {\n browserRecords[br_rec].shift();\n }\n\n // if browser exceeds max_requests\n if (browserRecords[br_rec].length >= reqOptions['max_requests']) {\n console.log(\"Max Request limit exceeded! Connection Refused!\");\n c_res.statusCode = 429; // TOO MANY REQUESTS\n c_res.end(\"429 - MAX REQUEST EXCEEDED!\"); // end response\n return;\n }\n\n // add timestamp for the new request to browserRecords\n browserRecords[br_rec].push(Date.now());\n\n var c_data = \"\";\n\n c_req.setEncoding('binary');// allows us to get all kinds of data\n\n //storing data coming in client request in a string\n c_req.on('data', function (chunk) {\n c_data += chunk;\n });\n\n // processing the data in an event handler\n c_req.on('end', function () {\n\n reqOptions.method = c_req.method;\n reqOptions.headers = c_req.headers;\n\n reqOptions.headers['host'] = reqOptions.host + \":\" + reqOptions.port;\n\n var s_data = \"\";\n\n callbackFunc = function (res) {\n\n res.setEncoding('binary');\n\n res.on('data', function (chunk) {\n s_data += chunk;\n });\n\n res.on('end', function () {\n\n // Handling Redirect errors by parsing the new URL\n if (res.statusCode == 301 || res.statusCode == 302 || res.statusCode == 303 || res.statusCode == 307 || res.statusCode == 308) {\n var temp = url.parse(res.headers.location);\n console.log(res.headers.location);\n\n if (temp.protocol.startsWith(\"https\")) {\n\n c_res.statusCode = 405;// Method not allowed\n c_res.end(\"405 - HTTPS REDIRECT DENIED!\");// end response\n\n return;\n }\n\n reqOptions.host = temp.hostname;\n reqOptions.path = temp.path;\n reqOptions.port = temp.port;\n reqOptions.headers['host'] = temp.host + \":\" + ((temp.port == null) ? '80' : temp.port);\n\n //Since 303 error makes it a compulsion to use GET instead of POST request\n if (res.statusCode == 303) {\n reqOptions.method = \"GET\";\n c_data = \"\";\n }\n\n s_data = \"\";\n var s_req = http.request(reqOptions, callbackFunc).end(c_data, 'binary');\n }\n else {\n // No redirect ERROR\n var ext = require('path').extname(reqOptions.path);\n \n c_res.writeHead(res.statusCode, res.headers);\n c_res.end(s_data, 'binary');\n }\n });\n }\n var request = http.request(reqOptions, callbackFunc).end(c_data, 'binary');\n });\n}", "sendDataToServer1() {\n //send http-request to hemmo-backend butto\n let host = 'http://127.0.0.1:3001';\n let link = '/data_to_server1';\n\n // host + link = 127.0.0.3000/data_to_server // require that kind of end point to backend to handle http-request\n //FETCH -> POST (head , body -> content-type: JSON ) ,\n let postData = {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(this.state),\n };\n\n fetch(host + link, postData)\n .then(resp => {\n return resp.json();\n })\n .then(r => {\n console.log('Fetch done successfuly !');\n //back-end response here\n //*********************************************************************** */\n this.state.additionalValue = 'http-respond, method=POST ' + r;\n this.setState(this.state);\n })\n .catch(err => {\n console.log('404 error, page not found');\n console.log('ERR', err);\n });\n\n console.log('Send http-request to end-point : ' + host + link);\n console.log('current message is :' + this.state.fieldvalue);\n }", "function _getResponse(){_getResponse=_asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request,config){var stageOne,response;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return fetch(request);case 3:stageOne=_context2.sent;_context2.next=9;break;case 6:_context2.prev=6;_context2.t0=_context2[\"catch\"](0);return _context2.abrupt(\"return\",createError('Network Error',config,'ERR_NETWORK',request));case 9:response={ok:stageOne.ok,status:stageOne.status,statusText:stageOne.statusText,headers:new Headers(stageOne.headers),// Make a copy of headers\n config:config,request:request};if(!(stageOne.status>=200&&stageOne.status!==204)){_context2.next=34;break;}_context2.t1=config.responseType;_context2.next=_context2.t1==='arraybuffer'?14:_context2.t1==='blob'?18:_context2.t1==='json'?22:_context2.t1==='formData'?26:30;break;case 14:_context2.next=16;return stageOne.arrayBuffer();case 16:response.data=_context2.sent;return _context2.abrupt(\"break\",34);case 18:_context2.next=20;return stageOne.blob();case 20:response.data=_context2.sent;return _context2.abrupt(\"break\",34);case 22:_context2.next=24;return stageOne.json();case 24:response.data=_context2.sent;return _context2.abrupt(\"break\",34);case 26:_context2.next=28;return stageOne.formData();case 28:response.data=_context2.sent;return _context2.abrupt(\"break\",34);case 30:_context2.next=32;return stageOne.text();case 32:response.data=_context2.sent;return _context2.abrupt(\"break\",34);case 34:return _context2.abrupt(\"return\",response);case 35:case\"end\":return _context2.stop();}},_callee2,null,[[0,6]]);}));return _getResponse.apply(this,arguments);}", "request(verb, requestUrl, data, headers) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._disposed) {\n throw new Error(\"Client has already been disposed.\");\n }\n let parsedUrl = url.parse(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n let maxTries = (this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1) ? this._maxRetries + 1 : 1;\n let numTries = 0;\n let response;\n while (numTries < maxTries) {\n response = yield this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (let i = 0; i < this.handlers.length; i++) {\n if (this.handlers[i].canHandleAuthentication(response)) {\n authenticationHandler = this.handlers[i];\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1\n && this._allowRedirects\n && redirectsRemaining > 0) {\n const redirectUrl = response.message.headers[\"location\"];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n let parsedRedirectUrl = url.parse(redirectUrl);\n if (parsedUrl.protocol == 'https:' && parsedUrl.protocol != parsedRedirectUrl.protocol && !this._allowRedirectDowngrade) {\n throw new Error(\"Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.\");\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n yield response.readBody();\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = yield this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n yield response.readBody();\n yield this._performExponentialBackoff(numTries);\n }\n }\n return response;\n });\n }", "function postToCa(request,data){\n console.log(\"posting csr to ca:\");\n console.log(data);\n //http-post header / optionen\n var caPostOptions = {\n hostname: 'h2418540.stratoserver.net',//localhost\n // hostname: 'localhost',//localhost\n port: 8080,\n path: '/certificateRequests',\n method: 'POST',\n headers: {\n 'Content-Type': 'text/plain',\n 'Content-Length': data.length\n }\n };\n \n //request an ca aufbauen\n var req = http.request(caPostOptions,function(res){\n //antwort der ca \n console.log(\"response ca: \" + res.statusCode);\n var caResponse = '';\n //ca schickt daten, kann in mehreren blöcken geschehen(theoretisch)\n var data;\n res.on('data', function(chunk){\n console.log(\"chunk: \"+ chunk);\n caResponse += chunk;\n //mail(request,chunk);\n //verifyCert(chunk.toString());\n });\n \n //fehler bei http-post\n res.on('error', function(e){\n console.log(\"error: \" + e);\n return false;\n });\n \n res.on('end', function () {\n console.log('end');\n mail(request,caResponse);\n //verifyCert(data.toString());\n });\n \n })\n //request schreiben und schicken\n req.write(data);\n req.end();\n return true;\n}", "async doRequest(method, data, additionalPath, additionalHeaders) {\r\n return new Promise((resolve, reject) => {\r\n const headers = additionalHeaders || {};\r\n let uri = this._networkEndPoint.getUri();\r\n let path = this._networkEndPoint.getRootPath();\r\n if (!stringHelper_1.StringHelper.isEmpty(additionalPath)) {\r\n const stripped = `/${additionalPath.replace(/^\\/*/, \"\")}`;\r\n path += stripped;\r\n uri += stripped;\r\n }\r\n const options = {\r\n protocol: `${this._networkEndPoint.getProtocol()}:`,\r\n hostname: this._networkEndPoint.getHost(),\r\n port: this._networkEndPoint.getPort(),\r\n path: path,\r\n method: method,\r\n headers,\r\n timeout: this._timeoutMs > 0 ? this._timeoutMs : undefined\r\n };\r\n if ((method === \"GET\" || method === \"DELETE\") && !objectHelper_1.ObjectHelper.isEmpty(data)) {\r\n options.path += data;\r\n }\r\n const req = this._httpClientRequest(options, (res) => {\r\n let responseData = \"\";\r\n res.setEncoding(\"utf8\");\r\n res.on(\"data\", (responseBody) => {\r\n responseData += responseBody;\r\n });\r\n res.on(\"end\", () => {\r\n if (res.statusCode === 200) {\r\n resolve(responseData);\r\n }\r\n else {\r\n this._logger.info(\"<=== NetworkClient::Received Fail\", { code: res.statusCode, data: responseData });\r\n reject(new networkError_1.NetworkError(`Failed ${method} request`, {\r\n endPoint: uri,\r\n errorResponseCode: res.statusCode,\r\n errorResponse: responseData || res.statusMessage\r\n }));\r\n }\r\n });\r\n });\r\n req.on(\"error\", (err) => {\r\n this._logger.error(\"<=== NetworkClient::Errored\");\r\n reject(new networkError_1.NetworkError(`Failed ${method} request`, {\r\n endPoint: uri,\r\n errorResponse: err\r\n }));\r\n });\r\n req.on(\"timeout\", (err) => {\r\n this._logger.error(\"<=== NetworkClient::Timed Out\");\r\n reject(new networkError_1.NetworkError(`Failed ${method} request, timed out`, {\r\n endPoint: uri\r\n }));\r\n });\r\n if (method !== \"GET\" && method !== \"DELETE\" && !objectHelper_1.ObjectHelper.isEmpty(data)) {\r\n req.write(data);\r\n }\r\n req.end();\r\n });\r\n }", "end() {\n this.finished = true;\n this.promiseFunction = () => rp({\n method: 'post',\n url: `${this.url}/expectations`,\n json: true,\n body: {\n request: this.req,\n response: this.res,\n repeat: this.rep,\n },\n });\n return this.promise;\n }", "function createRequestExecutor(\n options,\n httpModule,\n agent,\n) {\n const { hostname, pathname, port, protocol, search } = new url.URL(options.url);\n return function makeRequest(request) {\n return new Promise((resolve, reject) => {\n let body = streamFromBody(request.body);\n\n const headers = { ...options.headers };\n\n if (request.body.length > GZIP_THRESHOLD) {\n headers['content-encoding'] = 'gzip';\n body = body.pipe(zlib.createGzip());\n }\n\n const req = httpModule.request(\n {\n method: 'POST',\n agent,\n headers,\n hostname,\n path: `${pathname}${search}`,\n port,\n protocol,\n ca: options.caCerts,\n },\n res => {\n res.on('data', () => {\n // Drain socket\n });\n\n res.on('end', () => {\n // Drain socket\n });\n\n res.setEncoding('utf8');\n\n // \"Key-value pairs of header names and values. Header names are lower-cased.\"\n // https://nodejs.org/api/http.html#http_message_headers\n const retryAfterHeader = _nullishCoalesce(res.headers['retry-after'], () => ( null));\n const rateLimitsHeader = _nullishCoalesce(res.headers['x-sentry-rate-limits'], () => ( null));\n\n resolve({\n statusCode: res.statusCode,\n headers: {\n 'retry-after': retryAfterHeader,\n 'x-sentry-rate-limits': Array.isArray(rateLimitsHeader) ? rateLimitsHeader[0] : rateLimitsHeader,\n },\n });\n },\n );\n\n req.on('error', reject);\n body.pipe(req);\n });\n };\n}", "path(method, path, delegate) {\n\n // Cache the path\n this.paths.push({\n method: method,\n path: path,\n delegate: delegate\n });\n\n let executionContext = { logger: this.logger };\n\n // Create a new express route\n if (method == 'GET') this.app.get(path, (req, res) => {\n\n // Validating\n this.validator.validate(req).then((validationResult) => {\n\n if (validationResult.errors) { res.status(400).type('application/json').send({ code: 400, message: 'Validation errors', errors: validationResult.errors }); return; }\n\n // Log the fact that a call has been received\n this.logger.apiIn(req.headers['x-correlation-id'], method, path, req.headers['x-msg-id']);\n\n // Extract the data to add to the execution context\n executionContext.cid = req.headers['x-correlation-id'];\n executionContext.appVersion = req.headers['x-app-version'];\n\n // Execute the GET\n delegate.do(req, validationResult.userContext, executionContext).then((data) => {\n // Success\n res.status(200).type('application/json').send(data);\n }, (err) => {\n\n let errString = err;\n if (typeof err === 'object' && Object.keys(err)) errString = JSON.stringify(err);\n\n // Log\n this.logger.compute(req.headers['x-correlation-id'], errString, 'error');\n // If the err is a {code: 400, message: '...'}, then it's a validation error\n if (err != null && err.code == '400') res.status(400).type('application/json').send(err);\n // Failure\n else res.status(500).type('application/json').send(err);\n });\n });\n\n });\n else if (method == 'POST') this.app.post(path, (req, res) => {\n\n // Validating\n this.validator.validate(req).then((validationResult) => {\n\n if (validationResult.errors) { res.status(400).type('application/json').send({ code: 400, message: 'Validation errors', errors: validationResult.errors }); return; }\n\n // Log the fact that a call has been received\n this.logger.apiIn(req.headers['x-correlation-id'], method, path, req.headers['x-msg-id']);\n\n // Extract the data to add to the execution context\n executionContext.cid = req.headers['x-correlation-id'];\n executionContext.appVersion = req.headers['x-app-version'];\n\n // Execute the POST\n delegate.do(req, validationResult.userContext, executionContext).then((data) => {\n // Success\n res.status(201).type('application/json').send(data);\n }, (err) => {\n\n let errString = err;\n if (typeof err === 'object' && Object.keys(err)) errString = JSON.stringify(err);\n\n // Log\n this.logger.compute(req.headers['x-correlation-id'], errString, 'error');\n // If the err is a {code: 400, message: '...'}, then it's a validation error\n if (err != null && err.code == '400') res.status(400).type('application/json').send(err);\n // Failure\n else res.status(500).type('application/json').send(err);\n });\n });\n\n });\n else if (method == 'DELETE') this.app.delete(path, (req, res) => {\n\n // Validating\n this.validator.validate(req).then((validationResult) => {\n\n if (validationResult.errors) { res.status(400).type('application/json').send({ code: 400, message: 'Validation errors', errors: validationResult.errors }); return; }\n\n // Log the fact that a call has been received\n this.logger.apiIn(req.headers['x-correlation-id'], method, path, req.headers['x-msg-id']);\n\n // Extract the data to add to the execution context\n executionContext.cid = req.headers['x-correlation-id'];\n executionContext.appVersion = req.headers['x-app-version'];\n\n // Execute the DELETE\n delegate.do(req, validationResult.userContext, executionContext).then((data) => {\n // Success\n res.status(200).type('application/json').send(data);\n }, (err) => {\n\n let errString = err;\n if (typeof err === 'object' && Object.keys(err)) errString = JSON.stringify(err);\n\n // Log\n this.logger.compute(req.headers['x-correlation-id'], errString, 'error');\n // If the err is a {code: 400, message: '...'}, then it's a validation error\n if (err != null && err.code == '400') res.status(400).type('application/json').send(err);\n // Failure\n else res.status(500).type('application/json').send(err);\n });\n\n });\n });\n else if (method == 'PUT') this.app.put(path, (req, res) => {\n\n // Validating\n this.validator.validate(req).then((validationResult) => {\n\n if (validationResult.errors) { res.status(400).type('application/json').send({ code: 400, message: 'Validation errors', errors: validationResult.errors }); return; }\n\n // Log the fact that a call has been received\n this.logger.apiIn(req.headers['x-correlation-id'], method, path, req.headers['x-msg-id']);\n\n // Extract the data to add to the execution context\n executionContext.cid = req.headers['x-correlation-id'];\n executionContext.appVersion = req.headers['x-app-version'];\n\n // Execute the PUT\n delegate.do(req, validationResult.userContext, executionContext).then((data) => {\n // Success\n res.status(200).type('application/json').send(data);\n }, (err) => {\n\n let errString = err;\n if (typeof err === 'object' && Object.keys(err)) errString = JSON.stringify(err);\n\n // Log\n this.logger.compute(req.headers['x-correlation-id'], errString, 'error');\n // If the err is a {code: 400, message: '...'}, then it's a validation error\n if (err != null && err.code == '400') res.status(400).type('application/json').send(err);\n // Failure\n else res.status(500).type('application/json').send(err);\n });\n });\n });\n\n // Log the added path\n console.log('[' + this.apiName + '] - Successfully added method ' + method + ' ' + path);\n }", "function generateMockRequestAndResponse (statusCode, forwarded, ip, url) {\n let req = {\n connection: {\n remoteAddress: ip || '8.8.8.8'\n },\n headers: {\n host: 'http://0.0.0.0',\n referer: 'http://google.com',\n 'user-agent':\n 'Mozilla/5.0 (Windows NT x.y; WOW64; rv:10.0) Gecko/20100101 Firefox/10.0'\n },\n httpVersion: '1.1',\n method: 'GET',\n url: url || '/test',\n path: url || '/test'\n }\n\n if (forwarded) {\n req.connection.remoteAddress = '8.8.4.4'\n req.headers['x-forwarded-for'] = ip || '8.8.8.8'\n }\n\n let res = new http.ServerResponse(req)\n res.statusCode = statusCode || 200\n res.setHeader('content-length', 305)\n\n return {\n res: res,\n req: req,\n next: function () {\n res.end()\n }\n }\n}", "async request(verb, requestUrl, data, headers) {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n let parsedUrl = Url.parse(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n while (numTries < maxTries) {\n response = await this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (let i = 0; i < this.handlers.length; i++) {\n if (this.handlers[i].canHandleAuthentication(response)) {\n authenticationHandler = this.handlers[i];\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n let parsedRedirectUrl = Url.parse(redirectUrl);\n if (parsedUrl.protocol == 'https:' &&\n parsedUrl.protocol != parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n await response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (let header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = await this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n await response.readBody();\n await this._performExponentialBackoff(numTries);\n }\n }\n return response;\n }", "async request(verb, requestUrl, data, headers) {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n let parsedUrl = Url.parse(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n while (numTries < maxTries) {\n response = await this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (let i = 0; i < this.handlers.length; i++) {\n if (this.handlers[i].canHandleAuthentication(response)) {\n authenticationHandler = this.handlers[i];\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n let parsedRedirectUrl = Url.parse(redirectUrl);\n if (parsedUrl.protocol == 'https:' &&\n parsedUrl.protocol != parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n await response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (let header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = await this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n await response.readBody();\n await this._performExponentialBackoff(numTries);\n }\n }\n return response;\n }", "async function authTransaction(orgTkn,dest,amount)\n{\n return new Promise((resolve,reject)=>{\n var recivedData ='';\n var requestPath = \"/Payments/authTransaction/\"+amount+\"/\"+orgTkn+\"/\"+dest\n \n const options = {\n hostname: config.COCOBANCO_IP,\n port: 3007,\n path: requestPath,\n method: 'GET',\n }\n \n const req = http.request(options, res => {\n \n res.on('data', d => {\n recivedData += d;\n \n \n }).on('end',()=>\n {\n console.debug(recivedData)\n resolve(JSON.parse(recivedData));\n });\n })\n \n req.on('error', error => {\n console.error(\"error!! \"+error)\n reject(error)\n })\n \n req.end()\n })\n}", "async function proxySignInRequest(apiUrl, req, res) {\n try {\n // Make the request to our API with `got` in JSON mode. We will want to\n // inspect the result of this request instead of simply streaming\n // it through.\n const apiResponse = await apiClient.post(\n {...apiUrl, path: req.url},\n {\n json: false,\n headers: {\n \"Content-Type\": \"application/json\",\n Forwarded: getForwardedHeader(req),\n },\n body: req,\n },\n );\n\n // Attempt to parse the API response body.\n const result = JSON.parse(apiResponse.body);\n\n // If we got a not-ok response then send the response exactly back to\n // our browser.\n if (result.ok !== true) {\n res.statusCode = apiResponse.statusCode;\n res.setHeader(\"Content-Type\", \"application/json\");\n res.write(JSON.stringify(result));\n res.end();\n return;\n }\n\n // Set our refresh token and access token as secure cookies. HTTP-only\n // is very important here as it avoids XSS security vulnerabilities!\n //\n // Since refresh tokens are very dangerous in the wrong hands we also\n // force the cookie to only be sent over secure contexts.\n res.setHeader(\"Set-Cookie\", [\n cookie.serialize(\"access_token\", result.data.accessToken, cookieSettings),\n cookie.serialize(\n \"refresh_token\",\n result.data.refreshToken,\n cookieSettings,\n ),\n ]);\n\n // Send an ok response to our client. We remove the refresh and access\n // tokens from the response body so that client-side code will never\n // have access to them.\n res.statusCode = 200;\n res.setHeader(\"Content-Type\", \"application/json\");\n res.write(\n JSON.stringify({\n ok: true,\n data: {\n accessToken: \"\",\n refreshToken: \"\",\n },\n }),\n );\n res.end();\n } catch (error) {\n // Send an unknown error to the client.\n handleError(res, error);\n }\n}", "function run_request(req, reply){\n if(router){\n router(req, function(error, answer){\n if(error){\n logger.error(error);\n }\n reply(error, answer);\n }, function(){\n process.nextTick(function(){\n warehouse_proxy(req, reply); \n })\n })\n }\n else{\n process.nextTick(function(){\n warehouse_proxy(req, reply);\n })\n }\n }", "function request1() {\n return new Promise((resolve, reject) => {\n setTimeout(() => resolve ({\n data: 'Data',\n makeAnotherRequest: true\n }), 2000);\n });\n }", "async request(verb, requestUrl, data, headers) {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n let parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n while (numTries < maxTries) {\n response = await this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (let i = 0; i < this.handlers.length; i++) {\n if (this.handlers[i].canHandleAuthentication(response)) {\n authenticationHandler = this.handlers[i];\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n let parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol == 'https:' &&\n parsedUrl.protocol != parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n await response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (let header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = await this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n await response.readBody();\n await this._performExponentialBackoff(numTries);\n }\n }\n return response;\n }", "async request(verb, requestUrl, data, headers) {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n let parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n while (numTries < maxTries) {\n response = await this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (let i = 0; i < this.handlers.length; i++) {\n if (this.handlers[i].canHandleAuthentication(response)) {\n authenticationHandler = this.handlers[i];\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n let parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol == 'https:' &&\n parsedUrl.protocol != parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n await response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (let header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = await this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n await response.readBody();\n await this._performExponentialBackoff(numTries);\n }\n }\n return response;\n }", "async request(verb, requestUrl, data, headers) {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n let parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n while (numTries < maxTries) {\n response = await this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (let i = 0; i < this.handlers.length; i++) {\n if (this.handlers[i].canHandleAuthentication(response)) {\n authenticationHandler = this.handlers[i];\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n let parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol == 'https:' &&\n parsedUrl.protocol != parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n await response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (let header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = await this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n await response.readBody();\n await this._performExponentialBackoff(numTries);\n }\n }\n return response;\n }", "async request(verb, requestUrl, data, headers) {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n let parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n while (numTries < maxTries) {\n response = await this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (let i = 0; i < this.handlers.length; i++) {\n if (this.handlers[i].canHandleAuthentication(response)) {\n authenticationHandler = this.handlers[i];\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n let parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol == 'https:' &&\n parsedUrl.protocol != parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n await response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (let header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = await this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n await response.readBody();\n await this._performExponentialBackoff(numTries);\n }\n }\n return response;\n }", "async request(verb, requestUrl, data, headers) {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n let parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n while (numTries < maxTries) {\n response = await this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (let i = 0; i < this.handlers.length; i++) {\n if (this.handlers[i].canHandleAuthentication(response)) {\n authenticationHandler = this.handlers[i];\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n let parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol == 'https:' &&\n parsedUrl.protocol != parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n await response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (let header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = await this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n await response.readBody();\n await this._performExponentialBackoff(numTries);\n }\n }\n return response;\n }", "async request(verb, requestUrl, data, headers) {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n let parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n while (numTries < maxTries) {\n response = await this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (let i = 0; i < this.handlers.length; i++) {\n if (this.handlers[i].canHandleAuthentication(response)) {\n authenticationHandler = this.handlers[i];\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n let parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol == 'https:' &&\n parsedUrl.protocol != parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n await response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (let header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = await this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n await response.readBody();\n await this._performExponentialBackoff(numTries);\n }\n }\n return response;\n }", "async request(verb, requestUrl, data, headers) {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n let parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n while (numTries < maxTries) {\n response = await this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (let i = 0; i < this.handlers.length; i++) {\n if (this.handlers[i].canHandleAuthentication(response)) {\n authenticationHandler = this.handlers[i];\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n let parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol == 'https:' &&\n parsedUrl.protocol != parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n await response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (let header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = await this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n await response.readBody();\n await this._performExponentialBackoff(numTries);\n }\n }\n return response;\n }", "request_POST(self, url, params, fnSuccessResponse = null, headers = null, fnFailureResponse = null, finallyHandler = null) {\n console.log(\"post\")\n if (headers == null) {\n let token = \"\"\n if (sessionStorage.getItem(\"token\"))\n token = sessionStorage.getItem(\"token\")\n\n headers = {\n 'token': token,\n }\n }\n axios_instance.post(url, params, {\n headers: headers,\n })\n .then(function (response) {\n console.log(\"response.data.success=\" + response.data.success)\n if (fnSuccessResponse != null) {\n if (response.data.success == false)\n self.showSnakeBar(\"error\", response.data.message)\n console.log(\"log1.1\")\n fnSuccessResponse(response);\n }\n })\n .catch(function (error) {\n console.log(error);\n if (!error.response) {\n console.log(error)\n } else {\n console.log(error.response.data.status_code)\n self.handle400(error.response);\n self.handle401(error.response.status);\n self.handle440(error.response.status);\n self.handle403(error.response.status);\n self.handle500(error.response.status);\n if (fnFailureResponse != null) {\n fnFailureResponse();\n } else {\n self.handleNoInternetConnection()\n }\n }\n }).finally(function (res) {\n if (finallyHandler !== null) {\n finallyHandler()\n }\n });\n }", "function tran(req, res){\r\n\t\t\t\tif(!req || !res || !req.body || !req.headers){ return }\r\n\t\t\t\tif(req.url){ req.url = url.format(req.url) }\r\n\t\t\t\tvar msg = req.body;\r\n\t\t\t\t// AUTH for non-replies.\r\n\t\t\t\tif(gun.wsp.msg(msg['#'])){ return }\r\n\t\t\t\tgun.wsp.on('network', Gun.obj.copy(req));\r\n\t\t\t\tif(msg['@']){ return } // no need to process.\r\n\t\t\t\tif(msg['$'] && msg['$']['#']){ return tran.get(req, res) }\r\n\t\t\t\t//if(Gun.is.lex(msg['$'])){ return tran.get(req, res) }\r\n\t\t\t\telse { return tran.put(req, res) }\r\n\t\t\t\tcb({body: {hello: 'world'}});\r\n\t\t\t\t// TODO: BUG! server put should push.\r\n\t\t\t}", "function sendRequest(req, body, options) {\n var onBeforeRequestPromise = typeof options.onBeforeRequest === 'function' ? Promise.resolve(options.onBeforeRequest(req)) : Promise.resolve();\n return onBeforeRequestPromise.then(function () {\n return req.send(body).then(function (res) {\n var onAfterResponsePromise = typeof options.onAfterResponse === 'function' ? Promise.resolve(options.onAfterResponse(req, res)) : Promise.resolve();\n return onAfterResponsePromise.then(function () {\n return res;\n });\n });\n });\n }", "function request(url) {\n\t\t\t\tvar pingerResponseString\n\t\t\t\tvar writeHeadInvocation = 0\n\n\t\t\t\t// make sure ops initialized the url\n\t\t\t\tvar opsMiddleware = app.gets[url]\n\t\t\t\tassert.ok(opsMiddleware, 'test url was not registered by ops')\n\n\t\t\t\t// execute a request for the tested ops intance to repond to\n\t\t\t\tvar mockRequestInstance\n\t\t\t\tvar mockResponseInstance = {\n\t\t\t\t\twriteHead: writeHead,\n\t\t\t\t\tsend: send\t\t\t\t\n\t\t\t\t}\n\t\t\t\topsMiddleware(mockRequestInstance, mockResponseInstance)\n\n\t\t\t\t// check outcome, return response\n\t\t\t\tassert.equal(writeHeadInvocation, 1, 'ops did not set response code:' + writeHeadInvocation)\n\t\t\t\treturn pingerResponseString\n\n\t\t\t\t// reponse.writeHead mockup\n\t\t\t\tfunction writeHead(code, json) {\n\t\t\t\t\tassert.equal(code, 200, 'ops responded with bad status code:' + code)\n\t\t\t\t\twriteHeadInvocation++\n\t\t\t\t}\n\n\t\t\t\t// response.send mockup\n\t\t\t\tfunction send(jsonString, headerObject, statusCode) {\n\t\t\t\t\tif (headerObject || statusCode) writeHead(statusCode, headerObject)\n\t\t\t\t\tpingerResponseString =jsonString\n\t\t\t\t}\n\n\t\t\t}", "async function onRequest(rawReq, rawRes) {\n const startTime = Date.now()\n const reqURL = getURL(rawReq)\n\n try {\n\n logger.info(logger.cyan(rawReq.method), reqURL)\n\n const req = new Request(rawReq, upstream.getAgent(rawReq))\n const res = { statusCode: 200, headers: {}, body: '' }\n\n for (const { pattern, match, handle } of rules) {\n req.params = match(req)\n if (req.params) {\n logger.debug(logger.yellow(`${req.method}:${pattern}`), reqURL)\n if (await Promise.resolve(handle(req, res)) === false) {\n break\n }\n }\n }\n\n logger.info(logger.green(`${req.method}:responding`), reqURL, logger.green(`[${Date.now() - startTime}ms]`))\n rawRes.writeHead(res.statusCode, res.headers)\n\n if (res.body instanceof stream.Readable) {\n res.body.pipe(rawRes)\n await waitFor(res.body, 'end')\n } else {\n rawRes.end(res.body)\n }\n\n logger.info(logger.green(`${req.method}:${res.statusCode}`), reqURL, logger.green(`[${Date.now() - startTime}ms]`))\n\n } catch (error) {\n\n logger.error(logger.red(rawReq.method), reqURL, logger.red(`[${Date.now() - startTime}ms]`), '\\n', error.stack)\n\n if (rawRes.writable) {\n rawRes.writeHead(500)\n rawRes.end()\n }\n }\n }", "async function performRequest(res) {\n await request(options)\n .then(function(res) {\n patientData.feedInfos(res);\n patientData.checkStatus();\n })\n .catch(function(err) {\n console.log(err);\n })\n if (patientData.status === 1) {\n res.redirect('/info');\n res.end();\n } else {\n console.log(\"Data invalid\");\n res.redirect('/getCode');\n res.end();\n }\n}", "function subscribeInvoke(req, next) {\n // console.log(\"Invoked with\", req);\n var current_ts = \"\" + Math.floor(Date.now() / 1000);\n console.log(req);\n var allData1 = {\n \"peers\" : [\"peer0.org1.example.com\",\"peer1.org1.example.com\"],\n \"fcn\" : \"invoke\",\n \"args\" : [\"subscribe\", req.eventHash, req.participantName, current_ts],\n };\n\n var args1 = {\n data: allData1,\n headers: {\n \"Authorization\" : TokenForServer,\n \"Content-Type\": \"application/json\" },\n requestConfig: {\n timeout: 30000, //request timeout in milliseconds\n noDelay: true, //Enable/disable the Nagle algorithm\n keepAlive: true, //Enable/disable keep-alive functionalityidle socket.\n keepAliveDelay: 1000 //and optionally set the initial delay before the first keepalive probe is sent\n },\n };\n\n // Subscribe given user\n // sleep.sleep(1);\n var subscribeTxReq = client.post(SDKWebServerAddress + \"/channels/mychannel/chaincodes/lottery\", args1, function (data, response) {\n // parsed response body as js object\n console.log(\"data\", data);\n var tx_id = data.tx_id_string_;\n var payload = data.payload_;\n console.log(\"error flag\", data.flag);\n console.log(\"error message\" ,data.error_message);\n\n\n if (typeof payload !== \"strings\") {\n logger.debug(\"Typeof payload:\", typeof payload);\n payload = \"null\";\n }\n // logger.debug(typeof payload);\n // logger.debug(\"tx_id\", tx_id);\n // logger.debug(\"payload\", data.payload_);\n // logger.debug(\"Payload parse\", JSON.parse(data.payload_));\n logger.debug(\"EventName\", JSON.parse(data.payload_).EventName);\n logger.debug(\"EventHash\", JSON.parse(data.payload_).EventHash);\n updateLocalCache(cachedLotteries, JSON.parse(data.payload_));\n // raw response\n // console.log(\"response\", response);\n // token = data.token;\n // message = data.message;\n // secret = data.secret;\n\n // logger.info(token, message, secret);\n\n // when email entered\n if (validateEmail(req.participantName)) {\n RegisterByEmail(req.participantName, req.lotteryName, req.eventHash, req.token);\n }\n\n console.log(\"req.reses length\", req.reses.length);\n console.log(\"req.reses typeof\", typeof req.reses);\n var i = 0;\n for (res of req.reses) {\n if (data.flag == 1) {\n res.send(500, {error : data.error_message});\n // res.end();\n continue;\n }\n\n // res.write(req.tokens[i], \" 참여 성공!\"); \n res.write(req.tokens[i] + \" 참여 성공!\"); \n console.log(req.tokens[i]);\n ++i;\n res.end();\n // req.res.write(req.token);\n // req.res.end();\n }\n\n next();\n });\n\n subscribeTxReq.on('error', function(err) {\n logger.error(err);\n res.status(408).send(\"응모 실패\");\n return;\n });\n\n subscribeTxReq.on('requestTimeout', function (req) {\n logger.warn('응모 트랜잭션 실패');\n res.status(408).send(\"응모 실패\");\n subscribeTxReq.abort();\n return;\n });\n\n\n var useridentity = {\n lotteryName_ : req.lotteryName,\n participantName_ : req.participantName,\n // identityHash_ : identityHash,\n // encryptedIdentity_ : recordedIdentity,\n nonce_ : req.nonce,\n token_ : req.token\n };\n\n UserInfoTable.push(useridentity);\n console.log(\"New user added(\" + UserInfoTable.length + \")\");\n}", "async function redirectHandler(req, res, next) {\n var body = '<html><body><h4>OAuth2 authorize complete. ' +\n 'You can close this tab.</h4></body></html>';\n res.writeHead(200, {\n 'Content-Length': Buffer.byteLength(body),\n 'Content-Type': 'text/html'\n });\n res.write(body);\n res.end();\n\n console.log('\\nGot code (α): ' + req.query.code + '\\n');\n\n console.log('press any key to continue...');\n await keypress();\n\n var form = {\n grant_type: 'authorization_code',\n redirect_uri: program.redirect_uri,\n client_id: program.client_id,\n code: req.query.code,\n code_verifier: codeVerifier\n };\n\n console.log('\\nCalling /token endpoint with:');\n console.log('client_id: ' + form.client_id);\n console.log('code_verifier (v): ' + form.code_verifier);\n console.log('code (α): ' + form.code + '\\n');\n\n console.log(\n 'Here is the complete form post that will be sent to the /token endpoint:'\n );\n console.log(form);\n console.log();\n\n console.log('press any key to continue...');\n await keypress();\n\n // Step 3: call token endpoint to exchange code for tokens\n request.post(\n {\n url: program.auth_server + '/token',\n form: form\n },\n function (err, httpResponse, body) {\n var tokenResponse = JSON.parse(body);\n tokenResponseHandler(tokenResponse);\n return next();\n }\n );\n}", "sendRequest(url, opts) {\n const { axios, tracer, serviceName } = this;\n const { method } = opts;\n\n return new Promise((resolve, reject) => {\n tracer.scoped(() => {\n tracer.setId(tracer.createChildId());\n const traceId = tracer.id;\n\n tracer.recordServiceName(serviceName);\n tracer.recordRpc(method.toUpperCase());\n tracer.recordBinary('http.url', url);\n tracer.recordAnnotation(new Annotation.ClientSend());\n\n const config = Request.addZipkinHeaders(opts, traceId);\n config.url = url;\n axios.request(config)\n .then(result => {\n tracer.scoped(() => {\n tracer.setId(traceId);\n tracer.recordBinary('http.status_code', result.status.toString());\n tracer.recordAnnotation(new Annotation.ClientRecv());\n });\n resolve(result);\n })\n .catch(err => {\n tracer.scoped(() => {\n tracer.setId(traceId);\n tracer.recordBinary('request.error', err.toString());\n tracer.recordAnnotation(new Annotation.ClientRecv());\n });\n reject(err);\n });\n });\n });\n }", "_m_exec_http_request(ph_args, pf_process_next_in_queue) {\n const lo_this = this;\n\n const ph_query_opts = ph_args.ph_query_opts;\n\n const pf_json_callback = lo_this.m_pick_option(ph_args, \"pf_json_callback\");\n const pi_timeout_ms = lo_this.m_pick_option(ph_args, \"pi_timeout_ms\");\n const ps_call_context = lo_this.m_pick_option(ph_args, \"ps_call_context\");\n const ps_method = lo_this.m_pick_option(ph_args, \"ps_method\");\n const ps_url_end_point = lo_this.m_pick_option(ph_args, \"ps_url_end_point\");\n const ps_url_path = lo_this.m_pick_option(ph_args, \"ps_url_path\");\n\n const ls_url_full = f_join_non_blank_vals('', f_string_remove_trailing_slash(ps_url_end_point), ps_url_path);\n\n\n // credentials to call our own services\n const ps_http_pass = lo_this.m_pick_option(ph_args, \"ps_http_pass\", true);\n const ps_http_user = lo_this.m_pick_option(ph_args, \"ps_http_user\", true);\n\n /* eslint multiline-ternary:0, no-ternary:0 */\n const lh_auth = (f_string_is_blank(ps_http_pass) ? null : {\n user: ps_http_user,\n pass: ps_http_pass,\n sendImmediately: true\n });\n\n\n // one more call\n lo_this._ai_call_count_exec_total ++;\n f_chrono_start(lo_this._as_queue_chrono_name);\n\n // at first call\n if (lo_this._ab_first_call) {\n lo_this._ab_first_call = false;\n f_console_OUTGOING_CNX(`target=[${ls_url_full}] login=[${ps_http_user}] way=[push] comment=[connection ${lo_this.m_get_context(ps_call_context)}]`);\n }\n\n const ls_full_call_context = lo_this.m_get_context(`[#${lo_this._ai_call_count_exec_total}]`, ps_call_context);\n\n f_console_verbose(1, `${ls_full_call_context} - init`);\n\n // https://github.com/request/request#requestoptions-callback\n const lh_query_opts = f_object_extend({\n method: ps_method,\n url: ls_url_full,\n\n agent: false,\n auth: lh_auth,\n encoding: \"utf8\",\n json: true,\n rejectUnauthorized: false,\n requestCert: false,\n timeout: pi_timeout_ms,\n }, ph_query_opts);\n\n const ls_call_chrono_name = f_digest_md5_hex(f_join_non_blank_vals('~', lo_this._as_queue_chrono_name, lo_this._ai_call_count_exec_total, f_date_format_iso()));\n f_chrono_start(ls_call_chrono_name);\n\n\n // one more pending request in parallel...\n lo_this._ai_parallel_current ++;\n lo_this._ai_parallel_max = f_number_max(lo_this._ai_parallel_max, lo_this._ai_parallel_current);\n\n cm_request(lh_query_opts, function(ps_error, po_response, po_json_response) {\n\n // one less pending request in parallel...\n lo_this._ai_parallel_current --;\n\n const li_call_duration_ms = f_chrono_elapsed_ms(ls_call_chrono_name);\n f_console_verbose(2, `${ls_full_call_context} - call took [${f_human_duration(li_call_duration_ms, true)}]`);\n\n // collect stats\n lo_this._ai_call_duration_total_ms += li_call_duration_ms;\n lo_this._ai_call_duration_max_ms = f_number_max(lo_this._ai_call_duration_max_ms, li_call_duration_ms);\n lo_this._ai_call_duration_min_ms = f_number_min(lo_this._ai_call_duration_min_ms, li_call_duration_ms);\n\n try {\n\n // error ?\n if (f_string_is_not_blank(ps_error)) {\n throw f_console_error(`${ls_full_call_context} - ${ps_error}`);\n }\n\n const li_statusCode = po_response.statusCode;\n if (li_statusCode !== 200) {\n throw f_console_error(`${ls_full_call_context} - call returned statusCode=[${li_statusCode} / ${po_response.statusMessage}] on URL=[${ls_url_full}] - reponse=[${f_console_stringify(po_json_response)}]`);\n }\n\n if (f_is_not_defined(po_json_response)) {\n throw f_console_error(`${ls_full_call_context} - returned an empty body`);\n }\n\n f_console_verbose(3, `${ls_full_call_context} - returned statusCode=[${li_statusCode}] with raw response:`, {\n po_json_response: po_json_response\n });\n\n if (f_is_defined(po_json_response.errors)) {\n throw f_console_error(`${ls_full_call_context} - errors=[${f_console_stringify(po_json_response.errors)}]`);\n }\n\n if (f_is_defined(po_json_response.error)) {\n throw f_console_error(`${ls_full_call_context} - error=[${f_console_stringify(po_json_response.error)}]`);\n }\n\n // give a context to the reply\n po_json_response.as_call_context = ls_full_call_context;\n\n // positive feed-back through the call-back\n pf_json_callback(null, po_json_response);\n }\n\n catch (po_err) {\n f_console_catch(po_err);\n }\n\n // handle the next pending element in the queue\n f_console_verbose(2, `${lo_this.m_get_context()} - next in queue...`);\n pf_process_next_in_queue();\n });\n }", "function makeRequest(options, responseEndCallback, requestId){\n //console.log('making request to url: ' + options.url);\n var url = options.url,\n path = '';\n\n if(!options.url){\n var randomIndex=Math.floor(Math.random()*options.urls.length);//randomly select an index in the urls array\n url = options.urls[randomIndex];\n //console.log('url: %s randomIndex: %s', url, randomIndex);\n }\n\n //seperate the base url from the path.\n var firstSlashIndex = url.indexOf('/');\n if(firstSlashIndex >= 0){\n path = url.substr(firstSlashIndex);\n url = url.substr(0, firstSlashIndex);\n }\n\n //try using agent to get around ECONNRESET. seems to work!\n //var agent = new http.Agent();\n //agent.maxSockets = 20; //1 socket = 1936/2000 success. 10 socket = 1995/2000 success. 20 socket = 2000/2000 success!\n var agent = options.useAgents ? agentProvider.getAgent() : false; //false;//\n\n //create the request options for the http.request api.\n var requestOptions = {\n hostname: url,\n port: options.port,\n path: path,\n method: options.requestMethod,\n agent:agent, //try to fix ECONNRESET, socket closed issue.\n headers:{\n 'connection': options.connectionHeader, //'close' or 'keep-alive'\n 'requestid': requestId\n }\n };\n\n //initiate the request\n var req = http.request(requestOptions, function(res) {\n //console.log('creating request');\n pound.openConnections++;//increment count to keep track\n pound.requestsGenerated++;\n pound.requestsPerSecond = pound.requestsGenerated / ((new Date().getTime() - pound.startMilliseconds) / 1000);\n //console.log('open connections %s - open', pound.openConnections);\n pound.highestOpenConnectionsAtOneTime = pound.openConnections > pound.highestOpenConnectionsAtOneTime ? pound.openConnections : pound.highestOpenConnectionsAtOneTime;\n\n //console.log('STATUS: ' + res.statusCode);\n //console.log('HEADERS: ' + JSON.stringify(res.headers));\n //res.setEncoding('utf8');\n\n //Indicates that the underlaying connection was terminated before response.end() was called or able to flush.\n res.on('close', function(){ // this isn't getting called.\n console.log('response close called');\n });\n\n res.on('end', function(){\n pound.openConnections--;\n });\n //then you must consume the data from the response object, either by calling response.read() whenever there is a 'readable' event\n res.on('readable', function(message){\n //console.log('readable event fired');\n res.read();\n });\n\n }.bind({requestId:requestId}));\n\n //wait for the response\n /**\n * http://nodejs.org/docs/latest/api/http.html#http_class_http_agent\n * If no 'response' handler is added, then the response will be entirely discarded. However, if you add a 'response' event handler, then you must consume the data from the response object,\n * either by calling response.read() whenever there is a 'readable' event, or by adding a 'data' handler, or by calling the .resume() method.\n * Until the data is consumed, the 'end' event will not fire.\n */\n req.on('response', function(resp){\n //console.log('response received');\n //pound.openConnections--;\n \n pound.responsesReceived++;\n pound.responsesPerSecond = pound.responsesReceived / ((new Date().getTime() - pound.startMilliseconds) / 1000);\n //console.log('open connections %s - close', pound.openConnections);\n if(responseEndCallback){\n responseEndCallback(this.requestId);\n }\n });\n\n //log request errors.\n req.on('error', function(e) {\n pound.requestErrorCount++;\n console.warn('problem with requestId: %s to url: %s message: %s \\n complete: %s', this.requestId, this.url, e.message, JSON.stringify(e));\n }.bind({url:url, requestId:requestId}));\n\n //TODO: allow for request timeouts?\n // req.setTimeout(options.requestTimeout, function(e){\n // console.log('timeout for url %s', this.url);\n // this.req.end();\n // this.req.destroy();\n // }.bind({url:url, req:req}));\n\n // write data to request body\n //req.write('data\\n');\n //req.write('data\\n');\n req.end();\n }", "function route(client, handle, buffer) {\n// console.log(buffer);\n// console.log(buffer.toString());\n var header = new Header();\n if(header.parseHeader(buffer)) {\n client.header = header;\n //console.log(client.header.toString());\n // HEADER , NO EXCEPTION //\n //Si data\n if(client.header.size > 0) {\n client.buffer = buffer.slice(12);\n \n if(buffer.length == client.header.size+12) {\n if (typeof handle[client.header.type] === 'object'\n && typeof handle[client.header.type][client.header.num] === 'function') {\n if (client.isAuthenticated) {\n handle[client.header.type][client.header.num](client, client.buffer);\n client.buffer = null;\n }\n //If the client needs to authenticate\n else if (client.header.type === Header.REQ\n && client.header.num === Header.WORKER_CONNEC_REQ) {\n handle[Header.REQ][Header.WORKER_CONNEC_REQ](client, client.buffer);\n client.buffer = null;\n }\n //If the client needs to authenticate and sent the wrong header\n else {\n console.log(\"Router kick 1\");\n client.end();\n }\n }\n } else {\n client.concatOver = false;\n }\n }\n //pas de data\n else {\n if (typeof handle[client.header.type] === 'object'\n && typeof handle[client.header.type][client.header.num] === 'function') {\n //If the client is authenticated\n if (client.isAuthenticated) {\n handle[client.header.type][client.header.num](client, null);\n client.buffer = null;\n }\n //If the client needs to authenticate and sent the wrong header\n else {\n console.log(\"Router kick 2\");\n client.end();\n }\n }\n }\n }\n //NOT A HEADER\n else {\n //IF CONCATENATION NOT OVER\n if(client.concatOver === false) {\n client.buffer = Buffer.concat([client.buffer, buffer], client.buffer.length+buffer.length);\n //console.log(\"Concatenating, download% : \"+((client.buffer.length/client.header.size)*100));\n if(client.buffer.length == client.header.size) {\n client.concatOver = true;\n if (typeof handle[client.header.type] === 'object'\n && typeof handle[client.header.type][client.header.num] === 'function') {\n //@TODO this test may be useless, to look up later\n if (client.isAuthenticated) {\n handle[client.header.type][client.header.num](client, client.buffer);\n client.buffer = null;\n }\n else {\n console.log(\"Router kick 3\");\n client.end();\n }\n }\n }\n } else {\n console.log(\"Router kick 4\");\n client.end();\n }\n }\n}", "static sendXhr(method, uri, props, responseType) {\r\n return new Promise((resolve, reject) => {\r\n if (this.stop) { return C.CAN_FN.PR_RJ_STOP(); };\r\n\r\n // Get an unused key for this xhr. The do-while will usually only run one iteration.\r\n // Then create the object, setting it on the in-flight map and in the xhr local var.\r\n var xhrId = '0';\r\n do {\r\n xhrId = `${(Utils.xhrIdSeed++)}`;\r\n } while (Utils.xhrsInFlight.hasOwnProperty(xhrId));\r\n\r\n // Create the XHR in the tracking map and get a var handle to it.\r\n var xhr = Utils.xhrsInFlight[xhrId] = new XMLHttpRequest();\r\n\r\n\r\n // Error handler function. Logs the error status,\r\n // then deletes the xhr from the array and sets the var reference\r\n // to nul, then rejects with theStatus.\r\n var errorHandler = (errorStatus) => {\r\n // Log the error.\r\n Utils.lm(`XHR Error in sendXhr():\\n ${JSON.stringify(errorStatus)}`);\r\n\r\n // delete the xhr as best we can.\r\n delete Utils.xhrsInFlight[xhrId];\r\n xhr = null;\r\n\r\n // reject with the error status we were called with.\r\n reject(errorStatus);\r\n };\r\n\r\n\r\n // Left as a old-school function def so \"this\" will point at the xhr and not\r\n // accidentally cause bad closures.\r\n xhr.onreadystatechange = function onXhrRSC() {\r\n if (Utils.isSTOP()) {\r\n errorHandler(this.status);\r\n return;\r\n }\r\n\r\n if (this.readyState == XMLHttpRequest.DONE)\r\n {\r\n if (this.status == 200) {\r\n if (props && props.length > 1) {\r\n var propMap = {};\r\n var thisXhr = this;\r\n\r\n props.forEach((prop) => {\r\n propMap[prop] = thisXhr[prop];\r\n });\r\n\r\n resolve(propMap);\r\n }\r\n else if (props && props.length === 1) {\r\n resolve(this[props[0]]);\r\n }\r\n else {\r\n resolve(this);\r\n }\r\n }\r\n else {\r\n errorHandler(this.status);\r\n }\r\n\r\n // delete the xhr as best we can.\r\n delete Utils.xhrsInFlight[xhrId];\r\n xhr = null;\r\n }\r\n };\r\n\r\n\r\n // Again, using the old-school \"function\" so that \"this\"\r\n // points o the XHR.\r\n xhr.onerror = function onXhrError() {\r\n errorHandler(this.status);\r\n };\r\n\r\n\r\n // When STOP event is dispatched, abort gets called.\r\n xhr.onabort = function onXhrAbort() {\r\n Utils.lm(`aborted XHR for uri: ${uri}.`);\r\n errorHandler(C.ACTION.STOP);\r\n };\r\n\r\n\r\n // Event listener for stop event.\r\n var stopHandler = (evt) => {\r\n window.document.removeEventListener(C.ACTION.STOP, stopHandler, false);\r\n\r\n if (Utils.exists(Utils.xhrsInFlight[xhrId])) {\r\n Utils.xhrsInFlight[xhrId].abort();\r\n }\r\n };\r\n window.document.addEventListener(C.ACTION.STOP, stopHandler, false);\r\n\r\n\r\n // Perform the fetch.\r\n xhr.open(method, uri, true);\r\n if (responseType) {\r\n xhr.responseType = responseType;\r\n }\r\n xhr.send();\r\n });\r\n }", "send(method, path, params, file) {\n return new Promise(resolve => {\n // eslint-disable-line no-unused-vars\n let data;\n let content_type = 'application/json;charset=UTF-8';\n if (this.sending) {\n this.xhr.abort();\n this.sending = false;\n }\n\n this.setURL(path);\n if (!!params && method === 'GET') {\n const s_qry = Object.keys(params)\n .map(k => `${encodeURIComponent(k)}=${encodeURIComponent(params[k])}`)\n .join('&');\n\n this.setURL(`${path}?${s_qry}`);\n } else if (file) {\n data = new FormData();\n data.append('document', file);\n content_type = '';\n } else if (params) {\n data = JSON.stringify(params);\n }\n\n if ('withCredentials' in this.xhr) {\n this.xhr.open(method, this.url, true);\n } else if (typeof XDomainRequest !== 'undefined') {\n this.xhr = new XDomainRequest();\n this.xhr.open(method, this.url);\n } else {\n this.xhr.open(method, this.url);\n }\n\n if (content_type) {\n this.xhr.setRequestHeader('Content-Type', content_type);\n }\n\n this.xhr.setRequestHeader('Cache-Control', 'no-cache');\n if (this.token) {\n this.xhr.setRequestHeader('Authorization', `Bearer ${this.token}`);\n }\n\n this.xhr.onload = () => {\n this.sending = false;\n\n if (!this.xhr.response) {\n return resolve({ success: false, status: this.xhr.status });\n }\n\n try {\n const json_response = JSON.parse(this.xhr.response);\n let success = json_response.success || json_response.Success;\n if (json_response.hasOwnProperty('Success')) { // eslint-disable-line\n // eslint-disable-line no-prototype-builtins\n delete json_response.Success;\n json_response.success = success;\n }\n\n if (this.xhr.status % 400 < 100) {\n json_response.message =\n json_response.message || json_response.error;\n json_response.error_type = this._handle4XX(this.xhr.status);\n }\n\n if (this.xhr.status >= 500) {\n success = false;\n resolve({\n ...json_response,\n success: false,\n status: this.xhr.status,\n message: 502,\n });\n }\n\n if (\n this.xhr.responseURL.includes('csv-templates/download') &&\n this.xhr.status === 200\n ) {\n resolve({\n success: true,\n status: this.xhr.status,\n data: this.xhr.response,\n });\n }\n\n if (json_response.data) {\n for (const key in json_response.data) {\n // eslint-disable-line no-restricted-syntax\n if (\n json_response.data.hasOwnProperty(key) && // eslint-disable-line\n !!json_response.data[key] &&\n typeof json_response.data[key] === 'object'\n ) {\n // eslint-disable-line no-prototype-builtins\n if (key.length > 3 && key.substr(-3) === '_id') {\n const object_key = key.substr(0, key.length - 3);\n json_response.data[object_key] = json_response.data[key];\n if (json_response.data[object_key]._id) {\n json_response.data[key] =\n json_response.data[object_key]._id;\n }\n }\n }\n }\n }\n\n return resolve({\n ...json_response,\n status: this.xhr.status,\n success,\n });\n } catch (e) {\n return resolve({ success: false, status: this.xhr.status, e });\n }\n };\n\n this.xhr.onerror = e => {\n this.sending = false;\n\n if (!this.xhr.status) {\n resolve({ success: false, status: 502, stack: e });\n } else if (this.xhr.response) {\n const json_resp = JSON.parse(this.xhr.response);\n resolve({ ...json_resp, status: this.xhr.status, stack: e });\n } else {\n resolve({ success: false, status: 502, stack: e });\n }\n };\n\n this.sending = true;\n try {\n if (data) {\n this.xhr.send(data);\n } else {\n this.xhr.send();\n }\n } catch (e) {\n console.log(e); // eslint-disable-line no-console\n resolve(null);\n }\n });\n }", "function request (method, secure, host, port, path, qs, payload, headers, callback) {\n var httpClient = secure ? https : http\n // headers['Content-Type'] = 'application/x-www-form-urlencoded';\n\n if (qs) {\n path += '?' + querystring.stringify(qs)\n }\n // console.log('path', method, path, payload);\n\n var options = {\n hostname: host,\n port: port || (secure ? 443 : 80),\n path: path,\n method: method,\n headers: headers,\n agent: secure ? keepaliveHttpsAgent : keepaliveAgent\n }\n\n if (method === 'GET') {\n return httpClient.get(options, processResponse)\n .on('error', function (e) {\n callback(e)\n })\n } else {\n var req = httpClient.request(options, processResponse)\n req.setTimeout(120000)\n req.on('timeout', function () {\n if (callback) callback(new Error('timed out'), null)\n req.abort()\n })\n req.on('error', function (err) {\n if (callback) callback(err, null)\n })\n req.write(payload)\n req.end()\n return req\n }\n\n function processResponse (res) {\n if (callback) {\n var content = ''\n res.on('data', function (str) {\n content += str\n })\n res.on('end', function () {\n let r = null\n try {\n r = JSON.parse(content)\n } catch (e) {\n callback(e)\n }\n if (r) { callback(null, r) }\n })\n }\n }\n}", "function proxy(client_req, client_res) {\n client_res.setHeader('Access-Control-Allow-Origin', '*') // Avoid CORS issues\n const options = {\n hostname: CONFIG.FES_HOST,\n port: CONFIG.FES_PORT,\n path: client_req.url,\n method: client_req.method,\n headers: client_req.headers\n }\n console.log(`Proxy: ${options.hostname}:${options.port}${options.path}`)\n const proxy = http.request(options, (res) => {\n client_res.writeHead(res.statusCode, res.headers)\n res.pipe(client_res, {\n end: true\n })\n })\n client_req.pipe(proxy, {\n end: true\n })\n client_req.on('error', (error) => {\n console.log(`ERROR: ${client_req.url}: ${error.message}`)\n })\n proxy.on('error', (error) => {\n console.log(`ERROR: ${client_req.url}: ${error.message}`)\n })\n proxy.on('finish', () => {\n console.log(`End: ${client_req.url}`);\n })\n}", "sendRequest(webResource) {\n return tslib.__awaiter(this, void 0, void 0, function* () {\n // Ensure that we're about to use a secure connection.\n if (!webResource.url.startsWith(\"https:\")) {\n throw new Error(\"The resource address for authorization must use the 'https' protocol.\");\n }\n // The next request will happen differently whether we have a challenge or not.\n let response;\n if (this.challengeCache.challenge == undefined) {\n // If there's no challenge in cache, a blank body will start the challenge.\n const originalBody = webResource.body;\n webResource.body = \"\";\n response = yield this._nextPolicy.sendRequest(webResource);\n webResource.body = originalBody;\n }\n else {\n // If we did have a challenge in memory,\n // we attempt to load the token from the cache into the request before we try to send the request.\n yield this.loadToken(webResource);\n response = yield this._nextPolicy.sendRequest(webResource);\n }\n // If we don't receive a response with a 401 status code,\n // then we can assume this response has nothing to do with the challenge authentication process.\n if (response.status !== 401) {\n return response;\n }\n // If the response status is 401, we only re-authenticate if the WWW-Authenticate header is present.\n const wwwAuthenticate = response.headers.get(\"WWW-Authenticate\");\n if (!wwwAuthenticate) {\n return response;\n }\n // We re-generate the challenge and see if we have to re-authenticate.\n return yield this.regenerateChallenge(wwwAuthenticate, webResource);\n });\n }", "function handleRequestTwo(request, response) {\n console.log(\"Request Made!\");\n response.end(`It works! Path hit: ${request.url}`)\n}", "sendRequest(request) {\n return new Promise(function (fulfill, reject) {\n var reqGuid = Guid.create();\n // If we are using sockets, we emit on the 'request' topic, and wrap\n // the request in an object withe guid and payload\n var reqObj = {\n guid: reqGuid.value,\n payload: request\n };\n\n // Set out the timeout\n var timeoutToken = setTimeout(function() {\n reject({\n guid: reqGuid.value,\n payload: {\n reason: 'Request timed out'\n }\n });\n }, TIMEOUT_DURATION);\n\n // Register the callback function\n this.requestCallbacks[reqGuid.value] = function(response) {\n if (timeoutToken) {\n clearTimeout(timeoutToken);\n timeoutToken = undefined;\n }\n\n if (response.success) {\n fulfill({\n guid: response.guid,\n payload: response.payload\n });\n }\n else {\n reject({\n guid: response.guid,\n payload: response.payload\n });\n }\n };\n\n if (this.socket) {\n this.socket.emit('request', reqObj);\n }\n else {\n console.error('Socket not ready');\n }\n\n }.bind(this));\n }", "verifyTOTPToken (request, reply) {\n reply();\n }", "request(verb, requestUrl, data, headers) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n const parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n do {\n response = yield this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (const handler of this.handlers) {\n if (handler.canHandleAuthentication(response)) {\n authenticationHandler = handler;\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (response.message.statusCode &&\n HttpRedirectCodes.includes(response.message.statusCode) &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n const parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol === 'https:' &&\n parsedUrl.protocol !== parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n yield response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (const header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = yield this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (!response.message.statusCode ||\n !HttpResponseRetryCodes.includes(response.message.statusCode)) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n yield response.readBody();\n yield this._performExponentialBackoff(numTries);\n }\n } while (numTries < maxTries);\n return response;\n });\n }", "request(verb, requestUrl, data, headers) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n const parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n do {\n response = yield this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (const handler of this.handlers) {\n if (handler.canHandleAuthentication(response)) {\n authenticationHandler = handler;\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (response.message.statusCode &&\n HttpRedirectCodes.includes(response.message.statusCode) &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n const parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol === 'https:' &&\n parsedUrl.protocol !== parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n yield response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (const header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = yield this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (!response.message.statusCode ||\n !HttpResponseRetryCodes.includes(response.message.statusCode)) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n yield response.readBody();\n yield this._performExponentialBackoff(numTries);\n }\n } while (numTries < maxTries);\n return response;\n });\n }", "request(verb, requestUrl, data, headers) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n const parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n do {\n response = yield this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (const handler of this.handlers) {\n if (handler.canHandleAuthentication(response)) {\n authenticationHandler = handler;\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (response.message.statusCode &&\n HttpRedirectCodes.includes(response.message.statusCode) &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n const parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol === 'https:' &&\n parsedUrl.protocol !== parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n yield response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (const header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = yield this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (!response.message.statusCode ||\n !HttpResponseRetryCodes.includes(response.message.statusCode)) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n yield response.readBody();\n yield this._performExponentialBackoff(numTries);\n }\n } while (numTries < maxTries);\n return response;\n });\n }", "request(verb, requestUrl, data, headers) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n const parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n do {\n response = yield this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (const handler of this.handlers) {\n if (handler.canHandleAuthentication(response)) {\n authenticationHandler = handler;\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (response.message.statusCode &&\n HttpRedirectCodes.includes(response.message.statusCode) &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n const parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol === 'https:' &&\n parsedUrl.protocol !== parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n yield response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (const header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = yield this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (!response.message.statusCode ||\n !HttpResponseRetryCodes.includes(response.message.statusCode)) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n yield response.readBody();\n yield this._performExponentialBackoff(numTries);\n }\n } while (numTries < maxTries);\n return response;\n });\n }", "request(verb, requestUrl, data, headers) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n const parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n do {\n response = yield this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (const handler of this.handlers) {\n if (handler.canHandleAuthentication(response)) {\n authenticationHandler = handler;\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (response.message.statusCode &&\n HttpRedirectCodes.includes(response.message.statusCode) &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n const parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol === 'https:' &&\n parsedUrl.protocol !== parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n yield response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (const header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = yield this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (!response.message.statusCode ||\n !HttpResponseRetryCodes.includes(response.message.statusCode)) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n yield response.readBody();\n yield this._performExponentialBackoff(numTries);\n }\n } while (numTries < maxTries);\n return response;\n });\n }", "request(verb, requestUrl, data, headers) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n const parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n do {\n response = yield this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (const handler of this.handlers) {\n if (handler.canHandleAuthentication(response)) {\n authenticationHandler = handler;\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (response.message.statusCode &&\n HttpRedirectCodes.includes(response.message.statusCode) &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n const parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol === 'https:' &&\n parsedUrl.protocol !== parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n yield response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (const header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = yield this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (!response.message.statusCode ||\n !HttpResponseRetryCodes.includes(response.message.statusCode)) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n yield response.readBody();\n yield this._performExponentialBackoff(numTries);\n }\n } while (numTries < maxTries);\n return response;\n });\n }", "request(verb, requestUrl, data, headers) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n const parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n do {\n response = yield this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (const handler of this.handlers) {\n if (handler.canHandleAuthentication(response)) {\n authenticationHandler = handler;\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (response.message.statusCode &&\n HttpRedirectCodes.includes(response.message.statusCode) &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n const parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol === 'https:' &&\n parsedUrl.protocol !== parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n yield response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (const header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = yield this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (!response.message.statusCode ||\n !HttpResponseRetryCodes.includes(response.message.statusCode)) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n yield response.readBody();\n yield this._performExponentialBackoff(numTries);\n }\n } while (numTries < maxTries);\n return response;\n });\n }", "request(verb, requestUrl, data, headers) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n const parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n do {\n response = yield this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (const handler of this.handlers) {\n if (handler.canHandleAuthentication(response)) {\n authenticationHandler = handler;\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (response.message.statusCode &&\n HttpRedirectCodes.includes(response.message.statusCode) &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n const parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol === 'https:' &&\n parsedUrl.protocol !== parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n yield response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (const header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = yield this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (!response.message.statusCode ||\n !HttpResponseRetryCodes.includes(response.message.statusCode)) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n yield response.readBody();\n yield this._performExponentialBackoff(numTries);\n }\n } while (numTries < maxTries);\n return response;\n });\n }", "request(verb, requestUrl, data, headers) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n const parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n do {\n response = yield this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (const handler of this.handlers) {\n if (handler.canHandleAuthentication(response)) {\n authenticationHandler = handler;\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (response.message.statusCode &&\n HttpRedirectCodes.includes(response.message.statusCode) &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n const parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol === 'https:' &&\n parsedUrl.protocol !== parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n yield response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (const header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = yield this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (!response.message.statusCode ||\n !HttpResponseRetryCodes.includes(response.message.statusCode)) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n yield response.readBody();\n yield this._performExponentialBackoff(numTries);\n }\n } while (numTries < maxTries);\n return response;\n });\n }", "async handleRequest(payload, _next, end) {\n const finalPayload = subprovider_1.Subprovider._createFinalPayload(payload);\n const headers = {\n Accept: 'application/json',\n 'Content-Type': 'application/json'\n };\n let text;\n try {\n text = await RP({\n method: 'POST',\n body: JSON.stringify(finalPayload),\n url: this._rpcUrl,\n forever: true,\n headers: headers\n });\n }\n catch (error) {\n const statusCode = error.statusCode;\n switch (statusCode) {\n case types_1.StatusCodes.MethodNotAllowed:\n end(new JsonRpcError.MethodNotFound());\n return;\n case types_1.StatusCodes.GatewayTimeout:\n const errMsg = 'Gateway timeout. The request took too long to process. This can happen when querying logs over too wide a block range.';\n const err = new Error(errMsg);\n end(new JsonRpcError.InternalError(err));\n return;\n default:\n end(new JsonRpcError.InternalError(error));\n return;\n }\n }\n let data;\n try {\n data = JSON.parse(text);\n }\n catch (err) {\n end(new JsonRpcError.InternalError(err));\n return;\n }\n if (data.error) {\n end(new Error(data.error.message));\n return;\n }\n end(null, data.result);\n }", "async function sendAuthenticationRequest(options, callback)\n{\n let url = options.hostname + options.path;\n\n let optionsToSend = {\n method: 'POST',\n uri: url,\n body: JSON.parse(options.dataToSend),\n json: true\n };\n\n console.log(\"\\n\\nNEW REQUEST\");\n console.log(\"------------------------\\n\");\n console.log(\"URL -> \" + url);\n console.log(\"Data -> \" + options.dataToSend + \"\\n\");\n\n var b = false;\n logRequest(optionsToSend, -1, \"N/A\", -1);\n const intervalObj = setTimeout(() => {\n\n callback(null);\n\n return;\n }, 10000);\n\n return await rp(optionsToSend)\n .then(function(parseBody)\n {\n clearTimeout(intervalObj);\n\n callback(parseBody);\n return;\n })\n .catch(function(error)\n {\n clearTimeout(intervalObj);\n\n logError(optionsToSend, -1, \"N/A\", -1);\n //console.log(\"ERROR! \\nstatusCode \" + error[\"statusCode\"]);\n callback(null);\n });\n}", "request(verb, requestUrl, data, headers) {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n if (this._disposed) {\r\n throw new Error(\"Client has already been disposed.\");\r\n }\r\n let parsedUrl = url__default[\"default\"].parse(requestUrl);\r\n let info = this._prepareRequest(verb, parsedUrl, headers);\r\n // Only perform retries on reads since writes may not be idempotent.\r\n let maxTries = (this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1) ? this._maxRetries + 1 : 1;\r\n let numTries = 0;\r\n let response;\r\n while (numTries < maxTries) {\r\n try {\r\n response = yield this.requestRaw(info, data);\r\n }\r\n catch (err) {\r\n numTries++;\r\n if (err && err.code && NetworkRetryErrors.indexOf(err.code) > -1 && numTries < maxTries) {\r\n yield this._performExponentialBackoff(numTries);\r\n continue;\r\n }\r\n throw err;\r\n }\r\n // Check if it's an authentication challenge\r\n if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) {\r\n let authenticationHandler;\r\n for (let i = 0; i < this.handlers.length; i++) {\r\n if (this.handlers[i].canHandleAuthentication(response)) {\r\n authenticationHandler = this.handlers[i];\r\n break;\r\n }\r\n }\r\n if (authenticationHandler) {\r\n return authenticationHandler.handleAuthentication(this, info, data);\r\n }\r\n else {\r\n // We have received an unauthorized response but have no handlers to handle it.\r\n // Let the response return to the caller.\r\n return response;\r\n }\r\n }\r\n let redirectsRemaining = this._maxRedirects;\r\n while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1\r\n && this._allowRedirects\r\n && redirectsRemaining > 0) {\r\n const redirectUrl = response.message.headers[\"location\"];\r\n if (!redirectUrl) {\r\n // if there's no location to redirect to, we won't\r\n break;\r\n }\r\n let parsedRedirectUrl = url__default[\"default\"].parse(redirectUrl);\r\n if (parsedUrl.protocol == 'https:' && parsedUrl.protocol != parsedRedirectUrl.protocol && !this._allowRedirectDowngrade) {\r\n throw new Error(\"Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.\");\r\n }\r\n // we need to finish reading the response before reassigning response\r\n // which will leak the open socket.\r\n yield response.readBody();\r\n // let's make the request with the new redirectUrl\r\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\r\n response = yield this.requestRaw(info, data);\r\n redirectsRemaining--;\r\n }\r\n if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {\r\n // If not a retry code, return immediately instead of retrying\r\n return response;\r\n }\r\n numTries += 1;\r\n if (numTries < maxTries) {\r\n yield response.readBody();\r\n yield this._performExponentialBackoff(numTries);\r\n }\r\n }\r\n return response;\r\n });\r\n }", "function connection_handler(req, res){\n\tconsole.log(`New Request for ${req.url} from ${req.socket.remoteAddress}`);\n\tif (req.url === \"/\"){\n\t\tconst main = fs.createReadStream(\"html/main.html\");\n\t\tres.writeHead(200, {\"Content-Type\":\"text/html\"});\n\t\tmain.pipe(res);\n\t}\n\telse if (req.url.startsWith(\"/search\")){\n\t\tconst user_input = url.parse(req.url, true).query; //take an url object return a js object \n\t\tconsole.log(\"Performing PetFinder API request\");\n\t\t//POST method \n\t\tconst authentication_cache = \"./cache/authentication-res.json\";\n\t\tcache_access_token(authentication_cache, user_input, res);\n\t}\n\telse {\n\t\tres.writeHead(404, {\"Content-Type\":\"text/plain\"});\n\t\tres.write(\"404 Not Found\");\n\t\tres.end();\n\t}\n}", "static postLogin(req, res) {\n SyncHelper.renewToken(req.project, req.environment, req.body.username, req.body.password)\n .then((token) => {\n res.status(200).send(token);\n })\n .catch((e) => {\n res.status(402).send(SyncController.printError(e));\n });\n }" ]
[ "0.6614628", "0.5940748", "0.5912073", "0.58650607", "0.584834", "0.5840205", "0.5833111", "0.5788345", "0.57876074", "0.5754245", "0.5708558", "0.56855744", "0.56716514", "0.56446415", "0.56356794", "0.5624048", "0.56194246", "0.5615879", "0.5595748", "0.5586574", "0.55538714", "0.55438155", "0.553461", "0.55321103", "0.55198604", "0.5505084", "0.5496094", "0.5492187", "0.5489383", "0.54892945", "0.54807824", "0.5465035", "0.5459264", "0.54558545", "0.5450842", "0.5450201", "0.544992", "0.54407865", "0.5439528", "0.54261786", "0.54261786", "0.5414866", "0.5413544", "0.5410207", "0.5407382", "0.54059553", "0.53960854", "0.53912145", "0.5386897", "0.537952", "0.5378761", "0.5368928", "0.5367548", "0.5363377", "0.5363377", "0.5347787", "0.53385735", "0.53355294", "0.53348756", "0.5329645", "0.5329645", "0.5329645", "0.5329645", "0.5329645", "0.5329645", "0.5329645", "0.5322238", "0.53199", "0.5318235", "0.5317026", "0.53161484", "0.5314254", "0.5313932", "0.5313841", "0.530705", "0.5306879", "0.53068537", "0.5302344", "0.5291035", "0.5285294", "0.5281419", "0.5278104", "0.52773154", "0.52663326", "0.52557635", "0.52403814", "0.52390414", "0.52390414", "0.52390414", "0.52390414", "0.52390414", "0.52390414", "0.52390414", "0.52390414", "0.52390414", "0.52347034", "0.5233356", "0.52294105", "0.5216513", "0.5216067" ]
0.62423104
1
Example 1 Defining skeleton of Car object
function Car(name, color, price, company){ this.name = name this.color = color this.price = price this.company =company }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get skeleton() {}", "function Car(year, make, model) {\n this.sound = \"VRRRRRM\"\n this.type = \"Car\"\n Vehicle.call(this, year, make, model)\n \n}", "function CarMaker(){}", "set skeleton(value) {}", "function CarMaker() {}", "function Car(brand, model) {\n this.brand = brand\n this.model = model\n}", "function Car(make, model) {\n this.make = make;\n this.model = model;\n }", "function Car(model, color, wheels){\n this.model = model;\n this.color = color;\n this.wheels = wheels;\n this.honk = function() {\n console.log(\"honk!\");\n };\n}", "function Car() { }", "function Car(model, wheels) {\n this.model = model;\n this.wheels = wheels;\n}", "function Car() {}", "function Car(){}", "function skeleton () {\n\n\t\t\tthis.head = {x :0, y: 0};\n\t\t\tthis.neck = {x :0, y: 0};\n\t\t\tthis.torso = {x :0, y: 0};\n\n\t\t\tthis.left_shoulder = {x :0, y: 0};\n\t\t\tthis.left_elbow = {x :0, y: 0};\n\t\t\tthis.left_hand = {x :0, y: 0};\n\n\t\t\tthis.right_shoulder = {x :0, y: 0};\n\t\t\tthis.right_elbow = {x :0, y: 0};\n\t\t\tthis.right_hand = {x :0, y: 0};\n\n\t\t\tthis.left_hip = {x :0, y: 0};\n\t\t\tthis.left_knee = {x :0, y: 0};\n\t\t\tthis.left_foot = {x :0, y: 0};\n\n\t\t\tthis.right_hip = {x :0, y: 0};\n\t\t\tthis.right_knee = {x :0, y: 0};\n\t\t\tthis.right_foot = {x :0, y: 0};\n\n\t\t\tthis.update = function( incomingSkeleton ) {\n\n\t\t\t\tthis.head = incomingSkeleton.head;\n\t\t\t\tthis.neck = incomingSkeleton.neck;\n\t\t\t\tthis.torso = incomingSkeleton.torso;\n\t\t\t\t\n\t\t\t\tthis.left_shoulder = incomingSkeleton.left_shoulder;\n\t\t\t\tthis.left_elbow = incomingSkeleton.left_elbow;\n\t\t\t\tthis.left_hand = incomingSkeleton.left_hand;\n\n\t\t\t\tthis.right_shoulder = incomingSkeleton.right_shoulder;\n\t\t\t\tthis.right_elbow = incomingSkeleton.right_elbow;\n\t\t\t\tthis.right_hand = incomingSkeleton.right_hand;\n\n\t\t\t\tthis.left_hip = incomingSkeleton.left_hip;\n\t\t\t\tthis.left_knee = incomingSkeleton.left_knee;\n\t\t\t\tthis.left_foot = incomingSkeleton.left_foot;\n\n\t\t\t\tthis.right_hip = incomingSkeleton.right_hip;\n\t\t\t\tthis.right_knee = incomingSkeleton.right_knee;\n\t\t\t\tthis.right_foot = incomingSkeleton.right_foot;\n\t\t\t}\n\n\t\t\tthis.draw = function ( ctx ) {\n\n\t\t\t\tvar jointSize = 10;\n\n\t\t\t\t//draw the nodes\n\t\t\t\tctx.fillRect (this.head.x-jointSize/2, this.head.y-jointSize/2, jointSize, jointSize);\n\t\t\t\tctx.fillRect (this.neck.x-jointSize/2, this.neck.y-jointSize/2, jointSize, jointSize);\n\t\t\t\tctx.fillRect (this.torso.x-jointSize/2, this.torso.y-jointSize/2, jointSize, jointSize);\n\n\t\t\t\tctx.fillRect (this.left_shoulder.x-jointSize/2, this.left_shoulder.y-jointSize/2, jointSize, jointSize);\n\t\t\t\tctx.fillRect (this.left_elbow.x-jointSize/2, this.left_elbow.y-jointSize/2, jointSize, jointSize);\n\t\t\t\tctx.fillRect (this.left_hand.x-jointSize/2, this.left_hand.y-jointSize/2, jointSize, jointSize);\n\n\t\t\t\tctx.fillRect (this.right_shoulder.x-jointSize/2, this.right_shoulder.y-jointSize/2, jointSize, jointSize);\n\t\t\t\tctx.fillRect (this.right_elbow.x-jointSize/2, this.right_elbow.y-jointSize/2, jointSize, jointSize);\n\t\t\t\tctx.fillRect (this.right_hand.x-jointSize/2, this.right_hand.y-jointSize/2, jointSize, jointSize);\n\n\t\t\t\tctx.fillRect (this.left_hip.x-jointSize/2, this.left_hip.y-jointSize/2, jointSize, jointSize);\n\t\t\t\tctx.fillRect (this.left_knee.x-jointSize/2, this.left_knee.y-jointSize/2, jointSize, jointSize);\n\t\t\t\tctx.fillRect (this.left_foot.x-jointSize/2, this.left_foot.y-jointSize/2, jointSize, jointSize);\n\n\t\t\t\tctx.fillRect (this.right_hip.x-jointSize/2, this.right_hip.y-jointSize/2, jointSize, jointSize);\n\t\t\t\tctx.fillRect (this.right_knee.x-jointSize/2, this.right_knee.y-jointSize/2, jointSize, jointSize);\n\t\t\t\tctx.fillRect (this.right_foot.x-jointSize/2, this.right_foot.y-jointSize/2, jointSize, jointSize);\n\n\t\t\t\t//draw the connections\n\t\t\t\tctx.beginPath();\n\t\t\t\t\n\t\t\t\t//head to neck to torso\n\t\t\t\tctx.moveTo (this.head.x, this.head.y);\n\t\t\t\tctx.lineTo (this.neck.x, this.neck.y);\n\n\t\t\t\tctx.moveTo (this.neck.x, this.neck.y);\n\t\t\t\tctx.lineTo (this.torso.x, this.torso.y);\n\n\t\t\t\t//neck to shoulders\n\t\t\t\tctx.moveTo (this.neck.x, this.neck.y);\n\t\t\t\tctx.lineTo (this.left_shoulder.x, this.left_shoulder.y);\n\n\t\t\t\tctx.moveTo (this.neck.x, this.neck.y);\n\t\t\t\tctx.lineTo (this.right_shoulder.x, this.right_shoulder.y);\n\n\t\t\t\t//left arm\n\t\t\t\tctx.moveTo (this.left_shoulder.x, this.left_shoulder.y);\n\t\t\t\tctx.lineTo (this.left_elbow.x, this.left_elbow.y);\n\n\t\t\t\tctx.moveTo (this.left_elbow.x, this.left_elbow.y);\t\t\t\t\n\t\t\t\tctx.lineTo (this.left_hand.x, this.left_hand.y);\n\n\t\t\t\t//right arm\n\t\t\t\tctx.moveTo (this.right_shoulder.x, this.right_shoulder.y);\n\t\t\t\tctx.lineTo (this.right_elbow.x, this.right_elbow.y);\n\n\t\t\t\tctx.moveTo (this.right_elbow.x, this.right_elbow.y);\t\t\t\t\n\t\t\t\tctx.lineTo (this.right_hand.x, this.right_hand.y);\n\n\t\t\t\t//torso to knees\n\t\t\t\tctx.moveTo (this.torso.x, this.torso.y);\n\t\t\t\tctx.lineTo (this.left_hip.x, this.left_hip.y);\n\n\t\t\t\tctx.moveTo (this.torso.x, this.torso.y);\n\t\t\t\tctx.lineTo (this.right_hip.x, this.right_hip.y);\n\n\t\t\t\t//left leg\n\t\t\t\tctx.moveTo (this.left_hip.x, this.left_hip.y);\n\t\t\t\tctx.lineTo (this.left_knee.x, this.left_knee.y);\n\n\t\t\t\tctx.moveTo (this.left_knee.x, this.left_knee.y);\n\t\t\t\tctx.lineTo (this.left_foot.x, this.left_foot.y);\n\n\t\t\t\t//right leg\n\t\t\t\tctx.moveTo (this.right_hip.x, this.right_hip.y);\n\t\t\t\tctx.lineTo (this.right_knee.x, this.right_knee.y);\n\n\t\t\t\tctx.moveTo (this.right_knee.x, this.right_knee.y);\n\t\t\t\tctx.lineTo (this.right_foot.x, this.right_foot.y);\n\n\t\t\t\tctx.stroke();\n\t\t\t}\n\t\t}", "loadSkeleton(jsnchrctr) {\n//-----------\nreturn this.skeleton = Skeleton.create(jsnchrctr.skelBones, this.USE_TRX_BONE_DATA, this.TEST_CPU_TRX_TO_MAT);\n}", "function Car() {\r\n}", "function Car(make, model, year) {\n this.make = make;\n this.model = model;\n this.year = year;\n this.numWheels = 4;\n}", "function Car(make, model, year) {\n this.make = make;\n this.model = model;\n this.year = year;\n this.numWheels = 4;\n}", "function Car(make, model, year) {\n this.make = make;\n this.model = model;\n this.year = year;\n this.numWheels = 4;\n}", "function Car(make, model)\n{\n this.make=make;\n this.model=model;\n this._userGears=['P', 'N' , 'R' , 'D'];\n this._userGear=this.userGears[0];\n}", "function Car(make, model, year) {\n this.make = make;\n this.model = model;\n this.year = year;\n //we can also set properties on the keyword this\n //that are preset values\n this.numWheels = 4;\n}", "function Car(make, model, year) {\n this.make = make;\n this.model = model;\n this.year = year;\n //we can also set properties on the keyword this\n //that are preset values\n this.numWheels = 4;\n}", "function CarPrototype(model, year, miles) {\n this.model = model\n this.year = year\n this.miles = miles\n}", "function Car(make, model, speed, torque) {\n console.log(\"Our new car:\", this);\n\n // this.make is sort of the Ruby equiv of @make\n this.make = make;\n this.model = model;\n this.speed = speed;\n this.torque = torque;\n\n // function for car\n this.engine = function() {\n console.log(\"vroom! vroom!\");\n };\n console.log(\"Car initialization complete\");\n}", "function Car(make,model,year) {\n this.make = make\n this.model = model\n this.year = year\n\n this.describeSelf = function name(params) {\n console.log(`This is a ${this.make} of model ${this.model}`)\n }\n}", "function Bike(year, make, model) {\n this.sound = \"VRRRRRM\"\n this.type = \"Car\"\n Vehicle.call(year, make, model)\n \n}", "function Car(model, year, hybrid, speed) {\n \n //Create \"this\" dog \n console.log(\"Our new car:\", this);\n\n //Add attributes similar to Ruby instance variables using this.name\n this.model = model;\n this.year = year;\n this.hybrid = hybrid;\n this.speed = speed;\n\n //Create a function to accelerate from 0 to 100 mph in 5 seconds\n this.accelerate = function() {console.log(\"This car can accelerate from 0 to\" + \" \" + this.speed + \" \" + \"mph in 5 seconds\"); };\n \n //Car initialization message\n console.log(\"CAR INITIALIZATION COMPLETE\");\n \n}", "function createCar(){\n c = new Car({x: 0,y: 150,windowsColour: \"red\",colour:\"yellow\",directionX:200});\n}", "function carConstructor(carName, model, color, brand){\n this.theCarName = carName;\n this.theModel = model;\n this.theColor = color;\n this.theBrand = brand;\n}", "function Car() { // can pass in make, model, and year, just like in python (without using SELF)\n //this is one way of creating a CLASS\n this.make = \"\" //=make if passing make into the function\n this.model = \"\"\n this.year = \"\"\n}", "function Car(type, model, year, isCool) {\n\n console.log(\"Our new car:\", this);\n\n this.type = type;\n this.model = model;\n this.year = year;\n this.isCool = isCool\n\n this.sound = function() { console.log(\"vroooom\"); };\n this.price = function(price) {console.log (\"This car costs \" + price)};\n\n console.log(\"CAR INITIALIZATION COMPLETE\");\n}", "function initiateCars() {\n\n\tcars = game.add.group();\n\tcars.enableBody = true;\n\n\tfor (i = 0; i < slots; i++) {\n\n\t\tcarType = carSlotType[i];\n\t\thCar = carTypes[carType].h;\n\t\tinterval = carTypes[carType].interval;\n\t\tvelocity = carTypes[carType].velocity;\n\t\tspacing = interval * velocity;\n\n\t\tif (carSlotVector[i] == 1) {\n\t\t\ty = -hCar;\n\t\t\twhile(y < h) {\n\t\t\t\tcreateCar(i, y);\n\t\t\t\ty += spacing;\n\t\t\t} \n\t\t} else {\n\t\t\ty = h + hCar;\n\t\t\twhile(y > 0) {\n\t\t\t\tcreateCar(i, y);\n\t\t\t\ty -= spacing;\n\t\t\t}\n\t\t}\n\t}\n}", "function Car(model) {\n this.model = model;\n}", "function Car(model) {\n this.model = model;\n}", "function HybridCar() {\n}", "function createCar() {\n car = new Car();\n scene.add(car.mesh);\n}", "function Car(make,year,model) {\n this.make = make;\n this.model = model;\n this.year = year;\n}", "function Car(brand, model = \"no model specified\") {\n this.model = model;\n this.brand = brand;\n}", "function Car(model) {\n\n this.model = model;\n\n}", "function Car(make, model, color, runs) {\r\n\r\n\tconsole.log(\"Creating new car...\", this);\r\n\r\n\tthis.make = make;\r\n\tthis.model = model;\r\n\tthis.color = color;\r\n\tthis.runs = runs;\r\n\r\n\tthis.honk = function() { console.log(\"*honk!*\"); };\r\n\r\n\tthis.start = function() {\r\n\t\tif (this.runs) {\r\n\t\t\tconsole.log(\"*engine revs*\");\r\n\t\t} else {\r\n\t\t\tconsole.log(\"*engine putters out*\");\r\n\t\t}\r\n\t}\r\n\r\n\tconsole.log(\"Car initialized\")\r\n}", "function Car(brand, model, year) {\n this.brand = brand;\n this.model = model;\n this.year = year;\n\n\n}", "function Car() {\n this.doors = 0;\n \n this.addParts = function() {\n this.doors = 4;\n };\n \n this.say = function() {\n log.add(\"I am a \" + this.doors + \"-door car\");\n };\n}", "function Car(options){\n\tthis.make \t= options.make;\n\tthis.model\t= options.model;\n}", "function Car(brand, model, year) {\n this.brand = brand;\n this.model = model;\n this.year = year;\n this.move = function() {\n console.log(`Wouhouuu this ${this.brand} ${this.model} is moving at 120km/h!!!`);\n };\n}", "function Car(model, milesPerGallon) {\n this.model = model;\n this.milesPerGallon = milesPerGallon;\n this.tank = 0;\n this.odometer = 0;\n\n}", "function Car(make, model, year) {\n this.make = make;\n this.model = model;\n this.year = year;\n}", "function Car (brand, model, year) {\n this.brand = brand;\n this.model = model;\n this.year = year;\n this.moveCar = function(){\n return this.year + 10;\n };\n}", "function Car (model, year, miles) {\n this.model = model;\n this.year = year;\n this.miles = miles;\n}", "function Car(make, model, year) {\n this.make = make;\n this.model = model;\n this.year = year;\n}", "function Car(make, model, year){\n\tthis.make = make;\n\tthis.model = model;\n\tthis.year = year; \n}", "function Car(make, model, year, color) {\n\n\tconsole.log(\"Our new car:\", this);\n\n\tthis.make = make;\n\tthis.model = model;\n\tthis.year = year;\n\tthis.color = color;\n\n\tthis.beep = function() { console.log(\"*beeps horn three times*\")};\n\n\tconsole.log(\"CAR INITIALIZATION COMPLETE\");\n}", "function car(givenSpeed,givenBrand,givenColor,givenFuelType,givenBrand){\r\nthis.brand=givenBrand;\r\nthis.speed=givenSpeed;\r\nthis.color=givenColor;\r\nthis.fuelType=givenFuelType;\r\n}", "function MakeCarObjects(brand, model, year) {\n this.brand = brand;\n this.model = model;\n this.year = year;\n this.move = 0;\n\n this.moveCar = function () {\n this.move += 10;\n };\n}", "function Car(model, milesPerGallon) {\n this.model = model;\n this.milesPerGallon = milesPerGallon;\n this.tank = 0;\n this.odometer = 0;\n}", "function Car(make, model, year) {\n this.make = make;\n this.model = model;\n this.year = year;\n this.move = 0;\n this.moveCar = function() {\n return this.move + 10;\n };\n}", "function Car(make, model, color){\n //this = {}\n //this.prototype = Component;\n \n this.make = make;\n this.model = model;\n this.color = color;\n this.mileage = 0;\n\n // this.drive = function (){\n // this.mileage += 1;\n // }\n \n //return this\n}", "function Car (model, year, miles) {\n this.model = model\n this.year = year\n this.miles = miles\n }", "function car(model,year,color,speed,engine,shape){\n//we use this to create a property of an object\n//this property name should be the same as the parameter\nthis.model=model\nthis.year=year\nthis.color=color\nthis.speed=speed\nthis.engine=engine\nthis.body=body\n}", "function Motorcycle(make, model, year){\n //using call\n Car.call(this, make, model, year);\n this.numWheels = 2;\n\n}", "function Car(model, milesPerGallon) {\n this.model = model;\n this.milesPerGallon = milesPerGallon;\n this.tank = 0;\n this.odometer = 0;\n}", "function createCar() {\n car = game.add.sprite(startingX, startingY, 'car');\n car.anchor.setTo(.3, .5);\n car.scale.setTo(carScale);\n\n game.physics.p2.enable(car);\n car.body.setRectangle(10, 10);\n car.body.collideWorldBounds = true;\n car.body.angle = startingAngle;\n }", "function Car(makeModel, color, engineType, horsePower, gasSaver){\n\tconsole.log(\"Time to make a new car:\", this);\n\tthis.makeModel = makeModel;\n\tthis.color = color;\n\tthis.enginType = engineType;\n\tthis.horsePower = horsePower;\n\tthis.gasSaver = gasSaver;\n\tthis.testDrive = function() {\n\t\tconsole.log(\"Vroom! Vroom!\");\n\t};\n\tconsole.log(\"NEW CAR READY TO GO\")\n}", "function Car(brand,color,weight,topSpeed) {\n this.brand = brand;\n this.color = color;\n this.weight = weight;\n this.topSpeed = topSpeed;\n}", "function skeletonObject(row, col, rgb, hp, dmg) {\n return {\n row,\n col,\n // RGB value is used for the background color.\n // Passed as props from the original terrain/decor object.\n rgb,\n hp,\n dmg,\n type: 'enemy',\n // Enemy key is used to assign graphical components later.\n enemy: 'skeleton',\n flavorText: 'One of the lost souls cursed to wander in thrall of your foe, feeding on the pain he spreads.',\n deathFlavorText: 'With a pained shudder, the cursed thing is transported to a different hell. The morsel of life it clinged to latches onto you. You feel stronger, but also colder.',\n crossable: false,\n }\n}", "function Car(make, model, year, color, rating, price){\n this.make = make;\n this.model = model;\n this.year = year;\n this.color = color;\n this.rating = rating;\n this.price = price;\n}", "function Car(color,year,make,model) {\n this.color = color;\n this.year = year;\n this.make = make;\n this.model = model;\n this.sound = function() { console.log(\"Vroom Vroom!\"); };\n}", "function Car(color, make, speed) {\n this.color = color;\n this.make = make;\n this.speed = speed;\n this.drive = function(speed, make) { console.log(\"The \" + make + \" is driving \" + speed + \" mph.\"); };\n}", "function createSweetCar(name, brand, speed) {\n return {\n type: 'Car',\n name,\n brand,\n speed\n }; // Yes it looks sweet.\n}", "function createCar (model, year, color) { //takes in arguments\n var speed = 0; //starting speed\n return {\n model: model, ///input for argument\n year: year, //input for argument\n color: color, //input for argument\n\n getSpeed: function() { return speed}, //when called it returns the current speed\n accelerate: function() {speed += 10}, //when called it increases speed by 10\n brake: function() { speed -= Math.floor(Math.random()* (speed/2)) + 1; }, //when called this decreases speed by 7\n getNewCar: function() {\n return this.model + \" \" + this.year + \" \" + this.color // this creates string of elements of object\n },\n gas: function() {\n while (speed < 80) { ///Loops speed increment until it reaches 80\n this.accelerate();\n };\n if (speed = 80 ){\n speed += 5 //////once speed is 80 speed increases by 5\n\n };\n },\n emergencyBrake: function() {\n this.brake(); ///we are directly using the brake function\n // };\n\n }\n }\n}", "function initiateCar(x,y,width, height, velocity, health, color='blue') {\n var car = {\n velocity:velocity, //represents horizontal velcoity for player and vertical velocity for opponents\n color: color,\n x: x,\n y: y,\n width: width,\n height: height,\n health: health,\n };\n\n return car;\n}", "function Motorcycle(make, model, year) {\n //using call\n Car.call(this, make, model, year)\n this.numWheels = 2;\n}", "function HybridCar() { Car.call(this) }", "function NewCar(car) {\n this.motorSound = 'Varooom-varoom';\n this.car = car;\n this.race = function() {\n console.log(`The ${this.car} goes ${this.motorSound} down the alley!`);\n console.log(this);\n };\n }", "function NewCar(car) {\n this.motorSound = 'Varooom-varoom';\n this.car = car;\n this.race = function() {\n console.log(`The ${this.car} goes ${this.motorSound} down the alley!`);\n console.log(this);\n };\n }", "async startGenSkeleton() {\n this.init();\n try {\n this.handleNode(document.body);\n } catch (e) {\n console.log('==genSkeleton Error==\\n', e.message, e.stack);\n }\n }", "function ProtoCar(model, year, miles) {\n this.model = model;\n this.year = year;\n this.miles = miles;\n}", "function DirtBike(make, model, year) {\n Car.apply(this,arguments);\n}", "function Car() {\n this.velocity = 0; \n}", "function CarFactory(make, model) {\n this.make = make;\n this.model = model;\n}", "function Car(options) {\n this.make = options.make;\n this.model = options.model;\n this.year = options.year;\n}", "function CarBuilder() {\n this.car = null;\n \n this.step1 = function() {\n this.car = new Car();\n };\n \n this.step2 = function() {\n this.car.addParts();\n };\n \n this.get = function() {\n return this.car;\n };\n}", "function Car(carX, carSX, carY, carWidth, carHeight, carSpeed) {\r\n this.carX = carX;\r\n this.carSX = carSX;\r\n this.carY = carY;\r\n this.carWidth = carWidth;\r\n this.carHeight = carHeight;\r\n this.carSpeed = carSpeed;\r\n}", "function Car(color, brand, year) {\n this.color = color;\n this.brand = brand;\n this.year = year;\n}", "function Car(make, model, year) {\n this.make = make;\n this.model = model;\n this.year = year;\n }", "function Car(make, model, year) {\n this.make = make;\n this.model = model;\n this.year = year;\n this.move = 0; \n this.moveCar = function () {\n return this.move += 10;\n }\n }", "function Car(make, model) {\n // 'this' refers to the new object that is being constructed.\n // we are using dot notation to add make & model properties to the new object.\n\n // this = {}; <--- IMPLIED\n this.make = make;\n this.model = model;\n // return this; <-- IMPLIED\n\n // The new object gets automatically returned, we don't need to use a return statement.\n}", "function Car (make, model, year) {\n this.make = make\n this.model = model\n this.year = year\n this.move = 0\n this.moveCar = function () {\n return this.move += 10\n }\n}", "step1() {\n this.car = new Car();\n }", "function Car(obj){\n this.model = obj.model;\n this.year = obj.year;\n}", "constructor(brand, mod) {\r\n // takes 2 inputs on initialization of an instance, \r\n // brand (which is super'd/inherited from the parent class), \r\n // and the model/year of the car\r\n super(brand);\r\n this.model = mod;\r\n }", "function createCar (model, year, color) { //takes in arguments\n var speed = 0; //starting speed\n return {\n model: model, ///input for argument\n year: year, //input for argument\n color: color, //input for argument\n\n getSpeed: function() { return speed}, //when called it returns the current speed\n accelerate: function() {speed += 10}, //when called it increases speed by 10\n brake: function() { speed -= 7}, //when called this decreases speed by 7\n getNewCar: function() {\n return this.model + \" \" + this.year + \" \" + this.color // this creates string of elements of object\n },\n gas: function() {\n while (speed < 80) { ///Loops speed increment until it reaches 80\n this.accelerate();\n };\n if (speed = 80 ){\n speed += 5 //////once speed is 80 speed increases by 5\n\n };\n },\n emergencyBrake: function() {\n while(speed <= 85 && speed > 1) { /////Loops (decreased)speed until speed reaches 1\n this.brake();\n };\n if (speed = 1 ){\n speed-- //////once speed is 1 this decreases speed by 1\n };\n }\n }\n}", "function newCar(make, model, color, type, tires, mode, gasoline) {\n this.make = make;\n this.model = model;\n this.color = color;\n this.type = type;\n this.tires = tires;\n this.mode = mode;\n this.gasoline = gasoline;\n }", "function Car(make, model, year) {\n this.make = make;\n this.model = model;\n this.year = year;\n this.move = 0;\n this.moveCar = function () {\n return this.move += 10\n }\n}", "function createCar (model, year, color) { //takes in arguments\n var speed = 0; //starting speed\n return {\n model: model, ///input for argument\n year: year, //input for argument\n color: color, //input for argument\n\n getSpeed: function() { return speed}, //when called it returns the current speed\n accelerate: function() {speed += 10}, //when called it increases speed by 10\n brake: function() { speed -= 7}, //when called this decreases speed by 7\n getNewCar: function() {\n return this.model + \" \" + this.year + \" \" + this.color // this creates string of elements of object\n },\n gas: function() {\n while (speed < 70) { ///Loops speed increment until it reaches 70\n this.accelerate();\n };\n },\n emergencyBrake: function() {\n while(speed <= 70 && speed > 0) { /////loops decrement until it reaches 0\n this.brake();\n };\n }\n }\n}", "function Car(make, model, year)\n{\n this.make = make;\n this.model = model;\n this.year = year;\n\n this.details = function()\n {\n console.log(this.make, this.model, this.year);\n }\n this.sample = sampleFunc;\n}", "function init_car(){\n\tscenario.set_normals(computeVertexNormals(scenario.get_vertices()));\n\troad.set_normals(computeVertexNormals(road.get_vertices()));\n\tcar.set_normals(computeVertexNormals(car.get_vertices()));\n\twheels.set_normals(computeVertexNormals(wheels.get_vertices()));\n\n\tdrawObjects();\n}", "function placeCars()\n\t\t\t{\n\t\t\t\tconstructors = constructors.concat(constructors.slice(0, 8));\n\t\t\t\trandom(constructors);\n\t\t\t\t\n\t\t\t\tvar count = 0;\n\t\t\t\tvar car;\n\t\t\t\tfor (var i = 0; i < constructors.length; i++)\n\t\t\t\t{\n\t\t\t\t\tcount = count >= 10 ? 1 : count + 1;\n\t\t\t\t\t\n\t\t\t\t\tcar = new constructors[i]();\n\t\t\t\t\tvar str = i < 10 ? \"car0\" : \"car\";\n\t\t\t\t\tcar.name = str + i;\n\t\t\t\t\tcar.on(\"mousedown\", carHandler);\n\t\t\t\t\tcar.rotation = count <= 5 ? 0 : 180;\n\t\t\t\t\t\n\t\t\t\t\tstr = i < 10 ? \"spot_0\" : \"spot_\";\n\t\t\t\t\te[str + i].name = str + i;\n\t\t\t\t\te[str + i].addChild(car);\n\t\t\t\t}\n\t\t\t}", "function BasicCar(model, year, miles) {\n this.model = model;\n this.year = year;\n this.miles = miles;\n\n this.toString = () => {\n return `${this.model} has done ${this.miles} miles`;\n };\n}", "function car(make, mode, year) {\n\tthis.make = make;\n\tthis.model = model;\n\t\n}", "function createCar (model, year, color) { //takes in arguments\n var speed = 0; //starting speed\n return {\n model: model, ///input for argument\n year: year, //input for argument\n color: color, //input for argument\n\n getSpeed: function() { return speed}, //when called it returns the current speed\n accelerate: function() {speed += 10}, //when called it increases speed by 10\n brake: function() { speed -= Math.floor(Math.random()* (speed/2)) + 1; }, // This will call random number to be decrease per brake\n getNewCar: function() {\n return this.model + \" \" + this.year + \" \" + this.color // this creates string of elements of object\n },\n gas: function() {\n while (speed < 80) { ///Loops speed increment until it reaches 80\n this.accelerate();\n };\n if (speed = 80 ){\n speed += 5 //////once speed is 80 speed increases by 5\n\n };\n },\n emergencyBrake: function() {\n var counter = 0\n while(speed <= 85 && speed > 0) { /////Loops (decreased)speed until speed reaches 0\n this.brake(); // this will call brake fucntion\n counter ++ // increase 1 per cycle of loop\n console.log(counter) // print the number of counter value\n };\n }\n}\n}", "function Car(year, owner, manufacturer) {\n\tthis.year = year;\n\tthis.owner = owner;\n\tthis.manufacturer = manufacturer;\n\tthis.speak = function () {\n\t\treturn `vrooooooom!`;\n\t};\n}" ]
[ "0.68618804", "0.65702736", "0.65423256", "0.64889216", "0.64661145", "0.6356149", "0.6349651", "0.63335603", "0.63235384", "0.6301395", "0.6289095", "0.62632996", "0.6249437", "0.6185378", "0.6173466", "0.61513186", "0.61513186", "0.61513186", "0.6147331", "0.6103859", "0.6103859", "0.6091731", "0.6089477", "0.6074421", "0.6052542", "0.6038637", "0.6025773", "0.6024069", "0.6021202", "0.6016236", "0.60085446", "0.6000871", "0.6000871", "0.5997576", "0.5963668", "0.59570795", "0.5921414", "0.59173423", "0.5908514", "0.59027934", "0.58895344", "0.5886891", "0.58793586", "0.5876672", "0.5854515", "0.58519554", "0.58330864", "0.5829746", "0.58257747", "0.5799246", "0.57951266", "0.5788986", "0.57881355", "0.578715", "0.5785318", "0.5783523", "0.57731384", "0.5766766", "0.5756871", "0.5749023", "0.5744612", "0.57387704", "0.5733196", "0.57272017", "0.57260466", "0.57228786", "0.5716782", "0.56996083", "0.56980145", "0.5688861", "0.56845325", "0.56730837", "0.56730837", "0.5672154", "0.5662341", "0.5662116", "0.56620723", "0.56549627", "0.5652645", "0.564629", "0.564076", "0.5620599", "0.5614618", "0.56045514", "0.56013185", "0.5599227", "0.55979884", "0.5597863", "0.55931854", "0.55866593", "0.5585682", "0.55764675", "0.55728245", "0.5571335", "0.5566304", "0.5564302", "0.55413437", "0.5534757", "0.55330426", "0.55295694" ]
0.56562567
77
Example 2 1st way Defining a class named Arr and our own property like predefined length property on array objects
function Arr(arr=[]){ this.arr = arr this.type = typeof arr this.total_items_count = function (){ count = 0 for (var i = 0; i < this.arr.length; i++){ count += 1 } return count } this.len = this.total_items_count() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get arraySize() {}", "length(arr) {\n return arr.length;\n }", "function arrayLengthTest2() {\n var arr;\n\n arr = [ 1, 2 ];\n Array.prototype[2] = 'entry-in-proto';\n\n print(arr.length, arr[0], arr[1], arr[2], arr[3]);\n\n print(JSON.stringify(arr));\n}", "function main() {\n\n Array.SIZE_RATIO = 3;\n\n // Create an instance of the Array class\n let arr = new Array();\n\n // Add an item to the array\n arr.push(3);\n\n console.log(arr);\n}", "function arrayLengthTest1() {\n var arr;\n var k;\n\n // base case\n arr = [ 1, 2, undefined, 4 ];\n print(JSON.stringify(arr));\n\n // length must be obeyed even if no elements have been added\n arr = [ 1, 2, undefined, 4 ];\n arr.length = 8;\n print(JSON.stringify(arr));\n\n arr = [ 1, 2 ];\n arr[100] = 'foo';\n arr[3] = 4;\n print(JSON.stringify(arr));\n}", "get size() {\n return this._array.length\n }", "function DynamicArray() {\n this.arr = new Array(1);\n this.size = 1;\n this.length = 0;\n this.start = 0;\n}", "set arraySize(value) {}", "function Collection(arr) {\n if(!Array.isArray(arr)) {\n return \"Data is not array!\";\n }\n\n this.items = arr;\n\n Object.defineProperty(this, 'length', {\n value: arr.length,\n enumerable: false,\n writable: false,\n });\n}", "constructor() {\r\n // this.size = 0;\r\n this.arr = [];\r\n }", "function MyArray(arr=[]){\n\tthis.arr = arr\n\tthis.type = typeof arr\n\tthis.len = total_items\n\tthis.sum = function(){\n\t\ts = 0\n\t\tthis.arr.forEach(function(item){\n\t\t\ts += item\n\t\t})\n\t\treturn s\n\t}\n}", "function makeArray(n) {\nthis.length = n\nreturn this\n}", "constructor (arraySpecs, initSize = 100, deltaSize = 100) {\n // arraySpec details: Three forms are used.\n //\n // The \"key\" is the name of the array. The values are brackets specifying\n // formats for the Object's arrays.\n // * key: [value, 0] - name is a constant value, not an array of values.\n // * key: [arrayType, 1] - key is a simple array of given type.\n // A shortcut is key: arrayType .. w/o the brackets.\n // * key: [arrayType, num] - name is an Array of TypedArrays of num elements\n // arrayType has to be a typed array. If Array is to contain arrays,\n // they should be array objects of size num, not num elements from array.\n\n this.length = 0\n this.size = 0\n this.specs = {}\n this.arrayNames = [] // experiment, may not need\n this.defaultNames = []\n // convert arraySpecs arrays to {Type, elements} objects\n for (const key in arraySpecs) {\n let val = arraySpecs[key]\n if (util.typeOf(val) === 'function') val = [val, 1]\n const [Type, elements] = val\n this.specs[key] = {Type, elements}\n\n if (elements === 0) // experiment, may not need\n this.defaultNames.push(key)\n else\n this.arrayNames.push(key)\n }\n this.initSize = initSize\n this.deltaSize = deltaSize\n this.arrays = {}\n this.initArrays(this.specs)\n this.sharedGetterSetter = this.createGetterSetter()\n }", "function Array() {}", "function makeArray(size) \n{\n\tthis.size = size;\n\treturn this;\n}", "function mainmore(){\n Array.SIZE_RATIO = 3;\n let arr = new Array();\n arr.push(3);\n arr.push(5);\n arr.push(15);\n arr.push(19);\n arr.push(45);\n arr.push(10);\n console.log(arr);\n console.log(arr.length);\n console.log(arr._capacity);\n}", "function array(items) {\n if(!(this instanceof array)) return new array(items)\n \n var self = this\n this.items = []\n this.count = o_O(0)\n this.length = 0\n this.count.change(function(count) {\n self.length = count \n })\n if(items) {\n for(var i=0; i< items.length; i++)\n this.push(items[i])\n }\n this.initialize()\n}", "function Array(){\n this.is = \"Array\";\n}", "function maintahu(){\n Array.SIZE_RATIO = 3;\n let arr = new Array();\n arr.push(\"tahuina\");\n console.log(arr);\n console.log(arr.get(0));\n}", "function main() {\n Array.SIZE_RATIO = 3;\n\n // Create an instance of the Array class\n let arr = new Array();\n\n // Add an item to the array\n arr.push(3);\n console.log(arr);\n /* What is the length, capacity and memory address of \n your array?\n A: Lenght:1, capacity:3, memory address:0\n */\n\n arr.push(5);\n arr.push(15);\n arr.push(19);\n arr.push(45);\n arr.push(10);\n console.log(arr);\n /* Explore the push() method\n What is the length, capacity and memory\n address of your array?\n A: Lenght:6, capacity:6, memory address:0\n Array increased lenght by the number of elements added\n to the array, the capacity is using the size_ratio value of \n 1:3 so finale size is 12, when the size is 3 there is\n an increase in capacity (3 + 1) * 3 = 12 and the memory address is 3.\n */\n\n /* Exploring the pop() method\n What is the length, capacity, and address of your array?\n A: Lenght after pop would be 3. Capacity the same as there aren't\n calls to the size function, memory address:3\n */\n arr.pop();\n arr.pop();\n arr.pop();\n console.log(arr);\n\n // Understanding more about how arrays work\n // Print the 1st item in the array arr.\n console.log(arr.get(0));\n // Empty the array and add just 1 item: arr.push(\"tauhida\");\n var array_length = arr.length;\n while (array_length > 0) {\n arr.remove(0);\n array_length--;\n }\n arr.push(\"tauhida\");\n\n // Print this 1 item that you just added. What is the result?\n console.log(arr.get(0));\n /* Can you explain your result?\n A: the result is NaN, the reason is because our memory class is an array\n of ints. When the string gets set it check and defines NaN for the elements that\n the array should have.\n */\n\n // What is the purpose of the _resize() function in your Array class?\n // A: Allocate memory for the array based on the size ratio.\n}", "function someArr(arr) {\n return arr.length;\n}", "function length() {\n array = ['1', '2', '3'];\n return array.length\n}", "function defineAttribute(arr, prop) {\n if (!(prop in arr)) { // e.g. we cannot redefine .length\n Object.defineProperty(arr, prop, {\n get: function () {\n return querySet(_.pluck(arr, prop));\n },\n set: function (v) {\n if (util.isArray(v)) {\n if (this.length != v.length) throw new SiestaUserError({message: 'Must be same length'});\n for (var i = 0; i < v.length; i++) {\n this[i][prop] = v[i];\n }\n }\n else {\n for (i = 0; i < this.length; i++) {\n this[i][prop] = v;\n }\n }\n }\n });\n }\n}", "function ArrayCreate(length /* [, proto] */) { // eslint-disable-line no-unused-vars\n\t\t// 1. Assert: length is an integer Number ≥ 0.\n\t\t// 2. If length is -0, set length to +0.\n\t\tif (1 / length === -Infinity) {\n\t\t\tlength = 0;\n\t\t}\n\t\t// 3. If length>2^32-1, throw a RangeError exception.\n\t\tif (length > (Math.pow(2, 32) - 1)) {\n\t\t\tthrow new RangeError('Invalid array length');\n\t\t}\n\t\t// 4. If proto is not present, set proto to the intrinsic object %ArrayPrototype%.\n\t\t// 5. Let A be a newly created Array exotic object.\n\t\tvar A = [];\n\t\t// 6. Set A's essential internal methods except for [[DefineOwnProperty]] to the default ordinary object definitions specified in 9.1.\n\t\t// 7. Set A.[[DefineOwnProperty]] as specified in 9.4.2.1.\n\t\t// 8. Set A.[[Prototype]] to proto.\n\t\t// 9. Set A.[[Extensible]] to true.\n\t\t// 10. Perform ! OrdinaryDefineOwnProperty(A, \"length\", PropertyDescriptor{[[Value]]: length, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}).\n\t\tA.length = length;\n\t\t// 11. Return A.\n\t\treturn A;\n\t}", "get length() { return this._length; }", "get length() { return this._length; }", "constructor (N) {\n this.arr = new Array(N)\n\n for (var i = 0; i < N; i++) {\n this.arr.push(i)\n }\n }", "get length() {\n return this.size\n }", "get size() {\n return this.length;\n }", "function arrayItemLength(arr) {\n let newArr = [];\n for (const a in arr) {\n newArr.push(arr[a].length);\n }\n console.log(newArr);\n}", "function Array(item1, item2, item3, ...) {\n this.items = {\n 0: item1,\n 1: item2,\n 2: item3\n }\n}", "function array(n) {\r\n for (i = 0; i < n; i++) {\r\n this[i] = 0;\r\n }\r\n this.length = n;\r\n}", "get len(){\r\n\t\t// NOTE: if we don't do .slice() here this can count array \r\n\t\t// \t\tinstance attributes...\r\n\t\t// NOTE: .slice() has an added menifit here of removing any \r\n\t\t// \t\tattributes from the count...\r\n\t\treturn Object.keys(this.slice()).length }", "function ArrayCreate(length /* [, proto] */) { // eslint-disable-line no-unused-vars\n // 1. Assert: length is an integer Number ≥ 0.\n // 2. If length is -0, set length to +0.\n if (1 / length === -Infinity) {\n length = 0;\n }\n // 3. If length>2^32-1, throw a RangeError exception.\n if (length > (Math.pow(2, 32) - 1)) {\n throw new RangeError('Invalid array length');\n }\n // 4. If proto is not present, set proto to the intrinsic object %ArrayPrototype%.\n // 5. Let A be a newly created Array exotic object.\n var A = [];\n // 6. Set A's essential internal methods except for [[DefineOwnProperty]] to the default ordinary object definitions specified in 9.1.\n // 7. Set A.[[DefineOwnProperty]] as specified in 9.4.2.1.\n // 8. Set A.[[Prototype]] to proto.\n // 9. Set A.[[Extensible]] to true.\n // 10. Perform ! OrdinaryDefineOwnProperty(A, \"length\", PropertyDescriptor{[[Value]]: length, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}).\n A.length = length;\n // 11. Return A.\n return A;\n }", "get length() {\n return this.size;\n }", "function ArrayView(array, offset, length) {\n // ArrayView(array[, offset[, length]])\n // Inspired by TypedArray and DataView\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray\n this.array = array;\n this.viewOffset = offset|0;\n this.viewLength = length === undefined ? array.length|0 : length|0;\n }", "function getLength(arr){\n var a = arr.length\n return a\n}", "constructor() {\n this.items = [1, 2, 3, 4, 5];\n this.size = 0;\n }", "constructor() {\n this.elements = new Object();\n this.____length = 0;\n }", "get length() {\n return this.size;\n }", "function length(arr) {\n // code\n var lengthCount = arr.length;\n return lengthCount;\n}", "function QueueArray(){\n this.elements = new Array(6);\n}", "function Pack() {\n Object.defineProperty(this, \"length\", {set: setter});\n}", "ArrayLength() { \n\n if(this.Expected === null) { return 'Nothing has been add' } \n\n return this.Expected.length === this.Actual.length ? this.ArrayContent() : `Expected array length ${this.Expected.length} but found ${this.Actual.length}` \n \n }", "function myArray(len){\n\tvar a = [];\n\tfor(var i=0; i<len; i++){\n\t\ta[i] = {val:0};\n\t}\n\ta[len-1].val = 1;\n\treturn a;\n}", "get length() {\n return this._length;\n }", "function MyArray() {\n\n let values = new Array();\n if (arguments.length > 0) { values.push.apply(values, arguments) };\n\n // convertir un array a string separado por |\n values.__proto__.toPipedString = function() {\n return values.join(\"|\")\n }\n\n // convertir un array a string separado por /\n values.__proto__.toDirectoryString = function() {\n return values.join(\"/\")\n };\n\n // clasificar un array de strings de forma ascendente\n values.__proto__.arrayStringAsc = function() {\n return values.sort(function(a, b) {\n return a.localeCompare(b)\n })\n };\n\n // clasificar un array de strings de forma descendente\n values.__proto__.arrayStringDesc = function() {\n return values.sort(function(a, b) {\n return b.localeCompare(a)\n })\n };\n\n // clasificar un array de numeros de forma ascendente\n values.__proto__.arrayNumberAsc = function() {\n return values.sort((a, b) => a - b)\n };\n\n // clasificar un array de numeros de forma descendente\n values.__proto__.arrayNumberDesc = function() {\n return values.sort((a, b) => b - a)\n };\n\n // clasificar un array de objetos por una de sus propiedades de forma ascendente\n values.__proto__.arrayObjAsc = function(propertyName) {\n return values.sort(\n function(propertyName) {\n\n // hem de retornar una funcio de 2 parametres\n return function(object1, object2) {\n let value1 = object1[propertyName];\n let value2 = object2[propertyName];\n\n if (value1 < value2) {\n return -1;\n } else if (value1 > value2) {\n return 1;\n } else {\n return 0;\n }\n };\n }(propertyName)\n\n )\n };\n\n // clasificar un array de objetos por una de sus propiedades de forma descendente\n values.__proto__.arrayObjDesc = function(propertyName) {\n return values.sort(\n function(propertyName) {\n\n // hem de retornar una funcio de 2 parametres\n return function(object1, object2) {\n let value1 = object1[propertyName];\n let value2 = object2[propertyName];\n\n if (value1 < value2) {\n return 1;\n } else if (value1 > value2) {\n return -1;\n } else {\n return 0;\n }\n };\n }(propertyName)\n\n )\n };\n\n // eliminar elementos duplicados de una array o un string\n values.__proto__.delItemDup = (itemIterale) => {\n return [...new Set(itemIterale)]\n };\n\n return values;\n }", "function WMakeArray(num)\n{\n this.length = num;\n for (var i = 0; i < num; i++)\n {\n this[i] = \"\";\n }\n}", "constructor() {\n //starts array as empty\n this.length = 0;\n //capacity will be value for length of items in array + any empty spaces\n this._capacity = 0;\n //allocates the space for the length of new array, as long as there is room in memory\n this.ptr = newMem.allocate(this.length);\n }", "function lvl5exercise3() {\n\tvar array = [1, \"adam\"];\n console.log(\"3) \" + array.length);\n}", "get length() {}", "get length() {}", "get length(){return undefined;}", "get length(){return undefined;}", "get Length()\n {\n return this._length;\n }", "function setProperties(length, type, used) {\n this.length = length;\n this.type = type;\n this.used = used;\n}", "get length() {\n return this.items.size;\n }", "function makeArray(arrayLength)\n{\n //Solution goes here.\n}", "function\nXATS2JS_jsarray_length\n (xs)\n{\n return (xs.length);\n}", "function likeArray(obj) {\n return obj && typeof obj === \"object\" && typeof obj.length === \"number\";\n }", "get length() {\n return this.list.size;\n }", "function myArray(){\n this.size = 0,\n this.print = function(){\n for (let i = 0; i < this.size; i++){\n console.log(this[i]);\n }\n },\n this.push = function(item){\n this[this.size] = item;\n this.size++;\n },\n this.pop = function(){\n this[this.size-1] = undefined;\n this.size--;\n }\n}", "size(arr){\n var count = 0;\n while(this.data !== []){\n count++;\n this.pop;\n }\n return count;\n }", "function getElementCount(array) {\n return array.length;\n}//helper function for number of elements in array", "push(...el) {\n let i = Object.keys(this).length;\n for (let a of el)\n this[i++] = a;\n __classPrivateFieldSet(this, _length, __classPrivateFieldGet(this, _length) + el.length);\n return __classPrivateFieldGet(this, _length);\n }", "get length() {\n return array.length == 0\n }", "set length(length) {\n\t\tthis._length = length;\n\t}", "function ArrayList(initialLength){\n this.length=0;\n this.array=new Array(initialLength);\n\n this.grow = function () {\n var original=this.array;\n this.array=new Array(this.length*2);\n for(var i=0;i<this.length;i++){\n this.array[i]=original[i];\n }\n };\n this.add=function(value){\n if(this.length=this.array.length){\n this.grow();\n }\n this.array[this.length++]=value;\n }\n}", "length() {\n const arrayLen = this.array.length;\n debug(`\\nLOG: There are total ${arrayLen} data in the array`);\n return arrayLen;\n }", "function getArrayLength(array) {\n\t// create a length variable\n\tlet length;\n\t// assign it to the length of the array\n\tlength = array.length;\n\t// return the length variable\n\treturn length;\n}", "function length(array) {\n return array.length | 0;\n}", "function length(array) {\n return array.length | 0;\n}", "function TestConstructSmallObject(constr) {\n var myObject = { 0: 5, 1: 6, length: 2 };\n\n arr = new constr(myObject);\n\n assertEquals(2, arr.length);\n assertEquals(5, arr[0]);\n assertEquals(6, arr[1]);\n}", "function BaseArray() {\n for (var i=0; i < arguments.length; i++) {\n this[i] = arguments[i];\n };\n this.length = arguments.length;\n }", "getLength() {\nreturn this.length;\n}", "get length () {\n return this.products.length;\n }", "set length(value) {}", "set length(value) {}", "function test() {\n var arr;\n\n Object.defineProperty(Array.prototype,\n '0',\n {\n value: 'inherit',\n writable: false,\n enumerable: true,\n configurable: true\n });\n print('defineProperty success');\n\n // No problem here: '0' not accessed\n arr = [];\n print(arr.length, arr[0], arr[1]);\n\n // Again should succeed\n var arr = ['foo', 'bar'];\n print(arr.length, arr[0], arr[1]);\n\n // Assignment should not work unless an own property already exists\n arr = [];\n arr[0] = 'shouldfail'; // failure is silent\n print(arr.length, arr[0], arr[1]);\n\n arr = ['foo', 'bar'];\n arr[0] = 'shouldsucceed';\n print(arr.length, arr[0], arr[1]);\n}", "get length() {\n\t\treturn this.items.length;\n\t}", "get length() {\n return Object.keys(this).length;\n }", "get length() {\n return this._list.length;\n }", "ensureCapacity(len) {\n if (len == this.#array.length) {\n let newLen = this.#array.length * 2;\n let newArr = new Array(newLen);\n for (var i = 0; i < this.#size; i++) {\n newArr[i] = this.#array[i];\n }\n this.#array = newArr;\n }\n }", "function MaxArray(_maxLength) {\n this.maxLength = _maxLength; // max. number of objects to store\n this.values = []; // array for storing objects\n this.getLength = getLength; // return length of trail, aka num. of objects stored\n this.append = append; //add object to end of list\n}", "get length() {\n return this.list.length;\n }", "function length(arr){\r\n\tvar length = 0;\r\n\tfor(var len in arr){\r\n\t\tlength++;\r\n\t}\r\n\treturn length;\r\n}", "constructor(length = 0) {\n this._array = [];\n for (let ii = 0; ii < length; ii++) {\n this._array[ii] = Helper.getRandomWholeNumberBetweenRange(1, 10);\n }\n }", "constructor(...args) {\n this.length = 0;\n args.forEach(arg => {\n this.push(arg);\n })\n }", "getLength() {\n return this.length;\n }", "constructor(length){ \n this.n=BigInt(length)\n this.A={}\n }", "constructor(length){ \n this.n=BigInt(length)\n this.A={}\n }", "get _length () {\n return 1\n }", "get _length () {\n return 1\n }", "get length () {\n return this.list.length\n }", "get length(){\r\n\t\treturn this.values().length }", "get length () {\n return this.data.length\n }", "constructor(size = 53) {\n //give our array hashtable a size of 53\n this.keyMap = new Array(size); //create our neww array\n }", "function ArrayIterable(arr){\n this.arr = arr\n}", "size(){ return this.size}", "function /** VAM_ARR: VAlue_Member_ARRay **/\r\n /** (As apposed to pointer member in struct. **/\r\n GEP_VAM_ARR_dex_inc( arr_len )\r\n { \"use strict\"\r\n\r\n let arr_dex_inc=[];\r\n for( let i = 0 ; i < arr_len ; i ++ ){\r\n \r\n arr_dex_inc[ i ] = GEP_NEW_dex_inc( );\r\n\r\n //: NO!: GEP_INI_dex_inc( arr_dex_inc[ i ] ) ://\r\n //: Because: This function really ://\r\n //: exists to denote C syntax. ://\r\n };;\r\n return( arr_dex_inc );\r\n }" ]
[ "0.6944659", "0.68672657", "0.68197477", "0.67784697", "0.6701642", "0.66438645", "0.656437", "0.6552879", "0.6457395", "0.63919795", "0.6386485", "0.63513136", "0.62543947", "0.62125033", "0.61841005", "0.6117681", "0.6090436", "0.6042284", "0.59940344", "0.5989124", "0.5987147", "0.5986653", "0.5986144", "0.5942635", "0.59407085", "0.59407085", "0.5938815", "0.5928776", "0.5915891", "0.590612", "0.5904306", "0.58754975", "0.5871318", "0.58419245", "0.58405465", "0.5833809", "0.58330625", "0.5805489", "0.58039653", "0.5803427", "0.578378", "0.57773745", "0.5758802", "0.5758727", "0.574462", "0.57441217", "0.57414275", "0.57321346", "0.5728755", "0.5724206", "0.5713719", "0.5713719", "0.56732565", "0.56732565", "0.56662524", "0.5665114", "0.5664558", "0.56430674", "0.56425923", "0.5635986", "0.5635127", "0.56345785", "0.56317717", "0.5624464", "0.5593605", "0.55730945", "0.55709976", "0.55339694", "0.5531441", "0.5515466", "0.55043215", "0.55043215", "0.5504209", "0.5502076", "0.550105", "0.54876524", "0.5485768", "0.5485768", "0.548402", "0.5481729", "0.54806244", "0.54705745", "0.5462893", "0.54493654", "0.5441768", "0.54342544", "0.5426093", "0.542152", "0.5421188", "0.5413669", "0.5413669", "0.54133534", "0.54133534", "0.5405273", "0.5401249", "0.53999925", "0.539395", "0.53884387", "0.5381184", "0.5378684" ]
0.7584731
0
Example 3 2nd way Defining a class named Arr and our own property like predefined length property on array objects
function MyArray(arr=[]){ this.arr = arr this.type = typeof arr this.len = total_items this.sum = function(){ s = 0 this.arr.forEach(function(item){ s += item }) return s } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Arr(arr=[]){\n\tthis.arr = arr\n\tthis.type = typeof arr\n\t\n\tthis.total_items_count = function (){\n\t\tcount = 0\n\t\tfor (var i = 0; i < this.arr.length; i++){\n\t\t\tcount += 1\n\t\t}\n\t\treturn count\n\t}\n\tthis.len = this.total_items_count()\n}", "get arraySize() {}", "function arrayLengthTest2() {\n var arr;\n\n arr = [ 1, 2 ];\n Array.prototype[2] = 'entry-in-proto';\n\n print(arr.length, arr[0], arr[1], arr[2], arr[3]);\n\n print(JSON.stringify(arr));\n}", "length(arr) {\n return arr.length;\n }", "function main() {\n\n Array.SIZE_RATIO = 3;\n\n // Create an instance of the Array class\n let arr = new Array();\n\n // Add an item to the array\n arr.push(3);\n\n console.log(arr);\n}", "function arrayLengthTest1() {\n var arr;\n var k;\n\n // base case\n arr = [ 1, 2, undefined, 4 ];\n print(JSON.stringify(arr));\n\n // length must be obeyed even if no elements have been added\n arr = [ 1, 2, undefined, 4 ];\n arr.length = 8;\n print(JSON.stringify(arr));\n\n arr = [ 1, 2 ];\n arr[100] = 'foo';\n arr[3] = 4;\n print(JSON.stringify(arr));\n}", "get size() {\n return this._array.length\n }", "set arraySize(value) {}", "function DynamicArray() {\n this.arr = new Array(1);\n this.size = 1;\n this.length = 0;\n this.start = 0;\n}", "function Collection(arr) {\n if(!Array.isArray(arr)) {\n return \"Data is not array!\";\n }\n\n this.items = arr;\n\n Object.defineProperty(this, 'length', {\n value: arr.length,\n enumerable: false,\n writable: false,\n });\n}", "function makeArray(n) {\nthis.length = n\nreturn this\n}", "constructor() {\r\n // this.size = 0;\r\n this.arr = [];\r\n }", "constructor (arraySpecs, initSize = 100, deltaSize = 100) {\n // arraySpec details: Three forms are used.\n //\n // The \"key\" is the name of the array. The values are brackets specifying\n // formats for the Object's arrays.\n // * key: [value, 0] - name is a constant value, not an array of values.\n // * key: [arrayType, 1] - key is a simple array of given type.\n // A shortcut is key: arrayType .. w/o the brackets.\n // * key: [arrayType, num] - name is an Array of TypedArrays of num elements\n // arrayType has to be a typed array. If Array is to contain arrays,\n // they should be array objects of size num, not num elements from array.\n\n this.length = 0\n this.size = 0\n this.specs = {}\n this.arrayNames = [] // experiment, may not need\n this.defaultNames = []\n // convert arraySpecs arrays to {Type, elements} objects\n for (const key in arraySpecs) {\n let val = arraySpecs[key]\n if (util.typeOf(val) === 'function') val = [val, 1]\n const [Type, elements] = val\n this.specs[key] = {Type, elements}\n\n if (elements === 0) // experiment, may not need\n this.defaultNames.push(key)\n else\n this.arrayNames.push(key)\n }\n this.initSize = initSize\n this.deltaSize = deltaSize\n this.arrays = {}\n this.initArrays(this.specs)\n this.sharedGetterSetter = this.createGetterSetter()\n }", "function Array() {}", "function makeArray(size) \n{\n\tthis.size = size;\n\treturn this;\n}", "function array(items) {\n if(!(this instanceof array)) return new array(items)\n \n var self = this\n this.items = []\n this.count = o_O(0)\n this.length = 0\n this.count.change(function(count) {\n self.length = count \n })\n if(items) {\n for(var i=0; i< items.length; i++)\n this.push(items[i])\n }\n this.initialize()\n}", "function mainmore(){\n Array.SIZE_RATIO = 3;\n let arr = new Array();\n arr.push(3);\n arr.push(5);\n arr.push(15);\n arr.push(19);\n arr.push(45);\n arr.push(10);\n console.log(arr);\n console.log(arr.length);\n console.log(arr._capacity);\n}", "function defineAttribute(arr, prop) {\n if (!(prop in arr)) { // e.g. we cannot redefine .length\n Object.defineProperty(arr, prop, {\n get: function () {\n return querySet(_.pluck(arr, prop));\n },\n set: function (v) {\n if (util.isArray(v)) {\n if (this.length != v.length) throw new SiestaUserError({message: 'Must be same length'});\n for (var i = 0; i < v.length; i++) {\n this[i][prop] = v[i];\n }\n }\n else {\n for (i = 0; i < this.length; i++) {\n this[i][prop] = v;\n }\n }\n }\n });\n }\n}", "function Array(){\n this.is = \"Array\";\n}", "function Array(item1, item2, item3, ...) {\n this.items = {\n 0: item1,\n 1: item2,\n 2: item3\n }\n}", "function length() {\n array = ['1', '2', '3'];\n return array.length\n}", "function maintahu(){\n Array.SIZE_RATIO = 3;\n let arr = new Array();\n arr.push(\"tahuina\");\n console.log(arr);\n console.log(arr.get(0));\n}", "function someArr(arr) {\n return arr.length;\n}", "constructor (N) {\n this.arr = new Array(N)\n\n for (var i = 0; i < N; i++) {\n this.arr.push(i)\n }\n }", "function main() {\n Array.SIZE_RATIO = 3;\n\n // Create an instance of the Array class\n let arr = new Array();\n\n // Add an item to the array\n arr.push(3);\n console.log(arr);\n /* What is the length, capacity and memory address of \n your array?\n A: Lenght:1, capacity:3, memory address:0\n */\n\n arr.push(5);\n arr.push(15);\n arr.push(19);\n arr.push(45);\n arr.push(10);\n console.log(arr);\n /* Explore the push() method\n What is the length, capacity and memory\n address of your array?\n A: Lenght:6, capacity:6, memory address:0\n Array increased lenght by the number of elements added\n to the array, the capacity is using the size_ratio value of \n 1:3 so finale size is 12, when the size is 3 there is\n an increase in capacity (3 + 1) * 3 = 12 and the memory address is 3.\n */\n\n /* Exploring the pop() method\n What is the length, capacity, and address of your array?\n A: Lenght after pop would be 3. Capacity the same as there aren't\n calls to the size function, memory address:3\n */\n arr.pop();\n arr.pop();\n arr.pop();\n console.log(arr);\n\n // Understanding more about how arrays work\n // Print the 1st item in the array arr.\n console.log(arr.get(0));\n // Empty the array and add just 1 item: arr.push(\"tauhida\");\n var array_length = arr.length;\n while (array_length > 0) {\n arr.remove(0);\n array_length--;\n }\n arr.push(\"tauhida\");\n\n // Print this 1 item that you just added. What is the result?\n console.log(arr.get(0));\n /* Can you explain your result?\n A: the result is NaN, the reason is because our memory class is an array\n of ints. When the string gets set it check and defines NaN for the elements that\n the array should have.\n */\n\n // What is the purpose of the _resize() function in your Array class?\n // A: Allocate memory for the array based on the size ratio.\n}", "function ArrayCreate(length /* [, proto] */) { // eslint-disable-line no-unused-vars\n\t\t// 1. Assert: length is an integer Number ≥ 0.\n\t\t// 2. If length is -0, set length to +0.\n\t\tif (1 / length === -Infinity) {\n\t\t\tlength = 0;\n\t\t}\n\t\t// 3. If length>2^32-1, throw a RangeError exception.\n\t\tif (length > (Math.pow(2, 32) - 1)) {\n\t\t\tthrow new RangeError('Invalid array length');\n\t\t}\n\t\t// 4. If proto is not present, set proto to the intrinsic object %ArrayPrototype%.\n\t\t// 5. Let A be a newly created Array exotic object.\n\t\tvar A = [];\n\t\t// 6. Set A's essential internal methods except for [[DefineOwnProperty]] to the default ordinary object definitions specified in 9.1.\n\t\t// 7. Set A.[[DefineOwnProperty]] as specified in 9.4.2.1.\n\t\t// 8. Set A.[[Prototype]] to proto.\n\t\t// 9. Set A.[[Extensible]] to true.\n\t\t// 10. Perform ! OrdinaryDefineOwnProperty(A, \"length\", PropertyDescriptor{[[Value]]: length, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}).\n\t\tA.length = length;\n\t\t// 11. Return A.\n\t\treturn A;\n\t}", "get length() { return this._length; }", "get length() { return this._length; }", "function arrayItemLength(arr) {\n let newArr = [];\n for (const a in arr) {\n newArr.push(arr[a].length);\n }\n console.log(newArr);\n}", "function array(n) {\r\n for (i = 0; i < n; i++) {\r\n this[i] = 0;\r\n }\r\n this.length = n;\r\n}", "get length() {\n return this.size\n }", "get len(){\r\n\t\t// NOTE: if we don't do .slice() here this can count array \r\n\t\t// \t\tinstance attributes...\r\n\t\t// NOTE: .slice() has an added menifit here of removing any \r\n\t\t// \t\tattributes from the count...\r\n\t\treturn Object.keys(this.slice()).length }", "get size() {\n return this.length;\n }", "function ArrayView(array, offset, length) {\n // ArrayView(array[, offset[, length]])\n // Inspired by TypedArray and DataView\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray\n this.array = array;\n this.viewOffset = offset|0;\n this.viewLength = length === undefined ? array.length|0 : length|0;\n }", "function ArrayCreate(length /* [, proto] */) { // eslint-disable-line no-unused-vars\n // 1. Assert: length is an integer Number ≥ 0.\n // 2. If length is -0, set length to +0.\n if (1 / length === -Infinity) {\n length = 0;\n }\n // 3. If length>2^32-1, throw a RangeError exception.\n if (length > (Math.pow(2, 32) - 1)) {\n throw new RangeError('Invalid array length');\n }\n // 4. If proto is not present, set proto to the intrinsic object %ArrayPrototype%.\n // 5. Let A be a newly created Array exotic object.\n var A = [];\n // 6. Set A's essential internal methods except for [[DefineOwnProperty]] to the default ordinary object definitions specified in 9.1.\n // 7. Set A.[[DefineOwnProperty]] as specified in 9.4.2.1.\n // 8. Set A.[[Prototype]] to proto.\n // 9. Set A.[[Extensible]] to true.\n // 10. Perform ! OrdinaryDefineOwnProperty(A, \"length\", PropertyDescriptor{[[Value]]: length, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}).\n A.length = length;\n // 11. Return A.\n return A;\n }", "function getLength(arr){\n var a = arr.length\n return a\n}", "get length() {\n return this.size;\n }", "function myArray(len){\n\tvar a = [];\n\tfor(var i=0; i<len; i++){\n\t\ta[i] = {val:0};\n\t}\n\ta[len-1].val = 1;\n\treturn a;\n}", "function length(arr) {\n // code\n var lengthCount = arr.length;\n return lengthCount;\n}", "function QueueArray(){\n this.elements = new Array(6);\n}", "function lvl5exercise3() {\n\tvar array = [1, \"adam\"];\n console.log(\"3) \" + array.length);\n}", "constructor() {\n this.items = [1, 2, 3, 4, 5];\n this.size = 0;\n }", "get length() {\n return this.size;\n }", "constructor() {\n this.elements = new Object();\n this.____length = 0;\n }", "function Pack() {\n Object.defineProperty(this, \"length\", {set: setter});\n}", "ArrayLength() { \n\n if(this.Expected === null) { return 'Nothing has been add' } \n\n return this.Expected.length === this.Actual.length ? this.ArrayContent() : `Expected array length ${this.Expected.length} but found ${this.Actual.length}` \n \n }", "function WMakeArray(num)\n{\n this.length = num;\n for (var i = 0; i < num; i++)\n {\n this[i] = \"\";\n }\n}", "function MyArray() {\n\n let values = new Array();\n if (arguments.length > 0) { values.push.apply(values, arguments) };\n\n // convertir un array a string separado por |\n values.__proto__.toPipedString = function() {\n return values.join(\"|\")\n }\n\n // convertir un array a string separado por /\n values.__proto__.toDirectoryString = function() {\n return values.join(\"/\")\n };\n\n // clasificar un array de strings de forma ascendente\n values.__proto__.arrayStringAsc = function() {\n return values.sort(function(a, b) {\n return a.localeCompare(b)\n })\n };\n\n // clasificar un array de strings de forma descendente\n values.__proto__.arrayStringDesc = function() {\n return values.sort(function(a, b) {\n return b.localeCompare(a)\n })\n };\n\n // clasificar un array de numeros de forma ascendente\n values.__proto__.arrayNumberAsc = function() {\n return values.sort((a, b) => a - b)\n };\n\n // clasificar un array de numeros de forma descendente\n values.__proto__.arrayNumberDesc = function() {\n return values.sort((a, b) => b - a)\n };\n\n // clasificar un array de objetos por una de sus propiedades de forma ascendente\n values.__proto__.arrayObjAsc = function(propertyName) {\n return values.sort(\n function(propertyName) {\n\n // hem de retornar una funcio de 2 parametres\n return function(object1, object2) {\n let value1 = object1[propertyName];\n let value2 = object2[propertyName];\n\n if (value1 < value2) {\n return -1;\n } else if (value1 > value2) {\n return 1;\n } else {\n return 0;\n }\n };\n }(propertyName)\n\n )\n };\n\n // clasificar un array de objetos por una de sus propiedades de forma descendente\n values.__proto__.arrayObjDesc = function(propertyName) {\n return values.sort(\n function(propertyName) {\n\n // hem de retornar una funcio de 2 parametres\n return function(object1, object2) {\n let value1 = object1[propertyName];\n let value2 = object2[propertyName];\n\n if (value1 < value2) {\n return 1;\n } else if (value1 > value2) {\n return -1;\n } else {\n return 0;\n }\n };\n }(propertyName)\n\n )\n };\n\n // eliminar elementos duplicados de una array o un string\n values.__proto__.delItemDup = (itemIterale) => {\n return [...new Set(itemIterale)]\n };\n\n return values;\n }", "get length() {\n return this._length;\n }", "get length() {}", "get length() {}", "constructor() {\n //starts array as empty\n this.length = 0;\n //capacity will be value for length of items in array + any empty spaces\n this._capacity = 0;\n //allocates the space for the length of new array, as long as there is room in memory\n this.ptr = newMem.allocate(this.length);\n }", "function makeArray(arrayLength)\n{\n //Solution goes here.\n}", "get length(){return undefined;}", "get length(){return undefined;}", "function setProperties(length, type, used) {\n this.length = length;\n this.type = type;\n this.used = used;\n}", "get length() {\n return this.items.size;\n }", "function\nXATS2JS_jsarray_length\n (xs)\n{\n return (xs.length);\n}", "function getElementCount(array) {\n return array.length;\n}//helper function for number of elements in array", "function likeArray(obj) {\n return obj && typeof obj === \"object\" && typeof obj.length === \"number\";\n }", "function myArray(){\n this.size = 0,\n this.print = function(){\n for (let i = 0; i < this.size; i++){\n console.log(this[i]);\n }\n },\n this.push = function(item){\n this[this.size] = item;\n this.size++;\n },\n this.pop = function(){\n this[this.size-1] = undefined;\n this.size--;\n }\n}", "get Length()\n {\n return this._length;\n }", "size(arr){\n var count = 0;\n while(this.data !== []){\n count++;\n this.pop;\n }\n return count;\n }", "get length() {\n return this.list.size;\n }", "push(...el) {\n let i = Object.keys(this).length;\n for (let a of el)\n this[i++] = a;\n __classPrivateFieldSet(this, _length, __classPrivateFieldGet(this, _length) + el.length);\n return __classPrivateFieldGet(this, _length);\n }", "set length(length) {\n\t\tthis._length = length;\n\t}", "function BaseArray() {\n for (var i=0; i < arguments.length; i++) {\n this[i] = arguments[i];\n };\n this.length = arguments.length;\n }", "get length() {\n return array.length == 0\n }", "function length(array) {\n return array.length | 0;\n}", "function length(array) {\n return array.length | 0;\n}", "function getArrayLength(array) {\n\t// create a length variable\n\tlet length;\n\t// assign it to the length of the array\n\tlength = array.length;\n\t// return the length variable\n\treturn length;\n}", "length() {\n const arrayLen = this.array.length;\n debug(`\\nLOG: There are total ${arrayLen} data in the array`);\n return arrayLen;\n }", "function ArrayList(initialLength){\n this.length=0;\n this.array=new Array(initialLength);\n\n this.grow = function () {\n var original=this.array;\n this.array=new Array(this.length*2);\n for(var i=0;i<this.length;i++){\n this.array[i]=original[i];\n }\n };\n this.add=function(value){\n if(this.length=this.array.length){\n this.grow();\n }\n this.array[this.length++]=value;\n }\n}", "set length(value) {}", "set length(value) {}", "get length() {\n return Object.keys(this).length;\n }", "function test() {\n var arr;\n\n Object.defineProperty(Array.prototype,\n '0',\n {\n value: 'inherit',\n writable: false,\n enumerable: true,\n configurable: true\n });\n print('defineProperty success');\n\n // No problem here: '0' not accessed\n arr = [];\n print(arr.length, arr[0], arr[1]);\n\n // Again should succeed\n var arr = ['foo', 'bar'];\n print(arr.length, arr[0], arr[1]);\n\n // Assignment should not work unless an own property already exists\n arr = [];\n arr[0] = 'shouldfail'; // failure is silent\n print(arr.length, arr[0], arr[1]);\n\n arr = ['foo', 'bar'];\n arr[0] = 'shouldsucceed';\n print(arr.length, arr[0], arr[1]);\n}", "get length() {\n\t\treturn this.items.length;\n\t}", "function MaxArray(_maxLength) {\n this.maxLength = _maxLength; // max. number of objects to store\n this.values = []; // array for storing objects\n this.getLength = getLength; // return length of trail, aka num. of objects stored\n this.append = append; //add object to end of list\n}", "getLength() {\nreturn this.length;\n}", "get length () {\n return this.products.length;\n }", "ensureCapacity(len) {\n if (len == this.#array.length) {\n let newLen = this.#array.length * 2;\n let newArr = new Array(newLen);\n for (var i = 0; i < this.#size; i++) {\n newArr[i] = this.#array[i];\n }\n this.#array = newArr;\n }\n }", "function length(arr){\r\n\tvar length = 0;\r\n\tfor(var len in arr){\r\n\t\tlength++;\r\n\t}\r\n\treturn length;\r\n}", "get length() {\n return this._list.length;\n }", "function /** VAM_ARR: VAlue_Member_ARRay **/\r\n /** (As apposed to pointer member in struct. **/\r\n GEP_VAM_ARR_dex_inc( arr_len )\r\n { \"use strict\"\r\n\r\n let arr_dex_inc=[];\r\n for( let i = 0 ; i < arr_len ; i ++ ){\r\n \r\n arr_dex_inc[ i ] = GEP_NEW_dex_inc( );\r\n\r\n //: NO!: GEP_INI_dex_inc( arr_dex_inc[ i ] ) ://\r\n //: Because: This function really ://\r\n //: exists to denote C syntax. ://\r\n };;\r\n return( arr_dex_inc );\r\n }", "constructor(...args) {\n this.length = 0;\n args.forEach(arg => {\n this.push(arg);\n })\n }", "get length(){\r\n\t\treturn this.values().length }", "constructor(length){ \n this.n=BigInt(length)\n this.A={}\n }", "constructor(length){ \n this.n=BigInt(length)\n this.A={}\n }", "get length() {\n return this.list.length;\n }", "function TestConstructSmallObject(constr) {\n var myObject = { 0: 5, 1: 6, length: 2 };\n\n arr = new constr(myObject);\n\n assertEquals(2, arr.length);\n assertEquals(5, arr[0]);\n assertEquals(6, arr[1]);\n}", "constructor(size = 53) {\n //give our array hashtable a size of 53\n this.keyMap = new Array(size); //create our neww array\n }", "get _length () {\n return 1\n }", "get _length () {\n return 1\n }", "constructor(length = 0) {\n this._array = [];\n for (let ii = 0; ii < length; ii++) {\n this._array[ii] = Helper.getRandomWholeNumberBetweenRange(1, 10);\n }\n }", "get length () {\n return this.data.length\n }", "function ArrayIterable(arr){\n this.arr = arr\n}", "getLength() {\n return this.length;\n }", "function lengths(arr){\n return arr.map(f => f.length);\n}", "get length () {\n return this.list.length\n }" ]
[ "0.7603584", "0.6944865", "0.6882298", "0.68588364", "0.6742108", "0.67283565", "0.66138184", "0.6561255", "0.6544978", "0.6439339", "0.6388988", "0.6336112", "0.6275034", "0.621946", "0.6170189", "0.6126601", "0.611459", "0.60096574", "0.60022223", "0.60018194", "0.5994176", "0.5977261", "0.5976005", "0.59730655", "0.5969004", "0.5935339", "0.5924592", "0.5924592", "0.59208035", "0.5914832", "0.5894847", "0.588435", "0.5881681", "0.58683884", "0.58349144", "0.58225894", "0.5803095", "0.5783826", "0.5777849", "0.5777239", "0.5771251", "0.5765024", "0.5762271", "0.5758905", "0.57501173", "0.57457423", "0.5732787", "0.5725507", "0.572037", "0.5706128", "0.5706128", "0.5692459", "0.5679119", "0.5675034", "0.5675034", "0.5661399", "0.5649766", "0.564901", "0.5648471", "0.56436414", "0.56335783", "0.56335294", "0.56246334", "0.5604188", "0.557393", "0.5556868", "0.553364", "0.5531034", "0.5528416", "0.5528416", "0.55211836", "0.5513594", "0.5500426", "0.5498411", "0.5498411", "0.54894674", "0.5488108", "0.5474519", "0.54684645", "0.5468163", "0.54659045", "0.5461772", "0.544955", "0.5442503", "0.5436955", "0.542986", "0.54188573", "0.54146725", "0.54146725", "0.54130423", "0.54071355", "0.5404093", "0.53980523", "0.53980523", "0.53952765", "0.5394884", "0.5394713", "0.538381", "0.53801435", "0.5373925" ]
0.63655025
11
fillEditSummaries for VisualEditor, borrowed from "based on Grunny's jQuery version of Sikon's original version"
function fillEditSummariesVisualEditor() { mw.hook( 've.activationComplete' ).add(function () { $.get( mw.config.get( 'wgScript' ), { title: 'Template:Stdsummaries', action: 'raw', ctype: 'text/plain' } ).done( function( data ) { var $summaryOptionsList, $summaryLabel = $( '.ve-ui-summaryPanel' ), $summaryInput = $( '.ve-ui-summaryPanel-summaryInputField > input' ), lines = data.split( '\n' ), $wrapper = $( '<div>').addClass( 'edit-widemode-hide' ).text( 'Standard summaries: ' ); $summaryOptionsList = $( '<select />' ).attr( 'id', 'stdEditSummaries' ).change( function() { var editSummary = $( this ).val(); if ( editSummary !== '' ) { $summaryInput.val( editSummary ); } } ); for ( var i = 0; i < lines.length; i++ ) { var editSummaryText = ( lines[i].indexOf( '-- ' ) === 0 ) ? lines[i].substring(3) : ''; $summaryOptionsList.append( $( '<option>' ).val( editSummaryText ).text( lines[i] ) ); } $summaryLabel.prepend( $wrapper.append( $summaryOptionsList ) ); } ); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fillEditSummaries() {\n\n\tif ( !$( '#wpSummaryLabel' ).length ) {\n\t\treturn;\n\t}\n\n\t$.get( mw.config.get( 'wgScript' ), { title: 'Template:Stdsummaries', action: 'raw', ctype: 'text/plain' } ).done( function( data ) {\n\t\tvar\t$summaryOptionsList,\n\t\t\t$summaryLabel = $( '#wpSummaryLabel' ),\n\t\t\tlines = data.split( '\\n' ),\n\t\t\t$wrapper = $( '<div>').addClass( 'edit-widemode-hide' ).text( 'Standard summaries: ' );\n\n\t\t$summaryOptionsList = $( '<select />' ).attr( 'id', 'stdEditSummaries' ).change( function() {\n\t\t\tvar editSummary = $( this ).val();\n\t\t\tif ( editSummary !== '' ) {\n\t\t\t\t$( '#wpSummary' ).val( editSummary );\n\t\t\t}\n\t\t} );\n\n\t\tfor ( var i = 0; i < lines.length; i++ ) {\n\t\t\tvar editSummaryText = ( lines[i].indexOf( '-- ' ) === 0 ) ? lines[i].substring(3) : '';\n\t\t\t$summaryOptionsList.append( $( '<option>' ).val( editSummaryText ).text( lines[i] ) );\n\t\t}\n\n\t\t$summaryLabel.prepend( $wrapper.append( $summaryOptionsList ) );\n\t} );\n\n}", "function fillEditSummaries() {\n\n\tif ( !$( '#wpSummaryLabel' ).length ) {\n\t\treturn;\n\t}\n\n\t$.get( mw.config.get( 'wgScript' ), { title: 'Template:Stdsummaries', action: 'raw', ctype: 'text/plain' } ).done( function( data ) {\n\t\tvar\t$summaryOptionsList,\n\t\t\t$summaryLabel = $( '#wpSummaryLabel' ),\n\t\t\tlines = data.split( '\\n' ),\n\t\t\t$wrapper = $( '<div>').addClass( 'edit-widemode-hide' ).text( 'Standard summaries: ' );\n\n\t\t$summaryOptionsList = $( '<select />' ).attr( 'id', 'stdEditSummaries' ).change( function() {\n\t\t\tvar editSummary = $( this ).val();\n\t\t\tif ( editSummary !== '' ) {\n\t\t\t\t$( '#wpSummary' ).val( editSummary );\n\t\t\t}\n\t\t} );\n\n\t\tfor ( var i = 0; i < lines.length; i++ ) {\n\t\t\tvar editSummaryText = ( lines[i].indexOf( '-- ' ) === 0 ) ? lines[i].substring(3) : '';\n\t\t\t$summaryOptionsList.append( $( '<option>' ).val( editSummaryText ).text( lines[i] ) );\n\t\t}\n\n\t\t$summaryLabel.prepend( $wrapper.append( $summaryOptionsList ) );\n\t} );\n\n}", "function fillEditSummariesVisualEditor() {\n\tmw.hook( 've.activationComplete' ).add(function () {\n\n\t\t$.get( mw.config.get( 'wgScript' ), { title: 'Template:Stdsummaries', action: 'raw', ctype: 'text/plain' } ).done( function( data ) {\n\t\t\tvar\t$summaryOptionsList,\n\t\t\t\t$summaryLabel = $( '.ve-ui-summaryPanel' ),\n\t\t\t\t$summaryInput = $( '.ve-ui-summaryPanel-summaryInputField > input' ),\n\t\t\t\tlines = data.split( '\\n' ),\n\t\t\t\t$wrapper = $( '<div>').addClass( 'edit-widemode-hide' ).text( 'Varsayılan özetler: ' );\n\n\t\t\t$summaryOptionsList = $( '<select />' ).attr( 'id', 'stdEditSummaries' ).change( function() {\n\t\t\t\tvar editSummary = $( this ).val();\n\t\t\t\tif ( editSummary !== '' ) {\n\t\t\t\t\t$summaryInput.val( editSummary );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tfor ( var i = 0; i < lines.length; i++ ) {\n\t\t\t\tvar editSummaryText = ( lines[i].indexOf( '-- ' ) === 0 ) ? lines[i].substring(3) : '';\n\t\t\t\t$summaryOptionsList.append( $( '<option>' ).val( editSummaryText ).text( lines[i] ) );\n\t\t\t}\n\n\t\t\t$summaryLabel.prepend( $wrapper.append( $summaryOptionsList ) );\n\t\t} );\n\t} );\n}", "function fillEditSummaries() {\n\tif ( !$( '#wpSummaryLabel' ).length ) {\n\t\treturn;\n\t}\n\t$.get( mw.config.get( 'wgScript' ), { title: 'Template:Stdsummaries', action: 'raw', ctype: 'text/plain' } ).done( function( data ) {\n\t\tvar\t$summaryOptionsList,\n\t\t\t$summaryLabel = $( '#wpSummaryLabel' ),\n\t\t\tlines = data.split( '\\n' ),\n\t\t\t$wrapper = $( '<div>').addClass( 'edit-widemode-hide' ).text( 'Standard summaries: ' );\n\t\t$summaryOptionsList = $( '<select />' ).attr( 'id', 'stdEditSummaries' ).change( function() {\n\t\t\tvar editSummary = $( this ).val();\n\t\t\tif ( editSummary !== '' ) {\n\t\t\t\t$( '#wpSummary' ).val( editSummary );\n\t\t\t}\n\t\t} );\n\t\tfor ( var i = 0; i < lines.length; i++ ) {\n\t\t\tvar editSummaryText = ( lines[i].indexOf( '-- ' ) === 0 ) ? lines[i].substring(3) : '';\n\t\t\t$summaryOptionsList.append( $( '<option>' ).val( editSummaryText ).text( lines[i] ) );\n\t\t}\n\t\t$summaryLabel.prepend( $wrapper.append( $summaryOptionsList ) );\n\t} );\n}", "function fillEditSummaries() {\n\tvar label = document.getElementById( 'wpSummaryLabel' );\n\n\tif( label == null ) {\n\t\treturn;\n\t}\n\n\tvar comboString = 'Yleiset yhteenvedot: <select id=\"stdSummaries\" onchange=\"onStdSummaryChange()\">';\n\tcomboString += '</select><br />';\n\tlabel.innerHTML = comboString + label.innerHTML;\n\n\trequestComboFill( 'stdSummaries', 'Malline:Yhteenvedot' );\n}", "function displaySummaries() {\n self.editorData.input( null );\n }", "function autoEdEditSummary() {\n var txt = document.forms.editform.wpSummary;\n if( typeof( autoEdTag ) == 'undefined' ) {\n var tag = \"Poprawki same się robią...\";\n } else {\n var tag = autoEdTag;\n }\n // Is the tag blank?\n if( tag.match(/[^\\s]/) ) {\n // Has it already been tagged?\n if( txt.value.indexOf(tag) == -1 ) {\n // Append a pipe if necessary\n if( txt.value.match(/[^\\*\\/\\s][^\\/\\s]?\\s*$/) ) {\n txt.value += \" | \";\n }\n // Append our tag\n txt.value += tag;\n }\n }\n // Check 'This is a minor edit'\n if( typeof( autoEdMinor ) == 'undefined' || autoEdMinor ) {\n document.forms.editform.wpMinoredit.checked = true;\n }\n // Click 'Show changes'\n if( typeof( autoEdClick ) == 'undefined' || autoEdClick ) {\n document.forms.editform.wpDiff.click();\n }\n}", "function updateSummaryContent(mostCritViolated, mostNonCritViolated, totalCritViolations, totalNonCritViolations, totalItems) {\n $(\"#mostcritical\").html(mostCritViolated.name + \" (\" + mostCritViolated.inspections[0][\"critical-violations\"] + \")\");\n $(\"#mostnoncritical\").html(mostNonCritViolated.name + \" (\" + mostNonCritViolated.inspections[0][\"non-critical-violations\"] + \")\");\n $(\"#avgcritviolations\").html((totalCritViolations / totalItems).toFixed(2));\n $(\"#avgnoncritviolations\").html((totalNonCritViolations / totalItems).toFixed(2));\n\n}", "function updateSummary(summaries) {\n summaries.forEach(function(curSummary) {\n// console.log(curSummary);\n $('#services-container').append('\\\n <div class=\"col-md-4\">\\\n <span class=\"fa-stack fa-4x\">\\\n <i class=\"fa fa-circle fa-stack-2x text-primary\"></i>\\\n <i class=\"fa ' + curSummary.code + ' fa-stack-1x fa-inverse\"></i>\\\n </span>\\\n <h4 class=\"service-heading\">' + curSummary.name + '</h4>\\\n <p class=\"text-muted\">' + curSummary.description + '</p>\\\n </div>\\\n ');\n });\n}", "function dynamicSummary(){\n fieldArray = [];\t//\tclear array so everytime this is called we update the data\n window.guideBridge.visit(function(cmp){\n var name = cmp.name;\n if(name && isVisible(cmp)){\n var grouped = isGrouped(cmp);\n var hideLabel = isHideLabel(cmp);\n var hideLink = isHideLink(cmp);\n\n if(name.indexOf(\"block_heading_\") == 0){//\tcheck if block heading (like for the address block fields)\n fieldArray.push({\"type\":\"block_heading\",\"size\":size(cmp),\"name\":cmp.name,\"value\":$(cmp.value).html(),\"grouped\":grouped, \"hideLink\":hideLink, \"className\":cmp.className, \"cssClassName\":cmp.cssClassName,\"id\":cmp.id,\"som\":cmp.somExpression});\n }\n else if(name.indexOf(\"block_\") == 0) {//\tcheck if object is a group panel\n fieldArray.push({\"type\":\"block\",\"size\":size(cmp),\"name\":cmp.name,\"title\":cmp.title, \"grouped\":grouped, \"className\":cmp.className, \"id\":cmp.id,\"som\":cmp.somExpression});\n }\n else if(name.indexOf(\"heading_\") == 0){//\tcheck if heading\n fieldArray.push({\"type\":\"heading\",\"size\":size(cmp),\"name\":cmp.name,\"value\":$(cmp.value).html(),\"grouped\":grouped, \"hideLink\":hideLink, \"className\":cmp.className, \"cssClassName\":cmp.cssClassName,\"id\":cmp.id,\"som\":cmp.somExpression});\n }\n else{\n //if(cmp.value != null){\n if(cmp.className == \"guideTextBox\"){\n fieldArray.push({\"type\":\"field\",\"name\":cmp.name,\"title\":cmp.title,\"grouped\":grouped,\"hideLabel\":hideLabel, \"hideLink\":hideLink, \"value\":((cmp.value)?cmp.value:\"Not provided\"),\"className\":cmp.className,\"id\":cmp.id,\"som\":cmp.somExpression});\n }\n if(cmp.className == \"guideRadioButton\" ||\n cmp.className == \"guideCheckBox\" ){\n fieldArray.push({\"type\":\"option\",\"name\":cmp.name,\"title\":cmp.title,\"grouped\":grouped,\"hideLabel\":hideLabel,\"hideLink\":hideLink, \"value\":((cmp.value)?cmp.value:\"Not provided\"), \"obj\":cmp,\"className\":cmp.className,\"id\":cmp.id,\"som\":cmp.somExpression});\n }\n //}\n }\n }\n });\n\n renderHTML();\t//\tthis generates the html inside the summary component\n}", "function refresh() {\n refreshSummary();\n}", "function onEdit() {\n setValues();\n}", "showAllEditingRegion() {\n if (this.editRangeCollection.length === 0) {\n this.updateEditRangeCollection();\n }\n this.viewer.clearSelectionHighlight();\n for (let j = 0; j < this.editRangeCollection.length; j++) {\n let editRangeStart = this.editRangeCollection[j];\n let positionInfo = this.getPosition(editRangeStart);\n let startPosition = positionInfo.startPosition;\n let endPosition = positionInfo.endPosition;\n this.highlightEditRegions(editRangeStart, startPosition, endPosition);\n }\n }", "updateSelectedRowsValues() {\n\t\tconst summaryPropertyId = {\n\t\t\tname: this.selectSummaryPropertyName\n\t\t};\n\t\tconst tableControl = this.props.controller.getControl({ name: this.props.control.name });\n\t\tconst newSelectedSummaryRow = this.props.controller.getPropertyValue(summaryPropertyId);\n\t\tif (newSelectedSummaryRow && Array.isArray(newSelectedSummaryRow)) {\n\t\t\tnewSelectedSummaryRow[0].forEach((cellValue, colIndex) => {\n\t\t\t\tif (cellValue !== null && !isEqual(cellValue, this.selectedSummaryRowValue[0][colIndex])) {\n\t\t\t\t\t// if a column does not have a value, the default value is null and the value returned\n\t\t\t\t\t// from getPropertyValue is undefined causing unneccessary updates and an infinite loop during intialization\n\t\t\t\t\tconst testCell = (typeof cellValue === \"undefined\") ? null : cellValue;\n\t\t\t\t\tthis.props.selectedRows.forEach((rowIndex) => {\n\t\t\t\t\t\tthis.props.controller.updatePropertyValue({ name: this.props.control.name, row: rowIndex, col: colIndex }, testCell, true);\n\t\t\t\t\t});\n\t\t\t\t\tif (tableControl.subControls[colIndex].controlType === ControlType.ONEOFSELECT) {\n\t\t\t\t\t\tthis.props.controller.updatePropertyValue({ name: this.selectSummaryPropertyName, row: 0, col: colIndex }, null);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.selectedSummaryRowValue = cloneDeep(newSelectedSummaryRow);\n\t\t}\n\t}", "function editsummOnCannedSummarySelected() {\n var newSummary = editsummOriginalSummary;\n if(newSummary.length!=0) newSummary += \" - \";\n \n var idx = editsummDropdown.selectedIndex;\n var canned = editsummDropdown.options[idx].value;\n newSummary += canned;\n document.forms.editform.wpSummary.value = newSummary;\n }", "function editsummOnCannedSummarySelected() {\n var newSummary = editsummOriginalSummary;\n if(newSummary.length!=0) newSummary += \" - \";\n \n var idx = editsummDropdown.selectedIndex;\n var canned = editsummDropdown.options[idx].value;\n newSummary += canned;\n document.forms.editform.wpSummary.value = newSummary;\n}", "function displayEditData(){\n \t$('#editItemName').val(dataitemname[currentCount]);\n \t$('#editDepartment').val(datadepartment[currentCount]);\n \t\t$('#editDescription').val(datadescription[currentCount]);\n \t$('#editDesireDate').val(datadesiredate[currentCount]);\n \t$('#editTag').val(datasearchtags[currentCount]);\n \t//$('#editItems').listview('refresh');\n }", "function update_all() {\n var org = document.getElementById('org_field').value;\n\n if (org) {\n var datarange = $('#reportrange span')[0];\n var since = new Date();\n var until = new Date();\n\n if(datarange.textContent[0] != 'P') {\n since = new Date(datarange.textContent.split(' - ')[0]);\n until = new Date(datarange.textContent.split(' - ')[1]);\n }\n else {\n since.setDate(until.getDate() - 30);\n }\n\n // Get all the data of the organization from GitHub\n myApp.showPleaseWait();\n\n get_all_data(org, since, until).done(function (org_info, org_members, org_repos_with_contributors) {\n myApp.hidePleaseWait();\n\n if (!org_info) {\n alert(\"Error when fetching organization data for: \" + org);\n } else {\n $(\"#welcome\").slideUp();\n\n only_nonforked_repos = true;\n only_org_members = false;\n\n aggregated_data = aggregate_repo_data(org_repos_with_contributors, since, until,\n only_nonforked_repos, only_org_members,\n org_members);\n\n $(\"#graphs_container\").removeClass(\"hidden\");\n update_org_table(org, org_info, org_members);\n update_global_commits_per_repo(aggregated_data.total_contributions_by_repo, since, until);\n update_global_commits_per_user(aggregated_data.total_contributions_by_author, since, until);\n update_global_contributions_per_users(aggregated_data.total_contributions_by_author, since, until);\n update_weekly_commits_per_user(aggregated_data.weekly_contributions_by_author, since, until);\n }\n });\n } else {\n $(\"#org_field_div\").addClass(\"has-error\");\n $('#org_field').popover('show');\n }\n}", "function onEditSummary() {\n\tconst dateForm = document.getElementById('date-form');\n\tconst serviceForm = document.getElementById('service-form');\n\tconst summaryForm = document.getElementById('summary-form');\n\n\tconst dateStep = document.getElementById('date-step');\n\tconst serviceStep = document.getElementById('service-step');\n\tconst requestStep = document.getElementById('request-step');\n\tconst summaryStep = document.getElementById('summary-step');\n\n\tsummaryForm.style.display = \"none\";\n\tdateForm.style.display = \"block\";\n\n\tdateStep.classList.remove(\"completed\");\n\tdateStep.classList.add(\"active\");\n\tserviceStep.classList.remove(\"completed\");\n\trequestStep.classList.remove(\"completed\");\n\tsummaryStep.classList.remove(\"active\");\n}", "function fillAuditElements( data ) {\n\n for( const item of data ) {\n\n // pick specific parts of item\n let step = item['step']\n let task = item['task']\n\n // determines and selects the target cell\n // determination step heavily relies on the id formula i.e., c_cea = creation[0] and lower case of task (CEA)\n let target_el_id = \"#\" +step[0] + \"_\" + task.toLowerCase()\n const target_td = document.querySelector(target_el_id);\n\n methods = \"\"\n for (const method of item['methods']){\n // concatenates methods given name, #solved_cnt and a newline\n methods = methods + method[0] + \", \" + method[1] + \"</br>\"\n }\n\n // Updates the HTML of the target cell\n target_td.innerHTML = methods\n\n }\n }", "function epSummary() {\n epSumm = '';\n endSeleArray = [];\n \n var cm = \", \";\n var br = \";\";\t// Samantha, I replaced the comma with a semi-colon as some names have a comma in them\n\n $('#atSelections').empty();\n\n $.each($(\"input[name='ep-att-sel-1']:checked\"), function() {\n epSumm = epSumm + endPlacesArray[0][0] + cm;\n endSeleArray.push([endPlacesArray[0][0] + br + endPlacesArray[0][1]]);\n //console.log(\"end selc array \", endSeleArray);\n });\n\n $.each($(\"input[name='ep-att-sel-2']:checked\"), function() {\n epSumm = epSumm + endPlacesArray[1][0] + cm;\n endSeleArray.push([endPlacesArray[1][0] + br + endPlacesArray[1][1]]);\n });\n\n $.each($(\"input[name='ep-att-sel-3']:checked\"), function() {\n epSumm = epSumm + endPlacesArray[2][0] + cm;\n endSeleArray.push([endPlacesArray[2][0] + br + endPlacesArray[2][1]]);\n });\n\n $.each($(\"input[name='ep-att-sel-4']:checked\"), function() {\n epSumm = epSumm + endPlacesArray[3][0] + cm;\n endSeleArray.push([endPlacesArray[3][0] + br + endPlacesArray[3][1]]);\n });\n\n epSumm = epSumm.slice(0, -2);\n\n $('#atSelections').html(epSumm);\n\n updateDB();\n }", "function updateSummary() {\n var cart = app.getModel('Cart').get();\n Transaction.wrap(function () {\n cart.calculate();\n });\n app.getView({\n checkoutstep: 4,\n Basket: cart.object\n }).render('checkout/minisummary');\n}", "function getFiltersEdit() {\n var setFilters = new Array();\n $('[kind=\"filter\"]').each(function () {\n var insertToFilter = new Array();\n var cmpVal = $(this).attr(\"persist\");\n insertToFilter.push(cmpVal);\n var operador = $(this).attr(\"operador\") === undefined ? null : $(this).attr(\"operador\");\n if (operador === null) {\n insertToFilter.push(\"\");\n } else {\n insertToFilter.push(operador);\n }\n var valorCmp = null;\n if (this.tagName === \"INPUT\") {\n if ($(this).val() !== \"\") {\n if (this.getAttribute('type') === \"text\") {\n valorCmp = $(this).val();\n } else if (this.getAttribute('type') === \"date\") {\n var dato = formatDateddmmyyy(new Date(formantDdMmYyyy($(this).val())));\n valorCmp = dato;\n }\n }\n } else if (this.tagName === \"SELECT\") {\n if ($(this).val() !== \"\") {\n valorCmp = $(this).val();\n }\n } else if (this.tagName === \"DIV\" && this.className === \"edit\") {\n var input = this.firstElementChild;\n if (input.value !== \"\") {\n valorCmp = input.value;\n }\n }\n\n if (valorCmp !== null) {\n if (operador === null) {\n insertToFilter.push(\"%\" + valorCmp + \"%\");\n } else {\n insertToFilter.push(valorCmp);\n }\n setFilters.push(insertToFilter);\n }\n\n //var cmpVal = $(this).attr(\"persist\");\n //if (cmpVal.includes(\"_ID\")) {\n // cmpVal = cmpVal.substring(0, cmpVal.indexOf('_'));\n // cmpVal += \".id\";\n //}\n //setFilters.push(new Array(cmpVal, $(this).val()));\n });\n return setFilters;\n}", "_beginEdit(details) {\r\n const that = this,\r\n dataField = details.dataField;\r\n let rowId = details.rowId,\r\n rowElement = details.rowElement,\r\n rowObject = details.rowObject,\r\n cell = details.cell,\r\n cells = [],\r\n dataFields = [];\r\n\r\n if (!that.editing) {\r\n return;\r\n }\r\n\r\n if (!rowElement) {\r\n rowElement = that.$.tableContainer.querySelector(`tr[row-id=\"${rowId}\"]`);\r\n }\r\n\r\n if (!rowObject) {\r\n rowId = rowElement.getAttribute('row-id');\r\n rowObject = that.rowById[rowId];\r\n rowId = rowObject.data.$.id;\r\n }\r\n\r\n if (that.editMode === 'row') {\r\n cells = rowElement.querySelectorAll('td[data-field]');\r\n dataFields = that._columns.map(col => col.dataField);\r\n\r\n if (!cell) {\r\n cell = dataField ? rowElement.querySelector(`td[data-field=\"${dataField}\"`) : cells[0];\r\n }\r\n }\r\n else {\r\n if (!cell) {\r\n cell = rowElement.querySelector(`td[data-field=\"${dataField}\"`);\r\n }\r\n\r\n cells = [cell];\r\n dataFields = [dataField];\r\n }\r\n\r\n that._editing = { row: rowObject, cells: [] };\r\n\r\n for (let i = 0; i < dataFields.length; i++) {\r\n const currentCell = cells[i],\r\n currentDataField = dataFields[i],\r\n column = that.columnByDataField[currentDataField];\r\n\r\n if (column.allowEdit === false) {\r\n continue;\r\n }\r\n\r\n const cellValue = rowObject.data[currentDataField],\r\n editor = that._initEditor(column, rowId, currentDataField, cellValue);\r\n let standardDateEditor = editor instanceof HTMLInputElement && editor.type === 'date';\r\n\r\n if (column.editor && column.editor.template) {\r\n if (column.editor.onRender) {\r\n column.editor.onRender(rowId, currentDataField, editor, cellValue);\r\n }\r\n }\r\n else if (standardDateEditor) {\r\n if (cellValue instanceof Date && !isNaN(cellValue.getTime())) {\r\n const month = (cellValue.getMonth() + 1).toString(),\r\n date = cellValue.getDate().toString();\r\n\r\n editor.value = `${cellValue.getFullYear()}-${'0'.repeat(2 - month.length)}${month}-${'0'.repeat(2 - date.length)}${date}`;\r\n }\r\n else {\r\n editor.value = '';\r\n }\r\n }\r\n else {\r\n editor.value = cellValue;\r\n }\r\n\r\n currentCell.classList.add('editing');\r\n currentCell.innerHTML = '';\r\n currentCell.appendChild(editor);\r\n\r\n if (currentCell === cell && editor.focus) {\r\n editor.focus();\r\n\r\n if (!(column.editor && column.editor.template) && !standardDateEditor && editor.select) {\r\n editor.select();\r\n }\r\n }\r\n\r\n that._editing.cells.push({ dataField: currentDataField, editor: editor, element: currentCell });\r\n that.$.fireEvent('cellBeginEdit', { row: rowObject.data, dataField: currentDataField });\r\n }\r\n }", "function initDynamicSummary(){\n console.log(\"summary init\");\n}", "function createMeasuresSummaryTable(view, index){\n\n // get fields\n var fields = view.tableGroups[index].fields;\n \n // get HTML table\n var summaryTable = $('measuresSummary');\n tBody = summaryTable.tBodies[0];\n \n // if fields were defined\n if (fields != undefined) {\n \n // for each field in selected tablegroup of view object\n for (var i = 0; i < fields.length; i++) {\n \t\t//if(fields[i].is_virtual == 'false'){\n \t\t\t\n \t\t\t// get the number of rows in the HTML table. this number changes as fields are added\n \t\t\tvar numOfRows = tBody.rows.length;\n \t\t\tvar data_type = fields[i].data_type;\n \t\t\t\n \t\t\t// create row and add id (although this id can become obsolete as we can remove rows\n \t\t\tvar new_tr = document.createElement('tr');\n \t\t\tnew_tr.id = \"row\" + i;\n \t\t\tnew_tr.ml_heading_english = fields[i].ml_heading_english;\n \t\t\t \t\t\t\n \t\t\t// add cell with ml heading\n \t\t\tvar new_td = document.createElement('td');\n \t\t\tnew_td.name = \"scShow\";\n \t\t\tnew_td.innerHTML = fields[i].ml_heading;\n \t\t\tnew_tr.appendChild(new_td);\n \t\t\t\n \t\t\t// add cell with field name\n \t\t\tvar new_td = document.createElement('td');\n \t\t\tnew_td.name = \"scShow\";\n \t\t\tnew_td.innerHTML = fields[i].field_name;\n \t\t\tnew_tr.appendChild(new_td);\n \t\t\t\n \t\t\t// add cell with checkbox for count\n \t\t\tvar new_td = document.createElement('td');\n \t\t\tnew_td.name = \"scShow\";\n\n \t\t\tif((fields[i].is_virtual == 'false') || (fields[i].is_virtual == false)){\n \t\t\t\tnew_td.innerHTML = '<input type=\"checkbox\" name=\"' + fields[i].field_name + '\" value=\"Count\" onClick=\"saveOps(this)\"/>';\n \t\t\t}\n \t\t\tnew_tr.appendChild(new_td);\n \t\t\t\n \t\t\t// add cell for sum, but only create checkbox if \"Numeric\" data_type\n \t\t\tvar new_td = document.createElement('td');\n \t\t\tnew_td.name = \"scShow\";\n \t\t\tif (data_type.match(/Numeric|Integer|SmallInt/gi) && ((fields[i].is_virtual == 'false') || (fields[i].is_virtual == false))) {\n \t\t\t\tnew_td.innerHTML = '<input type=\"checkbox\" name=\"' + fields[i].field_name + '\" value=\"Sum\" onClick=\"saveOps(this)\"/>';\n \t\t\t}\n \t\t\tnew_tr.appendChild(new_td);\n \t\t\t\n \t\t\t// add cell for avg, but only create checkbox if \"Numeric\" data_type \n \t\t\tvar new_td = document.createElement('td');\n \t\t\tnew_td.name = \"aoHide\";\n \t\t\tif (data_type.match(/Numeric|Integer|SmallInt/gi) && ((fields[i].is_virtual == 'false') || (fields[i].is_virtual == false))) {\n \t\t\t\tnew_td.innerHTML = '<input type=\"checkbox\" name=\"' + fields[i].field_name + '\" value=\"Avg\" onClick=\"saveOps(this)\"/>';\n \t\t\t}\n \t\t\tnew_tr.appendChild(new_td);\n \t\t\t\n \t\t\t// add cell with checkbox for count-percentage\n \t\t\tvar new_td = document.createElement('td');\n \t\t\tnew_td.name = \"aoHide\";\n \t\t\tif((fields[i].is_virtual == 'false') || (fields[i].is_virtual == false)){\n \t\t\t\tnew_td.innerHTML = '<input type=\"checkbox\" name=\"' + fields[i].field_name + '\" value=\"count_percent\" onClick=\"saveOps(this)\"/>';\n \t\t\t}\n \t\t\tnew_tr.appendChild(new_td);\n \t\t\t\n \t\t\t// add cell for sum-percentage, but only create checkbox if \"Numeric\" data_type \n \t\t\tvar new_td = document.createElement('td');\n \t\t\tnew_td.name = \"aoHide\";\n \t\t\tif (data_type.match(/Numeric|Integer|SmallInt/gi) && ((fields[i].is_virtual == 'false') || (fields[i].is_virtual == false))) {\n \t\t\t\tnew_td.innerHTML = '<input type=\"checkbox\" name=\"' + fields[i].field_name + '\" value=\"sum_percent\" onClick=\"saveOps(this)\"/>';\n \t\t\t}\n \t\t\tnew_tr.appendChild(new_td);\n \t\t\t\n \t\t\t// add cell for avg-percentage, but only create checkbox if \"Numeric\" data_type \n \t\t\tvar new_td = document.createElement('td');\n \t\t\tnew_td.name = \"aoHide\";\n \t\t\t// if (data_type.match(/Numeric|Integer/gi)) {\n \t\t\t// new_td.innerHTML = '<input type=\"checkbox\" name=\"' + fields[i].field_name + '\" value=\"avg_percent\" onClick=\"saveOps(this)\"/>';\n \t\t\t// }\n \t\t\tnew_tr.appendChild(new_td);\n \t\t\t\n \t\t\t// add row to table body\n \t\t\ttBody.appendChild(new_tr);\n \t\t//}\n }\n \n // add table body to table\n summaryTable.appendChild(tBody);\n }\n}", "function doSummary() {\n if (userType == \"EXT\") {\n $(\"#merchAccts\").val($(\"#merchAccts\").val());\n }\n else {\n validateSummary4INT();\n $(\"#merchAccts\").val();\n }\n\n // cacheSearchValues();\n\n $.blockUI({\n message: PROCESSING,\n overlayCSS: {backgroundColor: '#E5F3FF'}\n });\n\n $(\"#reportForm\").attr(\"action\", \"summaryReport.htm\");\n $(\"#reportForm\").submit();\n}", "function clearEdits(){\n\n}", "function customFill(data) {\n\n if (!editorProperties) {\n editorProperties = [];\n }\n\n for (var i = 0; i < editorProperties.length; i++) {\n eval('var ' + editorProperties[i] + 'Editor = UE.getEditor(\"' + editorProperties[i] + '\",editorParam);');\n }\n\n for (var prop in data) {\n var evalString = 'if (';\n for (var i = 0; i < editorProperties.length; i++) {\n evalString += 'prop == \"' + editorProperties[i] + '\" ';\n if (i < editorProperties.length - 1) {\n evalString += ' || ';\n }\n }\n evalString += ')';\n evalString += '{';\n evalString += prop + 'Editor.ready(function () {'\n + prop + 'Editor.setContent(\"' + data[prop] + '\");'\n + '});'\n evalString += '}';\n eval(evalString);\n\n// if (prop == 'briefDescription' || prop == 'introduction' || prop == 'trafficGuide'\n// || prop == 'buyTicketNotes' || prop == 'characteristicShopping' || prop == 'specialtyFood') {\n// eval(prop + 'Editor.ready(function () {'\n// + prop + 'Editor.setContent(\"' + data[prop] + '\");'\n// + '});');\n// }\n\n }\n}", "function updateEditingSchedule() {\n\t\t$.get(\"schedule/jimmy/\", function(data) {\n\t\t\tvar lines = data.split(\"\\n\");\n\t\t\tfor (line in lines) {\n\t\t\t\tvar fields = lines[line].split(\" \");\n\t\t\t\tif (fields.length == 4) { //validate it's a real line\n\t\t\t\t\tpaintRange(parseInt(fields[0]), parseInt(fields[1]), parseInt(fields[2]), parseInt(fields[3]));\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "function proc_result_set(update_hash, doc) {\n for (var i in update_hash) {\n var elem = doc.$(i);\n\n if (elem != null)\n if (elem.tagName != \"INPUT\" && elem.tagName != \"SELECT\") {\n elem.innerHTML = update_hash[i];\n } else\n elem.value = update_hash[i];\n\n }\n\n}", "function updateAll(){refreshSliderDimensions();ngModelRender();}", "function prepareFields(){\r\n var elems = getInputElementsToSumUp();\r\n for(var i=0; i<elems.length; i++){\r\n elems[i].onchange = function(){ return updateSumField(); }\r\n }\r\n updateSumField(); // initialize the text showing the sum\r\n}", "function updateResultGrid(data){\n \t\t\t\t/*showCheckBox(data);\n \t\t\t\t\n \t\t\t\tdojo.forEach(data, function(item){\n \t\t\t\t\titem.dollarAmountDisplay = \"<span style='float:left'>$</span>\" + \"<span style='float:right'>\" + formatCurrency(item.dollarAmount) + \"</span>\";\n \t\t\t\t\tconvertNullFieldsToEmptyStrings(item);\n \t\t\t\t});\n \t\t\t\texpenseSummaryGridStore = new dojo.data.ItemFileReadStore(\n \t\t\t\t\t\t{data: {identifier: 'expdIdentifier',\n \t\t\t\t\t\titems: data}\n \t\t\t\t\t}\n \t\t\t\t);*/\n \t\t/*dijit.byId('resultCodingBlockGrid').setStore(expenseSummaryGridStore);\n \t\tvar firstRow = dijit.byId(\"resultCodingBlockGrid\").rows.grid.store._arrayOfAllItems[0];\n \t\tvar selCbRow = dijit.byId(\"resultCodingBlockGrid\").selection.getSelected()[0];\n \t\t// To highlight the first row on the grid\n \t\t// Verify the firstRow should not be undefined. kp \n \t\tif (selCbRow == undefined && firstRow != undefined ){\n \t\t\t// if the tab was not accessed before\n \t\tdijit.byId(\"resultCodingBlockGrid\").rows.setOverRow( 0 );\n \t\tdijit.byId(\"resultCodingBlockGrid\").selection.setSelected(0, true);*/\n \t\t\n \t\t//var row = dijit.byId(\"resultCodingBlockGrid\").selection.getSelected()[0];\n \t\tcellValue = firstRow.expdIdentifier;\n \t\t\n \t\t// Get the expense details identifier and call Ajax to get the coding blocks associated with the expense detail item\n \t\tdojo.xhrPost({\n \t\t\t\t\turl:\"AjaxGetExpenseDetails.action?expDtlsId=\" + '1234',\n \t\t\t\t\thandleAs: \"json\",\n \t\t\t\t\tsync: true,\n \t\t\t\t\tload: function(data,args){\n \t\t\t\t\t\tif(typeof data == \"error\"){\n \t\t\t\t\t\t//if errors, do not pursue the effect of call!\n \t\t\t\t\t\t\tconsole.warn(\"error!\",args);\n \t\t\t\t\t\t}else{\n \t\t\t\t\t\t\tdisplayCodingBlocks(data);\n \t\t\t\t\t\t\t//disable forms fields if applicable\n \t\t\t \t\t\tsetupDisplayCb();\n \t\t\t\t\t\t}\n \t\t\t\t}\n \t\t\t});\n \t\t\t//dijit.byId('resultCodingBlockGrid').selection.multiSelect = false;\n \t\t\t//dojo.connect(dijit.byId('resultCodingBlockGrid'),'onCellClick', \"getExpenseDetailsCodingBlock\");\n \t\t//}\n \t\t\t//dijit.byId(\"resultCodingBlockGrid\").resize();\n \t}", "function onLoadSortSummary(){\n var view = tabsFrame.newView;\n var numberOfTblgrps = Number(tabsFrame.tablegroupsRestriction);\n var viewType = tabsFrame.typeRestriction;\n var index = view.tableGroups.length - tabsFrame.selectedTableGroup - 1;\n \n // if this is a summary view, hide sort references and display grouping references\n if (viewType == 'summaryReports') {\n $('sort').style.display = \"none\";\n $('group1').style.display = \"\";\n $('group2').style.display = \"\";\n $('group3').style.display = \"\";\n $('sortOrder_title').innerHTML = getMessage('setGrouping');\n }\n else {\n \n // otherwise, show sort references\n $('sort').style.display = \"\";\n $('group1').style.display = \"none\";\n $('group2').style.display = \"none\";\n $('group3').style.display = \"none\";\n $('sortOrder_title').innerHTML = getMessage('selectSortOrder');\n }\n \n // create the sort summary table, filling in the field properties and creating the sort buttons\n createSortSummaryTable();\n \n // create an array for displaying/tracking the order of the sorts and stores this array in the summary table\n createSortSelectionArray();\n \n // get the array of sort objects\n var sortFldsArray = view.tableGroups[index].sortFields;\n \n // if sorts have been defined,\n if (sortFldsArray != undefined) {\n var summaryTable = $('sortOrderSummary');\n tBody = summaryTable.tBodies[0];\n var numOfRows = tBody.rows.length;\n \n // for each sort specified\n for (k = 0; k < sortFldsArray.length; k++) {\n \n // loop through the summary table\n for (var j = 1; j < numOfRows; j++) {\n var fieldNameCell = summaryTable.rows[j].cells[0];\n var tableNameCell = summaryTable.rows[j].cells[5];\n var setButtonCell = summaryTable.rows[j].cells[8];\n \n // if there is a match, display the order and hide the \"Sort\" button\n if ((sortFldsArray[k].field_name == fieldNameCell.innerHTML) && (sortFldsArray[k].table_name == tableNameCell.innerHTML)) {\n var rowID = setButtonCell.parentNode.id;\n setSort(\"\", rowID);\n }\n }\n }\n \n }\n\t\n\t/*\n\tif ( pattern.match(/highlight-restriction/gi) && (sortFldsArray == undefined) && ((index == 0) || (index == 2)) ){\n\t\tsetPKeysAsSortDefaults();\n\t}\n\t*/\t\n}", "function initializeEditableControls() {\n $('.editable-control').each(function () {\n var id = $(this).attr('id');\n var title = $(this).attr('data-title');\n var name = $(this).attr('data-name');\n var pk = $(this).attr('data-pk');\n var type = $(this).attr('data-type');\n //var classs = $(this).attr('class');\n if (type === 'text' || type === 'number') {\n $('#' + id).editable({\n url: '/post',\n type: 'number',\n pk: pk,\n name: name,\n title: title,\n display: function (value) {\n if (!value) {\n if ($('#valb4edit').val() === \"NA\") {\n $(this).html('0.00');\n } else {\n $(this).html($('#valb4edit').val());\n }\n return;\n } else {\n var grep = value.replace(/,/g, \"\");\n if (isNaN(grep)) {\n alert(\"The entered figure (\" + value + \") is not a valid value\");\n value = null;\n //document.getElementById(\"submit-final\").disabled = true;\n return;\n } else {\n //document.getElementById(\"submit-final\").disabled = false;\n }\n }\n var html = value.toString().replace(/,/g, \"\").replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n if (html.indexOf('.') === -1) {\n html += '.00';\n }\n $(this).html(html);\n\n var id_s = $(this).attr('id');\n var id_arr = id_s.split(\"_\");\n if (id_arr[id_arr.length - 1] === \"0\") {\n calculateheader(id_s);\n } else {\n calculateBody(id_s);\n }\n }\n });\n }\n });\n}", "function autoFormatEditorContent(ed) {\n var cursorStart = ed.getCursor(\"start\"),\n cursorEnd = ed.getCursor(\"end\"),\n lastLine = ed.lineCount(),\n viewPort = ed.getViewport();\n ed.autoFormatRange({ ch:0, line: 0 }, { ch:0, line: lastLine });\n ed.setSelection(cursorStart, cursorEnd);\n ed.scrollIntoView({ ch:0, line: viewPort.from });\n }", "function addMetadataEdits() {\n $('#meta_textarea').addClass('meta_ajaxwait').removeAttr('id');\n $.ajax({\n url: arcs.baseURL + \"metadataedits/add\",\n type: \"post\",\n data: {\n resource_kid: resource_kid,\n resource_name: resource_name,\n scheme_id: meta_scheme_name,\n control_type: meta_control_type,\n field_name: meta_field_name,\n user_id: \"user_not_set\", //this is set in the controller\n value_before: meta_value_before,\n new_value: meta_new_value,\n approved: 0,\n rejected: 0,\n reason_rejected: \"\",\n metadata_kid: meta_resource_kid\n },\n success: function (data) {\n var fill = '<td>' +\n '<div class=\"icon-meta-lock\">&nbsp;</div>' +\n '<div>Pending Approval</div>' +\n '</td>';\n $(\".meta_ajaxwait\").parent().parent().replaceWith(fill);\n metadataIsSelected = 0;\n editBtnClick = 0;\n }\n })\n }", "init(ids) {\n initEditors(ids)\n }", "function ValidationSummary(data) {\n var errorSummaryEle = $('div.alert_error_container');\n\n $(\"#loadingContainer\").hide();\n $(errorSummaryEle).empty();\n\n var hideModelError = (errorSummaryEle.attr('data-hideModelError') === 'true');\n var hasAnyErrors = false;\n\n var html = '<div class=\"validation-summary-errors\" data-valmsg-summary=\"true\">';\n html += '<ul>';\n $(data).each(function (index, item) {\n $(item).each(function (i, error) {\n if (!hideModelError || hideModelError && error.Name === '') {\n hasAnyErrors = true;\n var errors = error.Errors.join('<br/><span style=\"margin-left: 40px\"></span>');\n html += '<li>' + errors + '</li>';\n }\n });\n });\n html += '</ul>';\n html += '</div>';\n if (hasAnyErrors) {\n $(errorSummaryEle).html(html);\n var alertErrContainer = $(\".alert_error_container:first\");\n if ($(alertErrContainer).length > 0) {\n $('html, body').animate({\n scrollTop: $(alertErrContainer).offset().top\n }, 1000);\n }\n }\n}", "clearSummary() {\n var $this = this,\n mdl = $this._container;\n mdl.querySelectorAll('.venti-summary')[0].innerHTML = \"\";\n }", "function fillArrayAndTakeCount() {\n var userId = _spPageContextInfo.userId;\n var context = new SP.ClientContext.get_current();\n var oList = context.get_web().get_lists().getByTitle('ExpenseSheet');\n var camlQuery = new SP.CamlQuery();\n camlQuery.set_viewXml('<View>' +\n '<Query>' +\n '<Where>' +\n '<And>' +\n '<And>' +\n '<Eq>' +\n '<FieldRef Name=\\'Month\\'/>' +\n '<Value Type=\\'Text\\'>' + month + '</Value>' +\n '</Eq>' +\n '<Eq>' +\n '<FieldRef Name=\\'Year\\'/>' +\n '<Value Type=\\'Text\\'>' + year + '</Value>' +\n '</Eq>' +\n '</And>' +\n '<Eq>' +\n '<FieldRef Name=\\'AssignedTo\\' LookupId=\\'TRUE\\'/>' +\n '<Value Type=\\'User\\'>' + userId + '</Value>' +\n '</Eq>' +\n '</And>' +\n '</Where>' +\n '<OrderBy>' +\n '<FieldRef Name=\\'Title\\' Ascending=\\'TRUE\\' />' +\n '</OrderBy>' +\n '</Query>' +\n '<ViewFields>' +\n '<FieldRef Name=\\'Id\\' />' +\n '<FieldRef Name=\\'Date1\\' />' +\n '<FieldRef Name=\\'Recipient\\' />' +\n '<FieldRef Name=\\'Month\\' />' +\n '<FieldRef Name=\\'Year\\' />' +\n '<FieldRef Name=\\'Description1\\' />' +\n '<FieldRef Name=\\'Province\\' />' +\n '<FieldRef Name=\\'ExpensesType\\' />' +\n '<FieldRef Name=\\'Amount\\' />' +\n '<FieldRef Name=\\'Tip\\' />' +\n '<FieldRef Name=\\'TPS\\' />' +\n '<FieldRef Name=\\'TVQ\\' />' +\n '<FieldRef Name=\\'Total\\' />' +\n '<FieldRef Name=\\'ExchangeRate\\' />' +\n '<FieldRef Name=\\'TotalAfterRate\\' />' +\n '<FieldRef Name=\\'Project\\' />' +\n '</ViewFields>' +\n '</View>');\n window.collListItem = oList.getItems(camlQuery);\n context.load(collListItem, 'Include(Id, Project, Month, Year, Date1, Recipient, Description1, Province, ExpensesType, Amount, Tip, TPS, TVQ, Total, ExchangeRate, TotalAfterRate)');\n context.executeQueryAsync(Function.createDelegate(this, window.onQuerySucceeded),\n Function.createDelegate(this, window.onQueryFailed));\n}", "function renderNodeSummaryData() {\r\n $('.webui-popover').remove();\r\n loadNodeSummary();\r\n //addTagsData();\r\n }", "function contentUpdate(i){\n const itm = globalArr[i]\n select_id = itm.contentsId\n $('#title').val(itm.title)\n $('#description').val(itm.description)\n $('#status').val(itm.status)\n //console.log(select_id)\n editor.setText(itm.details + \"\\n\")\n}", "function updateSummary() {\n summary.innerHTML = `${summaryCountChecked} / ${summaryCountTotal} Completed`;\n}", "function updateDisplayedValues() {\n displayNameField.text(displayNameVal);\n emailField.text(emailVal);\n phoneField.text(phoneVal);\n zipcodeField.text(zipcodeVal);\n }", "function preEdit() {\r\n\tpreEditBtn.addEventListener(\"click\", () => {\r\n\t\tfor (let i = 0; i < editElements.length; i++) {\r\n\t\t\tconst tdData = document.querySelectorAll(\".selected .tdData\");\r\n\t\t\teditElements[i].value = \"\";\r\n\t\t\tif (tdData[i]) {\r\n\t\t\t\teditElements[i].value = tdData[i].innerHTML;\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}", "function updateAddTableEvents() {\n /**\n * Called when the plus sign in the Add Table is clicked.\n */\n $('.add-fact').click(function() {\n\tvar id = $(this).attr(\"data\");\n\topenFactCreationDialog(id, \"add\");\n });\n\n /**\n * Open the Fact editor with the current Fact loaded\n */\n $('.edit-fact').click(function() {\n\tvar id = $(this).attr(\"data\");\n\topenFactCreationDialog(id, \"edit\");\n });\n\n /**\n * Make Facts selectable\n */\n $('.select-fact').click(function() {\n\tvar id = $($(this).parent().siblings()[0]).text();\n\t$('#Controls_Executor_Arg1').addClass('fact-filled');\n\t$('#Controls_Executor_Arg1').text(id);\n\tcloseAddTable();\n });\n\n /* Create buttons for the AddTable */\n $('.add-fact, .edit-fact').button();\n}", "function setUI(sheetArr) {\n for (let i = 0; i < rows; i++) {\n for (let j = 0; j < columns; j++) {\n let uiCell = document.querySelector(`.grid .cell[rid=\"${i}\"][cid=\"${j}\"]`);\n let cellObj = sheetArr[i][j];\n uiCell.innerText = cellObj.value;\n uiCell.style.fontWeight = cellObj.isBold == true ? \"bold\" : \"normal\";\n uiCell.style.fontStyle = cellObj.isItalic == true ? \"Italic\" : \"normal\"; \"\";\n uiCell.style.textDecoration = cellObj.isUnderline == true ? \"underline\" : \"none\";\n uiCell.style.fontSize = cellObj.fontSize + \"px\";\n uiCell.style.fontFamily = cellObj.fontFamily;\n uiCell.style.color = cellObj.color;\n uiCell.style.backgroundColor = cellObj.bgColor;\n uiCell.style.textAlign = cellObj.halign;\n }\n }\n document.querySelector(`.grid .cell[rid=\"${0}\"][cid=\"${0}\"]`).click();\n}", "function editData(setOrGraph){//either a MD.Set or a MD.Graph (not defined for new series)\n if(!account.loggedIn()) {\n dialogShow(\"account required\", dialogues.signInRequired);\n return;\n }\n if($('#outer-show-graph-div').is(':visible')) quickViewClose();\n var seriesSetToEdit, seriesSetsToEdit, qGraph;\n if(!setOrGraph || (!setOrGraph.plots && !setOrGraph.setid)){\n _showSeriesEditor(); //open blank editor\n } else {\n if(setOrGraph.plots){\n qGraph = setOrGraph;\n seriesSetsToEdit = qGraph.onlySameSetPlots();\n if(!seriesSetsToEdit){\n //complex plots of just a bunch of simple plot of different sets?\n dialogShow('Plots have different components','Only the underlying data can be edited, not derived data created from mashing together multiple data sets. To edit an underlying data set, open the <b>more configurations</b> panel and <span class=\"comp-view\">view source data</span>.');\n return;\n }\n seriesSetToEdit = seriesSetsToEdit[0];\n } else {\n seriesSetToEdit = setOrGraph;\n }\n //is this a user set?\n callApi(\n {command: 'SetPreEditInfo', setid: seriesSetToEdit.setid},\n function(jsoData){\n seriesSetToEdit.userid = jsoData.userid;\n seriesSetToEdit.settype = jsoData.settype;\n seriesSetToEdit.maps = jsoData.maps;\n seriesSetToEdit.parseMaps();\n if(jsoData.userid){\n if(seriesSetToEdit.userid==account.info.userId){\n seriesSetToEdit.preferredmap = jsoData.preferredmap;\n seriesSetToEdit.worksheet = jsoData.worksheet;\n if((seriesSetToEdit.settype=='M' || seriesSetToEdit.settype=='X') && seriesSetToEdit.preferredmap){\n _editMapPointSet(seriesSetToEdit.setid, seriesSetToEdit.preferredmap);\n } else {\n _editWorkSheet(seriesSetToEdit.worksheet);\n }\n } else {\n dialogShow('Non-public data set','This is an other user&rsquo;s entered data set. Your can only edit public data sets and data sets you have created.');\n }\n } else {\n //public data: ask whether to edit set or the series\n if((seriesSetToEdit.settype=='M' || seriesSetToEdit.settype=='X') && seriesSetToEdit.maps){\n //2. Is seriesSetToEdit part of a public set (i.e. is settype 'M' or 'X')? If so, ask if the use wants to edit the series or the entire set\n //see if user wants to edit the entire set or just this series\n var html = '<div id=\"seriesOrSet\" style=\"width:330px;\">'\n + '<h4>This series is part of a mappable data set</h4>'\n + '<label><input type=\"radio\" name=\"editSeriesOrSet\" value=\"series\" checked> edit just this series </label><br>'\n + '<label><input type=\"radio\" name=\"editSeriesOrSet\" value=\"set\"> view and edit the data set\\'s series for the map:<br>'\n + '<select class=\"hidden\" style=\"margin-top: 8px;margin-left: 25px\"></select></label><br><br>'\n + '<button class=\"right\" id=\"seriesOrSetCancel\">cancel</button> <button class=\"right\" id=\"seriesOrSetOk\">OK</button><br><br><br>'\n + '<i>Note: Edits of public data will make a copy and <br>add your edited copy to your <b>My Data</b></i>'\n + '</div>';\n $.fancybox(html,\n {\n showCloseButton: false,\n autoScale: true,\n scrolling: false,\n overlayOpacity: 0.5,\n hideOnOverlayClick: false\n });\n var $panel = $('#seriesOrSet');\n var mapOptions='',\n $select = $panel.find('select').html('').show().click(function(){$panel.find('input:radio').removeAttr('checked').filter('[value=\"set\"]').attr('checked','checked')});\n for(var mapKey in seriesSetToEdit.maps){\n mapOptions+='<option value=\"'+mapKey+'\">'+ globals.maps[mapKey].name +' ('+seriesSetToEdit.maps[mapKey]+' series)</option>';\n }\n $select.html(mapOptions);\n\n $('#seriesOrSetOk').button({icons: {secondary: 'ui-icon-check'}}).click(function(){\n if($('input:radio[name=\\'editSeriesOrSet\\']:checked').val()=='series'){\n _showSeriesEditor([seriesSetToEdit]);\n } else {\n _editMapPointSet(seriesSetToEdit, $select.val())\n }\n $.fancybox.close();\n });\n $('#seriesOrSetCancel').button({icons: {secondary: 'ui-icon-close'}}).click(function(){\n $.fancybox.close();\n });\n } else {\n //3. If seriesSetToEdit a public single-series set (not part of a map or marker set), just go straight to _showSeriesEditor\n _showSeriesEditor([seriesSetToEdit]);\n }\n }\n }\n );\n }\n\n function _editWorkSheet(worksheet){\n callApi({command: 'GetWorkSheet', worksheet: worksheet}, function(results){\n var worksheetSeriesSets = [];\n for(var i=0;i<results.series.length;i++){\n worksheetSeriesSets.push(new MashableData.Set(results.series))\n }\n _showSeriesEditor(worksheetSeriesSets);\n });\n }\n function _editMapPointSet(set, map){\n var params = {command: 'GetSets', map: map};\n params[set.settype=='M'?'mapSets':'pointSets'] = [{setid: set.setid, freq: set.freq}];\n callApi(params, function(result){\n for(var handle in result.assets){\n _showSeriesEditor(result.assets[handle], map); //should only get called once as we requested a single set\n }\n });\n }\n\n\n function _showSeriesEditor(setsToEdit, map){\n //setsToEdit is either an array of single-series set objects, a Mapset/Pointset object, or not defined for a blank series editor\n\n var $editor = $('#data-editor'), //variable set in initialize() and used throughout\n editorCols = 2,\n setid = null,\n geoid = null,\n bunnyColumns = [],\n fixedRowsTop = 5, //gets modified for set mapset and pointset edits\n fixedColumnsLeft = 1,\n localSetidCounter = -1,\n settype,\n worksheetId,\n hotSettings,\n hot = false, //set to HandsOnTable instance on instantiation\n editorFreq = null,\n mapableSourceSet = null,\n now = new Date();\n\n //frequency editor\n var freqOptions = '';\n for(var freq in globals.period.name){\n if(freq!='N') freqOptions += '<option value=\"'+freq+'\">'+globals.period.name[freq]+'</option>';\n }\n $('#set_freq_format').html('');\n var $freqSelect = $('#set_freq').off().html(freqOptions).click(function(){\n editorFreq = $freqSelect.val();\n $('#set_freq_format').html('(Please format as ' + globals.period.format[editorFreq]+')');\n });\n $('#series-tabs').find('li.local-series a').click();\n var rows = {\n S: {setid: 0, name: 1, units: 2, notes: 3, header: 4},\n M: {geoid: 0, header: 1},\n X: {geoid: 0, geoname: 1, lat: 2, lon: 3, header: 4}\n };\n if(!setsToEdit) {\n setsToEdit = [];\n settype = 'S';\n worksheetId = now.getTime();\n\n } else {\n var isWorkSheet = Array.isArray(setsToEdit);\n if (isWorkSheet) {\n settype = 'S';\n worksheetId = setsToEdit[0].worksheet || now.getTime();\n $freqSelect.val('A').click();\n } else {\n mapableSourceSet = setsToEdit;\n settype = mapableSourceSet.settype; //either X or M (single series should be passed in as a single item array)\n worksheetId = mapableSourceSet.worksheet || now.getTime();\n $('#series-edit-preview, .series-edit-geoset').hide();\n }\n }\n\n var seriesData, point, i, j, row, grid, isoDate;\n switch(settype){\n case 'M':\n var mapSet = mapableSourceSet;\n _initializeDataEditor();\n\n $('#set-edit-header').show();\n $('#set_name').val(mapSet.setname);\n $('#set_units').val(mapSet.units);\n $('#set_notes').val(mapSet.setmetadata);\n $freqSelect.val(mapSet.freq).click();\n grid = [[\"geoid\"], [\"date\"]];\n for(var geokey in mapSet.data){\n grid[rows.M.geoid].push(mapSet.data[geokey].geoid);\n grid[rows.M.header].push(mapSet.data[geokey].geoname);\n if(mapSet.data[geokey].type=='bunny') bunnyColumns.push(grid[rows.M.header].length-1);\n row = rows.M.header + 1; //first data row\n if(mapSet.data[geokey].data){\n seriesData = mapSet.data[geokey].data.split('|');\n seriesData.sort(); //this should not be necessary if series were properly ordered\n for(j=0;j<seriesData.length;j++){\n point = seriesData[j].split(':');\n isoDate = common.isoDateFromMdDate(point[0]);\n while(row<grid.length && grid[row][0]<isoDate){\n grid[row++].push('');\n }\n if(row==grid.length){\n grid.push(_makeRow(point, grid[0].length));\n } else {\n if(grid[row][0]==isoDate) {\n grid[row].push(isNaN(point[1])?point[1]:parseFloat(point[1]));\n }\n if(grid[row][0]>isoDate) {\n grid.splice(row, 0, _makeRow(point, grid[0].length));\n }\n }\n row++;\n }\n }\n while(row<grid.length) grid[row++].push('');\n }\n editorCols = grid[0].length; //users cannot add columns to mapset: they are complete for a given map\n fixedRowsTop = 2;\n $editor.removeAttr(\"data\");\n hotSettings. data = grid;\n hotSettings.fixedRowsTop = fixedRowsTop;\n hotSettings.fixedColumnsLeft = fixedColumnsLeft;\n hot = new Handsontable($editor.get(0), hotSettings); //hiding and color and read-only handled in render\n unmask();\n break;\n case 'X'://MARKER SET EDIT\n _initializeDataEditor();\n $freqSelect.val(mapableSourceSet.freq).click();\n var aryLatLon, setData = mapableSourceSet.data;\n grid = [[\"marker set\",setData.name],[\"units\",setData.units],[\"notes\",\"\"],[\"geoid\"],[\"lat\"],[\"lon\"],[set],[\"date\"]]; //handle col will hold the set id\n for(var latlon in setData){\n aryLatLon = latlon.split(',');\n grid[rows.X.geoid].push(setData[latlon].geoid);\n grid[rows.X.lat].push(aryLatLon[0]);\n grid[rows.X.lon].push(aryLatLon[1]);\n grid[rows.X.header].push(setData[latlon].name.replace(setData.name,'').trim());\n row = rows.X.header+1; //first data row\n if(setData[latlon].data){\n seriesData = setData[latlon].data.split('|');\n seriesData.sort(); //this should not be necessary is series were properly ordered\n for(j=0;j<seriesData.length;j++){\n point = seriesData[j].split(':');\n isoDate = common.isoDateFromMdDate(point[0]);\n while(row<grid.length && grid[row][0]<isoDate) grid[row++].push('');\n if(row==grid.length){\n grid.push(_makeRow(point, grid[0].length));\n } else {\n if(grid[row][0]==isoDate) grid[row].push(isNaN(point[1])?point[1]:parseFloat(point[1]));\n if(grid[row][0]>isoDate) grid.splice(row, 0, _makeRow(point, grid[0].length));\n }\n row++;\n }\n }\n while(row<grid.length) grid[row++].push('');\n }\n editorCols = setData.geographies.length + 1;\n $editor.removeAttr(\"data\");\n hotSettings.data = grid;\n hotSettings.fixedRowsTop = fixedRowsTop;\n hotSettings.fixedColumnsLeft = fixedColumnsLeft;\n hotSettings.minCols = editorCols;\n hot = new Handsontable($editor.get(0), hotSettings);\n unmask();\n break;\n case 'S':\n _initializeDataEditor();\n grid = [[\"setid\"],[\"name\"],[\"units\"],[\"notes\"],[\"date\"]]; //handle col will hold the set id\n $freqSelect.val(setsToEdit.length?setsToEdit[0].freq:'A').click(); //a worksheet can only have a single freq\n for(i=0;i<setsToEdit.length;i++){\n var serie = setsToEdit[i];\n grid[rows.S.setid].push(serie.userid == account.info.userId?serie.setid||-localSetidCounter--:-localSetidCounter--);\n grid[rows.S.units].push(serie.units||''); //required and tested on save\n grid[rows.S.notes].push(serie.setmetdata || '');\n grid[rows.S.name].push(serie.name()); //required and tested on save\n seriesData = Array.isArray(serie.data)?serie.data:serie.data.split('|');\n seriesData.sort(); //this should not be necessary is series were properly ordered\n row = rows.S.header+1; //first data row\n for(j=0;j<seriesData.length;j++){\n point = seriesData[j].split(':');\n isoDate = common.isoDateFromMdDate(point[0]);\n while(row<grid.length && grid[row][0]<isoDate) grid[row++].push('');\n if(row==grid.length){\n grid.push(_makeRow(point, grid[0].length));\n } else {\n if(grid[row][0]==isoDate) grid[row].push(isNaN(point[1])?point[1]:parseFloat(point[1]));\n if(grid[row][0]>isoDate) grid.splice(row, 0, _makeRow(point, grid[0].length));\n }\n row++;\n }\n while(row<grid.length) grid[row++].push('');\n }\n $editor.removeAttr(\"data\");\n hotSettings.data = grid;\n hotSettings.fixedRowsTop = fixedRowsTop;\n hotSettings.fixedColumnsLeft = fixedColumnsLeft;\n hotSettings.minCols = editorCols;\n hot = new Handsontable($editor.get(0), hotSettings);\n $('#edit-user-series').slideDown();\n $('#set-edit-header').hide();\n }\n\n function _makeRow(point, length){\n var i, newRow = [common.isoDateFromMdDate(point[0])];\n for(i=1;i<length-1;i++) newRow.push('');\n newRow.push(isNaN(point[1])?point[1]:parseFloat(point[1]));\n return newRow;\n }\n function _initializeDataEditor(){\n var editorCols = 2,\n lastRow= 0,\n lastCol= 0,\n $panel = $('div#edit-user-series').height($('#local-series').height()).fadeIn();\n $editor.height($('#local-series').height()-$('#set-edit-header').height()-100).html('');\n $panel.find('button.series-edit-save').button({icons:{secondary:'ui-icon-disk'}}).off().click(function(){\n saveSeriesEditor();\n });\n $panel.find('button.series-edit-cancel').button({icons:{secondary:'ui-icon-close'}}).off().click(function(){\n closeSeriesEditor();\n });\n $panel.find('button.series-edit-preview').button({icons: {secondary: 'ui-icon-image'}}).off().click(function(){\n var dataArray, previewSet, previewSets = [], editorObj = getMyDataFromEditor(true);\n if(editorObj) { //false on error\n if(Array.isArray(editorObj)){ //else an array of data objects (not MD.Set!) for single-series sets or the data object for a map or pointset\n dataArray = editorObj;\n } else {\n dataArray = editorObj.data;\n }\n for(i=0; i<dataArray.length; i++){\n previewSet = new MD.Set(dataArray[i]);\n previewSets.push(previewSet);\n }\n if(previewSets.length) {\n quickGraph(previewSets, false, false);\n } else {\n dialogShow('error', 'An unexpected error was encountered');\n }\n }\n });\n $panel.find('button.series-edit-geoset').button({icons:{secondary:'ui-icon-flag'}}).show().off().click(function(){\n _showUserSetWizard();\n });\n $panel.find('button.series-edit-save-as').button({icons:{secondary:'ui-icon-copy'}});\n hotSettings = {\n minCols: 2,\n colWidths: function(c){\n return c==0?85:150;\n },\n minSpareCols: -1, //this allows the pasted changes to come through\n minSpareRows: 1, //always keep at least 1 spare row at the bottom\n autoWrapRow: true,\n contextMenu: {\n row_above: {\n disabled: function(){return hot.getSelected()[0] <= rows[settype].header;}\n },\n row_below: {\n disabled: function(){return hot.getSelected()[0] < rows[settype].header;}\n },\n col_right: {\n disabled: function(){return settype == 'M';}\n }\n },\n fillHandle: false,\n cells: function (row, col, prop) {\n var cellProperties = {};\n if ((row < rows[settype].header && col == 0) || row == rows[settype].header) {\n cellProperties.readOnly = true; //make cell read-only if it is first row or the text reads 'readOnly'\n }\n if(row>=fixedRowsTop && col>=fixedColumnsLeft){\n cellProperties.type = 'numeric';\n cellProperties.format = '0,0.[0000]';\n } else {\n cellProperties.renderer = _handsOnCellRenderer;\n }\n return cellProperties;\n },\n onSelection: function(r,c,r1,c1){\n if(r==r1&&c==c1){\n var bgColor = $(hot.getCell(r, c)).css('background-color').toUpperCase();\n if(bgColor=='RGB(224, 255, 255)'||bgColor=='#E0FFFF') hot.selectCell(r,c+1);\n if(bgColor=='RGB(128, 128, 128)'||bgColor=='#808080') {\n hot.selectCell(r+(lastCol==c&&(lastRow-r==1)?-1:1),c);\n }\n lastRow=r;lastCol=c;\n\n if(r>rows[settype].header){ //not a header cell or the first data row (which has no preceding date)\n\n var myDate = hot.getDataAtCell(r, 0);\n if(myDate==\"\"||myDate==null){ //corresponding date cell is empty\n var precedingDateEntry = (hot.getDataAtCell(r-1, 0)||'').toString();\n if(precedingDateEntry.length>3 && (isoDate = _isValidIsoDate(precedingDateEntry))){ //something is there. Hopefully a valid MD date...\n var precedingDate = dateFromMdDate(_mdDateFromIso(isoDate));\n var nextMdDate = common.mashableDate(nextDate(precedingDate, editorFreq), editorFreq);\n hot.setDataAtCell(r, 0, nextMdDate);\n }\n }\n }\n }\n },\n onBeforeChange: function(changes){ //autoexpansion code for large pastes\n var maxCol = 0;\n for(var i=0;i<changes.length;i++){if(changes[i][1]>maxCol)maxCol=changes[i][1]}\n if(maxCol>=editorCols){\n editorCols = maxCol+1;\n hot.updateSettings({\"cols\":editorCols});\n for(i=2;i<editorCols;i++) $(hot.getCell(3, i)).innerHTML=\"value\";\n }\n },\n onChange: function(changes, source){\n if(source==\"edit\"||source==\"empty\"){ //remove excess columns/rows\n try{\n var r, c, totalChanges, gridData = hot.getData();\n //check for empty columns\n for(c=gridData[0].length-1;c>1;c--){ //loop through columns right to left skipping the first two (date+first value column)\n totalChanges = \"\";\n for(r=0;r<gridData.length;r++){\n if(r!=3)totalChanges+=gridData[r][c];\n if(nonWhitePattern.test(totalChanges)) break; //exit on first non-empty cell = fast\n }\n if(nonWhitePattern.test(totalChanges)) break; //exit main loop too\n //empty right-most column found!!\n hot.alter('remove_col', c, c+1); //remove it!!\n }\n //check for excess empty bottom rows\n gridData = hot.getData(); //get a fresh copy\n for(r=gridData.length-1;r>5;r--){ //loop through bottom heading up\n totalChanges = \"\";\n for(c=0;c<gridData[0].length;c++){ //loop through all columns\n if(r!=3)totalChanges+=gridData[r][c]\n }\n if(nonWhitePattern.test(totalChanges)) break; //exit main loop too\n //empty bottomish row found!!\n if(r<gridData.length-1) hot.alter('remove_row', r); //remove it if not absolute bottom!!\n }\n } catch(err){console.log(err)}\n\n }\n }\n };\n }\n function _handsOnCellRenderer(instance, td, row, col, prop, value, cellProperties){\n switch(settype){\n case 'S':\n Handsontable.TextCell.renderer.apply(this, arguments);\n if(row < rows.S.header && col == 0){\n td.style.background = '#E0FFFF';\n td.style.fontWeight = 'bold';\n }\n if(row == rows.S.header){\n td.style.background = '#707070';\n td.style.fontWeight = 'bold';\n td.style.color = '#000000';\n }\n if(row > rows.S.header && col == 0){\n td.style.background = '#FFFFE0';\n }\n if(row == rows.S.setid){\n $(td).addClass('hidden');\n }\n break;\n case 'M':\n Handsontable.TextCell.renderer.apply(this, arguments);\n if(row < rows.M.header){\n $(td).addClass('hidden');\n }\n if(row > rows.M.header && col == 0){\n td.style.background = '#FFFFE0';\n }\n if(row == rows.M.header){\n td.style.background = '#707070';\n td.style.fontWeight = 'bold';\n td.style.color = '#000000';\n }\n if(row >= rows.M.header && bunnyColumns.indexOf(col) !== -1){\n td.style.background = 'DarkTurquoise';\n }\n }\n if(row>fixedRowsTop && col>fixedColumnsLeft){ //data value cell\n if(isNaN(value) && value.trim()!='' && value!=\"null\") value = 'null';\n td.style.background = 'White';\n }\n if(row>fixedRowsTop && col==0 && (value != '' || row < instance.countRows())){ //date cell, except final blank\n if(isoDate = _isValidIsoDate(value)){\n if(value != isoDate) {\n instance.setDataAtCell(row, col, isoDate);\n }\n } else {\n td.style.background = 'Red';\n }\n }\n }\n function _isValidIsoDate(cellValue){\n if(globals.period.test.strict[editorFreq].test(cellValue)){\n return globals.period.test.strict[editorFreq].exec(cellValue)[0];\n } else {\n if(globals.period.test.loose[editorFreq].test(cellValue)) {\n isoDate = globals.period.test.loose[editorFreq].exec(cellValue)[0];\n //find and fix single digit months in day/week dates\n var pos = isoDate.search(/-\\d-/g);\n if (pos > -1) isoDate = isoDate.substring(0, pos + 1) + '0' + isoDate.substring(pos + 2);\n //find trailing single digit date or month\n pos = isoDate.search(/-\\d\\b/g);\n if (pos > -1) isoDate = isoDate.substring(0, pos + 1) + '0' + isoDate.substring(pos + 2);\n return isoDate;\n } else {\n return false;\n }\n }\n }\n function _mdDateFromIso(isoDate){\n return isoDate.trim().replace(/[ -]/g, '');\n }\n function _showUserSetWizard(){\n showPanel();\n\n function showPanel() {\n var $panel, mapsAsOptions = '', i;\n for (var map in globals.maps) {\n mapsAsOptions += '<option value=\"' + map + '\">' + globals.maps[map].name + '</option>';\n }\n var html = '<div id=\"setsWizard\" style=\"width:330px;\">' //TODO: CSS entries\n + '<h4>Create a set of series that can be mapped:</h4>'\n + '<label><input name=\"setsWizardType\" type=\"radio\" value=\"X\" /> as points (requires latitudes and longitudes)</label><br />'\n + '<label><input name=\"setsWizardType\" type=\"radio\" value=\"M\" checked /> as countries or administrative areas</label><br /><br />'\n + '<i>For areas, optional regional series allow vizualizations that use regional tracking series. In the editor, these are shaded turquoise: <span style=\"background-color:DarkTurquoise;\"> </span></i><br /><br />'\n + '<select id=\"setsWizardMap\" style=\"width: 300px;\">'\n + '<option value=\"nomap\" class=\"nomap\">select map</option>'\n + mapsAsOptions\n + '</select><br><br>'\n + '<button class=\"right\" id=\"setsWizardCancel\">cancel</button><button class=\"right\" id=\"setsWizardOk\">OK</button>'\n + '</div>';\n $.fancybox(html,\n {\n showCloseButton: false,\n autoScale: true, //($btn?false:true),\n overlayOpacity: 0.5,\n hideOnOverlayClick: false\n });\n $('#setsWizardMap').change(function () {\n if ($(this).val() != 'nomap') {\n $('#setsWizardOk').button(\"option\", \"disabled\", false);\n $(this).find('option[value=\\'nomap\\']').remove();\n }\n });\n $('#setsWizardOk').button({icons: {secondary: 'ui-icon-check'}, disabled: true}).click(function () {\n _showUserSetWizard_configureUserSet($('#setsWizardMap').val(), $('#setsWizardMap').text(), $('input:radio[name=\\'setsWizardType\\']:checked').val());\n $.fancybox.close();\n });\n $('#setsWizardCancel').button({icons: {secondary: 'ui-icon-close'}}).click(function () {\n $.fancybox.close();\n });\n function _showUserSetWizard_configureUserSet(map, mapName, type) { //type = [X|M] for pointset or mapset\n settype = type;\n //1. if mapset: get maps's components from db\n // on callback: separator (default ':') on top too + columns of: noneditable geoname headers\n // else pointset\n //2. clear and reconfigure grid with map name and editable set name and units name on top\n //2B. for pointsets: columns of: noneditable geoname headers + editable green shaded cells for lat & lon\n //3. cell A1 = [name|map set| point set] will be\n callApi({command: 'GetMapGeographies', settype: type, map: map}, function (jsoData, textStatus, jqXH) {\n _showUserSetWizard_newUserMapSet(jsoData, type)\n }); //mapsets shown on callback\n $('#set_name').val('');\n $('#set_units').val('');\n $('#set_notes').val('');\n\n }\n\n function _showUserSetWizard_newUserMapSet(jsoData, type) {\n bunnyColumns = [];\n var data;\n if (type == 'M') {\n data = [[\"geoid\"], [\"date\"]]; //[\"map set\"],[\"units\"] & [\"notes\"] are now in the header (#set_name, #set_units, #set_notes)\n for (var i = 0; i < jsoData.geographies.length; i++) {\n data[rows.M.geoid].push(jsoData.geographies[i].geoid);\n data[rows.M.header].push(decodeURIComponent(escape(jsoData.geographies[i].name)));\n if (jsoData.geographies[i].type == 'bunny' || jsoData.geographies[i].type == 'region') bunnyColumns.push(i + 1); //used by renderer to shade columns\n }\n fixedRowsTop = 2;\n } else { //markerset\n data = [[\"geoid\"], [\"geography\"], [\"lat,lon\"], [\"date\"]]; //[\"map set\"],[\"units\"] & [\"notes\"] are now in the header (#set_name, #set_units, #set_notes)\n //TODO: create the array that will field the autocomplete field for point containers\n }\n\n //HIDE GEO ROW - TRY TO DO IT THE RIGHT WAY $editor.find('table.htCore tr').show().filter(':eq('+rows.M.handle+')').hide().end().filter(':eq('+rows.M.geoid+')').hide();\n editorCols = jsoData.geographies.length + 1;\n $('#set-edit-header').show();\n hotSettings.data = data;\n hotSettings.minCols = editorCols;\n hotSettings.fixedColumnsLeft = fixedColumnsLeft;\n hotSettings.fixedRowsTop = fixedRowsTop;\n if(hot) hot.destroy();\n hot = new Handsontable($editor.get(0), hotSettings);\n $('#series-edit-preview, .series-edit-geoset').hide();\n\n }\n }\n }\n\n function getMyDataFromEditor(forPreview){\n //build series and validate\n hot.destroyEditor(false); //exit cell edit mode and without reverting (ie. commit any edits)\n var gridData = hot.getData(),\n timestamp = (new Date()).getTime(),\n localSeriesIndex= 1,\n uSerie,\n mdata,\n c,\n r,\n invalidDates = [],\n allDates = [],\n dupDates = [],\n headerErrors = [];\n\n //1. create the shell Set objects\n switch(settype){\n case 'M':\n case 'X':\n var userSet = {\n units: $('#set_units').val().trim(),\n setname: $('#set_name').val().trim(),\n setmetadata: $('#set_notes').val().trim(),\n freq: editorFreq,\n freqs: [editorFreq],\n settype: settype,\n worksheet: worksheetId,\n data: []\n };\n if(mapableSourceSet.setid) userSet.setid = mapableSourceSet.setid;\n if(mapableSourceSet.uid) userSet.uid = mapableSourceSet.uid;\n if(mapableSourceSet.worksheet) userSet.worksheet = mapableSourceSet.worksheet;\n if(!userSet.name || !userSet.name){\n dialogShow('Incomplete set', 'A set name and units are required. Please enter this information first in the space above the data grid.');\n return false;\n }\n break;\n case 'S':\n var worksheetSets = [];\n }\n\n //2. verify dates = correctly converts to a real date or row is empty; also checks for duplicates\n var dateConversions = {}, rowHasData;\n for(r=rows[settype].header+1;r<gridData.length;r++){\n rowHasData = false;\n for(c=1;c<gridData[0].length;c++) {\n if(gridData[r][c]!==null && nonWhitePattern.test(gridData[r][c])){\n rowHasData = true;\n break;\n }\n }\n if(rowHasData){\n if(isoDate = _isValidIsoDate(gridData[r][0])){\n if(allDates.indexOf(isoDate)==-1){\n allDates.push(isoDate);\n } else {\n if(dupDates.indexOf(isoDate)==-1) dupDates.push(isoDate);\n //would be nice to paint it purple but don't know how: $editor.data('handsontable').setCellMeta()\n }\n } else {\n invalidDates.push(gridData[r][0])\n }\n } else {\n gridData.splice(r--, 1);\n }\n }\n\n for(c=1;c<gridData[0].length;c++){\n var colData = [];\n for(r=rows[settype].header+1;r<gridData.length;r++){ //does this column have any data?\n if(gridData[r][c]!==null && nonWhitePattern.test(gridData[r][c])){\n colData.push(_mdDateFromIso(_isValidIsoDate(gridData[r][0])) + ':' + gridData[r][c]);\n }\n }\n if(colData.length) { //don't try to save empty columns\n mdata = colData.sort(); //leave unjoined for save and plotting .join('|');\n switch(settype){\n case 'M':\n //3M. no additional mapset error checks needed\n //4M. create the region series\n uSerie = {\n geoid: gridData[rows.M.geoid][c],\n geoname: gridData[rows.M.header][1],\n data: mdata\n };\n if(forPreview) uSerie.units = userSet.units;\n userSet.data.push(uSerie);\n break;\n case 'X':\n //3X. pointset specific error checks\n if(isNaN(gridData[rows.X.lat][c]) || isNaN(gridData[rows.X.lon][c]) || Math.abs(parseFloat(gridData[rows.X.lat][c]))>180 || Math.abs(parseFloat(gridData[rows.X.lon][c]))>180){\n dialogShow(\"Invalid latitude-longitude\", 'Valid latitude and longitude values are required for columns containing data for a set of point specific data. An invalid value was encountered in column '+c+'. Valid values must be a number between -180 and 180.');\n return false;\n }\n\n if(gridData[rows.X.header][c].trim()){\n if(i=seriesNames.indexOf(gridData[rows.X.header][c].trim())===-1){\n seriesNames.push(gridData[rows.X.header][c].trim());\n } else {\n dialogShow('Duplicate Name', 'Each marker must have a unique location name. Columns '+(i+1)+' and '+c+' are duplicates. Please fix and try saving again.');\n return false;\n }\n } else {\n dialogShow(\"Location Name Required\", 'A series name is required for columns containing data. Please enter a location name for column '+c+' and save again.');\n return false;\n }\n //4X. Create the point series\n uSerie = {\n geoid: globals.maps[map].bunny,\n latlon: parseFloat(gridData[rows.X.lat][c]).toString() + ',' + parseFloat(gridData[rows.X.lon][c]).toString(),\n seriesname: gridData[rows.X.header][c].trim(),\n savedt: new Date().getTime(),\n data: mdata\n };\n if(forPreview) {\n uSerie.units = userSet.units;\n uSerie.freq = editorFreq;\n }\n userSet.data.push(uSerie);\n break;\n default:\n //3U. single series column specific error checks\n if(settype=='S' && (!nonWhitePattern.test(gridData[rows.S.name][c]) || (gridData[rows.S.name][c]===null) || !nonWhitePattern.test(gridData[rows.S.units][c]) || (gridData[rows.S.units][c]===null))){\n dialogShow(\"Invalid Series\",\"Name and units are required fields.\");\n return false;\n }\n //4U. Create the single series Set\n uSerie = {\n setid: parseInt(gridData[rows.S.setid][c] || 0),\n settype: 'S',\n freq: editorFreq,\n freqs: [editorFreq],\n setname: gridData[rows.S.name][c].trim(),\n units: gridData[rows.S.units][c].trim(),\n setmetadata: gridData[rows.S.notes][c].trim(),\n savedt: timestamp,\n worksheet: worksheetId,\n data: mdata\n };\n if(!uSerie.setname.length || !uSerie.units.length) {\n dialogShow(\"Name and units required\",'Name and units are required for each non-empty column. Please correct column '+c+' and try again.');\n return false;\n }\n worksheetSets.push(uSerie);\n break;\n }\n }\n }\n\n if((settype=='S' && !worksheetSets.length) || (settype!='S' && !userSet.data.length)){\n dialogShow(\"No data\",\"No date-value pairs found.<br><br><i>If you want to delete a previously saved worksheet, use the delete button.</i>\");\n return false;\n }\n\n if(invalidDates.length + dupDates.length + headerErrors.length >0){\n dialogShow(\"Dates did not validate\",\n (invalidDates.length?'<p>Invalid dates found. For the frequency chosen, the date field must validate to ' + globals.period.format[editorFreq] + '. Invalid dates are shown in red and must be corrected if the row has any data.</p>':'')\n + (dupDates.length?'<p>Duplicate dates found for rows that have data. Either delete the row data or correct the dates: ' + dupDates.join(', ') + '</p>' : '')\n + '<br><br>Please correct these errors and try again.'\n );\n return false;\n }\n return settype == 'S' ? worksheetSets : userSet;\n }\n\n// HOW SAVING WORKS:\n// for map/point set: regions and points are not transmitted if the column is emptied of data or deleted. If latlon/geoid not in submission, it will be deleted from the set\n// for series: series are not transmitted if the column is emptied out or deleted. updatets is updated for all series in worksheet upon save.\n// editor: warn on saved if series data or the entire set is empty\n// If the user chooses to proceed: a worksheet's single-series sets and a set's setdata components not resubmitted during a save are deleted\n// Server sets firstdt and lastdt in setdata on save; freqs, ghandles, set.firstdt and set.lastdt and maps are set after each set is saved\n\n// DELETING:\n// from qGraph: A setUsed(setid) check is performed in set delete routine sends an error msg if set is in use as a plot component and offers to open all the graphs\n// from editor save: See above for warning and deleting of empty map, point, and single series sets\n// from editor delete: Visible if editing an existing worksheet or user set\n\n function saveSeriesEditor(){\n var i,\n mySet,\n oldHandle,\n graphRefreshes = {},\n graphWarnings = [],\n myData = getMyDataFromEditor(); //returns false if missing name or units or data\n //need to add geoid (of bunny for PointSets + setname)\n if(myData){\n callApi({command: \"SaveUserSets\", data: myData, settype: settype, freq: editorFreq, preferredmap: map}, //set ie either 'S' or the handle of a mapset or pointset\n function(jsoData, textStatus, jqXH){\n //add update MySeriesGrid on success\n for(i=0;i<myData.length;i++){\n mySet = new MD.Set(myData[i]);\n //looking for existing set\n oldHandle = settype + (mySet.oldsetid || mySet.setid);\n //problems with the update on the manipulated cells. Easier to delete and add.\n $dtMyData.find('span.handle:contains('+oldHandle+')').each(function(){\n if($(this).html() == oldHandle) $dtMyData.fnDeleteRow($(this).closest(\"tr\").get(0));\n });\n delete oMySets[oldHandle];\n //add to data table and mySets object unless deleted (setid = false)\n if(mySet.setid){\n $dtMyData.fnAddData(mySet);\n oMySets[mySet.handle()] = myData[i]; //over-write as needed\n }\n for(var panel in panelGraphs){\n panelGraphs[panel].eachComponent(function(){\n if(this.setid == mySet.setid){ //only update sets already using mySet. Don't replace old sets.\n this.setname = mySet.setname;\n this.units = mySet.units;\n this.data = mySet.data;\n this.setmetadata = mySet.setmetadata;\n graphRefreshes[panel] = true;\n }\n if(this.setid == mySet.oldsetid && this.setid != mySet.setid){\n if(mySet.setid){\n if(graphWarnings.indexOf(panelGraphs[panel]) !== -1) graphWarnings.push(panelGraphs[panel]);\n } else {\n this.deleted = true; //checked for on graph.save\n showDialog('Delete data in use','A data set just deleted was in use by the unsaved graph <a href=\"#/t='+panel+'\">'+panelGraphs[panel].title+'</a>. Please remove the delete sets before saving the graph.');\n }\n }\n })\n }\n }\n for(panel in graphRefreshes){\n panelGraphs[panel].controls.redraw();\n }\n }\n\n );\n closeSeriesEditor();\n }\n unmask();\n }\n\n function closeSeriesEditor(){\n hot.destroy(); //handsontable does not support chaining\n $editor.attr('style','overflow:scroll;');\n $('div#edit-user-series').fadeOut();\n window.history.back();\n }\n\n }\n}", "function update_title_range(val) {\n document.getElementById('count_value').value = val;\n}", "function prepareSelectedDescriptors(e){_.each(e,function(e){var t=JSON.parse(e.properties.meta);t.date=moment(t.date).format(\"LL\"),e.properties.title=GH.tpl.customfields.sprintmultiselect.renderTooltip(t),e.properties.html=GH.tpl.customfields.sprintmultiselect.renderSuggestionMeta(t)})}", "function openSummary() {\n // Hide simulation content\n $(\"#mainRowWrapper\").css(\"display\", \"none\");\n $(\".menuBar\").css(\"display\", \"none\");\n $(\"#projectionGraph\").css(\"width\", \"100%\");\n\n loadSummaryDisplays();\n loadSummarySliders();\n\n // Add date of design\n var d = new Date();\n $(\"#summaryContainer\").append(\"<h5>Date of design: \" + d.toLocaleDateString() + \"</h5>\");\n\n // Show summary\n $(\"#summaryContainer\").fadeIn(500);\n}", "function populateEditScreen(dataPassedIn) {\n // populating the edit screen with fillable fields\n var funnelStageHtmlOutput = '';\n funnelStageHtmlOutput += '<select required name=\"funnel-stage\">';\n funnelStageHtmlOutput += '<option value=\"1\">New Leads</option>';\n funnelStageHtmlOutput += '<option value=\"2\">Qualified Leads</option>';\n funnelStageHtmlOutput += '<option value=\"3\">Contact/Apply</option>';\n funnelStageHtmlOutput += '<option value=\"4\">Interview</option>';\n funnelStageHtmlOutput += '<option value=\"5\">Offer</option>';\n funnelStageHtmlOutput += '<option value=\"6\">Negotiate</option>';\n funnelStageHtmlOutput += '</select>';\n var ratingHtmlOutput = '';\n ratingHtmlOutput += '<select name=\"rating\">';\n ratingHtmlOutput += '<option value=\"0\">Select</option>';\n ratingHtmlOutput += '<option value=\"1\">Dream job!</option>';\n ratingHtmlOutput += '<option value=\"2\">Good fit</option>';\n ratingHtmlOutput += '<option value=\"3\">Take it or leave it</option>';\n ratingHtmlOutput += '<option value=\"4\">Only if I\\'m desperate</option>';\n ratingHtmlOutput += '</select>';\n\n $('#js-position-header-edit').html('<input type=\"text\" name=\"position\" placeholder=\"Position\" value=\"' + dataPassedIn.position + '\">');\n $('#js-company-header-edit').html('<input type=\"text\" name=\"company\" placeholder=\"Company Name\" value=\"' + dataPassedIn.company + '\">');\n for (var i = 1; i <= 6; i++) {\n if (dataPassedIn.funnelStage == i) {\n // first search for the index where i occurs\n var indx = funnelStageHtmlOutput.search(i);\n // then pass that index (+2 to account for closing double quotes and a space following)\n funnelStageHtmlOutput = funnelStageHtmlOutput.slice(0, indx + 2) + ' selected=\"selected\"' + funnelStageHtmlOutput.slice(indx + 2);\n }\n };\n $('#js-funnel-stage').html(funnelStageHtmlOutput);\n $('#js-company-overview').html('<input type=\"textarea\" name=\"company-overview\" placeholder=\"What kind of company is this? What is the company culture like?\" value=\"' + dataPassedIn.companyOverview + '\">');\n $('#js-company-size').html('<input type=\"text\" name=\"company-size\" placeholder=\"About how many?\" value=\"' + dataPassedIn.companySize + '\"> employees');\n $('#js-position-location').html('<input type=\"text\" name=\"position-location\" placeholder=\"Ganymede Station\" value=\"' + dataPassedIn.positionLocation + '\">');\n $('#js-salary-benefits').html('<input type=\"text\" name=\"salary-benefits\" placeholder=\"$1,000,000 + a helicopter\" value=\"' + dataPassedIn.salaryBenefits + '\">');\n $('#js-job-description').html('<input type=\"textarea\" name=\"job-description\" placeholder=\"What are the duties and requirements?\" value=\"' + dataPassedIn.jobDescription + '\">');\n if (dataPassedIn.applicationDate != null) {\n var dateForEditScreen = ((dataPassedIn.applicationDate).split('T'))[0];\n $('#js-application-date').html('<input type=\"date\" name=\"application-date\" value=\"' + dateForEditScreen + '\">');\n } else {\n $('#js-application-date').html('<input type=\"date\" name=\"application-date\" value=\"\" placeholder=\"2017-09-15\">');\n };\n $('#js-contact-name').html('<input type=\"text\" name=\"contact-name\" placeholder=\"James Bond\" value=\"' + dataPassedIn.contactName + '\">');\n $('#js-contact-email').html('<input type=\"email\" name=\"contact-email\" placeholder=\"example@example.com\" value=\"' + dataPassedIn.contactEmail + '\">');\n $('#js-application-materials').html('<input type=\"text\" name=\"application-materials\" placeholder=\"CV, resume, cover letter...\" value=\"' + dataPassedIn.applicationMaterials + '\">');\n if (dataPassedIn.interviewDate != null) {\n var dateForEditScreen = ((dataPassedIn.interviewDate).split('T'))[0];\n $('#js-interview-date').html('<input type=\"date\" name=\"interview-date\" value=\"' + dateForEditScreen + '\">');\n } else {\n $('#js-interview-date').html('<input type=\"date\" name=\"interview-date\" value=\"\" placeholder=\"2017-09-15\">');\n };\n $('#js-interview-follow-up').html('<input type=\"text\" name=\"interview-follow-up\" placeholder=\"Did you send a thank-you note?\" value=\"' + dataPassedIn.interviewFollowUp + '\">');\n $('#js-lead-source').html('<input type=\"text\" name=\"lead-source\" placeholder=\"Friend? Google?\" value=\"' + dataPassedIn.leadSource + '\">');\n $('#js-notes').html('<input type=\"textarea\" name=\"notes\" placeholder=\"Note to self!\" value=\"' + dataPassedIn.notes + '\">');\n for (var i = 1; i <= 4; i++) {\n if (dataPassedIn.rating == i) {\n // first search for the index where i occurs\n var indx = ratingHtmlOutput.search(i);\n // then pass that index (+2 to account for closing double quotes and a space following)\n ratingHtmlOutput = ratingHtmlOutput.slice(0, indx + 2) + ' selected=\"selected\"' + ratingHtmlOutput.slice(indx + 2);\n }\n };\n $('#js-rating').html(ratingHtmlOutput);\n}", "function update_total_count_summary() {\r\n\t\t\t$('#flight_search_result').show();\r\n\t\t\tvar _visible_records = parseInt($('.r-r-i:visible').length);\r\n\t\t\tvar _total_records = $('.r-r-i').length;\r\n\t\t\t// alert(_total_records);\r\n\t\t\tif (isNaN(_visible_records) == true || _visible_records == 0) {\r\n\t\t\t\t_visible_records = 0;\r\n\t\t\t\t//display warning\r\n\t\t\t\t$('#flight_search_result').hide();\r\n\t\t\t\t$('#empty_flight_search_result').show();\r\n\t\t\t} else {\r\n\t\t\t\t$('#flight_search_result').show();\r\n\t\t\t\t$('#empty_flight_search_result').hide();\r\n\t\t\t}\r\n\t\t\t$('#total_records').text(_visible_records);\r\n\t\t\tif(_visible_records == 1){\r\n\t\t\t\t$('#flights_text').text('Flight');\r\n\t\t\t}\r\n\t\t\t$('.visible-row-record-count').text(_visible_records);\r\n\t\t\t$('.total-row-record-count').text(_total_records);\r\n\t\t\t\r\n\t\t}", "getSummaryArray() {\n var summaryArray = [];\n for (var i = 0; i < this.rows.length; i++) {\n var bindedField = this.rows[i].bindedField;\n summaryArray.push({\n property: bindedField.property,\n value: bindedField.value,\n hierarchy: bindedField.hierarchy,\n exportName: bindedField.exportName\n });\n }\n\n return summaryArray;\n }", "function dateUpdate()\n {\n var id = $(this).attr('id') || '';\n var baseId = id.substr(0, id.lastIndexOf('_'));\n var objects = false;\n if (baseId == $baseId)\n {\n objects = $widgets;\n }\n else if (baseId == $baseRangeId)\n {\n objects = $rangeWidgets;\n }\n\n $('#'+baseId).val(objects.month.val() + '/' + objects.day.val() + '/' + objects.year.val());\n }", "function updateFacetCountValues() {\n\t\t /* \n There is some additional complexity with removing this. This is caled in the success callback as afterRenderHandler() in plugin.js\n but will need to be looked at separately.\n\n Until that's refactored, this should continue to return true\n\n */\n\t\t\t// $(\"span.nvao\").append(\"<span class='accreditation-tooltip'><dfn>Lorem ipsum dolor sit amet consectetur adipiscing</dfn></span>\");\n\t\t\treturn true;\n\t\t}", "function populateAssessmentDetails() {\n $('#taskStatus1').val(ch_task_status);\n $('#duedate1').val(formatDate1(ch_task_duedate));\n\n //assessment comments\n $('#tasknotes1').val(ch_task_worknotes);\n}", "function EditDataFunct() {\n\n //debugger;\n\n $(\"#tableRow_\" + Intern_LineEditedNum).html(GenerateTableLine(Intern_LineEditedNum));\n AddEvents(Intern_LineEditedNum);\n Intern_LineEditedNum = null;\n ClearAllInputs();\n $('#' + Intern_AddButtonId).html(Disp_TextAdd);\n Intern_InputFieldElems[0].focus();\n }", "function populateValuesInGrid(event)\n {\n //value of 1 means affiliated with LUMS\n event.field.find(\".configName\").text($(\"#configNamePopUp\").val())\n event.field.find(\"*[id*=name]\").val($(\"#configNamePopUp\").val())\n event.field.find(\".editConfigLink\").click(function()\n {\n //set edit mode\n setEditOrCreateMode(\"1\")\n //set the row currently being edited\n editRow = $(this).closest('tr');\n //set the closest flex table\n currentFlexTable=$(this).closest('table')\n //set values in the fancybox for edit mode\n setValuesForEditBeforeOpen()\n\n }).fancybox()\n }", "function createSummaryRow(row) {\n\t var indexPattern = $scope.indexPattern;\n\n\t // We just create a string here because its faster.\n\t var newHtmls = [openRowHtml];\n\n\t if (indexPattern.timeFieldName) {\n\t newHtmls.push(cellTemplate({\n\t timefield: true,\n\t formatted: _displayField(row, indexPattern.timeFieldName)\n\t }));\n\t }\n\n\t $scope.columns.forEach(function (column) {\n\t newHtmls.push(cellTemplate({\n\t timefield: false,\n\t sourcefield: column === '_source',\n\t formatted: _displayField(row, column, true)\n\t }));\n\t });\n\n\t var $cells = $el.children();\n\t newHtmls.forEach(function (html, i) {\n\t var $cell = $cells.eq(i);\n\t if ($cell.data('discover:html') === html) return;\n\n\t var reuse = _.find($cells.slice(i + 1), function (cell) {\n\t return $.data(cell, 'discover:html') === html;\n\t });\n\n\t var $target = reuse ? $(reuse).detach() : $(html);\n\t $target.data('discover:html', html);\n\t var $before = $cells.eq(i - 1);\n\t if ($before.size()) {\n\t $before.after($target);\n\t } else {\n\t $el.append($target);\n\t }\n\n\t // rebuild cells since we modified the children\n\t $cells = $el.children();\n\n\t if (i === 0 && !reuse) {\n\t $toggleScope = $scope.$new();\n\t $compile($target)($toggleScope);\n\t }\n\t });\n\n\t if ($scope.open) {\n\t $detailsScope.row = row;\n\t }\n\n\t // trim off cells that were not used rest of the cells\n\t $cells.filter(':gt(' + (newHtmls.length - 1) + ')').remove();\n\t }", "function refreshUserAnnotations(){\n\n $.get( OCC_REC.contextPath + \"/assertions/\" + OCC_REC.recordUuid, function(data) {\n\n if (data.assertionQueries.length == 0 && data.userAssertions.length == 0) {\n $('#userAnnotationsDiv').hide('slow');\n $('#userAssertionsContainer').hide(\"slow\");\n $('#userAnnotationsNav').css(\"display\",\"none\");\n } else {\n $('#userAnnotationsDiv').show('slow');\n $('#userAssertionsContainer').show(\"slow\");\n $('#userAnnotationsNav').css(\"display\",\"block\");\n }\n $('#userAnnotationsList').empty();\n\n var userAssertionStatus = jQuery.i18n.prop(\"user_assertions.\" + data.userAssertionStatus);\n $(\"#userAssertionStatus\").text(userAssertionStatus);\n\n for(var i=0; i < data.assertionQueries.length; i++){\n var $clone = $('#userAnnotationTemplate').clone();\n $clone.find('.issue').text(data.assertionQueries[i].assertionType);\n $clone.find('.user').text(data.assertionQueries[i].userName);\n $clone.find('.comment').text('Comment: ' + data.assertionQueries[i].comment);\n $clone.find('.created').text('Date created: ' + (moment(data.assertionQueries[i].createdDate).format('YYYY-MM-DD')));\n if(data.assertionQueries[i].recordCount > 1){\n $clone.find('.viewMore').css({display:'block'});\n $clone.find('.viewMoreLink').attr('href', OCC_REC.contextPath + '/occurrences/search?q=query_assertion_uuid:' + data.assertionQueries[i].uuid);\n }\n $('#userAnnotationsList').append($clone);\n $('#userAssertionsContainer').show(\"slow\");\n }\n\n var verifiedAssertions = [];\n var disableDelete = [];\n var enableDelete = [];\n\n $.each(data.userAssertions, function( index, userAssertion ) {\n\n var $clone = $('#userAnnotationTemplate').clone();\n\n // if the code == 50000, then we have verification - so don't display here\n if (userAssertion.code != 50000) {\n $clone.prop('id', \"userAnnotation_\" + userAssertion.uuid);\n $clone.find('.issue').text(jQuery.i18n.prop(userAssertion.name));\n $clone.find('.user').text(userAssertion.userDisplayName);\n $clone.find('.comment').text('Comment: ' + userAssertion.comment);\n $clone.find('.userRole').text(userAssertion.userRole != null ? userAssertion.userRole : '');\n $clone.find('.userEntity').text(userAssertion.userEntityName != null ? userAssertion.userEntityName : '');\n $clone.find('.created').text('Date created: ' + (moment(userAssertion.created, \"YYYY-MM-DDTHH:mm:ssZ\").format('YYYY-MM-DD HH:mm:ss')));\n if (userAssertion.userRole != null) {\n $clone.find('.userRole').text(', ' + userAssertion.userRole);\n }\n if (userAssertion.userEntityName != null) {\n $clone.find('.userEntity').text(', ' + userAssertion.userEntityName);\n }\n\n //if the current user is the author of the annotation, they can delete\n if(OCC_REC.userId == userAssertion.userId){\n $clone.find('.deleteAnnotation').css({display:'block'});\n $clone.find('.deleteAnnotation').attr('id', userAssertion.uuid);\n } else {\n $clone.find('.deleteAnnotation').css({display:'none'});\n }\n\n //display the verification button,\n $clone.find('.verifyAnnotation').css({display:'block'});\n $clone.find('.verifyAnnotation').attr('id', \"verifyAnnotations_\" +userAssertion.uuid);\n\n $clone.find(\".verifications\").hide();\n\n $('#userAnnotationsList').append($clone);\n } else {\n //this is a verification assertion, so it needs to be embedded in existing assertion\n verifiedAssertions.push(userAssertion);\n // if an assertion has a verification, disable the delete button\n if (disableDelete.indexOf(userAssertion.relatedUuid) < 0) {\n disableDelete.push(userAssertion.relatedUuid);\n }\n }\n });\n\n //display verified\n var sortedVerifiedAssertion = verifiedAssertions.sort(compareModifiedDate);\n for(var i = 0; i < sortedVerifiedAssertion.length; i++){\n\n var $clone = $('#userVerificationTemplate').clone();\n $clone.prop('id', \"userVerificationAnnotation_\" + sortedVerifiedAssertion[i].uuid);\n var qaStatusMessage = jQuery.i18n.prop(\"user_assertions.\" + sortedVerifiedAssertion[i].qaStatus);\n $clone.find('.qaStatus').text(qaStatusMessage);\n $clone.find('.comment').text(sortedVerifiedAssertion[i].comment);\n $clone.find('.userDisplayName').text(sortedVerifiedAssertion[i].userDisplayName);\n $clone.find('.created').text((moment(sortedVerifiedAssertion[i].created, \"YYYY-MM-DDTHH:mm:ssZ\").format('YYYY-MM-DD HH:mm:ss')));\n\n //add the verification, and show the table\n $('#userAnnotationsList').find('#userAnnotation_' + sortedVerifiedAssertion[i].relatedUuid + \" table.verifications tbody\").append($clone);\n $('#userAnnotationsList').find('#userAnnotation_' + sortedVerifiedAssertion[i].relatedUuid + \" table.verifications\").show();\n updateDeleteVerificationEvents(sortedVerifiedAssertion[i].relatedUuid)\n }\n\n for(var i = 0; i < disableDelete.length; i++) {\n var $cloneHeader = $('#userVerificationTemplate').clone();\n $cloneHeader.prop('id', \"userVerificationAnnotationHeader_\" + disableDelete[i]);\n $cloneHeader.find('.qaStatus').text(\"User Verification Status\");\n $cloneHeader.find('.comment').text(\"Comment\");\n $cloneHeader.find('.userDisplayName').text(\"Verified By\");\n $cloneHeader.find('.created').text(\"Created\");\n $cloneHeader.find('.deleteVerification').html('Delete this Verification');\n $cloneHeader.css({display: 'block'});\n ($cloneHeader).insertAfter('#userAnnotation_' + disableDelete[i] + ' .userVerificationClass .userVerificationTemplate:first')\n }\n\n for(var i = 0; i < data.userAssertions.length; i++){\n if ((data.userAssertions[i].code != 50000) && (disableDelete.indexOf(data.userAssertions[i].uuid) < 0)) {\n enableDelete.push (data.userAssertions[i].uuid);\n }\n }\n\n updateDeleteEvents(enableDelete, disableDelete);\n });\n}", "function refreshInteractiveElements(){\r\n $.logEvent('[dataVisualization.core.refreshInteractiveElements]');\r\n \r\n var interactiveTypeObj;\r\n \r\n $.each(dataVisualization.configuration.loadSequence,function(){\r\n interactiveTypeObj = this.id.split('-');\r\n \r\n if(typeof(window[this.id]) == 'object'){ \r\n // window[this.id].validateNow();\r\n \r\n // Re-draw the centre percentage value for all instances of donut charts\r\n //if(interactiveTypeObj[0] == 'donut'){\r\n // $('#' + this.id).donutChart('createCentreValue');\r\n //}\r\n }\r\n });\r\n }", "function updateCursorPosition() {\r\n var position = editor.getCursorPosition();\r\n // indicate cursor postion elements\r\n document.getElementById(\"cur-row\").innerText = position.row + 1;\r\n document.getElementById(\"cur-col\").innerText = position.column + 1;\r\n document.getElementById(\"all-lines\").innerText = editor.getSession().getLength();\r\n}", "function summarize(data) {\n if (view.viewFunctions.summarize) {\n var result = [],\n values = $scope.values,\n object = {\n value: 0,\n type: '',\n format: ''\n }\n\n if ($scope.summarize.length > 0) {\n result = $scope.summarize;\n }\n\n for (var i = 0; i < values.length; i++) {\n if (result.length !== values.length) {\n result[i] = object;\n object = {\n value: 0,\n type: '',\n format: ''\n };\n\n result[i].type = values[i].type;\n result[i].format = values[i].format;\n }\n\n for (var j = 0; j < data.length; j++) {\n if (values[i].type === 'digits') {\n var value = findMatch(data[j], values[i].matchValue);\n\n if (value !== null) {\n result[i].value += value;\n }\n } else {\n result[i] = {};\n }\n }\n }\n\n $scope.summarize = result;\n }\n }", "function addAutoFillAndCollapseMetaData() {\n filledRecsCnt === 0 ?\n entityObj.validationResults.autoFill = null :\n entityObj.validationResults.autoFill = {\n received: countRecrdsInObj(recrdsObj),\n filled: filledRecsCnt,\n collapsed: collapsedCnt,\n remaining: countRecrdsInObj(processedRcrds)\n }\n }", "function updateCalcInfo() {\n\tObject.keys(obj).forEach((element) => {\n\t\tif (hash == element) {\n\t\t\ttitle.innerHTML = obj[element].title;\n\t\t\tdescription.innerHTML = obj[element].description;\n\t\t\twhile(extraInput.firstChild) {\n\t\t\t\textraInput.removeChild(extraInput.lastChild)\n\t\t\t\t}\n\t\t\tif (obj[element].extras) {\n\n\t\t\t\tobj[element].extras()\n\t\t\t}\n\t\t\tcalcTypeElem.value = hash.substr(1);\n\t\t}\n\t})\n}", "function showAll() {\n vm.rangeNum = vm.fullList.length;\n }", "onEditComplete() {}", "onEditComplete() {}", "function fillWithValues(values) {\n tooltip.showHTML(getHTMLForValues(values));\n }", "function updateColors() {\n\tfor (var i=0; i<allTissues.length; i++){\n\t\tchangeFillColor(allTissues[i].tissue, allTissues[i].color);\n\t\t//console.log(allTissues[i].tissue+\" \"+allTissues[i].value+\" \"+allTissues[i].color);\n\t}\n\tif(searchByTable){\n\t\tgenerateSelectionTable();\n\t}\n}", "function showAllJSonFormatted(target, obj, inherited) {\n\n // - keyfield sets field width and float:left property\n // - valueField can be used for further styling\n\n /* show own properties, both enumerable and nonenumerable */\n\n var elem = document.getElementById(target);\n\n var found = [];\n var Props = Object.getOwnPropertyNames(obj);\n\n var table = '<table>';\n for (var prop in Props) {\n found.push(Props[prop]);\n table += \n '<tr><td class=\"keyfield\">' + Props[prop] +\n '</td><td> : </td><td class=\"valuefield\">' + obj[Props[prop]] + '</td></tr>';\n }\n /* show prototype's properties, both enumerable and nonenumerable */\n\n if (!(inherited === true)) {\n table += '</table>';\n elem.innerHTML = table;\n return;\n } \n else {\n var Props2 = Object.getOwnPropertyNames(obj.__proto__);\n for (var prop in Props2) {\n if (!(Props[prop] in found)) {\n table +=\n '<tr><td class=\"keyfield\">' + Props2[prop] +\n '</td><td class=\"top\"> : </td><td class=\"valuefield\">' + obj[Props2[prop]] + '</td></tr>'\n }\n }\n } \n table += '</table>';\n\n elem.innerHTML = table;\n //alert('at end');\n}", "function expand_and_populate(data)\n{\n\tset_initial_state('report_type', data['obj_type']);\n\tif (!is_populated && data['obj_type']) {\n\t\tsetTimeout(function() {expand_and_populate(data);}, 1000);\n\t\treturn;\n\t}\n\tvar reportObj = data;\n\tvar field_obj = new field_maps();\n\tvar tmp_fields = new field_maps3();\n\tvar field_str = reportObj['obj_type'];\n\tif (reportObj['objects']) {\n\t\tvar to_id = field_obj.map[field_str];\n\t\tvar from_id = tmp_fields.map[field_str];\n\t\t// select report objects\n\t\tfor (prop in reportObj['objects']) {\n\t\t\t$('#' + from_id).selectOptions(reportObj['objects'][prop]);\n\t\t}\n\t\t// move selected options from left -> right\n\t\tmoveAndSort(from_id, to_id);\n\t}\n\n\tif (data['standardreport']) {\n\t\tvar val = data['standardreport'][0];\n\t\tif ($('#standardreport').is(':visible')) {\n\t\t\t$('#standardreport option').each(function() {\n\t\t\t\tif ($(this).val() == val) {\n\t\t\t\t\t$(this).attr('selected', true);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tset_initial_state('report_type', reportObj['report_type']);\n\tshow_calendar(reportObj['report_period']);\n\n\tif (reportObj['report_name'] != undefined) {\n\t\tset_initial_state('report_name', reportObj['report_name']);\n\t}\n\n\tif (reportObj['report_period'] == 'custom') {\n\t\tstartDate = epoch_to_human(reportObj['start_time']);\n\t\tdocument.forms['summary_form'].cal_start.value = reportObj['cal_start'];\n\t\tdocument.forms['summary_form'].time_start.value = reportObj['time_start'];\n\t\tdocument.forms['summary_form'].start_time.value = format_date_str(startDate);\n\n\t\tendDate = epoch_to_human(reportObj['end_time']);\n\t\tdocument.forms['summary_form'].cal_end.value = reportObj['cal_end'];\n\t\tdocument.forms['summary_form'].time_end.value = reportObj['time_end'];\n\t\tdocument.forms['summary_form'].end_time.value = format_date_str(endDate);\n\t}\n\n\t// wait for lists to populate\n\tsetTimeout(\"remove_duplicates();\", 500);\n}", "function updateSumField(){\r\n var idForSumField = \"sumField\";\r\n\r\n // Create a new node for displaying the sum and the description text\r\n var sum = countSum();\r\n var sumLine = document.createElement(\"p\");\r\n sumLine.setAttribute(\"id\", idForSumField);\r\n var text = document.createTextNode(\"Sum of work to log: \"+sum);\r\n sumLine.appendChild(text);\r\n\r\n // Try to reach the existing sum field element\r\n // If exsting, replace it with the new one, else create it \r\n // below(/above) the table where the numbers reside.\r\n //\r\n var oldField = document.getElementById(idForSumField);\r\n if(oldField){\r\n oldField.parentNode.replaceChild(sumLine,oldField);\r\n }else{\r\n var theTable = getTheTable();\r\n //theTable.parentNode.insertBefore(sumLine, theTable); // inserting before\r\n theTable.parentNode.insertBefore(sumLine, theTable.nextSibling); // inserting after\r\n }\r\n}", "function populateTestSummary( locator, response ) {\n var content = '<span id=\"summary\">';\n content += '<span id=\"scenarioCount\" class=\"summary\">' + response.summary.total + ' Scenarios</span>';\n content += ' (<span id=\"scenarioCount\" class=\"summary pass\">' + response.summary.passed + ' Passed</span>';\n content += ', <span id=\"scenarioCount\" class=\"summary fail\">' + response.summary.failed + ' Failed</span>';\n content += ', <span id=\"scenarioCount\" class=\"summary skip\">' + response.summary.skipped + ' Skipped</span>)';\n content += '</span>';\n $(locator).html(content);\n}", "function CalculateSum() {\n var sumAll = 0;\n var skip0 = 0;\n $('b[name=\"miniSum\"]').each(function () {\n if ($(this).text() != \"\")\n sumAll += parseInt($(this).text().replace(/\\,/g, \"\"));\n $(this).text(numberWithCommas($(this).text()));\n if ($(this).text() == '0') {\n if (skip0 == 0)\n $(this).text('');\n else\n $(this).text('0');\n }\n skip0++;\n });\n var refNum = $.number(sumAll, 0, '.', ',');\n $(\"#spanSumAll\").text(refNum).trigger('change');\n}", "function refreshSummary() {\n getTraceSummary(minutes).then(function() {\n refreshTraceSummaryTable(minutes);\n });\n}", "function itShouldAppendValuesToASpreadsheet() {\n var spreadsheetId = helpers.createTestSpreadsheet();\n helpers.populateValues(spreadsheetId);\n var result = snippets.appendValues(spreadsheetId, 'Sheet1', 'USER_ENTERED', [\n ['A', 'B'],\n ['C', 'D']\n ]);\n var updates = result.updates;\n expectToEqual(updates.updatedRows, 2);\n expectToEqual(updates.updatedColumns, 2);\n expectToEqual(updates.updatedCells, 4);\n}", "function itShouldUpdateSpreadsheetValues() {\n var spreadsheetId = helpers.createTestSpreadsheet();\n var result = snippets.updateValues(spreadsheetId, 'A1:B2', 'USER_ENTERED', [\n ['A', 'B'],\n ['C', 'D']\n ]);\n expectToEqual(result.updatedRows, 2);\n expectToEqual(result.updatedColumns, 2);\n expectToEqual(result.updatedCells, 4);\n}", "onStoreUpdate({ source: store, changes }) {\n // If a grouping field is among the changes, StoreGroup#onDataChanged will\n // take care of the update by re-sorting.\n if (changes && store.groupers.find((grouper) => grouper.field in changes)) {\n return;\n }\n // only update summary when a field that affects summary is changed\n // TODO: this should maybe be removed, another column might depend on the value for its summary?\n let shouldUpdate = Object.keys(changes).some((field) => {\n const colField = this.grid.columns.get(field);\n // check existence, since a field not used in a column might have changed\n return Boolean(colField) && (Boolean(colField.sum) || Boolean(colField.summaries));\n });\n\n if (shouldUpdate) {\n this.grid.forceFullRefresh = true;\n }\n }", "async function updateSummary() {\n // batchLog.info('updateSummary');\n const summary = await Summary.findOne();\n if (_.isEmpty(summary)) {\n return;\n }\n const statusCnts = await Proposal.aggregate([{\n $group : {\n _id : '$status',\n count : {$sum : 1}\n }\n }]);\n\n const summaryObj = {\n total_proposals : 0,\n funded_proposals : 0,\n ongoing_proposals : 0,\n total_voters : 0\n };\n\n _.forEach(statusCnts, function(status) {\n if (status._id !== SEnum.PROPOSAL_STATUS_REJECTED) {\n summaryObj.total_proposals += status.count;\n }\n if (status._id === SEnum.PROPOSAL_STATUS_COMPLETED) {\n summaryObj.funded_proposals += status.count;\n }\n if (status._id === SEnum.PROPOSAL_STATUS_PENDING || status._id === SEnum.PROPOSAL_STATUS_ON_VOTE || status._id === SEnum.PROPOSAL_STATUS_FINISHED_VOTING ||\n status._id === SEnum.PROPOSAL_STATUS_CHECK_VOTE || status._id === SEnum.PROPOSAL_STATUS_CHECKED_VOTE ||\n status._id === SEnum.PROPOSAL_STATUS_APPROVED) {\n summaryObj.ongoing_proposals += status.count;\n }\n });\n summaryObj.total_voters = await VotingInfo.distinct('account').countDocuments();\n return Summary.updateOne({_id : summary._id}, {$set : summaryObj});\n}", "_schemaChanged() {\n //make sure the content is there first\n setTimeout(() => {\n let itemLabel = this.schema.items.itemLabel;\n if (this.schema && Array.isArray(this.schema.value)) {\n this.schema.value.forEach(val => {\n this.push(\"__headings\", val[itemLabel]);\n });\n }\n this.shadowRoot.querySelectorAll(\".item-fields\").forEach(item => {\n let index = item.getAttribute(\"data-index\"),\n propertyName = `${this.propertyPrefix}${this.propertyName}`,\n prefix = `${propertyName}.${index}`,\n //path = `${propertyName}.properties.${index}`,\n val = this.schema.value[index];\n //for each array item, request the fields frrom eco-json-schema-object\n this.dispatchEvent(\n new CustomEvent(\"build-fieldset\", {\n bubbles: false,\n cancelable: true,\n composed: true,\n detail: {\n container: item,\n path: propertyName,\n prefix: prefix,\n properties: this.schema.properties.map(prop => {\n let newprop = JSON.parse(JSON.stringify(prop));\n newprop.value = val[prop.name];\n return newprop;\n }),\n type: EcoJsonSchemaArray.tag,\n value: this.schema.value || []\n }\n })\n );\n });\n }, 0);\n }", "function update() {\n\t\tfilterName = $(\"#new_pipeline #filterName\");\n\t\trequestType = $(\"#new_pipeline #requestType\");\n\t\trequestRank = $(\"#new_pipeline #requestRank\");\n\t\tmakeTrace = $(\"#new_pipeline #makeTrace\");\n\t\ttips = $(\"#new_pipeline .validateTips\");\n\t\tallFields = $([]).add(filterName).add(requestType).add(requestRank).add(makeTrace);\n\t}", "function set_values_of_fluid_rows(div, vals) {\n var rows = div.children('div:not([style*=\"display:none\"])');\n var first_row = null;\n var default_rows = [];\n\n // Find first custom row and remove all additional rows if they have\n // a remove button. Otherwise, leave the row be.\n rows.each(function () {\n var row = $(this);\n if (get_custom_class(row).includes('_')) {\n if (first_row == null) {\n first_row = row;\n default_rows.push(row);\n } else {\n if (row.children('button').length > 0) {\n row.remove();\n } else {\n default_rows.push(row);\n }\n }\n }\n });\n\n var inputs = first_row.children('input');\n var add_btn = first_row.children('button');\n\n // Then, add the number of rows we need.\n for (var i = 0; i < vals.length; i++) {\n var j = 0;\n var val = vals[i];\n\n inputs.each(function () {\n $(this).val(val[j]);\n j++;\n });\n\n add_btn.click();\n }\n\n // while (default_rows.length < vals.length) {\n // add_btn.click();\n // var new_div = div.children('div:not([style*=\"display:none\"]):last');\n // default_rows.push(new_div);\n // }\n //\n // // Finally, populate the text inputs.\n // for (var i = 0; i < vals.length; i++) {\n // var row = default_rows[i];\n // var row_vals = vals[i];\n // var row_inputs = row.children('input');\n //\n // for (var j = 0; j < row_vals.length; j++) {\n // var input = row_inputs.eq(j);\n // var val = row_vals[j];\n //\n // if (val != null && val != '') {\n // input.val(val);\n // }\n // }\n // }\n}", "function eventDSEditOnLoad() {\n var form = EventEditForm.getForm();\n form.setValues(eventDS.getAt(0).data);\n}", "function theme_summary_table(table_id, data, data_type, urls, highlight, sort, report_id) {\n\n // Create reference to datatable\n var table = $('#' + table_id).dataTable();\n\n // Bail if datatable does not exist\n if ($('#' + table_id).val() == undefined)\n return;\n\n // Clear the table\n table.fnClearTable();\n\n // Add rows to the data table\n for (i = 0; i < data.length; i++) {\n var row = new Array();\n\n for (j = 0; j < data[i].length; j++) {\n // Converting to human readable (e.g. IP addresses) can mess up sorting.\n // Add hidden data that preserves the sort order.\n var hidden_item = '';\n\n if (data_type[j] == 'ip')\n hidden_item = '<span style=\"display: none\">' + data[i][j] + '</span>';\n else\n hidden_item = '';\n\n // Change item in table to a URL if specified\n var item = clearos_human_readable(data[i][j], data_type[j]);\n\n if (urls[j])\n item = '<a href=\"' + urls[j] + item + '\">' + item + '</a>';\n\n row.push(hidden_item + item);\n }\n\n table.fnAddData(row);\n }\n\n // Sort\n table.fnSort( [ [highlight, sort] ] );\n table.fnAdjustColumnSizing();\n\n // TODO: review\n // For data tables that are linked to charts, we provide a callback.\n // Whenever a datatable is sorted, the callback is triggered.\n if (report_id != null)\n table.bind('sort', function () { clearos_report_trigger( 'Sort', table, report_id ); })\n}", "function makeHtmlFromEsummaryJson(esummaryJson) { \n //Given a jsonObj from eSummary, generates html <li> for display of Docsummary\n //The jsonOBj could be for one or multiple eSummaries\n // jsonObj passed from jQuery.get(url, f())\n\n //USAGE:\n //domElementIdHtml += makeHtmlFromEsummaryJson(esummaryJson);\n \n \n //TO DO Take code from getDocSumAttributesFromJson (id)\n var esummaryResult = esummaryJson.result; //main json obj containing uids list and summary for each uid\n var uidsList = esummaryResult.uids; // array of all uids in the jsonObj from eSummary\n //(.result.uids is from the ncbi esummary json)\n //console.log(\"uidsList: \" + uidsList.join()); //debug\n \n citation_html =\"\";\n \n uidsList.forEach(function(uid) {\n //Go through each uid and extract the attributes to make html\n //console.log(\"for-each: \" + uid); //debug\n \n var authors = [];\n esummaryResult[uid]['authors'].forEach(function(author){\n authors.push([author.name]); \n }) // forEach author\n //console.log(\"AUTTHORS: \" + authors); //debug\n \n var authorFirst = esummaryResult[uid]['authors'][0]['name'];\n var title = esummaryResult[uid]['title']; //console.log(title);\n var pubdate = esummaryResult[uid]['pubdate'];\n var year = pubdate.match(/^\\d\\d\\d\\d/);\n \n var issue = (esummaryResult[uid]['issue']);\n issue = (issue) ? \"(\" + issue + \")\":\"\"; //null if no issue else with parenthesis (issue)\n \n var pages = esummaryResult[uid]['pages'];\n var sortfirstauthor = esummaryResult[uid]['sortfirstauthor'];\n var source = esummaryResult[uid]['source']; //console.log(source);\n var volume = esummaryResult[uid]['volume']; //console.log(volume);\n \n var linkToUid = \"<a href=\\\"https://www.ncbi.nlm.nih.gov/pubmed/\" + uid + \"\\\"\" + \" target=\\\"_blank\\\">\" + title + \"</a>\";\n \n var citation = (authors.join(\", \") + \". \" + \"<b>\" + year + \"</b>\" + \". \" + linkToUid + \" \" + \"<strong>\" + source + \" \" + volume + issue + \":\" + pages + \"</strong>\" + \".\" + \" (\" + uid + \")\");\n var citation_li = \"<li>\" + citation + \"</li><br/>\"; // + \"\\n\\n\";\n //Creates like:\n //Dash S, Campbell JD, Cannon EK, Cleary AM, ......, Farmer AD, Cannon SB. 2016. Legume information system (LegumeInfo.org): a key component of a set of federated data resources for the legume family. Nucleic Acids Res 44(D1):D1181-8. (<a href=\"https://www.ncbi.nlm.nih.gov/pubmed/26546515\" target=\"_blank\">26546515</a>)\n //console.log(\"citation_li: \" + citation_li); //debug\n citation_html += citation_li; \n \n }) //uidsList.forEach\n \n //console.log(\"citation_html: \" + citation_html); //debug\n return citation_html; // Returns XMLHttpRequest {}\n \n} //function makeHtmlFromEsummaryJson(EsummaryJson)", "mergeCells() {\n if (this.owner.isReadOnlyMode || !this.owner.isDocumentLoaded) {\n return;\n }\n if (!isNullOrUndefined(this.viewer) && !this.selection.isEmpty) {\n this.mergeSelectedCellsInTable();\n }\n }", "function editableCells(){\n var numOrders =0\n var numOrdersInNew=0\n var numOrdersInAR=0\n var numOrdersInGVP=0\n var numOrdersInDDR=0\n var numOrdersInCD=0\n var numOrdersInDP=0\n var numOrdersInCompleted=0\n table.rows().every( function(rowIdx, tableLoop, rowLoop){\n numOrders+=1\n var rowData = this.data()\n var qNum =rowData[dataNames['qNum']]\n var rowStatus=rowData[dataNames['status']]\n var isQueried = rowData[dataNames['isQueried']]\n var rowReg=rowData[dataNames['regNum']]\n var rowChassis=rowData[dataNames['chassis']]\n var rowADD=rowData[dataNames['deliveryDate']]\n var rowDoR=rowData[dataNames['dateOfRegistration']]\n var rowAFRL=rowData[dataNames['afrl']]\n var rowInvoice=rowData[dataNames['invoice']]\n var rowDeliveryNote=rowData[dataNames['deliveryNote']]\n var rowOrderForm = rowData[dataNames['moreInfo']]\n\n var todayDate = new Date()\n var orderDateSplit = rowData[dataNames['orderDate']].split(\"/\") //as it cannot convert dd/mm/yyyy to a date\n var orderDate= new Date(orderDateSplit[2],orderDateSplit[1]-1,orderDateSplit[0])\n var dateDifference =(todayDate-orderDate)/(1000*3600*24) //how old the order is in days\n\n \n table.cell(rowIdx,moreInfoIndex).data(\"<button onclick='displayOrderForm(\\\"\"+qNum+\"\\\",\\\"\"+rowOrderForm+\"\\\")'>Order Form</button>\")\n if(rowData[dataNames['orderNum']]==null){\n table.cell(rowIdx, orderNumIndex).data(\"<input placeholder='Enter Order Number' onchange='editOrderNum(\\\"\"+qNum +\"\\\",this.value,\\\"\"+rowIdx+\"\\\")'></input>\")\n }\n if(rowStatus==statusNames['new']){\n numOrdersInNew+=1\n if (dateDifference>=1){ //if order is more than one day old\n $('tbody tr').eq(rowLoop).find('td').eq(0).addClass('overdue')\n }\n table.cell(rowIdx, etaIndex).data(\"<input onblur='changeETA(\\\"\"+qNum +\"\\\",this.value)' type='date'></input>\")\n \n table.cell(rowIdx,isQueriedIndex).data(\"<button onclick='displayQueryScreen(\\\"\"+qNum+\"\\\")'>Add/Show Queries</button>\")\n if(isQueried){\n table.cell(rowIdx, confirmOrderIndex).data('Curremtly Queried')\n } else{\n table.cell(rowIdx, confirmOrderIndex).data(\"<button onclick='confirmOrder(\\\"\"+qNum +\"\\\",\\\"\"+rowIdx+\"\\\")'>Confirm</button>\")\n }\n \n //remove the line below\n // table.cell(rowIdx, confirmOrderIndex).data(\"<button onclick='confirmOrder(\\\"\"+qNum +\"\\\",\\\"\"+rowIdx+\"\\\")'>Confirm</button>\")\n\n //highlight cells red\n $('tbody tr').eq(rowLoop).find('td').eq(confirmOrderIndex).addClass('incomplete')\n }\n else if (rowStatus == statusNames['AR']){\n numOrdersInAR+=1\n if(rowReg==\"\"){\n table.cell(rowIdx, regNumIndex).data(\"<input placeholder='Enter Registration' onchange='changeReg(\\\"\"+qNum +\"\\\",this.value,\\\"\"+rowIdx+\"\\\")'></input>\")\n //highlight cell red\n $('tbody tr').eq(rowLoop).find('td').eq(regNumIndex).addClass('incomplete')\n }\n else{\n //highlight cell green\n $('tbody tr').eq(rowLoop).find('td').eq(regNumIndex).addClass('complete')\n }\n \n if(rowChassis==undefined){\n table.cell(rowIdx, chassisIndex).data(\"<input placeholder='Enter Chassis' onchange='changeChassis(\\\"\"+qNum +\"\\\",this.value,\\\"\"+rowIdx+\"\\\")'></input>\")\n //highlight cell red\n $('tbody tr').eq(rowLoop).find('td').eq(chassisIndex).addClass('incomplete')\n //once both chassis and reg are uploaded, status should change to delivery date requested\n }\n else{\n //highlight cell green\n $('tbody tr').eq(rowLoop).find('td').eq(chassisIndex).addClass('complete')\n }\n }\n else if(rowStatus==statusNames['GVP']){\n numOrdersInGVP+=1\n }\n else if (rowStatus==statusNames['DDR']){\n numOrdersInDDR+=1\n table.cell(rowIdx, deliveryDateIndex).data(\"<input onblur='addADD(\\\"\"+qNum +\"\\\",this.value)' type='date' style='width: 100px'></input><button onclick='confirmADD(\\\"\"+qNum+\"\\\",\\\"\"+rowIdx+\"\\\")'>Ok</button>\")\n $('tbody tr').eq(rowLoop).find('td').eq(deliveryDateIndex).addClass('incomplete')\n table.cell(rowIdx, deliveryDetailsIndex).data(\"<button onclick='viewDeliveryDetails(\\\"\"+qNum+\"\\\")'>View Delivery Details</button>\")\n table.cell(rowIdx, atpIndex).data(\"<button onclick='viewATP(\\\"\"+qNum+\"\\\")'>View ATP</button>\")\n }\n else if (rowStatus==statusNames['CD']){\n numOrdersInCD+=1\n if(rowDoR==false){\n table.cell(rowIdx, dateOfRegistrationIndex).data(\"<input onblur='addDoR(\\\"\"+qNum +\"\\\",this.value)' type='date'></input><button onclick='confirmDoR(\\\"\"+qNum+\"\\\",\\\"\"+rowIdx+\"\\\")'>Ok</button>\")\n $('tbody tr').eq(rowLoop).find('td').eq(dateOfRegistrationIndex).addClass('incomplete')\n }\n else{\n $('tbody tr').eq(rowLoop).find('td').eq(dateOfRegistrationIndex).addClass('complete')\n }\n if(rowAFRL==false){\n //table.cell(rowIdx, afrlIndex).data(\"<input type='file' onchange='uploadAFRL(\\\"\"+qNum+\"\\\",event)'></input>\")\n table.cell(rowIdx, afrlIndex).data(\"<button onclick='uploadFile(\\\"AFRL\\\",\\\"\"+qNum+\"\\\")'>Upload AFRL</button>\")\n $('tbody tr').eq(rowLoop).find('td').eq(afrlIndex).addClass('incomplete')\n }\n else{\n $('tbody tr').eq(rowLoop).find('td').eq(afrlIndex).addClass('complete')\n table.cell(rowIdx, afrlIndex).data('<i class=\"fas fa-check\"></i>')\n }\n if(rowInvoice==false){\n //table.cell(rowIdx, invoiceIndex).data(\"<input type='file' onchange='uploadInvoice(\\\"\"+qNum+\"\\\",event)'></input>\")\n table.cell(rowIdx, invoiceIndex).data(\"<button onclick='uploadFile(\\\"Invoice\\\",\\\"\"+qNum+\"\\\")'>Upload Invoice</button>\")\n $('tbody tr').eq(rowLoop).find('td').eq(invoiceIndex).addClass('incomplete')\n }\n else{\n $('tbody tr').eq(rowLoop).find('td').eq(invoiceIndex).addClass('complete')\n table.cell(rowIdx, invoiceIndex).data('<i class=\"fas fa-check\"></i>')\n }\n if(rowDeliveryNote==\"\"){\n //table.cell(rowIdx, 16).data(\"<input type='file' onchange='uploadDN(\\\"\"+qNum+\"\\\",event)'</input>\")\n table.cell(rowIdx, deliveryNoteIndex).data(\"<button onclick='uploadFile(\\\"Delivery Note\\\",\\\"\"+qNum+\"\\\")'>Upload Delivery Note</button>\")\n $('tbody tr').eq(rowLoop).find('td').eq(deliveryNoteIndex).addClass('incomplete')\n }\n else{\n $('tbody tr').eq(rowLoop).find('td').eq(deliveryNoteIndex).addClass('complete')\n table.cell(rowIdx, deliveryNoteIndex).data('<i class=\"fas fa-check\"></i>')\n }\n table.cell(rowIdx, deliveryDetailsIndex).data(\"<button onclick='viewDeliveryDetails(\\\"\"+qNum+\"\\\")'>View Delivery Details</button>\")\n \n }\n else if(rowStatus==statusNames['DP']){\n numOrdersInDP+=1\n table.cell(rowIdx, deliveryDetailsIndex).data(\"<button onclick='viewDeliveryDetails(\\\"\"+qNum+\"\\\")'>View Delivery Details</button>\")\n }\n else if (rowStatus==statusNames['completed']){\n numOrdersInCompleted+=1\n }\n })\n $('#tabNum0').text(numOrders)\n $('#tabNum1').text(numOrdersInNew)\n $('#tabNum2').text(numOrdersInAR)\n $('#tabNum3').text(numOrdersInGVP)\n $('#tabNum4').text(numOrdersInDDR)\n $('#tabNum5').text(numOrdersInCD)\n $('#tabNum6').text(numOrdersInDP)\n $('#tabNum7').text(numOrdersInCompleted)\n}", "function fill_data_for_state(data) {\n\n fill_values(\"pop\",data.summary_info.state_population*1000000);\n // For ui\n $('#pop_val').text(usFormat(data.summary_info.state_population*1000000));\n\n fill_values(\"total_infected\",parseInt(data.summary_info.cases)); \n // For ui\n $('#total_infected_val').text(usFormat(data.summary_info.cases));\n\n fill_values(\"non_tracked_factor\",default_non_tracked_factor);\n \n // Case Growth (if<=1, we put 2)\n fill_values(\"new_case_growth_per_day\",parseFloat(data.summary_info.cg_last)<=1?2:data.summary_info.cg_last);\n \n // Mortality Rate (if<=.5, we put .6)\n fill_values(\"mortality_rate\",parseFloat(data.summary_info.mortality)<=.5?.6:data.summary_info.mortality);\n \n fill_values(\"non_tracked_factor\",default_non_tracked_factor);\n fill_values(\"herd_immunity_threshold\",default_herd_immunity_treshold);\n\n \n $('input[name=last_day_of_data]').val(dateFormat(data.summary_info.state_data_last_updated)); \n $('input[name=current_dead]').val(data.summary_info.deaths);\n}", "function loadEdit()\n{\n // emit debugging information\n if (false && debug.toLowerCase() == 'y')\n traceAlert(\"editIndivid.js:loadEdit: \" +\n location.pathname + location.search);\n\n // if this is invoked for a completely new individual the\n // heading is meaningless, set up to update it on the fly\n let titleElement = document.getElementById('title');\n let title = titleElement.innerHTML.trim();\n // if there is only one space prior to the date range then there is\n // no name information and a date range containing only an m-dash\n // is an empty date range\n updateTitle = title.substring(title.length - 3) == \"(\\u2014)\" &&\n (title.match(/ /g)||[]).length <= 1;\n // if updateTitle is true then titlePrefix is whatever text is present\n // preceding the empty date range\n titlePrefix = title.substring(0, title.length - 3);\n\n document.body.onresize = onWindowResize;\n\n let idir = 0;\n let marriagesButton = document.getElementById('Marriages');\n let parentsButton = document.getElementById('Parents');\n\n // loop through arguments passed to script\n for(let key in args)\n { // loop through all arguments\n let value = args[key];\n switch(key.toLowerCase())\n {\n case 'id':\n case 'idir':\n { // request to edit an existing individual\n // note that this requires that elements with names\n // id or idir must precede the element with\n // name parentsIdmr within the invoking request or page\n parmIdir = parseInt(value);\n break;\n } // request to edit an existing individual\n\n case 'idcr':\n { // request to edit an existing child\n if (marriagesButton)\n marriagesButton.disabled = true;\n if (parentsButton)\n parentsButton.disabled = true;\n break;\n } // request to edit an existing child\n\n case 'rowid':\n { // request to edit a spouse\n if (marriagesButton)\n marriagesButton.disabled = true;\n break;\n } // request to edit a spouse\n\n case 'parentsidmr':\n { // request to add a new child\n parentsIdmr = parseInt(value);\n if (marriagesButton)\n marriagesButton.disabled = true;\n if (parentsButton)\n parentsButton.disabled = true;\n break;\n } // request to add a new child\n\n case 'testsubmit':\n case 'debug':\n { // debug by submitting request rather than using AJAX\n if (value.toUpperCase() == 'Y')\n {\n testSubmit = true;\n debug = 'Y';\n alert('editIndivid.js: loadEdit: ' +\n 'testSubmit set to true for ' + key + '=' + value);\n }\n break;\n } // debug by submiting\n } // action depends upon parameter name\n } // loop through parameters\n\n document.body.onkeydown = eiKeyDown;\n\n for (let fi = 0; fi < document.forms.length; fi++)\n { // loop through all forms\n let form = document.forms[fi];\n\n // set action methods for form as a whole\n if (form.name == 'indForm')\n { // main form\n if (!testSubmit)\n {\n form.onsubmit = validateForm;\n }\n else\n console.log('editIndivid.js: loadEdit: 637 testSubmit is true');\n form.onreset = resetForm;\n form.setIdar = setIdar;\n\n // callback from editMarriages.php\n form.marriageUpdated = marriageUpdated;\n form.setIdmrPref = setIdmrPref;\n form.setParentsPref = setParentsPref;\n\n // callback from editEvent.php\n form.eventFeedback = eventFeedback;\n } // main form\n\n // activate the dynamic functionality of form elements\n activateElements(form);\n } // loop through all forms\n\n // set up refresh action\n if (parmIdir === null)\n {\n parmIdir = 0;\n newSearch = \"?idir=\" + idir +\n \"&\" + location.search.substring(1);\n }\n\n if (window.navigator)\n { // navigator object defined\n if (/MSIE (\\d+\\.\\d+);/.test(window.navigator.userAgent))\n { // test for MSIE x.x; \n ie = true;\n ieversion = new Number(RegExp.$1) // capture x.x portion\n if (ieversion < 9)\n alert (\"editIndivid.js: loadEdit: Running under IE version \" +\n ieversion);\n } // test for MSIE x.x; \n } // navigator object defined\n else\n alert (\"editIndivid.js: loadEdit: navigator object not defined\");\n\n hideRightColumn();\n\n}", "function DisplayData(itemToEdit) {\n\tvar result = null;\n //put data into the fields\n document.getElementById(\"txtPROD_GROUP\").value = itemToEdit.Prod_group;\n\tdocument.getElementById(\"txtPROD_GROUP\").style.backgroundColor = mDefaultBackground;\n\t//if we have a change method, let's call it\n\t\n document.getElementById(\"txtGROUP_DESC\").value = itemToEdit.Group_desc;\n\tdocument.getElementById(\"txtGROUP_DESC\").style.backgroundColor = mDefaultBackground;\n\t//if we have a change method, let's call it\n\t\n\n //disable key fields\n document.getElementById(\"txtPROD_GROUP\").disabled = true;\n\n //focus the first page\n document.getElementById(\"txtGROUP_DESC\").focus(); \n document.getElementById(\"txtGROUP_DESC\").select(); \n}", "function setSummaryFromStore() {\n document.getElementById(\"name_disp\").innerHTML =\n \"Name: \".bold() +\n store.get(\"first_name_text\") +\n \" \" +\n store.get(\"last_name_text\");\n document.getElementById(\"email_disp\").innerHTML =\n \"Email: \".bold() + store.get(\"email_text\");\n document.getElementById(\"phone_number_disp\").innerHTML =\n \"Phone Number: \".bold() + store.get(\"phone_number_text\");\n\n document.getElementById(\"hoodie_disp\").innerHTML =\n \"Type: \".bold() +\n setSummaryPriceText(\n store.get(\"settings\")[9][1],\n \"type\",\n store.get(\"settings\")[0][1]\n );\n document.getElementById(\"crewneck_disp\").innerHTML =\n \"Type: \".bold() +\n setSummaryPriceText(\n store.get(\"settings\")[10][1],\n \"type\",\n store.get(\"settings\")[1][1]\n );\n document.getElementById(\"green_disp\").innerHTML =\n \"Color: \".bold() +\n setSummaryPriceText(\n store.get(\"settings\")[11][1],\n \"color\",\n store.get(\"settings\")[2][1]\n );\n document.getElementById(\"gray_disp\").innerHTML =\n \"Color: \".bold() +\n setSummaryPriceText(\n store.get(\"settings\")[12][1],\n \"color\",\n store.get(\"settings\")[3][1]\n );\n\n document.getElementById(\"size_disp\").innerHTML =\n \"Size: \".bold() + store.get(\"size\");\n\n document.getElementById(\"front_disp\").innerHTML =\n \"Front: \".bold() +\n setSummaryPriceText(\n store.get(\"settings\")[13][1],\n \"front_text\",\n store.get(\"settings\")[4][1]\n );\n document.getElementById(\"left_arm_disp\").innerHTML =\n \"Left Arm: \".bold() +\n setSummaryPriceText(\n store.get(\"settings\")[14][1],\n \"left_arm_text\",\n store.get(\"settings\")[5][1]\n );\n document.getElementById(\"right_arm_disp\").innerHTML =\n \"Right Arm: \".bold() +\n setSummaryPriceText(\n store.get(\"settings\")[15][1],\n \"right_arm_text\",\n store.get(\"settings\")[6][1]\n );\n document.getElementById(\"back_disp\").innerHTML =\n \"Back: \".bold() +\n setSummaryPriceText(\n store.get(\"settings\")[16][1],\n \"back_text\",\n store.get(\"settings\")[7][1]\n );\n document.getElementById(\"comment_disp\").innerHTML =\n \"Additional Information: \".bold() + store.get(\"comment_text\");\n\n if (store.get(\"type\") === \"hoodie\") {\n document.getElementById(\"hood_disp\").innerHTML =\n \"Hood: \".bold() +\n setSummaryPriceText(\n store.get(\"settings\")[17][1],\n \"hood_text\",\n store.get(\"settings\")[8][1]\n );\n\n document.getElementById(\"hoodie_disp\").style.display = \"auto\";\n document.getElementById(\"hood_disp\").style.display = \"auto\";\n document.getElementById(\"crewneck_disp\").style.display = \"none\";\n } else {\n document.getElementById(\"crewneck_disp\").style.display = \"auto\";\n document.getElementById(\"hoodie_disp\").style.display = \"none\";\n document.getElementById(\"hood_disp\").style.display = \"none\";\n }\n\n if (store.get(\"color\") === \"green\") {\n document.getElementById(\"green_disp\").style.display = \"auto\";\n document.getElementById(\"gray_disp\").style.display = \"none\";\n } else {\n document.getElementById(\"gray_disp\").style.display = \"auto\";\n document.getElementById(\"green_disp\").style.display = \"none\";\n }\n}", "function updateGrid() {\n grid.innerHTML = \"\";\n createGrid(range.value);\n}", "function populateEditFields($row) {\n var url = siteUrl + 'meme/' + $row.data('row-id'),\n method = 'GET';\n \n $editModal.find('input').val('').prop('disabled', true);\n $editModal.find('select').val('f').prop('disabled', true);\n $editModal.find('button').prop('disabled', true);\n $editModal.find('img').attr('src', '').addClass('hidden');\n \n $.ajax({'url': url, 'type': method, 'dataType': 'json'})\n .done(function (data) {\n var tags = [], i = 0, length = data.tags.length;\n \n for (i; i < length; i++) {\n tags.push(data.tags[i].name);\n }//end for\n \n $('#meme-edit-name').val(data.name);\n $('#meme-edit-toptemplate').val(data.top_text_template);\n $('#meme-edit-bottomtemplate').val(data.bottom_text_template);\n $('#meme-edit-tags').val(tags.join(' '));\n $('#meme-edit-hidden').val((data.is_hidden) ? 't' : 'f');\n $('#meme-edit-image').attr('src', data.thumbnail_data).removeClass('hidden');\n \n $editModal.find('input').prop('disabled', false);\n $editModal.find('select').prop('disabled', false);\n $editModal.find('button').prop('disabled', false);\n })\n .fail(function () {\n $editModal.modal('hide');\n bootbox.alert('There was a problem getting the meme data.');\n });\n }//end populateEditFields()", "function populateDataForEdit(selectedrowid)\n\t\t{\n\t\t\tvar table = $(\"#tableSagRod tbody\");\n\t\t\ttable.find('tr').each(function (i) \n\t\t {\n\t\t var $tds = $(this).find('td'), \n\t\t\t\t rowid = $tds.eq(1).text();\n\t\t \n\t\t if(rowid == selectedrowid)\n\t\t {\n\t\t \teditRowNo = selectedrowid;\t\t \t\t\t \t\n\t\t \t \n\t var\tShape = $tds.eq(2).text(),\n\t Dia = $tds.eq(3).text(),\n\t MaterialGrade = $tds.eq(4).text(),\n\t Length = $tds.eq(5).text(),\n\t Quantity = $tds.eq(6).text(),\n\t MemberWeightLbs = $tds.eq(7).text(),\n\t MemberWeightTons = $tds.eq(8).text(),\n\t ReferenceDRawing = $tds.eq(9).text(),\n\t LenghtInFeet = $tds.eq(10).text(),\n\t LengthInInch = $tds.eq(11).text(),\n\t LengthInFraction = $tds.eq(12).text();\n\t\t \t\t\t \t\n\t\t \t$('#txtShape').val(Shape);\n\t\t \t\n\t\t \t$('#drpBoltDia').val(getOptId('drpBoltDia', Dia.replace('\"',''))).change();\t\n\t\t \t\n\t\t \t$('#drpMaterialGrade').val(getOptId('drpMaterialGrade', MaterialGrade)).change();\t\t\t \t\n\t\t \t$('#txtQuantity').val(Quantity);\n\t\t \t$('#txtLengthInFeet').val(LenghtInFeet);\n\t\t \t\n\t\t \t$('#drpLengthInInch').val(getOptId('drpLengthInInch', LengthInInch));\n\t\t \t$('#drpLengthInFraction').val(getOptId('drpLengthInFraction', LengthInFraction));\n\t\t \t\t\t \t\n\t\t \tvar drawings = ReferenceDRawing.split(\",\");\t\t\n\t\t \t$(\"#drpReferenceDrawing\").val(drawings).trigger(\"change\");\t\n\t\t \t\n\t\t \t\n\t\t }\n\t\t });\n\t\t\t\n\t\t}", "function RenderGrid(gridSettings) {\n $('#MainDiv').html('<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"display\" id=\"DataGrid\"></table>');\n oTable = $('#DataGrid').dataTable(gridSettings);\n $('td', oTable.fnGetNodes()).editable('/EditTable/' + objGrid_Main.Config.tblToUpdate, {\n \"callback\": function (sValue, y) {\n if (sValue) var jsonResp = JSON.parse(sValue);\n if (jsonResp.ErrorMsg) { alert(jsonResp.ErrorMsg) } else {\n var aPos = oTable.fnGetPosition(this);\n oTable.fnUpdate(jsonResp.NewValue, aPos[0], aPos[2]); //0-Eilute,1-St atemus pakavotus,2-St su pakavotais\n gridSettings.aaData[aPos[0]][aPos[2]] = jsonResp.NewValue; //Isimenam pakeitima ir i masyva\n }\n },\n \"submitdata\": function (value, settings) {\n var aPos = oTable.fnGetPosition(this);\n var Col = objGrid_Main.Head[aPos[2]]; //Stulpelio pavadinimo suradimas pagal st indeksa\n // /* Visų tos eilutės reikšmių suradimas */\n var aData = oTable.fnGetData(aPos[0]);\n var id = aData[0]//id suradimas. Id visada rasomi pirmam stulpelyje [0]\n var NewValue = aData[aPos[2]]\n return { \"FieldName\": Col, \"id\": id, \"NewValue\": value };\n },\n \"height\": \"14px\"\n // \"cancel\": \"No\",\n // \"submit\": \"Ok\",\n // \"tooltip\": \"Spragtelėti norint keisti\",\n // \"onblur\": \"submit\"\n });\n\n //-------------------------------------------------------\n // $('#DataGrid tbody td').hover(function () { Ciotkai highlitina cele\n // $(this).addClass('highlighted');\n // }, function () {\n // var nTrs=oTable.fnGetNodes();\n // $('td.highlighted', nTrs).removeClass('highlighted');\n // });\n //-------------------------------------------------------\n // $('#DataGrid tbody tr').hover(function () {\n // //alert(\"Here we go!\");\n // //$(this).toggleClass('row_selected');\n // $(this).addClass('highlighted');\n // }, function () {\n // var nTrs=oTable.fnGetNodes();\n // $('td.highlighted', nTrs).removeClass('highlighted');\n // });\n // //-------------------------------------------------------\n $('#DataGrid tbody tr').live('click', function () {\n var aData = oTable.fnGetData(this);\n var iId = aData[2];\n $('tr.row_selected').removeClass('row_selected');\n //gaiSelected[gaiSelected.length++]=iId;\n // if(jQuery.inArray(iId, gaiSelected)===-1) {\n // gaiSelected[gaiSelected.length++]=iId;\n // }\n // else {\n // gaiSelected=jQuery.grep(gaiSelected, function (val) {\n // return val!=iId;\n // });\n //alert(gaiSelected);\n // }\n // // $(this).removeClass('row_selected');\n $(this).toggleClass('row_selected');\n });\n //-------------------------------------------------------\n $(\"#DataGrid_filter input[type=text]\")[0].focus();\n //-------------------------------------------------------\n}", "function dataSummaries(data,title,location) {\n $(location).append(\"<span>\" + title + \": \" + data + \"</span><br/>\");\n }" ]
[ "0.75905913", "0.75905913", "0.7580197", "0.7521105", "0.73072886", "0.6594714", "0.57314813", "0.5653535", "0.55813056", "0.55471015", "0.5448848", "0.5430851", "0.54249316", "0.54189384", "0.5395011", "0.5377594", "0.53286415", "0.5327642", "0.52212805", "0.5168593", "0.5167344", "0.5149012", "0.51225764", "0.51121217", "0.5102147", "0.5085513", "0.50850105", "0.5084859", "0.5078284", "0.5042633", "0.49858525", "0.49854204", "0.49735278", "0.49462634", "0.49456728", "0.493539", "0.49121064", "0.49057782", "0.48821008", "0.48759538", "0.48734486", "0.4865534", "0.486003", "0.4833507", "0.4810762", "0.48007816", "0.4799169", "0.47970495", "0.47933286", "0.47910142", "0.47873357", "0.47811434", "0.4777924", "0.47777167", "0.47694883", "0.4769289", "0.47656184", "0.4765043", "0.47559768", "0.4750012", "0.47482318", "0.4746884", "0.4745919", "0.4745593", "0.47367206", "0.47349408", "0.4731757", "0.47229454", "0.47166574", "0.4711896", "0.4711896", "0.47113082", "0.47038996", "0.47011214", "0.4692919", "0.46911976", "0.46833116", "0.46824515", "0.46741566", "0.46733236", "0.46725714", "0.46692792", "0.46690434", "0.46633327", "0.46625108", "0.4648979", "0.4646497", "0.46406525", "0.46351063", "0.46329975", "0.46320203", "0.46300927", "0.46299076", "0.46287274", "0.4628096", "0.4622264", "0.4618978", "0.4604405", "0.4603532", "0.46026587" ]
0.7550771
3
POST User in DB
function addNewUser(user){ fetch("https://students-3d096.firebaseio.com/.json", { method:"POST", headers: { "Content-type": "application/json" }, body: JSON.stringify(user) }) .then(res => res.json()) .then(data => { users.push({...user, id: data.name}); showUsersInfo(users); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function postUser(req, res) {\n User.create({\n name: req.body.name,\n email: req.body.email,\n password: req.body.password\n },\n function (err, user) {\n if (err) return res.status(500).send(\"There was a problem adding the information to the database.\");\n res.status(200).send(user);\n });\n}", "static async onPost(req, res) {\n const { username, password } = req.body\n\n let userModel = new User({\n username: username,\n password: password,\n role: \"Staff\",\n })\n\n try {\n const savedUser = await userModel.save()\n return res.json(\"added: \" + savedUser)\n } catch (err) {\n console.log(err)\n return res.status(400).json(err)\n }\n }", "newUser(req, res, next) {\n // EXTRACT FORM DATA\n const { username, email, password } = req.body;\n\n // INSERT USER DATA INTO AN OBJECT\n let newUser = { username, email, password };\n\n // USE MODEL TO REGISTER A NEW USER\n User.addUser(newUser)\n .then(user => {\n res.status(201).json({\n success: true,\n message: 'User registered',\n user: {\n id: user.id,\n username: user.username,\n email: user.email\n }\n });\n })\n .catch(err => console.error(err));\n }", "function post_user(name, sub) {\n var key = datastore.key(USER);\n const new_user = { \"name\": name, \"sub\": sub };\n return datastore.save({ \"key\": key, \"data\": new_user }).then(() => { return key })\n}", "function post(req, res) {\n // New model\n let user = new model();\n // Params\n const body = req.body;\n // See params TODO Temporal\n console.log(body);\n user.control_number = body.control_number;\n user.password = body.password;\n user.role_id = body.role_id;\n // Create connection\n const conecction = mysql.createConnection({\n host: \"localhost\",\n user: \"root\",\n password: \"\",\n database: \"cafetecdb\"\n });\n conecction.connect(function(err) {\n // Connection Failed\n if (err) res.status(200).send({\"conecction\": \"Fallo en la conexión con la base de datos.\"});\n // Post user\n conecction.query(sql.post,[user.control_number,user.password,user.role_id], function (err, result) {\n // if error\n if(err){res.status(200).send(err);}\n // if not\n else{res.status(200).send(result);}\n });\n // End connection\n conecction.end();\n });\n}", "function postUser(user_data) {\n console.log(\"Hello Newman\")\n console.log(user_data)\n fetch(allUsersUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Accept': 'application/json'\n },\n body: JSON.stringify({\n \"name\": user_data.name.value,\n \"age\": user_data.age.value,\n \"gender\": user_data.gender.value,\n // \"user_id\": 1\n })\n })\n .then(resp => resp.json())\n .then(userObj => {\n renderNewUser(userObj)\n })\n }", "function submitNewUser() {\n var json = `{\"username\": \"${username}\", \"email\": \"${email}\", \n \"password\": \"${password}\", \"role\":\"${role}\"}`;\n\n fetch('http://localhost:9090/users/add', {\n method: 'POST',\n body: json,\n headers: {\n 'Authorization': `bearer ${localStorage.getItem('access_token')}`,\n 'Content-Type': 'application/json'\n }})\n .then(res => res.json())\n .then(alert('New user added to system!'))\n .catch(console.error());\n }", "createUser(newUser) {\n return this.perform('post', '/user', newUser);\n }", "function createUser(req, res, next) {\n const sql = sqlString.format(`INSERT INTO users SET ?`, req.body)\n\n db.execute(sql, (err, result) => {\n if (err) return next(err)\n res.send('New user added successfully')\n })\n}", "function postNewUser(req , res , next){\n var user = {};\n console.log(req.params);\n user.ID = req.params.ID;\n user.Nombre = req.params.Nombre;\n user.Apellidos = req.params.Apellidos;\n user.Correo = req.params.Correo;\n connection.query(\"INSERT INTO Usuarios (ID, Nombre, Correo,Apellidos)\"+\" VALUES ('\"+\n\t\t +user.ID+\"','\"\t \n +user.Nombre+\"','\"\n +user.Apellidos+\"','\"\n +user.Correo+ \"')\"\n , function (error, success){\n if(error) throw error;\n console.log(success);\n res.send(200, success.insertId);\n }\n );\n}", "function putUser(req, res) {\n\tvar user = req.body.username;\n\tvar pass = req.body.password;\n\tvar date = new Date().toISOString().slice(0, 10);\n\tvar last = req.session.uid;\n\tif (req.body.usertype == 'Admin') {\n\t\tvar userType = 1;\n\t} else if (req.body.usertype == 'User') {\n\t\tvar userType = 2;\n\t}\n\n\tbcrypt.hash(pass, saltRounds, function(err, hash) {\n\t\tvar query = {\n\t\t\ttext: 'INSERT INTO users(username, password, user_type, date_entered, last_update) VALUES ($1, $2, $3, $4, $5)',\n\t\t\tvalues: [user, hash, userType, date, last]\n\t\t}\n\n\t\tmodel.pullData(query, (rows) => {\n\t\t\tconsole.log(rows);\n\t\t});\n\t});\n}", "function registerUser(){\r\n let email=$(\"#txtEmail\").val();\r\n let pass=$(\"#txtPassword\").val();\r\n let firstName=$(\"#txtFirst\").val();\r\n let lastName=$(\"#txtLast\").val();\r\n let age=$(\"#txtAge\").val();\r\n let address=$(\"#txtAddress\").val();\r\n let phone=$(\"#txtPhone\").val();\r\n let payment=$(\"#selPayment\").val();\r\n let color=$(\"#txtColor\").val();\r\n let user = new User(email,pass,firstName,lastName,age,address,phone,payment,color);\r\n console.log(user);\r\n saveUser(user);// this function is on the storeManager\r\n clearForm();\r\n setNavInfo()\r\n\r\n}", "function addUserToDB(id , name) {\n url = serverURL + \"/sendUserInfo\";\n sendPostRequest(url, {'id': id,'name': name});\n}", "async addUser(ctx) {\n try {\n var body = ctx.request.body;\n var user = new User();\n user.name = body.name;\n user.email = body.email;\n user.save();\n ctx.body = { status: 200, message: \"data save \", user: user }\n }\n catch (error) {\n ctx.throw(error)\n }\n }", "function postUser(req, res) {\n if (req.body.email && !Isemail.validate(req.body.email))\n {\n res.json({\"error\": \"Invalid email address\"});\n } else {\n var newUser = new User(req.body);\n newUser.save((err, user) => {\n if (err) {\n res.json(err);\n } else {\n res.json(makeJsonResponse(user));\n }\n });\n }\n}", "function submit(ev) {\n api.create_user(props.form);\n }", "function upsertUser(userData) {\n $.post(\"/api/user/create\", userData)\n .then(function(){\n localStorage.setItem(\"currentUser\", JSON.stringify(userData));\n localStorage.setItem(\"loggedIn\", true);\n window.location = \"/\"\n });\n }", "static postUser(req) {\n return new Promise((resolve, reject) => {\n models.user.create({\n firstname: req.firstname,\n lastname: req.lastname,\n email: req.email,\n password: req.password\n })\n .then(newuser => {\n console.log(newuser);\n resolve(newuser);\n }, (error) => {\n reject(error);\n });\n });\n }", "function postUser(request, response) {\n\tfunction respondCreated(response, user) {\n\t\tresponse.json({\n\t\t\tmessage: 'Usuario creado con exito',\n\t\t\tuser\n\t\t})\n\t}\n\n\tfunction respondError(response, error) {\n\t\tif(error && error.code == 11000) {\n\t\t\tresponse.json({\n\t\t\t\tmessage: 'Usuario duplicado',\n\t\t\t\terror\n\t\t\t})\n\t\t} else {\n\t\t\tresponse.send(error)\n\t\t}\n\t}\n\n\t// Crea un nuevo usuario\n\tlet newUser = new User(request.body);\n\n\tnewUser.save()\n\t\t.then(user => respondCreated(response, user))\n\t\t.catch(error => respondError(response, error))\n}", "function registerUser() {\n let email = $(\"#txtEmail\").val();\n let pass= $(\"#txtPassword\").val();\n let first= $('#txtFirst').val();\n let last = $('#txtLast').val();\n let age = $('#txtAge').val();\n let address = $('#txtAddress').val();\n let phone = $('#txtPhone').val();\n let payment = $('#txtPayment').val();\n let color = $('#txtColor').val();\n\n let user = new User(email, pass, first, last, age, address, phone, payment, color);\n console.log(user);\n\n saveUser(user); // This function is on the storeManager\n clearUser();\n\n}", "function postUser(app){\n\treturn function(req, res){\n\t\tconst id = req.params.id;\n\t\tif(typeof id === 'undefined'){\n\t\t\tres.sendStatus(BAD_REQUEST);\n\t\t}\n\t\telse{\n\t\t\tconst user = req.body;\n\t\t\tuser._id = id;\n\t\t\treq.app.locals.model.users.updateUser(user).\n\t\t\t\tthen(function(){\n\t\t\t\t\tres.append('Location', requestUrl(req));\n\t\t\t\t\tres.sendStatus(SEE_OTHER);\n\t\t\t\t}).\n\t\t\t\tcatch((err) => {\n\t\t\t\t\tconsole.error(err);\n\t\t\t\t\tres.sendStatus(NOT_FOUND);\n\t\t\t\t});\n\t\t}\n\t};\n}", "async function storeUser(userName) {\n // Post to the user_database service so it is stored\n const newUser = { name: userName }\n await fetch(API_USERS + '/user', \n {\n method: 'POST',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(newUser) \n })\n}", "function createUser (req, res, next) {\n console.log(req.body);\n db.none(`INSERT INTO \"user\" (user_name, email, profile_pic, password) VALUES ($1, $2, $3, $4)`, [req.body.user_name, req.body.email, req.body.profile_pic, req.body.password])\n .then(next())\n .catch(err => next(err));\n}", "async users_post(req, res, next) {\n try {\n let body = _.pick(req.body, ...newUserFields);\n let user = await User.create(body);\n res.send('created successfully');\n return next();\n } catch (e) {\n console.error(e);\n res.send(500, e);\n return next(false);\n }\n }", "handleNewUser(req, res) {\n self.services.saveNewUser(req.validBody)\n .then(data => {\n res.send({data}); \n })\n .catch(error => {\n self.sendError(res, self.CODES.INTERNAL_ERROR, \"An error occured trying to sign up\");\n });\n }", "function saveUser(user, callback) {\n $.post('/users', {\n first: user.firstname, \n last: user.lastname\n }, callback)\n}", "async store ({request, response}){\n const userData = request.only(['username', 'email', 'password']);\n \n const userModel = new User();\n \n userModel.username = userData.username;\n userModel.email = userData.email;\n userModel.password = userData.password;\n \n await userModel.save();\n \n return response.status(201).json(userModel);\n }", "function createUser() {\n var newUser = {\n username: $usernameFld.val(),\n password: $passwordFld.val(),\n firstName: $firstNameFld.val(),\n lastName: $lastNameFld.val(),\n role: $roleFld.val()\n };\n try {\n userService\n .createUser(newUser)\n .then(function (userServerInfo) {\n users.push(userServerInfo);\n renderUsers(users);\n resetInputFields();\n clearSelected();\n });\n }\n catch (err) {\n console.log(err.name + \": \" + err.message);\n }\n }", "function createUser(user){\n return $http.post(url.user, user).then( handleSuccess, handleError);\n }", "add(userObject, response) {\n //password encryption\n userObject.password = encryptOperations.encryptPassword(\n userObject.password\n );\n UserModel.create(userObject, (err) => {\n if (err) {\n console.log(\"Error in Record Add\");\n response.status(appCodes.SERVER_ERROR).json({\n status: appCodes.ERROR,\n message: \"Record Not Added Due to Error\"\n });\n } else {\n console.log(\"Record Added..\");\n sendMail(userObject.userid, \"register\");\n\n response\n .status(appCodes.OK)\n .json({ status: appCodes.SUCCESS, message: \"Record Added\" });\n }\n });\n }", "function submitUser(User) {\n $.post(\"/api/users/\", User, function() {\n window.location.href = \"/welcome\";\n });\n }", "createUser({ body }, res) {\n User.create(body)\n .then(dbUserData => res.json(dbUserData))\n .catch(err => res.json(err));\n }", "static async postNew(request, response) {\n const { email, password } = request.body;\n\n // check for email and password\n if (!email) return response.status(400).send({ error: 'Missing email' });\n if (!password) return response.status(400).send({ error: 'Missing password' });\n\n // check if the email already exists in DB\n const emailExists = await dbClient.users.findOne({ email });\n if (emailExists) return response.status(400).send({ error: 'Already exist' });\n\n // Insert new user\n const sha1Password = sha1(password);\n let result;\n try {\n result = await dbClient.users.insertOne({\n email, password: sha1Password,\n });\n } catch (err) {\n await userQueue.add({});\n return response.status(500).send({ error: 'Error creating user' });\n }\n\n const user = {\n id: result.insertedId,\n email,\n };\n\n await userQueue.add({\n userId: result.insertedId.toString(),\n });\n\n return response.status(201).send(user);\n }", "function createUser(user) {\n return fetch(self.url, {\n method: 'POST',\n body: JSON.stringify(user),\n headers: {\n \"content-type\": \"application/json\"\n }\n }).then(response => response.json())\n }", "function createUser(user) {\n var newUser = {\n username: user.username,\n password: user.password,\n firstName: \"\",\n lastName: \"\"\n };\n return $http.post(\"/api/user\", newUser);\n }", "function createUser() {\n var username = $('#usernameFld').val();\n var password = $('#passwordFld').val();\n var firstName = $('#firstNameFld').val();\n var lastName = $('#lastNameFld').val();\n var role = $('#roleFld').val();\n\n var user = new User(username,password,firstName,lastName,role,null,null,null);\n\n userService\n .createUser(user)\n .then(findAllUsers)\n .then(emptyUserForm);\n }", "function postNewUser(){\n\tfunction postUser(userData) {\n \t$.post(\"/api/\", userData)\n \t.then(login);\n \t}\n \t//verify user information is entered correectly\n \tif($('#newPassword').val() != $('#newPassword2').val()){\n \t\talert('Passwords do not match, please re-enter your password and try again');\n \t}else if($('#newfname').val() == \"\" || $('#newlname').val() == \"\" || $('#newEmail').val() == \"\" || $('#newPassword').val() == \"\" || $('#newCompany').val() == \"\"){\n \t\talert('Some information is missing from the form. Please make sure all information is filled out fully.');\n \t}else{\n\t\tpostUser({\n\t\t\taction: 'newUser',\n\t\t\tfName: $('#newfname').val(),\n\t\t\tlName: $('#newlname').val(),\n\t\t\temail: $('#newEmail').val(),\n\t\t\tpassword: $('#newPassword').val(),\n\t\t\tcompany: $('#newCompany').val()\n\t\t});\n\t\talert(\"New user has been created, please login.\");\n\t}\n}", "async postUser(userInfo) {\n let user = {\n publicKey: userInfo.publicKey,\n requests: []\n }\n\n if(this.UserType == \"Patient\")\n user.treatments = [],\n user.redeemedTreatments = []\n\n await this.state.put(this.UserId, user);\n }", "async function postUser(req, res) {\n try {\n await usersController.addUser(req.body);\n res.status(201).send('Se agrego el usuario correctamente');\n } catch (e) {\n res.status(404).send('No se encontro el archivo ' + e);\n }\n}", "function createUser(body, next) {\n var url = '/api/users/new';\n request\n .post(url)\n .send(body)\n .accept('application/json')\n .end(function(err, res){\n if(err) { return console.error(err); }\n next(res.body);\n });\n}", "function createUser(user) {\n var url = \"/api/user\";\n return $http.post(url,user);\n\n }", "function createUserController(request, response) {\n const userData = request.body;\n delete userData.password;\n\n const newUser = model.insert(userData);\n\n response.status(httpStatus.CREATED).json(newUser);\n}", "createUser({ body }, res) {\n User.create(body)\n .then((dbUserData) => {\n res.json(dbUserData);\n })\n .catch((err) => {\n res.json(err);\n });\n }", "function createNewUser(data){\n let msg = {\n jsonrpc: '2.0',\n id: '0',\n method: 'setUser',\n params: data,\n };\n console.log(\"Making new user request\" )\n doSend(msg); \n}", "createUser({ body }, res) {\n User.create(body)\n .then((dbUserData) => res.json(dbUserData))\n .catch((err) => res.status(400).json(err));\n }", "function createUser(user) {\n return fetch('https://wbdv-generic-server.herokuapp.com/api/alkhalifas/users', {\n method: 'POST',\n body: JSON.stringify(user),\n headers: {\n 'content-type': 'application/json'\n }\n })\n .then(response => response.json())\n }", "save() {\n return db.execute('INSERT INTO users (user_name, user_password, user_email) VALUES (?, ?, ?)',\n [this.username, this.password, this.email]);\n }", "function createOrLoginUser(user) {\n\n var cleanName = user.cn.split(\",\");\n cleanName = cleanName[1].trim() + \" \" + cleanName[0];\n\n $scope.currentUser = user.cn;\n\n $cookies.putObject(\"user\", {\n full: cleanName,\n username: user.sAMAccountName,\n mail: user.mail,\n officeLoc: user.l\n });\n\n setCommService($scope.currentUser, user.sAMAccountName);\n\n httpService.postUser({\n username: user.sAMAccountName,\n full: cleanName,\n mail: user.mail,\n location: user.l,\n profilePic: \"\"\n }).then(function() {\n $location.path(\"/\");\n }, function(err) {\n alert(\"there was a problem posting your info to the database\");\n });\n }", "async addUser(ctx, next) {\n console.log('Controller HIT: UserController::addUser');\n return new Promise((resolve, reject) => {\n const usr = ctx.request.body;\n chpConnection.query({\n sql: `INSERT INTO User\n (\n fname,\n lname,\n email,\n payment\n ) VALUES (?, ?, ?, ?);`,\n values: [usr.fname,\n usr.lname,\n usr.email,\n usr.payment\n ]\n }, (err, res) => {\n if(err) {\n reject(err);\n }\n ctx.body = res;\n ctx.status = 200;\n resolve();\n });\n \n })\n .then(await next)\n .catch(err => {\n ctx.status = 500;\n ctx.body = {\n error: `Internal Server Error: ${err}`,\n status: 500\n };\n });\n }", "addUser(user) {\n return Api.post(\"/admin/add-user\", user).then((r) => sendActionResult(r));\n }", "function create_user(userobject){\n\n}", "function saveUser(err, body) {\n if (err) { return res.send(err.status_code, err); }\n\n if (body.rows && body.rows.length === 0) {\n return res.send(500, { ok: false, message: 'No user found with that email.' });\n }\n\n user = body.rows[0].value;\n // generate uuid save to document\n user.code = uuid.v1();\n db.insert(user, user._id, createEmail);\n }", "static add(user) {\n //wywołuje polecenie sql i zwraca promesę (Promise)\n return db.execute(\n 'insert into users (firstName, lastName) values (?, ?)',\n [user.firstName, user.lastName]\n );\n }", "function saveUser(name, surname, password, address, tel) {\n // save user code\n}", "function postUser(baseurl, callback) {\n\t// test user\n\tvar userObject = {\n\t\t'firstName': 'Test' + getRandomNumber(\"string\"),\n\t\t'lastName': 'User' + getRandomNumber(\"string\"),\n\t\t'emailId': 'Test.User' + getRandomNumber(\"string\") + '@test.com',\n\t\t'mobile': getRandomNumber(\"number\")\n\t}\n\tvar url = baseurl + \"/users\";\n\tvar options = {\n\t\tmethod: 'post',\n\t\tbody: userObject,\n\t\tjson: true,\n\t\turl: url\n\t}\n\t// callback would include error and response and body\n\trequest(options, function(error, response, body) {\n\t\tif (error) {\n\t\t\tlogger.log(\"Error received from postUser: \" + error);\n\t\t\treturn callback(500);\n\t\t}\n\t\tif (response.statusCode !== 200) {\n\t\t\treturn callback(response.statusCode);\n\t\t}\n\t\treturn callback(null, body);\n\t});\n}", "function create(req, res) {\n console.log(req.body);\n User.createSecure(req.body.email, req.body.password, function (err, newUser) {\n if (err){\n console.log('user creation error:', err);\n sendServerError(res);\n } else {\n console.log('user created with email:', newUser.email);\n req.session.userId = newUser._id; // log the user in immediately\n res.json(newUser);\n }\n });\n}", "async save (user) {\n user['avatar'] = ''\n user['followers'] = 0\n user['following'] = 0\n\n await Http.post('/signup', user, false)\n Events.emit('userStore:signup')\n }", "function createUser() {}", "function submitUser(user) {\n $.post(\"/api/users\", user, function() {\n window.location.href = \"/concerts\";\n });\n }", "function postUser(user) {\n fetch(\"https://rpsexam-61a3.restdb.io/rest/registeredusers\", {\n method: \"post\",\n headers: {\n \"Content-Type\": \"application/json; charset=utf-8\",\n \"x-apikey\": \"5ddfb3cc4658275ac9dc201e\",\n \"cache-control\": \"no-cache\"\n },\n body: JSON.stringify(user)\n })\n .then(e => e.json())\n .then(newUser => {\n window.location.hash = \"#profile\";\n localStorage.setItem(\"RPSuser\", newUser._id);\n loggedUserID = localStorage.getItem(\"RPSuser\");\n document.querySelector(\".modal_winner_body_notlogged\").style.display =\n \"none\";\n document.querySelector(\".modal_winner_body_logged\").style.display =\n \"block\";\n document.querySelector(\".modal_start_body-trial\").style.display = \"none\";\n document.querySelector(\".modal_start_body-logged\").style.display =\n \"block\";\n document.querySelector(\".nav_user-link\").href = \"#profile\";\n document.querySelector(\"#review\").style.display = \"block\";\n document.querySelector(\"div.highscore_sorting\").style.display = \"block\";\n resetGame();\n fetchUser(newUser._id);\n });\n}", "function createNewUser(){\n\n\tconsole.log(\"Click detected!\");\n\n\tvar newUsername = $('#usernamePick').val();\n\tvar newPassword = $('#passwordPick').val();\n\t//var newEmail = $('#emailPick').val();\n\n\tvar newUser = {\n\t\t\"username\": newUsername,\n\t\t\"password\": newPassword,\n\t\t\"email\": newEmail\n\t}\n\tconsole.log(\"new user!\");\n\t$.post('/', newUser, function(data){\n\t\t//console.log(newPost);\n\t})\n}", "async function saveUser (req,res) {\n if (!req.body) {\n return res.status(500).json({error: \"Request body emty.\"})\n }\n\n const user = new User({nombre:req.body.nombre, email:req.body.email, password:req.body.password})\n await user.save()\n return res.status(200).json({msg: \"user saved.\"})\n}", "create(req, res, next) {\n const userProps = req.body\n User.create(userProps)\n .then(user => res.send(user))\n .catch(next)\n }", "function create(req, res) {\n db.User.create(req.body, function(err, user) {\n if (err) { console.log('error', err); }\n res.json(user);\n });\n}", "function create(req, res) {\n db.User.create(req.body, function(err, user) {\n if (err) { console.log('error', err); }\n res.json(user);\n });\n}", "function createUser(newUser) {\n $.ajax({\n method: \"POST\",\n url: \"/api/newUser\",\n data : newUser\n })\n .then(function() {\n // or some redirect\n location.reload();\n \n });\n }", "function saveUser(user, res) {\n user.save()\n .then(result => {\n console.log('Creating User: ' + result);\n createActivationLink(res, user);\n res.status(201).json({\n message: 'user was created, please check your email account to verify your account.',\n createdUser: {\n _id: result._id,\n email: result.email,\n password: result.password,\n request: {\n type: 'GET',\n url: 'http:localhost:3000/api/users/' + result._id\n }\n }\n });\n })\n .catch(error => {\n handleError(res, 500, error);\n });\n}", "function createUser(req, res) {\n\n var user = req.body;\n\n if(null == user){\n res.sendStatus(500);\n return;\n }\n userModel.createUser(user)\n .then(function (dbUser) {\n\n if(null == dbUser){\n res.sendStatus(500);\n } else {\n res.send(dbUser);\n }\n\n }, function (err) {\n res.sendStatus(500).send(err);\n });\n }", "function postUser(username, pin) {\n newUser = {\n username: username,\n pin: pin,\n highScore: 0,\n };\n configObj = {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(newUser),\n };\n fetch(userUrl, configObj)\n .then((response) => response.json())\n .then((user) => {\n exitSignIn(user);\n })\n .catch((error) => console.error(\"ERROR: \", error));\n }", "function registerUserInDB(username, password){\n let newUser = new User({username: username, password: password});\n return newUser.save();\n}", "function insertNewUser({ username, firstname, lastname, email, password, admin }) {\n}", "async registerUser(userInfo) {}", "async createUser(req,res,next) {\n try {\n const user = this.postBody(req)\n await this.controller.createUser(user)\n return res.status(httpStatus.OK)\n } catch (e) {\n next(e)\n }\n }", "function registerUser(tempUser) {\n return $http.post('/register', tempUser);\n } // end registerUser()", "function saveNewUser() {\n let confirmation = confirm(\"Dont use a real password! If you did please change it! Press - Abbrechen\");\n if (confirmation == true) {\n let query = \"command=registerUser\";\n let inputs = document.getElementsByTagName(\"input\");\n console.log(inputs);\n if (inputs[0].value == \"\" || inputs[1].value == \"\" || inputs[2].value == \"\") {\n printError(\"Please fill in the form to create a new user\");\n return;\n }\n query += \"&name=\" + inputs[0].value;\n query += \"&username=\" + inputs[1].value;\n query += \"&password=\" + inputs[2].value;\n console.log(query);\n sendRequest(query, handleUserInsertResponse);\n }\n }", "function saveUser(req, res){\r\n //crear el objeto del usuario\r\n var user=new User();\r\n\r\n //recoger los parametros que nos llegan por la peticion\r\n var params=req.body; \r\n if(params.password && params.nombres && params.paterno && params.email && params.username){\r\n //asignar valores al objeto usuario\r\n user.nombres=params.nombres;\r\n user.paterno=params.paterno;\r\n user.email=params.email;\r\n user.username=params.username;\r\n\r\n if(params.cedula!=''){\r\n user.cedula=params.cedula; \r\n \r\n }else{\r\n user.cedula='';\r\n } \r\n if(params.sexo=='M'){\r\n user.sexo='M';\r\n }else{\r\n user.sexo='F';\r\n }\r\n if(params.celular!=0){\r\n user.celular=params.celular;\r\n }else{\r\n user.celular=0;\r\n }if(params.ocupacion!=''){\r\n user.ocupacion=params.ocupacion;\r\n user.instruccion=params.instruccion;\r\n user.zona=params.zona;\r\n user.calle=params.calle;\r\n user.materno=params.materno;\r\n }else{\r\n user.ocupacion='';\r\n user.instruccion='';\r\n user.materno='';\r\n }\r\n if(params.estadocivil!=''){\r\n user.nacimiento=params.nacimiento;\r\n user.estadocivil=params.estadocivil;\r\n user.gsanguineo=params.gsanguineo;\r\n user.materno=params.materno;\r\n user.zona=params.zona;\r\n user.calle=params.calle;\r\n }else{\r\n user.zona='';\r\n user.calle='';\r\n user.gsanguineo='';\r\n }\r\n\r\n if(params.roles=='ninguno'){\r\n user.roles='ninguno';\r\n }else{\r\n user.roles=params.roles;\r\n }\r\n \r\n user.password=params.password;\r\n if(params.institucion==''){\r\n user.institucion=null;\r\n }else{\r\n user.institucion=params.institucion;\r\n }\r\n\r\n User.findOne({email:user.email.toLowerCase()}, (err, issetUser) => {\r\n if(err){\r\n res.status(500).send({message: 'Error al comprobar el usuario'});\r\n }else{\r\n if(!issetUser){\r\n //cifrar password\r\n bcrypt.hash(params.password, null, null, function(err, hash){\r\n user.password=hash;\r\n //guarda usuario en bd\r\n user.save((err, userStored) => {\r\n if(err){\r\n res.status(500).send({message:'Error al guardar el usuario'}); \r\n }else{\r\n if(!userStored){\r\n res.status(404).send({message:'No se ha registrado el usuario'});\r\n }else{\r\n res.status(200).send({user: userStored});\r\n }\r\n }\r\n });\r\n });\r\n }else{\r\n res.status(200).send({\r\n message: 'El usuario ya se encuentra registrado'\r\n });\r\n }\r\n }\r\n });\r\n }else{\r\n res.status(200).send({\r\n message:'Se ha detectado campos erroneos en el formulario'\r\n });\r\n }\r\n}", "signup(req, res) {\n User.create(req.body, (err, user) => {\n if (err) return res.status(500).send(err.message);\n response = {success: true, message: 'User created.', user: user};\n return res.status(200).json(response);\n });\n }", "function createUser(req, res) {\n let user = req.body;\n // db Save\n // console.log(user);\n // if a new entry is created on server\n // memory -> ram\n userDB.push(user);\n fs.writeFileSync(path.join(__dirname,\n \"user.json\"),\n JSON.stringify(userDB));\n // res status code server send \n res.status(201).json({\n success: \"successfull\",\n user: user\n })\n}", "function createUser(req, res) {\n userService.create(req.body)\n .then(function () {\n res.sendStatus(200);\n })\n .catch(function (err) {\n res.status(400).send(err);\n });\n}", "function saveUser(userParam) {\n\n // remove password from user params, to be hashed (with salt length)\n var user = _.assign(new User(), _.omit(userParam, 'password'));\n user.password = bcrypt.hashSync(userParam.password, config.saltLength);\n\n console.log(user);\n user.save(\n function (err, doc) {\n if (err) deferred.reject(err.name + ': ' + err.message);\n\n //@TODO: generate activation token and sent it to this mail\n deferred.resolve();\n });\n }", "function createUser(username, email, password) {\n let endpoint = \"/Users\";\n let payload = {\n \"username\":username,\n \"password\":password,\n \"email\":email\n }\n let headers = {\"Content-Type\":\"application/x-www-form-urlencoded\"}\n sendRequest(method, endpoint, headers, payload, createUserCallback); // From CRUD.js\n}", "async createUser(req, res) {\n try {\n console.log(\"creating employee\")\n const dbUserData = await User.create(req.body);\n console.log(dbUserData);\n res.json({ message: \"new employee added\" })\n } catch (err) {\n console.log(err);\n res.status(500).json(err);\n }\n }", "function insertUser(data) {\n\treturn db(\"team_members\").insert(data);\n}", "static registerUser(body) {\n return fetch(\n \"https://salty-lowlands-70665.herokuapp.com/subprojects/user/\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(body),\n }\n ).then((response) => response.json());\n }", "create(user) {\n const { firstName, lastName, email, password, role, refreshToken } = user;\n const stmt = this.db.prepare(\n \"INSERT INTO users (firstName, lastName, email, password, role, refreshToken) VALUES (?, ?, ?, ?, ?, ?)\"\n );\n return stmt.run(firstName, lastName, email, password, role, refreshToken);\n }", "register(formData) {\n return this.http.post(\"http://localhost:8080/api/users/addNewUser\", formData);\n }", "async create() {\n const { ctx, service } = this;\n const params = getParams(ctx, 'body');\n const res = await service.user.crud({\n type: 'createOne',\n data: params,\n });\n ctx.body = res;\n }", "create(newUser) {\n database.Users.push(newUser)\n let response = {\n status: 200,\n data: {\n token: newUser.token,\n id: newUser.id,\n first_name: newUser.first_name,\n last_name: newUser.last_name,\n email: newUser.email,\n address: newUser.address,\n is_admin: newUser.is_admin\n }\n }\n return response;\n }", "async create(req, res) {\n try {\n validateUser(req.body);\n await userRepository.create(req.body);\n res.json('User registered successfully.');\n } catch (err) {\n res.json({ err });\n }\n }", "function registerUser(){\n Cloud.Users.create({\n username: \"push123x\",\n password: \"push123x\",\n password_confirmation: \"push123x\",\n first_name: \"Firstname\",\n last_name: \"Lastname\"\n }, function (e) {\n if (e.success) {\n \talert(\"User Created\");\n \tloginUser();\n } else {\n \talert(\"Error :\"+e.message);\n }\n });\n}", "function signUp() {\n console.log(new User(txtEmail.value, txtPassword.value, null));\n let newUser = new User(txtEmail.value, txtPassword.value, null);\n localStorage.setItem(\"user\", JSON.stringify(newUser));\n\n fetch(\"https://acastore.herokuapp.com/users\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(newUser)\n }).then(response => {\n // response.then(data => {\n // console.log(data);\n // });\n console.log(\"response: \", response.json());\n });\n}", "function createUser(newUser) {\n var url = \"/api/assignment/user\";\n return $http.post(url, newUser)\n .then(function(response) {\n return response.data;\n });\n }", "function createUser(user) {\n return fetch(self.url, {\n method: 'POST',\n // the user parameter is represented in binary format in the ram/memory of cpu. Needs to be converted to\n // a format that can be streamed across the http request, so we need to convert it into string that can be\n // streamed bits by bits\n body: JSON.stringify(user),\n headers: {\n 'content-type': 'application/json'\n }\n }).then(function (response) {\n return response.json()\n })\n }", "signUpUser(data) {\n return this.post('signup', data);\n }", "function singUp (req, res) {\n const user = new User({\n email: req.body.email,\n displayName: req.body.displayName,\n password: req.body.password\n })\n\n user.save()\n .then((user) => {\n res.status(200).send({message: 'te has logueado correctamente', token: service.createToken(user)})\n })\n .catch((err) => {\n res.status(500).send({err: err})\n })\n}", "static createUser(req, res){\n // Form validation\n const { errors, isValid } = validateRegisterInput(req.body);\n // Check validation\n if (!isValid) {\n return res.status(400).json(errors);\n }\n User.findOne({ username: req.body.username })\n .then(user => {\n if (user) {\n return res.status(400).json({ username: \"Username already exists\" });\n } \n const newUser = new User({\n username: req.body.username,\n password: req.body.password,\n //privileges : req.body.privileges,\n admin_creator: req.body.admin_creator,\n isAdmin: req.body.isAdmin,\n isNetIDLogin: req.body.isNetIDLogin,\n comment: req.body.comment,\n\n });\n // Hash password before saving in database\n bcrypt.genSalt(10, (err, salt) => {\n bcrypt.hash(newUser.password, salt, (err, hash) => {\n if (err) throw err;\n newUser.password = hash;\n newUser\n .save()\n .then(user => res.json(user))\n .catch(err => console.log(err));\n });\n });\n } \n )\n }", "function createNewUser(personalInfo, customerInfo, res) {\r\n var stm = 'INSERT INTO users (name, password, email, birth_date, phone, plan_name, monthly_amount, plan_id, customer_id_stripe) VALUES (?,?,?,?,?,?,?,?,?)'\r\n var params = [personalInfo.name,\r\n personalInfo.password,\r\n personalInfo.email,\r\n personalInfo.birth_date,\r\n personalInfo.phone,\r\n customerInfo.plan_name,\r\n customerInfo.monthly_amount,\r\n customerInfo.plan_id,\r\n stripe_cus_id]\r\n db.run(stm, params, function (err, result) {\r\n if (err) {\r\n console.log(err);\r\n console.log(\"cannot store customer\")\r\n return;\r\n }\r\n res.redirect(\"/customer\");\r\n });\r\n}", "async function addUser(req, res, next) {\n const user = new userModel_1.default(req.body);\n try {\n await user.save();\n return res.status(200).json({\n status: \"okay\",\n message: \"User successfully signed up\",\n });\n }\n catch (err) {\n res.status(400).json({\n error: dbErrorHandler_1.default.getErrorMessage(err),\n });\n }\n}", "create(req, res) {\n let user = new User();\n if (req.body.id) {\n user.id = req.body.id;\n }\n user.username = req.body.username;\n user.password = req.body.password;\n user.rolename = req.body.rolename;\n user.restaurant_id = req.body.restaurant_id;\n\n if (req.body.id) {\n return this.userdao.createWithId(user)\n .then(this.common.editSuccess(res))\n .catch(this.common.serverError(res));\n } else {\n return this.userdao.create(user)\n .then(this.common.insertSuccess(res))\n .catch(this.common.serverError(res));\n }\n\n }", "function registerUser(req, res) {\n userService.create(req.body)\n .then(function () {\n res.sendStatus(200);\n })\n .catch(function (err) {\n res.status(400).send(err);\n });\n}", "function registerUser(req, res) {\n userService.create(req.body)\n .then(function () {\n res.sendStatus(200);\n })\n .catch(function (err) {\n res.status(400).send(err);\n });\n}" ]
[ "0.7232981", "0.7171108", "0.7105241", "0.70450854", "0.70371866", "0.70073676", "0.6979549", "0.6943724", "0.69225806", "0.6921657", "0.6904248", "0.68871254", "0.68773717", "0.68731326", "0.6790053", "0.6766104", "0.6761648", "0.6735347", "0.6717131", "0.67121994", "0.6701537", "0.66902184", "0.66849", "0.6660825", "0.66489464", "0.66458833", "0.6620708", "0.66144276", "0.66045654", "0.6601029", "0.6593431", "0.6586027", "0.65847707", "0.6580274", "0.65711415", "0.6562692", "0.6559887", "0.6559377", "0.65554464", "0.65529126", "0.6551867", "0.6541813", "0.65338826", "0.6525406", "0.6522134", "0.6521708", "0.652155", "0.6519449", "0.6511394", "0.6491585", "0.6486396", "0.6484407", "0.6474312", "0.64717907", "0.6465298", "0.6463596", "0.645574", "0.64525443", "0.6450208", "0.64371556", "0.64354813", "0.6428838", "0.64265615", "0.6423125", "0.6423125", "0.64190537", "0.63957006", "0.6390253", "0.6389289", "0.63827825", "0.63810956", "0.6380854", "0.63770986", "0.63634783", "0.6357417", "0.6350038", "0.6338974", "0.6334609", "0.6328113", "0.6325089", "0.63089406", "0.6299933", "0.6297875", "0.62969846", "0.6292191", "0.6291742", "0.62912977", "0.6288878", "0.6287557", "0.62869674", "0.62801147", "0.62756395", "0.62619", "0.62613755", "0.6260845", "0.6260046", "0.62576264", "0.62464964", "0.6245973", "0.6243979", "0.6243979" ]
0.0
-1
Edit User in DB
function editUserInfo(user){ fetch(`https://students-3d096.firebaseio.com/${user.id}.json`, { method:"PUT", headers: { "Content-type": "application/json" }, body: JSON.stringify(user) }) .then(res => res.json()) .then(data => { debugger users = users.map(user => { if(user.id == data.id) user = data; return user; }) showUsersInfo(users); isAdd = true; currentId = null; }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function edit(req, res) {\n\tvar user_id = req.params.id;\n\tvar update = req.body;\n\n\t// do not update password in this method\n\tdelete update.password;\n\n\tif (user_id != req.user.sub) return res.status(500).send({ message: 'No tienes permiso para actualizar este usuario' });\n\n\tUser.findByIdAndUpdate(user_id, update, {new: true}, (err, data) => {\n\t\tif (err) return res.status(500).send({ message: 'Error en la peticion', error: err });\n\t\tif (!data) return res.status(404).send({ message: 'No se ha podido actualizar el usuario' });\n\t\treturn res.status(200).send({ user: data });\n\t});\n}", "function editUser(event) {\n var editButton = $(event.currentTarget);\n var userId = editButton\n .parent()\n .parent()\n .parent()\n .attr('id');\n userId = parseInt(userId);\n currentUserID = userId;\n userService\n .findUserById(userId)\n .then(renderUser);\n }", "function userEdit(req, res, next) {\n User\n .findById(req.params.id)\n .then((user) => {\n if (!user) return res.notFound();\n user = Object.assign(user,req.body);\n return user.save();\n })\n .then(user => res.json(user))\n .catch(next);\n}", "function editUser(e) {\r\n if (e.target.className === \"save\") {\r\n let newUserData = prepareEditedUser(e);\r\n putEditedUser(newUserData);\r\n clearEditBox();\r\n }\r\n}", "updateUser (context, user) {\n context.commit('updateUser', user)\n }", "function editUser(user) {\n\n $('#userIdEdit').val(user.user_id);\n $('#firstNameEdit').val(user.first_name);\n $('#lastNameEdit').val(user.last_name);\n $('#ageEdit').val(user.age);\n\n $('#editModal').modal('show');\n}", "editUser(user) {\r\n return axios.put(USER_API_BASE_URL + '/edit-profile/' + user.id, user);\r\n }", "editarUser(user) {\n user = JSON.parse(user);\n this.user = user;\n this.onEdit = true;\n this.cedulaWarning = true;\n }", "async edit_user(_, name) {\r\n const id = localStorage.getItem('id')\r\n const data = { 'user_id': id, 'name': name }\r\n return await axios.post('auth/edit', data)\r\n }", "async function editUsername() {\n try {\n // get Userinfo to fill out the missing variables in put requests\n const current = await api.get(`/users/${sessionStorage.getItem('id')}`);\n\n const requestBody = JSON.stringify({\n name: current.data.name,\n username: username,\n matrikelNr: current.data.matrikelNr\n });\n\n // Edit is sent to backend\n await api.put(`/users/${sessionStorage.getItem('id')}`, requestBody);\n\n } catch (error) {\n alert(`Something went wrong while editing the user: \\n${handleError(error)}`);\n }\n }", "function editUser(event) {\n $button= $(event.currentTarget);\n $userId=$button.parent().parent().parent().attr(\"id\");\n findUserById($userId).then(renderUser);\n }", "function updateUser() {\n try {\n selectedUser.username = $usernameFld.val();\n selectedUser.password = $passwordFld.val();\n selectedUser.firstName = $firstNameFld.val();\n selectedUser.lastName = $lastNameFld.val();\n selectedUser.role = $roleFld.val();\n userService.updateUser(selectedUserId, selectedUser)\n .then(function (userServerInfo) {\n users[editIndex] = selectedUser;\n renderUsers(users);\n resetInputFields();\n clearSelected();\n });\n }\n // In future could catch null error or could grey out checkmark icon.\n catch (err) {\n console.log(err.name + \": \" + err.message);\n }\n }", "editUser(userInfo) {\n return service\n .patch(`/api/user/edit`, userInfo)\n .then((res) => res.data)\n .catch(errorHandler);\n }", "function editUser(user) {\n return axios.put(api_host+\":\"+api_port+\"/api/user/\"+user.id, user)\n .then( res => {\n return res.data;\n })\n .catch( err => {\n console.log(err);\n });\n}", "function EditUser(isClosed, idPeople){\n\tvar result = validateUserFields()\n\tif(result){\n\t\tsaveUserData(idPeople,isClosed)\n\t}\n}", "async function editName() {\n try {\n // get Userinfo to fill out the missing variables in put requests\n const current = await api.get(`/users/${sessionStorage.getItem('id')}`);\n\n const requestBody = JSON.stringify({\n name: name,\n username: current.data.username,\n matrikelNr: current.data.matrikelNr\n });\n\n // Edit is sent to backend\n await api.put(`/users/${sessionStorage.getItem('id')}`, requestBody);\n\n } catch (error) {\n alert(`Something went wrong while editing the user: \\n${handleError(error)}`);\n }\n }", "function updateUser (req, res, next) {\n db.none(`UPDATE \"user\" SET user_name = $1, email = $2, profile_pic = $3, password = $4 WHERE user_id = $5`, [req.body.user_name, req.body.email, req.body.profile_pic, req.body.password, req.params.user_id])\n .then(next())\n .catch(err => next(err));\n}", "function updateUser(req, res, next) {\n const sql = sqlString.format(`UPDATE users SET ? WHERE id = ?`, [\n req.body,\n req.params.id\n ])\n\n db.execute(sql, (err, result) => {\n if (err) return next(err)\n if (!result.affectedRows) return next({ message: 'User not find' })\n res.send('User updated')\n })\n}", "function updateUser() {\n var username = $('#usernameFld').val();\n var password = $('#passwordFld').val();\n var firstName = $('#firstNameFld').val();\n var lastName = $('#lastNameFld').val();\n var role = $('#roleFld').val();\n var user = new User(username,password,firstName,lastName,role,null,null,null);\n userService\n .updateUser(currentUserID,user)\n .then(findAllUsers)\n .then(emptyUserForm);\n\n }", "static async editUserForm(userId, req, res, next) {\n\t\tlet user = await userModel.getUser(userId);\n\n\t\tif (user[0]) {\n\t\t\tuser = user[0];\n\t\t\tuser.hasImage = this.hasImage(userId);\n\t\t\tlet data = {\n\t\t\t\ttitle: \"User\",\n\t\t\t\tuser: user,\n\t\t\t\tnav: await navmenuModel.getNavmenu()\n\t\t\t};\n\t\t\tif (cfgControllers.json) {\n\t\t\t\treturn res.json(data);\n\t\t\t} else {\n\t\t\t\treturn res.render(\"user/editprofile\", data);\n\t\t\t}\n\t\t} else {\n\t\t\tnext();\n\t\t}\n\t}", "async editUser({ rootGetters}, user){\n // set token additional header\n let tokenHeaders = {\n headers: { 'Authorization': \"Bearer \" + rootGetters.getToken }\n }\n // get data user from API Server\n return await this.$axios.$put('/user/' + user.id, user, tokenHeaders)\n }", "function updateUser(e){\n var user = updateForm.getValueForm();\n user[\"id\"] = userId;\n var val = updateForm.form.find('#myForm').valid();\n if(val){\n e.preventDefault();\n collectionOfUser.update(\n user,\n function(newUser){\n $('tr[data-id='+userId +']').html('').html(logic.template(templates.tColumOfTable, newUser))\n $('tr[data-id='+userId +']').on('click', select);\n updateForm.hide();\n },\n error\n ); \n }\n }", "function editUser(newRole, id) {\n var xhttp;\n xhttp = new XMLHttpRequest();\n xhttp.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n getUsers();\n }\n };\n \n var obj = { \"role\" : newRole};\n obj = JSON.stringify(obj);\n xhttp.open(\"PUT\", \"http://localhost:8080/api/user/userUpdate/\" + id, true);\n xhttp.setRequestHeader(\"Content-type\", \"application/json\");\n xhttp.send(obj);\n }", "update(req, res) {\n let user = new User();\n user.id = req.body.id;\n user.username = req.body.username;\n user.password = req.body.password;\n user.rolename = req.body.rolename;\n user.restaurant_id = req.body.restaurant_id;\n\n return this.userdao.update(user)\n .then(this.common.editSuccess(res))\n .catch(this.common.serverError(res));\n }", "function updateTUser(name, id) {\n return promessQuery('UPDATE user SET user_name= \"' + name + '\" WHERE user_id= ' + id,\n callBackSucesso, callBackErro);\n }", "function updateUser(req, res) {\n User.findByIdAndUpdate(req.params.id, req.body.user, function(err, user) {\n if (err || !user) {\n console.log(err);\n req.flash(\"error\", \"Sorry, could not update this user\");\n res.redirect(\"back\");\n } else {\n //Make Admin from edit user form if admin code correct \n if (req.body.user.admin === \"admin123\") {\n user.isAdmin = true;\n user.save();\n }\n req.flash(\"success\", \"User successfully updated\");\n res.redirect(\"/users/\" + req.params.id);\n }\n });\n}", "editAccountName(request, response) {\n const loggedInUser = accounts.getCurrentUser(request);\n loggedInUser.name = request.body.name;\n memberStore.editUser(loggedInUser);\n response.redirect(\"/viewAccountDetails\");\n }", "function updateUser(user) {\n return {\n type: 'UPDATE_USER',\n user\n }\n}", "function updateUser(req, res, next) {\r\n\tdb.none('update users set first_name=$1, last_name=$2, email=$3 where id=$5',\r\n\t [req.body.name, req.body.breed, parseInt(req.body.age),\r\n\t req.body.sex, parseInt(req.params.id)])\r\n\t.then(function () {\r\n\t\tres.status(200)\r\n\t\t.json({\r\n\t\t\tstatus: 'success',\r\n\t\t\tmessage: 'Updated your user'\r\n\t\t});\r\n\t})\r\n\t.catch(function (err) {\r\n\t\treturn next(err);\r\n\t});\r\n}", "function updateUserInfoInEditForm(user) {\n $('#ename').val(user.fullName);\n //$('#eid').val(user.id);\n $('#egender').val(user.gender);\n $('#ebirthyear').val(user.birthYear);\n $('#eemail').val(user.email);\n $('#epassword').val(user.password);\n $('#estreet').val(user.street);\n $('#ecity').val(user.city);\n $('#estate').val(user.state);\n $('#ezip').val(user.zipCode);\n}", "function editUser(){\n\tconst opsw = document.getElementById(\"opsw\").value;\n\tconst npsw = document.getElementById(\"npsw\").value;\n\tconst cpsw = document.getElementById(\"cpsw\").value;\n\tif(opsw != user_psw){\n\t\talert(\"Wrong old password\");\n\t}\n\telse if(npsw==\"\"){\n\t\talert(\"Password can't be empty\")\n\t}\n\telse if(npsw != cpsw){\n\t\talert(\"New passwords don't match\");\n\t}\n\telse{\n\t\tuser = {\"id\":0, \"password\":npsw};\n\t\tpostServerData(`/ws/users/${current_user_id}`,user,navig);\n\t}\n}", "function editUsers(req, res) {\n //get input from client\n}", "edit() {\n this.whenAuthenticated('/', (key, { username }) => {\n this.render(Edit, {\n changePassword: (password, confirmation, callbacks) =>\n this.users.updatePassword(key, password, confirmation, callbacks),\n destroyUser: (password, callbacks) =>\n this.sessions.login(username, password, {\n success: () =>\n this.users.destroyUser(key, {\n success: () => {\n callbacks.success();\n this.io.navigate('/');\n },\n error: callbacks.error\n }),\n error: callbacks.error\n }),\n login: (password, callbacks) =>\n this.sessions.login(username, password, callbacks),\n success: () => this.io.navigate('/a/')\n });\n });\n }", "async function editProfile(req, res) {\n try {\n const { id } = req.auth;\n\n const { name, surnames, email, userName } = req.body;\n\n\n const schema = Joi.object({\n name: Joi.string().required().min(5).max(20),\n surnames: Joi.string().required(),\n email: Joi.string().email().required(),\n userName: Joi.string().alphanum().min(5).max(20),\n\n });\n await schema.validateAsync({ name, surnames, email, userName });\n\n const updateQuery = ('UPDATE users SET name = ?, surnames = ?, email = ?, userName = ? WHERE id = ?');\n\n\n await database.pool.query(updateQuery, [name, surnames, email, userName, id]);\n\n\n const selectQuery = 'SELECT * FROM users WHERE id = ?';\n const [selectRows] = await database.pool.query(selectQuery, id);\n\n\n res.send(selectRows[0]);\n\n\n } catch (err) {\n res.status(500);\n res.send({ error: err.message });\n }\n}", "function putUser(req, res) {\n\tvar user = req.body.username;\n\tvar pass = req.body.password;\n\tvar date = new Date().toISOString().slice(0, 10);\n\tvar last = req.session.uid;\n\tif (req.body.usertype == 'Admin') {\n\t\tvar userType = 1;\n\t} else if (req.body.usertype == 'User') {\n\t\tvar userType = 2;\n\t}\n\n\tbcrypt.hash(pass, saltRounds, function(err, hash) {\n\t\tvar query = {\n\t\t\ttext: 'INSERT INTO users(username, password, user_type, date_entered, last_update) VALUES ($1, $2, $3, $4, $5)',\n\t\t\tvalues: [user, hash, userType, date, last]\n\t\t}\n\n\t\tmodel.pullData(query, (rows) => {\n\t\t\tconsole.log(rows);\n\t\t});\n\t});\n}", "function editUser(value, valueID){\n\tvar newUser = prompt(\"Edit \" + value + \" username\");\n\tconsole.log(value, valueID, newUser);\n\t$.post('/editUser', {\n\t\t_token: $('meta[name=csrf-token]').attr('content'),\n\t\tchangeUser: newUser,\n\t\tselectedUID: valueID\n\t}).done(function(msg){\n\t\talert(msg);\n\t\twindow.location = \"http://vidstream.tv/profile\";\n\t});\n}", "editUser(username, userPhoto, handler) {\n if (username) {\n this.user.displayName = username;\n }\n\n if (userPhoto) {\n this.user.photo = userPhoto;\n }\n\n handler();\n }", "function handleEditUser(event){\n //Extract the url of the resource from the form action attribute.\n if (DEBUG) {\n console.log (\"Triggered handleEditUser\");\n }\n var $form = $(this).closest(\"form\");\n var body = serializeFormTemplate($form);\n var user_url = $(this).closest(\"form\").attr(\"action\");\n edit_user(user_url, body);\n return false;\n}", "function updateUserInfo(id, user) {\n}", "function updateUser() {\n if (model.addAdmin) {\n model.user.roles.push(\"ADMIN\");\n }\n if (model.addMember) {\n model.user.roles.push(\"MEMBER\");\n }\n userService\n .updateUser(model.userId, model.user)\n .then(function() {\n model.message = \"User updated successfully.\";\n });\n }", "updateUser({ commit }, userID) {\n commit(\"updateUser\", userID);\n }", "async updateUser(req,res){\n //función controladora con la lógica que actualiza un usuario\n }", "function edit(req, res, next) {\n // Look up all the information fields the user is gonna fill in and store them in variables.\n var username = req.body.username;\n var age = req.body.age;\n var gender = req.body.gender;\n var hospital = req.body.hospital;\n var day = req.body.day;\n var description = req.body.description;\n var picture = req.file ? req.file.filename : null;\n var email = req.body.email;\n var password = req.body.password;\n\n // Connect to the database and check if the username exists\n connection.query('SELECT * FROM users WHERE username = ?', username, done);\n\n // If it doesn't, carry out the following function\n function done(err, data) {\n if (err) {\n next(err);\n } else if (data.length === 1) {\n // If there is no data hash the password and carry out the onhash callback\n argon2.hash(password).then(onhash, next);\n } else {\n // If the username all ready exists send back an error\n res.status(409).send('Gebruikersnaam is al in gebruik');\n }\n }\n\n function onhash(hash) {\n // Save all the new user information inside the database\n connection.query('UPDATE users SET *', {\n username: username,\n age:age,\n gender:gender,\n hospital:hospital,\n day:day,\n description:description,\n picture:picture,\n email:email,\n hash: hash\n },\n oninsert);\n\n // When all the information is saved start this function\n function oninsert(err) {\n if (err) {\n next(err);\n } else {\n // Save the username inside the current session and redirect the user to the dashboard\n req.session.user = {username: username, picture:picture};\n res.redirect('dashboard');\n }\n }\n }\n}", "async editUserInfo({ commit }, params) {\n const username = params.name;\n const res = await api.editUser(username, params);\n if (res.status === 202) {\n commit(\"editComment\", \"유저 정보가 변경되었습니다.\");\n } else {\n if (res.data.error) {\n commit(\"editComment\", res.data.error);\n } else {\n commit(\"editComment\", \"정보 수정을 실패했습니다.\");\n }\n }\n }", "function editProfile() {\n setErrorsVisible(true);\n setCurrentPasswordServerError(\"\");\n setUsernameServerError(\"\");\n setEmailServerError(\"\");\n console.log(getProfileUsernameError(true, true, fieldsStateUser.username, currentUser.username, usernameServerError));\n if (!hasErrors(true, \"\", \"\", \"\")) {\n const newUser = createUserForUpdate(currentUser, fieldsStateUser, enableNotifications);\n updateUser(newUser)\n .then(result => {\n props.showStatusAlert(\"Данные успешно обновлены\", \"success\");\n console.log(result);\n\n //save success so current user is equal to new user\n setCurrentUser(newUser);\n props.updatePopoverUser(newUser);\n\n //slackcredentials saved, other values are \"\" by default\n //reset fields\n const newFieldStateUser = getDefaultFieldsStateUser();\n newFieldStateUser.slackCredentials = fieldsStateUser.slackCredentials;\n setFieldsStateUser(newFieldStateUser);\n setErrorsVisible(false);\n setShouldChangeLogin(false);\n setShouldChangeEmail(false);\n setShouldChangePassword(false);\n })\n .catch(err => {\n props.updateIsTokenExpired(err.message);\n if (err.message.length > HttpStatusCodeLength || err.message === ErrorInternalServerErr)\n props.showStatusAlert(\"Не удалось обновить данные\", \"error\");\n console.log(err.message);\n setCurrentPasswordServerError(parseCurrentPasswordServerError(err.message));\n setUsernameServerError(parseUsernameServerError(err.message));\n setEmailServerError(parseEmailServerError(err.message));\n });\n }\n }", "function useredit(e, myid) {\n myid = myid.replace('edit-', '');\n\n formData.append('iduser', myid);\n ajax({\n url: `./usuario/editar/${myid}`,\n method: \"POST\",\n // async: true,\n // responseType: 'json',\n done: editar,\n error: rendererror,\n form: formData,\n });\n\n abrirmodal(modal3, modaledit);\n\n e.preventDefault();\n}", "function updateUser2(req, res){\r\n var userId=req.params.id;\r\n var update=req.body;\r\n delete update.password;\r\n User.findByIdAndUpdate(userId, update, {new:true}, (err, userUpdate) => {\r\n if(err){\r\n res.status(500).send({message:'Error al realizar los cambios'});\r\n }else{\r\n if(!userUpdate){\r\n res.status(404).send({message:'No se ha logrado realizar los cambios solicitados'});\r\n }else{\r\n res.status(200).send({user:userUpdate});\r\n }\r\n }\r\n }); \r\n}", "function updateUser(req, res) {\n var userId = req.params.id;\n var update = req.body;\n // borrar propiedad password\n delete update.password;\n if (userId != req.user.sub) {\n return res.status(500).send({message: 'No tienes permiso para actualizar los datos del usuario.'});\n }\n\n User.findByIdAndUpdate(userId, update, {new: true}, (err, userUpdated) => {\n if (err) return res.status(500).send({message: 'Error en la peticion.'});\n if (!userUpdated) return res.status(404).send({message: 'No se ha podido actualizar.'});\n return res.status(200).send({user: userUpdated});\n })\n}", "function editUser() {\n let user_id = $(this).data().userid;\n\n $.ajax({\n url: \"/edit/user/\" + user_id,\n type: 'GET'\n }).done(function (resp) {\n createEditUserDialog(resp);\n }).fail(function (response) {\n addStatusMessage(response.responseText, false);\n\n $(\"html, body\").animate({scrollTop: 0}, \"slow\");\n $('#' + modal_id).modal(\"hide\");\n });\n}", "editUserProfile(details, success, failure) {\n ApolloService.mutate({\n mutation: Mutations.EDIT_USER_PROFILE,\n variables: details\n }).then(data => { success(this.handleResponse(data.data.editUserProfile, \"user\")) })\n .catch(error => failure(error));\n }", "function updateUser(req, res) {\n User.findByIdAndUpdate(req.params.id, req.body, { new: true }, function (err, user) {\n if (err) return res.status(500).send(\"There was a problem updating the user.\");\n res.status(200).send(user);\n });\n}", "function updateUser(req, res) {\n var userId = req.params.id;\n var update = req.body;\n\n // borrar propiedad password\n delete update.password;\n\n if (userId != req.user.sub) {\n return res.status(500).send({\n message: 'No tiene permiso para actualizar los datos'\n });\n }\n // new : true indica que el metodo solo me devolvera el metodo actualizado.\n User.findByIdAndUpdate(userId, update, { new: true }, (err, userUpdated) => {\n if (err) {\n return res.status(500).send({\n message: 'Error en la peticion'\n });\n }\n if (!userUpdated) {\n return res.status(404).send({\n message: 'No se ha podido actualizar el usuario'\n });\n }\n return res.status(200).send({ user: userUpdated });\n });\n}", "function openEditUser() {\n routingBase.goToCurrentState('userDetails');\n }", "function editUsers(){\n\tvar position=JSON.parse(localStorage.getItem('CurrentUser')).Position;\n\tvar users= JSON.parse(localStorage.getItem('Users'));\n\tvar user =users[position];\n\tif(document.getElementById('widget_password').value !== document.getElementById('widget_password_confirmation').value){\n\t\talert(\"The password doesn't match\");\n\t\treturn;\n\t}\n\tuser.FirstName=document.getElementById('widget_first_name').value;\n\tuser.LastName=document.getElementById('widget_last_name').value;\n\tuser.UserName=document.getElementById('widget_userName').value;\n\tuser.Email=document.getElementById('widget_email').value;\n\tuser.Password=document.getElementById('widget_password').value;\n\tuser.Admin=document.getElementById('box').checked;\n\tdocument.getElementById('welcomeUser').innerHTML='Welcome '+ user.FirstName + ' ' + user.LastName;\n\tlocalStorage.setItem('Users',JSON.stringify(users));\n\tlocalStorage.setItem(\"CurrentUser\",JSON.stringify(user));\n\t$('.overlay-bg, .overlay-content').hide();\n\talert(\"The user has been edited successfully\");\n}", "function EditUserModal(Name, LastName, UserName, Rol, Id) {\n \n //asociamos los textbox con sus respetivos valores provenientes de la base de datos.\n document.getElementsByName('userName')[0].value = UserName;\n document.getElementsByName('name')[0].value = Name;\n document.getElementsByName('lastName')[0].value = LastName;\n document.getElementById('userType')[0].value = Rol;\n idDeleteUpdate = document.getElementsByName('idHidden')[0].value = Id;\n}", "async updateUser(_, { id, firstName, lastName, email, password }, { authUser }) {\n // Make sure user is logged in\n if (!authUser) {\n throw new Error('You must log in to continue!')\n }\n // fetch the user by it ID\n // Update the user\n await user.update({\n firstName,\n lastName,\n email,\n password: await bcrypt.hash(password, 10)\n });\n return user;\n }", "function onSubmitEditUser(e) {\r\n e.preventDefault();\r\n fetch(`https://contact-list-phase2-app.herokuapp.com/users/${id}`, {\r\n method: \"PATCH\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify(formData),\r\n })\r\n .then((res) => res.json())\r\n .then((userData) => {\r\n setFormData(userData);\r\n });\r\n }", "function editUser(username, updatedValue){\n return new Promise(\n (resolve, reject) => {\n if (!username){\n const error = new Error('Username must not be empty');\n error.status = 422;\n reject(error);\n return;\n }\n persistenceUnit.getUserByEmailOrUsername(username)\n .then((foundUser) => {\n if(!foundUser){\n const error = new Error(`Did not find any User with this name: ${username}`);\n error.status = 404;\n reject(error);\n return;\n }\n const user = {\n userid: foundUser.userid,\n email: foundUser.email,\n password: foundUser.password,\n score: foundUser.score,\n playedGames: foundUser.playedGames,\n scorePercentage: foundUser.scorePercentage\n };\n\n if (updatedValue.email) {\n user.email = updatedValue.email;\n }\n if (updatedValue.password) {\n validatePassword(updatedValue.password, reject);\n const hash = crypto.createHmac('sha512', cryptoKey);\n hash.update(updatedValue.password);\n const hashedPassword = hash.digest('hex');\n user.password = hashedPassword;\n }\n persistenceUnit.updateUser(user.userid, user);\n resolve();\n }).catch((err) => reject(err));\n });\n}", "function updateUserProfile(req, res) {\n if(req.body.userID === undefined){\n return res.send(\"Error: no user specified\");\n }\n User.findById(req.body.userID, function (err, user) {\n if (err) throw err;\n if(user === null) {\n return res.send(\"Error: No such User exists\");\n }\n\n user.name = req.body.name;\n user.email = req.body.email;\n user.phone = req.body.phone;\n user.address = req.body.address;\n user.password = req.body.password;\n \n user.save(function(err) {\n if (err) throw err;\n return res.send('Success');\n });\n \n });\n \n}", "updateUser(req, res) {\n User.findOneAndUpdate({ _id: req.params.id }, req.body, { new: true, runValidators: true })\n .then(dbUserData => {\n if (!dbUserData) {\n res.status(404).json({ message: \"No user found with this id!\" });\n return;\n }\n res.json(dbUserData)\n })\n .catch(err => res.json(err));\n }", "update(id, user) {\n return 1;\n }", "edit({ email, name, password, image }) {\n let details = { email, name, password, image };\n for (const key in details)\n if (details[key]) {\n currentUser[key] = details[key];\n }\n callFuture(updateUserListeners);\n }", "editUserType({ idUser }, { idType }, result) {\r\n let query = `update uZvFiNMuwF.user set idType = ${idType}`;\r\n query += ` where idUser = ${idUser}`;\r\n\r\n sql.query(query, (err, rows, fields) => {\r\n if (err) {\r\n result(err, rows);\r\n return;\r\n }\r\n\r\n result(null, rows);\r\n });\r\n }", "function editUser(req, res) {\n console.log('editUser function called')\n\n var userID = req.body.userID || ''\n var username = req.body.username || ''\n var password = req.body.password || ''\n var imei = req.body.imei || ''\n var firstname = req.body.firstname || ''\n var lastname = req.body.lastname || ''\n\n if (!userID || !username || !password || !imei || !firstname || !lastname) {\n res.status(412).json(new ApiResponse(412, \"Missing parameters, check if userId, username, password, imei, firstname or lastname is missing\")).end()\n return\n }\n\n\n var query = {\n sql: 'UPDATE user SET username = ?, password = ?, imei = ? WHERE userID = ?',\n values: [username, password, imei, userID],\n timeout: 3000\n }\n\n var queryTwo = {\n sql: 'UPDATE driver SET firstname = ?, lastname = ? WHERE userID = ?',\n values: [firstname, lastname, userID],\n timeout: 3000\n }\n\n db.query(query, (err, response, fields) => {\n if (err) {\n res.status(500).json(new ApiResponse(500, err)).end()\n } else {\n db.query(queryTwo, (err, response, fields) => {\n if (err) {\n res.status(500).json(new ApiResponse(500, err)).end()\n } else {\n res.status(200).json(new ApiResponse(200, \"Edit succesfull\")).end()\n }\n })\n }\n })\n\n // db.query('SELECT * FROM driver WHERE userID = ?', [userID], function (error, rows, fields) {\n // res.status(500).json(new ApiResponse(500, error)).end()\n // })\n\n // db.query('SELECT * FROM user WHERE userID = ?', [userID], function (error, rows, fields) {\n // if (!error) {\n // res.status(200).json(new ApiResponse(200, \"Edit succesfull\")).end()\n // } else {\n // res.status(500).json(new ApiResponse(500, error)).end()\n // }\n // })\n\n}", "function update(req, res) {\n\tUser.findById(req.params.user_id, function(err, user) {\n\t\tif (err) return res.send(err);\n\n\t\tif (req.body.name) user.name = req.body.name;\n\t\tif (req.body.password) user.password = req.body.password;\n\n\t\tuser.blocked\t= req.body.blocked;\n\t\tuser.image \t\t= req.body.image;\n\n\t\tuser.save(function(err, user) {\n\t\t\tif (err) return res.send(err);\n\n\t\t\tres.json({ message : \"User Updated\" });\n\t\t})\n\t})\n}", "update(req, res) {\n\t\t\tif(req.user === USER_NOT_FOUND) {\n\t\t\t\treturn res.sendStatus(404);\n\t\t\t}\n\t\t\tconst query = \"UPDATE users SET name = $1, email = $2 WHERE id = $3\"\n\t\t\tconst values = [req.body.name, req.body.email, req.params.user ]\n\t\t\tdb.query(query, values, (err, result) => {\n\t\t\t\tif(err) {\n\t\t\t\t\treturn res.json(err);\n\t\t\t\t}\n\t\t\t\tif(result.rowCount === 0) {\n\t\t\t\t\tres.sendStatus(404);\n\t\t\t\t}\n\t\t\t\tres.sendStatus(204);\t\n\t\t\t});\n\t\t}", "updateUser(userId, data) {\n return this.userStore.updateUser(userId, data)\n }", "static async updateUser({ username, password, first_name, last_name, email }) {\n try {\n const res = await this.request(`users/${username}`, { password, first_name, last_name, email }, 'patch')\n return res;\n } catch (err) {\n return { errors: err };\n }\n }", "async edit(req, res) {\n const _id = req.user._id\n\n const user = await User.findOne({_id: _id})\n\n if (!req.body.dataNasc || !req.body.nome || !req.body.endereco || !req.body.cpf) {\n return res.status(400).send('Campo(s) obrigatório(s) vazio(s)!')\n }\n\n user.nome = req.body.nome\n user.cpf = req.body.cpf\n user.dataNasc = req.body.dataNasc\n user.endereco = req.body.endereco\n \n //biografia opcional\n if (req.body.biografia) {\n user.biografia = req.body.biografia\n }\n\n //condicional para verificar se o email de confirmacao precisa ser reenviado\n if (req.body.email) {\n const emailAlreadyExists = await User.findOne({email: req.body.email})\n \n if (emailAlreadyExists) {\n return res.status(400).send(\"Email já cadastrado!\")\n }\n\n user.email = req.body.email\n user.verificado = false\n \n const novoTokenVerificacao = Math.random().toString(36).slice(2)\n user.tokenVerificacao = novoTokenVerificacao\n sendEmail(req.body.email, novoTokenVerificacao)\n }\n\n const savedUser = await user.save()\n return res.json({completo: true})\n }", "updateUser(id, body) {\n return this.patch(`${this.baseUrl}/users/${id}`, body);\n }", "async function editMatrikel() {\n try {\n\n CheckMatrikelNrFormat();\n\n // get Userinfo to fill out the missing variables in put requests\n const current = await api.get(`/users/${sessionStorage.getItem('id')}`);\n\n const requestBody = JSON.stringify({\n name: current.data.name,\n username: current.data.username,\n matrikelNr: matrikelNr\n });\n\n // Edit is sent to backend\n await api.put(`/users/${sessionStorage.getItem('id')}`, requestBody);\n\n } catch (error) {\n alert(`Something went wrong while editing the user: \\n${handleError(error)}`);\n }\n }", "async updateUser(parent, {\n updateUserInput: {\n id,\n name,\n email,\n password\n }\n }, context, info) {\n try {\n const updateUser = await context.prisma.user.update({\n where: {\n id\n },\n data: {\n name,\n email,\n password\n }\n });\n return \"user update sucessfully\";\n } catch (error) {\n return error;\n }\n }", "function EditUser() {\n const [user,setUser] = useState({\n name: '',\n username: '',\n email: '',\n phone: '',\n website: ''\n })\n const {name,username,email,phone,website} = user;\n const history = useHistory();\n const {id} = useParams(); //Id of user to be deleted coming from dynamic routing\n\n const loadUser = async (id) => {\n const user = await axios.get(`http://localhost:3001/users/${id}`);\n setUser(user.data);\n }\n\n useEffect(() => {\n loadUser(id)\n },[id])//Jab bhi edit pe koi click krega ye page render hoga aue ek hi bar data load hoga\n\n const handleInput = (e) => {\n const name = e.target.name;\n const value = e.target.value;\n setUser({...user,[name] : value});\n }\n const handleSubmit = async (e) => {\n e.preventDefault();\n await axios.put(`http://localhost:3001/users/${id}`, user)\n // kis user ka data update krna hai iske liye id diya\n history.push(\"/\");\n }\n return (\n <>\n <form className='w-25 mx-auto mt-5'>\n <div className='mb-3'>\n <input \n type='text' \n placeholder='Name' \n className='form-control' \n name='name'\n value={name}\n onChange={handleInput}\n />\n </div>\n <div className='mb-3'>\n <input \n type='text' \n placeholder='Username' \n className='form-control' \n name='username'\n value={username}\n onChange={handleInput}\n />\n </div>\n <div className='mb-3'>\n <input type='text' \n placeholder='Email' \n className='form-control' \n name='email'\n value={email}\n onChange={handleInput}\n />\n </div>\n <div className='mb-3'>\n <input \n type='text' \n placeholder='Phone' \n className='form-control' \n name='phone'\n value={phone}\n onChange={handleInput}\n />\n </div>\n <div className='mb-3'>\n <input \n type='text' \n placeholder='Website' \n className='form-control' \n name='website'\n value={website}\n onChange={handleInput}\n />\n </div>\n <div className='text-center'>\n <button className='btn btn-primary mx-auto w-100' onClick={handleSubmit}>Save</button>\n </div>\n </form>\n </>\n )\n}", "function update(req, res) {\n // find one user by id, update it based on request body,\n // and send it back as JSON\n\n db.User.findById(req.params.id, function(err, foundUser) {\n if (err) { console.log('userController.update error', err); }\n foundUser.username = req.body.username;\n foundUser.password = req.body.password;\n foundUser.location = req.body.location;\n foundUser.contact = req.body.contact;\n foundUser.picture = req.body.picture;\n foundUser.posts = req.body.posts;\n foundUser.save(function(err, savedUser) {\n console.log(savedUser)\n if (err) { console.log('saving altered user failed'); }\n res.json(savedUser);\n });\n });\n}", "updateUser(request, response, next) {\n let attributes = {\n name: request.body.name\n };\n this._knex(this._user)\n .where('id', request.params.id)\n .update(attributes, '*')\n .then(result => {\n response.json(result);\n })\n .catch(err => {\n next(err);\n });\n }", "function updateUser(req, res){\n\n var id = req.params.id;\n var body = req.body;\n\n Usuario.findById(id , (err, usuario) => {\n\n if( err ) \n return res.status(500).json({\n ok: false,\n mensaje: 'Error al buscar usuario',\n errors: err\n });\n \n if( !usuario ) \n return res.status(400).json({\n ok: false,\n mensaje: 'El usuario con el id: '+ id+' no exite',\n errors: { message : 'No existe un usuario con ese id'}\n });\n\n usuario.nombre = body.nombre;\n usuario.email = body.email;\n\n usuario.save( (err, usuarioActualzado) => {\n \n if( err ) \n return res.status(301).json({\n ok: false,\n mensaje: 'Error al actualizar usuario',\n errors: { message : err}\n });\n\n usuarioActualzado.password = \";)\";\n return res.status(200).json({\n ok: true,\n usuario:usuarioActualzado\n });\n\n\n });\n\n\n \n });\n\n\n}", "async update({ request, params, response }) {\n /*** get the user update inputs */\n let { status } = request.only([\"status\"]);\n\n /** get the target user */\n try {\n const user = await User.query().where(\"id\", params.id).first();\n if (!user) {\n return response.status(404).send({\n message: \"not found\",\n });\n }\n\n /** update the user details */\n\n user.active = status;\n await user.save();\n return response.status(200).send({\n message: \"info updated\",\n });\n } catch (error) {\n return response.status(404).send({\n message: \"fail\",\n error: error,\n });\n }\n }", "function updateUser(req, res) {\n var userId = req.params.id;\n var update = req.body;\n\n User.findByIdAndUpdate(userId, update, (err, updateUser) => {\n if (err) {\n res.status(500).send(\"Error al actualizar el usuario\");\n } else {\n if (!updateUser) {\n res.status(404).send(\"No se ha podido actualizar el usuario\");\n } else {\n res.status(200).send(updateUser);\n }\n }\n });\n}", "onUserEditBegin(user) {\n this.setState({\n editUser: user,\n editedUser: new User(user),\n });\n }", "function updateUser() {\n // fields to update\n delete userParam.oldPassword;\n delete userParam.confirmPassword;\n var set = _.omit(userParam,'_id');\n \n // update password if it was entered\n if (userParam.password) {\n set.hash = bcrypt.hashSync(userParam.password, 10);\n }\n delete set.password;\n \n db.users.update({_id: mongo.helper.toObjectID(_id)}, {$set: set}, function(err){\n if(err) {\n deferred.reject(err);\n }\n deferred.resolve();\n });\n }", "async update(id, user, type) {\n\t\tconst dto = await this.entityDto.domain()\n\t\tuser.id = id\n\t\tuser = morphism(dto, user)\n\t\tif (type == 'password') {\n\t\t\tconst salt = await bcrypt.genSalt(10)\n\t\t\tuser.password = await bcrypt.hash(user.password, salt)\n\t\t\treturn this.usersRepository.updatePassword(id, user)\n\t\t}\n\t\treturn this.usersRepository.updateUsername(id, user)\n\t}", "function update(username,password,firstName, lastName, emailId){\n var userLoggedIn=$rootScope.currentUser;\n var LoggedInUserId=userLoggedIn._id;\n console.log(\"User Logged in ID: \");\n console.log(userLoggedIn);\n\n var user={\n \"username\":username,\n \"password\":password,\n \"firstName\":firstName,\n \"lastName\":lastName,\n \"emailId\":emailId\n };\n\n\n UserService.updateUser(LoggedInUserId,user, function (response) {\n\n\n UserService.setCurrentUser(response);\n console.log(\"Response From Service: Updated the User\");\n console.log(response);\n\n });\n\n }", "update(req, res, next, user) {\n if (currentUser && (req.params.id == currentUser._id || currentUser.isAdmin)) {\n User.update({\n _id: req.params.id\n }, req.body, (err, status) => {\n if (err) {\n next(err);\n } else {\n res.sendStatus(200);\n }\n });\n } else {\n res.status(\"401\").send(\"Not authorized, your are not admin!\");\n }\n }", "function selectUser(event) {\n var editBtn = $(event.target);\n editIndex = editBtn.attr(\"id\").split('-')[1];\n selectedUserId = users[editIndex]._id;\n try {\n userService.findUserById(selectedUserId)\n .then(function (userInfo) {\n console.log(\"userInfo from findUserById\", userInfo);\n $usernameFld.val(userInfo.username);\n $passwordFld.val(userInfo.password);\n $firstNameFld.val(userInfo.firstName);\n $lastNameFld.val(userInfo.lastName);\n $roleFld.val(userInfo.role);\n selectedUser = userInfo;\n });\n }\n catch (err) {\n console.log(err.name + \": \" + err.message);\n }\n }", "async updateUser(user) {\n try {\n const result = await this.axiosInstance.patch(\n `/users/${user.username}`,\n user.requestBody\n );\n return result;\n } catch (err) {\n helpMeInstructor(err);\n return err;\n }\n }", "function updateUser(req, res){\r\n var userId=req.params.id;\r\n var update=req.body;\r\n delete update.password;\r\n console.log(update);\r\n\r\n if(userId != req.user.sub){\r\n return res.status(500).send({message:'No tienes permisos'});\r\n }\r\n console.log(update);\r\n User.findByIdAndUpdate(userId, update, {new:true}, (err, userUpdate) => {\r\n if(err){\r\n res.status(500).send({message:'Error al realizar los cambios'});\r\n }else{\r\n if(!userUpdate){\r\n res.status(404).send({message:'No se ha logrado realizar los cambios solicitados'});\r\n }else{\r\n res.status(200).send({user:userUpdate});\r\n }\r\n }\r\n }); \r\n}", "function updateUser(){\n // use save instead of update to trigger 'save' event for password hashing\n\t\nconsole.log('REQUEST IS ', req.body)\n\tif (!user.termsAccepted_v1) user.termsAccepted_v1 = false;\n user.set(req.body);\n user.save(function(err, user){\n \n // Uniqueness and Save Validations\n \n if (err && err.code == 11001){\n var duplicatedAttribute = err.err.split(\"$\")[1].split(\"_\")[0];\n req.flash('error', \"That \" + duplicatedAttribute + \" is already in use.\");\n return res.redirect('/account');\n }\n if(err) return next(err);\n \n // User updated successfully, redirecting\n \n req.flash('success', \"Account updated successfully.\");\n return res.redirect('/account');\n });\n }", "function updateUser(userId, name, email, password, role) {\n return (User.findByIdAndUpdate(userId, {\n name,\n email,\n password,\n role\n }, {new: true}));\n}", "function updateUserDetails(e){\n e.preventDefault();\n\n var userFormData = JSON.parse(queryStringToJsonString($(\"#admin-view-user\").serialize()));\n var userObj = {};\n for(var key in userFormData){\n if(key==\"projectName\")\n continue;\n userObj[key] = decodeURIComponent(userFormData[key]);\n }\n\n updateDetails(\"PUT\", baseURL + \"User\", JSON.stringify(userObj), \"Resource\", \"userViewForm\");\n}", "function _editAdminById(req,res,next){\n\tCommon.ensureUserInSession(req, res, function(caller) {\n\t\tvar adminId = req.param('id');\n\t\tvar fname = req.body.txtfirstname ;\n\t\tvar lname = req.body.txtlastname;\n\t\tvar password=req.body.txtpassword;\n\t\tvar city=req.body.txtcityname;\n\t\tvar state=req.body.txtstatename;\n\t\tvar country=req.body.country;\n\n\t\tCommon.saltAndHash(req, res, password, function(endryptedPassword){\n\t\t\tpassword = endryptedPassword;\n\t\t});\n\t\t\n\t\tvar update_obj = {\n\t\t\tfirst_name:fname,\n\t\t\tlast_name:lname,\n\t\t\tpassword:password,\n\t\t\tcity:city,\n\t\t\tstate:state,\n\t\t\tcountry:country\n\t\t}\n\n\t\tADMIN_COLLECTION.update({_id:new ObjectID(adminId)}, {$set:update_obj},\n\t\t\tfunction(err,result){\n\t\t\tif(err){\n\t\t\t\tconsole.log('Failed to Update Admin Error : ' + err);\n\t\t\t\tCommon.pushMessage(req, 'fail', 'Failed to Update Admin...!!!');\n\t\t\t\tres.redirect('/admins');\n\t\t\t}else{\n\t\t\t\tCommon.pushMessage(req, 'success', 'Admin Updated Successfully...!!!');\n\t\t\t\tres.redirect('/admins');\n\t\t\t}\n\t\t});\n\t});\n}", "updateUser ({ params, body }, res) {\n User.findOneAndUpdate({ _id: params.id }, body, { new: true })\n .then(dbUserData => {\n if (!dbUserData) {\n res.status(404).json({ message: 'There is NO user found with this id!' });\n return;\n }\n res.json(dbUserData);\n })\n .catch(err => \n res.json(err)\n );\n }", "function updateUserController(request, response) {\n const userId = request.params.userId;\n const newValues = request.body;\n\n model.updateById(userId, newValues)\n\n response.status(httpStatus.NO_CONTENT).send();\n}", "editPasswordUser(hash: string, salt: string, email: string, callback) {\n super.query(\n 'UPDATE user SET hash = ?, salt = ? WHERE email = ?',\n [hash, salt, email],\n callback,\n );\n }", "function allowUserToEdit() {\n // console.log('user to edit:', usersShow.user.id);\n // console.log('currentUser:', currentUserId);\n if (usersShow.user.id === currentUserId) {\n usersShow.editable = true;\n }\n }", "mutateUser ({dispatch}, payload) {\n if (payload.id) {\n dispatch('editUser', payload)\n } else {\n // TODO creating a user from the admin account\n console.log('this user doesnt exist in database')\n }\n }", "async function edit(id){\r\n newForm();\r\n const editdata = await fetch(\"https://611f26499771bf001785c736.mockapi.io/users/\"+ id ,\r\n {\r\n method:\"PUT\"\r\n });\r\n const userdata = await editdata.json();\r\n document.getElementById(\"userName\").value = userdata.name\r\n document.getElementById(\"picture\").value = userdata.avatar\r\n remove(id)\r\n}", "update(req, res, next) {\n if (!req.body) {\n return res.status(400).send({\n message: \"l' utilisateur à mettre à jpour ne peut etre vide!\"\n });\n }\n \n const id = req.params.id;\n \n User.findByIdAndUpdate(id, req.body, { useFindAndModify: false })//chercher un produit \n .then(data => {\n if (!data) {\n res.status(404).send({\n message: `Ne peut mettre à jour avec l'id=${id}. peut etre l' utilisateur ne peut etre trouvé!`\n });\n } else res.send({ message: \"Mise à jour de l' utilisateur a réussi.\" });\n })\n .catch(err => {\n res.status(500).send({\n message: \"Error updating user with id=\" + id\n });\n });\n }", "function updateUser(user) {\n\n schema = {\n name: Joi.string().min(3).required(),\n email: Joi.string().required().email(),\n roles: Joi.string(),\n password: Joi.string().min(8),\n id: Joi.string().required()\n }\n\n return Joi.validate(user, schema)\n}", "function setupEditUserForm(user) {\n document.getElementById('user_id').value = user.user_id; \n document.getElementById('user_username').value = user.username;\n document.getElementById('user_name').value = user.name; \n\n var form = document.getElementById('create_user_form');\n form.onsubmit = submitCreateOrUpdateUser;\n\n var del = document.getElementById('delete_user_submit');\n del.onclick = function(e) {\n deleteUser(user.user_id);\n };\n\n var cancel = document.getElementById('cancel_user_submit');\n cancel.onclick = function() {\n window.location.href = basePath + 'index.html';\n };\n}", "function editEmployee(req,res){\n console.log('editing employee ' ,req.params.id);\n userService.editEmployee(req.params.id)\n .then(function (emp) {\n res.status(200).send(emp);\n })\n .catch(function (err) {\n res.status(400).send(err);\n });\n}", "function updateUser(req,res){\n var userId = req.params.id;\n var update = req.body;\n \n //BORRAR LA PROPIEDAD PASSWORD.\n delete update.password;\n\n if(userId != req.user.sub){\n return res.status(500).send({message: 'No tienes permiso para actualizar los datos del usuario.'});\n }\n\n User.find({$or:[\n {email: update.email.toLowerCase()},\n {nick: update.nick.toLowerCase()}\n ]}).exec((err,users)=>{\n var user_isset = false;\n users.forEach((user)=>{\n if(user && user._id != userId) user_isset = true;\n });\n \n if(user_isset) return res.status(404).send({message: 'Dato en uso.'});\n\n User.findByIdAndUpdate(userId,update,{new:true},(err,userUpdated)=>{\n if(err) return res.status(500).send({message: 'Error en la peticion.'});\n if(!userUpdated) return res.status(404).send({message: 'No se ha podido actualizar el usuario'});\n return res.status(200).send({user: userUpdated});\n });\n });\n}" ]
[ "0.77155644", "0.77038884", "0.76689386", "0.7665904", "0.76140034", "0.7504789", "0.74198294", "0.7414744", "0.74078023", "0.7403332", "0.7389808", "0.727536", "0.7269812", "0.7240016", "0.72125584", "0.7127718", "0.71140206", "0.71104944", "0.70934826", "0.70738894", "0.70363146", "0.7024379", "0.7016817", "0.697808", "0.6970643", "0.6955264", "0.6944925", "0.6930302", "0.68959695", "0.6892631", "0.687442", "0.6857277", "0.6853154", "0.68425506", "0.68356544", "0.68237865", "0.679414", "0.677561", "0.6771367", "0.67709255", "0.67649055", "0.67620766", "0.6735401", "0.6731904", "0.6727156", "0.6722595", "0.67191195", "0.670175", "0.6701746", "0.669737", "0.66855764", "0.6668991", "0.66643804", "0.6663525", "0.66480887", "0.6647011", "0.6637287", "0.66265166", "0.66182214", "0.66143763", "0.6611741", "0.6598248", "0.6596116", "0.65796244", "0.6574333", "0.6573578", "0.65640736", "0.6558871", "0.6558181", "0.65560937", "0.6555505", "0.65539074", "0.6551795", "0.6546111", "0.6542604", "0.65421", "0.6538998", "0.65343636", "0.65266776", "0.6526352", "0.65177965", "0.6513896", "0.6511039", "0.6510441", "0.6506919", "0.6505944", "0.64967495", "0.64811206", "0.647417", "0.64722353", "0.64703035", "0.64689344", "0.64650166", "0.6460692", "0.64592344", "0.6458521", "0.6454361", "0.64483136", "0.643059", "0.642956", "0.64280695" ]
0.0
-1
Delete User from DB
function deleteUser(event){ let id = event.currentTarget.id; fetch(`https://students-3d096.firebaseio.com/${id}.json`, { method: 'DELETE' }) .then(res => res.json()) .then(data => { users = users.filter(user => user.id != id); showUsersInfo(users); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteUser() {\n userService\n .deleteUser(model.userId)\n .then(function() {\n $location.url(\"\");\n });\n }", "function deleteUser(req, res, next) {\n const sql = sqlString.format(`DELETE FROM users WHERE id = ?`, [\n req.params.id\n ])\n db.execute(sql, (err, result) => {\n if (err) return next(err)\n if (!result.affectedRows) return next({ message: 'User not find' })\n res.send({ deleted: true })\n })\n}", "deleteUser(db, id) {\n return db('users').where({ id }).delete();\n }", "function deleteUser(req, res) {\n User.findByIdAndRemove(req.params.id, function (err, user) {\n if (err) return res.status(500).send(\"There was a problem deleting the user.\");\n res.status(200).send(\"User: \" + user.name + \" was deleted.\");\n });\n}", "static deleteUser(req, res) {\n let id = +req.params.id\n User.destroy({\n where: {id}\n })\n .then(data => {\n res.redirect('/users')\n })\n .catch(err => {\n res.send(err)\n })\n }", "deleteUser(req, res) {\n const { user } = req;\n user.destroy()\n .then(() => this.logout(req, res))\n .catch(err => errorHandler(req, res, err));\n }", "function deleteUser(id) {\n return db.query('DELETE FROM users WHERE id= ?', id);\n}", "delete(req, res) {\n\t\t\t// usersModel.destroy({\n\t\t\t// \twhere: {\n\t\t\t// \t\tid: req.user.id\n\t\t\t// \t}\n\t\t\t// }).then(() => {\n\t\t\t// \tres.sendStatus(204);\n\t\t\t// });\n\t\t\t\n\t\t\tif(req.user === USER_NOT_FOUND) {\n\t\t\t\treturn res.sendStatus(404);\n\t\t\t}\n\t\t\tconst query = \"DELETE FROM users where id = $1\";\n\t\t\tconst values = [req.user.id];\n\t\n\t\t\tdb.query(query, values, (err, result) => {\n\t\t\t\tif(err) {\n\t\t\t\t\treturn res.json(err);\n\t\t\t\t}\n\t\t\t\tres.sendStatus(204);\n\t\t\t});\n\t\t\n\t\t}", "function deleteUser() {\n UserService\n .deleteUser(userId)\n .success(function () {\n $location.url(\"/login\");\n })\n .error(function (error) {\n \n });\n }", "function destroy(req, res) {\n db.User.findOneAndRemove({_id: req.params.userId}, function(err, user) {\n console.log('sever error ', err)\n res.send(\"Successfully deleted!\")\n });\n}", "function destroy(req, res) {\n db.User.findOneAndRemove({_id: req.params.id}, function(err, user) {\n console.log('sever error ', err)\n res.send(\"Successfully deleted!\")\n });\n}", "function deleteUser() {\n UserService.deleteUser(model.userId)\n .then(function (response) {\n console.log(response);\n if (response.status == 200) {\n $location.url('/login');\n }\n }, function (rejection) {\n model.errorMessage = \"Sorry an error was encountered and your profile was not deleted. Please try again\";\n });\n }", "async delete({ params, response }) {\n /*** get the user from db */\n const user = await User.query().where(\"id\", params.id).first();\n if (!user) {\n return response.status(404).send({\n message: \"not found\",\n });\n }\n /** delete the user */\n await user.delete();\n\n return response.status(200).send({\n message: \"user removed from database\",\n });\n }", "function deleteUser(req, res) {\n User.findOne({_id: req.body.userID}, function(err, user) {\n if (err) throw err;\n if(user === null) {\n return res.send(\"Error: no such user\");\n }\n user.remove(function(err) {\n if (err) throw err;\n return res.send(\"Success\");\n });\n });\n}", "function deleteUser(request, response) {\n\n\tfunction responseOk(response, user) {\n\t\tresponse.json({\n\t\t\tmessage: 'Usuario eliminado con exito',\n\t\t\tuser\n\t\t})\n\t}\n\n\tfunction respondError(response, error) {\n\t\tresponse.send(error)\n\t}\n\n\tUser.remove({\n\t\t\t_id: request.params.userId\n\t\t})\n\t\t.then(user => responseOk(response, user))\n\t\t.catch(error => respondError(response, error))\n}", "function deleteUser(req, res) {\n var userId = req.params.id;\n\n User.findByIdAndRemove(userId, (err, deleteUser) => {\n if (err) {\n res.status(500).send(\"Error al eliminar el usuario\");\n } else {\n if (!deleteUser) {\n res.status(404).send(\"No se ha podido eliminar el usuario\");\n } else {\n res.status(200).send(deleteUser);\n }\n }\n });\n}", "function deleteUser(req , res , next){\n connection.query('DELETE FROM Usuarios WHERE ID = '+req.params.userId, function (error, success){\n if(error) throw error;\n res.send(200, 'Eliminado con exito');\n }); \n}", "async function deleteUser(req,res){\n if (!req.params.id) {\n return res.status(500).json({error:\"Params emty\"})\n }\n\n await User.findOneAndDelete(req.params.id)\n res.status(200).json({msg: \"user deleted\"})\n}", "async function deleteUser(req, res) {\n const id = req.params.id;\n await Users.deleteUser(id);\n res.status(204).send();\n}", "DeleteUser(req, res) {\n let email = req.params['id'];\n this.UserDB.delete({ email })\n .then(result => res.status(200).json(result))\n .catch(error => res.status(404));\n }", "function deleteUser(userId) {\n return User.findByIdAndRemove(userId);\n}", "async deleteUser(id) {\n return user.findByIdAndDelete(id)\n }", "function deleteUser(event) {\n var deleteBtn = $(event.currentTarget);\n var userId = deleteBtn\n .parent()\n .parent()\n .parent()\n .attr('id');\n userId = parseInt(userId);\n userService\n .deleteUser(userId)\n .then(findAllUsers);\n }", "function delete_user() {\n\tvar uri = \"http://localhost:8081/\" + user.accountType + \"s/\" + user.id;\n\tvar xhr = createRequest(\"DELETE\", uri);\n\txhr.onload = function() {\n\t\tif(xhr.status == 400) alert(\"Format Error\");\n\t\telse if(xhr.status != 200) alert(\"Something went wrong :/\");\n\t\telse {\n\t\t\tlocalStorage.removeItem(\"user\");\n\t\t\twindow.location.href = \"/\";\n\t\t}\n\t}\n\txhr.send();\n}", "function usersDelete(req, res){\n User.findByIdAndRemove({_id: req.params.id}, function(err){\n if (err) return res.status(404).json({message: 'Something went wrong.'});\n res.status(200).json({message: 'User has been successfully deleted'});\n });\n}", "async destroy() {\n const { ctx, service } = this;\n const params = getParams(ctx, 'body');\n const condition = Object.assign({}, params);\n const res = await service.user.crud({\n type: 'deleteOne',\n condition,\n });\n ctx.body = res;\n }", "async function Delete(req, res) {\n res.send(await Model.User.findOneAndRemove({ _id: req.params.id }));\n}", "function deleteUser(req, res) {\n User.findByIdAndRemove(req.params.id)\n .then(user => {\n if(!user) {\n return res.status(404).send({\n message: \"user not found with id \" + req.params.id\n });\n }\n res.send({message: \"user deleted successfully!\"});\n }).catch(err => {\n if(err.kind === 'ObjectId' || err.name === 'NotFound') {\n return res.status(404).send({\n message: \"user not found with id \" + req.params.id\n });\n }\n return res.status(500).send({\n message: \"Could not delete user with id \" + req.params.id\n });\n });\n}", "deleteUser({ commit }, id) {\n commit(\"deleteUser\", id)\n }", "function deleteUser(user) {\n console.log(user, 'deleted');\n}", "function deleteUser(user) {\n console.log(user, 'deleted');\n}", "function deleteUser(req, res) {\n if (req == null || req.params == null) {\n return utils.res(res, 400, 'Bad Request');\n }\n\n if (req.user_id == null) {\n return utils.res(res, 401, 'Invalid Token');\n }\n\n if (req.params.id == null) {\n return utils.res(res, 400, 'Please provide user_id of user to delete');\n }\n\n // Delete the user\n models.User.findOneAndDelete({\n 'user_id': req.params.id\n }, function (err, deletedUser) {\n if (err || deletedUser == null) {\n return utils.res(res, 401, 'Such user does not exist');\n }\n\n // Successfull Deletion\n return utils.res(res, 200, 'User account deleted successfully');\n });\n}", "function delete_user() {\r\n alertBox.hide();\r\n const username = Utils.getInput();\r\n if(Utils.isEmpty(username))\r\n return;\r\n\r\n fetch('./delete', Utils.postUserParam(username)).then(function(response) {\r\n if(response.status !== 200) {\r\n alertBox.show('No such username!', true);\r\n return;\r\n }\r\n\r\n response.json().then(function(data) {\r\n alertBox.show(data.msg, false);\r\n init_saved(); //updates saved list\r\n });\r\n });\r\n }", "deleteUser(db, req) {\n return db.transaction(trx =>\n Promise.all([\n db('users')\n .transacting(trx)\n .where('id', req.user.id)\n .del(),\n db('messages')\n .transacting(trx)\n .where('user_id', req.user.id)\n .del()\n ]));\n }", "function deleteUser() {\n UserService\n .deleteUser(userId)\n .then(function (response) {\n var result= response.data;\n if(result){\n $location.url(\"/login\");\n }else{\n vm.error = \"can't delete you.\"\n }\n });\n }", "deleteUser({ params }, res) {\n User.findOneAndDelete({ _id: params.id })\n .then(dbUserData => {\n if (!dbUserData) {\n res.status(404).json({ message: 'No user found with this id!' });\n return;\n }\n res.json(dbUserData);\n })\n .catch(err => res.status(400).json(err));\n }", "deleteUser({ params }, res) {\n User.findOneAndDelete({ _id: params.id })\n .then(dbUserData => {\n if (!dbUserData) {\n res.status(404).json({ message: 'No user found with this id!' });\n return;\n }\n res.json(dbUserData);\n })\n .catch(err => res.status(400).json(err));\n }", "async function deleteUser(req, res) {\n try {\n let user = req.profile;\n let deletedUser = await user.remove();\n deletedUser.hash_password = undefined;\n deletedUser.salt = undefined;\n res.json(deletedUser);\n }\n catch (err) {\n return res.status(400).json({\n err: dbErrorHandler_1.default.getErrorMessage(err),\n });\n }\n}", "async function Delete(req, res) {\n await User.findByIdAndRemove(req.params.id);\n return res.status(200).send('User successfully deleted');\n}", "function deleteUserController(request, response) {\n const userId = request.params.userId;\n\n model.deleteById(userId);\n\n response.status(httpStatus.NO_CONTENT).send();\n}", "deleteUser({ params }, res) {\n User.findOneAndDelete({ _id: params.id })\n .then(dbUserData => {\n if (!dbUserData) {\n res.status(404).json ({ message: 'There is NO user found by this id!' });\n return;\n }\n res.json(dbUserData);\n })\n .catch(err =>\n res.json(err)\n );\n }", "function deleteUser(req, res) {\n var id = req.params['id'];\n typeModel.deleteAdmin(id)\n .then(res.sendStatus(200))\n }", "destroy(req, res) {\n\n return User\n .findById(req.params.id)\n .then(user => {\n\n if (!user) {\n return res.status(404).send({\n message: 'User Not Found',\n });\n }\n\n return user\n .destroy()\n .then(() => res.status(200).send({\n message: 'User deleted successfully',\n }))\n .catch(error => res.status(400).send(error));\n })\n .catch(error => res.status(404).send(error));\n }", "function deleteUser(req, res, next) {\n getDB().then((db, err) => {\n if (err) return next(err);\n\n db.collection('users')\n .remove({ _id: ObjectID(req.params.id) }, (removeErr, doc) => {\n if (removeErr) return next(removeErr);\n\n res.removed = doc;\n db.close();\n return next();\n });\n return false;\n });\n return false;\n}", "async delete(req, res) {\n try {\n const id = await userRepository.delete(req.params.id);\n res.json('deleted user. redirect to website landing page');\n } catch (err) {\n console.log('error', err);\n }\n }", "function deleteUser(req, res, next) {\n // Let's try to delete user with passed id\n db.none('DELETE FROM users WHERE id = $1', req.params.id)\n .then(function (data) {\n // Return success message\n return res.status(200)\n .json({\n status: 'success',\n message: 'User has been deleted'\n });\n })\n .catch(function (error) {\n // Return an error\n return next(error);\n });\n}", "delete(req, res, next) {\n const id = req.params.id;\n \n User.findByIdAndRemove(id)\n .then(data => {\n if (!data) {\n res.status(404).send({\n message: `Cannot delete user with id=${id}. Maybe user was not found!`\n });\n } else {\n res.send({\n message: \"user was deleted successfully!\"\n });\n }\n })\n .catch(err => {\n res.status(500).send({\n message: \"Could not delete user with id=\" + id\n });\n });\n }", "function deleteUser(event) {\n var removeBtn = $(event.target);\n var removeIndex = removeBtn.attr(\"id\").split('-')[1];\n var removeUserId = users[removeIndex]._id;\n try {\n userService\n .deleteUser(removeUserId)\n .then(function () {\n users.splice(removeIndex, 1);\n renderUsers(users);\n });\n }\n catch (err) {\n console.log(err.name + \": \" + err.message);\n }\n }", "static async deleteUser(req, res, next) {\n try {\n const data = req.body;\n const ret = await this.database.deleteUser(data);\n res.send(ret);\n } catch (error) {\n next(error);\n }\n }", "async delete({response, session, params}){\n const user = await User.find(params.id)\n\n await user.delete()\n\n session.flash({message: 'User has been removed!'})\n return response.redirect('back')\n }", "async function destroy(req, res) {\n try {\n const id = req.params.id;\n\n // get the user from the db\n const user = await User.findByPk(id);\n\n // delete the user from the db\n await user.destroy()\n\n res.json({ message: `user ${user.firstname} ${user.lastname} with id ${user.id} has been deleted from the database.` })\n } catch (error) {\n res.status(400).json({ error: error.message || error })\n }\n}", "function removeUser() {\n UserModel.remove({ _id: '5ccc467de09f3f3b9de92446' }, function(err, user) {\n console.log('remove', err, user)\n })\n}", "removeUser(req, res){\n \n }", "async deleteUser(req,res){\n //función controladora con la lógica que elimina un usuario\n }", "function eliminarPersona(user,res){\n tb_persona.connection.query(\"DELETE FROM persona WHERE id=\" + user.id);\n res.send();\n}", "deleteOne(req, res) {\n if (process.env.NODE_ENV === 'production') {\n res.status(403).send({ message: 'That action is not allowed!' });\n } else {\n User.findById(req.params.id)\n .then((user) => {\n if (!user || user.length < 1) {\n res.status(404).send({ message: 'User doesn\\'t exist' });\n } else if (user.title === 'admin') {\n res.status(403).send({ message: 'Permission denied!' });\n } else {\n User.destroy({\n where: { id: req.params.id },\n cascade: true,\n restartIdentity: true,\n });\n res.send({ message: 'User deleted!' });\n }\n });\n }\n }", "function deleteUser(userId) {\n return UserModel.remove(\n {_id: userId}\n );\n }", "deleteUser(user) {\n if(user.privilege === global.SUPER_ADMIN) {\n console.log(\"Errr! You are trying to delete a super admin user\");\n return 401;\n }\n user = null;\n return user;\n }", "function deleteUser(req, res) {\n\n var id = req.params.id;\n\n Usuario.findByIdAndRemove(id, (err, usuarioBorrado) => {\n\n if( err ) \n return res.status(500).json({\n ok: false,\n mensaje: 'Error al BORRAR usuario',\n errors: { message : err}\n });\n if( !usuarioBorrado ) \n return res.status(400).json({\n ok: false,\n mensaje: 'El Usuario no existe',\n errors: { message : 'No existe un usuario con ese id'}\n });\n\n usuarioBorrado.password = \";)\";\n return res.status(200).json({\n ok: true,\n usuario:usuarioBorrado\n });\n\n\n });\n}", "function remove() {\n // REMOVE FROM DB\n let uid = $rootScope.account.authData.uid;\n $rootScope.db.users.child(uid).remove();\n }", "async delete({response, params}){\n const id = params.id;\n const userDel = await User.findOrFail(id);\n await userDel.delete();\n\n return response.status(201).json('Data berhasil dihapus!!');\n }", "function deleteUser(userKey) {\n\t//\n\tvar firebaseRemoveRef = firebase.database().ref(\"Users/\"+userKey);\n\tfirebaseRemoveRef.remove().then(function(){\n\t\tconsole.log(\"ok\");\n\t}).catch(function(error){\n\t\tconsole.log(\"Falha: \"+error.message)\n\t});\n\tshowData();\n}", "async deleteUser(id) {\n try {\n wlogger.silly(\"Enteried cassandra-db/deleteUser()\")\n\n await this.client.connect()\n\n await this.client.execute(`\n DELETE FROM users WHERE id=${id}\n `)\n\n //await this.client.shutdown()\n } catch (err) {\n wlogger.error(`Error in cassandra-db/deleteUser()`, err)\n throw err\n }\n }", "delete(requisicao, resposta, next){\n try{\n const postgre = new postgresDB();\n const response = postgre.deleteUser(requisicao, resposta, next);\n return response;\n }\n catch(error){\n resposta.status(503).send(error);\n }\n }", "async deleteUser(id){\n let res = await db.query('DELETE FROM users WHERE id = ?', [id]);\n\n return res;\n }", "function deleteUser(id) {\n var url = \"/api/user\" + id;\n return $http.delete(url);\n }", "function deleteUser(app){\n\treturn function(req, res){\n\t\tconst id = req.params.id;\n\t\tif(typeof id === 'undefined'){\n\t\t\tres.sendStatus(BAD_REQUEST);\n\t\t}\n\t\telse{\n\t\t\treq.app.locals.model.users.deleteUser(id).\n\t\t\t\tthen(() => res.end()).\n\t\t\t\tcatch((err) => {\n\t\t\t\t\tconsole.error(err);\n\t\t\t\t\tres.sendStatus(NOT_FOUND);\n\t\t\t\t});\n\t\t}\n\t};\n}", "function userDelete(req, cb){\n var email = req.body['email'] || req.user.email;\n log.info(\"user delete: \" + email + (email != req.user.email?\"(from: \"+req.user.email+\")\":\"\"));\n if(email != req.user.email && !req.user.isAdmin) return cb(errorsList['need-admin']);\n users.deleteAccount(email , cb);\n}", "async function deleteUser () {\n // delete user if exists in the saved list. input will be sent to the request\n await handleSaveList(\"/githubSearch/delete\", \"delete\",\n document.getElementById(\"inputBox\").value.trim());\n }", "deleteUser(userId) {\n this.data[userId] = null;\n this.store.del(userId);\n }", "async remove() {\n const { id } = this;\n const options = {\n TableName: process.env.userTableName,\n Key: ddb.prepare({ id })\n };\n return ddb.call('deleteItem', options);\n }", "function deleteUser(userId) {\n return fetch('https://wbdv-generic-server.herokuapp.com/api/alkhalifas/users/' + userId, {\n method: 'DELETE'\n })\n }", "async function deleteUser(req, res) {\n try {\n var id = req.body._id;\n await usersController.userDeleted(id);\n res.status(200).send('Se elimino el usuario correctamente');\n } catch (e) {\n res.status(500).send('No se encontro el usuario a eliminar ' + e);\n }\n}", "function deleteUser(id) {\n var xhttp;\n xhttp = new XMLHttpRequest();\n xhttp.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n getUsers();\n }\n };\n \n xhttp.open(\"DELETE\", \"http://localhost:8080/api/user/userRemoval/\" + id, true);\n xhttp.setRequestHeader(\"Content-type\", \"application/json\");\n xhttp.send();\n }", "static delete(req, res) {\n\n const getIdUser = parseInt(req.params.user)\n\n GEN_DATA_AGUNAN.destroy({ where: { UserId: getIdUser } })\n .then((data) => {\n res.status(200).json({\n message: \"delete Data success\",\n result: data\n })\n })\n .catch((err) => {\n res.status(500).json({\n message: \"Internal Server Error\",\n log: err\n })\n })\n }", "deleteAccount(){\n let userId = firebase.auth().currentUser.uid;\n this.state.user.delete().then(function() {\n console.log('delete user')\n let ref = firebase.database().ref().child('users/'+userId);\n ref.remove();\n this.props.navigation.navigate('ProfilScreen')\n })\n .catch(function(error) {\n // An error happened.\n console.log(error.message)\n alert('Une erreur est apparue. Déconnectez-vous puis reconnectez-vous avant de réessayer')\n });\n }", "function deleteUser() {\n // TODO: needs to not logout user if catch is trigered\n axios.delete(`https://${serverEndpoint}/user/${user.user_id}`)\n .catch((error) => {\n // TODO: This code should be ofloaded to a helper function\n if (error.response) {\n // The request was made and the server responded with a status code\n // that falls out of the range of 2xx\n console.log(error.response.data);\n console.log(error.response.status);\n console.log(error.response.headers);\n } else if (error.request) {\n // The request was made but no response was received\n // `error.request` is an instance of XMLHttpRequest in the browser and an instance of\n // http.ClientRequest in node.js\n console.log(error.request);\n } else {\n // Something happened in setting up the request that triggered an Error\n console.log('Error', error.message);\n }\n console.log(error.config);\n });\n window.sessionStorage.clear();\n accountService.logout();\n }", "function deleteUser(userId) {\n return new Promise((resolve, reject) => {\n const sql =\n \"DELETE FROM [user] WHERE id = @id\";\n const request = new Request(sql, (err, rowcount, raws) => {\n console.log('rowcount', rowcount);\n console.log('raws', raws);\n if (err) {\n reject(err);\n console.log(err);\n } else if (rowcount == 0) {\n reject({ message: \"User does not exist\" });\n } else if (rowcount === 1) {\n resolve({ message: 'successfully deleted.!' })\n }\n });\n request.addParameter(\"id\", TYPES.Int, userId);\n\n connection.execSql(request);\n });\n}", "destroy(req, res) {\n return this.kernel.model.Userg.removeById(req.params.id)\n .then(function() {\n res.status(204).end();\n })\n .catch(handleError(res));\n }", "function deleteUser(id) {\n return fetch(`${self.url}/${id}`, {method: \"DELETE\"})\n }", "async function deleteUser (user) {\n \n if (!user.uuid) {\n return {msg: 'No uuid specified..'};\n }\n\n return !!await UserModel.destroy({\n where: {\n uuid: user.uuid\n }\n });\n}", "function deleteUser(userID){\n /* Exceptions */\n var func = arguments.callee.toString().match(/function ([^\\(]+)/)[1];\n if (typeof userID != 'number' || !Number.isInteger(userID)){\n throw `${func}: userID must be an integer.`;\n }\n var queryDum = `\n DELETE FROM\n users\n WHERE\n user_id = ?\n `;\n var columnVals = [userID];\n con.query(queryDum,columnVals);\n}", "deleteUserRequest() {\n SuperAgent\n .del('/users/' + this.props.user._id)\n .end((error, response) => {\n if (error) {\n console.log('UserCard - Error deleting user from request');\n } else {\n this.props.removeUser(this.props.index);\n }\n });\n }", "async deleteUser(parent, {\n id\n }, context, info) {\n try {\n const deletedUser = await context.prisma.user.delete({\n where: {\n id\n }\n }); // console.log(deletedUser)\n\n return \"user deleted successfully\";\n } catch (error) {\n return error;\n }\n }", "static async deleteUser(username) {\n let result = await db.query(\n ` DELETE FROM users\n WHERE username = $1\n RETURNING username`,\n [username]\n );\n\n if (result.rows.length === 0) {\n throw new ExpressError(`There exists no user with username ${username}`, 404);\n }\n }", "delete(user) {\n return __awaiter(this, void 0, void 0, function* () {\n if (user == null) {\n throw new nullargumenterror_1.NullArgumentError('user');\n }\n let index = this.users.findIndex(u => u.id == user.id);\n if (index != -1) {\n this.users.splice(index, 1);\n }\n });\n }", "function deleteUser(){ \n let userId = parseInt(event.target.dataset.id)\n\n fetch(`${BASE_URL}/users/${userId}`, {\n method: 'DELETE'\n })\n\n this.location.reload()\n}", "delete(req, res, next, currentUser) {\n if (currentUser && currentUser.isAdmin) {\n User.findByIdAndRemove(req.params.id, (err) => {\n res.sendStatus(200);\n });\n } else {\n res.status(\"401\").send(\"Not authorized, your are not admin!\");\n }\n }", "function deleteUserByUsername(username){\n let deleteUser = (\"DELETE FROM user WHERE username =?\");\n\n // Deletes Username in DB\n conn.query(deleteUser, [username], async function(err, rows, fields){\n if(err) throw err;\n });//Orders query\n\n}", "function removeUser (id) {\n return knex('users').where('id', `${id}`).del()\n}", "function deleteAccount() {\n var gebruiker_id = [session.get('gebruiker_id')];\n databaseManager\n .query(\"DELETE FROM gebruiker WHERE ID_GEBRUIKER = (?) \", [gebruiker_id]);\n alert('Uw account is succesvol verwijderd!');\n }", "function removeUser(req, res, next) {\r\n\tvar userID = parseInt(req.params.id);\r\n\tdb.result('delete from users where id = $1', userID)\r\n\t.then(function (result) {\r\n\t\tres.status(200)\r\n\t\t.json({\r\n\t\t\tstatus: 'success',\r\n\t\t\tmessage: `Removed ${result.rowCount} users`\r\n\t\t});\r\n\t})\r\n\t.catch(function (err) {\r\n\t\treturn next(err);\r\n\t});\r\n}", "deleteUser({ params }, res) {\n Thought.deleteMany({ userId: params.id})\n .then(() => {\n User.findOneAndDelete({ _id: params.id})\n .then((dbUserData) => {\n if(!dbUserData) {\n res.status(404).json({ message: 'There is no user found with that id!'});\n return;\n }\n res.json(dbUserData);\n })\n })\n .catch((err) => res.status(400).json(err));\n }", "function deleteUserElement(req){\n deleteElement(dataTable_users,'#user_'+req.request.data);\n updateUserSelect();\n}", "static async delete(username) {\n\t\tconst dbQuery = \"DELETE FROM users WHERE username = $1 RETURNING username\";\n\t\tconst dbRes = await db.query(dbQuery, [username]);\n\n\t\tif (dbRes.rows.length === 0) {\n\t\t\tthrow { message: `There is no user with a username '${username}`, status: 404 };\n\t\t}\n\t}", "function deleteUser(user) {\n return axios.delete(api_host+\":\"+api_port+\"/api/user/\"+user.id)\n .then( res => {\n return res.data;\n })\n .catch( err => {\n console.log(err);\n });\n}", "function unregister() {\n\t\t\tUserService\n\t\t\t\t.deleteUser(vm.userId)\n\t\t\t\t.then(\n\t\t\t\t\tfunction(){\n\t\t\t\t\t\t// Take the user to login page on successful deletion\n\t\t\t\t\t\t$rootScope.currentUser = null;\n\t\t\t\t\t\t$location.url(\"/login\");\n\t\t\t\t\t},\n\t\t\t\t\tfunction(){\n\t\t\t\t\t\t// Display failure message\n\t\t\t\t\t\tvm.deleteError = \"Error! \";\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t}", "function deleteUser(req, res) {\n console.log('deleteUser function called')\n\n var userID = req.body.userID || ''\n\n if (!userID || userID == '') {\n res.status(412).json(new ApiResponse(412, \"Please provide a userID\")).end()\n return\n }\n\n db.query('SELECT * FROM user WHERE userID = ?', [userID], function (error, rows, fields) {\n\n // Handle Mysql Errors\n if (error) {\n res.status(500).json(new ApiResponse(500, err)).end()\n }\n\n var query = {\n sql: 'DELETE FROM user WHERE userID = ?',\n values: userID,\n timeout: 3000\n }\n\n db.query(query, (err, response, fields) => {\n if (err) {\n res.status(500).json(new ApiResponse(500, err)).end()\n }\n res.status(200).json(new ApiResponse(200, \"Succesfully deleted user\")).end()\n })\n })\n\n\n}", "function deleteUser(user) {\n return new Promise((resolve, reject) => {\n console.log(\"Delete user: \" + user.username + \"\");\n admin.auth()\n .deleteUser(user.uid)\n .then( () => {\n console.log(user.uid + \" deleted.\");\n resolve(user);\n })\n .catch( e => {\n console.log([e.message, user.name, \"could not be deleted!\"].join(' '));\n resolve(user);\n });\n admin.database().ref(\"/users\").remove();\n admin.database().ref(\"/usernames\").remove();\n });\n }", "function deleteUser(userData) {\n // Makes sure that currentUser is set before getting messages from the server\n AuthFactory.auth.$onAuthStateChanged(function(currentUser) {\n\n if(currentUser){\n currentUser.getToken().then(function(idToken) {\n return $http({\n method: 'DELETE',\n url: '/profile-edit/delete-user/' + mentorId,\n headers: {\n id_token: idToken\n },\n data: {\n userData: userData\n }\n })\n .then(function(response) {\n getProfiles();\n }),\n function(error) {\n console.log('Error with user DELETE request: ', error);\n };\n });\n }\n });\n }", "function deleteUser(userId) {\n var url = \"/api/user/\" + userId;\n return $http.delete(url);\n }" ]
[ "0.79460835", "0.7927555", "0.7870987", "0.7849442", "0.78420573", "0.7826598", "0.78052", "0.7801093", "0.7746416", "0.774003", "0.77113277", "0.76761335", "0.76386476", "0.7607396", "0.7600734", "0.7570766", "0.75533706", "0.75363594", "0.75140965", "0.7505278", "0.7503326", "0.74975866", "0.74891794", "0.74755484", "0.74727434", "0.7430397", "0.7427035", "0.74263155", "0.742328", "0.74218774", "0.74218774", "0.7416272", "0.7403318", "0.74018764", "0.7388041", "0.73874146", "0.7382194", "0.7381509", "0.7378948", "0.73633265", "0.73619384", "0.73594844", "0.7346124", "0.7341711", "0.73313063", "0.73294216", "0.7327485", "0.73256856", "0.7323599", "0.7322717", "0.7316294", "0.7283631", "0.7283202", "0.7259646", "0.72579265", "0.72576433", "0.7255687", "0.7241658", "0.72163147", "0.72041845", "0.7179201", "0.7175586", "0.7165036", "0.71635306", "0.71591985", "0.71503377", "0.7144438", "0.7129962", "0.70939744", "0.70682096", "0.70648545", "0.7052992", "0.7047796", "0.70476586", "0.7040288", "0.70378524", "0.7033458", "0.70152754", "0.7013327", "0.69919777", "0.69871795", "0.6981418", "0.6973456", "0.6972394", "0.6971013", "0.6968344", "0.69632614", "0.6957598", "0.6952494", "0.69494987", "0.6927706", "0.6923628", "0.69217515", "0.691691", "0.69157106", "0.6906797", "0.6895012", "0.68937457", "0.6889903", "0.686993", "0.6851692" ]
0.0
-1
Using url parameter and json context as reference renders the numFact object or just text. Props: None Context: json numFact updateCurrNumberString Router > (APIResponse)
function APIResponse() { const { parameter } = useParams(); const {numFact, updateCurrNumberString, json} = useContext(NumberContext); useEffect(() => { updateCurrNumberString(parameter, true) }, []) // eslint-disable-line react-hooks/exhaustive-deps return ( <div className="API">{json ? JSON.stringify(numFact) : numFact.text}</div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getFactAjax1(){\r\n let number = numberInput.value;\r\n if(number != ''){\r\n let xhr = new XMLHttpRequest();\r\n xhr.open('GET', 'http://numbersapi.com/'+number);\r\n\r\n xhr.onload = function(){\r\n if(this.status == 200){\r\n fact1.style.display = 'block';\r\n factText1.innerText = this.responseText;\r\n }\r\n }\r\n\r\n xhr.send(); \r\n }\r\n }", "function directBasedOnNum(reference) {\n\n\n\tconsole.log('name: ' + slotValue_companyName); \n\tconsole.log('country: ' + slotValue_country); \n\tconsole.log('region: ' + slotValue_region); \n\tconsole.log('content: '+ slotValue_certificationScenario); \n\tconsole.log('date: '+ slotValue_date); \n\t// console.log('solution: '+ slotValue_solution); \n\n\n\tvar query = format.queryToURLForm(slotValue_companyName, slotValue_country, slotValue_region, slotValue_certificationScenario, slotValue_date); \n\n\trequest.requestGetNum(query, function(response) { \n\n\t\tvar total = response.results.total; \n\t\tvar successful = response.results.successful; \n\t\tvar inProgress = response.results.inProgress; \n\n\t\tvar outputText = ''; \n\n\t\t// var numResults = output; \n\n\t\t// if 0 results found \n\t\tif (total === 0) { \n\n\t\t/*\texpand results unabled \n\n\t\t// zero results, country given\n\t\tif (slotValue_country !== null) { \n\n\t\t\t\t// attempt to offer to expand results in entire region - unabled \n\n\t\t\t\t// nullify current slotValue_country and run search in region \n\t\t\t\t// var URL = hostNum + format.queryToURLForm(slotValue_name, null, global_region, slotValue_content, slotValue_date, slotValue_solution); \n\n\t\t\t\t//var URL = hostNum + format.queryToURLForm(slotValue_name, null, global_region, slotValue_content, slotValue_date); \n\n\t\t\t\tvar query_2 = format.queryToURLForm(slotValue_name, null, global_region, slotValue_content, slotValue_date); \n\n \t\t\t//Request(URL, function(response) { \n\n \t\t\trequest.requestGetNum(query_2, function(response) { \n\n\t\t\t\t\tvar outputText_noResults = 'No results found for ' + format.formatQuery(slotValue_name, slotValue_country, slotValue_region, slotValue_content, slotValue_date) + '. You can start over by saying start over or say cancel to cancel.' \n\t\t\t\t\tvar outputText_offerExpand = 'No results found for ' + format.formatQuery(slotValue_name, slotValue_country, slotValue_region, slotValue_content, slotValue_date) + '. Would you like to search in the region?'; \n\n\t\t\t\t\tvar total = response.results.total; \n\n\t\t\t\t\t// if results in region \n\t\t\t\t\tif (total > 0) { \n\n\t\t\t\t\t\treference.handler.state = states.EXPAND_SEARCH; \n\t\t\t\t\t\treference.emit(':ask', outputText_offerExpand, outputText_offerExpand); \n\n\t\t\t\t\t}\n\n\t\t\t\t\t// if no results in region \n\t\t\t\t\telse { \n\n\t\t\t\t\t\treference.handler.state = states.NO_RESULTS; \n\t\t\t\t//\t\treference.emit(':ask', outputText_noResults, outputText_noResults); \n\t\t\t\t\t\treference.emit(':ask', updated_noResults(), againNoResults); \n\n\t\t\t\t\t}\n\n\t\t\t\t}); \n\n\t\t\t//\tvar expandQuery = 'No results found for ' + format.formatQuery() + '. Would you like to search in the region?'; \n\t\t\t//\treference.handler.state = states.EXPAND_SEARCH; \n\t\t\t//\treference.emit(':ask', expandQuery, expandQuery); \n\n\t\t\t} \n\n\t\t\telse { \n\n\t\t\t\treference.handler.state = states.NO_RESULTS; \n\t\t\t\treference.emit(':ask', updated_noResults(), againNoResults); \n\n\t\t \t} \n\n\n\n\t\t \t*/ \n\n\n\t\t\t\treference.handler.state = states.NO_RESULTS; \n\t\t\t\treference.emit(':ask', updated_noResults(), againNoResults); \n\n\n\t\t}\n\n\t\t// if 1 result found \n\t\telse if (total === 1) { \n\t\t\treference.handler.state = states.ONE_RESULT;\n\t\t\treference.emit(':ask', updated_oneResult(), againOneResult);\n\n\t\t} \n\n\t\t// multiple results found \n\t\telse {\n\n\t\t\t// would you like to narrow down answers \n\t\t\treference.handler.state = states.MULTIPLE_RESULTS; \n\n\t\t\t// if within threshold\n\t\t\tif (total <= resultThreshold) { \n\t\t\t\treference.emit(':ask', updated_moreResults(total, successful, inProgress), updated_againMoreResults(total)); \n\t\t\t}\n\n\t\t\t// if above threshold \n\t\t\telse { \n\t\t\t\treference.emit(':ask', updated_moreThanThreshold(total, successful, inProgress), updated_againMoreThanThreshold(total)); \n\n\t\t\t}\n\t\t\n\n\t\t\t// ------------------------------------------------------------- WOULD THIS WORK?????? --------------------------------------------------------------------\n//\t\t\temitMoreResults(reference); \n\t\t\t// var outputText = numResults + ' results found for ' + format.formatQuery() + '. Continue selecting?'; \n\t\t\t//reference.emit(':ask', updated_moreResults(total, successful, inProgress), updated_againMoreResults(total)); \n\n\t\t\t} \n\n\t }); \n\n\t//\tvar numResults = getNumResults(); \n\t//\tvar query = format.formatQuery();\n\n\n}", "function getFactFetch(){\n let number = numberInput.value;\n\n if (number != '') {\n fetch(`${proxy}http://numbersapi.com/${number}`).then(res => res.text()).then(data => {\n fact.style.visibility = 'visible';\n factText.innerText = data;\n }).catch(error => console.error(error));\n }\n}", "function SandboxCard() {\n const {currNumberString, numFact, updateCurrNumberString, json} = useContext(NumberContext);\n\n function handleChange(evt) {\n const {value} = evt.target\n updateCurrNumberString(value)\n }\n \n // treat 'Enter' as submit, update context and url\n function handleEnter(evt) {\n if(evt.key === 'Enter') {\n let value = evt.target.value\n updateCurrNumberString(value, true)\n //updates url to append pathname to end of hostname\n window.history.replaceState({}, document.title, `/fact/${value}`)\n }\n }\n return (\n <div className=\"outer-search\">\n <div className=\"search-box\">\n <div id=\"search-box\">\n <label>\n <Link to={`/API/${currNumberString}`}>numbersapi.com/</Link></label>\n <span>\n <input \n id=\"search-text\" \n name=\"search\"\n type=\"text\" \n value={currNumberString} \n onChange={handleChange} \n onKeyDown={handleEnter}\n />\n </span>\n </div>\n <div id=\"search-result\" className=\"api-result\">\n <div id=\"counter\"><Counter /> </div>\n <span id=\"result-temporary-text\">\n {json ? JSON.stringify(numFact) : numFact.text}\n </span>\n </div>\n <div/>\n </div>\n </div>\n )\n}", "async function updateCurrNumberString(val, action=false) {\n if(currNumberString !== val) {\n setCurrNumberString(val);\n }\n if(action || !numFact) {\n let resp = await Api.getNumberFact(val);\n setNumFact(() => resp)\n }\n }", "function provideFact(assistant) {\n var number;\n var url = NUMBERS_API_BASE_URL;\n var type;\n\n for (var fact_type in FACT_TYPES) {\n console.log('fact_type=' + fact_type);\n if (assistant.getArgument(fact_type) != null) {\n type = fact_type;\n break;\n }\n }\n\n if (type == null) type = DEFAULT_TYPE;\n assert(typeof (type) != \"undefined\", 'fact type is undefined');\n\n console.log(\"type=\" + type);\n\n if (type == MATH_ARGUMENT || type == DEFAULT_TYPE) {\n number = assistant.getArgument(NUMBER_ARGUMENT);\n } else {\n console.log(\"Arg=\" + assistant.getArgument(type));\n number = extractNumber(assistant.getArgument(type), type);\n }\n\n assert(number, 'number is null');\n console.log(\"number = \" + number);\n\n url += \"/\" + number + \"/\" + FACT_TYPES[type];\n sendRequest(url, callback);\n }", "function numberFormatsEndpoint(categoryguid){\n request.get({\n headers: {\n 'content-type': 'application/json',\n 'arena_session_id': accessToken\n },\n url: 'https://api.arenasolutions.com/v1/items/numberformats',\n body: JSON.stringify({\n \"email\": email,\n \"password\": password,\n \"workspaceId\": workspace\n })\n }, individualNumberFormats); \n}", "async function numFact() {\n\tlet response = await axios.get(`${baseURL}/${favNum}?json`);\n\tconsole.log(response.data.text);\n}", "function displayUnitTestResult(req, num)\n{\n var unitTestId = 'unit-test-status-' + num;\n\n if(req.responseText.length < 512)\n {\n document.getElementById(unitTestId).innerHTML =\n req.responseText;\n }\n else\n {\n leadingZeros = \"\";\n if(num < 10)\n {\n leadingZeros = \"000\";\n }\n else if(num < 100)\n {\n leadingZeros = \"00\";\n }\n else if(num < 1000)\n {\n leadingZeros = \"000\";\n }\n else if(num < 10000)\n {\n leadingZeros = \"0\";\n }\n\n var formattedNum = leadingZeros + num;\n var baseTcUrl = getBaseTcUrl();\n var htmlUrl = baseTcUrl + formattedNum + \".xhtml\";\n var sparqlUrl = baseTcUrl + formattedNum + \".sparql\";\n var expectedResult = \"true\";\n\n document.getElementById(unitTestId).innerHTML =\n \"<a href=\\\"javascript:checkUnitTest(\" + num + \",'\" +\n htmlUrl + \"','\" + sparqlUrl + \"','\" + expectedResult +\n \"')\\\" style=\\\"font-weight: bold; color: #f00\\\">ERROR</a>\" ;\n }\n}", "function refreshNumInCart(num) {\n if (num == -1) {\n //Onload => param = -1\n var documentRoot = document.getElementById(\"documentRoot\").innerText;\n var xhttp = new XMLHttpRequest();\n\n xhttp.onreadystatechange = function () {\n if (this.readyState == 4 && this.status == 200) {\n //Get result = result of function amountIncart() in CartController\n document.getElementById(\"cartAmountId\").innerText = this.responseText;\n }\n };\n //Call function amountInCart() in CartController\n xhttp.open(\"GET\", `${documentRoot}/cart/amountInCart`, true);\n xhttp.send();\n } else {\n //Add to cart => new result = param 'num'\n document.getElementById(\"cartAmountId\").innerText = 0;\n }\n}", "function displayUnitTestDetailsResult(req, num)\n{\n document.getElementById('unit-test-details-' + num).innerHTML =\n req.responseText;\n}", "function getFactAjax2(){\r\n let year = yearInput.value;\r\n if(year != ''){\r\n let xhr = new XMLHttpRequest();\r\n xhr.open('GET', 'http://numbersapi.com/'+year+'/year');\r\n\r\n xhr.onload = function(){\r\n if(this.status == 200){\r\n fact2.style.display = 'block';\r\n factText2.innerText = this.responseText;\r\n }\r\n }\r\n\r\n xhr.send(); \r\n }\r\n }", "function getNumber(){\r\n fetch(url,{method: 'GET', \r\n})\r\n .then(reponseThis =>{ //reponseThis จริงๆแล้วเขียนค่าอะไรก็ได้ แต่หลักๆคนเขามักเขียน response\r\n //console.log(reponseThis)\r\n return reponseThis.json();\r\n })\r\n .then(getData => { //getData จริงๆแล้วเขียนค่าอะไรก็ได้ แต่หลักๆคนเขามักเขียน data\r\n //console.log(getData)\r\n appendDataToElement(getData[0].id)\r\n appendUidToElement(getData[0].uid)\r\n })\r\n}", "function renderNumber(number) {\n numberView.innerText = number\n}", "function individualNumberFormats(err, httpResponse, body){\n //var data = body;\n var numFormatResults = JSON.parse(body).results;\n console.log(\"****ITEM NUMBER RESULTS = \", numFormatResults);\n console.log(\"????? ITEM TEST ARRAY\", testArray);\n for (var m = numFormatResults.length - 1; m >= 0; m--) {\n searchName = String(numFormatResults[m].name).split(/-(.+)?/)[1];\n console.log(\"SEARCH STRING = \", String(searchName));\n //resultObject[m] = searchme(String(searchName), testArray);\n if(typeof searchName != \"undefined\" && searchName !== 'undefined' && typeof testArray[searchName] != \"undefined\"){\n console.log(\"Adding number api name from guid = , \", numFormatResults[m].guid);\n \n request.get({\n headers: {\n 'content-type': 'application/json',\n 'arena_session_id': accessToken\n },\n url: 'https://api.arenasolutions.com/v1/items/numberformats/'+numFormatResults[m].guid,\n body: JSON.stringify({\n \"email\": email,\n \"password\": password,\n \"workspaceId\": workspace\n })\n }, individualNumberFormatsResults);\n\n }\n }\n}", "function refreshOrderNumberDisplay() {\n document.getElementById(\"order_num_disp\").innerHTML =\n \"Order #\" + store.get(\"order_num\", \"ORDER NUM NOT SET\");\n}", "function testGetStringInt() {\n document.getElementById(\"httpRequest\").innerHTML = \"/123ABC\";\n fetch(baseURL + \"/123ABC\")\n .then(res => res.text())\n .then(res => {\n console.log(res);\n document.getElementById(\"httpResponse\").innerHTML = res;\n })\n}", "function renderCurrentQuestionStatus(questionNum) {\n\t$('.js-question-number').html(`<p>Question <span>${QUESTIONS[questionNum].number}</span> of 10</p>`);\n}", "function getRequestToApi() {\n var numbersApi = 'http://numbersapi.com/81';\n var response = UrlFetchApp.fetch(numbersApi).getContentText();\n Logger.log(response);\n}", "function callAPIUsingFetch(){\n fetch(URL).then(res=> res.json()).then(parsedData=>{\n const value = parsedData.bpi.USD.rate_float;\n priceText.innerText = value;\n })\n}", "function MakeAPICallToRanking(metric) {\n\n var url = base_url + \"review/ranking/\" + metric;\n var xhr = new XMLHttpRequest();\n var anime_url = url\n //Make the get request\n xhr.open(\"GET\", anime_url, true);\n var jsonResponse;\n\n xhr.onload = function(e) {\n jsonResponse = xhr.responseText.toString();\n //Do some parsing for the response\n jsonResponse.replace((/([\\w]+)(:)/g), \"\\\"$1\\\"$2\");\n\n jsonResponse = jsonResponse.replace(/NaN/g, '0');\n //Convert the response to a json object\n jsonResponse = JSON.parse(jsonResponse);\n\n var data = jsonResponse[\"data\"];\n //Update the UI in this function\n updateRankingAnimes(data, metric);\n\n }\n\n xhr.onerror = function(e) {\n console.error(xhr.statusText);\n }\n\n xhr.send(null);\n\n}", "function getMathFact(number) {\n\tvar url = \"http://numbersapi.com/\" + number + \"/math?default=not+found\";\n\tvar fact = 'I am here!';\n\trequest(url, 'GET', function(respText) {\n\t\t//return 'I am here!';\n\t\t//return respText;\n\t\tfact = respText;\n\t});\n\treturn fact;\n}", "function getHistoricalRecCount() {\n\n\tdojo\n\t\t\t.xhrGet({\n\t\t\t\t// The following URL must match the destination\n\t\t\t\t// url:\n\t\t\t\t// \"http://webcomponentdemo13.alpha.vmforce.com/getHistoricalRecCount\",\n\t\t\t\t// url :\n\t\t\t\t// \"http://localhost:28093/webcomponent/getHistoricalRecCount\",\n\t\t\t\turl : \"http://localhost:28093/webcomponent/getHistoricalRecCount\",\n\t\t\t\t//url : \"http://mdmoncloud.alpha.vmforce.com/getHistoricalRecCount\",\n\t\t\t\thandleAs : \"text\",\n\t\t\t\ttimeout : 5000, // Time in milliseconds\n\n\t\t\t\t// The LOAD function will be called on a successful response.\n\t\t\t\tload : function(response, ioArgs) { //\n\t\t\t\t\tserverResponse = response;\n\t\t\t\t\t// alert(\"serverResponse \"+serverResponse);\n\t\t\t\t\tstatArray = serverResponse.split(\"|\");\n\t\t\t\t\t// alert(\"statArray \"+statArray);\n\t\t\t\t\tnumberOfRecPropcessed1 = statArray[0];\n\t\t\t\t\tnumberOfRecPropcessed2 = statArray[1];\n\t\t\t\t\tnumberOfRecPropcessed3 = statArray[2];\n\t\t\t\t\tnumberOfRecPropcessed4 = statArray[3];\n\t\t\t\t\treturn response; // \n\t\t\t\t},\n\n\t\t\t\t// The ERROR function will be called in an error case.\n\t\t\t\terror : function(response, ioArgs) { // \n\t\t\t\t\tconsole.error(\"HTTP status code: \", ioArgs.xhr.status); //\n\t\t\t\t\tdojo.byId(\"replace\").innerHTML = 'Loading the ressource from the server has failed'; // \n\t\t\t\t\treturn response; // \n\t\t\t\t},\n\n\t\t\t\t// Here you put the parameters to the server side program\n\t\t\t\t// We send two hard-coded parameters\n\t\t\t\tcontent : {\n\t\t\t\t\tname : \"lars\",\n\t\t\t\t\turl : \"testing\"\n\t\t\t\t}\n\t\t\t});\n\n}", "function handleResponse(resp) {\n let num =resp.data.num.num;\n let num_fact = resp.data.num.fact;\n let year = resp.data.year.year;\n let year_fact =resp.data.year.fact;\n $(\"#lucky-results\").html(`Your lucky number is ${num}. ${num_fact}. Your birth year ${year} fact is ${year_fact}`)\n}", "function radlibs_render(json, update_form) {\n\n var rval = '';\n var template;\n\n template =\n \"TECHNIQUE:\\n\" +\n \"Multiple {{ te.mo }}{{# te.mo }} {{/te.mo}}images of the pelvis were obtained{{#te.cn}} after the intravenous administration of {{#te.vc}}{{ te.vc }} mL of {{/te.vc}}{{ te.cn }} contrast{{ #te.rc }} at {{ te.rc }} mL/sec{{/te.rc}}{{/te.cn}}. {{ te.co }}\\n\" +\n \"Image quality was {{te.qu}}{{^te.qu}}adequate{{/te.qu}}.\\n\" +\n \"\\n\" +\n \"FINDINGS:\\n\" +\n \"Tumor location:\\n\";\n \n rval += Mustache.to_html(template,json);\n \n if (radlibs_has_path(json,'lo.SphincDist') ) {\n json.lo['SphincDist_helper'] = (parseInt(json.lo.SphincDist) > 0) ? 'The tumor involves the anal sphincter complex.' : 'Distance from the lowest extent of the tumor to top of anal sphincter (i.e. puborectalis): ' + json.lo.SphincDist + ' cm.'; \n }\n \n template = \n \"Distance from the lowest extent of the tumor to anal verge: {{lo.VergDist}} cm.\\n\" +\n \"{{SphincDist_helper}}\\n\" +\n \"Relationship to peritoneal reflection: {{lo.PerRef}}.\\n\\n\";\n \n rval += Mustache.to_html(template,json); \n \n template = \n \"Tumor size and characteristics:\\n\" +\n \"Craniocaudal extent: {{ch.CCsize}} cm.\\n\" +\n \"{{CircExFrom_helper}}\\n\";\n \n if (radlibs_has_path(json,'ch.CircExFrom') && radlibs_has_path(json,'ch.CircExTo') ) {\n if (json.ch.CircExFrom == \"circ\" || json.ch.CircExTo==\"circ\") {\n json.CircExFrom[\"CircExFrom_helper\"] = 'The tumor extends circumferentially.\\n';\n } else {\n json.CircExFrom[\"CircExFrom_helper\"] = \"Circumferential extent: \" + json.ch.CircExFrom + \" o'clock to \" + json.ch.CircExTo + \" o'clock.\\n\";\n }\n\t}\n\n rval += Mustache.to_html(template,json); \n return rval;\n\n} // radlibs_render", "function custom_printing(id,redirect_url){\n var generate_number = function(id){\n jQuery.ajax({\n url:getBase()+'factures/generate_aserb_number/'+id,\n dataType:'json',\n success:function(r){ \n if(r.success){\n jQuery('#displayed_num').text('n° '+r.no).css({'display':'inline'});\n jQuery('#displayed_num').attr('type','aserb');\n if(redirect_url.indexOf(\"ventes\") > -1){\n document.location.href=getBase()+'factures/view/'+id+'/standard/2';\n print_facture(id,getBase()+'ventes/print_facture/'+id+'/1');\n }\n else {\n print_documents('export',redirect_url);\n }\n }\n else {\n alert(r.msg);\n }\n }\n });\n };\n\n var desired_number = prompt(\"Entrer le numéro souhaitez :\");\n desired_number = (desired_number)? desired_number: 0;\n if(desired_number !== 0){\n jQuery.ajax({\n url:getBase()+'factures/check_aserb_number_availability/'+id+'/'+desired_number,\n dataType:'json',\n success:function(r){ \n if(r.success){\n generate_number(id);\n }\n else {\n alert(\"the desired number \"+desired_number+\" is not available\");\n custom_printing(id, redirect_url);\n }\n }\n });\n }\n else { generate_number(id);}\n \n}", "function onLoad(){\n getRequest(\"/display-current\", displayData);\n}", "function handleResponse(resp) {\n return `\n <div>\n Your lucky number is ${resp.num.num} (${resp.num.fact})\n </div>\n <div>\n Your birth year (${resp.year.year}) fact is ${resp.year.fact}\n </div>\n ;`\n\n}", "function useApiData(data){\n\n for (var i = 0; i < data.hits.length; i++) {\n\ndocument.querySelector(\"#content\").innerHTML+=`\n\n\n<div class=\"w3-card-4\">\n <div class=\"card-group\">\n <div class=\"w3-container w3-center\">\n <img class=\"card-img-top\" src=\"${data.hits[i].recipe.image}\" alt=\"Card image cap\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${data.hits[i].recipe.label}</h5>\n <p class=\"card-text\">${data.hits[i].recipe.healthLabels}</p>\n <br> Calories:\n ${data.hits[i].recipe.calories}\n </p>\n <a href=\"${data.hits[i].recipe.url}\" class=\"w3-button w3-green\">Source</a>\n </div>\n </div>\n </div>\n </div>\n\n <pre class=\"tab\"></pre>\n\n`\ndocument.querySelector(\"#resultnum\").innerHTML=`<p>Number of Results: </p>${data.hits.length}`\n\n}\n\n}", "function UpdateUI(url, data)\n{\n if (url.indexOf(\"AddMoney\") !== -1)\n {\n $('#remainingAmount').text(data.toFixed(2));\n }\n else if (url.indexOf(\"DispenseCoffee\") !== -1)\n {\n DispenseCoffeeUI(data);\n }\n else if (url.indexOf(\"AddCoffee\") !== -1)\n {\n AddCoffeeUI(data);\n }\n else if (url.indexOf(\"DispenseChange\") !== -1)\n {\n DispenseChangeUI(data);\n }\n}", "function changeItemNumber(id, value) {\n //modifycartitemnumber?id=33&count=12\n var xhttp = new XMLHttpRequest();\n xhttp.open(\"GET\", \"modifycartitemnumber?id=\" + id + \"&count=\" + value, true);\n xhttp.send();\n\n}", "function updateRequestDisplay() {\n apiRequest.textContent = 'https://analytics.api.brightcove.com/v1/data?accounts=ACCOUNT_ID';\n if (selectedDimensions.length > 0) {\n apiRequest.textContent += '&dimensions=' + selectedDimensions.join(',');\n }\n if (fieldsToReturn.length > 0) {\n apiRequest.textContent += '&fields=' + fieldsToReturn.join(',');\n }\n }", "function useApiData(data) {document.querySelector(\"#content\").innerHTML = `\n<img src=\"${data.hits[0]recipe.image}\">\n<h5>${data.hits[0].recipe.label}</h5>\n<p>Source: ${data.hits[0].recipe.source}</p>\n<a href=\"${data.hits[0].recipe.url}\">Go conferir</a>\n`\n}", "function retrieveData() {\n $.ajax({\n method: 'GET',\n url: '/calculate',\n success: function(response) {\n console.log('the calculated data returned is:', response);\n // answer = response.number;\n $('.display-screen-span').append('<span> = ' + response.number + '</span>');\n\n var output = '';\n for (var index = 0; index < response.history.length; index++) {\n output += '<p>' + response[index].history.inputOne + ' ' + response[index].history.operation + ' ' + response[index].history.inputTwo + ' = ' + response[index].history.answer + '</p>';\n }\n $('.history-screen').html(output);\n\n stage = 'third';\n operation = 'none';\n firstNumber = '';\n secondNumber = '';\n\n // run post request to add the answer to the history module\n // $.ajax({\n // method: 'POST',\n // url: '/calculate/answer',\n // data: {answer: answer},\n // success: function(response){\n // console.log('object sent as answer:', object);\n // console.log('response is:', response);\n\n // displayHistory();\n // },\n // error: function(error){\n // console.log('The \"/calculate/answer\" ajax post request failed with error: ', error);\n // }\n // });\n }\n });\n}", "function recepieInfo( idStr ){ // load and render a specific recepie with idString\n\tif ( !validateUser() ){ return; }\n\t// console.log(\"Get recepie:\", idStr, \"and render in recepieEdit template\");\n\tlet url = `https://cookuniproject-default-rtdb.firebaseio.com/recepies/${idStr}.json`;\n setInfoBox();\n\tfetch(url)\n .then(function (response) {\n if( response.status < 300 ){\n clearInfoBox();\n }\n return response.json();\n })\n .then(function (data) {\n // console.log(\"Recepie Info Data:\", JSON.stringify(data)); // recepie ID\n let src = document.getElementById(\"recepieInfo\").innerHTML;\n let template = Handlebars.compile(src);\n data.recepieID = idStr;\n if( user == data.creator ){\n data.author = true;\n }else{\n data.author = false;\n }\n let context = data;\n let html = template(context);\n // console.log(html);\n render(html);\n return data;\n });\n}", "getDisplayNumber(number) {\n return number;\n }", "function nutritionixApi(foodForApi, j){\n \n var calorieOutput = document.createElement(\"div\");\n calorieOutput.classList.add(\"calorie-output\");\n\n document.querySelectorAll(\".food-input\")[j].appendChild(calorieOutput); \n\n // var nutriQuery = 'https://api.nutritionix.com/v1_1/search/'+ foodForApi +'?results=0:20&fields=item_name,brand_name,item_id,nf_calories&appId=a78c3a3d&appKey=23e36dd6dd3f508d048df44067e0d944'\n var nutriQuery = 'https://api.nutritionix.com/v1_1/search/'+ foodForApi +'?results=0:20&fields=item_name,brand_name,item_id,nf_calories&appId=aa0c257f&appKey=36d2338b2c677899f5ad2f35c9ae1404'\n\n // API call\n $.ajax({\n url: nutriQuery,\n method: \"GET\"\n }).then(function(res) {\n\n calorieTotal = res.hits[0].fields.nf_calories;\n totalCount += res.hits[0].fields.nf_calories;\n\n document.querySelectorAll(\".calorie-output\")[j].textContent = Math.round(calorieTotal);\n\n document.querySelector(\"#total-count\").textContent = \"Total = \" + Math.round(totalCount);\n\n // console.log(\"Current Calorie Total: \" + Math.round(calorieTotal));\n // foodInput.nextElementSibling.textContent = calorieTotal\n\n });\n \n}", "function loadFromNumberJson(json) {\n // update html\n jQuery('#number').html(json.number);\n jQuery('#contents').html(json.text.replace(json.number, '...'));\n\n // update text to be sent over twitter\n var twitterShareText;\n\n if (json.text.length > 137) {\n twitterShareText = json.text.slice(0, 137) + \"...\";\n } else {\n twitterShareText = json.text;\n }\n jQuery('#twitter').attr(\"href\", BASE_TWITTER + encodeURIComponent(twitterShareText));\n}", "function compute(n, url, selection) {\n var calc = '';\n\n $.ajax({\n type: \"GET\",\n dataType: \"html\",\n url: url + \"/\" + n,\n data: n,\n\n success: function(msg) {\n calc = \"The \" + selection + \" for \" + n + \" is \" + msg;\n $(\"#output\").html(calc);\n },\n\n error: function(thrownError) {\n $(\"#option\").html(calc);\n }\n });\n}", "function updateDisplay(){\n //make get request for answer + history\n $.ajax({\n type: 'GET',\n url: '/calculation'\n }).then(function(response) {\n console.log('back from GET:', response);\n //clear DOM\n let historyList = response;\n let latestResult = historyList[historyList.length-1];\n //append most recent results to DOM\n showMostRecent(latestResult);\n //update history on DOM\n showHistory(historyList);\n //set calculationComplete to true\n calculationComplete=true;\n }).catch(function(err) {\n alert('error posting results');\n console.log(err);\n })\n}//end updateDisplay (GET)", "function getTotalSales() {\n fetch('https://inlupp-fa.azurewebsites.net/api/total-sales')\n .then(res => res.json()) \n .then(data => {\n document.getElementById('totalSales').innerHTML = data.currency + data.amount;\n })\n}", "function renderDetail(data, favorites) {\n if (data) {\n var result = JSON.parse(data.body);\n\n // Object containing properties and methods used to render detail page\n var detail = {\n id: result.InternalId,\n address: result.Adres,\n zipCity: result.Postcode + ', ' + result.Plaats,\n img: result.HoofdFoto,\n type: function() {\n if (result.Koopprijs && !result.Huurprijs) {\n return 'koop';\n } else {\n return 'huur';\n }\n },\n price: function() {\n if (result.Koopprijs && !result.Huurprijs) {\n return '<strong>€ ' + numberWithPeriods(result.Koopprijs) + ' <abbr title=\"Kosten Koper\">k.k.</abbr></strong>';\n } else {\n return '<strong>€ ' + numberWithPeriods(result.Huurprijs) + ' <abbr title=\"Per maand\">/mnd</abbr></strong>';\n }\n },\n text: {\n paragraphs: result.VolledigeOmschrijving.split('\\n'),\n combined: function() {\n var total = '';\n\n detail.text.paragraphs.map(function(paragraph) {\n total += '<p>' + paragraph + '</p>';\n });\n\n return total;\n }\n }\n };\n\n // Checks whether an item already exists in favorites of user and sets correct reference\n function checkFavorites() {\n if (favorites) {\n // Checks if user has any favorites added, returns 'add' link for each result otherwise\n if (favorites.length) {\n for (var i = 0; i < favorites.length; i++) {\n if (favorites[i].favorite_ID === detail.id) {\n return '<a href=\"/favorites/remove/' + detail.id + '\" class=\"fav-label checked\"></a>';\n }\n if (i === favorites.length - 1) {\n return '<a href=\"/favorites/add/' + detail.type() + '/' + detail.id + '\" class=\"fav-label\"></a>';\n }\n }\n } else {\n return '<a href=\"/favorites/add/' + detail.type() + '/' + detail.id + '\" class=\"fav-label\"></a>';\n }\n } else {\n return '<a href=\"/favorites/add/' + detail.type() + '/' + detail.id + '\" class=\"fav-label\"></a>';\n }\n }\n\n return [\n '<section id=\"detail\">',\n '<section class=\"btn-block\">',\n '<a href=\"javascript:history.back()\" class=\"go-back\">Terug</a>',\n '</section>',\n '<h2>' + detail.address + '</h2>',\n '<h3>' + detail.zipCity + '</h3>',\n '<section class=\"img-block\">',\n '<img src=\"' + detail.img + '\" alt=\"Foto van ' + detail.address + '\">',\n checkFavorites(),\n '<p id=\"detailPrice\">' + detail.price() + '</p>',\n '</section>',\n '<article>',\n detail.text.combined(),\n '</article>',\n '</section>',\n ].join('\\n');\n } else {\n return [\n '<section id=\"detail\">',\n '<h2>Details</h2>',\n '<p>',\n 'Voor dit resultaat zijn geen gegevens bekend.',\n '</p>',\n '</section>',\n ].join('\\n');\n }\n}", "function renderVersion() {\n $.ajax({\n url: jsconfig.baseurl + \"/api/version\",\n beforeSend: authHeaders\n }).then(function(data) {\n var versionText = \"TempGopher © 2018 Mike Shoup | Version: \" + data.version;\n $(\"#version\").text(versionText);\n });\n}", "function GetDeptValues() {\n let onFocus = document.getElementById(\"chooseDepartment\");\n let departmentName = onFocus.options[onFocus.selectedIndex].value;\n let dollarUS = Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n });\n\n // Send an AJAX request\n $.getJSON('api/DeptSoldPurchValues?deptName=' + departmentName)\n .done(function (data) {\n console.log(data);\n document.getElementById(\"values\").innerText = \"The dept, \" + departmentName + \", sold fleet vehicles worth: \" + dollarUS.format(data[0]) + \n \"\\n\\nThe \" + departmentName + \" purchased PHEV vehicles worth: \" + dollarUS.format(data[1]);\n });\n}", "function updateCoffeeView(coffeeQty) {\n // create a variable to store and update the coffee counter\n let coffeeCounter = document.getElementById('coffee_counter');\n coffeeCounter.innerText = coffeeQty;\n}", "function countRel(rel){\n $.ajax({\n type: 'GET',\n url: 'http://localhost:8080/relationship/count/' + rel,\n dataType : \"json\",\n contentType:\"application/json\",\n success: function(data){\n console.log(data);\n var val= JSON.stringify(data).replace(\"count(p)\\\":\", \"\").replace(/[&\\/\\\\#+()$~%'\"*?<>{}]/g, '');\n $(\"<label>There are \" + val +\" relationships of \"+rel+\" type </label>\" ).addClass(\"counterLabel\").attr(\"value\", $(this).text()).appendTo( $(\"#result3\")); }\n });\n\n }", "function poundToInrConverter(){\n\tvar xhttp= new XMLHttpRequest();\n\txhttp.onreadystatechange = function(){\n\t\tif(this.readyState == 4 && this.status == 200){\n\t\t\tvar apiData =JSON.parse(this.responseText);\n\t\t\tvar poundData = 0.0;\n\t\t\tvar newValue=0.0;\n\t\t\tvar updateAmount=0.0;\n\n\t\t\tpoundData=document.getElementById('pounds').value;\n\t\t\tnewValue=apiData.rates.INR;\n\t\t\tupdateAmount =poundData*newValue;\n\t\t\t\n\t\t\tdocument.getElementById('rupees').value = updateAmount;\t\n\t\t}\n\t};\n\txhttp.open(\"GET\",'https://api.fixer.io/latest?base=GBP&symbols=INR',true);\n\txhttp.send();\n}", "function printResponse(cardID) {\n console.log(\"cardid : \" + cardID);\n var responseUrl2 = new URL(window.location.href);\n // console.log(responseUrl.href);\n // console.log('URL demo: '+ responseUrl);\n //document.getElementById('url1').innerHTML = responseUrl;\n\n var transactionInfo = getTransactionInfo(responseUrl2);\n var resultString = \"\";\n\n if (errorField in transactionInfo) {\n console.log(\"ERROR THROWN\");\n resultString = handleError(transactionInfo);\n } else {\n console.log(\"SUCCESS\");\n resultString = handleSuccess(transactionInfo);\n update_credit(cardID);\n }\n\n document.getElementById('url').innerHTML = resultString;\n db_update(cardID, 0);\n}", "function Fill_With_JSON(_url) {\n\t\tvar API_Call = require('ui/apiCalling/call_with_indicator');\n\t\tnew API_Call('GET', _url, null, activityIndicator, function(json) {\n\t\t\trenderJson(json);\n\t\t});\n\t}", "function getComputation() {\n $.ajax({\n type: 'GET',\n url: '/math/',\n success: function (amount) {\n clearInfo();\n MathForm.total = amount;\n $('#x').val(MathForm.total);\n MathForm.x = '';\n },\n });\n}", "function displayFactText(currentFact, positionId) {\n document.getElementById(positionId).innerHTML = currentFact.text;\n}", "function getCalculation() {\n $.ajax({\n type: 'GET',\n url: '/type',\n success: function (response) {\n $('.viewport').text(response);\n },\n });\n}", "function getTestNumberJson() {\n return loadFromNumberJson({\n \"text\": \"15250 is the number of times the average driver will honk in a lifetime.\",\n \"number\": 15250,\n \"found\": true,\n \"type\": \"trivia\"\n });\n}", "function printGoals(MIS321goal, total){\n const printGoalsApiUrl = \"https://localhost:5001/api/sessions\";\n let html = \"<p>\"; \n fetch(printGoalsApiUrl).then(function(response){\n //console.log(response); \n return response.json();\n \n }).then(function(json){\n //console.log(goalNew); \n console.log(MIS321goal);\n\n var i = 0; \n for (i = 0; i < json.length; i++) { \n if(json[i].category == \"Goal\" && json[i].name == \"MIS321\"){\n //console.log(session.totalTime); \n var newGoal = json[i].totalTime;\n console.log(newGoal); \n \n }\n }\n \n \n if(MIS321goal >= 1){\n var goal = MIS321goal; \n console.log(goal); \n }\n\n var percentage = total / newGoal; \n percentage = percentage * 100; \n console.log(percentage);\n var hoursLeft = newGoal - total; \n // var finalGoal = MIS321goal; \n\n //console.log(finalGoal);\n html += \"<div class = \\\"progress\\\"><div class=\\\"progress-bar progress-bar-striped progress-bar-animated bg-info\\\" role=\\\"progressbar\\\" style=\\\"width:\" + percentage +\"%;\\\" aria-valuenow=\\\" \" + percentage+ \"\\\" aria-valuemin=\\\"0\\\" aria-valuemax=\\\"100\\\"></div></div>\" + \n \"<p class=\\\"text\\\" style = \\\"font-size: 16px; font-weight: light;\\\">You have the goal to study \" + newGoal + \" hours of MIS321.\" + \n \" So far you have logged \" + total + \" hours of MIS321.</p>\" +\n \"<p class=\\\"text text-info\\\" style = \\\"font-size: 16px; font-weight: light;\\\">You need to study \" + hoursLeft + \" more hours to achieve your Goal.</p>\"; \n\n\n document.getElementById(\"mis321goals\").innerHTML = html;\n }).catch(function(error){\n console.log(error);\n })\n}", "function testGetRandomInt() {\n document.getElementById(\"httpRequest\").innerHTML = \"/123456\";\n fetch(baseURL + \"/123456\")\n .then(res => res.text())\n .then(res => {\n console.log(res);\n document.getElementById(\"httpResponse\").innerHTML = res;\n })\n}", "function usdToInrConverter(){\n\tvar xhttp= new XMLHttpRequest();\n\txhttp.onreadystatechange = function(){\n\t\tif(this.readyState == 4 && this.status == 200){\n\t\t\tvar apiData =JSON.parse(this.responseText);\n\t\t\tvar dollarData = 0.0;\n\t\t\tvar newValue=0.0;\n\t\t\tvar updateAmount=0.0;\n\t\t\t\n\t\t\tdollarData=document.getElementById('dollar').value;\n\t\t\tnewValue=apiData.rates.INR;\n\t\t\tupdateAmount =dollarData*newValue;\n\t\t\t\n\t\t\tdocument.getElementById('rupees').value = updateAmount;\t\n\t\t\t\n\t\t}\n\t};\n\txhttp.open(\"GET\",'https://api.fixer.io/latest?base=USD&symbols=INR',true);\n\txhttp.send();\n}", "function renderCurrent() {\n document.getElementById('currentCity').innerHTML = \n `\n ${currentSearch.city.name} ${currentSearch.list[0].dt_txt}\n <p>${Math.round(currentSearch.list[0].main.temp * (9 / 5) - 459.67)}°F.</p>\n <p>Humidity: ${currentSearch.list[0].main.humidity}%</p>\n <p>Wind Speed: ${currentSearch.list[0].wind.speed}mph</p>\n <p id='uvIndex'></p>\n `\n document.getElementById('forecast').innerHTML = renderForecastItem(0) + renderForecastItem(8) + renderForecastItem(16) + renderForecastItem(24) + renderForecastItem(32)\n}", "function updateContent(sampleURL) {\n fetch(sampleURL, {\n\n })\n .then(response => response.json())\n .then(data => {\n\n //set the variable and update the content\n let latestTitle = data.title;\n let latestImg = data.img;\n let latestAlt = data.alt;\n\n document.getElementsByClassName('title-content')[0].innerHTML = latestTitle;\n document.getElementById('comic-id').src = latestImg;\n document.getElementsByClassName('alt-content')[0].innerHTML = latestAlt;\n\n //set the current num, for the using of Next and Prev\n currentNum = data.num;\n });\n}", "function updateTally(outcome) {\n totalPoints += parseInt(outcome);\n \n // Draw tally using HTML\n tally = display_element.querySelector(\".tally\");\n tally.innerHTML = `Total Points: ${totalPoints}`\n \n }", "function populateRecentCrisis() {\n // Make an AJAX Call to ReliefWebAPI\n $.ajax({\n type: \"GET\",\n url: `https://api.reliefweb.int/v1/reports?appname=caritas`,\n data: { preset: \"latest\" },\n dataType: \"json\",\n contentType: \"application/json\"\n })\n // If Done, Render the Result\n .done(result => renderRecentCrisis(result))\n // If Fail, Log the Error\n .fail(err => console.log(err));\n}", "function showTemp(response){\n //console.log(response.data);\n let temperature = Math.round(reponse.data.main.temp);\n let temperatureElement = document.querySelector(\"#temperature\");\n temperatureElement.innerHTML = `${response.data.main.temp}°C`;\n}", "function showCurrentOrder(){\r\n document.getElementById(\"cartTitle\").innerText=\"\";\r\n document.getElementById(\"passTypeC\").innerText=`Your Ticket Type : ${ticket.passChoice}`;\r\n document.getElementById(\"adultTicketsC\").innerText=`No. of adults : ${ticket.noOfAdults}`;\r\n document.getElementById(\"childTicketsC\").innerText=`No. of children : ${ticket.noOfChildren}`;\r\n document.getElementById(\"durationC\").innerText=`Duration of your visit : ${ticket.duration}`;\r\n document.getElementById(\"annualPassC\").innerText=`Annual Pass Tokens : ${ticket.annualPass}`;\r\n document.getElementById(\"foodTokensC\").innerText=`Food Tokens : ${ticket.foodToken}`;\r\n txtCostCurrent.innerText = ticket.costCurrent;\r\n}", "function updateCount(){\n $.getJSON('http://slaughterspottr.herokuapp.com/api/count',function(data){\n $('#spot-count').replaceWith('<span id=\\'spot-count\\'>'+data.count+'</span>');\n });\n }", "function calculate(operand){\n const number1 = document.getElementById('number1').value;\n const number2 = document.getElementById('number2').value;\n\n const apiUrl = '/calc/' + operand + '/' + number1 + '/' + number2;\n getResultFromApi(apiUrl);\n\n}", "function getCurrentNRf(req, res){\n\n nrfService.getById()\n .then(function(nrf){\n if(nrf){\n res.send(nrf);\n }else{\n res.sendStatus(404);\n }\n })\n .catch(function(err){\n res.status(400).send(err);\n });\n}", "function rerunCalculation() {\n let calcIndex = $(this).data().index;\n calcDisplay = $('#calc-display-text');\n $(this).css('color', '#00a59a'); \n $(this).siblings().css('color', 'black');\n \n $.ajax({\n method: 'GET',\n url: '/get-calculation'\n }).then(function (response) {\n calcDisplay.empty();\n let calcTotalParsed = parseFloat(response[calcIndex].calcTotal.toFixed(2));\n calcDisplay.append(`${calcTotalParsed}`);\n })\n}", "function _render (url) {\r\n if (null != exports.ttQueryStr && '' != exports.ttQueryStr)\r\n {\r\n var m = url.match(\"\\\\.[a-zA-Z]+\\\\?\");\r\n if (null != m && 0 < m.length)\r\n {\r\n if (url.indexOf('?') == (url.length-1))\r\n {\r\n url = url + exports.ttQueryStr;\r\n } else {\r\n url = url + '&' + exports.ttQueryStr;\r\n }\r\n } else {\r\n url = url + '?' + exports.ttQueryStr;\r\n }\r\n\r\n //console.log(\"render:\",url);\r\n }\r\n\r\n return url;\r\n }", "function showUnitTestDetails(num, html_url, sparql_url)\n{\n var rdfaExtractorUrl = getRdfaExtractorUrl();\n var n3ExtractorUrl = \"http://www.w3.org/2007/08/pyRdfa/extract?format=n3&uri=\";\n\n document.getElementById('unit-test-details-' + num).innerHTML =\n \"Retreiving information...\";\n sendRequest('test-details?id=' + num +\n '&xhtml=' + html_url +\n '&sparql=' + sparql_url +\n '&rdfa-extractor=' + escape(rdfaExtractorUrl) +\n '&n3-extractor=' + escape(n3ExtractorUrl),\n displayUnitTestDetailsResult, num)\n}", "function APIcall(url) {\r\n fetch(url)\r\n .then(apiResponse => {\r\n return apiResponse.json();\r\n })\r\n .then(data => {\r\n if (data.cod === 200) {\r\n const {temp,humidity,temp_min,temp_max} = data.main;\r\n \r\n // Updating Dom Elements\r\n cityTemp.textContent = temp;\r\n cityName.textContent = data.name + '/' + data.sys.country;\r\n humidityLevel.textContent = humidity;\r\n minTemp.textContent = temp_min;\r\n maxTemp.textContent = temp_max;\r\n icon.src = 'icons/' + data.weather[0].icon + '.svg';\r\n } else {\r\n cityName.textContent = data.message;\r\n cityTemp.textContent = 0;\r\n humidityLevel.textContent = 0;\r\n minTemp.textContent = 0;\r\n maxTemp.textContent = 0;\r\n }\r\n\r\n });\r\n}", "function renderQNum(currentQuestion){\n currentQuestion.text((counter + 1) + ' of ' + quizLength);\n }", "function getHistory() {\n //console.log('Get History');\n $.ajax({\n method: 'GET',\n url: '/equate'\n }).then((response) =>{\n console.log('Retrieved history', response);\n appendEquation(response);\n $('#calcInput').val(`${response[response.length - 1].answer}`);\n })\n}// response history", "function getreviews(uid, iid)\n{\n $.ajax({\n url: '/predictreview',\n dataType: 'JSON',\n type: 'POST',\n data: JSON.stringify({\n uid: uid,\n iid: iid\n }),\n contentType: 'application/json;charset=UTF-8',\n success: function(response){\n $(\"#grids\").css('display','none');\n $(\"#description\").css('display','none');\n $(\"#rev_iid\").text(iid);\n $(\"#toprev_title\").show();\n $(\"#review_grids\").show();\n $(\"#back_btn\").show();\n var toprevs = response['toprevs'];\n var otherrevs = response['otherrevs'];\n\n $(\"#item_info\").empty();\n var des_meta=response['des_meta'];\n var title_meta=response['title_meta'];\n var price_meta=response['price_meta'];\n var imurl_meta=response['imurl_meta'];\n var categ_meta=response['categ_meta'];\n\n $(\"#item_info\").prepend('<img style=\"display: block; margin:auto\" src='+imurl_meta+' alt='+title_meta+' height=\"350\" />');\n $(\"#item_info\").append($(\"<br/>\"));\n $(\"#item_info\").append('<p style=\"font-size:30px; text-align: center\">' + title_meta + '</p>');\n\n if (des_meta==\"\") {\n $(\"#item_info\").append('Description: None');\n } else {\n $(\"#item_info\").append('Description: '+des_meta);\n }\n\n $(\"#item_info\").append($(\"<br/>\"));\n $(\"#item_info\").append('Categories: '+categ_meta);\n $(\"#item_info\").append($(\"<br/>\"));\n $(\"#item_info\").append('Price: $'+price_meta);\n\n $(\"#rev_type1\").text('');\n var rev_rate_top = response['rev_rate_top'];\n for(var i = 0; i < toprevs.length; i++){\n var j=i+1;\n $(\"#rev_type1\").append(j+\": (\");\n $(\"#rev_type1\").append('<span style=\"font-size:20px; font-weight:Bold; color:red\">' + rev_rate_top[i]) + '</span>';\n $(\"#rev_type1\").append(\" Star) \"+toprevs[i]);\n $(\"#rev_type1\").append($(\"<br/>\"));\n $(\"#rev_type1\").append($(\"<br/>\"));\n }\n\n $(\"#rev_type3\").text('');\n var rev_rate_other = response['rev_rate_other'];\n for(var i = 0; i < otherrevs.length; i++){\n var j=i+1;\n $(\"#rev_type3\").append(j+\": (\");\n $(\"#rev_type3\").append('<span style=\"font-size:20px; font-weight:Bold; color:red\">' + rev_rate_other[i]) + '</span>';\n $(\"#rev_type3\").append(\" Star) \"+otherrevs[i]);\n $(\"#rev_type3\").append($(\"<br/>\"));\n $(\"#rev_type3\").append($(\"<br/>\"));\n }\n }\n });\n}", "function getResultFromCocktailDB(searchterms, targetno) {\n //Test alert telling that function has been entered\n //alert(\"getResultFromCocktailDB entered\");\n\n //call cocktail API using Ajax\n //build url for the request\n var url = \"https://www.thecocktaildb.com/api/json/v1/1/search.php?s=\" + searchterms;\n\n //Test alert to display url variable\n //alert(\"Url built: \" + url);\n\n //use jquery json shortcut\n $.getJSON(url, function(jsondata) {\n //Test alert to show getJSON function has been entered\n //alert(\"getJson function has been entered\");\n\n //Send jsondata and target number to printing function\n printDescription(jsondata, targetno);\n });\n}", "function DisplayNumberInCart(){\n let totalNumber = currentNumber;\n numberInCart.innerHTML = totalNumber;\n}", "render(initialValue) {\n let returnValue = initialValue;\n\n if (this.context._regexSpecial.nonNumericValue.test(initialValue) === false) {\n let realPart = returnValue.realPart,\n imaginaryPart = returnValue.imaginaryPart,\n sign,\n significantDigits = this.context.significantDigits,\n precisionDigits = this.context.precisionDigits;\n\n if (imaginaryPart >= 0) {\n sign = '+';\n }\n else {\n sign = '-';\n imaginaryPart = Math.abs(imaginaryPart);\n }\n\n const realPartRenderer = new JQX.Utilities.NumberRenderer(realPart),\n imaginaryPartRenderer = new JQX.Utilities.NumberRenderer(imaginaryPart);\n\n if (this.context.scientificNotation) {\n realPart = realPartRenderer.toScientific(significantDigits, precisionDigits);\n imaginaryPart = imaginaryPartRenderer.toScientific(significantDigits, precisionDigits);\n }\n else {\n realPart = realPartRenderer.toDigits(significantDigits, precisionDigits);\n imaginaryPart = imaginaryPartRenderer.toDigits(significantDigits, precisionDigits);\n }\n\n returnValue = `${realPart} ${sign} ${imaginaryPart}i`;\n }\n return returnValue;\n }", "function displayModelInfo() {\n numberReactionsDisplay.innerHTML = \"Number of Reactions: \" + currentReactionNumber;\n}", "function expensesAPI() {\n fetch(\"http://localhost:8080/trip?tripName=\" + trip)\n .then((result) => result.json())\n .then((json) => {\n console.log(json);\n setListexpenses(json);\n setExpenseheader(\"Expense - Amount - User\");\n });\n }", "function displayPastCalculation(){\n //GET route to gather info to display to DOM\n $.ajax({\n url: '/calculated',\n type: 'GET'\n\n }).then(function(response){\n console.log('back from GET with:', response);\n $('#pastCalculation').empty();\n $('#pastCalculation').append(' <h5><u>Past Calculations</u></h5>')\n for(let i=response.length-1; i>=0; i--){\n $('#pastCalculation').append(`\n <ul>\n <li>${response[i].num1}${response[i].operator}${response[i].num2}\n =${response[i].total}</li>\n </ul>`);\n }\n }).catch(function(err){\n alert('error recieving calculation');\n console.log(err);\n })\n}//end displayLastCalculation", "function getWeather (param){\n $.ajax({\n url: 'https://api.apixu.com/v1/forecast.json?key=7cca46df45774803b2d211925162902&q='+param,\n method: \"GET\",\n success: function(data){\n console.log(data);\n var currentTemp = data.current.temp_f;\n\n console.log(currentTemp);\n\n // $(\"#weather\").html($(\"<span class='current'>\" + currentTemp +\" F</span>\"));\n $(\"#weather\").html($(\"<span class='current'>\" + currentTemp +\" F</span>\"));\n }\n });\n}", "function updateDisplay(){\n document.querySelector('#displayNumber').innerText=calaculator.displayNumber;\n\n}", "function updateFirstNumber() {\n $.ajax({\n type: 'GET',\n url: '/math',\n success: function(data) {\n console.log('got the completed data!');\n mathObject.firstNumber = data.number;\n mathObject.operator = mathObject.nextOperator;\n console.log(mathObject);\n $('#display').text(mathObject.firstNumber);\n },\n error: function() {\n console.log(\"error with getCompleted function\");\n }\n });\n}", "static fetchFact(type) {\n\t\tlet numberInput = document.querySelector('#input');\n\t\tlet factInput = document.querySelector('#facts');\n\n\t\t//fetch data when number is inputed\n\t\tnumberInput.addEventListener('input', () => {\n\t\t\tif (type === 'math') {\n\t\t\t\tfetch(`http://numbersapi.com/${numberInput.value}/math`)\n\t\t\t\t.then((response) => response.text())\n\t\t\t\t.then((data) => {\n\t\t\t\t\tif (numberInput.value === ''){\n\t\t\t\t\t\tfactInput.innerHTML = '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfactInput.innerHTML = data;\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t} else if (type === 'trivia') {\n\t\t\t\tfetch(`http://numbersapi.com/${numberInput.value}`)\n\t\t\t\t.then((response) => response.text())\n\t\t\t\t.then((data) => {\n\t\t\t\t\tif (numberInput.value === ''){\n\t\t\t\t\t\tfactInput.innerHTML = '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfactInput.innerHTML = data;\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t} else if (type === 'year') {\n\t\t\t\tfetch(`http://numbersapi.com/${numberInput.value}/year`)\n\t\t\t\t.then((response) => response.text())\n\t\t\t\t.then((data) => {\n\t\t\t\t\tif (numberInput.value === ''){\n\t\t\t\t\t\tfactInput.innerHTML = '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfactInput.innerHTML = data;\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t\n\t\t});\n\n\t}", "function fetchAPI() {\n\tfetch(url)\n\t\t.then(response => response.json())\n\t\t.then(response => {\n\t\t\tconst {Lotto: {numerki: numbers, data_losowania:data}} = response;\n\t\t\tlet convertedNumber = numbers.split(\",\").map(number => parseInt(number))\n\t\t\t$('.data').html(`${data.substr(0, 10)}`)\n\t\t\tconvertedNumber.forEach(number => {\n\t\t\t\tresponseNumbers.push(number);\n\t\t\t\tconst ball = $('<div>').addClass('ball ball-modifier').html(number)\n\t\t\t\t$('.numbers').append(ball);\n\n\t\t\t});\n\t\t})\n}", "function printGBA300Goals(GBA300goal, total){\n const printGBA300GoalsApiUrl = \"https://localhost:5001/api/sessions\";\n let html = \"<p>\"; \n fetch(printGBA300GoalsApiUrl).then(function(response){\n //console.log(response); \n return response.json();\n \n }).then(function(json){\n //console.log(goalNew); \n console.log(GBA300goal);\n\n var i = 0; \n for (i = 0; i < json.length; i++) { \n if(json[i].category == \"Goal\" && json[i].name == \"GBA300\"){\n //console.log(session.totalTime); \n var newGoal = json[i].totalTime;\n console.log(newGoal); \n \n }\n }\n \n \n \n if(GBA300goal >= 1){\n var goal = GBA300goal; \n console.log(goal); \n }\n\n var percentage = total / newGoal; \n percentage = percentage * 100; \n console.log(percentage);\n\n var hoursLeft = newGoal - total; \n // var finalGoal = MIS321goal; \n\n //console.log(finalGoal);\n html += \"<div class = \\\"progress\\\"><div class=\\\"progress-bar progress-bar-striped progress-bar-animated bg-success\\\" role=\\\"progressbar\\\" style=\\\"width:\" + percentage +\"%;\\\" aria-valuenow=\\\" \" + percentage+ \"\\\" aria-valuemin=\\\"0\\\" aria-valuemax=\\\"100\\\"></div></div>\" + \n \"<p class=\\\"text\\\" style = \\\"font-size: 16px; font-weight: light;\\\">You have the goal to study \" + newGoal + \" hours of GBA300.\" + \n \" So far you have logged \" + total + \" hours of GBA300.</p>\" +\n \"<p class=\\\"text text-success\\\" style = \\\"font-size: 16px; font-weight: light;\\\">You need to study \" + hoursLeft + \" more hours to achieve your Goal.</p>\"; \n\n\n document.getElementById(\"gba300goals\").innerHTML = html;\n }).catch(function(error){\n console.log(error);\n })\n}", "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 }", "function renderResourceCount(count) {\n var text = document.getElementById('resource_list_count');\n\n text.innerHTML = count.toString() + ' records found';\n}", "function getTotalAll(id, url) {\n\n fetch(url)\n .then(res => res.json())\n .then(data => {\n\n document.getElementById(id).innerHTML = data.currency + data.amount\n \n });\n }", "function displayTotal(val) {\n var answer = val;\n var query = \"SELECT product_name, id, stock_quantity, price FROM products WHERE ?\"\n connection.query(query, { id: answer.item }, function (err, res) {\n if (err) throw err;\n for (var i = 0; i < res.length; i++) {\n var cost = res[i].price;\n var name = res[i].product_name;\n var currentQ = res[i].stock_quantity;\n }\n var quantityId = answer.quantity;\n var updateQ = currentQ - quantityId\n var idPrice = cost * quantityId;\n\n console.log(\"\\nProduct: \" + name);\n console.log(\"\\nQuantity: \" + quantityId);\n console.log(\"-------------------------\")\n console.log(\"Your total price is: $\" + idPrice);\n console.log(\"-------------------------\")\n updateProduct(updateQ, answer);\n })\n}", "toString(){let url=this.url==null?\"\":this.url.url;return\"\".concat(this.total,\" | \").concat(this.progress,\" :: tested: \").concat(url)}", "function render_total(data){\n\t return '<a href=\"\">'+data+' pessoa(s)</a>';\n\t}", "function nextStep(operationType, note) {\n $.each(tickets, function (key, item) {\n item.ticketNo = $('#ticketNo-' + item.ticketID).val();\n item.ticketPrice = $('#ticketPrice-' + item.ticketID).val();\n item.ticketID = item.ticketID;\n });\n\n\n var _json = {};\n var my_url = \"\";\n if (operationType === 91) {\n\n _json = {\n \"tickets\": tickets,\n \"currentVacationId\": currentVacationId,\n \"operationType\": operationType,\n \"note\": note\n }\n }\n else {\n _json = {\n \"tickets\": null,\n \"currentVacationId\": currentVacationId,\n \"operationType\": operationType,\n \"note\": note\n }\n }\n console.log(_json);\n\n $.ajax({\n url: \"/TicketsApprovment/VacationOperations\"/* + currentVacationId + '/' + operationType + '/' + note*/,\n type: \"POST\",\n contentType: \"application/json;charset=UTF-8\",\n dataType: \"json\",\n data: JSON.stringify(_json),\n success: function (result) {\n if (result.Code === 200) {\n swal({\n title: \"تمت العملية بنجاح\",\n text: result.Title,\n type: \"success\"\n });\n }\n else {\n swal({\n title: \"خطأ\",\n text: result.Title,\n type: \"error\"\n });\n }\n $(\"#userControl\").modal('hide');\n loadData();\n },\n error: function (errormessage) {\n console.log(errormessage)\n //alert(errormessage.responseText);\n }\n });\n}", "function getOneTechDeets(){\n console.log(\"test\"); \n //const oneTechDeetsApiUrl = \"https://localhost:5001/api/feedback\";\n const oneTechDeetsApiUrl =\"https://tas360feedbackapi.herokuapp.com/api/feedback\";\n \n\n fetch(oneTechDeetsApiUrl).then(function(response){\n console.log(response); \n return response.json();\n \n }).then(function(json){\n\n let html = \"<ul>\";\n json.forEach((survey)=>{\n if (survey.employee_Feedback == 'EmployeeOne' && survey.techTotal >= 5 && survey.techTotal <= 7){ //red \n\n html+= \"<p><div><div class = \\\"scoreName\\\">Technology Score</div><div class = \\\"d-img-red\\\"></div></div></p>\" + \n \"<div class=\\\"d-box-2\\\"><div class = \\\"space2\\\"><p> ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎</p></div>\" +\n \"<p>‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‎Exceptionality ... ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎\" + survey.tech1 + \"</p>\" +\n \"<div class = \\\"space2\\\"><p> ‎‏‏‎ ‎‏The exceptionality score describes an employee's willingness to go the extra mile on tasks and projects. </p></div>\" +\n \"<p>‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎Flexibility ... ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎ \" + survey.tech2 + \"‎‏‏‎‏‎‎‏‏‎</p>\" +\n \"<div class = \\\"space2\\\"><p> ‎‏‏‎ ‎‏ ‎‏‏‎The flexibility score describes an employee's ability to react and adapt to changes in the workplace. ‏‏‎‎</p></div>\" +\n \"<p> ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎Cleverness ... ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎‏‏‎\" + survey.tech3 + \"‎‏‏‎‎‏‏‎‎</p>\" +\n \"<div class = \\\"space2\\\"><p>‎ ‎‏‏‎ The cleverness score describes an employee's ability to solve problems creatively and recourcefully. </p></div>\" +\n \"<p> ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎Producivity ... ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎ ‎‏‏‎‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎ ‏‏‎ \" + survey.tech4 + \"‎‏‏‎</p>\" +\n \"<div class = \\\"space2\\\"><p>‎ ‎‏‏‎ The productivty score describes an employee's level of time management skills. </p></div>\" +\n \"<p> ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ Knowledgeable... ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎\" + survey.tech5 + \"</p>\" +\n \"<div class = \\\"space2\\\"><p>‎ ‎‏‏‎ The knowledgeable score describes an employee's ability to absorb new information quickly and apply it to projects.‎</p></div></div>\"; \n }\n else if (survey.employee_Feedback == 'EmployeeOne' && survey.techTotal >= 8 && survey.techTotal <= 13) {\n html+= \"<p><div><div class = \\\"scoreName\\\">Technology Score</div><div class = \\\"d-img-orange\\\"></div></div></p>\" + \n \"<div class=\\\"d-box-2\\\"><div class = \\\"space2\\\"><p> ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎</p></div>\" +\n \"<p>‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‎Exceptionality ... ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎\" + survey.tech1 + \"</p>\" +\n \"<div class = \\\"space2\\\"><p> ‎‏‏‎ ‎‏The exceptionality score describes an employee's willingness to go the extra mile on tasks and projects. </p></div>\" +\n \"<p>‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎Flexibility ... ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎ \" + survey.tech2 + \"‎‏‏‎‏‎‎‏‏‎</p>\" +\n \"<div class = \\\"space2\\\"><p> ‎‏‏‎ ‎‏ ‎‏‏‎The flexibility score describes an employee's ability to react and adapt to changes in the workplace. ‏‏‎‎</p></div>\" +\n \"<p> ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎Cleverness ... ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎‏‏‎\" + survey.tech3 + \"‎‏‏‎‎‏‏‎‎</p>\" +\n \"<div class = \\\"space2\\\"><p>‎ ‎‏‏‎ The cleverness score describes an employee's ability to solve problems creatively and recourcefully. </p></div>\" +\n \"<p> ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎Producivity ... ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎ ‎‏‏‎‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎ ‏‏‎ \" + survey.tech4 + \"‎‏‏‎</p>\" +\n \"<div class = \\\"space2\\\"><p>‎ ‎‏‏‎ The productivty score describes an employee's level of time management skills. </p></div>\" +\n \"<p> ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ Knowledgeable... ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎\" + survey.tech5 + \"</p>\" +\n \"<div class = \\\"space2\\\"><p>‎ ‎‏‏‎ The knowledgeable score describes an employee's ability to absorb new information quickly and apply it to projects.‎</p></div></div>\"; \n }\n else if (survey.employee_Feedback == 'EmployeeOne' && survey.techTotal >= 14 && survey.techTotal <= 18) {\n html+= \"<p><div><div class = \\\"scoreName\\\">Technology Score</div><div class = \\\"d-img-yellow\\\"></div></div></p>\" + \n \"<div class=\\\"d-box-2\\\"><div class = \\\"space2\\\"><p> ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎</p></div>\" +\n \"<p>‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‎Exceptionality ... ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎\" + survey.tech1 + \"</p>\" +\n \"<div class = \\\"space2\\\"><p> ‎‏‏‎ ‎‏The exceptionality score describes an employee's willingness to go the extra mile on tasks and projects. </p></div>\" +\n \"<p>‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎Flexibility ... ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎ \" + survey.tech2 + \"‎‏‏‎‏‎‎‏‏‎</p>\" +\n \"<div class = \\\"space2\\\"><p> ‎‏‏‎ ‎‏ ‎‏‏‎The flexibility score describes an employee's ability to react and adapt to changes in the workplace. ‏‏‎‎</p></div>\" +\n \"<p> ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎Cleverness ... ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎‏‏‎\" + survey.tech3 + \"‎‏‏‎‎‏‏‎‎</p>\" +\n \"<div class = \\\"space2\\\"><p>‎ ‎‏‏‎ The cleverness score describes an employee's ability to solve problems creatively and recourcefully. </p></div>\" +\n \"<p> ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎Producivity ... ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎ ‎‏‏‎‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎ ‏‏‎ \" + survey.tech4 + \"‎‏‏‎</p>\" +\n \"<div class = \\\"space2\\\"><p>‎ ‎‏‏‎ The productivty score describes an employee's level of time management skills. </p></div>\" +\n \"<p> ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ Knowledgeable... ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎\" + survey.tech5 + \"</p>\" +\n \"<div class = \\\"space2\\\"><p>‎ ‎‏‏‎ The knowledgeable score describes an employee's ability to absorb new information quickly and apply it to projects.‎</p></div></div>\"; \n }\n else if (survey.employee_Feedback == 'EmployeeOne' && survey.techTotal >= 19 && survey.techTotal <= 21) {\n html+= \"<p><div><div class = \\\"scoreName\\\">Technology Score</div><div class = \\\"d-img-lime\\\"></div></div></p>\" + \n \"<div class=\\\"d-box-2\\\"><div class = \\\"space2\\\"><p> ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎</p></div>\" +\n \"<p>‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‎Exceptionality ... ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎\" + survey.tech1 + \"</p>\" +\n \"<div class = \\\"space2\\\"><p> ‎‏‏‎ ‎‏The exceptionality score describes an employee's willingness to go the extra mile on tasks and projects. </p></div>\" +\n \"<p>‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎Flexibility ... ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎ \" + survey.tech2 + \"‎‏‏‎‏‎‎‏‏‎</p>\" +\n \"<div class = \\\"space2\\\"><p> ‎‏‏‎ ‎‏ ‎‏‏‎The flexibility score describes an employee's ability to react and adapt to changes in the workplace. ‏‏‎‎</p></div>\" +\n \"<p> ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎Cleverness ... ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎‏‏‎\" + survey.tech3 + \"‎‏‏‎‎‏‏‎‎</p>\" +\n \"<div class = \\\"space2\\\"><p>‎ ‎‏‏‎ The cleverness score describes an employee's ability to solve problems creatively and recourcefully. </p></div>\" +\n \"<p> ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎Producivity ... ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎ ‎‏‏‎‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎ ‏‏‎ \" + survey.tech4 + \"‎‏‏‎</p>\" +\n \"<div class = \\\"space2\\\"><p>‎ ‎‏‏‎ The productivty score describes an employee's level of time management skills. </p></div>\" +\n \"<p> ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ Knowledgeable... ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎\" + survey.tech5 + \"</p>\" +\n \"<div class = \\\"space2\\\"><p>‎ ‎‏‏‎ The knowledgeable score describes an employee's ability to absorb new information quickly and apply it to projects.‎</p></div></div>\"; \n }\n else if (survey.employee_Feedback == 'EmployeeOne' && survey.techTotal >= 22 && survey.techTotal <= 25) {\n html+= \"<p><div><div class = \\\"scoreName\\\">Technology Score</div><div class = \\\"d-img-green\\\"></div></div></p>\" + \n \"<div class=\\\"d-box-2\\\"><div class = \\\"space2\\\"><p> ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎</p></div>\" +\n \"<p>‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‎Exceptionality ... ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎\" + survey.tech1 + \"</p>\" +\n \"<div class = \\\"space2\\\"><p> ‎‏‏‎ ‎‏The exceptionality score describes an employee's willingness to go the extra mile on tasks and projects. </p></div>\" +\n \"<p>‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎Flexibility ... ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎ \" + survey.tech2 + \"‎‏‏‎‏‎‎‏‏‎</p>\" +\n \"<div class = \\\"space2\\\"><p> ‎‏‏‎ ‎‏ ‎‏‏‎The flexibility score describes an employee's ability to react and adapt to changes in the workplace. ‏‏‎‎</p></div>\" +\n \"<p> ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎Cleverness ... ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‏‏‎‎‏‏‎‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‏‏‎‎‏‏‎ ‎‏‏‎‎‏‏‎‎‏‏‎‎‏‏‎‏‏‎\" + survey.tech3 + \"‎‏‏‎‎‏‏‎‎</p>\" +\n \"<div class = \\\"space2\\\"><p>‎ ‎‏‏‎ The cleverness score describes an employee's ability to solve problems creatively and recourcefully. </p></div>\" +\n \"<p> ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‎Producivity ... ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎ ‎‏‏‎‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎ ‏‏‎ \" + survey.tech4 + \"‎‏‏‎</p>\" +\n \"<div class = \\\"space2\\\"><p>‎ ‎‏‏‎ The productivty score describes an employee's level of time management skills. </p></div>\" +\n \"<p> ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ Knowledgeable... ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎ ‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‏‏‎\" + survey.tech5 + \"</p>\" +\n \"<div class = \\\"space2\\\"><p>‎ ‎‏‏‎ The knowledgeable score describes an employee's ability to absorb new information quickly and apply it to projects.‎</p></div></div>\"; \n }\n });\n html += \"</ul>\"; \n document.getElementById(\"details\").innerHTML = html; \n }).catch(function(error){\n console.log(error);\n })\n}", "function useResult() {\n updateFormula(function() {\n return resultDisplay.text();\n }, true);\n }", "update() {\n this.currTextViewer.innerHTML =\n this.getDisplay(this.currentOperand);\n if (this.operation != null) {\n this.prevTextViewer.innerHTML =\n `${this.getDisplay(this.previousOperand)} ${this.symbol}`;\n } else {\n this.prevTextViewer.innerHTML = `${this.currentOperand}`;\n this.total = `${this.currentOperand}`;\n }\n }", "function calculatePrice(fab_id, product_id){\n $('#product_price').html('');\n $('#product_og_price').html('');\n var _token = $(\"input[name='_token']\").val();\n $.ajax({\n url: \"/product/price/calculate\",\n type:'POST',\n data: {_token:_token, fab_id:fab_id, product_id:product_id},\n dataType: 'json',\n success:function(response){\n $('#product_price').append('MYR '+response.price);\n $('#product_og_price').append('MYR '+response.og_price);\n product_price = response.price;\n }\n });\n }", "function poundToUsdConverter(){\n\tvar xhttp= new XMLHttpRequest();\n\txhttp.onreadystatechange = function(){\n\t\tif(this.readyState == 4 && this.status == 200){\n\t\t\tvar apiData =JSON.parse(this.responseText);\n\t\t\tvar poundData = 0.0;\n\t\t\tvar newValue=0.0;\n\t\t\tvar updateAmount=0.0;\n\n\t\t\tpoundData=document.getElementById('pounds').value;\n\t\t\tnewValue=apiData.rates.USD;\n\t\t\tupdateAmount =poundData*newValue;\n\t\t\t\n\t\t\tdocument.getElementById('dollar').value = updateAmount;\t\n\t\t}\n\t};\n\txhttp.open(\"GET\",'https://api.fixer.io/latest?base=GBP&symbols=USD',true);\n\txhttp.send();\n}", "function update_cart_qty_in_sideCart_and_cart_plus(id) {\n\n var secPID = id;\n var qty = $('#cartQty'+id).val();\n var qty =parseFloat(qty) + parseInt(1);\n $('#cartQty'+id).val(qty);\n \n $.ajax({\n url: '/update_to_cart',\n method:\"GET\",\n data:{ \n secPID:secPID,\n qty: qty,\n },\n success: function (response) {\n var grndTotal = response['grandtotal'].toFixed(2);\n var setgtotal = $('#indGtotal'+id).text(grndTotal);\n TotalPriceCalc();\n leftCartSidebar();\n //console.log(grndTotal);\n Toastify({\n text: response['status'],\n backgroundColor: \"linear-gradient(to right, #00b09b, #96c93d)\",\n className: \"error\",\n }).showToast();\n }\n });\n\n}", "function inrToPoundConvert(){\n\tvar xhttp= new XMLHttpRequest();\n\txhttp.onreadystatechange = function(){\n\t\tif(this.readyState == 4 && this.status == 200){\n\t\t\tvar apiData =JSON.parse(this.responseText);\n\t\t\tvar indianData = 0.0;\n\t\t\tvar newValue=0.0;\n\t\t\tvar updateAmount = 0.0;\n\n\t\t\tindianData=document.getElementById('rupees').value;\n\t\t\tnewValue = apiData.rates.GBP;\n\t\t\tupdateAmount = indianData * newValue;\n\t\t\t\n\t\t\tdocument.getElementById('pounds').value = updateAmount;\t\n\t\t\t\n\t\t}\n\t};\n\txhttp.open(\"GET\",'https://api.fixer.io/latest?base=INR&symbols=GBP',true);\n\txhttp.send();\n}", "function calculate() {\n const curr_one_val = curr_one.value;\n const curr_two_val = curr_two.value;\n\n fetch(`https://api.exchangerate-api.com/v4/latest/${curr_one_val}`)\n .then(res => res.json())\n .then(data => {\n //console.log(data))\n const rate = data.rates[curr_two_val];\n \n rateEle.innerText = `1 ${curr_one_val} = ${rate} ${curr_two_val}`;\n\n amount_two.value = (amount_one.value * rate).toFixed(2);\n\n\n });\n}", "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}" ]
[ "0.56095946", "0.5566847", "0.55238754", "0.5516346", "0.55064994", "0.5320464", "0.52478284", "0.517854", "0.515293", "0.5085682", "0.5064342", "0.503334", "0.50287414", "0.49940336", "0.49579793", "0.49137762", "0.4907234", "0.49043846", "0.48985672", "0.48817647", "0.48793918", "0.48735073", "0.4866902", "0.48646054", "0.48497137", "0.48293173", "0.48286766", "0.4806484", "0.480258", "0.47781897", "0.4759537", "0.4757386", "0.47529164", "0.47348157", "0.47335628", "0.4721677", "0.4711795", "0.47116444", "0.4707967", "0.47057337", "0.47000268", "0.46955085", "0.46793917", "0.46775514", "0.46755826", "0.46714374", "0.46695212", "0.4667098", "0.46648964", "0.4657087", "0.46562853", "0.46556064", "0.46474433", "0.46474257", "0.46369365", "0.46340898", "0.46273214", "0.46272984", "0.46149155", "0.46081442", "0.4597872", "0.45952624", "0.45915225", "0.45883492", "0.45677868", "0.45673457", "0.45609853", "0.45609015", "0.45583054", "0.45541963", "0.45506135", "0.4547771", "0.45463055", "0.45450097", "0.4543181", "0.45405367", "0.45336497", "0.45319968", "0.45311472", "0.45308772", "0.45261207", "0.45238143", "0.45237774", "0.45217064", "0.4520868", "0.45201397", "0.45107964", "0.45081064", "0.45073143", "0.45008278", "0.44998562", "0.4499414", "0.44985235", "0.44967678", "0.44946852", "0.4490431", "0.4489321", "0.44893062", "0.44892684", "0.4486495" ]
0.73164093
0
NIVEL: mp mapa esquema
function mapaProcesos_mapa_esquema(jsonObj,cont) { //Tenemos el JSON completo y el nivel en el que estamos var datos_mp_fullcontent = jsonObj; var i = cont; //Tenemos el segundo array del JSON completo [mp_estructura] -> [subnivel] var datos_mp_content = datos_mp_fullcontent[i].subnivel; for (var j = 0; j < datos_mp_content.length; j++) { var result_nombre = ""; var result_nivel = ""; result_nombre = datos_mp_content[j].nombre; result_nivel = datos_mp_content[j].nivel; result_nivel_sindecimal = result_nivel.split("_",3); //Recorrido del primer nivel del esquema del MP if (result_nivel_sindecimal[0] == "1"){ if (result_nivel_sindecimal[1] == "01"){ texto_a_imprimir += "<div class=\"bc_mp_estruct_part1_25porc\"><p></p></div>"+ "<div class=\"bc_mp_estruct_part1_50porc\">"+ "<div class=\"bc_mp_caja_borde bc_mp_estruct_part1_50porc_intern_33porc\">"+ result_nombre +"</div>"; } else { if (result_nivel_sindecimal[1] == "02"){ texto_a_imprimir += "<div class=\"bc_mp_caja_borde bc_mp_estruct_part1_50porc_intern_33porc\">"+ result_nombre +"</div>"; } else { if (result_nivel_sindecimal[1] == "03"){ texto_a_imprimir += "<div class=\"bc_mp_caja_borde bc_mp_estruct_part1_50porc_intern_33porc\">"+ result_nombre +"</div>"+"</div>"+ "<div class=\"bc_mp_estruct_part1_25porc\"><p></p></div>"; } } } } //Recorrido del segundo nivel del esquema del MP if (result_nivel_sindecimal[0] == "2"){ if (result_nivel_sindecimal[1] == "01"){ texto_a_imprimir += "<div class=\"bc_mp_caja_borde bc_mp_caja_bgcolor_gris2 bc_mp_estruct_part2_16porc\">"+ result_nombre +"</div>"; } else{ if ((result_nivel_sindecimal[1]=="02")||(result_nivel_sindecimal[1]=="05")){ texto_a_imprimir += "<div class=\"bc_mp_estruct_part2_05porc\">"+ ">" +"</div>"+ "<div class=\"bc_mp_estruct_part2_16porc\">"+ "<div class=\"bc_mp_caja_borde bc_mp_caja_bgcolor_gris2 bc_mp_estruct_part2_16porc_agrupados_bottom\">"+ result_nombre +"</div>"; } else { if ((result_nivel_sindecimal[1]=="03")||(result_nivel_sindecimal[1]=="06")){ texto_a_imprimir += "<div class=\"bc_mp_caja_borde bc_mp_caja_bgcolor_gris2 bc_mp_estruct_part2_16porc_agrupados_top\">"+ result_nombre +"</div>"+ "</div>"; } } if ((result_nivel_sindecimal[1] == "04")||(result_nivel_sindecimal[1] == "07")){ texto_a_imprimir += "<div class=\"bc_mp_estruct_part2_05porc\">"+ ">" +"</div>"+ "<div class=\"bc_mp_caja_borde bc_mp_caja_bgcolor_gris2 bc_mp_estruct_part2_16porc\">"+ result_nombre +"</div>"; } } } //Recorrido del tercer nivel del esquema del MP if (result_nivel_sindecimal[0] == "3"){ if (result_nivel_sindecimal[1] < "20"){ if (result_nivel_sindecimal[1] == "01"){ texto_a_imprimir += "<div class=\"bc_mp_estruct_part3_50porc\">"; } texto_a_imprimir += "<div class=\"bc_mp_caja_borde bc_mp_estruct_part3_50porc_intern_33porc\">"+ result_nombre +"</div>"; } else { if (result_nivel_sindecimal[1] == "21"){ texto_a_imprimir += "</div><div class=\"bc_mp_estruct_part3_50porc\">"; } texto_a_imprimir += "<div class=\"bc_mp_caja_borde bc_mp_caja_bgcolor_gris1 bc_mp_estruct_part3_50porc_intern_33porc\">"+ result_nombre +"</div>"; if (result_nivel_sindecimal[1] == "29"){ texto_a_imprimir += "</div>"; } } } } texto_a_imprimir += "</div>"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function index_limpiarMapa() {\n\tobjetoLineas.setPath([]);\n\tobjetoLineas.setMap(map);\n\tarrayPuntos = new Array();\n\t\n\tif (arrayMarcas.length > 0) {\n\t\tfor (var x = 0; x < arrayMarcas.length; x++) {\n\t\t\tarrayMarcas[x].setMap(null);\n\t\t}\n\t}\n\t\t\n\tarrayMarcas = new Array();\n\t\n\tfor (var x = 0; x < arrayMarcasPuntos.length; x++) {\n\t\tarrayMarcasPuntos[x].setMap(null);\n\t}\n\t\n\tarrayMarcasPuntos = new Array();\n\tif (typeof objetoPoligono !== 'undefined') {\n\t\tobjetoPoligono.setMap(null);\n\t}\n}", "function map() {\n\n}", "function MapaParaLista(mapa) {\n var lista = [];\n for (var chave in mapa) {\n lista.push(chave);\n }\n return lista;\n}", "function marcadoresEnMapa (marcadores, mapa) {\n for (var i = 0; i < marcadores.length; i++) {\n marcadores[i].setMap(mapa)\n }\n }", "function Map() {\n\t\n}", "function Map() {\n\t\n}", "function MAP() {\n\n}", "get Mipmaps() {}", "set Mipmaps(value) {}", "function initMap() {\n// Créer l'objet \"macarte\" et l'insèrer dans l'élément HTML qui a l'ID \"map\"\nmacarte.setView([lat, lon], 11);\n// Leaflet ne récupère pas les cartes (tiles) sur un serveur par défaut. Nous devons lui préciser où nous souhaitons les récupérer. Ici, openstreetmap.fr\nL.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {\n // Il est toujours bien de laisser le lien vers la source des données\n attribution: 'donnsées © <a href=\"osm.org/copyright\">OpenStreetMap</a>/ODbL - rendu <a href=\"openstreetmap.fr\">OSM France</a>',\n minZoom: 1,\n maxZoom: 20\n}).addTo(macarte);\n}", "function mapa1(){\n // Crea un arreglo con los nodos visitados hasta ahora.\n var nodes = [\n \n {id: 1, label: 'Brasil'},\n ];\n\n // Crea un arreglo con las conexiones entre los nodos.\n var edges = [\n\n ];\n // Crea un arreglo con los nodos activos.\n var activeNode = [ 1 ];\n mapa( nodes, edges, activeNode );\n }", "function funcionInicializarMapa () {\r\n\r\n //Se crea una instancia para el mapa\r\n gmMapa = new google.maps.Map(document.querySelector('#mapa'), {\r\n //Se establece el zoom\r\n zoom: 16,\r\n //Se centra el mapa a una ubicacion\r\n center: new google.maps.LatLng(9.935, -84.092),\r\n //Se establece el tipo del mapa\r\n mapTypeId: google.maps.MapTypeId.HYBRID\r\n });\r\n //Se agregan opciones al mapa\r\n var gmOpcionesMapa = {\r\n //Se establece el zoom maximo\r\n maxZoom:20,\r\n //Se establece el zoom minimo\r\n minZoom:14,\r\n //Se deshabilita el uso de stree view\r\n streetViewControl: false,\r\n //Se deshabilita el control del tipo de mapa\r\n mapTypeControl: false\r\n }\r\n var nLatitud = sessionStorage.getItem(\"sesion_latitud_tiendas_CU5\");\r\n var nLongitud = sessionStorage.getItem(\"sesion_longitud_tiendas_CU5\");\r\n\r\n //Se agregan las opciones al mapa\r\n gmMapa.setOptions(gmOpcionesMapa);\r\n //Se setea un marcador con una ubicacion por defecto\r\n gmMarcador = new google.maps.Marker({\r\n //Se agrega la posicion en San Jose\r\n position: new google.maps.LatLng(nLatitud, nLongitud)//,\r\n //Se habilita el arratre del marcador\r\n //draggable: true\r\n });\r\n //Se centra el mapa en la posicion del marcador\r\n gmMapa.setCenter(gmMarcador.position);\r\n //Se coloca el marcador en el mapa\r\n gmMarcador.setMap(gmMapa);\r\n //Se obtiene una latitud y longitud por defecto\r\n nLatitud = gmMarcador.position.lat();\r\n nLongitud = gmMarcador.position.lng();\r\n\r\n\r\n var geocoder = new google.maps.Geocoder;\r\n\r\n geocoder.geocode({'location': gmMarcador.position}, function(results, status) {\r\n\r\n if (status === google.maps.GeocoderStatus.OK) {\r\n if (results[1]) {\r\n var gmContenido = '<h2>' + results[1].formatted_address + '</h2>' + '<p>' + gmMarcador.position + '</p>';\r\n var gmVentanaInformacion = new google.maps.InfoWindow({\r\n content: gmContenido\r\n });\r\n gmVentanaInformacion.open(gmMapa, gmMarcador);\r\n } else {\r\n window.alert('No results found');\r\n }\r\n } else {\r\n window.alert('Geocoder failed due to: ' + status);\r\n }\r\n });\r\n}", "function WoWMapProjection(){}", "function capaConsultas() {\n checkboxCapa = document.getElementById(\"capaConsultas\");\n if (checkboxCapa.checked) {\n for (var i = 0; i < polisConsulta.length; i++) {\n polisConsulta[i].setMap(map);\n } \n }\n else {\n for (var i = 0; i < polisConsulta.length; i++) {\n polisConsulta[i].setMap(null);\n } \n \n }\n}", "generarMapa(){\n this.counterId = 1;\n this.salaActual = new Sala(true,NaN, NaN, \"0.txt\", 0 ,this.counterId);\n this.counterId++;\n var listaNodosAActualizar = [this.salaActual];\n this.inicio = this.salaActual;\n while (listaNodosAActualizar.length > 0)\n {\n var proximaProfundida = [];\n listaNodosAActualizar.forEach(sala => {\n\n var derecha = false, izquierda = false ,arriba = false ,abajo = false;\n //Genara la sala de la izuierda, que no necesariamente se va a utilizar\n if(sala.izquierda == null)\n {\n sala.izquierda = this.generarSala(posicionSala.izquierda, sala);\n izquierda = true;\n }\n\n //Genara la sala de la derecha\n if(sala.derecha == null) {\n sala.derecha = this.generarSala(posicionSala.derecha, sala);\n derecha = true;\n }\n //Genera la sala de arriba\n if(sala.arriba == null) {\n sala.arriba = this.generarSala(posicionSala.arriba, sala);\n arriba = true;\n }\n //genera la sala de abajo\n if(sala.abajo == null) {\n sala.abajo = this.generarSala(posicionSala.abajo, sala);\n abajo = true;\n }\n //Los mete en la proxima generacion\n if(izquierda) proximaProfundida.push(sala.izquierda);\n if(derecha) proximaProfundida.push(sala.derecha);\n if(arriba) proximaProfundida.push(sala.arriba);\n if(abajo) proximaProfundida.push(sala.abajo);\n\n\n\n\n });\n proximaProfundida = proximaProfundida.filter(x=> x.depth <= 3 );\n proximaProfundida = proximaProfundida.filter(x => x != this.inicio);\n listaNodosAActualizar = proximaProfundida;\n\n }\n }", "constructor(hauteur,largeur){\n this.hauteur = hauteur;\n this.largeur = largeur;\n let nombreMursMinimum = (this.largeur*2)+(this.hauteur*2)+this.largeur*2+this.hauteur/2;\n this.map = this.setMap();\n console.log(nombreMursMinimum,this.nombreMurs())\n //TODO REGENERATION DE MAP SI Murs < Min\n\n // while(this.nombreMurs(this.map)<=nombreMursMinimum){\n // console.log(\"generation carte\")\n // this.map = this.setMap();\n // }\n \n }", "function SeleneseMapper() {\n}", "function mapa2(){\n // Crea un arreglo con los nodos visitados hasta ahora.\n var nodes = [\n \n {id: 1, label: 'Brasil'},\n {id: 2, label: 'Finlandia'},\n\n ];\n\n // Crea un arreglo con las conexiones entre los nodos.\n var edges = [\n {from: 1, to: 2},\n ];\n // Crea un arreglo con los nodos activos.\n var activeNode = [ 2 ];\n mapa( nodes, edges, activeNode );\n }", "function initMap() {\n\t// Créer l'objet \"macarte\" et l'insèrer dans l'élément HTML qui a l'ID \"map\"\n\tmacarte = L.map('map').setView([lat, lon], 5);\n\t// Leaflet ne récupère pas les cartes (tiles) sur un serveur par défaut. Nous devons lui préciser où nous souhaitons les récupérer. Ici, openstreetmap.fr\n\tL.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {\n\t\t// Il est toujours bien de laisser le lien vers la source des données\n\t\tattribution: 'données © <a href=\"//osm.org/copyright\">OpenStreetMap</a>/ODbL - rendu <a href=\"//openstreetmap.fr\">OSM France</a>',\n\t\tminZoom: 1,\n\t\tmaxZoom: 20\n\t}).addTo(macarte);\n\t\n\n}", "function Map() {}", "function Mapa() {\n\tthis.initialized = false\n\tthis.map = null\n\tthis.mapOptions = {\n\t\tzoom: 17,\n\t\tcenter: new google.maps.LatLng(-22.0059848, -47.8931638),\n\t}\n\tthis.realties = new Array()\n\tthis.descriptions = new Array()\n\n\tthis.realtyClusterer = null\n\tthis.descriptionClusterer = null\n\n\t// flag que diz se o usuario está adicionando uma nova descricão\n\tthis.addingDescription = false\n\t// posicao em que a nova descrição será adicionada\n\tthis.newDescriptionPosition = null\n}", "function initMap() {\n\t\t\t\t// Créer l'objet \"macarte\" et l'insèrer dans l'élément HTML qui a l'ID \"map\"\n macarte = L.map('map').setView([lat, lon], 11);\n // Leaflet ne récupère pas les cartes (tiles) sur un serveur par défaut. Nous devons lui préciser où nous souhaitons les récupérer. Ici, openstreetmap.fr\n L.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {\n // Il est toujours bien de laisser le lien vers la source des données\n attribution: 'données © <a href=\"//osm.org/copyright\">OpenStreetMap</a>/ODbL - rendu <a href=\"//openstreetmap.fr\">OSM France</a>',\n minZoom: 17\n }).addTo(macarte);\n // Nous ajoutons un marqueur\n \t\t\tlet marker = L.marker([48.8464712, 2.4288957]).addTo(macarte);\n \t\t \t// Nous ajoutons la popup. A noter que son contenu (ici la variable ville) peut être du HTML\n\t \t\tmarker.bindPopup(\"Carnium<br>3 Avenue de la République, 94300 Vincennes</br>\");\n \t\t\t}", "function initMap() {\n // Créer l'objet \"macarte\" et l'insèrer dans l'élément HTML qui a l'ID \"map\"\n macarte = L.map('map').setView([lat, lon], 11);\n // Leaflet ne récupère pas les cartes (tiles) sur un serveur par défaut. Nous devons lui préciser où nous souhaitons les récupérer. Ici, openstreetmap.fr\n L.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {\n // Il est toujours bien de laisser le lien vers la source des données\n attribution: 'données © <a href=\"//osm.org/copyright\">OpenStreetMap</a>/ODbL - rendu <a href=\"//openstreetmap.fr\">OSM France</a>',\n minZoom: 1,\n maxZoom: 20\n }).addTo(macarte);\n var marker = L.marker([lat, lon]).addTo(macarte);\n}", "initialiserMap() {\n this.terrain = {};\n this.arret = false;\n this.terrain.geometrie = JSON.parse(JSON.stringify(this.niveaux[this.niveauActuel].geometrie));\n this.terrain.dimension = {\n x: this.terrain.geometrie[0].length,\n y: this.terrain.geometrie.length\n };\n this.terrain.apparence = [];\n this.bitMasking();\n }", "function cambiarMapas()\r\n{\r\n\t opcion = sel.value();\r\n}", "setMapping(){\n this.amharicPhoneticMap.set('h', 'ህ');\n this.amharicPhoneticMap.set('ha', 'ሃ');\n this.amharicPhoneticMap.set('he', ['ሄ', 'ሀ']);\n this.amharicPhoneticMap.set('hi', 'ሂ');\n this.amharicPhoneticMap.set('ho', 'ሆ');\n this.amharicPhoneticMap.set('hu', 'ሁ');\n\n this.amharicPhoneticMap.set('l', 'ል');\n this.amharicPhoneticMap.set('la', 'ላ');\n this.amharicPhoneticMap.set('le', ['ሌ', 'ለ']);\n this.amharicPhoneticMap.set('li', 'ሊ');\n this.amharicPhoneticMap.set('lo', 'ሎ');\n this.amharicPhoneticMap.set('lu', 'ሉ');\n\n this.amharicPhoneticMap.set('m', 'ም');\n this.amharicPhoneticMap.set('ma', 'ማ');\n this.amharicPhoneticMap.set('me', ['ሜ', 'መ']);\n this.amharicPhoneticMap.set('mi', 'ሚ');\n this.amharicPhoneticMap.set('mo', 'ሞ');\n this.amharicPhoneticMap.set('mu', 'ሙ');\n\n this.amharicPhoneticMap.set('s', 'ስ');\n this.amharicPhoneticMap.set('sa', 'ሳ');\n this.amharicPhoneticMap.set('se', ['ሴ', 'ሰ']);\n this.amharicPhoneticMap.set('si', 'ሲ');\n this.amharicPhoneticMap.set('so', 'ሶ');\n this.amharicPhoneticMap.set('su', 'ሱ');\n\n this.amharicPhoneticMap.set('r', 'ር');\n this.amharicPhoneticMap.set('ra', 'ራ');\n this.amharicPhoneticMap.set('re', ['ሬ', 'ረ']);\n this.amharicPhoneticMap.set('ri', 'ሪ');\n this.amharicPhoneticMap.set('ro', 'ሮ');\n this.amharicPhoneticMap.set('ru', 'ሩ');\n\n this.amharicPhoneticMap.set('sh', 'ሽ');\n this.amharicPhoneticMap.set('sha', 'ሻ');\n this.amharicPhoneticMap.set('she', ['ሼ', 'ሸ']);\n this.amharicPhoneticMap.set('shi', 'ሺ');\n this.amharicPhoneticMap.set('sho', 'ሾ');\n this.amharicPhoneticMap.set('shu', 'ሹ');\n\n this.amharicPhoneticMap.set('q', 'ቅ');\n this.amharicPhoneticMap.set('qa', 'ቃ');\n this.amharicPhoneticMap.set('qe', ['ቄ', 'ቀ']);\n this.amharicPhoneticMap.set('qi', 'ቂ');\n this.amharicPhoneticMap.set('qo', 'ቆ');\n this.amharicPhoneticMap.set('qu', 'ቁ');\n\n this.amharicPhoneticMap.set('b', 'ብ');\n this.amharicPhoneticMap.set('ba', 'ባ');\n this.amharicPhoneticMap.set('be', ['ቤ', 'በ']);\n this.amharicPhoneticMap.set('bi', 'ቢ');\n this.amharicPhoneticMap.set('bo', 'ቦ');\n this.amharicPhoneticMap.set('bu', 'ቡ');\n\n this.amharicPhoneticMap.set('t', ['ት', 'ጥ']);\n this.amharicPhoneticMap.set('ta', ['ታ', 'ጣ']);\n this.amharicPhoneticMap.set('te', ['ቴ', 'ተ', 'ጤ', 'ጠ']);\n this.amharicPhoneticMap.set('ti', ['ቲ', 'ጢ']);\n this.amharicPhoneticMap.set('to', ['ቶ', 'ጦ']);\n this.amharicPhoneticMap.set('tu', ['ቱ', 'ጡ']);\n\n this.amharicPhoneticMap.set('ch', ['ች', 'ጭ']);\n this.amharicPhoneticMap.set('cha', ['ቻ', 'ጫ']);\n this.amharicPhoneticMap.set('che', ['ቼ', 'ቸ', 'ጬ', 'ጨ']);\n this.amharicPhoneticMap.set('chi', ['ቺ', 'ጪ']);\n this.amharicPhoneticMap.set('cho', ['ቾ', 'ጮ']);\n this.amharicPhoneticMap.set('chu', ['ቹ', 'ጩ']);\n\n this.amharicPhoneticMap.set('c', ['ች', 'ክ']);\n this.amharicPhoneticMap.set('ca', ['ቻ', 'ካ']);\n this.amharicPhoneticMap.set('ce', ['ቼ', 'ቸ', 'ኬ', 'ከ']);\n this.amharicPhoneticMap.set('ci', ['ቺ', 'ኪ']);\n this.amharicPhoneticMap.set('co', ['ቾ', 'ኮ']);\n this.amharicPhoneticMap.set('cu', ['ቹ', 'ኩ']);\n\n this.amharicPhoneticMap.set('n', 'ን');\n this.amharicPhoneticMap.set('na', 'ና');\n this.amharicPhoneticMap.set('ne', ['ኔ', 'ነ']);\n this.amharicPhoneticMap.set('ni', 'ኒ');\n this.amharicPhoneticMap.set('no', 'ኖ');\n this.amharicPhoneticMap.set('nu', 'ኑ');\n\n this.amharicPhoneticMap.set('gn', 'ኝ');\n this.amharicPhoneticMap.set('gna', 'ኛ');\n this.amharicPhoneticMap.set('gne', ['ኜ', 'ኘ']);\n this.amharicPhoneticMap.set('gni', 'ኚ');\n this.amharicPhoneticMap.set('gno', 'ኞ');\n this.amharicPhoneticMap.set('gnu', 'ኙ');\n\n this.amharicPhoneticMap.set('a', 'ኣ');\n this.amharicPhoneticMap.set('e', ['ኤ']);\n this.amharicPhoneticMap.set('i', 'ኢ');\n this.amharicPhoneticMap.set('o', 'ኦ');\n this.amharicPhoneticMap.set('u', 'ኡ');\n\n this.amharicPhoneticMap.set('k', 'ክ');\n this.amharicPhoneticMap.set('ka', 'ካ');\n this.amharicPhoneticMap.set('ke', ['ኬ', 'ከ']);\n this.amharicPhoneticMap.set('ki', 'ኪ');\n this.amharicPhoneticMap.set('ko', 'ኮ');\n this.amharicPhoneticMap.set('ku', 'ኩ');\n\n this.amharicPhoneticMap.set('w', 'ው');\n this.amharicPhoneticMap.set('wa', 'ዋ');\n this.amharicPhoneticMap.set('we', ['ዌ', 'ወ']);\n this.amharicPhoneticMap.set('wi', 'ዊ');\n this.amharicPhoneticMap.set('wo', 'ዎ');\n this.amharicPhoneticMap.set('wu', 'ዉ');\n\n this.amharicPhoneticMap.set('w', 'ው');\n this.amharicPhoneticMap.set('wa', 'ዋ');\n this.amharicPhoneticMap.set('we', ['ዌ', 'ወ']);\n this.amharicPhoneticMap.set('wi', 'ዊ');\n this.amharicPhoneticMap.set('wo', 'ዎ');\n this.amharicPhoneticMap.set('wu', 'ዉ');\n\n this.amharicPhoneticMap.set('z', 'ዝ');\n this.amharicPhoneticMap.set('za', 'ዛ');\n this.amharicPhoneticMap.set('ze', ['ዜ', 'ዘ']);\n this.amharicPhoneticMap.set('zi', 'ዚ');\n this.amharicPhoneticMap.set('zo', 'ዞ');\n this.amharicPhoneticMap.set('zu', 'ዙ');\n\n this.amharicPhoneticMap.set('x', 'ዝ');\n this.amharicPhoneticMap.set('xa', 'ዛ');\n this.amharicPhoneticMap.set('xe', ['ዜ', 'ዘ']);\n this.amharicPhoneticMap.set('xi', 'ዚ');\n this.amharicPhoneticMap.set('xo', 'ዞ');\n this.amharicPhoneticMap.set('xu', 'ዙ');\n\n this.amharicPhoneticMap.set('y', 'ይ');\n this.amharicPhoneticMap.set('ya', 'ያ');\n this.amharicPhoneticMap.set('ye', ['ዬ', 'የ']);\n this.amharicPhoneticMap.set('yi', 'ዪ');\n this.amharicPhoneticMap.set('yo', 'ዮ');\n this.amharicPhoneticMap.set('yu', 'ዩ');\n\n this.amharicPhoneticMap.set('d', 'ድ');\n this.amharicPhoneticMap.set('da', 'ዳ');\n this.amharicPhoneticMap.set('de', ['ዴ', 'ደ']);\n this.amharicPhoneticMap.set('di', 'ዲ');\n this.amharicPhoneticMap.set('do', 'ዶ');\n this.amharicPhoneticMap.set('du', 'ዱ');\n\n this.amharicPhoneticMap.set('j', 'ጅ');\n this.amharicPhoneticMap.set('ja', 'ጃ');\n this.amharicPhoneticMap.set('je', ['ጄ', 'ጀ']);\n this.amharicPhoneticMap.set('ji', 'ጂ');\n this.amharicPhoneticMap.set('jo', 'ጆ');\n this.amharicPhoneticMap.set('ju', 'ጁ');\n\n this.amharicPhoneticMap.set('g', 'ግ');\n this.amharicPhoneticMap.set('ga', 'ጋ');\n this.amharicPhoneticMap.set('ge', ['ጌ', 'ገ']);\n this.amharicPhoneticMap.set('gi', 'ጊ');\n this.amharicPhoneticMap.set('go', 'ጎ');\n this.amharicPhoneticMap.set('gu', 'ጉ');\n\n this.amharicPhoneticMap.set('ts', 'ጽ');\n this.amharicPhoneticMap.set('tsa', 'ጻ');\n this.amharicPhoneticMap.set('tse', ['ጼ', 'ጸ']);\n this.amharicPhoneticMap.set('tsi', 'ጺ');\n this.amharicPhoneticMap.set('tso', 'ጾ');\n this.amharicPhoneticMap.set('tsu', 'ጹ');\n\n this.amharicPhoneticMap.set('f', 'ፍ');\n this.amharicPhoneticMap.set('fa', 'ፋ');\n this.amharicPhoneticMap.set('fe', ['ፌ', 'ፈ']);\n this.amharicPhoneticMap.set('fi', 'ፊ');\n this.amharicPhoneticMap.set('fo', 'ፎ');\n this.amharicPhoneticMap.set('fu', 'ፉ');\n\n this.amharicPhoneticMap.set('p', 'ፕ');\n this.amharicPhoneticMap.set('pa', 'ፓ');\n this.amharicPhoneticMap.set('pe', ['ፔ', 'ፐ']);\n this.amharicPhoneticMap.set('pi', 'ፒ');\n this.amharicPhoneticMap.set('po', 'ፖ');\n this.amharicPhoneticMap.set('pu', 'ፑ');\n\n this.amharicPhoneticMap.set('v', 'ቭ');\n this.amharicPhoneticMap.set('va', 'ቫ');\n this.amharicPhoneticMap.set('ve', ['ቬ', 'ቨ']);\n this.amharicPhoneticMap.set('vi', 'ቪ');\n this.amharicPhoneticMap.set('vo', 'ቮ');\n this.amharicPhoneticMap.set('vu', 'ቩ');\n }", "function index_definirArea_mapa() {\n\tindex_limpiarMapa();\n\tif (listenerCrearLineasPoligono == null)\n\t\tlistenerCrearLineasPoligono = google.maps.event.addListener(map, 'click', index_crearLineasPoligono);\n}", "function setAllMapZonas(map) {\n for (var i = 0; i < todosLosMarcadoresDeZonas.length; i++) {\n todosLosMarcadoresDeZonas[i].setMap(map); //verificar por qué mierda no funciona! esta linea tira como undefined.\n }\n}", "function initMap() {\n var uluru = {lat: 45.3430556, lng: 14.4091667};\n map = new google.maps.Map(document.getElementById('map'), {\n mapTypeControl: false,\n streetViewControl: false,\n zoomControlOptions: {\n position: google.maps.ControlPosition.LEFT_CENTER\n },\n zoom: 8,\n center: uluru\n });\n map.addListener('click', function(e) {\n lng = e.latLng.lng();\n lat = e.latLng.lat(); // ovako cuvamo gdje je pozvan modal pri konstrukciji modala\n $('#myModal').modal();\n }); \n map.addListener('mouseover', function(e){\n padlng = e.latLng.lng();\n padlat = e.latLng.lat();\n }) // zabiljezava gdje je ispustena slika\n}", "function capaLeyenda() {\n checkboxCapa = document.getElementById(\"capaLeyenda\");\n if (checkboxCapa.checked) {\n etiqLeyenda.setMap(map);\n hayLeyenda = true;\n }\n else {\n etiqLeyenda.setMap(null);\n hayLeyenda = false; \n }\n}", "function PhoneticMapper(map)\n{\n this.map = map;\n}", "function initMap() {\n // Créer l'objet \"macarte\" et l'insèrer dans l'élément HTML qui a l'ID \"map\"\n macarte = L.map('map', { zoomControl: false, attributionControl: false }).setView([49.210186, -67.433494], 8); // Leaflet ne récupère pas les cartes (tiles) sur un serveur par défaut. Nous devons lui préciser où nous souhaitons les récupérer. Ici, openstreetmap.fr\n L.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {\n // Il est toujours bien de laisser le lien vers la source des données\n attribution: 'données © <a href=\"//osm.org/copyright\">OpenStreetMap</a>/ODbL - rendu <a href=\"//openstreetmap.fr\">OSM France</a>',\n minZoom: 1,\n maxZoom: 20\n }).addTo(macarte);\n var url = document.location.href;\n if (url.indexOf('bouee') == -1) {\n var listeCoords = new Array();\n listeCoords.push(49.0523948); listeCoords.push(-68.283337);\n for (var i = 2; i < 15; i += 2) {\n listeCoords.push(listeCoords[i - 2] + 0.1);\n listeCoords.push(listeCoords[i - 1] + 0.33);\n }\n for (var i = 0; i < 29; i += 2) {\n L.marker([listeCoords[i], listeCoords[i + 1]]).addTo(macarte);\n console.log(listeCoords[i] + ',' + listeCoords[i + 1])\n\n }\n } else {\n macarte.setView([49.0523948, -68.283337], 10);\n L.marker([49.0523948, -68.283337]).addTo(macarte);\n }\n\n}", "function inicializarMapa() {\n // The location of Córdoba\n var casaCentral = { lat: -31.4662446, lng: -64.3983766 } //casa central en Córdoba\n // The map, centered at localizacion\n var map =new google.maps.Map(document.getElementById('maps'),{zoom: 4, center: casaCentral});\n\n localizaciones.forEach(localizacion => {\n //cargo los marcadores\n var marker = new google.maps.Marker({\n position: localizacion.position, \n map: map\n }); \n //cuando hace click se abre la ventanita infowindows con el nombre \n var infowindow = new google.maps.InfoWindow({\n content: localizacion.content\n });\n \n marker.addListener('click', function() {\n infowindow.open(map, marker);\n });\n }); \n \n}", "function init_Mapa1() {\n \t//Crear mapa en el elemento DOM\n \t//CIUDADO: Se crea como variable global para que los eventos puedan modificarlo\n \tmapa1 = new ol.Map({\n \t\tview: new ol.View({}),\n \t\tlayers: [\n \t\t\t//mapa base\n \t\t\tnew ol.layer.Tile({\n \t\t\t\tsource: new ol.source.TileWMS({\n \t\t\t\t\turl: 'http://idena.navarra.es/ogc/wms',\n \t\t\t\t\tparams: {\n \t\t\t\t\t\tLAYERS: 'IDENA:AGROAL_Pol_DOPIdiazabal'\n \t\t\t\t\t},\n \t\t\t\t}),\n \t\t\t\ttitle: 'capa0',\n \t\t\t\tvisible: true\n \t\t\t}),\n\n \t\t\tnew ol.layer.Tile({\n \t\t\t\tsource: new ol.source.TileWMS({\n \t\t\t\t\turl: 'http://idena.navarra.es/ogc/wms',\n \t\t\t\t\tparams: {\n \t\t\t\t\t\tLAYERS: 'IDENA:MTNa5_BTA_fondo'\n \t\t\t\t\t},\n \t\t\t\t}),\n \t\t\t\ttitle: 'capa1',\n \t\t\t\tvisible: true\n \t\t\t}),\n\n \t\t\tnew ol.layer.Tile({\n \t\t\t\tsource: new ol.source.TileWMS({\n \t\t\t\t\turl: 'http://idena.navarra.es/ogc/wms',\n \t\t\t\t\tparams: {\n \t\t\t\t\t\tLAYERS: 'REFERE_Pol_Navarra'\n \t\t\t\t\t},\n \t\t\t\t}),\n \t\t\t\ttitle: 'capa2',\n \t\t\t\tvisible: true\n \t\t\t}),\n \t\t\tnew ol.layer.Tile({\n \t\t\t\tsource: new ol.source.TileWMS({\n \t\t\t\t\turl: 'http://idena.navarra.es/ogc/wms',\n \t\t\t\t\tparams: {\n \t\t\t\t\t\tLAYERS: 'IDENA:mapa_relieve_color'\n \t\t\t\t\t},\n \t\t\t\t}),\n \t\t\t\ttitle: 'capa3',\n \t\t\t\tvisible: true\n \t\t\t}),\n \t\t\tnew ol.layer.Tile({\n \t\t\t\tsource: new ol.source.TileWMS({\n \t\t\t\t\turl: 'http://idena.navarra.es/ogc/wms',\n \t\t\t\t\tparams: {\n \t\t\t\t\t\tLAYERS: 'ortofoto_5000_2017'\n \t\t\t\t\t},\n \t\t\t\t}),\n \t\t\t\ttitle: 'capa4',\n \t\t\t\tvisible: true\n \t\t\t})\n \t\t],\n \t\ttarget: 'Mapa1'\n \t});\n\n }", "function criarMarcadores(map) {\n for (localKey in locais) {\n const posicao = locais[localKey];\n const title = legendasLocais[localKey].descricao;\n\n posicao.forEach((pos) => {\n const [lat, lng] = pos;\n criarMarcador(map, { lat, lng }, title, localKey);\n });\n }\n}", "function mappy(dataset) {\n var newAreas = {};\n dataset.forEach((key) => {\n let area = {};\n area.value = key.Tasso;\n area.tooltip = {\n content:\n \"<span style='font-weight:bold;'>\" +\n key.Nazione +\n \" \" +\n \"</span>\" +\n \"<br/>\" +\n \"Software illegale: \" +\n area.value +\n \"%\" +\n \"<br>Valore: \" +\n key.Valore +\n \"$ milioni\",\n };\n area.eventHandlers = {\n click: function (e, id, mapElem, textElem) {\n $(\".first\").remove();\n $(\".f32\").remove();\n $(\".graph-container\").removeClass(\"hidden\");\n $(\"#description\").append(\n \"<p class='first f32' style='font-weight:bold; font-size: 1.2em; margin-left: 20px;'>\" +\n key.Nazione +\n \" \" +\n \"<span class='flag \" +\n key.Codice.toLowerCase() +\n \"'></span></p>\"\n );\n $(\"#description\").append(\n \"<p class='first' style='font-size:18px; margin-left: 20px;'>É possibile confrontare fino a quattro paesi, da notare \" +\n \"la tendenza inversamente proporzionale tra i valori dei due grafici</p>\"\n );\n creategraph(dataset, key.Codice);\n creategraphalt(dataset, key.Codice);\n $(\".container\").trigger(\"zoom\", {\n level: 8,\n latitude: key.latitude,\n longitude: key.longitude,\n });\n $(\".container\").addClass(\"active\");\n $(\".container\").trigger(\"tooltip.css\", {\n display: \"block\",\n });\n },\n };\n newAreas[key.Codice] = area;\n });\n $(\".container\").mapael({\n map: {\n name: \"world_countries\",\n //width: 500,\n zoom: {\n enabled: true,\n step: 0.25,\n maxLevel: 20,\n },\n defaultArea: {\n attrs: {\n fill: \"#666666\",\n stroke: \"#ced8d0\",\n \"stroke-width\": 0.3,\n cursor: \"pointer\",\n },\n attrsHover: {\n \"stroke-width\": 1.5,\n },\n },\n defaultPlot: {\n text: {\n attrs: {\n fill: \"#b4b4b4\",\n },\n attrsHover: {\n fill: \"#fff\",\n \"font-weight\": \"bold\",\n },\n },\n },\n },\n text: {\n attrs: {\n cursor: \"pointer\",\n \"font-size\": 10,\n fill: \"#666\",\n },\n },\n areas: newAreas,\n legend: {\n area: {\n display: true,\n //mode: \"horizontal\",\n title: \"Percentuale di software illegale scaricato\",\n marginBottom: 6,\n slices: [\n {\n max: 25,\n attrs: {\n fill: \"#6aafe1\",\n },\n legendSpecificAttrs: {\n stroke: \"#505050\",\n },\n label: \"Tasso < 25%\",\n },\n {\n min: 26,\n max: 50,\n attrs: {\n fill: \"#459bd9\",\n },\n label: \"Tasso compreso tra 25 e 50 %\",\n },\n {\n min: 51,\n max: 75,\n attrs: {\n fill: \"#2579b5\",\n },\n label: \"Tasso compreso tra 50 e 75 %\",\n },\n {\n min: 76,\n attrs: {\n fill: \"#1a527b\",\n },\n label: \"Tasso > 75%\",\n },\n ],\n },\n },\n });\n $(\".zoomReset\").click(function () {\n //flush all\n $(\".container\").removeClass(\"active\");\n $(\".graph-container\").addClass(\"hidden\");\n myfunCalls = 0;\n check = [];\n checkalt = [];\n $(\"#limit\").css(\"display\", \"none\");\n });\n }", "function index_mostrarMapa(transaccion) {\n\t$(\"#index_filtros_transaccion li.lista li[data-value='\"+transaccion+\"']\").click();\n\t$(\"#index_filtros_transaccion li.lista\").hide();\n\t$('.galeria').css('width',0);\n\t\n\t\n\tif ($(\"#indexContenedorMapa\").css(\"display\") == \"none\") {\n\t\t$(\"#indexContenedorMapa\").show();\n\t\t$(\".controlesMapa\").show();\n\t\t$(\".filtrosMapa\").show();\n\t\ttempCenter = new google.maps.LatLng(20.673792, -103.3354131);\n\t\t\n\t\t//define el google maps\n\t\tvar mapaGoogle = document.getElementById(\"indexContenedorMapa\");\n\t\tvar mapOptions = {\n\t\t\tcenter: tempCenter,\n\t\t\tzoom: 13,\n\t\t\tmapMaker: true,\n\t\t\tscrollwheel: false,\n\t\t\tmapTypeId: google.maps.MapTypeId.ROADMAP\n\t\t};//SATELLITE,ROADMAP\n\t\t\n\t\tmap = new google.maps.Map(mapaGoogle, mapOptions);\n\t\t\n\t\tobjetoLineas = new google.maps.Polyline({\n\t\t\tpath: [],\n\t\t\tgeodesic: true,\n\t\t\tstrokeColor: \"#852c2b\",\n\t\t\tstrokeOpacity: 1.0,\n\t\t\tstrokeWeight: 2\n\t\t});\n\t\t\n\t\tobjetoLineas.setMap(map);\n\t\t\n\t\tcadenaInfo =\n\t\t\t\"<div class='template_infoWindow'>\"+\n\t\t\t\t\"<p>Instrucciones del mapa</p>\"+\n\t\t\t\t\"- Haga click dentro del mapa para agregar puntos y delimitar el área de búsqueda.<br />\"+\n\t\t\t\t\"- A partir del tercer click se mostrara el área de búsqueda.<br />\"+\n\t\t\t\t\"- Puedes arrastras los puntos del mapa para modificar el área.<br />\"+\n\t\t\t\t\"- Al finalizar el área de búsqueda da click en buscar propiedades.<br />\"+\n\t\t\t\t\"- Puedes hacer click en limpiar mapa para comenzar de nuevo.<br />\"+\n\t\t\t\t\"- Para filtrar su búsqueda puede utilizar el cuadro ubicado en el lado derecho del mapa.\"+\n\t\t\t\"</div>\";\n\t\tvar infoWindow = new google.maps.InfoWindow({\n\t\t\tcontent: cadenaInfo,\n\t\t\tposition: tempCenter\n\t\t});\n\t\tinfoWindow.open(map);\n\t}\n\t\n\t//comienza la definicion de puntos en el mapa\n\tindex_definirArea_mapa();\n}", "function localizacion(posicion){\n\n var latitude = posicion.coords.latitude;\n var longitude = posicion.coords.longitude;\n \n \n \n var posicion={lat:latitude, lng: longitude}\n \n const inplat=document.getElementById(\"lat\");\n const inplong=document.getElementById(\"lng\");\n inplat.value=latitude;\n inplong.value=longitude;\n \n const map = new google.maps.Map(document.getElementById(\"map\"), {\n zoom: 16,\n center: {\n\n lat: latitude,\n lng: longitude\n }\n });\n \n \n var marker = new google.maps.Marker({position: posicion,animation: google.maps.Animation.DROP, map: map, label: {\n color: 'black',\n fontWeight: 'bold',\n text: 'Tu ubicación',\n },});\n }", "function init_Mapa1() {\n //Crear mapa en el elemento DOM\n mapa1 = new ol.Map({\n view: new ol.View({\n center: [-15000, 6700000],\n zoom: 4\n }),\n layers: [\n new ol.layer.Tile({\n source: new ol.source.TileWMS({\n url: 'http://demo.mapserver.org/cgi-bin/wms',\n params: {\n 'LAYERS': 'bluemarble'\n },\n }),\n title: 'capa1'\n })\n ],\n target: 'Mapa1'\n });\n}", "mapF(){\n\n\n\n /*\n this.reproduccion.casos_prueba.map( function (state) {\n //console.log(state)\n\n return {\n value: state.nombre_caso_prueba.toLowerCase(),\n display: state.id_caso_prueba + ' ' + state.nombre_caso_prueba\n }\n });\n */\n\n console.log(this.querySearch('qqqq'))\n \n\n /*return {\n value: state.toLowerCase(),\n display: state\n };\n */\n }", "function initMap(resultats) {\n /* // initialiser 4 tableaux vide\n var tab_coor = [];\n var tab_nom = [];\n var tab_type = []; */\n\n\n // The location of Paris - La Villette\n var center = { lat: 48.893937, lng: 2.390411 };\n // The map, centered at Paris - La Villette\n map = new google.maps.Map(\n document.getElementById('map'), {\n zoom: 16, center: center, styles: [\n {\n featureType: 'poi.business',\n stylers: [{ visibility: 'off' }]\n },\n {\n featureType: 'transit',\n elementType: 'labels.icon',\n stylers: [{ visibility: 'off' }]\n }\n ]\n });\n getLocation();\n for (let pins of resultats) {\n if (pins.categories == '7') {\n /* // ajouter au tableau des objets de type tab_coor[pins] = {lat: 'number', lng: 'number'}\n tab_coor.push({ lat: parseFloat(pins.acf.latitude), lng: parseFloat(pins.acf.longitude) });\n // ajouter au tableau des objets de type tab_nom[pins] = {'nom'}\n tab_nom.push(pins.acf.name);\n // aujouter au tableau des objets sur le type du pins\n tab_type.push(pins.acf.categorie); */\n\n var coord = { lat: parseFloat(pins.acf.latitude), lng: parseFloat(pins.acf.longitude) };\n var img = pins.acf.img;\n \n dest = new google.maps.LatLng(parseFloat(pins.acf.latitude), parseFloat(pins.acf.longitude));\n\n let contentString = \"<div class=\\\"nompins\\\">\" + pins.acf.name + \"</div>\" + \"<button class=\\\"buttonpins\\\" onclick=\\\"calculateRoute(\" + dest + \")\\\">ITINÉRAIRE</button>\";\n let infowindow = new google.maps.InfoWindow({ content: contentString });\n\n let lemarker = new google.maps.Marker({ position: coord, map: map, tag: pins.acf.categorie, /*label: {text: pins.acf.name, color: \"#000000\"},*/ icon: img });\n tab.push(lemarker);\n\n\n lemarker.addListener('click', (function () {\n let marqueurActuel = lemarker;\n return function () { infowindow.open(map, lemarker); }\n })());\n }\n }\n console.log(tab);\n // For each post with marker\n /* var i;\n for (i = 0; i < tab_nom.length; i++) {\n tab.push(new google.maps.Marker({ position: tab_coor[i], map: map, tag: tab_type[i], label: tab_nom[i] }));\n } */\n\n var items = document.getElementsByName('chk');\n for (var i = 0; i < items.length; i++) {\n if (items[i].type == 'checkbox')\n items[i].checked = true;\n }\n\n}", "function initMap() {\n\n let infoHotel = getHotelVisualizar();\n\n let latitudHotel = Number(infoHotel['latitud']);\n let longitudHotel = Number(infoHotel['longitud']);\n\n\n let posicionCentral = { lat: latitudHotel, lng: longitudHotel };\n\n let opciones = {\n zoom: 16,\n center: posicionCentral,\n mapTypeControl: false\n\n }\n\n //Creacion de mapa\n let mapa = new google.maps.Map(document.getElementById('mapaHotel'), opciones);\n\n //Marker\n let marker = new google.maps.Marker({\n position: posicionCentral,\n map: mapa,\n });\n}", "function setAllMap(map) {\n for (var i = 0; i < todosLosMarcadores.length; i++) {\n todosLosMarcadores[i].setMap(map);\n }\n}", "function inicia_google_maps(){\n\tcria_mapa_colorido(PHP.localizacao_geografica[0], PHP.localizacao_geografica[1]);\n}", "function setMap(m) {\n map = m;\n }", "function vielseMap() {\n var lommedal = {lat: 59.950574, lng: 10.501232}; //Område som skal vises\n var map = new google.maps.Map(document.getElementById('mapVielse'), { //I funksjonen google.maps.Map kan man legge til funksjoner som zoom og hvor kartet skal være sentrert.\n zoom: 17, //Zooming på kartet\n center: lommedal //Hvor kartet skal sentreres, her i posisjon lommedal (satt i longitude og latitude)\n });\n var marker = new google.maps.Marker({ //Posisjonen til markøren\n position: lommedal,\n map: map\n });\n}", "function mapa3(){\n // Crea un arreglo con los nodos visitados hasta ahora.\n var nodes = [\n \n {id: 1, label: 'Brasil'},\n {id: 2, label: 'Finlandia'},\n {id: 3, label: 'China'},\n ];\n\n // Crea un arreglo con las conexiones entre los nodos.\n var edges = [\n {from: 1, to: 2},\n {from: 2, to: 3},\n\n \n\n ];\n // Crea un arreglo con los nodos activos.\n var activeNode = [ 3 ];\n mapa( nodes, edges, activeNode );\n}", "setMap(map, on_response = empty_fun) {\n let data = '';\n for(let pair of map) {\n data += `${pair[0]}\\n${_raw_size(pair[1])}\\n${pair[1]}\\n`;\n }\n\n this.httpPost('mset', function(resp) {\n on_response(resp.isOk());\n }, data);\n }", "function setMapOnAll(map) {\n\tfor (var i = 0; i < puntos.length; i++) {\n\t puntos[i].setMap(map);\n\t }\n\t}", "function MapTable() {\r\n}", "function setMapSize(){\n\t//si la fenetre est inferieur a x alors on met la carte en largeur max (typiquement on est sur un smartphone)\n\tif(window.innerWidth < 769){\n\t\tvar largeur_a_enlever_a_la_carte = 0;\n\t\tvar hauteur_a_rajouter_a_la_liste = 50;\n\t}\n\telse{\n\t\tvar largeur_a_enlever_a_la_carte = 300;\n\t\tvar hauteur_a_rajouter_a_la_liste = 0;\n\t}\n\t//si le navigateur est internet explorer\n\tif (MQA.browser.name == \"msie\"){\n\t\tdocument.getElementById('map').style.width = document.body.offsetWidth - 20 - largeur_a_enlever_a_la_carte;\n\t\tdocument.getElementById('map').style.height = document.body.offsetHeight - $('#offset').height() - 20;\n\t\talert(\"Internet Explorer ne permet pas d'afficher les équipes et leur parcours. Utilisez un navigateur plus récent comme Chrome ou Firefox.\");\n\t\t//meme chose pour la liste\n\t\tdocument.getElementById('userlist').style.height = document.body.offsetHeight - $('#offset').height() - 20;\n\t} else {\n\t\tdocument.getElementById('map').style.width = window.innerWidth - largeur_a_enlever_a_la_carte;\n\t\tdocument.getElementById('map').style.height = window.innerHeight - $('#offset').height();\n\t\t//meme chose pour la liste\n\t\tdocument.getElementById('userlist').style.height = window.innerHeight - $('#offset').height() + hauteur_a_rajouter_a_la_liste;\t\n\t}\n\t\n}", "function init_Mapa2() {\n mapa2 = new ol.Map({\n view: new ol.View({\n center: [-15000, 6700000],\n zoom: 4\n }),\n layers: [\n new ol.layer.Tile({\n source: new ol.source.OSM(),\n title: 'capa1'\n })\n ],\n target: 'Mapa2'\n });\n\n}", "function initMap() {\n // Créer l'objet \"macarte\" et l'insèrer dans l'élément HTML qui a l'ID \"map\"\n overview = L.map('map').setView([lat, lon], 9); //Changer le nombre ici pour dézoomer la carte \n // Leaflet ne récupère pas les cartes (tiles) sur un serveur par défaut. Nous devons lui préciser où nous souhaitons les récupérer. Ici, openstreetmap.fr\n L.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {\n // Il est toujours bien de laisser le lien vers la source des données\n attribution: 'données © <a href=\"//osm.org/copyright\">OpenStreetMap</a>/ODbL - rendu <a href=\"//openstreetmap.fr\">OSM France</a>',\n minZoom: 1,\n maxZoom: 20\n }).addTo(overview);\n var icone = L.icon({\n iconUrl: \"https://img2.freepng.fr/20180702/qu/kisspng-temperature-computer-icons-celsius-thermometer-cli-5b39e62a1b47e8.1921838915305211301118.jpg\",\n iconSize: [50, 50],\n iconAnchor: [25, 50],\n popupAnchor: [0, -50]\n });\n // Nous ajoutons un marqueur\n var marker = L.marker([lat, lon]/*, { icon: icone }*/).addTo(overview);\n}", "function detailMunicipio(){\n munD = '';\n if (map.getZoom() >= 14){\n\t var latDet = roundNumber(targetCoordMun.lat(),7); while (latDet.length != 10){latDet = latDet + \"0\" + \"\";}\n\t\tvar lngDet = roundNumber(targetCoordMun.lng(),7); while (lngDet.length != 10){lngDet = lngDet + \"0\" + \"\";}\n\t\t\n\t\tvar plesso = coordPless['\"'+lngDet+','+latDet+'\"'][0];\n\t\t\n\t for (var x in plesso){\n\t\t\tmunD = plesso[x][\"M\"];\n\n\t\t}\n }\n\n}", "function initialize(puntos) { \r\n //iniciamos un nuevo mapa el div 'map' y le asignamos propiedades \r\n var map = new google.maps.Map(document.getElementById('map'), { \r\n center: new google.maps.LatLng(-17.4038, -66.1635), //coordenada inicial \r\n zoom: 14, //nivel de zoom \r\n mapTypeId: google.maps.MapTypeId.ROADMAP //tipo de mapa \r\n\r\n }); \r\n\r\n //llamar a la funcion que escribe los marcadores \r\n setMarkers(map, puntos); \r\n\r\n}", "uzycieMap(){\n const cityMessage = this.cities.map((city) => {\n return this.name + \" has lived in \" + city;\n });\n return cityMessage;\n }", "function paradasRutas(storeParadasRutas) {\n \n var estado=0;\n for (var i = 0; i < storeParadasRutas.length; i++) {\n image = {\n url: 'img/marker5.png',\n size: new google.maps.Size(50, 50),\n origin: new google.maps.Point(0, 0),\n anchor: new google.maps.Point(0, 50)\n };\n if(i===1){\n estado=1;\n image = {\n url: 'img/marker6.png',\n size: new google.maps.Size(50, 50),\n origin: new google.maps.Point(0, 0),\n anchor: new google.maps.Point(0, 50)\n };\n }\n if(i===4){\n estado=1;\n image = {\n url: 'img/marker6.png',\n size: new google.maps.Size(50, 50),\n origin: new google.maps.Point(0, 0),\n anchor: new google.maps.Point(0, 50)\n };\n }\n \n var myLatLng = new google.maps.LatLng(storeParadasRutas[i].lat, storeParadasRutas[i].lon);\n addMarker(myLatLng, storeParadasRutas[i].dir_img, storeParadasRutas[i].direccion, estado,storeParadasRutas[i].referencia,storeParadasRutas[i].barrio, storeParadasRutas[i].imagenVisibleParada);\n }\n setAllMap(mapGoogle);\n}", "function getXeovisorMinMap(){\n if (map == undefined){\n\t\tinit();\n }\n return map;\n}", "function inicializa_mapa()\n{\n\n estado = 1;\n\n // START PROMPT ANIMATION\n move_obj($('mapa_jogo_img'),-1000,0);\n move_obj($('mapa_jogo_flash'),-1000,0);\n move_obj($('comida_img'),-1000,0);\n limpa_pontuacaos();\n move_obj($('comida_pw_img'),-1000,0);\n for(var i=0; i<=12; i++)\n move_obj($('ecra_inicial_obj_'+i),-1000,0);\n move_obj($('ecra_inicial_obj'),-1000,0);\n move_obj($('inicializa_mapa_obj'),0,0);\n\n if (creditos > 1)\n {\n move_obj($('inicializa_mapa_obj_1'),-1000,0);\n move_obj($('inicializa_mapa_obj_2'),224,335);\n }\n else\n {\n move_obj($('inicializa_mapa_obj_1'),264,335);\n }\n}", "function Mapa(canvas, contexto, colorCuadricula, tamanoCelda){\r\n\r\n this.canvas = (canvas == null) ? null : canvas;\r\n this.colorCuadricula = (colorCuadricula == null) ? \"#5E2750\" : colorCuadricula;\r\n this.contexto = (this.canvas == null) ? null : canvas.getContext(contexto);\r\n this.tamanoCelda = (tamanoCelda == null) ? 32 : tamanoCelda;\r\n\r\n this.ancho = (canvas == null) ? 0 : canvas.width;\r\n this.alto = (canvas == null) ? 0 : canvas.height;\r\n\r\n this.matrix = [];\r\n\r\n // Evitamos referencias circulares\r\n canvas = null;\r\n}", "function getMap() {\n showJourneyMap();\n}", "function initmap() {\n // set up the map\n map = new L.Map('map');\n var osmUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';\n var osmAttrib='Map data © <a href=\"https://openstreetmap.org\">OpenStreetMap</a> contributors';\n var osm = new L.TileLayer(osmUrl, {minZoom: 2, maxZoom: 16, attribution: osmAttrib});\n map.setView(new L.LatLng(-16.5, -65.15),5.5);\n map.addLayer(osm);\n \n //DICCIONARIO\n const dic=[{'nombre':'SLCB', 'longitude':\t'-66.177101' , 'latitude':\t'-17.421'},\n{'nombre':'SLGY', 'longitude':\t'-65.345802' , 'latitude':\t'-10.8216'},\n{'nombre':'SLLP', 'longitude':\t'-68.1922' , 'latitude':\t'-16.5133'},\n{'nombre':'SLRQ', 'longitude':\t'-67.498001' , 'latitude':\t'-14.4275'},\n{'nombre':'SLET', 'longitude':\t'-63.171398' , 'latitude':\t'-17.811501'},\n{'nombre':'SLSU', 'longitude':\t'-65.149612' , 'latitude':\t'-19.246836'},\n{'nombre':'SLTR', 'longitude':\t'-64.917999' , 'latitude':\t'-14.8187'},\n{'nombre':'SLUY', 'longitude':\t'-66.830002' , 'latitude':\t'-20.459999'},\n{'nombre':'SLVR', 'longitude':\t'-63.1353' , 'latitude':\t'-17.644699'},\n{'nombre':'SLHI', 'longitude':\t'-65.141502' , 'latitude':\t'-16.98975'},\n{'nombre':'SLRI', 'longitude':\t'-66.116669' , 'latitude':\t'-11.0105'},\n{'nombre':'SLRY', 'longitude':\t'-65.149612' , 'latitude':\t'-13.3333333333'},\n{'nombre':'SLPS', 'longitude':\t'-57.8191625744' , 'latitude':\t'-18.9748221244'},\n{'nombre':'SLYA', 'longitude':\t'-63.65166666666' , 'latitude':\t'-21.9608333'},\n{'nombre':'SLAG', 'longitude':\t'-63.9627777777' , 'latitude':\t'-19.8238889'},\n{'nombre':'SLAP', 'longitude':\t'-68.4119444444' , 'latitude':\t'-14.7355556'},\n{'nombre':'SLAS', 'longitude':\t'-63.15666666666' , 'latitude':\t'-15.9302778'},\n{'nombre':'SLBJ', 'longitude':\t'-64.3127777777' , 'latitude':\t'-22.7733333'},\n{'nombre':'SLCA', 'longitude':\t'-63.5274999999' , 'latitude':\t'-20.0072222'},\n{'nombre':'SLCP', 'longitude':\t'-62.028611111' , 'latitude':\t'-16.1383333'},\n{'nombre':'SLJE', 'longitude':\t'-60.7430555555' , 'latitude':\t'-17.8308333'},\n{'nombre':'SLJO', 'longitude':\t'-64.6744444444' , 'latitude':\t'-13.0658333'},\n{'nombre':'SLJV', 'longitude':\t'-62.4702777777' , 'latitude':\t'-16.2708333'},\n{'nombre':'SLMG', 'longitude':\t'-64.0619444444' , 'latitude':\t'-13.2586111'},\n{'nombre':'SLOR', 'longitude':\t'-67.075' , 'latitude':\t'-17.9555556'},\n{'nombre':'SLPO', 'longitude':\t'-65.7233333333' , 'latitude':\t'19.5422222'},\n{'nombre':'SLRA', 'longitude':\t'-64.6038888888' , 'latitude':\t'-13.2638889'},\n{'nombre':'SLRB', 'longitude':\t'-59.7658333333' , 'latitude':\t'-18.3277778'},\n{'nombre':'SLSA', 'longitude':\t'-65.4347222222' , 'latitude':\t'-13.7616667'},\n{'nombre':'SLSB', 'longitude':\t'-66.7386111111' , 'latitude':\t'-14.8577778'},\n{'nombre':'SLSI', 'longitude':\t'-60.96166666666' , 'latitude':\t'-16.3844444'},\n{'nombre':'SLSM', 'longitude':\t'-65.6338888888' , 'latitude':\t'-14.9655556'},\n{'nombre':'SLSR', 'longitude':\t'-66.7869444444' , 'latitude':\t'-14.0744444'},\n{'nombre':'SLTI', 'longitude':\t'-58.40194444444' , 'latitude':\t'-16.3391667'},\n{'nombre':'SLVG', 'longitude':\t'-64.0994444444' , 'latitude':\t'-18.4825'},\n{'nombre':'SLVM', 'longitude':\t'-63.4066666666' , 'latitude':\t'-21.2541667'},\n{'nombre':'SLTJ', 'longitude':\t'-64.701302' , 'latitude':\t'-21.5557'},\n{'nombre':'SLCX', 'longitude':\t'-68.782898' , 'latitude':\t'-11.0404'}]\n \n//COLORES\nconst color=[{'color':'#00CC00'},{'color':'#CCFF00'},{'color':'#0066CC'},{'color':'#00CC99'},\n{'color':'#990033'},{'color':'#FF6633'},{'color':'#FF0000'},{'color':'#99FF66'},{'color':'#CC00FF'},\n{'color':'#660099'},{'color':'#66CC99'},{'color':'#993300'},{'color':'#000099'},{'color':'#00FFFF'},\n{'color':'#00FF00'},{'color':'#3366FF'},{'color':'#999966'},{'color':'#CC00FF'},{'color':'#FF6600'},\n{'color':'#00FF66'},{'color':'#3399FF'},{'color':'#996699'},{'color':'#CC66FF'},{'color':'#FFCC66'},\n{'color':'#0099CC'},{'color':'#330000'},{'color':'#993333'},{'color':'#CCCCFF'},{'color':'#FFCC00'},\n{'color':'#0066CC'},{'color':'#330066'},{'color':'#9900FF'},{'color':'#CC66CC'},{'color':'#FFFFFF'},\n{'color':'#006666'},{'color':'#33CC99'},{'color':'#99FF33'},{'color':'#CCCC66'},] \n\n \n \n //MARCADORES\n \n\n for (let index = 0; index < dic.length; index++) {\n var marker = L.circleMarker([ dic[index].latitude, dic[index].longitude],{\n radius: 15,\n fillColor: color[index].color,\n color: \"#000\",\n weight: 1,\n opacity: 1,\n fillOpacity: 0.8,\n title: \"test\"}).addTo(map); /* .on('click', onClick) */\n marker.myJsonData = dic[index].nombre;\n \n marker.bindPopup(dic[index].nombre).closePopup();\n\n function onClick(e) {\n alert(\"Ciudad: \" + e.target.myJsonData);\n }\n }\n}", "function initMap() {\n let options = {\n zoom: 5,\n center: userCoords,\n };\n let map = new google.maps.Map(document.getElementById(\"map\"), options);\n\n // Fonction de marqueur\n const addMarker = (props) => {\n let marker = new google.maps.Marker({\n position: props.coords,\n map: map, // quelle carte?: la carte ci-dessus\n });\n if (props.iconImage) marker.setIcon(props.iconImage);\n if (props.content) {\n let infoWindow = new google.maps.InfoWindow({\n content: props.content,\n });\n marker.addListener(\"click\", () => {\n infoWindow.open(map, marker);\n });\n }\n };\n\n addMarker({\n coords: userCoords,\n iconImage: \"http://maps.google.com/mapfiles/ms/icons/green-dot.png\",\n content: \"<h2>Vous êtes ici.</h2>\",\n });\n\n foodPlaces.forEach((foodPlace) => {\n let address = foodPlace.address.split(\",\");\n addMarker({\n coords: {\n lat: parseFloat(foodPlace.lat),\n lng: parseFloat(foodPlace.long),\n },\n content: `\n <h2>${foodPlace.restaurantName}</h2>\n <address>\n <p>${address[0]}</p>\n <p>${address[1].trim()}</p>\n </address>\n `,\n });\n });\n}", "function get_map(){\n var filter = get_filter_params();\n fetch_map_values(filter);\n\n //si une region (ville ou pays) est selectionnee on raffraichit aussi la liste correspondante\n if(selected_region.type){\n //on ajoute le parametre country_id\n var country_or_city_json = $.parseJSON('{\"'+selected_region.type+'\":\"'+selected_region.id+'\"}');\n //on join les trois tableaux de parametres\n $.extend(filter,country_or_city_json);\n new_search('get_experiences_map',filter);\n }\n}", "function setMapOnAll(map) {\r\n //hace ciclo sobre los marcadores que hemos guardado en la variable markers\r\n for (var i = 0; i < markers.length; i++) {\r\n markers[i].setMap(map);\r\n }\r\n}", "function showMap( latitud , longitud , nombre ,direccion ) {\n var mapOptions = {\n center: { lat: latitud, lng: longitud },\n zoom: 16\n };\n var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);\n var marker = new google.maps.Marker({\n position: {lat: latitud, lng: longitud},\n map: map\n });\n $('#nombre_negocio').text(nombre);\n $('#direccion_negocio').text(direccion);\n }", "function transformaAlunosEmArray(mapaAlunos) {\n let alunosArray = []\n mapaAlunos.forEach(([aID, a]) => {\n if (a[\"GPS\"] && a[\"ESCOLA_TEM_GPS\"]) {\n alunosArray.push({\n key: aID,\n tipo: \"aluno\",\n nome: a[\"NOME\"],\n lat: a[\"LOC_LATITUDE\"],\n lng: a[\"LOC_LONGITUDE\"],\n turno: a[\"TURNOSTR\"],\n nivel: a[\"NIVELSTR\"],\n temEscola: a[\"TEM_ESCOLA\"],\n school: String(a[\"ESCOLA_ID\"]),\n escolaID: String(a[\"ESCOLA_ID\"]),\n escolaNome: a[\"ESCOLA_NOME\"],\n escolaTemGPS: a[\"ESCOLA_TEM_GPS\"] ? \"Sim\" : \"Não\",\n passengers: 1\n })\n }\n })\n\n return alunosArray;\n}", "function navigacija(start) {\n let aptekaString = localStorage.getItem(\"odbranaApteka\"),\n apteka, aptekaCoords;\n if (aptekaString) {\n apteka = JSON.parse(aptekaString);\n aptekaCoords = [apteka.lon, apteka.lat];\n document.getElementById(\"map\").insertAdjacentHTML('beforebegin', `\n <div id=\"odbrana-apteka-info\">\n Избрана аптека: \n <div>${apteka.Ime}</div>\n <div>${apteka.Adresa}</div>\n <div>0${apteka.TelBroj}</div>\n <div>Рејтинг: ${apteka.Rating}</div>\n </div>\n `);\n document.getElementById('instructions').style.display = \"block\";\n document.getElementById('map').insertAdjacentHTML('beforebegin', `\n <div id=\"izb-nova-apt\"> Изберете нова аптека </div>\n `);\n document.getElementById('izb-nova-apt').onclick = () => {\n localStorage.removeItem('odbranaApteka');\n window.location.href = \"apteki4.html\";\n }\n document.getElementById('izb-nova-apt').onmouseover = function () {\n this.style.cursor = \"pointer\";\n }\n } else {\n document.querySelector(\"#map\").insertAdjacentHTML('afterend', `\n <div id=\"odb-apteka\"> Одберете аптека </div>`);\n document.getElementById('odb-apteka').onclick = () => window.location.href = \"/apteki4.html\";\n document.getElementById('odb-apteka').onmouseover = function () {\n this.style.cursor = \"pointer\";\n }\n }\n\n mapboxgl.accessToken = `${ACCESS_TOKEN}`;\n var map = new mapboxgl.Map({\n container: 'map',\n style: 'mapbox://styles/mapbox/streets-v10',\n center: start,\n zoom: 12\n });\n\n var bounds = [\n [start[0] - 2, start[1] - 2],\n [start[0] + 2, start[1] + 2]\n ];\n map.setMaxBounds(bounds);\n\n var canvas = map.getCanvasContainer();\n\n // Funkcija za iscrtuvanje na ruta od lokacijata na korisnikot do aptekata\n function getRoute(end) {\n var url = `https://api.mapbox.com/directions/v5/mapbox/${prevoz}/` + start[0] + ',' + start[1] + ';' + end[0] + ',' + end[1] + '?steps=true&geometries=geojson&access_token=' + mapboxgl.accessToken;\n var req = new XMLHttpRequest();\n req.open('GET', url, true);\n req.onload = function () {\n var json = JSON.parse(req.response);\n var data = json.routes[0];\n var route = data.geometry.coordinates;\n var geojson = {\n type: 'Feature',\n properties: {},\n geometry: {\n type: 'LineString',\n coordinates: route\n }\n };\n if (map.getSource('route')) {\n map.getSource('route').setData(geojson);\n } else {\n map.addLayer({\n id: 'route',\n type: 'line',\n source: {\n type: 'geojson',\n data: {\n type: 'Feature',\n properties: {},\n geometry: {\n type: 'LineString',\n coordinates: geojson\n }\n }\n },\n layout: {\n 'line-join': 'round',\n 'line-cap': 'round'\n },\n paint: {\n 'line-color': '#3887be',\n 'line-width': 5,\n 'line-opacity': 0.75\n }\n });\n }\n var instructions = document.getElementById('instructions');\n var steps = data.legs[0].steps;\n\n var tripInstructions = [];\n for (var i = 0; i < steps.length; i++) {\n tripInstructions.push('<br><li>' + steps[i].maneuver.instruction) + '</li>';\n instructions.innerHTML = '<br><span class=\"duration\">Trip duration: ' + Math.floor(data.duration / 60) + ' min 🚴 </span>' + tripInstructions;\n }\n\n };\n req.send();\n }\n\n map.on('load', function () {\n getRoute(start);\n map.addLayer({\n id: 'point',\n type: 'circle',\n source: {\n type: 'geojson',\n data: {\n type: 'FeatureCollection',\n features: [{\n type: 'Feature',\n properties: {},\n geometry: {\n type: 'Point',\n coordinates: start\n }\n }]\n }\n },\n paint: {\n 'circle-radius': 10,\n 'circle-color': 'green'\n }\n });\n // Za sekoja od aptekite stava tocka na mapata na soodvetnata lokacija\n fetch('/apteki')\n .then(response => response.json())\n .then(apteki => {\n apteki.forEach(apteka => {\n map.addLayer({\n id: `${apteka.id}`,\n type: 'circle',\n source: {\n type: 'geojson',\n data: {\n type: 'FeatureCollection',\n features: [{\n type: 'Feature',\n properties: {},\n geometry: {\n type: 'Point',\n coordinates: [apteka.lon, apteka.lat]\n }\n }]\n }\n },\n paint: {\n 'circle-radius': 8,\n 'circle-color': '#3887be'\n }\n });\n });\n });\n if (apteka) {\n getRoute(aptekaCoords);\n }\n });\n}", "function compartir(viaje) {\n//\tpruebo las cosas del mapa\n//\tconsole.log(\"https://maps.googleapis.com/maps/api/staticmap?\" +\n//\t\"maptype=ROADMAP\" +\n//\t\"&size=600x400\" +\n//\t\"&markers=color:green%7C\" +viaje.tripDetails.fromCity.latitude +\",\"+viaje.tripDetails.fromCity.longitude +\n//\t\"%7C\" + viaje.tripDetails.toCity.latitude +\",\"+viaje.tripDetails.toCity.longitude+\n//\t\"&path=color:red%7C\" +viaje.tripDetails.fromCity.latitude +\",\"+viaje.tripDetails.fromCity.longitude +\n//\t\"%7C\" +viaje.tripDetails.toCity.latitude +\",\"+viaje.tripDetails.toCity.longitude);\n//\tposteo en muro de facebook\n\tFB.api('/' + id + '/feed', 'post', {\n\t\tmessage: getViajeParaFB(viaje.tripDetails.fromCity.name, viaje.tripDetails.toCity.name, viaje.tripDetails.outboundDate, viaje.tripDetails.inboundDate),\n\t\tpicture: \"https://maps.googleapis.com/maps/api/staticmap?\" +\n\t\t\t\"maptype=ROADMAP\" +\n\t\t\t\"&size=600x400\" +\n\t\t\t\"&markers=color:green%7C\" +viaje.tripDetails.fromCity.latitude +\",\"+viaje.tripDetails.fromCity.longitude +\n\t\t\t\"%7C\" + viaje.tripDetails.toCity.latitude +\",\"+viaje.tripDetails.toCity.longitude+\n\t\t\t\"&path=color:red%7C\" +viaje.tripDetails.fromCity.latitude +\",\"+viaje.tripDetails.fromCity.longitude +\n\t\t\t\"%7C\" +viaje.tripDetails.toCity.latitude +\",\"+viaje.tripDetails.toCity.longitude,\n\t\tname: 'TACS POR EL MUNDO',\n\t\tdescription: 'viaje',\n\t\taccess_token: token\n\t}, function (data) {\n\t\tconsole.log(data);\n\t\tbootbox.alert(\"Excelente! Tu nuevo viaje ya esta publicado\", function () {\n\t\t});\n\t});\n\n}", "function load_map() {\r\n\t\tloader(\"Cargando mapa...\", false);\r\n\t\t// Declarar Opciones de Mapa\r\n\t\tvar myOptions = {\r\n\t zoom: 15,\r\n\t\t\tmapTypeControl: false,\r\n\t\t\tpanControl: false,\r\n\t\t\tzoomControlOptions: {style: google.maps.ZoomControlStyle.LARGE, position: google.maps.ControlPosition.LEFT_CENTER},\r\n\t\t\tstreetViewControl: false,\r\n\t mapTypeId: google.maps.MapTypeId.ROADMAP\r\n\t \t};\r\n\t\t// Mostrar Mapa en Pantalla\r\n\t\tmap = new google.maps.Map(document.getElementById('map-canvas'), myOptions);\r\n\t\t//icono camion posicion chofer\r\n\t\tmarkerGeo = new google.maps.Marker({map: map, icon: icons.chof, title: \"Tu posición\", animation: google.maps.Animation.DROP});\r\n\t\t//variables para trazar ruta\r\n\t\tdirectionsDisplay = new google.maps.DirectionsRenderer({\r\n\t\t\tpreserveViewport: true,\r\n\t\t\tmap: map,\r\n\t\t\tsuppressMarkers: true\r\n\t\t});//solicitando api trazado de ruta\r\n\r\n\t\t//PONEMOS EL BOTON EN EL MAPA!\r\n\t\tmap.controls[google.maps.ControlPosition.RIGHT_TOP].push(botonGps);\r\n\t\t/////HTML5 GEOCALIZAR AL USUARIO/////\r\n\t\tgoogle.maps.event.addListenerOnce(map, 'idle', function(){\r\n\t \t$.mobile.loading( \"hide\" );\r\n\t\t});\r\n\t\tgeocalizando();\r\n\t\t//google.maps.event.addListener(marker, 'click', geocalizando);//\r\n\t\t//marker.bindTo('position', map, 'center');//mantiene marker en el centro\r\n\t}///FIN LOAD_MAP/////////////////", "function iniciarmapa() {\n\t\n\t\n\t\n vector = new OpenLayers.Layer.Vector(\"Vector Layer\", {});\n tapetes = new OpenLayers.Layer.Vector(\"Tapetes Layer\", {});\n carrera.kmlayer = new OpenLayers.Layer.Vector(\"Layer\", {});\n ruta_layer = new OpenLayers.Layer.Vector(); \n\n\t//carrera.geosalida = new OpenLayers.Geometry.LineString([new OpenLayers.Geometry.Point(puntosalida[2],puntosalida[3]),new OpenLayers.Geometry.Point(puntosalida[4],puntosalida[5])]); //casa\n\t//carrera.geollegada =new OpenLayers.Geometry.LineString([new OpenLayers.Geometry.Point(puntollegada[0],puntollegada[1]),new OpenLayers.Geometry.Point(puntollegada[2],puntollegada[3])]); //casa\n \t\n\tstyle_tapete = {// estilo par la linea de ruta\n strokeColor: \"#FF0000\",\n strokeWidth: 3,\n pointRadius: 6\n \t };\n\n\t//tapetes.addFeatures(new OpenLayers.Feature.Vector(carrera.geosalida,null,style_tapete));\n\t//tapetes.addFeatures(new OpenLayers.Feature.Vector(carrera.geollegada,null,style_tapete));\n\t\n sprintersLayer = new OpenLayers.Layer.Vector(\"Sprinters\", {\n styleMap: new OpenLayers.StyleMap({\n graphicOpacity: 1.0,\n graphicWidth: 16,\n graphicHeight: 26,\n graphicYOffset: -26\n })\n });\n\n \n\t \n var geolocate = new OpenLayers.Control.Geolocate({\n id: 'locate-control',\n geolocationOptions: {\n \tmaximumAge:0, \n \ttimeout:60000, \n \tenableHighAccuracy: true//true\n }\n });\n geolocate.watch = true;\n\n // create map\n map = new OpenLayers.Map({\n div: \"map\",\n theme: null,\n projection: sm,\n numZoomLevels: 18,\n controls: [\n new OpenLayers.Control.Attribution(),\n new OpenLayers.Control.TouchNavigation({\n dragPanOptions: {\n enableKinetic: true\n }\n }),\n \n\t\t geolocate\n \n ],\n layers: [\n new OpenLayers.Layer.OSM(),\n ruta_layer,\n sprintersLayer,\n carrera.kmlayer,\n tapetes,\n vector\n \n \n ],\n center: new OpenLayers.LonLat(0, 0),\n zoom: 1\n });\n\n\t\n\n\n\n var style = {\n fillOpacity: 0.1,\n fillColor: '#000',\n strokeColor: '#f00',\n strokeOpacity: 0.6\n };\n\t \n\n carrera.getruta();\n //map.addLayer(sprintersLayer);\n geolocate.events.register(\"locationupdated\",geolocate,function(e) {\n \t\n \tconsole.log(carrera.precision+\"hola\");\n \t$(\"#precision_text\").text((e.position.coords.accuracy).toFixed(0)+\" Mt\");\n \tif(e.position.coords.accuracy<=10){\n \t\t//$(\"#popupGpsInfo\").popup('close');\n \t\t$(\".precision\").css('background-color', 'rgb(82,134,183)');\n \t}else \n \tif(e.position.coords.accuracy<=20){\n \t\t$(\".precision\").css('background-color', 'yellow');\n \t}else \n if(e.position.coords.accuracy<=50){\n \t\t$(\".precision\").css('background-color', 'orange');\n \t}\n \telse{\n \t\t$(\".precision\").css('background-color', 'red');\n \t}\n \t\t\n\t\n \t\t//Si a presicion en es menor a 12 \n\t \t\tif(e.position.coords.accuracy<=carrera.precision)\n\t \t\t{ \t\n\t \t\t\tif(e.position.coords.accuracy>20){\n\t \t\t\tcarrera.precision=e.position.coords.accuracy;\n\t \t\t\t}\n\t \t\t\txpx=e.point.x;\n\t\t\t\typx=e.point.y;\n\t\t\t\tif ( $(\"#locate_stop\").is(\":visible\") ) {\n \n\t\t//alert(carrera.tipo);\n\t\t\t\t\tif(\tcarrera.tipo==\"competencia\"){\n\t\t\t\t\t\tcarrera.geosalida=tapetes.features[0].geometry;\n\t\t\t\t\t\tcarrera.geollegada=tapetes.features[1].geometry;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif(\tcarrera.tipo==\"competencia\"){\n\t\t\t\t\t\truta(xpx,ypx);\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tentrenamiento(xpx,ypx);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t/*intervalo=self.setInterval(function(){\n\t\t\t\t\t\tif(\tcarrera.tipo==\"competencia\"){\n\t\t\t\t\t\t\truta(puntos_simulacion[i].x,puntos_simulacion[i].y);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tentrenamiento(puntos_simulacion[i].x,puntos_simulacion[i].y);\n\t\t\t\t\t\t}\n\t\t\t\t\t\ti++;\n\t\t\t\t\t\tif(i>1000){\n\t\t\t\t\t\t\tintervalo=window.clearInterval(intervalo);\n\t\t\t\t\t\t\tstop_carrera();\n\t\t\t\t\t\t}},\n\t\t\t\t\t\t100\n\t\t\t\t\t);*/\n\t\t\t\t} \n\t \t\t}\t\t\n\t});\n\t\n\t\n\t/*map.events.register('zoomend', this, function (event) {\n var x = map.getZoom();\n \n if( x > 16)\n {\n map.zoomTo(17);\n }\n });*/\n\t\t\t\n\t\t\t\n\t\n\tgeolocate.events.register(\"locationfailed\",this,function() {\n\t \t$.mobile.loading('hide');\t // getter2\n\t \tstop_carrera();\n\t $.mobile.changePage(\"#gpsfailed\", \"pop\"); \n\t \n\n\t});\n // set interval PARA ENVIAR LOS DATOS CADA 10 SEG\n\t\n\n}", "function initMap() {\n}", "function ObtenerMapa(id){\n $('#mapa_apiario').attr('src','http://localhost:8000/map/'+id+'');\n}", "function embeddedInMaps() { }", "function mapearCartas(nPares) {\r\n mapa = [];\r\n // adiciona pares de cartas em ordem no vetor\r\n for (i=1; i<=nPares; i++){\r\n for (j=0; j<2; j++){\r\n mapa.push(i)\r\n }\r\n }\r\n embaralhar(mapa)\r\n}", "function setMapOnAll(map) {\n for (let i = 0; i < markers.length; i++) {\n markers[i].setMap(map);\n }\n for (let i = 0; i < choiceMarkers.length; i++) {\n choiceMarkers[i].setMap(map);\n } \n for (let i = 0; i < searchResMarkers.length; i++) {\n searchResMarkers[i].setMap(map);\n } \n}//setMapOnAll", "function cargarCapas() {\r\n var stylePuntosParadas = new OpenLayers.StyleMap( {\r\n fillOpacity : 0.7,\r\n pointRadius : 9,\r\n idBD : \"${idBD}\",\r\n idOrd : \"${idOrd}\",\r\n label : \"${idOrd}\",\r\n lat : \"${lat}\",\r\n lon : \"${lon}\",\r\n dir : \" ${dir}\",\r\n ref : \"${ref}\",\r\n img : \"${img}\",\r\n fontColor : \"white\",\r\n fillColor : \"#1C5E06\", //verde\r\n strokeColor : \"#FFFFFF\",\r\n strokeOpacity : 0.7,\r\n fontSize : \"12px\",\r\n fontFamily : \"Courier New, monospace\",\r\n fontWeight : \"bold\"\r\n });\r\n\r\n var stylePuntosEstudiante = new OpenLayers.StyleMap( {\r\n fillOpacity : 0.7,\r\n pointRadius : 6,\r\n ci : \"${ci}\",\r\n lat : \"${lat}\",\r\n lon : \"${lon}\",\r\n dir : \"${dir}\",\r\n fontColor : \"white\",\r\n fillColor : \"#DF3A01\", //naranja\r\n strokeColor : \"#FFFFFF\",\r\n strokeOpacity : 0.7,\r\n fontSize : \"12px\",\r\n fontFamily : \"Courier New, monospace\",\r\n fontWeight : \"bold\"\r\n });\r\n\r\n var stylePuntosRutas = new OpenLayers.StyleMap( {\r\n fillOpacity : 0.7,\r\n pointRadius : 9,\r\n label : \"${id}\",\r\n fontColor : \"white\",\r\n fillColor : \"#003DF5\", //black\r\n strokeColor : \"#FFFFFF\",\r\n strokeOpacity : 0.7,\r\n fontSize : \"12px\",\r\n fontFamily : \"Courier New, monospace\",\r\n fontWeight : \"bold\"\r\n });\r\n\r\n lienzoParadas = new OpenLayers.Layer.Vector('Points', {\r\n styleMap: stylePuntosParadas\r\n });\r\n\r\n map.addLayer(lienzoParadas);\r\n\r\n lienzoRutas = new OpenLayers.Layer.Vector('Puntos Rutas', {\r\n styleMap: stylePuntosRutas\r\n });\r\n\r\n map.addLayer(lienzoRutas);\r\n \r\n lienzoEstudiantes = new OpenLayers.Layer.Vector('Puntos Estudiantes', {\r\n styleMap: stylePuntosEstudiante\r\n });\r\n\r\n map.addLayer(lienzoEstudiantes);\r\n\r\n //Comportamiento de los Elementos de la Capa\r\n selectFeatures = new OpenLayers.Control.SelectFeature(\r\n [ lienzoParadas ],\r\n {\r\n clickout : true,\r\n toggle : false,\r\n multiple : false,\r\n hover : false,\r\n onSelect : function(feature){\r\n selectParada( feature );\r\n },\r\n onUnselect : function(feature){\r\n unselectParada( feature );\r\n }\r\n }\r\n );\r\n\r\n map.addControl( selectFeatures );\r\n selectFeatures.activate();\r\n \r\n selectFeaturesEstudiante = new OpenLayers.Control.SelectFeature(\r\n [ lienzoEstudiantes ],\r\n {\r\n clickout : true,\r\n toggle : false,\r\n multiple : false,\r\n hover : false,\r\n onSelect : function(feature){\r\n infoEstudiantePopUp(feature);\r\n },\r\n onUnselect : function(feature){\r\n map.removePopup( feature.popup );\r\n feature.popup.destroy();\r\n feature.attributes.poppedup = false;\r\n feature.popup = null;\r\n }\r\n }\r\n );\r\n\r\n map.addControl( selectFeaturesEstudiante );\r\n \r\n /**\r\n * Inicializa el mapa para que permita graficar los recorridos de los buses\r\n */\r\n capaRecorridos();\r\n permitirArrastrarPuntosRutas();\r\n}", "function initMap() {\n // The location of NAirobi\n const nairobi = { lat: -1.286389, lng: 36.817223 };\n // The map, centered at NAirobi\n const map = new google.maps.Map(document.getElementById(\"map\"), {\n zoom: 4,\n center: nairobi,\n });\n // The marker, positioned at NAirobi\n const marker = new google.maps.Marker({\n position: nairobi,\n map: map,\n });\n }", "function fazPonto(ponto) {\n\tmarca = new google.maps.Marker({ position : ponto, map : map });\n\tcordenadasAtual = ponto;\n\tsetDocumentoInfo(ponto);\n\tmap.panTo(ponto);\n}", "buildMap(){\n\t\tlet that \t= this;\n\t\tlet map \t= that.req.body.data.map;\n\t\tlet mountain= that.req.body.data.mountain;\n\t\tlet treasure= that.req.body.data.treasure;\n\t\tlet player\t= that.req.body.data.player;\n\t\tlet finalMap= [];\n\t\tlet error = {};\n\t\tlet cpt_erreur = 0;\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tPromise.all([that.buildMountainsParams(mountain), that.buildTreasureParams(treasure), that.buildPlayerParams(player)]).then((res) => {\n\t\t\t\tif(!res[0].err && !res[1].err && !res[2].err)\n\t\t\t\t{\n\t\t\t\t\tlet mountainParams = res[0].mountainParams;\n\t\t\t\t\tlet treasureParams = res[1].treasureParams;\n\t\t\t\t\tlet playerParams = res[2].playerParams;\n\t\t\t\t\tObject.keys(map).forEach((e) => {\n\t\t\t\t\t\tlet mapParams \t= map[e].data.split('-');\n\t\t\t\t\t\tfor(let i = 0; i < mapParams[2]; i++){\n\t\t\t\t\t\t\tfinalMap[i] = [];\n\t\t\t\t\t\t\tfor(let j = 0; j < mapParams[1]; j++){\n\t\t\t\t\t\t\t\tfinalMap[i][j] = 0;\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\tObject.keys(mountainParams).forEach((e) =>{\n\t\t\t\t\t\tif(finalMap[mountainParams[e].y][mountainParams[e].x] == 0){\n\t\t\t\t\t\t\tfinalMap[mountainParams[e].y][mountainParams[e].x] = 'M';\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\terror[cpt_erreur] = {};\n\t\t\t\t\t\t\terror[cpt_erreur].mountain = `Erreur ${finalMap[mountainParams[e].y][mountainParams[e].x]} | Mapping: ${mountainParams[e].y} - ${mountainParams[e].x}`;\n\t\t\t\t\t\t\tcpt_erreur++;\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\tObject.keys(treasureParams).forEach((e) => {\n\t\t\t\t\t\tif(finalMap[treasureParams[e].y][treasureParams[e].x] == 0){\n\t\t\t\t\t\t\tfinalMap[treasureParams[e].y][treasureParams[e].x] = `${treasureParams[e].nb}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\terror[cpt_erreur] = {};\n\t\t\t\t\t\t\terror[cpt_erreur].treasure = `Erreur ${finalMap[treasureParams[e].y][treasureParams[e].x]} | Mapping: ${treasureParams[e].y} - ${treasureParams[e].x}`;\n\t\t\t\t\t\t\tcpt_erreur++;\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\tObject.keys(playerParams).forEach((e)=> {\n\t\t\t\t\t\tif(finalMap[playerParams[e].y][playerParams[e].x] == 0){\n\t\t\t\t\t\t\tfinalMap[playerParams[e].y][playerParams[e].x] = 'A';\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\terror[cpt_erreur] = {};\n\t\t\t\t\t\t\terror[cpt_erreur].player = `Erreur ${finalMap[playerParams[e].y][playerParams[e].x]} | Mapping: ${playerParams[e].y} - ${playerParams[e].x}`;\n\t\t\t\t\t\t\tcpt_erreur++;\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\tif(finalMap.length > 0){\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tstatus: 'success',\n\t\t\t\t\t\t\tfinalMap: finalMap,\n\t\t\t\t\t\t\tplayer: playerParams,\n\t\t\t\t\t\t\tmountain: mountainParams,\n\t\t\t\t\t\t\ttreasureParams: treasureParams,\n\t\t\t\t\t\t\terreur_mapping: error\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\treject({\n\t\t\t\t\t\t\tstatus: 'error',\n\t\t\t\t\t\t\tmsg_er: 'Error to build map'\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\treject({\n\t\t\t\t\t\tstatus: 'error',\n\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\t\n\t\t\t})\n\t\t\t\n\t\t})\n\t}", "function initMap() {\n map = new google.maps.Map(document.getElementById('map'), {\n center: {lat: -34.6131516, lng:-58.3772316}, /* Coordenadas de la ciudad de Buenos Aires */\n zoom: 12\n });\n }", "function init_Mapa1() {\n //Crear mapa en el elemento DOM\n var bingApiKey = \"AoqHQ_lF0XVJw-wQgHZa-nD_s49vCYuKDLzXriH-cgFPpI0l8bVw_C__Af5BNLnM\";\n\n var mapa = new ol.Map({\n view: new ol.View({\n zoom: 4,\n center: [-223293, 5247800],\n }),\n target: 'Mapa1',\n layers: [new ol.layer.Tile({\n source: new ol.source.BingMaps({\n key: bingApiKey,\n imagerySet: 'CanvasGray'\n }),\n title: 'CanvasGray'\n }),\n new ol.layer.Tile({\n source: new ol.source.TileWMS({\n url: 'http://demo.mapserver.org/cgi-bin/wms',\n params: {\n 'LAYERS': 'bluemarble'\n },\n }),\n opacity: 0.5\n })\n ]\n });\n}", "function compararmapa(elemento,escala){\n if ((elemento.x-1)%20==0 && (elemento.y-1)%20==0){\n elemento.xworld=Math.trunc(elemento.x/escala.x);\n elemento.yworld=Math.trunc(elemento.y/escala.y);\n }\n}", "function mapa(position) {\n\n var container= document.getElementById('map');\n var latitud= position.coords.latitude;\n var longitud= position.coords.longitude;\n var mapita = new google.maps.LatLng(latitud,longitud);\n var centerZoom={center: mapita,zoom: 16,mapTypeControl:false,};\n var map = new google.maps.Map(container,centerZoom);\n\n var currentMarker = new google.maps.Marker({\n position: new google.maps.LatLng(latitud,longitud),\n map: map,\n title:\"¡ Aqui estoy !\",\n icon: \"img/persona.png\"\n });\n var marker1 = new google.maps.Marker({\n position: new google.maps.LatLng(latitud+0.001, longitud),\n map: map,\n title:\"auto1\",\n icon: \"img/car.png\"\n });\n var marker2 = new google.maps.Marker({\n position: new google.maps.LatLng(latitud+0.004, longitud),\n map: map,\n title:\"auto2\",\n icon: \"img/car.png\"\n });\n var marker3 = new google.maps.Marker({\n position: new google.maps.LatLng(latitud, longitud+0.004),\n map: map,\n title:\"auto3\",\n icon: \"img/car.png\"\n });\n\n /********************AUTOOMPLETE DE LOS LUGARES POR LA API DE PLACES**********************/\n var input = document.getElementById('pac-input');\n var autocomplete = new google.maps.places.Autocomplete(input);\n autocomplete.bindTo('bounds', map);\n map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);\n var infowindow = new google.maps.InfoWindow();\n var marker = new google.maps.Marker({map: map});\n marker.addListener('click', function() {infowindow.open(map, marker);});\n\n autocomplete.addListener('place_changed', function() \n {\n infowindow.close();\n var place = autocomplete.getPlace();\n if (!place.geometry) {return;}\n if (place.geometry.viewport) {\n map.fitBounds(place.geometry.viewport);\n } else {\n map.setCenter(place.geometry.location);\n map.setZoom(16);\n }\n marker.setPlace({placeId: place.place_id, location: place.geometry.location});\n marker.setVisible(true);\n infowindow.setContent('<div><strong>' + place.name + '</strong><br>' + '<br>' +\n place.formatted_address);\n infowindow.open(map, marker);\n storageDirection(place.formatted_address);\n });\n \n}", "function initialize() {\n var mapProp = {\n center: new google.maps.LatLng(51.508742, -0.120850),\n zoom: 5,\n mapTypeId: google.maps.MapTypeId.ROADMAP\n };\n mapaNuevoViaje = new google.maps.Map(document.getElementById(\"googleMapViaje\"), mapProp);\n mapaVuelo = new google.maps.Map(document.getElementById(\"googleMapVuelo\"), mapProp);\n mapaReview = new google.maps.Map(document.getElementById(\"googleMapViajeReview\"), mapProp);\n mapaReviewRecom = new google.maps.Map(document.getElementById(\"googleMapViajeReviewRecom\"), mapProp);\n var markerBounds = new google.maps.LatLngBounds();\n}", "constructor()\r\n\t{\r\n\t\tvar mapJ1 = [\r\n [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],\r\n\t\t[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],\r\n\t\t[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],\r\n\t\t[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],\r\n\t\t[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\r\n\t\t[0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,9,0],\r\n\t\t[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\r\n\t\t[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],\r\n\t\t[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],\r\n\t\t[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],\r\n [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]];\r\n\t\t\r\n\t\tvar mapJ2 = [\r\n [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],\r\n\t\t[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],\r\n\t\t[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],\r\n\t\t[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],\r\n\t\t[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\r\n\t\t[0,0,0,6,0,0,0,0,0,0,0,0,0,0,9,0,0,0],\r\n\t\t[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\r\n\t\t[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],\r\n\t\t[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],\r\n\t\t[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],\r\n [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]];\r\n\r\n var lvlList = [mapJ1, mapJ2]\r\n\t\tvar listLength = lvlList.length;\r\n\t\tvar lvlListIndex = -1;\r\n\t\tthis.GetLvl = function ()\r\n\t\t{\r\n\t\t\tif(lvlListIndex <= listLength)\r\n\t\t\t{\r\n\t\t\t\tlvlListIndex++;\r\n\t\t\t\treturn lvlList[lvlListIndex];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t};\r\n\t}", "function translate_map() {\n\n var width = $(elem[0]).width(),\n height = $(elem[0]).height();\n\n if (! scope.keylistener.keyActive(17)) {\n var t = d3.event.translate,\n s = d3.event.scale;\n t[0] = Math.min(width / 2 * (s - 1), Math.max(width / 2 * (1 - s), t[0]));\n t[1] = Math.min(height / 2 * (s - 1) + 230 * s, Math.max(height / 2 * (1 - s) - 230 * s, t[1]));\n dr.zoom.translate(t);\n\n scope.panel.display.translate = t;\n scope.panel.display.scale = s;\n dr.g.style(\"stroke-width\", 1 / s).attr(\"transform\", \"translate(\" + t + \") scale(\" + s + \")\");\n }\n }", "function showMamufasMap() {\n\t\t\t\t$('#mamufas_map').css('background','url(/images/editor/mamufas_bkg.png) repeat 0 0');\n\t\t\t\t$('#mamufas_map').fadeIn();\n\t\t\t\t$('#loader_map').fadeIn();\n\t\t\t}", "function initMap() {\n let uluru;\n uluru = { lat: Number(-24.90387784417046), lng: Number(133.9211859007968) };\n var map = new google.maps.Map(document.getElementById(\"map\"), {\n center: {lat: parseFloat(-24.90387784417046), lng: parseFloat(133.9211859007968) },\n zoom: 4,\n });\n var i = 0;\n while(Object.values(cord).length>=i){ \n if( cord[i] != undefined)\n uluru = { lat: Number(cord[i]['latitude']), lng: Number(cord[i]['longitude']) };\n addMarker(uluru);\n i++; \n } //loop\n //add marker function\n function addMarker(coords){\n var marker = new google.maps.Marker({\n position:coords,\n map:map,\n });\n };\n\n } //map", "function GetMap() {\n return map;\n }", "function initMap() {\n\tvar mapProp = {\n\t\t\tcenter : new google.maps.LatLng(-34.9038055, -57.9392111, 18),\n\t\t\tzoom : 10,\n\t\t\tmapTypeId : google.maps.MapTypeId.ROADMAP\n\t\t};\n\tif (document.getElementById(\"map\") != null){\n\t\tmap = new google.maps.Map(document.getElementById(\"map\"), mapProp);\n\n\t\tmap.addListener('click', function(e) {\n\t\t\tagregarMarker(e.latLng, map);\n\n\t\t});\n\t\tpuntos = [];\n\t\tinitPolyline();\n\t\tobtenerMarkers();\n\t\t\n\t}\n\t\n\t//loadKmlLayer(src, map);\n\t\n}", "function haeJoukkueId() {\n\n let tunnisteet = new Map();\n\n for (let kilpailu of data) {\n for (let sarja of kilpailu['sarjat']) {\n for (let joukkue of sarja['joukkueet']) {\n tunnisteet.set(joukkue['id'], joukkue);\n }\n }\n }\n\n return tunnisteet;\n}", "function laberinto(ancho, largo){\n //dibujo las paredes exteriores que limitaran el campo\n for(var i = 0;i < ancho;i++){pared(-3,0,i *3 - 3); pared(largo *3 - 3,0,i*3 - 3);} \n for(var j = 0;j < largo;j++){pared(j *3-3,0,0 - 3); pared(j*3 - 3,0,ancho *3 - 3);} \n\n/* suelo(0*3,p,0*3);\n suelo(lado *3 -6,p,lado*3 -6);\n suelo(0,p,lado*3 -6);\n suelo(lado*3,p,0);\n\n var i = 1;\n console.log(\"va\");\n suelo(i*3,p,i*3);i=2;\n suelo(i*3,p,i*3);\n suelo(3*3,p,4*3);\n*/\n dibujarMapa();\n function dibujarMapa(){\n //creo el array multidimensional del mapa\n var tablaJuego = new Array(ancho-2);\n\n for(var i= 0; i < ancho -2; i++){//multiplicar por 3 para el metodo viejo\n tablaJuego[i] = new Array(largo-2);\n }\n /*relleno el array con ceros para despues aplicar \n el algoritmo del laberinto*/\n for (var i = 0; i < ancho -2; i++) {\n for(var j = 0; j < largo -2; j++){\n tablaJuego[i][j] = 0; \n }\n }\n /*for(var i = 0; i < ancho; i++){\n for(var j = 0; j < largo; j++){\n techo(i*3 - 1,6,j*3 - 1);\n }\n }*/\n var lin;\n/*\n fetch('laberinto.txt')\n .then(res => res.text())\n .then(content => {\n var lines = content.split(/\\n/);\n lines.forEach(line => console.log(Array.from(lines)));\n //lines.forEach(line => lin = Array.from(lines));\n //lines.forEach(line => console.log(line));\n });*/\n\n //console.log(lines);\n //console.log(\" + \" + lin[1]);\n\n\n\n\n var caminoEncontrado = false;\n construccion(0,0,lado,lado,\"up\");//inicio la funcio :)\n //rellenar();\n /*metodo recursivo que buscara y creara el laberinto\n @param: posX,posY se encargan de la posicion actual del metodo\n y @param ancho, alto: se encargan de la posicion final del metodo recursivo*/\n function construccion(posX, posY, ancho, largo, direc){\n //console.log(\"hola principio\");\n var desplazamiento = parseInt(Math.random()*3);//elijo un desplazamiento entre 1 y 5 bloques\n //console.log(desplazamiento + \" esta aqui\" + posX + \" \" + posY);\n if(posX== lado-2 && posY== lado-2){return;}\n //caso en que se disputara a boleo a donde ira\n else{ \n var direccion = parseInt(Math.random()*2);//saco la variable a boleo\n //console.log(\"direccion \" + direccion);\n var px = (posX+1 < lado -2);//X positiva\n var nx = (posX-1 >= 0);//X negativa\n var py = (posY+1 < lado -2);//Y positiva \n var ny = (posY-1 >= 0);\n var px1 = (posX+2 < lado -2);//X positiva\n var nx1 = (posX-2 >= 0);//X negativa\n var py1 = (posY+2 < lado -2);//Y positiva \n var ny1 = (posY-2 >= 0);\n\n console.log( direccion);\n //direccion\n \n do{\n if(posX== lado-2 && posY== lado-2){suelo(posX *3,p,posY *3);return;}\n\n else if(direc == \"up\"){\n if(direccion == 0 && px&& px1 && tablaJuego[posX + 1][posY] != 3 && tablaJuego[posX +2][posY] !=3){\n\n console.log(\"entra PX\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n tablaJuego[posX+1][posY] = 3;\n suelo(posX *3,p,posY *3);\n suelo((posX +1) *3 ,p,posY *3 );\n construccion(posX + 2, posY, ancho, largo,\"up\");\n }else if(direccion == 1 && py&&py1 && tablaJuego[posX][posY +1] != 3 && tablaJuego[posX][posY +2] !=3){\n\n console.log(\"entra PY\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n tablaJuego[posX][posY+1] = 3;\n suelo(posX *3,p,posY *3);\n suelo(posX *3 ,p,(posY +1) *3 );\n construccion(posX, posY +2, ancho, largo,\"rigth\");\n }else if(direccion == 2 && ny &&ny1&& tablaJuego[posX][posY -1] != 3 && tablaJuego[posX][posY -2] !=3){\n\n console.log(\"entra NY\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n tablaJuego[posX][posY-1] = 3;\n suelo(posX*3,p,posY*3);\n suelo(posX *3 ,p,(posY -1) *3 );\n construccion(posX, (posY -2), ancho, largo,\"left\");\n } else {\n console.log('SOS');\n }\n //prueba ir en uno\n /*\n else if(direccion == 0 && px&& tablaJuego[posX + 1][posY] != 3){\n\n console.log(\"entra PX\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n suelo(posX *3,p,posY *3);\n construccion(posX + 1, posY, ancho, largo,\"up\");\n }else if(direccion == 1 && py&&py1 && tablaJuego[posX][posY +1] != 3 ){\n\n console.log(\"entra PY\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n suelo(posX *3,p,posY *3);\n construccion(posX, posY +1, ancho, largo,\"rigth\");\n }else if(direccion == 2 && ny &&ny1&& tablaJuego[posX][posY -1] != 3){\n\n console.log(\"entra NY\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n suelo(posX*3,p,posY*3);\n construccion(posX, (posY -1), ancho, largo,\"left\");\n }else caminoEncontrado = true;console.log(\"sale en\" + direccion);return;\n */\n }else if(direc == \"down\"){\n if(direccion == 0 && nx&&nx1 && tablaJuego[posX - 1][posY] != 3 && tablaJuego[posX -2][posY] !=3){\n\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n tablaJuego[posX-1][posY] = 3;\n suelo(posX *3,p,posY *3);\n suelo((posX -1) *3 ,p,posY *3 );\n construccion((posX- 2), posY, ancho, largo,\"down\");\n }else if(direccion == 1 && py &&py1&& tablaJuego[posX][posY +1] != 3 && tablaJuego[posX][posY+2] !=3){\n\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n tablaJuego[posX][posY+1] = 3;\n suelo(posX *3,p,posY *3);\n suelo(posX *3 ,p,(posY +1) *3 );\n construccion(posX, posY +2, ancho, largo, \"rigth\");\n }else if(direccion ==2 && ny&&ny1 && tablaJuego[posX][posY -1] != 3 && tablaJuego[posX][posY -2] !=3){\n\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n tablaJuego[posX][posY-1] = 3;\n suelo(posX *3,p,posY *3);\n suelo(posX *3 ,p,(posY-1) *3 );\n construccion(posX, (posY-2), ancho, largo,\"left\");\n } else {\n console.log('SOS');\n }/*\n //prueba ir en uno\n else if(direccion == 0 && nx&&nx1 && tablaJuego[posX - 1][posY] != 3){\n\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n suelo(posX *3,p,posY *3);\n construccion((posX- 1), posY, ancho, largo,\"down\");\n }else if(direccion == 1 && py &&py1&& tablaJuego[posX][posY +1] != 3){\n\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n suelo(posX *3,p,posY *3);\n construccion(posX, posY +1, ancho, largo, \"rigth\");\n }else if(direccion ==2 && ny&&ny1 && tablaJuego[posX][posY -1] != 3){\n\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n suelo(posX *3,p,posY *3);\n construccion(posX, (posY-1), ancho, largo,\"left\");\n }else caminoEncontrado = true;return; */\n }else if(direc == \"left\"){\n if(direccion == 0 && px &&px1&& tablaJuego[posX + 1][posY] != 3 && tablaJuego[posX+2][posY] !=3){\n\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n tablaJuego[posX+1][posY] = 3;\n suelo((posX +1) *3,p,posY*3);\n suelo(posX *3 ,p,posY *3 );\n construccion(posX + 2, posY, ancho, largo,\"up\");\n }else if(direccion == 1 && ny &&ny1&& tablaJuego[posX][posY-1] != 3 && tablaJuego[posX][posY-2] !=3){\n\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n tablaJuego[posX][posY-1] = 3;\n suelo(posX *3,p,posY *3);\n suelo(posX *3 ,p,(posY-1) *3 );\n construccion((posX), posY -2, ancho, largo,\"left\");\n }else if(direccion ==2 && nx &&nx1&& tablaJuego[posX-1][posY] != 3 && tablaJuego[posX-2][posY] !=3){\n\n /// console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n tablaJuego[posX-1][posY] = 3;\n suelo(posX *3,p,posY *3);\n suelo((posX -1)*3 ,p,posY*3 );\n construccion(posX-2, (posY), ancho, largo,\"down\");\n } else {\n console.log('SOS');\n }/* \n //intenta ir de uno en uno\n else if(direccion == 0 && px &&px1&& tablaJuego[posX + 1][posY] != 3){\n\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n suelo((posX +1) *3,p,posY*3);\n construccion(posX + 1, posY, ancho, largo,\"up\");\n }else if(direccion == 1 && nx &&nx1&& tablaJuego[posX -1][posY] != 3){\n\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n suelo(posX *3,p,posY *3);\n construccion((posX), posY -1, ancho, largo,\"left\");\n }else if(direccion ==2 && py &&py1&& tablaJuego[posX][posY +1] != 3){\n\n /// console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n suelo(posX *3,p,posY *3);\n construccion(posX, (posY -1), ancho, largo,\"rigth\");\n }else caminoEncontrado = true;return;*/\n\n }else if(direc == \"rigth\"){\n if(direccion == 0 && px &&px1&& tablaJuego[posX + 1][posY] != 3 && tablaJuego[posX +2][posY] !=3){\n\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n tablaJuego[posX+1][posY] = 3;\n suelo(posX *3,p,posY *3 );\n suelo((posX +1) *3 ,p,posY *3 );\n construccion(posX + 2, posY, ancho, largo,\"up\");\n }else if(direccion == 1 && nx &&nx1&& tablaJuego[posX-1][posY] != 3 && tablaJuego[posX-2][posY] !=3){\n\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n tablaJuego[posX-1][posY] = 3;\n suelo(posX *3 ,p,posY *3 );\n suelo((posX-1) *3 ,p,posY *3 );\n construccion(posX-2, posY, ancho, largo,\"down\");\n }else if(direccion ==2 && py &&py1&& tablaJuego[posX][posY +1] != 3 && tablaJuego[posX][posY +2] !=3){\n\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n tablaJuego[posX][posY+1] = 3;\n suelo(posX *3 ,p,posY *3 );\n suelo(posX *3 ,p,(posY +1)*3 );\n construccion(posX, posY +2, ancho, largo,\"rigth\");\n } else {\n console.log('SOS');\n }\n //pruebo ir uno en uno\n /* \n else if(direccion == 0 && px &&px1&& tablaJuego[posX + 1][posY] != 3 ){\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n suelo(posX *3,p,posY *3 );\n construccion(posX + 1, posY, ancho, largo,\"up\");\n }else if(direccion == 1 && nx &&nx1&& tablaJuego[posX][posY -1] != 3){\n\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n suelo(posX *3 ,p,posY *3 );\n suelo(posX *3 ,p,(posY-1) *3 );\n construccion(posX, (posY-1), ancho, largo,\"left\");\n }else if(direccion ==2 && py && tablaJuego[posX][posY +1] != 3 ){\n\n //console.log(\"hola\" + direccion);\n //caminoEncontrado = true;\n tablaJuego[posX][posY] = 3;\n suelo(posX *3 ,p,posY *3 );\n construccion(posX, posY +1, ancho, largo,\"rigth\");\n }else console.log(\"llego aqui\"); caminoEncontrado = true;return;*/\n }\n }while(caminoEncontrado == true)\n }\n }\n //rellenar();\n function rellenar (){\n console.log(\"pintando\");\n for(var i = 0; i < ancho-2; i++){\n for(var j = 0; j < largo-2; j++){\n var r = Math.random();\n console.log(tablaJuego[i][j]);\n if(tablaJuego[j][i] != 3 && r < 0.48)pared(i*3,p,j*3);\n else if(tablaJuego[j][i]==3)suelo(i*3,p,j*3);\n }\n }\n }\n }\n }", "function markMap() {\n for (let key in Memory.warControl) {\n if (Memory.warControl[key]) {\n new RoomVisual(key).text(\n Memory.warControl[key].type,\n 25,\n 25,\n {align: 'left', opacity: 0.8}\n );\n }\n if (Memory.warControl[key].siegePoint) {\n new RoomVisual(Memory.warControl[key].siegePoint).text(\n 'Siegepoint',\n 25,\n 25,\n {align: 'left', opacity: 0.8}\n );\n }\n }\n}", "function createMap() {\r\n var map = new BMap.Map(\"dituContent\"); //Create a map in Baidu map container\r\n var point = new BMap.Point(113.888261794090271, 22.81255829315185545); //The definition of a center point coordinates (changes here)\r\n map.centerAndZoom(point,18); //Center point and coordinate map set and the map is displayed on the map in the container\r\n window.map = map; //The map variable is stored in the global\r\n }", "function generateMap(customLat, customLng, customZoon, mapContainer) {\n var map = new L.Map( mapContainer || 'map' ).setView( new L.LatLng( customLat || lat, customLng || lng ), customZoon || zoom, { animation: true } );\n //Remove options from the map\n var disableControlsFromMap = disableControls( map );\n //Set PNOA layer\n var base = L.tileLayer.wms( '//www.ign.es/wms-inspire/pnoa-ma', {\n attribution: '<a href=\"http://www.ign.es\" target=\"_blank\">© Instituto Geográfico Nacional</a>',\n layers: 'OI.OrthoimageCoverage',\n format: 'image/jpeg',\n transparent: false,\n version: '1.3.0',\n crs: L.CRS.EPSG4326,\n maxZoom: maxZoom\n }).addTo( map );\n //Return the map value\n return map;\n }", "function drawMaps(){\n\t$('.sucursal.card').each(function(index){\n\t\tvar latitud = $(this).find('input[name=\"latitud\"]').val();\n\t\tvar longitud = $(this).find('input[name=\"longitud\"]').val();\n\t\tvar divMap = '#sucursal-map' + (index+1);\n\t\tconsole.log(divMap);\n\t\tmapa = new GMaps({\n\t\t\tdiv: divMap,\n\t\t\tlat: latitud,\n\t\t\tlng: longitud\n\t\t});\n\n\t\tmapa.addMarker({\n\t\t\tlat: latitud,\n\t\t\tlng: longitud\n\t\t});\n\t});\n\n}", "function setMapOnAll(i, map) {\n database[i].markerid.setMap(map);\n console.log(markers[id]);\n }", "function makeMap() {\r\n\tif (map == \"\") {\r\n\t\tgenNewMap();\r\n\t}\r\n\r\n\tconstructMap();\r\n}", "function chooseMap(ilmakuva) {\n // Set the label to the aerial imagery name\n map.setLayoutProperty(currentLayer, 'visibility', 'none');\n currentLayer = toggleableLayers[0]['layers'][ilmakuva];\n map.setLayoutProperty(currentLayer, 'visibility', 'visible');\n document.getElementById('slider-label').textContent = currentLayer;\n }" ]
[ "0.6945057", "0.66730183", "0.6643837", "0.6609678", "0.6479947", "0.6479947", "0.6472625", "0.6414302", "0.6380582", "0.6375624", "0.6375172", "0.63698715", "0.63526547", "0.6339147", "0.63311493", "0.62608886", "0.62045765", "0.6185284", "0.6173085", "0.61390936", "0.6132738", "0.6132515", "0.6111197", "0.6109674", "0.60785985", "0.6055888", "0.6031687", "0.60121655", "0.60111105", "0.5990619", "0.59847766", "0.5963865", "0.59633845", "0.59625286", "0.5943258", "0.59345853", "0.59192646", "0.5916286", "0.5910851", "0.590787", "0.5902466", "0.588065", "0.5870245", "0.5864672", "0.5861849", "0.58541214", "0.58468664", "0.5844321", "0.5842665", "0.5832421", "0.5831929", "0.58301765", "0.5826211", "0.5819333", "0.5805442", "0.58030015", "0.58020926", "0.5799818", "0.5795434", "0.57812715", "0.57534754", "0.57437915", "0.57342345", "0.57314", "0.5730054", "0.5728574", "0.5724455", "0.5724318", "0.57220125", "0.5717668", "0.5714976", "0.57141215", "0.5710791", "0.5700382", "0.56977427", "0.5695494", "0.56945866", "0.5693282", "0.5691962", "0.5660335", "0.5657195", "0.5644112", "0.56421053", "0.56348515", "0.563394", "0.56329644", "0.56244403", "0.5606069", "0.5601714", "0.56004953", "0.55995566", "0.559373", "0.55888677", "0.5588086", "0.5583186", "0.5580947", "0.5580592", "0.5579461", "0.5576981", "0.55738074" ]
0.61994356
17
funcion para el nuevo contenedor
function contenedorNuevaLista(){ var nuevaFila= document.createElement("div"); trelloObject.contenedor.appendChild(nuevaFila); nuevaFila.setAttribute("class", "nuevaFila"); nuevaFila.appendChild(trelloObject.spanAnadirLista); nuevaFila.appendChild(trelloObject.formHtml); trelloObject.spanAnadirLista.style.display = "inline-block"; trelloObject.botonHtml.disabled = true; trelloObject.inputHtml.addEventListener("keyup", function(){ var longitud = trelloObject.inputHtml.value.length; if (longitud <= 0){ trelloObject.botonHtml.disabled = true; }else if (longitud >= 1){ trelloObject.botonHtml.disabled = false; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function iniciar() {\n \n }", "function create() {\n\n}", "function functionClic(){\n var newTuit = document.createElement(\"section\");\n var textTuit = document.createTextNode(document.getElementById(\"text-area-id\").value);\n var tuitList = document.getElementById(\"subcontainer-id\");\n var timeStamp = document.createElement(\"PRE\");\n var date = new Date();\n newTuit.className = \"msgTuit\";\n newTuit.appendChild(textTuit);\n\n //tuitList.insertBefore(newTuit, tuitList.childNodes[0]); //Inserta los tuits al principio\n tuitList.appendChild(newTuit); //Inserta los tuits al final\n timeStamp.appendChild(document.createTextNode(date.getHours()+\":\"+date.getMinutes()));\n newTuit.appendChild(timeStamp);\n\n document.getElementById(\"text-area-id\").value = \"\";//limpia el textarea INPUT\n document.getElementById(\"text-area-count-id\").value = 140;\n divChange();\n}", "function crearTermostatoTipo0( id_term)\n{\n\tvar termostato1= new Object();\n\t\n\t\n\ttermostato1.parametros={temperatura:35.5, modo:0,temperaturaAmbiente:30.5,ValvulaAbierta:0};// datos recibidor del termostato\n\ttermostato1.configuracion={temperatura:35.5, modo:0, Caption:\"\"};// parametros que se envian al termostato \n\ttermostato1.configuracion.Caption=\"Termostato \"+id_term;\n\ttermostato1.iluminadoModo=false;\n\ttermostato1.Tipo=0;// tipo de objeto en este caso termostato sistena\n\ttermostato1.Caption=\"Termostato \"+id_term;\n\ttermostato1.visible=1;// se mira si es visible o no \n\ttermostato1.EstaMinimizado=1; // 0 maximizado, 1 minimizado\n\t//termostato1.temperatura=35.5;\n\t//termostato1.temperaturaAmbiente=30.5;\n\ttermostato1.estado=1; // donde 1 es on y 0 off \n\ttermostato1.actualizar=0; // donde 1 es que hay que enviar datos al servicio pass , 0 no hay datos actualizador\n\ttermostato1.dat=0;// ????\n\t//termostato.HayDatosCambiados=HayDatosCambiados_Term;\n\n\ttabla_valores.push(termostato1);\n\n\tvar t = document.querySelector('#termostato_tipo_1');\n\t\n\t\n\tvar clone = document.importNode(t.content, true);\n\t\n\tclone.getElementById(\"termostato\").id=\"termostato\"+id_term;\n\tclone.getElementById(\"marco_superior\").id=\"marco_superior\"+id_term;\n\tclone.getElementById(\"icono_despliegue\").id=\"icono_despliegue\"+id_term;\n\tclone.getElementById(\"caption_temp\").id=\"caption_temp\"+id_term;\n\tclone.getElementById(\"tempAmbiente\").id=\"tempAmbiente\"+id_term;\n\tclone.getElementById(\"icono_OnOffSup\").id=\"icono_OnOffSup\"+id_term;\n\tclone.getElementById(\"marco_inf\").id=\"marco_inf\"+id_term;\n\tclone.getElementById(\"zona_iconos\").id=\"zona_iconos\"+id_term;\n\tclone.getElementById(\"btn_mas\").id=\"btn_mas\"+id_term;\n\tclone.getElementById(\"icono_func_mas\").id=\"icono_func_mas\"+id_term;\n\tclone.getElementById(\"temp_grande\").id=\"temp_grande\"+id_term;\n\tclone.getElementById(\"btn_menos\").id=\"btn_menos\"+id_term;\n\tclone.getElementById(\"icono_func_menos\").id=\"icono_func_menos\"+id_term;\n\tclone.getElementById(\"icono_onoff\").id=\"icono_onoff\"+id_term;\n\tclone.getElementById(\"btn_onoff\").id=\"btn_onoff\"+id_term;\n\tclone.getElementById(\"marco_temp\").id=\"marco_temp\"+id_term;\n\tclone.getElementById(\"btn_conf\").id=\"btn_conf\"+id_term;\n\tclone.getElementById(\"temp_peque\").id=\"temp_peque\"+id_term;\n\tclone.getElementById(\"term_modo\").id=\"term_modo\"+id_term;\n\t\n\t\n\t$(\"#contenedor\").append(clone);\n\tdocument.getElementById(\"icono_despliegue\"+id_term).setAttribute( \"IdTerm\",id_term.toString());\n\tdocument.getElementById(\"icono_OnOffSup\"+id_term).setAttribute(\"IdTerm\",id_term.toString());\n\tdocument.getElementById(\"btn_mas\"+id_term).setAttribute(\"IdTerm\",id_term.toString());\n\tdocument.getElementById(\"btn_menos\"+id_term).setAttribute(\"IdTerm\",id_term.toString());\n\tdocument.getElementById(\"btn_onoff\"+id_term).setAttribute(\"IdTerm\",id_term.toString());\n\tdocument.getElementById(\"btn_conf\"+id_term).setAttribute(\"IdTerm\",id_term.toString());\n\t\n}", "function OperadorNew(){\r\n\tresultado = '';\r\n\treturn ;\r\n}", "function crearFormulario() {\n\t// se crea un elemnto div, se le colocan clases, y se agrega antes del boton de Añaidr Lista\n\t//este elemento es de color azul y tiene un input y un boton\n\tvar formulario = document.createElement('div');\n\tformulario.setAttribute(\"class\",\"forma arriba\");\n\tboton.parentNode.insertBefore(formulario, boton);\n\t//se crea un input para escribir el nombre de la nueva lista y se agrega como hijo del div que se creo arriba, tiene focus para poder esccribir directamente en el \n\tvar nombre = document.createElement('input');\n\tnombre.setAttribute(\"type\",\"text\");\n\tnombre.setAttribute(\"placeholder\",\"Nombre de la lista\");\n\tformulario.appendChild(nombre);\n\tnombre.focus();\n\n\tvar agregar = document.createElement('button');\n\tagregar.innerHTML = \"Aceptar\";\n\tagregar.setAttribute(\"class\",\"amarillo blanco\");\n\tagregar.setAttribute(\"type\",\"submit\");\t\n\tformulario.appendChild(agregar);\n\n\tcrearCierre(formulario);\n\tcrearLista(nombre,formulario);\n\tcerrarCuadro(formulario,boton);\n}", "function insertarNodoU(proceso,nombre, tiempo, quantum,tll, tf, tr, pr,rar, ne,contenido){\r\n\tvar nuevo = new nodo();\r\n\tvar colaTemp = new cola();\r\n\tnuevo.proceso = proceso;\r\n\tnuevo.nombre=nombre;\r\n\tnuevo.tiempo = tiempo;\r\n\tnuevo.quantum = quantum;\r\n\tnuevo.Tllegada=tll;\r\n\tnuevo.Tfinalizacion=tf;\r\n\tnuevo.Turnarround=tr;\r\n\tnuevo.numEjecucion=ne;\r\n\t\r\n\t\r\n\tnuevo.prioridad=pr;\r\n\tnuevo.rafagareal=rar;\r\n\tnuevo.contenido=contenido;\r\n\tnuevo.sig = null;\r\n\t\r\n\tif(this.vacia()){\r\n\t\tthis.raiz = nuevo;\r\n this.fondo = nuevo;\r\n\t}else{\r\n\t\twhile(!this.vacia()){\t\r\n\t\t\tvar temp = new nodo();\t\t\r\n\t\t\ttemp = this.extraerPrimero();\r\n\t\t\tcolaTemp.insertarPrimero(temp.proceso,temp.nombre, temp.tiempo, temp.quantum,temp.Tllegada,\r\n\t\t\t\ttemp.Tfinalizacion,temp.Turnarround,temp.prioridad,temp.rafagareal,temp.numEjecucion,temp.contenido); \t\t\r\n\t\t}\r\n\t\tthis.insertarPrimero(proceso,nombre, tiempo, quantum,tll, tf, tr, pr,rar,ne,contenido);\t\t\r\n\t\twhile(!colaTemp.vacia()){\r\n\t\t\tvar temp = new nodo();\t\t\r\n\t\t\ttemp = colaTemp.extraerPrimero();\r\n\t\t\tthis.insertarPrimero(temp.proceso,temp.nombre, temp.tiempo, temp.quantum,temp.Tllegada,\r\n\t\t\t\ttemp.Tfinalizacion,temp.Turnarround,temp.prioridad,temp.rafagareal,temp.numEjecucion,temp.contenido); \t\r\n\t\t}\r\n\t}\r\n}", "create() {\n\t}", "function accionCrear()\n\t{\n\n//\t\talert(\"accionCrear\");\n\t\tif(listado1.datos.length != 0)\n\t\t{\n\t\t\tvar orden = listado1.codSeleccionados();\n//\t\t\talert(\"Linea seleccionada \" + orden);\n\t\t\tset('frmPBuscarTiposError.hidOidCabeceraMatrizSel', orden);\n\t\t\tset('frmPBuscarTiposError.accion', 'crear');\n\t\t\tenviaSICC('frmPBuscarTiposError');\n\n\t\t}else\n\t\t{\n\t\t\talert(\"no hay seleccion: \" + listado1.datos.length);\n\t\t}\n\t}", "function Copcar(){}", "function inicio(){\n var div = document.createElement('div');\n document.body.appendChild(div);\n telaUm(div);\n \n}", "mostrarMensaje(mensaje,clases){\n const div=document.createElement('div');\n div.classList=clases;\n //agregar texto\n div.appendChild(document.createTextNode(mensaje));\n //buscar el padre para colocar el div\n const buscadorDiv=document.querySelector('#buscador');\n buscadorDiv.appendChild(div);\n setTimeout(()=>{\n this.limpiarMensaje();\n },3000);\n }", "function comportement (){\n\t }", "function agregarOrden(){\r\n let compra = document.getElementById('tit1')\r\n let precio = document.getElementById('pre1')\r\n pedido.push(new vehiculo(compra.textContent, precio.textContent));\r\n crearPedido(); \r\n}", "function hCreate(storage){\r\n}", "function CrearCuento(){\n SeleccionLibro();\n BorrarPaginasCuento();\n\n var Cuento = {Nombre:$('#InputNombre').val(),Coleccion:$('#SelectorColecciones').val()};\n InsertarCuentos(Cuento);\n GetIDCuento(Cuento);\n CargarCuentos();\n}", "procesarControles(){\n\n }", "function inicio(){\n canvas=document.getElementById('micanvas'); //almacenamiento de un elemento del documento(HTML) a una variable\n ctx=canvas.getContext('2d'); //generarle al lienzo un contexto de dos dimenciones para graficar en ella\n canvas.width=1000; //definiendo el ancho del lienzo en pixeles\n canvas.height=600; //definiendo el alto del lienzo en pixeles\n\n for (i = 0; i < cantidad; i++) {\n arrastrables.push(new Circulo(aleatorio(canvas.width), aleatorio(canvas.height), 20,abc[arrastrables.length])); //creacion de un arreglo de objetos circulos(nodos)\n }\n \n habilitarEntradas(); //se habilita la llamada constante a las variables de entrada \n correr(); //se inicializa el corredor de la aplicacion (algo parecido al Timer en C++ o C#)\n}", "function imprimir(){\n let caja = document.createElement('div');\n let contenido = document.createTextNode(`Estimado(a) ${nombre} ${apellido} y su Rut: ${rut}, su hora para ${select} ha sido reservada para el día ${fecha} a las ${hora}. Además, se le envió un mensaje a su correo ${correo} con el detalle de su cita. Gracias por preferirnos`);\n caja.appendChild(contenido);\n caja.setAttribute('class', 'caja azul');\n let contenedor = document.getElementById('contenedor');\n contenedor.appendChild(caja);\n }", "function agregarTextArea(){\n contProcesos += 1;\n let idEntrada= document.getElementById(\"procesos\");\n let job = document.createElement(\"text\");\n job.innerHTML = `<div class=\"${ contProcesos % 2 ? \"jobc\" : \"jobc\" }\">\n <p>Proceso ${contProcesos}</p>\n <textarea class=\"midpro\"></textarea>\n </div>`;\n idEntrada.appendChild( job ); /*es una referencia a un nodo existente en el documento.*/\n}", "mostra_dati(msg) {\n mostramenu();\n while (document.getElementById(\"contenuto\").firstChild != null ) {\n document.getElementById(\"contenuto\").removeChild(document.getElementById(\"contenuto\").firstChild);\n }\n var div = document.createElement(\"div\");\n\t\tvar attdiv = document.createAttribute(\"align\");\n\t\tattdiv.value = \"center\";\n\t\tdiv.setAttributeNode(attdiv);\n\t\tvar attdivv = document.createAttribute(\"id\");\n\t\tattdivv.value = \"box\";\n\t\tdiv.setAttributeNode(attdivv);\n\t\tvar attdiv1 = document.createAttribute(\"width\");\n\t\tattdiv1.value = \"auto\";\n\t\tdiv.setAttributeNode(attdiv1);\n\t\tvar attdiv2 = document.createAttribute(\"height\");\n\t\tattdiv2.value = \"auto\";\n\t\tdiv.setAttributeNode(attdiv2);\n console.log(msg);\n $(\"#contenuto\").append(div);\n $(\"#box\").append(msg);\n \n\t\t//prende tutti i dati contenuti nell'oggetto dati_registrazione e li visualizza all'utente\n\t}", "spawnToken(){\n this.spawnedToken = true; //primero cambiamos el estado de spawnedToken\n let divToken = document.createElement(\"div\"); // crea un div\n divToken.setAttribute(\"id\",\"token\"); //le agrega un id llamado \"token\", el estilo de ldiv ya esta asignado en la hoja css\n document.getElementById(\"container\").insertAdjacentElement(\"beforeend\",divToken);//inserta el div en el container\n divToken.style.transform = `translate(${this.posX}px,${this.posY}px)`; //mueve el div a su punto de origen\n divToken.style.animation = `token 4s linear`; //le asigna el \"keyframes\" el cual tiene que estar si o si creado en la hoja css\n divToken.style.backgroundImage = this.url; //y por ultimo le pone la imagen de fondo\n return divToken; //tanto esta funcion como \"spawnOcti\" devuelven el div creado para agilizar la tarea para borrarlo cuando ya no sea necesario\n }", "function escreveConteudo(){}", "function avertirPanierVide(conteneur) {\n conteneur = document.createElement(\"div\");\n main.appendChild(conteneur);\n let titre = document.createElement(\"h2\");\n conteneur.appendChild(titre);\n conteneur.setAttribute(\"id\", \"panierVide\");\n conteneur.setAttribute(\"class\", \"row \");\n conteneur.style.justifyContent = \"center\";\n\n let messagePanierVide = document.createElement(\"h2\");\n conteneur.appendChild(messagePanierVide);\n messagePanierVide.textContent = \"Oups, votre panier est vide\";\n messagePanierVide.setAttribute(\"class\", \"mt-4 col-12 col-md-12 col-xl-12\");\n messagePanierVide.style.textAlign = \"center\";\n\n let imagePanierVide = document.createElement(\"img\");\n conteneur.appendChild(imagePanierVide);\n imagePanierVide.src = \"img/vide.png\";\n imagePanierVide.setAttribute(\"class\", \"col-12 col-md-6 col-xl-4\");\n}", "function InicializarControlador()\n{\n idPalabraActual = 0; // Id de la palabra que tiene que escribir el jugador.\n idCharActual = 0; // Id a nivel de texto del primer caracter de la palabra que tiene que escribir el jugador.\n tIni = new Date(); // Momento de inicio del juego.\n errores = 0; // Número de errores que ha tenido el jugador hasta ahora.\n subIptAnterior = \"\"; // Lo que el usuario tenía escrito antes del último refresco del input.\n\n palabras = libreria[IndexarTextoAleatorio()].match(/\\S+/gi); // Elijo un texto al azar de la librería y lo divido en un array buscando cualquier bloque de texto que no sea un \" \".\n largoTexto = CalcularLargoDelTexto(); // Número de caracteres del texto, incluyendo espacios.\n texto = ConstruirTextoRevisado(palabras);\n}", "create () {}", "create () {}", "function PlcEvento (){\r\n\t\r\n}", "function iniciar(e) {\n\tform(e,'texto',i,'Añadir una lista...', agregar);\n\te.removeAttribute('onclick');\n\te.className='lista';\n\tcontenido.appendChild(e);\n\ti++;\n}", "function inviaMessaggio() {\r\n var templateMex = $(\".template .messaggi\").clone();\r\n var txtMex = $(\".txt-mex\").val();\r\n if (txtMex != \"\") {\r\n // Trovo gli elementi a cui stampare messaggio e ora\r\n templateMex.find(\".text\").text(txtMex);\r\n // L'elemento 'ora-chat' richiama la 'funzione ora()'\r\n templateMex.find(\".ora-chat\").text(ora());\r\n templateMex.addClass(\"right\");\r\n $(\".elenco_messaggi.active\").append(templateMex);\r\n $(\".txt-mex\").val(\"\");\r\n scrollDown();\r\n // Ottieni una risposta dopo un secondo\r\n setTimeout(function() {\r\n risposta();\r\n scrollDown();\r\n }, 1000);\r\n } else {\r\n console.log(\"err\");\r\n }\r\n }", "function reiniciar() {\n movimentos = 0;\n $('.movimentos').html(movimentos);\n tempo.stopTimer();\n $('#timer').text(\"Tempo: 00:00 \");\n criarCards();\n $('#s1').show();\n $('#s2').show();\n $('#s3').show();\n addEventHandler();\n }", "create() {}", "create() {}", "function constroiPagina(){\n let divHeader = document.createElement('div');\n divHeader.className ='header-container';\n\n //crio 6 headers de h1 a h6\n for(let i = 1; i < 7; i++){\n\n let h = document.createElement(`h${i}`);\n let hText = document.createTextNode(`Isto é um h${i}`);\n h.appendChild(hText);\n h.className = `h${i}`;\n divHeader.appendChild(h);\n }\n\n //adiciono o div com as h's ao body da pagina\n document.body.appendChild(divHeader);\n\n //Crio um array de cores para que ao dar um duplo clique no botao a cor da div mude\n let colors = ['red', 'blue', 'green', 'orange', 'pink', 'yellow', 'purple', 'gray'];\n let buttonCor = document.createElement('button');\n let buttonText = document.createTextNode('clique duplo');\n buttonCor.appendChild(buttonText);\n\n //Adiciono o botão ao body e do o listener no duplo click\n document.body.appendChild(buttonCor);\n buttonCor.addEventListener('dblclick', alteraDiv);\n\n // função pra alterar a div\n function alteraDiv(){\n divHeader.style.backgroundColor = mudaCor();\n }\n\n //função pra retornar aleatoriamente uma cor\n function mudaCor(){\n let colorPick = parseInt(Math.random() * 8);\n let color = colors[colorPick];\n return color;\n }\n\n //crio o segundo botao pra criar item de lista ao clicar\n let button2 = document.createElement('button');\n let button2Text = document.createTextNode('Clique para adicionar um item a lista');\n button2.className = 'list-button';\n button2.appendChild(button2Text);\n\n //Adiciono o botão 2 ao body \n document.body.appendChild(button2); \n\n //criando item de lista apos cada clique\n button2.addEventListener('click', criaItem);\n let totalItens = 1;\n\n //função para criar items de lista, o numero do item aumento e ao clicar no item a cor muda aleatoriamente\n function criaItem(){\n let li = document.createElement('li');\n let liTexto = document.createTextNode(`${totalItens} item da lista`);\n li.appendChild(liTexto);\n\n //Toda vez q eu clicar num item eu altero especificamente ele\n li.addEventListener('click', alteraLi);\n\n //função para mudar cor do texto do item\n function alteraLi(){\n li.style.color = mudaCor();\n }\n\n //Toda vez q eu der um duplo clique, deletar este item da lista\n li.addEventListener('dblclick', deletaItem);\n\n function deletaItem(){\n document.body.removeChild(li);\n }\n\n //adiciono o item ao body e incremento o numero\n document.body.appendChild(li);\n totalItens++;\n }\n \n}", "function nuevo(p,color,a,cap,cilin,num,zona,val,fecha,email,tel,direc){\r\n\r\n\tvar nuevo_vehiculo = {placa: p, color:color, Anyo:a,capacidad:cap,\r\n\tcilindraje:cilin,chasis:num,zona:zona,valor:val,fecha:fecha,correo:email,tele:tel,dir:direc};\r\n\tvec.push(nuevo_vehiculo);\r\n}", "create(){\n\n }", "function animerPente() {\n\ttriangle.setAttribute({\n\t\tvisible : true\n\t});\n\tif ( typeof bullePente != \"undefined\") {//si l'object existe on le detruis.\n\t\tboard.removeObject(bullePente);\n\t}\n\tbullePente = board.create('text', [-2, 0, \" La pente = \" + dynamiqueA()], {\n\t\tanchor : triangle,\n\t\tstrokeColor : \"#fff\",\n\t\tcssClass : 'mytext'\n\t});\n\tbullePente.on('move', function() {//function pour cacher le bulles avec un event.\n\t\tboard.removeObject(bullePente);\n\t});\n\ttriangle.on('move', function() {//function pour cacher le bulles avec un event.\n\t\tbullePente.update();\n\t});\n}", "function crearCargando(pag){\n\t\t// CREAR IMAGEN\n\t\tvar car = document.createElement(\"img\");\n\t\tcar.setAttribute('src','medios/loading.gif');\n\t\tcar.id=\"cargando\";\n\t\tvar div=document.getElementById(pag);\n\t\tdiv.appendChild(car);\n\t\tTemporizador();\n}", "function principal() {\n choquecuerpo();\n choquepared();\n dibujar();\n movimiento();\n \n if(cabeza.choque (comida)){\n comida.colocar();\n cabeza.meter();\n } \n}", "function creaTastiCanzoni(nomeCanzoneSingola, id) {\n\n var pulsantoni = document.getElementById(\"pulsanti-grandi\");\n pulsantoni.classList.add(\"animated\");\n pulsantoni.classList.add(\"bounceOutUp\");\n\n //creo i pulsantini per le singole canzoni\n var divCanzone = document.createElement(\"div\");\n divCanzone.setAttribute('class', 'pulsanteCanzone animated fadeIn');\n canzoniRecuperate = document.getElementById(\"canzoni-recuperate\");\n canzoniRecuperate.appendChild(divCanzone);\n //metto il contenuto dentro il divCanzone\n var paragrafo = document.createElement(\"p\");\n divCanzone.appendChild(paragrafo);\n\n //creo il link\n a = document.createElement('a');\n paragrafo.appendChild(a); //inserisco a in p \n a.innerHTML = nomeCanzoneSingola\n a.href = \"midiSequencerTable.html?id=\" + id;\n\n\n\n}", "crearFormulario(formCL,contenedor){\n\t\tlet arrAttrb = new Array(['class',formCL]);\n\t\tlet formular = this.crearNodo('form',arrAttrb,contenedor);\n\t\treturn formular;\n\t}", "mostra_inserimento() {\n mostramenu();\n while ( document.getElementById(\"contenuto\").firstChild != null) {\n $(document.getElementById(\"contenuto\").firstChild);\n document.getElementById(\"contenuto\").removeChild(document.getElementById(\"contenuto\").firstChild);\n }\n\n var div = document.createElement(\"div\");\n \t\tvar attdiv = document.createAttribute(\"align\");\n \t\tattdiv.value = \"center\";\n \t\tdiv.setAttributeNode(attdiv);\n \t\tvar attdivv = document.createAttribute(\"id\");\n \t\tattdivv.value = \"box\";\n \t\tdiv.setAttributeNode(attdivv);\n \t\tvar attdiv1 = document.createAttribute(\"width\");\n \t\tattdiv1.value = \"auto\";\n \t\tdiv.setAttributeNode(attdiv1);\n \t\tvar attdiv2 = document.createAttribute(\"height\");\n \t\tattdiv2.value = \"auto\";\n \t\tdiv.setAttributeNode(attdiv2);\n \t\t\n\t\tvar form = document.createElement(\"form\");\n var messaggio = document.createElement(\"div\");\n\t\tvar labnum = document.createElement(\"h2\");\n\t\tvar labscad = document.createElement(\"h2\");\n\t\tvar labtipo = document.createElement(\"h2\");\n\t\tvar intipo = document.createElement(\"input\");\n\t\tvar innum = document.createElement(\"input\");\n\t\tvar inscad = document.createElement(\"input\");\n\t\tvar acapo = document.createElement(\"br\");\n\t\tvar btn = document.createElement(\"input\");\n\t\tvar t1 = document.createTextNode(\"Inserisci il tipo di carta da agganciare\");\n\t\tlabtipo.appendChild(t1);\n\t\tvar attbtn = document.createAttribute(\"type\");\n\t\tattbtn.value = \"button\";\n\t\tbtn.setAttributeNode(attbtn);\n\t\tvar attbtn2 = document.createAttribute(\"value\");\n\t\tattbtn2.value = \"Invia\";\n\t\tbtn.setAttributeNode(attbtn2);\n\t\tvar attbtn3 = document.createAttribute(\"onclick\");\n\t\tattbtn3.value = \"avanti11()\";\n\t\tbtn.setAttributeNode(attbtn3);\t\n\t\tvar t2 = document.createTextNode(\"Inserisci il numero della carta da agganciare\");\n\t\tlabnum.appendChild(t2);\n\t\tvar t3 = document.createTextNode(\"Inserisci la scandenza della carta\");\n\t\tlabscad.appendChild(t3);\n\t\tvar attbtn4 = document.createAttribute(\"type\");\n\t\tattbtn4.value = \"text\";\n\t\tintipo.setAttributeNode(attbtn4);\t\n\t\tvar attbtn5 = document.createAttribute(\"name\");\n\t\tattbtn5.value = \"tipo\";\n\t\tintipo.setAttributeNode(attbtn5);\t\n\t\tvar attbtn6 = document.createAttribute(\"type\");\n\t\tattbtn6.value = \"text\";\n\t\tinscad.setAttributeNode(attbtn6);\t\n\t\tvar attbtn62 = document.createAttribute(\"type\");\n\t\tattbtn62.value = \"text\";\n\t\tinnum.setAttributeNode(attbtn62);\t\n\t\tvar attbtn7 = document.createAttribute(\"name\");\n\t\tattbtn7.value = \"num\";\n\t\tinnum.setAttributeNode(attbtn7);\n\t\tvar attbtn72 = document.createAttribute(\"name\");\n\t\tattbtn72.value = \"scad\";\n\t\tinscad.setAttributeNode(attbtn72);\n\t\tvar attbtn8 = document.createAttribute(\"name\");\n\t\tattbtn8.value = \"aggancio\";\n\t\tform.setAttributeNode(attbtn8);\t\n\t\tvar attbtn9 = document.createAttribute(\"id\");\n\t\tattbtn9.value = \"aggancio\";\n\t\tform.setAttributeNode(attbtn9);\t\n\t\tform.appendChild(labtipo);\n\t\tform.appendChild(acapo);\n\t\tform.appendChild(intipo);\n\t\tform.appendChild(acapo);\n\t\tform.appendChild(labnum);\n\t\tform.appendChild(acapo);\n\t\tform.appendChild(innum);\n\t\tform.appendChild(acapo);\n\t\tform.appendChild(labscad);\n\t\tform.appendChild(acapo);\n\t\tform.appendChild(inscad);\n\t\tform.appendChild(btn);\n\t\tdiv.appendChild(form);\n\t\tcontenuto.appendChild(div);\n }", "constructur() {}", "function handleContador(){\n props.incrementCounter(1);\n }", "procesa() {\n if (!this.setFrase) //Si la frase es variable\n this.frase = prompt(\"Escribe una frase\", \"Hola\").toUpperCase();\n\n this.tempData = this.data.slice(); //Necesitamos una copia, dado que el fondo es blanco.\n this.limpiaCanvas(); // Limpiamos el fondo\n super.procesa((w, h) => {\n this.ctx.font = h+\"px Arial\"; //Asignamos el tamaño de letra a la altura de la seccion.\n });\n }", "consstructor(){\n \n\n }", "createDOM(element) {\n this.undo = document.getElementById('undo');\n this.canvas = document.createElement('canvas');\n this.canvas.id = \"canvas\";\n this.canvas.width = this.options.width;\n this.canvas.height = this.options.height;\n element.appendChild(this.canvas);\n this.context = this.canvas.getContext(\"2d\");\n this.cPush();\n this.canvas.addEventListener('mousedown', this.onMouseDown.bind(this));\n this.canvas.addEventListener('mousemove', this.onMousemove.bind(this));\n this.canvas.addEventListener('mouseup', this.onMouseUp.bind(this));\n this.canvas.addEventListener('mouseleave', this.onMouseLeave.bind(this));\n // this.canvas.addEventListener('dblclick', function(){return false});\n this.undo.addEventListener('click', this.cUndo.bind(this));\n \n //targetEl.parentElement.replaceChild(this.canvas, targetEl); \n }", "function genereContenuID(element,contenu,divMere,idd)\n{\n nouveauDiv = document.createElement(element); //Creation of the element\n nouveauDiv.innerHTML = contenu; //Assigning content\n nouveauDiv.id=idd; //Assigning an id\n document.getElementById(divMere).appendChild(nouveauDiv);\n}", "function crearCohete(){\n\tcohete = new moduloLunar();\n\tescena.add(cohete.mesh);\n\n}", "function _construct()\n\t\t{;\n\t\t}", "function criarVetor() {\r\n let sec = document.createElement('section');\r\n}", "function ouvrir() {\n creationModal();\n }", "function nuevaCita(e){\n e.preventDefault();\n\n //Extraer infomracion\n const {mascota,propietario,telefono,fecha,hora,sintomas} = citaObj;\n\n //validar\n if(mascota === '' || propietario === '' || telefono === '' || fecha === '' || hora === '' || sintomas === ''){\n ui.imprimirAltera('Llena todos los campos', 'error');\n return;\n }\n if(editando){\n ui.imprimirAltera(`Se actualizo correctamente.`)\n\n //Pasar el objeto de la cita a edicion\n administrarCitas.editarCita({...citaObj});\n\n //Quitar modo edicion\n formulario.querySelector('button[type=\"submit\"]').textContent = 'Crear Cita';\n editando = false;\n \n\n\n }else{\n //Generar id\n citaObj.id = Date.now();\n\n //Crear cita\n administrarCitas.agregarCita({...citaObj});\n ui.imprimirAltera(`Cita para ${citaObj.mascota} agregada.`)\n }\n\n\n //Restabelcer datos'\n reiniciarObj();\n formulario.reset();\n\n //Mostrar HTML citas\n ui.imprimirCitas(administrarCitas);\n\n}", "function miFuncion (){}", "function criarCelular4(marcaCelular, tamanhoTela, capacidadeBateria) {\n return {\n marcaCelular,\n tamanhoTela,\n capacidadeBateria,\n ligar: function () {\n console.log(\"fazendo ligação!...\");\n },\n };\n}", "function newProduct(camera){\n \n\n //creation de la div produit\n const containerProduct = document.createElement(\"div\");\n containerProduct.classList.add(\"cardsProduct\"); //c'est le container des cartes\n \n //ajout des images\n const image = addImage(camera);\n\n //ajout du texte description\n const description = addDescription(camera);\n\n \n // Montage de la DIV\n image.appendChild(description);\n containerProduct.appendChild(image);\n\n return containerProduct;\n}", "InitNew() {\n\n }", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function heredaDe(prototipoHijo, prototipoPadre) { // Esta es una funcion que recibe funciones\n var fn = function () {} // Creamos una funcion vacia\n fn.prototype = prototipoPadre.prototype // Hacemos una copia del prototipo del Padre para guardarlo en el protitipo de nuestra funcion vacia\n prototipoHijo.prototype = new fn // De esa forma evitamos acceder directamente a la funcion y no la pizamos\n prototipoHijo.prototype.constructor = prototipoHijo //Asignamos la funcion constructora\n //Si no agregamos la ultima linea se estaria llamando al constructor de prototipo padre\n}", "function crearGifo() {\n btnCrear.textContent = \"COMENZAR\";\n btnCrear.setAttribute(\"onclick\", \"comenzar()\");\n hide(\n \"video\",\n \"msj-2\",\n \"msj-crear-1\",\n \"msj-crear-2\",\n \"contador\",\n \"repetir\",\n \"gif-listo\",\n \"contenedor-gif-creado\"\n );\n unhide(\"msj-1\", \"btnPasosCrear\");\n pasoActivo(0);\n}", "function agregarAlCarrito() {\n /* Función que agrega un producto al carrito. utiliza el atributo \"alt\" del botón clickeado para obtener el código del producto a agregar. Cada vez que se agrega un producto se vuelve a generar la tabla que se muestra en pantalla.*/\n var elCodigo = $(this).attr(\"alt\");\n var laPosicion = buscarCodigoProducto(elCodigo);\n var productoAgregar = listadoProductos[laPosicion];\n carrito[carrito.length] = productoAgregar;\n armarTablaCarrito();\n }", "function connexionPanierControl(){\n\tconsole.log('tata');\n\tcliendGood();\n\tmdpControl();\n\temailControl();\n}", "function crealista(o) {\n var aCte = new Array();\n eval(b64.decode(o.contenido));\n var tlb = document.getElementById(\"tlb\");\n while (i = tlb.firstChild) {\n tlb.removeChild(i);\n }\n if(aCte.length) {\n for (var j=0; j<aCte.length; j++) {\n var fila = zombietr.cloneNode(true);\n var primera = fila.firstChild;\n var tfolio = document.createTextNode(aCte[j][0]);\n primera.appendChild(tfolio);\n var segunda = primera.nextSibling;\n var tnombre = document.createTextNode(aCte[j][1]);\n segunda.appendChild(tnombre);\n var tercera = segunda.nextSibling;\n var tusuarios = document.createTextNode(aCte[j][2]);\n var ligausr = document.createElement(\"a\");\n ligausr.className = \"ligausr\";\n ligausr.id = \"ligausr_\" + aCte[j][0];\n ligausr.href = \"usuarios\";\n ligausr.setAttribute(\"title\",aCte[j][0]);\n ligausr.onmouseover = \"window.status='Servicios RH Global';\";\n ligausr.onclick = function() {agregausr(this.title);return false;};\n ligausrspan = document.createElement(\"span\");\n ligausrspan.appendChild(tusuarios);\n ligausr.appendChild(ligausrspan);\n tercera.appendChild(ligausr);\n var cuarta = tercera.nextSibling;\n var tacciones = new Array(\"borrar\",\"editar\");\n for (var l in tacciones) {\n nliga = document.createElement(\"a\");\n nliga.href = aCte[j][0];\n nliga.setAttribute(\"title\",tacciones[l] + \" \" + aCte[j][0]);\n nliga.onclick = function() {return accion(this.title);};\n nimg = document.createElement(\"img\");\n nimg.setAttribute(\"src\",\"/interfase/\" + tacciones[l] + \".gif\");\n nimg.setAttribute(\"alt\",tacciones[l]);\n nliga.appendChild(nimg);\n cuarta.appendChild(nliga);\n }\n fila.className = ((j+1)%2==0) ? \"even\" : \"odd\";\n tlb.appendChild(fila);\n }\n } else {\n var filavacio = document.createElement(\"tr\");\n filavacio.className=\"even\";\n var celdavacio = document.createElement(\"td\");\n celdavacio.setAttribute(\"colspan\",\"4\");\n celdavacio.colSpan = 4;\n var txtvacio = document.createTextNode(\"No hay Clientes en el Sistema\");\n var br = document.createElement(\"br\");\n celdavacio.appendChild(txtvacio);\n celdavacio.appendChild(br);\n filavacio.appendChild(celdavacio);\n tlb.appendChild(filavacio);\n }\n}", "chatta(indice){\n this.index = indice;\n let lunghezzaMessaggi =this.contacts[indice].messages.length;\n this.chiudiBlockEmoji()\n document.getElementById('insert-field').focus();\n }", "addNewTag() {\n this.$emit('add-tag', this.newTag, this.listIndex, this.cardIndex);\n this.newTag = {\n name: \"\",\n color: \"\"\n };\n }", "cambiarEstado(tipo){\n if (tipo === \"editar\"){\n this.btnEnviar.textContent = \"Actualizar Publicación\";\n this.btnEnviar.classList =\"btn btn-block btn-warning\";\n \n const btnVolver = document.createElement(\"button\");\n btnVolver.className = \"btn btn-block btn-secondary mt-2 cancelar-Edicion\";\n btnVolver.setAttribute(\"id\", \"btnVolver\");\n btnVolver.textContent = \"Volver\";\n this.formTarjeta.appendChild(btnVolver);\n //si el estado que recibo por parametro es agregar, entonces quito los cambios hechos por el estado editar y limpio los campos\n }else{\n this.btnEnviar.textContent = \"Publicalo!\";\n this.btnEnviar.classList =\"btn btn-block btn-primary\";\n if (document.getElementById(\"btnVolver\")){\n document.getElementById(\"btnVolver\").remove();\n }\n this.limpiarCampos();\n \n }\n }", "function agregarDetalle(){\r\n if(!validarCamposDetalle()){\r\n return;\r\n }\r\n cargarDetalles();\r\n let temp;\r\n let correlativo = detallesOrden.length;\r\n if(existeEnOrden(document.getElementById(\"CodigoProd\").value,document.getElementById(\"Cantidad\").value, document.getElementById(\"Precio\").value,2)){\r\n guardarDetalles();\r\n poblarDetalle();\r\n limpiarDetalles();\r\n return;\r\n }\r\n temp = new detalle(\r\n correlativo+1,\r\n document.getElementById(\"CodigoProd\").value,\r\n document.getElementById(\"Descripcion\").value,\r\n document.getElementById(\"Cantidad\").value,\r\n document.getElementById(\"Precio\").value\r\n );\r\n \r\n detallesOrden.push(temp);\r\n guardarDetalles();\r\n poblarDetalle();\r\n limpiarDetalles();\r\n}", "static create(obj) {\n //spinner(true);\n\n let handle = $(obj).attr(\"referencia\");\n let target = $(obj).attr(\"target\");\n let single = parseInt($(obj).attr(\"single\"));\n\n this.criaModal(handle, target);\n\n if(!(single === 1 && $(obj).find(\".galeria-overlay\").length > 0)){\n this.lista(obj);\n }\n }", "function muestra_resultado(resultado, idContenedor)\n{\n //crea una nueva etiqueta \"p\" y le asigna el valor recibido\n let nuevoResultado = document.createElement('p');\n nuevoResultado.innerHTML = resultado;\n\n //busca el contenedor en el cual se va meter el resultado\n let contenedorResultado = document.getElementById(idContenedor);\n //mete el resultado al contenedor para que se muestre en pantalla\n contenedorResultado.appendChild(nuevoResultado);\n}", "function muestra_resultado(resultado, idContenedor)\n{\n //crea una nueva etiqueta \"p\" y le asigna el valor recibido\n let nuevoResultado = document.createElement('p');\n nuevoResultado.innerHTML = resultado;\n\n //busca el contenedor en el cual se va meter el resultado\n let contenedorResultado = document.getElementById(idContenedor);\n //mete el resultado al contenedor para que se muestre en pantalla\n contenedorResultado.appendChild(nuevoResultado);\n}", "createNode() {\n this.createNode();\n }", "function moverDisco(torre,disco){\n torre.appendChild(disco)\n\n}", "reiniciarConteo() {\n this.ultimo = 0;\n this.tickets = [];\n this.grabarArchivo();\n this.ultimos4 = []\n console.log('Se ha inicializado el sistema');\n \n }", "afterCreate(result) {}", "addFunctionToCallback(ƒ){\n this.createdCallback.push(ƒ);\n }", "constructor() {\n //vamos a poner un setTimeout para que no arranque ni bien el usuario pulsa el boton\n this.inicializar();\n this.generarSecuencia();\n setTimeout(this.siguienteNivel,500);\n }", "createNode() {\n // Create div\n let divButton = document.createElement(\"div\");\n // Id and class\n divButton.setAttribute('id', this.id);\n divButton.setAttribute('class', this.className);\n // Size\n divButton.style.width = (this.widthPix * 0.90).toFixed(0) + 'px';\n divButton.style.paddingLeft = (this.widthPix * 0.05).toFixed(0) + 'px';\n divButton.style.paddingRight = (this.widthPix * 0.05).toFixed(0) + 'px';\n divButton.style.height = (this.heightPix * 0.95).toFixed(0) + 'px';\n divButton.style.marginBottom = (this.heightPix * 0.05).toFixed(0) + 'px';\n // Text\n divButton.innerHTML = this.text;\n // Visibility\n if (this.visible === true) {\n divButton.style.display = 'flex';\n } else {\n divButton.style.display = 'none';\n }\n this.node = divButton;\n }", "cambiaContatto(index){\n this.contattoAttivo = index;\n }", "obtain(){}", "function inserirDesconto() {\n if (desconto > 0) {\n const divDesconto = document.createElement('div');\n divDesconto.classList.add('desconto');\n const descricao = document.createElement('h2');\n descricao.appendChild(document.createTextNode('Descontos'));\n divDesconto.appendChild(descricao);\n const divValorDesc = document.createElement('div');\n divValorDesc.classList.add('valor-desc');\n divDesconto.appendChild(divValorDesc);\n const valorDesc = document.createElement('h2');\n valorDesc.appendChild(\n document.createTextNode(\n desconto.toLocaleString('pt-BR', { style: 'currency', currency: 'BRL' })\n )\n );\n divValorDesc.appendChild(valorDesc);\n const cupomDesc = document.createElement('span');\n cupomDesc.appendChild(\n document.createTextNode('CUPOM: MEUPRIMEIROVESTIDOPRETO')\n );\n\n divValorDesc.appendChild(cupomDesc);\n\n resumo.insertBefore(divDesconto, freteInserido);\n }\n}", "function NewObj(){}", "function onloevha() {\n}", "function criarLembrete(){\n\tvar conteudoTextArea = document.getElementById(\"texto\").value;\n\tif(!textoValido(conteudoTextArea)){\n\t\tmostrarError();\n\n\t}\n\n\tlimparError();\n\n\t// criar as variaveis para tempo\n\tvar referencia = new Date();\n\tvar id = referencia.getTime();\n\tvar data = referencia.toLocaleDateString();\n\tvar texto = conteudoTextArea;\n\n\t//JSON\n\tvar recordatorio = {\"id\": id, \"data\": data,\"texto\": texto};\n\n\t//função para comprovar se existe lembrete\n\tcomprovarRecordatorio(recordatorio);\n}", "function createNewFunctionView() {\n // json set\n var dataSet = pluto.loadedDataSet[pluto.selectedPlutoName];\n \n // gets the pluto\n var layer = pluto.loadedPluto[pluto.selectedPlutoName];\n // create layer.\n layer.loadFillLayer(thr, pluto.selectedFunctionName, dataSet);\n }", "function createInspektor()\n{\n addCSS(); //nahraje do hlavicky css pro inspektor\n setEventBody(); //definovani obsluznych funkci pro udalosti nakter ma reagovat puvodni telo\n \n createInspektorElem(); // tvoreni tela inspektrou\n \n modalWindow(); //pomocny \"dialog\" pro meneni atributu class a id\n setEventDialog();\n}", "function TIcuContainerNode() {}", "function TIcuContainerNode() {}", "function TIcuContainerNode() {}", "function nuevo(codigo) //generacion del formulario de uno nuevo\n{\n\t\n\tvar tabla = $F('tabla');\n\tvar url = \"inc/generator.php\"\n\tvar pars = \"opcion=5&tabla=\"+codigo\n\tvar myAjax = new Ajax.Request(url,\n\t {\n\t\t\tmethod:'post',\n\t\t\tparameters: pars,\n\t\t\tonComplete: function gen(t)\n\t\t\t{\n\t\t\t\t$('formulario').innerHTML = t.responseText\n\t\t\t\t//vamos a mirar aqui casos de tabla pe en empleados \n\t\t\t\tcampos_fecha(tabla)\n\t\t\t\tmuestra_el_formulario()\n\t\t\t}\n\t\t\t\n\t});\n}", "Allocate() {\n\n }", "efficacitePompes(){\n\n }", "function mostraretro1() {\n retrouno.style.display=\"block\";\n fronte1fronte1.replaceChild(retrouno,fronte1);\n //modifica delle descrizioni con il contenuto della lettera\n testo.style.display=\"block\";\n descrizionedescrizione.replaceChild(testo, descrizione); \n }", "function resumen_cita () {\n\n $('#contenido').children('div').remove();\n $('#contenido').append('<div id=\"margen\"></div>');\n\n $('#contenido').append('<div id=\"resumen_cita\" class=\"div_unaColumna\">');\n\n $('#resumen_cita').append('<h3> Resumen cita </h3>');\n //$('#resumen_cita').append('<p> Datos Cliente </p>');\n $('#resumen_cita').append('<p><b> DNI: </b> ' + global_objUsuario.dni + '</p>');\n $('#resumen_cita').append('<p><b> Nombre: </b> ' + global_objUsuario.nombre + '</p>');\n $('#resumen_cita').append('<p><b> Apellidos: </b> ' + global_objUsuario.apellidos + '</p>');\n\n $('#resumen_cita').append('<p><b> Medico: </b>' + global_objMedico.nombre + ' ' + global_objMedico.apellidos + '</p>');\n\n $('#resumen_cita').append('<p><b> Fecha: </b>' + globalFecha + '</p>');\n\n $('#resumen_cita').append('<p><b> Horario: </b>' + global_objTramo.tramo_inicio + ' </p>');\n\n $('#resumen_cita').append('<button onclick=\"confirmarCita();\"> Confirmar cita </button>'); \n}", "function prepare()\n\t{\n \t//e = e || window.event;\n \t//var key = e.which || e.keyCode;\n\t\t////vai avanti\n \t//if(key===84)\n\t\t//{\n\t\t\t//if (i < n)\n\t\t\t//{\t\n\t\t\tif (precedentCanvas != currentCanvas && json.canvas[currentCanvas].name != \"no_canvas\")\n\t\t\teval(\"miradorInstance.store.dispatch(Mirador.actions.setCanvas('main_window', 'http://localhost/capua/mostra/index.json/canvas/\" + currentCanvas.toString() + \"'))\");\n\t\t\t//else alert(json.canvas[currentCanvas].videos[i].action.type);\n\t\t\tswitch (json.canvas[currentCanvas].videos[i].action.type)\n\t\t\t\n\t\t\t\t{\t\n\t\t\t\t\tcase \"SELECT_ANNOTATION\" :\n\t\t\t\t\tactionTranslation=\"selectAnnotation\";\n\t\t\t\t\tconsole.log(\"annotation\");\n\t\t\t\t\taction1 = eval(\"Mirador.actions. \" + actionTranslation + \"('\" +json.canvas[currentCanvas].videos[i].action.parameters.window_id + \"', '\" + json.canvas[currentCanvas].videos[i].action.parameters.argument + \"')\");\n\t\t\t\t\tsetTimeout(go, 500);\n\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase \"ZOOM_WINDOW\" : \n\t\t\t\t\tactionTranslation=\"updateViewport\";\n\t\t\t\t\tconsole.log(\"upview\");\n\t\t\t\t\taction1 = eval(\"Mirador.actions. \" + actionTranslation + \"('\" +json.canvas[currentCanvas].videos[i].action.parameters.window_id + \"',\" + json.canvas[currentCanvas].videos[i].action.parameters.argument + \")\");\n\t\t\t\t\tsetTimeout(go, 500);\n\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase \"CHANGE_CANVAS\" : \n\t\t\t\t\tactionTranslation=\"setCanvas\";\n\t\t\t\t\tconsole.log(\"change canvas\");\n\t\t\t\t\taction1 = eval(\"Mirador.actions. \" + actionTranslation + \"('\" +json.canvas[currentCanvas].videos[i].action.parameters.window_id + \"','\" + json.canvas[currentCanvas].videos[i].action.parameters.argument + \"')\");\n\t\t\t\t\tsetTimeout(go, 500);\n\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase \"CHANGE_MANIFEST\" : \n\t\t\t\t\tactionTranslation=\"addResource\";\n\t\t\t\t\tconsole.log(\"add manifest\");\n\t\t\t\t\taction1 = eval(\"Mirador.actions. \" + actionTranslation + \"(\" + json.canvas[currentCanvas].videos[i].action.parameters.argument + \"')\");\n\t\t\t\t\tsetTimeout(go, 500);\n\t\t\t\t\tbreak;\n\n\t\t\t\t\t//no action\n\t\t\t\t\tcase \"NO_ACTION\" : \n\t\t\t\t\tactionTranslation=\"\";\n\t\t\t\t\tconsole.log(\"no action\");\n\t\t\t\t\tsetTimeout(go, 500);\n\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault :\n\t\t\t\t\talert(\"ERROR: syntax error(s) or action not supported\");\n\t\t\t\t\tbreak;\n\n\n\t\t\t\t//}\n\t\t\t\t//console.log(\"Mirador.actions. \" + json.videos[i].action.type + \"('\" +json.videos[i].action.parameters.window_id + \"',\" + json.videos[i].action.parameters.argument + \")\");\n\t\t\t\t//action1 = eval(\"Mirador.actions. \" + json.videos[i].action.type + \"('\" +json.videos[i].action.parameters.window_id + \"',\" + json.videos[i].action.parameters.argument + \")\");\n\t\t\t\t//Mirador.selectAnnotation('main_window', 'http://localhost/annotations/1');\n\t\t\t\t//media.src = json.videos[i++].video;\n\t\t\t\t//forward();\n\t\t\t}\n\t\t\t\t\t//next canvas\n\t\t\t\t/*\telse {\n\t\t\t\t\tcurrentCanvas++;\n\t\t\t\t\teval(\"miradorInstance.store.dispatch(Mirador.actions.setCanvas('main_window', 'http://localhost/capua/mostra/index.json/canvas/\" + currentCanvas.toString() + \"'))\");\n\t\t\t\t\ti = 0;\n\t\t\t\t\t\n\t\t\t\t\tn= json.canvas[currentCanvas].videos.length;\n\t\t\t\t}*/\n\n\t\t//}\n\t\t/*else \n\t\t\t\t{\tconsole.log(\"ann\");\n\t\t\t\t\tmiradorInstance.store.dispatch(Mirador.actions.selectAnnotation('main_window', 'http://localhost/annotations/1'));\n\n\t\t\t} */\n\n\n\t\t\n\n\t\n\t}", "function creaarLista(i) {\n\tvar lista = document.createElement('div');\n\t\tlista.setAttribute('onclick', 'iniciar(this)');\n\t\tlista.setAttribute('id', i);\n\t\tlista.setAttribute('class', 'empezar');\n\t\tlista.innerHTML= 'Añadir una lista...';\n\n\tcontenido.appendChild(lista);\n}", "createNode() {\n // Create div\n let divButton = document.createElement(\"div\");\n // Id and class\n divButton.setAttribute('id', this.id);\n divButton.setAttribute('class', this.className);\n divButton.classList.add(this.currentColour);\n divButton.classList.add(this.fastTransition);\n // Size\n divButton.style.width = (this.widthPix * 0.90).toFixed(0) + 'px';\n divButton.style.paddingLeft = (this.widthPix * 0.05).toFixed(0) + 'px';\n divButton.style.paddingRight = (this.widthPix * 0.05).toFixed(0) + 'px';\n divButton.style.height = (this.heightPix * 0.95).toFixed(0) + 'px';\n divButton.style.marginBottom = (this.heightPix * 0.05).toFixed(0) + 'px';\n // Text\n divButton.textContent = this.text;\n // Visibility\n if (this.visible === false) {\n divButton.classList.add('hidden');\n }\n this.node = divButton;\n }", "function anhadir() {\n k.anhadirDatos();\n}", "agregarNuevo(){\n let esta = false;\n let cont = 0;\n \n while(!esta){\n cont++;\n const fil = Math.floor(Math.random() * this.size);\n const col = Math.floor(Math.random() * this.size);\n\n if(this.getCelda(fil,col)==null){\n esta = true;\n const val = Math.floor(Math.random() * 6)+1;\n if(val>=0 && val<5)\n this.setCeldaEfecto(2,fil,col); // 3 chances de 4 de que toque 2\n else\n this.setCeldaEfecto(4,fil,col); // 3 chances de 4 de que toque 4\n }\n\n //conta\n if(cont==1000) esta = true;\n\n }\n\n }" ]
[ "0.58534193", "0.58091646", "0.5660517", "0.5654602", "0.5652373", "0.5622404", "0.55763847", "0.55430865", "0.5528871", "0.552085", "0.55148834", "0.55125993", "0.55120677", "0.5486772", "0.54753566", "0.5459764", "0.5445767", "0.54372936", "0.5428892", "0.5421343", "0.54088396", "0.54085284", "0.5407333", "0.54023665", "0.5400855", "0.5389042", "0.5389042", "0.5384081", "0.53722864", "0.5362445", "0.53621536", "0.5331208", "0.5331208", "0.53289205", "0.53278166", "0.53271276", "0.5326628", "0.53224075", "0.5319582", "0.53194374", "0.5317622", "0.53053445", "0.5295389", "0.5293165", "0.5292962", "0.52929157", "0.5285492", "0.5273256", "0.5267191", "0.52581906", "0.52568203", "0.52534443", "0.5249821", "0.5246761", "0.5241917", "0.52404505", "0.523414", "0.52312905", "0.52312905", "0.52312905", "0.52308977", "0.5229446", "0.5228819", "0.52277595", "0.5222155", "0.52204293", "0.5219232", "0.52167135", "0.5214254", "0.5212112", "0.5210131", "0.5210131", "0.52097505", "0.5205936", "0.5204557", "0.5197615", "0.5193866", "0.51881933", "0.5185567", "0.5184809", "0.5176712", "0.5176499", "0.5168638", "0.51663494", "0.5162974", "0.51556176", "0.5154355", "0.5150943", "0.5150943", "0.5150943", "0.51503694", "0.5145142", "0.51445436", "0.51441723", "0.5139871", "0.5138698", "0.51384014", "0.5138222", "0.51353794", "0.5133773" ]
0.5159175
85
method on class, every class needs a render method
render() { //manipulating state example return ( <div className="search-bar"> <input value={this.state.term} onChange={event => this.onInputChange(event.target.value)} /> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render(){\n //Every render method always return HTML\n return <h1>Welcome to Myclass</h1>;\n }", "function render() {\n\n\t\t\t}", "function render() {\n\t\t\t}", "static rendered () {}", "static rendered () {}", "render() {\n // Subclasses should override\n }", "function render() {\n\t}", "function render() {\n\t\t\n\t}", "render(){}", "render(){}", "_render() {}", "render() {}", "render() {}", "render() {}", "render() { return super.render(); }", "Render(){\n throw new Error(\"Render() method must be implemented in child!\");\n }", "render () {\n throw new Error('render function must be override!')\n }", "function render() {\r\n\r\n}", "function render() {\r\n\r\n}", "render() {\n\n\t}", "render() {\n\n\t}", "render() { }", "render() {\n\n }", "render() {\n }", "function general_render(obj) {\n obj.render();\n }", "constructor() {\n super();\n this.render();\n }", "function init() { render(this); }", "render(){\r\n\r\n\t}", "render() {\n\n console.log(\"Render of class MEthod gets called\")\n\n \n return (\n <div>\n I am a class componnet\n\n <button onClick={this.something}>\n Modify the state\n \n </button>\n </div>\n )\n }", "render() {\n\n }", "render() {\n\n }", "render() {\n\n }", "render() {\n }", "render() {\n }", "render() {\n if (this.renderer) {\n this.renderer.call(this.owner, this.content, this.owner, this.model);\n }\n }", "render() {\n return this.renderContent()\n }", "render() {\n return super.render();\n }", "render(){if(this.renderer){this.renderer.call(this.owner,this.content,this.owner,this.model)}}", "render() {\n return super.render();\n }", "render() {\n return super.render();\n }", "render() {\n return this.renderContent();\n }", "yourMethodHere() {\n // any display logic, style, conditional rendering etc\n }", "render() {//rendering the class\n\n return (//returning the class\n\n <div>\n\n <h1 className=\"title-container__title\">Amahle's Weather Scanner </h1>\n <p className=\"title-container__subtitle\"> Helps you find weather conditions in cities... </p>\n </div>\n )\n }", "render(){return renderNotImplemented;}", "onRender()/*: void*/ {\n this.render();\n }", "render() {\n\t\treturn <div>{this.renderContent()}</div>;\n\t}", "render() {\n return renderNotImplemented;\n }", "render() {\n return renderNotImplemented;\n }", "render()\n {\n return super.render();\n }", "render() {\n return <div className=\"border red\">{this.renderContent()}</div>;\n }", "render() {\n return <div className=\"border red\">{this.helperrender()}</div>\n }", "render( ) {\n return null;\n }", "render() {\n return super.render();\n }", "render() {\n return super.render();\n }", "render() {\n return super.render();\n }", "render() {\n return super.render();\n }", "render() { this.screen.render() }", "_render()\n {\n if (this.isDisabled())\n return;\n\n this._setContentSizeCss();\n this._setDirection();\n const paragraph = html`<p>${this.text}</p>`;\n let anchor = \"\";\n let action = \"\";\n if (this.link && this.linkText)\n anchor = html`<a href=\"${this.link}\" target=\"_blank\">${this.linkText}</a>`;\n if (this.action && this.actionText)\n action = html`${anchor ? \" | \" : \"\"}<a href=\"javascript:void(0)\" @click=${this.action}>${this.actionText}</a>`;\n let heading = \"\";\n if (this.heading)\n heading = html`<h4>${this.heading}</h4>`;\n\n render(html`${heading}${paragraph}<div id=\"links\">${anchor}${action}</div>`, this.tooltipElem);\n }", "function Renderer() {\n}", "render() {\n return <div>{this.toRender()}</div>;\n }", "function Renderer() {}", "render(className, textContent) {\n this.node.className = className;\n this.node.textContent = textContent;\n }", "render() {\r\n return (\r\n <div className=\"border red\">\r\n { this.renderContent() }\r\n </div>\r\n );\r\n }", "render() {\n\t\treturn(\n\t\t\t<div className=\"border red\">\n\t\t\t\t{this.renderContent()}\n\t\t\t</div>\n\t\t);\n\t}", "renderPage() {}", "render() {\n\t\treturn null;\n\t}", "render() {\n\n return (\n <div>\n {this.renderContent()}\n </div>\n );\n \n }", "function render() {\n renderRegistry();\n renderDirectory();\n renderOverride();\n}", "renderHTML() {\n \n }", "render() {\n if (!this.initialized) this.init();\n }", "init() {\n this.render();\n }", "init() {\n this.render();\n }", "render() {\n this.$el.addClass(this.className);\n\n return this;\n }", "renderScreenContent(){}", "render() {\n this._addChooserHandler();\n this._addLoggerListeners();\n this._addButtonHandler();\n }", "render() {\n const { name, code } = this.props\n return (\n <div>\n <h1>This is a Class Components</h1>\n <p>I am {name}, and I love {code}</p>\n </div>\n )\n }", "render() { // it is a function ==> render: function() {}\n return (<h1>Hello World!!!!!!!</h1>);\n }", "render() {\n return null;\n }", "render() {\n return null;\n }", "render() {\r\n return;\r\n }", "render(map)\n\t{\n\t\tthrow new Error(\"Not implemented\");\n\t}", "render() {\n return (\n <div className=\"border red\">\n {this.renderContent()}\n </div>\n );\n \n }", "function renderStaticView() {\n\t// Text for class view\n\tclassViewText();\n\n\t// Rect for line under title\n\t//classViewLine();\n\t// ORDER LEVEL and FAMILY LEVEL label\n\tstaticLabels();\n\t// Legend\n\t//legend();\n\t//incrementProgress();\n\tinstructions();\n}", "render() {\n\t\tthis.patch();\n\t}", "render() {\n this.update();\n }", "render() {\n // always reinit on render\n this.init();\n }", "render() {\n // always reinit on render\n this.init();\n }", "render() {\n return (\n <div className=\"border red\">\n {this.renderContent()}\n </div>\n )\n }", "render() {\n return (\n <div className=\"red-border\">\n { this.renderContent() }\n </div>\n )\n }", "render() {\n return(\n <div className=\"border-red\">\n {this.renderContent()}\n </div>\n )\n\n }", "render(){return html``}", "render() {\n // we are calling the renderContent function\n // we are always calling the blue border, that's why this is in render and not in the each component\n // the border blue class doesn't exist, just for show\n return <div className=\"border blue\">{this.renderContent()}</div>;\n }", "render() {\n return (\n <div className=\"border red\">\n {this.renderHelper()}\n </div>\n );\n }", "render() {\n if (this.state.error) {\n return this.renderError();\n }\n else if (this.state.showResult) {\n return this.renderResult();\n } else {\n return this.renderNormal();\n }\n }", "constructor() {\n super();\n this.renderCoreStyles();\n this.render();\n }", "render() {\n return (\n <div className = \"border red\">\n {this.renderContent()}\n </div>\n );\n }", "render() {\n return(\n <div className=\"border red\">\n {this.renderContent()}\n </div> \n );\n }", "render() {\n if (!this.initialized) {\n this.init();\n }\n }", "render() {\n return (\n <div className=\"border-red\">\n {this.renderContent()}\n </div>\n );\n }", "function render() {\n\n // Call the Character instance's renderAt() method, passing along its current\n // left and top position\n _character.renderAt(_character.left, _character.top);\n }", "initialize() {\n this.render();\n }" ]
[ "0.7767173", "0.7764078", "0.7739819", "0.77194345", "0.77194345", "0.76358885", "0.7520294", "0.7472425", "0.7446513", "0.7446513", "0.7402744", "0.73226756", "0.73226756", "0.73226756", "0.7318832", "0.72957635", "0.7272895", "0.7265707", "0.7265707", "0.726139", "0.726139", "0.7243186", "0.72319555", "0.72281593", "0.71892965", "0.7176506", "0.71085787", "0.70993507", "0.7070841", "0.70636237", "0.70636237", "0.70636237", "0.7051728", "0.7051728", "0.70277095", "0.7009536", "0.70037085", "0.69807976", "0.6921489", "0.6921489", "0.69145316", "0.68919635", "0.68487704", "0.68465686", "0.682885", "0.6785427", "0.6771942", "0.6771942", "0.6736545", "0.67318344", "0.67077637", "0.6706208", "0.67053396", "0.67053396", "0.67053396", "0.67053396", "0.6700267", "0.6614444", "0.66053885", "0.65772223", "0.6577194", "0.6545942", "0.65285796", "0.651715", "0.65133566", "0.65043193", "0.6494233", "0.64863175", "0.64801824", "0.6475982", "0.645454", "0.645454", "0.6439467", "0.6438687", "0.64293176", "0.6408947", "0.6384795", "0.63831055", "0.63831055", "0.6380825", "0.6379558", "0.63660884", "0.63643926", "0.6344212", "0.6341444", "0.6331926", "0.6331926", "0.63304865", "0.6320599", "0.63119334", "0.63090074", "0.630679", "0.6304893", "0.63013875", "0.629303", "0.627123", "0.62557673", "0.622399", "0.6214305", "0.62134486", "0.62107694" ]
0.0
-1
Delete the images from the server's directories when a review is deleted
function deleteImages(restaurant, images) { const directory = `./public/images/restaurants/${restaurant}/`; for (const image of images) { const imagePath = directory + image; console.log(`Deleting ${imagePath}`); fs.unlinkSync(imagePath); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function cleanupImages() {\n let experiments = await Experiment.findAll({\n include: [{\n model: Image,\n as: 'images'\n }]\n })\n\n let filenames = []\n for (let experiment of experiments) {\n for (let image of experiment.images) {\n let url = image.dataValues.url\n filenames.push('files/' + url.slice(6, url.length))\n }\n }\n\n for (let expDir of fs.readdirSync('files')) {\n if (!util.isStringInStringList(expDir, filenames)) {\n await rimraf('files/' + expDir)\n console.log('> Models.cleanupOrphanedImageFiles deleted dir', expDir)\n }\n }\n}", "function deleteStoredImages() {\n let storageRef = storage.ref();\n for (var i = 0; i < imageURLs.length; i++)\n deleteRef = imageURLs[i].replace(\"https://firebasestorage.googleapis.com/v0/b/greenquest-\"\n + \"5f80c.appspot.com/o/images%2Fquests%2F\", \"\");\n deleteRef = deleteRef.substr(0, deleteRef.indexOf(\"?\"));\n deleteRef = storageRef.child(\"images/quests/\" + deleteRef);\n deleteRef.delete()\n .then(() => {\n console.log(\"Processed image successfully removed from storage!\");\n })\n .catch((error) => {\n console.error(\"Error removing processed image from storage: \", error);\n });\n}", "removePresentationDir(req, res) {\r\n const userId = req.params.userid;\r\n const presentationId = req.params.presentationid;\r\n const filePath = path.join(__dirname, '/imageLibrary',\r\n `/user-${stringManipulation.sixPad(userId)}`,\r\n `presentation-${stringManipulation.sixPad(presentationId)}`)\r\n fs.rmdir(filePath, (err) => {\r\n if (err) {\r\n res.status(400).send(err);\r\n } else {\r\n res.status(200).json(\"Presentation is now gone.\");\r\n }\r\n });\r\n }", "function deleteImageOnServer(imagePath){\n fs.unlink(imagePath,(err)=>{\n if(err){\n console.log(err);\n return;\n } \n console.log(\"Image\" + imagePath + \"successfully removed from server\");\n });\n}", "function cleanImages() {\n return del([\n 'src/public/images/dist'\n ])\n}", "function Delete_Image() {\n //try to delete the file (image)\n //success = delete_helper.Delete_Image_File(image_files_in_dir[image_index-1])\n success = delete_helper_IDB.Delete_Image_File(image_files_in_dir[image_index-1])\n if(success == 1){\n Refresh_File_List()\n tagging_view_annotate.Meme_View_Fill(image_files_in_dir)\n //refresh the image view to the next image (which is by defaul the 'next' +1)\n New_Image_Display( 0 ) \n //perform the house cleaning for the image references in the DB and the rest of the annotations\n //delete_helper.Image_Delete_From_DB_And_MemeRefs() \n }\n}", "function eraseLocalImages(){\n\tvar characterizedImagesPath = appDataPath + \"\\\\characterized-images\";\n\tvar relativeImageFilePaths = jetpack.find(characterizedImagesPath, {files: true, matching: \"*.png\" } );\n\t//Erase images one by one\n\trelativeImageFilePaths.forEach( (path) =>{\n\t\tjetpack.remove(path);\n\t});\n}", "function del() {\n\t\tif( $( '#img' ).data( 'pngPath' ) !== undefined ) {\n\t\t\t$.post( \"delete.php\", { path: $( '#img' ).data( 'path' ), pngPath : $( '#img' ).data( 'pngPath' ) } ); \n\t\t}\n\t\telse {\n\t\t\t$.post( \"delete.php\", { path: $( '#img' ).data( 'path' ) } ); \n\t\t}\n\t}", "async function deleteImages(filename) {\n const fileUri = imageSettings.fileUri;\n const directory = imageSettings.directory;\n const dirPath = `${fileUri}/${directory}`;\n const files = fs.readdirSync(dirPath);\n\n files.forEach(function (name) {\n if (name.startsWith(filename)) {\n try {\n const filePath = dirPath + \"/\" + name;\n console.log(\"filePath: \", filePath);\n fs.unlinkSync(filePath);\n //file removed\n } catch (err) {\n console.error(err);\n }\n } else {\n console.log(\"don't delete: \", name);\n }\n });\n}", "function deleteReview(req, res, next) {\n // Note the cool \"dot\" syntax to query on the property of a subdoc\n Photo.findOne({'reviews._id': req.params.id}).then(function(photo) {\n // Find the review subdoc using the id method on Mongoose arrays\n // https://mongoosejs.com/docs/subdocs.html\n const review = photo.reviews.id(req.params.id);\n // Ensure that the review was created by the logged in user\n if (!review.user.equals(req.user._id)) return res.redirect(`/photos/${photos._id}`);\n // Remove the review using the remove method of the subdoc\n review.remove();\n // Save the updated photo\n photo.save().then(function() {\n // Redirect back to the photo's show view\n res.redirect(`/photos/${photo._id}`);\n }).catch(function(err) {\n // Let Express display an error\n return next(err);\n });\n });\n}", "delete(req, res) {\n console.log('Delete Request is=====>');\n console.log(req.query);\n queryVars = req.query;\n Image.destroy({\n where: {\n id: queryVars.id\n }\n })\n .then(function (deletedRecords) {\n //if successfull, delete image from the file system tourcosts\n\n res.status(200).json(deletedRecords);\n })\n .catch(function (error){\n res.status(500).json(error);\n });\n }", "function deleteImage(image) {\n fs.unlink(image, (err) => {\n if (err) {\n console.log(err);\n } else {\n console.log(\"Imagem apagada\");\n }\n });\n}", "function imageDel(delList){\n //del zip file\n var delimg=\"file:///mnt/sdcard/imcmobile/\";\n for(i in delList){\n window.resolveLocalFileSystemURL(delimg+delList[i], onResolveSuccess, fail);\n }\n}", "function onDeleteAll() {\n\t\t$.get(url, function (response) {\n\t\t\tresponse.forEach(function (record) {\n\t\t\t\tvar newUrl = url + record._id;\n\t\t\t\t$.ajax({\n\t\t\t\t\turl: newUrl,\n\t\t\t\t\tmethod: 'DELETE'\n\t\t\t\t});\n\t\t\t});\n\t\t}, 'json');\n\t\t$imageUrl.val('');\n\t\t$imageCaption.val('');\n\t\t$gallery.html('');\n\t\t$gallery.hide();\n\t}", "cleanDrive() {\n let auth = this.auth;\n const drive = google.drive({ version: 'v3', auth });\n drive.files.list({\n includeRemoved: false,\n pageSize: 10,\n fields: 'nextPageToken, files(id, name)',\n }, (err, res) => {\n if (err) return console.log('The API returned an error: ' + err);\n const files = res.data.files;\n if (files.length) {\n console.log('Deleting files...');\n files.map((file) => {\n drive.files.delete({\n 'fileId': file.id\n }).then(delRes => {\n console.log(`${file.name} (${file.id})`);\n });\n });\n this.db.collection(\"filesCollection\").drop();\n console.log('Database cleaned');\n } else {\n console.log('No files found.');\n }\n });\n \n }", "function deleteMedias(){\n imagesToRemove = []\n console.log(\"BORRANDO\")\n $.couch.urlPrefix = \"https://socpa.cloudant.com\";\n $.couch.login({\n name: \"socpa\",\n password: \"asdargonnijao\"\n });\n\n return $.couch.db(\"media\").view(\"todelete/todelete\", {\n key: canvas_id,\n reduce: false,\n success: function(data) {\n\n },\n error: function(status) {\n console.log(status);\n }\n\n })\n}", "deleteFile(url){\n const file = url.split(env.files.uploadsUrl)[1]\n if(file != 'system/default.png'){\n fs.unlinkSync(env.files.uploadsPath+file)\n }\n }", "function removeReplyImage(reply) {\n let files = []\n\n if(reply && reply.file) {\n files.push(reply.file)\n\n //takes an array of files\n cloud.remove(files)\n }\n}", "function clean_img() {\n return del('./dist/img/');\n}", "function deleteImage() {\n firebase.database().ref('sessions/' + sessionName + \"/image\").remove();\n}", "function deleteFolderOfImages(project_id) {\n const listObjectsParams = {\n Bucket: process.env.AWS_BUCKET_NAME,\n Prefix: `${project_id}/`,\n };\n s3.listObjects(listObjectsParams, (err, data) => {\n\n const deleteObjectsParams = {\n Bucket: process.env.AWS_BUCKET_NAME,\n Delete: { Objects: [] },\n };\n for (const content of data.Contents) {\n deleteObjectsParams.Delete.Objects.push({ Key: content.Key });\n }\n s3.deleteObjects(deleteObjectsParams, () => {});\n });\n}", "function deleteItem() {\n deleteImage(localStorage.getItem(currentImageId), currentImageId)\n}", "function flushUploads() {\n fs.readdir('course-data/uploads', (err, files) => {\n if (err) throw err;\n\n for (const file of files) {\n fs.unlink(path.join('course-data/uploads', file), err => {\n if (err) throw err;\n });\n }\n });\n}", "function deleteImage(url, id) {\n if (window.confirm(Dictionary.areYouSure)) {\n (document.getElementById(\"renderPreview\" + id)).remove();\n storage.refFromURL(url).delete().then(function () { }).catch(function (error) { console.log(error); alert(\"delete faild\"); });\n }\n}", "function deleteImage(fileName, folderName) {\n\tvar imageDir = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, folderName);\n\t\n\tif (imageDir.exists()) {\t\t\n\t\t// .resolve() provides the resolved native path for the directory.\n\t\tvar imageFile = Ti.Filesystem.getFile(imageDir.resolve(), fileName);\n\t\tif (imageFile.exists()) {\n\t\t\timageFile.deleteFile();\n\t\t}\n\t}\n}", "function deleteProgressImages(progressId,filename,id,keys) {\n\t\tif (keys > 1) {\n\t // Create a reference to the file to delete\n\t\tvar desertRef = progressStorageRef.child(`${UID}/${queryString}/${progressId}/${filename}`);\n\t\t// Delete the file\n\t\tdesertRef.delete().then(() => {\n\t\t\tprogressAddonImages.child(progressId).child(id).remove();\n\t\t\tfetchProgress(queryString);\n\t\t\tselectProgressImages(progressId);\n\t\t // File deleted successfully\n\t\t}).catch((error) => {\n\t\t // Uh-oh, an error occurred!\n\t\t alert(\"Remove image failed: \" + error.message);\n\t\t});\n\t} else {\n\t\talert(\"Image unable to delete.\")\n\t}\n}", "function deleteFromCloud(image) {\n if (image) {\n const id = path.parse(image);\n cloudinary.api.delete_resources([id.name], function (result) {\n console.log(result);\n });\n }\n}", "function deleteFile (imageUrl) {\n if (!imageUrl) return\n // Recherche du nom du fichier de l'image\n const filename = imageUrl.split('/images/')[1]\n // Utilisation de 'file system' pour supprimer le fichier du dossier 'images'\n fs.unlink(`images/${filename}`, () => {})\n}", "function clean(cb) {\n rimraf(DIST + '/img', cb);\n}", "async function removeEnterpriseImages (markdownImageData, directoryImageList, assetsReferencedInNonContentDirs, directory) {\n const directoryVersion = directory.split('/').pop()\n for (const directoryImage of directoryImageList) {\n // get the asset's format that is stored in the markdownImageData object\n const imageDataKey = directoryImage.replace(directory, '')\n\n // if the image is in a non content file (i.e., javascript or data file)\n // we don't have the page version info so assume it's used in all versions\n if (assetsReferencedInNonContentDirs.includes(imageDataKey)) continue\n\n const imageFullPath = path.join(process.cwd(), directoryImage)\n const imageVersions = markdownImageData[imageDataKey]\n\n // if the asset isn't referenced in Markdown at all, remove it\n if (markdownImageData[imageDataKey] === undefined) {\n fs.unlinkSync(imageFullPath)\n continue\n }\n\n // if the asset is in Markdown but is not used on GitHub AE pages, remove it\n if (directoryVersion === 'github-ae' &&\n !Object.prototype.hasOwnProperty.call(imageVersions, 'github-ae')) {\n fs.unlinkSync(imageFullPath)\n continue\n // if the asset is in Markdown but is not used on a page versioned for the\n // directoryVersion (i.e., GHES release number), remove it\n }\n if (directoryVersion !== 'github-ae' &&\n !Object.prototype.hasOwnProperty.call(imageVersions, 'enterprise-server')) {\n fs.unlinkSync(imageFullPath)\n continue\n }\n if (directoryVersion !== 'github-ae' && semver.lt(\n semver.coerce(directoryVersion),\n semver.coerce(imageVersions['enterprise-server'].replace('*', 0.0)))) {\n fs.unlinkSync(imageFullPath)\n }\n }\n}", "function removeImage(id){\n return db('images')\n .where({ id })\n .del();\n}", "deleteImage() {\n const { image } = this.props.route.params;\n var imgRef = firebase.storage().refFromURL(image.downloadURL);\n imgRef.delete().then(() => {\n this.deleteRefFromFirestore();\n this.props.navigation.goBack(\"My Images\");\n }).catch(() => {\n Alert.alert(\"Could Not Delete\", \"There was an error deleting this image. Please Try again.\");\n });\n }", "async destroy({ params, request, response }) {\n const category = await Category.find(params.id);\n const oldCategory = category;\n if (!category) {\n return response.status(404).json({ status: 0 });\n }\n\n const oldPicture = Helpers.publicPath(\"uploads\") + \"/\" + category.cover;\n fs.unlink(oldPicture, function(err) {\n if (err) response.status(400).json({ status: 0, error: err });\n });\n\n await category.delete();\n return response.status(200).json({\n status: 1,\n data: oldCategory\n });\n }", "static async removeUserImages(userId) {\n // Find the user profile images\n const profilePics = fs\n .readdirSync(`${process.env.FILE_UPLOAD_PATH}/avatars/`)\n .filter((file) => file.startsWith(`${userId}`));\n\n // Remove user's profile images\n if (profilePics.length !== 0) {\n for (let i = 0; i < profilePics.length; i++) {\n await fs.promises.unlink(\n `${process.env.FILE_UPLOAD_PATH}/avatars/${profilePics[i]}`\n );\n }\n }\n\n // Find the user background images\n const backgroundPics = fs\n .readdirSync(`${process.env.FILE_UPLOAD_PATH}/backgrounds/`)\n .filter((file) => file.startsWith(`${userId}`));\n\n // Remove user's background images\n if (backgroundPics.length !== 0) {\n for (let j = 0; j < backgroundPics.length; j++) {\n await fs.promises.unlink(\n `${process.env.FILE_UPLOAD_PATH}/backgrounds/${backgroundPics[j]}`\n );\n }\n }\n }", "function deletePhoto(){\n\tvar answer = confirm(\"Are you sure? Deletion is Permanent!\")\n\tif(answer){\n\t\tvar url = \"servlet/delete/\" + imgSrc\n\t\treq = new XMLHttpRequest();\n\t\treq.open(\"GET\",url,true);\n\t\treq.onreadystatechange = function(){\n\t\t\tif(req.readyState == 4){\n\t\t\t\twindow.location = \"browse.html\";\n\t\t\t}\n\t\t\n\t\t}\n\t\treq.send(null);\n\t}\n}", "delete({review}, res) {\n\t\treview.remove((err, review) => {\n\t\t\tres.status(200);\n\t\t\tres.json(review);\n\t\t});\n\t}", "function runCleanImg(cb) {\n del(global.getDest('img'), cb);\n}", "function delpic(filename)\n{\n\tvar radioid\t= filename.replace('|@SEP@|', '');\n\tvar radiolength\t= $('input[name=rdo_main_pic]').length;\n\tvar selectedIndex\t= $('input[name=rdo_main_pic]:checked').index('input[name=rdo_main_pic]') ;\n\t\n\tif(radiolength > 1)\n\t{\n\t\tif(selectedIndex==0)\n\t\t{\n\t\t\tselectedIndex\t=\t1;\n\t\t}\n\t\telse\n\t\t\tselectedIndex\t= selectedIndex-1;\n\t}\n\t\n\tvar status\t= $('#status');\n\tvar btnuplad = $('#btn_upload');\n\tvar delAJAXurl = base_url +'newsfeed/delete_tmp_image_AJAX/'+ filename.replace('|@SEP@|', '/') + '/extraparam/';\n\t\n\t$.get(delAJAXurl, function(msg){\n\t\t\t\t\t\t\t \n\t\tif(msg === 'ok')\n\t\t{\n\t\t\t//selectedIndex\t= selectedIndex-1;\n\t\t\tif(selectedIndex!= -1)\n\t\t\t{\n\t\t\t\t$('input[name=rdo_main_pic]:eq('+selectedIndex+')').attr('checked', 'checked');\n\t\t\t}\n\t\t\t\n\t\t\t$(\"#div\"+filename.replace('|@SEP@|','')).remove();\t\n\t\t\t$(\"#hid_\"+filename.replace('|@SEP@|','')).remove();\n\t\t\t\n\t\t\t//search_for_other();\n\t\t\t\n\t\t\tstatus.html('<div class=\"ok_msg\">Image deleted successfully ...</div>');\n\t\t\tbtnuplad.show();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tstatus.attr('class', 'ok');\n\t\t\tstatus.html('<div class=\"err_msg\">Image cannot be deleted!</div>');\n\t\t}\n\t});\n}", "async function deleteImageURL(imageURL) {\n await ImageStore.deleteImage(imageURL[1]);\n }", "function deleteLocalPicture() {\n\tfs.unlink(__dirname + '/pics/cam.jpg', function (err) {\n\t if (err)\n\t {\n\t\tconsole.log('Error while trying to delete: ' + err) \n\t }\n\t else \n\t {\n\t \tconsole.log('Successfully deleted previous picture.');\n\t }\n\t});\n}", "function handleReviewDelete() {\n var currentReview = $(this)\n .parent()\n .parent()\n .data(\"review\");\n deletePost(currentReview.id);\n }", "function deleteAll() {\n\n\t\tlet l = storage(\"local\");\n\t\ttoServer(null, l.filename, \"erase\");\n\n\t\tlocalStorage.removeItem(\"paste\");\n\t\tsessionStorage.removeItem(\"paste\");\n\n\t\tlocation.replace(\"index.html\");\n\t}", "removePictureAndDescription(req, res) {\n const pictureId = req.params.pictureId;\n EmergencyStatusDetail.removePictureAndDescription(pictureId)\n .then((result) => {\n const path = result.picture_path;\n fs.unlink(path, (err) => {\n /* istanbul ignore next */\n if (err) {\n console.error(err);\n }\n });\n res.contentType('application/json');\n return res.status(201).send(JSON.stringify(result));\n /* istanbul ignore next */\n }).catch((err) => {\n /* istanbul ignore next */\n return res.status(500).send(err);\n });\n }", "async function testGetStepImages_savesFiles() {\n let api = await getGoogleApiClient();\n let filePath = await api.saveStepImage('5fb5bee7.Photo1.132604.jpg', '05d8fd63').catch(error => console.log('GOOGLE API RESPONSE ERROR: ' + error));\n await deletePhotoFile(filePath);\n}", "function cleanFaviconsDir() {\n return del([faviconsPath+'*', faviconsTemplate]);\n }", "function deletePhoto(event) {\n let reqDB = indexedDB.open('photos', 1);\n reqDB.onsuccess = function (e) {\n let db = e.target.result;\n\n // получаем ключ записи\n const id = event.target.getAttribute('id')\n // открываем транзакцию чтения/записи БД, готовую к удалению данных\n const tx = db.transaction(['cachedForms'], 'readwrite');\n // описываем обработчики на завершение транзакции\n tx.oncomplete = () => {\n console.log('Transaction completed. Photo deleted')\n getAndDisplayImg();\n };\n tx.onerror = function (event) {\n alert('error in cursor request ' + event.target.errorCode);\n };\n\n // создаем хранилище объектов по транзакции\n const store = tx.objectStore('cachedForms');\n // выполняем запрос на удаление указанной записи из хранилища объектов\n let req = store.delete(+id);\n\n req.onsuccess = () => {\n\n //удалить это фото из всех localStorage tag\n if (localStorage.getItem('tags') !== null) {\n let tags = JSON.parse(localStorage.getItem('tags'))\n tags = tags.map(tagObj => {\n return {...tagObj, images: tagObj.images.filter(imgId => imgId !== +id)}\n })\n tags = JSON.stringify(tags)\n localStorage.setItem('tags', tags)\n }\n\n // обрабатываем успех нашего запроса на удаление\n console.log('Delete request successful');\n };\n document.querySelector('.container2').remove()\n };\n }", "async removeImage(id) {\n let filename = this._formatFilename(id);\n\n await fs.unlink(filename);\n }", "function deleteImg(e) {\n const img = e.nextElementSibling;\n const options = {\n method: 'DELETE',\n headers: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': 'application/json',\n 'Access-Control-Allow-Origin': '*'\n },\n\n body: JSON.stringify({\n id: img.id\n })\n }\n\n api('/gallery', options, (err, result) => {\n if (err) {\n console.log(err);\n }\n })\n}", "async function remove(req, res, next) {\n const { mobile } = req.user;\n const { id } = req.params;\n Post.destroy({ where: { id, mobile } })\n .then(async () => {\n await emptyS3Directory(mobile, id);\n res.json(httpStatus[\"204_MESSAGE\"]);\n })\n .catch((err) => next(err));\n}", "function delete_storage(){\n\tsimact.Algebrite.run(\"clearall\");\n\tfilloutputarea();\n}", "function deleteRemovedImages(request_json) {\n return new Promise(function(resolve, reject) {\n $.ajax({\n type: REQUEST_TYPE_DELETE,\n url: URL_ARTICLE_REPRESENTATIONS,\n data: JSON.stringify(request_json),\n contentType: \"application/json; charset=utf-8\",\n dataType: \"json\"\n }).done(function(data) {\n resolve(data);\n }).fail(function(error) {\n reject(processError(error));\n });\n });\n}", "function removeDownloads(){\n fs.unlinkSync(\"./download/Default Sample File.zip\");\n fsExtra.emptyDirSync(\"./extracted\");\n}", "removeAllImages() {\n this.images = [];\n this.image_key = 0;\n }", "function deleteImageFromPhotoCont(e) {\n var index = -1;\n var target = e.target;\n if (target.className == \"button_3\") {\n var imgblock = target.parentNode;\n var imgblocks = gId('photo_cont').getElementsByClassName(\"img_block\");\n for (var i = 0; i < imgblocks.length; i++) {\n if (imgblocks[i] == imgblock) {\n index = i; // define index of our image\n }\n }\n gId('photo_cont').removeChild(imgblock);\n Images.splice(index, 1); //delete image from array Images[] that will be uploaded.\n }\n}", "function deletePhoto() {\n $scope.work.email = $rootScope.email;\n $scope.menuOpened = 'closed';\n if(confirm('Delete this photo?')){\n $scope.work.src = ''; \n }\n //$state.reload();\n }", "function deletePhotoPost(req,res)\r\n{\r\n\tvar pathFoto= req.body.link;\r\n\tvar file_path= pathFoto;\r\n\tvar file_split= file_path.split('/');\r\n\tvar file_name=file_split[4];\r\n\r\n\tPhoto.findOne({name: file_name}, (err, fotoFind)=>{\r\n\t\tif(err)\r\n\t\t{\r\n\t\t\tres.status(500).send({message:'Error al intentar buscar la foto deseada para eliminarla.'});\r\n\t\t}\r\n\t\telse{\r\n\t\t\tif(!fotoFind)\r\n\t\t\t{\r\n\t\t\t\tres.status(500).send({message:'No existe el nombre de la foto a eliminar. No se puede borrar ninguna foto.'});\r\n\t\t\t}\r\n\t\t\telse{\r\n\r\n\t\t\t\t//Eliminamos la foto en la base de datos.\r\n\t\t\t\tPhoto.findByIdAndRemove(fotoFind._id, (err, fotoRemoved) =>{\r\n\t\t\t\t\tif(err){\r\n\t\t\t\t\t\tres.status(500).send({message:'Error al intentar eliminar la foto'});\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tif(!fotoRemoved)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tres.status(500).send({message:'No existe el ID de la foto a eliminar. No se ha borrado ninguna foto.'});\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\t\r\n\r\n\t\t\t\t //Eliminamos fisicamente la foto en el servidor.\r\n\t\t\t\t var path_file = './public/post/'+file_name;\r\n\t\t\t\t var ruta=path.resolve(path_file);\r\n\t\t\t\t //console.log(ruta);\r\n\r\n\t\t\t\t fs.exists(path_file,function(exists){\r\n\t\t\t\t\t\t\t\tif(exists){\r\n\t\t\t\t\t\t\t\t\t//Objeto path para acceder a rutas de nuestro sistema de archivos. Me devolverá el archivo\r\n\t\t\t\t\t\t\t\t\t//Se elimina la foto fisica\r\n\t\t\t\t\t\t\t\t\tfs.unlink(ruta, (err)=>{\r\n\t\t\t\t\t\t\t\t\t\tif(err){\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tres.status(500).send({message: 'Ha ocurrido un problema al borrar la foto.'});\t\t\r\n\t\t\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\t\t\tres.status(200).send({foto: fotoRemoved});\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\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\t\tres.status(404).send({\r\n\t\t\t\t\t\t\t\t\t\tmessage: 'La imagen no existe'\r\n\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});\r\n\t\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});\r\n\t\t\t}\r\n\t\t}\r\n\t});\t\r\n\r\n}", "function dbDeleteImage(fileId, folderName, fileName) {\n var authedUser, uid;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function dbDeleteImage$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n _context3.next = 2;\n return Object(redux_saga_effects__WEBPACK_IMPORTED_MODULE_12__[\"select\"])(_store_reducers_authorize__WEBPACK_IMPORTED_MODULE_21__[\"authorizeSelector\"].getAuthedUser);\n\n case 2:\n authedUser = _context3.sent;\n uid = authedUser.get('uid');\n\n if (!uid) {\n _context3.next = 16;\n break;\n }\n\n _context3.prev = 5;\n _context3.next = 8;\n return Object(redux_saga_effects__WEBPACK_IMPORTED_MODULE_12__[\"call\"])(galleryService.deleteFile, uid, fileId, folderName);\n\n case 8:\n _context3.next = 10;\n return Object(redux_saga_effects__WEBPACK_IMPORTED_MODULE_12__[\"put\"])(_store_actions_imageGalleryActions__WEBPACK_IMPORTED_MODULE_17__[\"deleteImage\"](fileId));\n\n case 10:\n _context3.next = 16;\n break;\n\n case 12:\n _context3.prev = 12;\n _context3.t0 = _context3[\"catch\"](5);\n _context3.next = 16;\n return Object(redux_saga_effects__WEBPACK_IMPORTED_MODULE_12__[\"put\"])(_store_actions_globalActions__WEBPACK_IMPORTED_MODULE_16__[\"showMessage\"](_context3.t0.message));\n\n case 16:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _marked3, null, [[5, 12]]);\n}", "deleteRefFromFirestore() {\n const { image } = this.props.route.params;\n firebase.firestore()\n .collection('users')\n .doc(firebase.auth().currentUser.uid)\n .collection(\"images\")\n .where('downloadURL', '==', image.downloadURL)\n .get()\n .then((snapshot) => {\n snapshot.forEach((doc) => {\n doc.ref.delete();\n });\n }).catch((error) => console.log(error));\n }", "async function deleteUrlImages(urls) {\n // console.log(\"deleteUrlImages: \", urls);\n // for (const index in urls) {\n // const url = urls[index];\n // const bucket = storage.bucket(bucketName);\n // const fullname = url.split(\"/\").pop();\n // const filename = fullname.substr(0, fullname.lastIndexOf(\".\"));\n // await deleteFile(filename);\n // }\n // return true;\n}", "function deleteReview(req, res, next) {\n reviewService\n .remove(req.params.id)\n .then(() =>\n res.status(200).json({\n message: 'Review deleted successfully',\n })\n )\n .catch((err) => next(err))\n }", "async function removeFiles(arr){\r\n try {\r\n arr.forEach((file) => {\r\n fs.unlink(`./public/uploads/${file.name}`, (err) => {\r\n if (err) throw err;\r\n })\r\n File.findByIdAndDelete({ _id: file._id }, (err) => {\r\n if (err) throw err;\r\n })\r\n });\r\n } catch (error) {\r\n console.log(error) \r\n }\r\n}", "async purgeImages() {\n if (!this._maxImages) return;\n\n await this._withDb(async (db) => {\n // We cannot use this.getCount because it uses a new connection\n // from the connection pool, so it will not work while we are\n // performing a transaction.\n let getCount = async () => (await db.get(\n 'SELECT COUNT(id) FROM images WHERE NOT DELETED'\n ))['COUNT(id)'];\n\n while (await getCount() > this._maxImages) {\n let id = (await db.get(\n 'SELECT id FROM images WHERE NOT DELETED ORDER BY id ASC'\n ))['id'];\n\n this.deleteImage(id, db);\n }\n }, true);\n }", "function deletePreviewImg(mediaId){\n $(\"img.preview-image[target='\" + mediaId +\"']\").remove();\n}", "function removeTemporaryFiles() {\n \n if (isIOS()) {\n \n // Currently camera.cleanup() seems not to remove files on iPad, iOS 5 and 6 (though onSuccess() function is called, \n // as well as in the case of other PhoneGap file-remove operations).\n // Temporary directory is removed on application exit (e.g. on device switch off).\n //\n // navigator.camera.cleanup(onSuccess, onError); \n }\n \n function onSuccess() { }\n function onError(message) { }\n}", "async function removeUnusedDotcomImages (markdownImageData, directoryImageList, assetsReferencedInNonContentDirs) {\n for (const directoryImage of directoryImageList) {\n if (ignoreList.find(ignored => directoryImage.startsWith(ignored))) continue\n\n // if the image is in a non content file (i.e., javascript or data file)\n // we don't have the page version info so assume it's used in all versions\n if (assetsReferencedInNonContentDirs.includes(directoryImage)) continue\n\n if (markdownImageData[directoryImage] === undefined) {\n fs.unlinkSync(path.join(process.cwd(), directoryImage))\n }\n }\n}", "function clean(){\n\t\twrench.rmdirRecursive( __dirname + '/docs/', function(){\n\t\t\tmsg('docs deleted');\n\t\t});\n\t}", "function destroy (id) {\n // find record\n image.findById(id, function (err, image) {\n if(err) { console.log (err); }\n else if (image.remove) {\n // delete record\n image.remove(function(err) {\n if(err) { console.log (err); }\n });\n }\n });\n}", "function reset(cb) {\n\tdel( 'build/**/*' ).then( function( paths ) {\n\t\tconsole.log( 'Deleted files and folders:\\n', paths.join( '\\n' ) );\n\t});\n\tcb();\n}", "function DeleteFilesInStaticDirectory() {\n const directory = rootPath + \"/static\";\n fs.readdir(directory, (err, files) => {\n if (err) throw err;\n\n if (files.length > 0) {\n files.forEach((file) => {\n\t\t\t\tfs.unlink(pathJoiner.join(directory, file), err => {\n\t\t\t\t\tif (err) throw err;\n\t\t\t\t\tconsole.log(`${file} deleted.`);\n\t\t\t\t});\n\t\t\t});\n\t\t\t// Disable the button and change the caption\n\t\t\treturn true;\n\t\t\n\n } else {\n\t\t\tconsole.log(`no files to delete`);\n\t\t\treturn false;\n }\n });\n}", "function onDelete() {\n setFileURL(false)\n console.log(\"delete file\");\n }", "async function deleteImage(id) {\n const confirm = window.confirm('Are you sure you want to delete this image?')\n if (confirm) {\n try {\n await axios.delete(`/api/restaurants/delete-image/${id}`)\n let updatedImages = restaurant.images.filter(image => image.id !== id)\n setRestaurant({ ...restaurant, images: updatedImages })\n dispatch({ type: 'FlashMessage', value: 'Image deleted successfully!', color: 'success' })\n } catch (err) {\n dispatch({ type: 'FlashMessage', value: err.response.data, color: 'error' })\n }\n }\n }", "function deletePhotoBasedOnURL(imageURL, parentFolder) {\n // Index of the start point of the image name\n var startOfName = imageURL.indexOf(\"%2F\") + 3;\n\n // Index of the end point of the image name\n var endOfName = imageURL.indexOf(\"?\");\n\n // Image name\n let imageName = imageURL.substring(startOfName, endOfName);\n\n // Storage bucket\n var bucket = storage.bucket(\"hbtgram.appspot.com\");\n\n // Start deleting the found image\n bucket.deleteFiles(\n {\n prefix: `${parentFolder}/${imageName}`,\n },\n function (error) {\n if (!error) {\n // If there is no error, return 0\n return 0;\n } else {\n // If there is an error, return 1\n }\n }\n );\n}", "Delete() {\n log.config(\"Delete() called on folder \" + this.name);\n let msgDBService = Cc[\"@mozilla.org/msgDatabase/msgDBService;1\"]\n .getService(Ci.nsIMsgDBService);\n let database = msgDBService.cachedDBForFolder(this);\n if (database) {\n database.ForceClosed();\n this.msgDatabase = null;\n }\n\n let pathFile = this.filePath;\n let summaryFile = getSummaryFileLocation(pathFile);\n\n // Remove summary file.\n summaryFile.remove(false);\n\n // Delete fake mailbox\n pathFile.remove(false);\n\n // Clean up .sbd folder if it exists.\n addDirectorySeparator(pathFile);\n if (pathFile.exists() && pathFile.isDirectory())\n pathFile.remove(true);\n\n // Make sure this is gone in RDF (though this may cause issues during destruction)\n let rdf = Cc[\"@mozilla.org/rdf/rdf-service;1\"]\n .getService(Ci.nsIRDFService);\n rdf.UnregisterResource(this.cppBase.QueryInterface(Ci.nsIRDFResource));\n\n // null parent means an invalid folder.\n this.parent = null;\n }", "function deleteImage(deleteX){\n\tvar imageFilename = deleteX.imageFilename;\n\tdeleteX.addEventListener(\"click\", function(e){\n\t\t\n\t\t// Stop reload interval\n\t\tisIdle = false;\n\t\t\n\t\tvar deleteConfirm = confirm(\"Delete \" + imageFilename + \"?\");\n\t\t\n\t\t// Start reload interval\n\t\tisIdle = true;\n\t\t\n\t\tif(deleteConfirm == true){\n\t\t\te.stopPropagation();\n\t\t\te.preventDefault();\n\n\t\t\tvar deleteRequest = new_request();\n\t\t\tdeleteRequest.open(\"GET\", \"server.php\", true);\n\t\t\tdeleteRequest.setRequestHeader('COMMAND', \"Delete\");\n\t\t\tdeleteRequest.setRequestHeader('FILE_NAME', imageFilename);\n\t\t\tdeleteRequest.send(null);\n\n\t\t\tdeleteRequest.onreadystatechange = function () {\n\t\t\t\tif(deleteRequest.readyState == 4)\n\t\t\t\t{\n\t\t\t\t\tif(deleteRequest.status != 200)\n\t\t\t\t\t\talert(\"Error code = \" + new String(deleteRequest.status));\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// Get the return object and pares as JSON\n\t\t\t\t\t\tdatabaseObj = JSON.parse(deleteRequest.responseText);\n\t\t\t\t\t\t\n\t\t\t\t\t\tupdateAlbumTable();\n\t\t\t\t\t\tconsole.log(databaseObj[0]);\n\t\t\t\t\t\tconsole.log(\"Delete complete\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t} else {\n\t\t\t\n\t\t}\n\t}\n\t, false);\n}", "function deleteAltImgById(e, id) {\n $(e.currentTarget).parent('.pip').remove();\n $.ajax({\n method: 'POST',\n url: window.delete_alt_img_by_id,\n data: {\n _token: $('meta[name=\"csrf-token\"]').attr('content'),\n id: id,\n },\n success: function (result) {\n One.helpers('notify', {type: 'success', icon: 'fa fa-check mr-1', message: result})\n },\n });\n}", "function removeClicked()\n\t{\n\t\tvar i, els = getSelectedImages();\n\n\t\tfor (i = 0; i < els.length; i++) {\n\t\t\tremoveImageConstruct(els[i].id);\n\t\t\tdelete ImageStore[els[i].id];\n\n\t\t}\n\n\t\tif (els.length > 0) {\n\t\t\tenableImageButtons([Ids.DeleteAction, Ids.RotateLeftAction, Ids.RotateRightAction, Ids.CropAction, Ids.ClearAction], false);\n\t\t\tloadData(EmptyImageData);\n\t\t\tdisableAllImageControls();\n\t\t\tImageCount -= els.length;\n\t\t}\n\t\t\n\t\tif (ImageCount === 0) {\n\t\t\tYD.setStyle(Ids.DropHelp, 'display', 'block');\n\t\t\tYD.get(Ids.DropHelp).innerHTML = MsgDragPhotos;\n\t\t}\n\n\t\tdisplayImageDimensions();\n\t}", "deleteArticleImage(key)\n {\n let vm = this;\n\n if(vm.articleImages[key].pivot)\n {\n Api.http\n .delete(`/articles/${vm.article.id}/images/${vm.articleImages[key].id}`)\n .then(response => {\n if(response.status === 204)\n {\n vm.articleImages.splice(key, 1);\n Vue.toast('Article image detached successfully', {\n className: ['nau_toast', 'nau_success'],\n });\n }\n });\n }\n else\n {\n vm.articleImages.splice(key, 1);\n\n Vue.toast('Article image detached successfully', {\n className: ['nau_toast', 'nau_success'],\n });\n }\n }", "function deleteMultipleThumbs() {\n console.log (currentAlbum.images);\n\n //remove images in reverse order\n //the array selectedImgs is a sorted array (low - > high)\n //removing from currentAlbum array in reverse means elements acn be removed from the current AlbumArray\n //without breaking the relationship between the indices of the the currentAlbum array and the selectedImgs array\n for(var i=selectedImgs.length-1; i>=0; i--) {\n console.log(\"delete img \" + selectedImgs[i]);\n console.log( currentAlbum.images[selectedImgs[i]]);\n\n //delete image from the array of images\n currentAlbum.images.splice(selectedImgs[i],1);\n\n //remove the thumb from the DOM\n $('#thumb' + selectedImgs[i]).remove();\n\n\n }\n\n //console.log (currentAlbum.images);\n\n //have to redraw the image thumbs so that thumb0 corresponds to image zero in the currentAlbum Array\n createImageThumbs();\n\n //update the length of the album\n $(\"#numImages\").html(currentAlbum.images.length);\n\n\n //set slider values\n setSliderValues(slide, (currentAlbum.images.length-1), currentImgNum, currentAlbum.images[currentImgNum].time);\n\n //**********************************************************************************************************\n //********************* make server call to remove the image from the database *****************************\n //**********************************************************************************************************\n\n //clear the array of selected thumbs\n selectedImgs=[];\n\n }", "function clean(callback) {\n var folders = [\n path.join(config.paths.dest, '/'),\n path.join(config.paths.tmp, '/')\n ];\n\n del(folders, callback);\n}", "async deleteProduct(req, res, next) {\n console.log(\"inside delete function\");\n let document;\n try {\n document = await ProductDB.findOneAndDelete({ _id: req.params.id });\n // console.log(document.image);\n fs.unlink(document.image, (error) => {\n if (error) {\n return next(error);\n }\n });\n } catch (error) {\n return next(error);\n }\n res.json({ document });\n }", "function deletePhoto() {\n // If an operation is in progress, usually involving the server, don't do it.\n if (processing) { return false; }\n if (currentPhoto == null) {\n alert(\"Please select a photo first.\");\n return false;\n }\n // If photo happens to be growing, cut it short.\n snapImageToLandingPad();\n // Get the name of the selected collection, the filename of the current\n // photo, and verify deletion.\n var collectionName = parent.fraControl.document.getElementById(\n \"collectionsList\").value;\n var photoFilename = currentPhoto.getFilename();\n if (confirm(\"Are you sure you want to delete the current photo?\")) {\n // Show the please wait floatover.\n showPleaseWait();\n // Make AJAX call.\n dojo.io.bind({\n url: \"deletePhoto.action\",\n content: {collection: collectionName, filename: photoFilename},\n error: function(type, errObj) { alert(\"AJAX error!\"); },\n load: function(type, data, evt) {\n alert(data);\n hidePleaseWait();\n loadCollection();\n },\n mimetype: \"text/plain\",\n transport: \"XMLHTTPTransport\"\n });\n }\n}", "async delete(multistatus) {\n await util_1.promisify(fs_1.unlink)(this.fullPath);\n this.context.socketService.notifyRefresh(this.getParentPath(this.path));\n }", "function deleteImageFile(event) {\n\n let filename = event.target.getAttribute('data-filename');\n let ok = confirm('Are you sure you want to delete ' + filename + '?');\n\n if (ok === true) {\n\n let formData = new FormData();\n formData.append('filename', filename);\n\n fetch('/image/delete', {method: 'post', body: formData})\n .then(response => response.json())\n .then(data => {\n\n console.log(data.error);\n if (data.hasOwnProperty('error')) {\n alert(data.error);\n } else {\n loadImages();\n }\n }\n );\n }\n\n}", "function deleteImg() {\r\n let createImage = document.createElement('IMG');\r\n let el = document.getElementById('artist-img');\r\n el.parentNode.removeChild(el);\r\n console.log('img deleted');\r\n}", "function _deleteLogo() {\n if ($scope.logoImage.docName) {\n $scope.deleteLogoFlag = false;\n serverRequestService.deleteDocument($scope.logoImage.docName, $scope.logoImage._id).then(function() {\n $scope.logoImage = null;\n $scope.project.logoImageId = null;\n $scope.deleteLogoFlag = true;\n });\n }\n }", "cleanMemory() {\n if (this.state.files.length > 0) {\n this.state.files.map(file => URL.revokeObjectURL(file.preview));\n }\n }", "function deleteActiveUpload() {\n\t\t \t\tif(scope.activeImage) {\n\t\t \t\t\tuploadService.deleteUpload(scope.activeImage.blobKey);\n\t\t \t\t\tscope.activeImage = null;\t\n\t\t \t\t}\t\t \n\t\t \t}", "function cleanFiles(files) {\n files.forEach(file => {\n if (fs.existsSync(file.path)) {\n fs.unlink(file.path, err => {\n if (err) {\n console.error(\n `Failed to remove ${file.path} ($file.originalname) from a failed upload: ${err}.`\n )\n }\n })\n }\n })\n}", "clearImages() {\n this.images = [];\n }", "remove(imageSrc) {\n const currentGallery = this.get();\n\n // Remove image from storage if it is in there.\n const index = currentGallery.indexOf(imageSrc);\n if(index > -1) {\n currentGallery.splice(index, 1);\n this.set(currentGallery);\n }\n }", "function deleteItem(item) {\n console.log(item);\n Firebase.database().ref(`/items/${item}`).remove();\n\n var desertRef = storage.ref(`images/${item.image}`);\n\n // Delete the file\n desertRef\n .delete()\n .then(function () {\n // File deleted successfully\n })\n .catch(function (error) {\n // Uh-oh, an error occurred!\n });\n }", "async function deletePost() {\n try {\n history.push('/home');\n\n // delete image in storage\n const imageRef = storage.ref(`images/${post.image.imageName}`);\n await imageRef.delete();\n\n // delete post in firestore\n await postRef.delete();\n\n toast.success('Tweet deleted successfully', options);\n } catch (err) {\n console.error(err.message);\n toast.error('Error deleting tweet', options);\n }\n }", "function removeImages(x) {\n listImages.splice(x, 1);\n $('#badgeFoto').text(listImages.length);\n listaFotosAux();\n}", "function deleteReview(userReviewedId) {\n console.log(\"deleteReview() called \", userReviewedId);\n // Hide review div on front end\n hideElement(userReviewedId);\n addTextToDom(\"No reviews yet\", \"review-summary\");\n addTextToDom(\"N/A\", \"bd-price\");\n// $(\"#bd-price\").innerHTML = \"N/A\";\n resetSummaryStars();\n // Query 'businessDetails' using businessId and get usersReviewed. Remove uid. Update collection\n var removeUserFromUsersReviewed = (doc) => {\n if (doc.exists) {\n // Remove user from usersReviewed list\n usersReviewedList = doc.data().usersReviewed;\n if (usersReviewedList.length > 0) {\n removeArrayElement(uid, usersReviewedList);\n updateDocumentUsingDocId(\"businessDetails\", businessId, {\"usersReviewed\": usersReviewedList});\n // Read summary ratings\n var sumStarRatings = doc.data().sumStarRatings;\n var numStarRatings = doc.data().numStarRatings;\n var sumPriceRatings = doc.data().sumPriceRatings;\n var numPriceRatings = doc.data().numPriceRatings;\n // Access reviews collection and get old star rating / price rating\n var getOldStarAndPriceRating = () => {\n var oldStarRating = doc.data().oldStarRating;\n var oldPriceRating = doc.data().priceRating;\n // Update summary ratings\n subtractSummaryRatings(oldStarRating, oldPriceRating, sumStarRatings, numStarRatings, sumPriceRatings, numPriceRatings);\n }\n getDocByDocId(\"reviews\", userReviewedId, getOldStarAndPriceRating);\n }\n } else {\n console.log(\"Document doesn't exist\");\n }\n }\n getDocByDocId(\"businessDetails\", userReviewedId, removeUserFromUsersReviewed);\n // Delete doc from 'reviews' using uid (or userReviewedId)\n deleteDocByDocId(\"reviews\", userReviewedId);\n}", "function deleteAllAttachments(){\n\n fs.readdir(tempDir, function(err, files){\n if (err) throw err;\n\n files.forEach(function(file){\n fs.unlink( path.join(tempDir, file), function(err) {\n if (err) throw err;\n });\n });\n });\n}", "deleteReview(reviewId) {\n return axios.delete(`${this.baseURL}/review/${reviewId}`);\n }", "function deleteSelection(){\n\n\t// load selected image names into array\n\tvar checkArray = document.getElementsByClassName(\"check\");\n\tvar selected = [];\n\tfor (var i = 0; i < checkArray.length; i++) if(checkArray[i].checked) selected.push(checkArray[i].value);\n\n\t// delete confirmation\n\tif (confirm(\"Permanently Delete All \"+ selected.length +\" Images?\") == false) return;\n\t\n\t// use ajax to call delete image function\n\t$.ajax({\n\t\turl: \"delete.php\",\n\t\tdata: { src: selected },\n\t\ttype: \"GET\",\n\t\tsuccess: function(data) {\n\t\t\tdocument.location.reload(true);\n\t\t} // success\n\t}); // ajax\n} // deleteSelection", "function destroyAllPostPhotosFromGCS(uid, postId) {\n // You do not have to use Promise constructor here, just return async function\n // return new Promise((resolve, reject) => {\n return (async (resolve, reject) => {\n const bucket = admin.storage().bucket();\n let folderRef = `/users/${uid}/posts/${postId}/`;\n // List all the files under the bucket\n let files = await bucket.getFiles({\n prefix: folderRef\n });\n // Delete each one\n let response;\n for (let i in files) {\n try {\n response = await files[i].delete();\n } catch(err) {\n reject(err);\n }\n }\n resolve(response);\n });\n}", "function deleteFile({ _id: _id, filename: filename }) {\n const getToken = localStorage.getItem('token');\n const getUserid = localStorage.getItem('userId');\n\n axios.delete(\"/api/delete\", {\n headers: {\n 'accept': 'application/json',\n 'Authorization': `Bearer ${getToken}`\n },\n params: {\n filename: filename,\n id: _id,\n userID: getUserid\n }\n })\n .then(function (response) {\n\n getStorageData();\n resetFields();\n history.push(\"/gameover\");\n })\n .catch(function (error) {\n console.log(error);\n });\n }", "function clean() {\n return del([url_dest + \"*\"]);\n}" ]
[ "0.71073073", "0.67200756", "0.6669429", "0.6617434", "0.65599936", "0.6161805", "0.61463886", "0.6128327", "0.6106347", "0.60901755", "0.6084935", "0.606593", "0.60342157", "0.6006003", "0.5992644", "0.5975462", "0.5975361", "0.5958504", "0.5956197", "0.5937805", "0.59198797", "0.5889575", "0.585211", "0.5843897", "0.58399314", "0.5828619", "0.577462", "0.5770621", "0.57643735", "0.5760274", "0.57412875", "0.57349014", "0.5732425", "0.572242", "0.5695201", "0.56683016", "0.56641483", "0.5653139", "0.5650107", "0.5643424", "0.5638967", "0.5620921", "0.56140035", "0.5612532", "0.5610487", "0.5606351", "0.55955994", "0.5573516", "0.5558553", "0.5541337", "0.55348355", "0.552364", "0.5522561", "0.55210257", "0.54889804", "0.5488901", "0.5484086", "0.5462895", "0.545727", "0.54546255", "0.54544455", "0.54526055", "0.54502094", "0.54496264", "0.54464126", "0.54448885", "0.5420372", "0.5419587", "0.5378604", "0.53688025", "0.536435", "0.53578794", "0.535383", "0.5351182", "0.53484124", "0.53455603", "0.5344546", "0.53439665", "0.5330156", "0.5328719", "0.5315972", "0.5310761", "0.5308915", "0.5302573", "0.52978337", "0.52972734", "0.5294994", "0.5292606", "0.5290394", "0.5285701", "0.5285216", "0.52763367", "0.5274303", "0.5271657", "0.5268514", "0.5267677", "0.5263427", "0.5257042", "0.52530545", "0.52494717" ]
0.69779325
1
These function ensures the color scheme is kept while the display is updated
function enforceTheme(currentTheme) { switch(currentTheme) { case 0: changeToWhite(); break; case 1: changeToBlack(); break; case 2: changeToGray(); break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeColorScheme() {\n\n}", "function refreshHardColors(){\n\t colors = createHardColors(squares.length , range);\n\t\treset();\n}", "function refreshEasyColors(){\n\t\tcolors = createColors(squares.length);\n\t\treset();\n\n}", "checkColorChange () {\n // Reset string on color change.\n this.string = null // will be lazy evaluated via getCss.\n }", "function refresh_color_display() {\n var hex = current_color.to_hex();\n $('#current-color #color-identifiers').text(hex);\n $('#current-color #color-background').css('background-color', hex);\n $('#current-color #color-text').css('color', hex);\n}", "static original() {\n window.localStorage.removeItem('colorScheme')\n this.#setSchemeFromBrowser()\n this.#applyScheme()\n }", "_colorChanged() {\n // Update the context\n this.resetContext();\n }", "function colorForCurrent(){\n\n}", "function resetColors() {\r\n s = document.getElementById(\"s\").value;\r\n l = document.getElementById(\"l\").value;\r\n document.querySelector('body').style.background = `hsl(${color}, ${s}%, ${l}%)`;\r\n document.querySelector('#hdisplay').innerHTML = color;\r\n document.querySelector('#sdisplay').innerHTML = s;\r\n document.querySelector('#ldisplay').innerHTML = l;\r\n document.querySelector('#rgb').innerHTML = document.body.style[\"background-color\"];\r\n}", "function use_plyr_bg_color() {\n ctx.strokeStyle = BLACK;\n ctx.fillStyle = BLACK;\n if (sessionStorage.getItem(\"page\") === BLACK) {\n ctx.strokeStyle = WHITE;\n ctx.fillStyle = WHITE;\n }\n }", "function square_change_colour(){\n\tif(settings.last_colour_square == 'black'){\n\t\tsettings.last_colour_square = 'white';\n\t} else {\n\t\tsettings.last_colour_square = 'black';\n\t}\n}", "static light() {\n window.localStorage.setItem('colorScheme', 'light')\n this.#isDark = false;\n this.#applyScheme();\n }", "function resetColors(){\r\n\t\r\n\tcolors = createSquares(mode);\r\n\r\n\t\r\n\tassignColors();\r\n\r\n\t// update message\r\n\tmessage.textContent = \"\";\r\n\r\n\t// change h1Header\r\n\th1Header.style.backgroundColor=\"rgb(60, 118, 174)\";\r\n\r\n\t// change text of new colors/ reset button\r\n\tresetBtn.textContent = \"New Colors\";\r\n}", "function finalColors(){\n\treset.textContent=\"Play Again?\";\n\th1.style.backgroundColor=pickedColor;\n\tfor(var i=0;i<squares.length;i++)\n\t\tsquares[i].style.backgroundColor=pickedColor;\n}", "function update_color() {\n refresh_color_display();\n\n // Iterate over each channel on the page\n for (var cs in COLORSPACES) {\n var colorspace = COLORSPACES[cs];\n var cs_name = colorspace.identifier;\n for (var i in colorspace.channels) {\n var channel = colorspace.channels[i];\n var id = cs_name + '-' + channel.identifier;\n\n // Update value and marker position\n update_slider(colorspace, channel);\n\n // Iterate over stops and update their colors, using assume()\n // to see what they *would* be if the slider were there. Note\n // that hue and lightness are special cases; hue runs through\n // the rainbow and needs several stops, whereas lightness runs\n // from black to a full color and then back to white, needing\n // an extra stop in the middle.\n var stop_ct = channel.stops;\n\n var $canvas = $('#' + id + ' canvas');\n var ctx = $canvas[0].getContext('2d');\n\n var grad = ctx.createLinearGradient(0, 0, 100, 0);\n var assumption = {};\n for (var i = 0; i < stop_ct; i++) {\n var offset = i / (stop_ct - 1);\n assumption[channel.identifier] = offset;\n grad.addColorStop(offset, current_color.assume(assumption).to_hex());\n }\n ctx.fillStyle = grad;\n ctx.fillRect(0, 0, 100, 100);\n }\n }\n}", "function colorgenerator() {\n let colours = [],\n i;\n for (i = 0; i < 372; i++){\n colours[i] = 'hsl(' + i + ', 100%, 50%)';\n if (i > 359) {\n colours[i] = 'hsl(0, 100%, 100%)';\n }\n }\n colours = colours.toString();\n //console.log(colours);\n root.style.setProperty(\"--colours\", colours);\n}", "function colorChange(){\n //Write the current color in a div with the rgb value\n document.getElementById('currentColor').textContent = \"Current Color: rgb(\" + red + \",\" + green + \",\" + blue + \")\";\n //change the color of the div based on the values determined earlier, as the user presses the buttons these values change and this should update each time if done correctly.\n Display.style.backgroundColor = \"rgb(\" + red + \",\" + green + \",\" + blue + \")\";\n}", "function ChangeColorPallette(){\n updateColorPallette();\n}", "function refreshSwatch2() {\n var cyan = $( \"#cyan\" ).slider( \"value\" ),\n magenta = $( \"#magenta\" ).slider( \"value\" ),\n yellow = $( \"#yellow\" ).slider( \"value\" ),\n key = $( \"#key\" ).slider( \"value\" ),\n hex = CMYK2RGB( cyan, magenta, yellow, key );\n\t document.getElementById('swatch2').innerHTML = '<div style=\"background-color:#' + hex +'\"><div onclick=\"aplikal(\\''+hex+'\\');\" class=\"aplikalo\" title=\"Activate\">&nearr;</div><input onClick=\"this.select();\" value=#' + hex + ' /> </div>';\n }", "function changeColor(e){\n if (colorScheme == \"BLACK\"){\n e.target.style.backgroundColor = \"BLACK\";\n e.target.style.opacity = 1;\n } else if (colorScheme == \"RAINBOW\"){\n e.target.style.backgroundColor = \"#\" + Math.floor(Math.random() * 4096).toString(16);\n e.target.style.opacity = 1;\n } else if (colorScheme == \"DARKEN\"){\n let darken = Number(e.target.style.opacity);\n e.target.style.opacity = darken += 0.1;\n e.target.style.backgroundColor = '#000';\n }\n}", "function newOutputColor() {\n switch (outputColorBox.value()) {\n case 'red':\n outputs[propOutput].colr = 0;\n break;\n case 'yellow':\n outputs[propOutput].colr = 1;\n break;\n case 'green':\n outputs[propOutput].colr = 2;\n break;\n case 'blue':\n outputs[propOutput].colr = 3;\n break;\n default:\n }\n outputs[propOutput].updateColor();\n}", "function newColor1()\n{\n\tIN.doFocus();\n\tIN.clr=\"#109FA6\";\n\trcCookie.set(\"c\",IN.clr,365);\n\tIN.ec(\"ForeColor\",false,IN.clr);\n\tIN.tBC();\n}", "function update_lscolors() {\n var lscolors = '';\n\n for (var i=0;i<11;i++) {\n lscolors += get_bsd_color(selected_foreground_colors[i], selected_foreground_bold[i]);\n lscolors += get_bsd_color(selected_background_colors[i], selected_background_bold[i]);\n }\n\n $('#lscolors').val(lscolors);\n $('#lscolors').keyup();\n }", "function colorChanged() {\r\n // STEP 2 PART 1\r\n // In index.html, the color picker's value ranges from #000000 to #ffffff\r\n // Let's store the color picker's value in a variable, perhaps named \"color\"\r\n\r\n /* SOLUTION HERE */\r\n color = colorPicker.value;\r\n\r\n // STEP 2 PART 2\r\n // Set the color value to both context.fillStyle and context.strokeStyle\r\n\r\n /* SOLUTION HERE */\r\n context.fillStyle = color;\r\n context.strokeStyle = color;\r\n\r\n }", "function onColorUpdate(e){\n current.color = e.target.className.split(' ')[1];\n }", "_loadLast() {\n if (this.previousColor !== undefined) {\n this.setColor(this.previousColor, false);\n }\n else {\n alert(\"There is no last color to load...\");\n }\n }", "function CReplaceColor() {\n this.mode = 0;\n this.app = null;\n this.pImages = null;\n}", "function chg_freesp_color(c) {\r\n\tprop.freeSpaceColor = c;\r\n\tdraw();\r\n}", "function resetNeutralColors() {\n\t\t$('#virtual-blink').css('background-color', \"#eee\");\n\t\t$('#color-zoom').css({'top': '-190px', 'left': '61px', 'background-color' : '#eee'});\t\t\n\t\t$('.color-swatch').removeClass('.light-off').css('background-image', 'none');\n\t\t$('#color-display #rgb input').val('255');\t\n\t}", "async function resetColors() {\n setEditedCustomColors({})\n await saveCustomColors({})\n setShowColorControls(false)\n }", "function editor_tools_handle_color()\n{\n editor_tools_store_range();\n\n // Display the color picker.\n var img_obj = document.getElementById('editor-tools-img-color');\n showColorPicker(img_obj);\n return;\n}", "function chcolor(){if(v_chcolor == 1){ document.getElementById(\"sgb\").style.color=color[x];(x < color.length-1) ? x++ : x = 0;}}", "function setRGBDisplay() {\r\n redDisplay.textContent = redCorrect;\r\n greenDisplay.textContent = greenCorrect;\r\n blueDisplay.textContent = blueCorrect;\r\n}", "function eraser() {\r\n color_stock = \"#FFFFFF\";\r\n}", "function colorpicker(){\r\n\tvar val3 = '#ffffff';\r\n\t\r\n\t$('.sp-replacer').remove();\t\r\n\t$(\".tint-color\").spectrum({\r\n\t\tshowInput: true,\r\n\t\tpreferredFormat: \"rgb\",\r\n\t\t//color: val3\r\n\t});\r\n}", "function albatrossColoring() {\n location.reload(true);\n}", "_save() {\n this.updateCallback(this.color);\n this.applied = false;\n this._hide();\n }", "function colorChanger(color){\n\n mouse.color = color;\n hold.style.background = color;\n\n\n\n\n}", "function refreshSwatch(red, green, blue) {\n\tvar hex = hexFromRGB( red, green, blue );\n\t$( \"#swatch\" ).css( \"background-color\", \"#\" + hex );\n}", "function updateColorTheme(start) {\n // Define an array so we can save colors and access later. Doing this before the draw function helps random colors stay consistent\n colorTheme = []\n\n // 1st set\n // Assign random color for colorFrom\n let r = Math.floor(Math.random() * 256)\n let g = Math.floor(Math.random() * 256)\n let b = Math.floor(Math.random() * 256)\n\n // Assign random color for colorTo\n let r2 = Math.floor(Math.random() * 256)\n let g2 = Math.floor(Math.random() * 256)\n let b2 = Math.floor(Math.random() * 256)\n\n colorFrom = color(r, g, b, alpha)\n colorTo = color(r2, g2, b2)\n\n // 2nd set\n r = Math.floor(Math.random() * 256)\n g = Math.floor(Math.random() * 256)\n b = Math.floor(Math.random() * 256)\n\n // Assign random color for colorTo\n r2 = Math.floor(Math.random() * 256)\n g2 = Math.floor(Math.random() * 256)\n b2 = Math.floor(Math.random() * 256)\n\n colorFrom2 = color(r, g, b, alpha)\n colorTo2 = color(r2, g2, b2)\n\n for (let i = 0; i < numCircles; i++) {\n // Create lerp color interpolation. More visible when one color is used.\n let lerpAmt = map(i * numCircles * 10, -width / 2, width / 2, 0, 1)\n // Alternate colors between first set and second set based on whether we are on odd or even index\n let lerpedCol =\n i % 2 === 0\n ? lerpColor(colorFrom, colorTo, lerpAmt)\n : lerpColor(colorFrom2, colorTo2, lerpAmt)\n\n // Save lerp colors so we can use later. Since we have 12 circles, 12 lerpedColors will be saved\n colorTheme.push(lerpedCol)\n }\n}", "function update(e) {\n for (let i = 0; i < themeColor.length; i++) {\n themeColor[i].style.background = e.target.value;\n }\n }", "function rotateColors(display) {\nvar red = 0;\nvar green = 0;\nvar blue = 0;\ndisplay.setColor(red, green, blue);\nsetInterval(function() {\nblue += 64;\nif (blue > 255) {\n blue = 0;\n green += 64;\n if (green > 255) {\n green = 0;\n red += 64;\n if (red > 255) {\n red = 0;\n }\n }\n}\ndisplay.setColor(red, green, blue);\ndisplay.setCursor(0, 0);\ndisplay.write(' Hackster.io');\ndisplay.setCursor(1,1);\ndisplay.write('Intel Edison');\n // extra padding clears out previous text\n}, 1000);\n}", "function reset(){\n\tcolors=generateColors(numSquares);\n\tpickedColor= pickColor();\n\tcolorDisplay.textContent=pickedColor;\n\t\n\tfor (var i =0; i <squares.length; i++) {\n\n\t\tif(colors[i]){\n\t\t\tsquares[i].style.background=colors[i];\n\n\t\t\tsquares[i].style.display=\"block\";\n\t\t}\n\t\telse\n\t\t\tsquares[i].style.display=\"none\";\n\t}\n\n\n\th1.style.background=\"steelblue\";\n\tmessageDisplay.textContent=\"\";\n\tresetButton.textContent=\"New colors\";\n}", "function rotateColors(display) {\n var red = 0;\n var green = 0;\n var blue = 0;\n display.setColor(red, green, blue);\n setInterval(function() {\n blue += 64;\n if (blue > 255) {\n blue = 0;\n green += 64;\n if (green > 255) {\n green = 0;\n red += 64;\n if (red > 255) {\n red = 0;\n }\n }\n }\n display.setColor(red, green, blue);\n display.setCursor(0,0);\n //display.write('red=' + red + ' grn=' + green + ' ');\n display.setCursor(1,0);\n //display.write('blue=' + blue + ' '); // extra padding clears out previous text\n display.write('and cute');\n }, 1000);\n}", "cls(c) {\n const context = this.cr.renderer;\n if (c === undefined) {\n // clear screen\n context.clearRect(0, 0, this.cr.canvas.width, this.cr.canvas.height);\n }\n else {\n // evaluate runtime errors\n this.colorRangeError(c);\n // draw the selected color on screen\n context.fillStyle = this.palette[c];\n context.fillRect(0, 0, this.cr.canvas.width, this.cr.canvas.height);\n }\n // update ticks\n this.passedTicks += 1;\n }", "function removeCurrentColorSetting(){\n if(currentColorSetting == \"Inverse\"){\n toggleInvertColor();\n toggleAriaButtonPress('#color-scheme-inverse');\n }\n else if(currentColorSetting == \"GrayStyle\"){\n toggleGraystyle();\n toggleAriaButtonPress('#color-scheme-b-o-w');\n }\n}", "function etchTheSketch(e) {\n let colorChange = changeColors(e);\n e.target.style.backgroundColor = colorChange;\n}", "function updateColors () {\n // ADJUST COLOR VARIABLES FOR COLOR VALUE\n r = redSlider.value;\n g = greenSlider.value;\n b = blueSlider.value;\n\n // UPDATE ALL COLORS WITH NEW VALUES\n setColors(r, g, b);\n}", "function oldColor() {\n if (ALaxis === 'distanceSpot')\n return '#ff0000';\n else if (ALaxis === 'angleSpot')\n return '#0000ff';\n else if (ALaxis === 'colorRing' || ALaxis === 'lightnessRing')\n return '#888';\n}", "livelyUpdate() {\n // this.style.backgroundColor = \"\"\n }", "function reset() {\r\n colors = randomColor(num);\r\n pickedColor = colorPicker();\r\n colorDisplay.text(pickedColor);\r\n resetbtn.text(\"New Colors\");\r\n message.text(\"\");\r\n for (let i = 0; i < sq.length; i++) {\r\n if (colors[i]) {\r\n sq[i].style.display = \"block\";\r\n sq[i].style.background = colors[i];\r\n } else {\r\n sq[i].style.display = \"none\";\r\n }\r\n }\r\n}", "async ColorChanger(name) {\n var colore = null\n var colorCur = $(name).spectrum(\"get\");\n if (typeof colorCur.toHex !== \"undefined\") {\n colore = colorCur.toHex();\n }\n\n $(\"name\").spectrum(\"destroy\");\n $(name).spectrum({\n color: colore,\n type: \"component\",\n showPalette: false,\n disabled: true,\n showButtons: false,\n allowEmpty: false,\n showAlpha: false\n\n });\n if (colore == null) {\n this.scene.traverse((child) => {\n if (child.isMesh && child.name == \"Struttura\") {\n $(name).spectrum(\"set\", child.material.color.getHexString());\n }\n });\n }\n\n\n $(name).off(\"dragstop.spectrum\");\n\n\n $(name).on(\"dragstop.spectrum\",(e, color) => {\n this.scene.traverse((child) => {\n if (child.isMesh && child.name == \"Struttura\") {\n child.material.color.setHex(\"0x\" + color.toHexString().substring(1));\n }\n\n });\n });\n\n if (colore != null) {\n $(name).trigger(\"dragstop.spectrum\", [colorCur])\n }\n\n $(name).spectrum(\"enable\");\n }", "function UpdateColors(aColorWellID, aPreviewID, aColor)\n{\n // Only show editor colors from prefs if we're in custom mode\n if (!document.getElementById(\"editor.use_custom_colors\").value)\n return;\n\n SetColors(aColorWellID, aPreviewID, aColor)\n}", "function updateColor(e) {\n var colorHasChanged = !tinycolor.equals(get(), colorOnShow);\n\n if (colorHasChanged) {\n if (clickoutFiresChange && e !== \"cancel\") {\n updateOriginalInput(true);\n } else {\n revert();\n }\n }\n }", "function applyColorScheme(ghostName, color) {\n switch (color) {\n case 'blue':\n document.getElementById(ghostName).style.backgroundColor = '#0B24FB';\n document.getElementById(ghostName + '.leftEye').style.backgroundColor = '#FFF';\n document.getElementById(ghostName + '.rightEye').style.backgroundColor = '#FFF';\n document.getElementById(ghostName + '.leftEyeball').style.backgroundColor = 'transparent';\n document.getElementById(ghostName + '.rightEyeball').style.backgroundColor = 'transparent';\n document.getElementById(ghostName + '.mouth').style.borderColor = '#FFF';\n document.getElementById(ghostName + '.mouth1').style.borderColor = '#FFF';\n break;\n case 'normal':\n document.getElementById(ghostName).style.backgroundColor = getComputedStyle(document.documentElement).getPropertyValue('--' + ghostName + 'Color');\n document.getElementById(ghostName + '.leftEye').style.backgroundColor = '#305198';\n document.getElementById(ghostName + '.rightEye').style.backgroundColor = '#305198';\n document.getElementById(ghostName + '.leftEyeball').style.backgroundColor = '#FFF';\n document.getElementById(ghostName + '.rightEyeball').style.backgroundColor = '#FFF';\n document.getElementById(ghostName + '.mouth').style.borderColor = 'transparent';\n document.getElementById(ghostName + '.mouth1').style.borderColor = 'transparent';\n break;\n case 'eyes':\n document.getElementById(ghostName).style.backgroundColor = 'transparent';\n document.getElementById(ghostName + '.leftEye').style.backgroundColor = '#305198';\n document.getElementById(ghostName + '.rightEye').style.backgroundColor = '#305198';\n document.getElementById(ghostName + '.leftEyeball').style.backgroundColor = '#FFF';\n document.getElementById(ghostName + '.rightEyeball').style.backgroundColor = '#FFF';\n document.getElementById(ghostName + '.mouth').style.borderColor = 'transparent';\n document.getElementById(ghostName + '.mouth1').style.borderColor = 'transparent';\n break;\n case 'transparent':\n document.getElementById(ghostName).style.backgroundColor = 'transparent';\n document.getElementById(ghostName + '.leftEye').style.backgroundColor = 'transparent';\n document.getElementById(ghostName + '.rightEye').style.backgroundColor = 'transparent';\n document.getElementById(ghostName + '.leftEyeball').style.backgroundColor = 'transparent';\n document.getElementById(ghostName + '.rightEyeball').style.backgroundColor = 'transparent';\n document.getElementById(ghostName + '.mouth').style.borderColor = 'transparent';\n document.getElementById(ghostName + '.mouth1').style.borderColor = 'transparent';\n break;\n case 'flash red':\n document.getElementById(ghostName).style.backgroundColor = '#FFF';\n document.getElementById(ghostName + '.leftEye').style.backgroundColor = '#FE2502';\n document.getElementById(ghostName + '.rightEye').style.backgroundColor = '#FE2502';\n document.getElementById(ghostName + '.mouth').style.borderColor = '#FE2502';\n document.getElementById(ghostName + '.mouth1').style.borderColor = '#FE2502';\n break;\n case 'flash blue':\n document.getElementById(ghostName).style.backgroundColor = '#0B24FB';\n document.getElementById(ghostName + '.leftEye').style.backgroundColor = '#FFF';\n document.getElementById(ghostName + '.rightEye').style.backgroundColor = '#FFF';\n document.getElementById(ghostName + '.mouth').style.borderColor = '#FFF';\n document.getElementById(ghostName + '.mouth1').style.borderColor = '#FFF';\n break;\n }\n }", "function getColourSchemes() {\n \n \n // addColourList();\n palettes = [\"#ffffe5\", \"#f7fcb9\", \"#d9f0a3\", \"#addd8e\", \"#78c679\", \"#41ab5d\", \"#238443\", \"#006837\", \"#004529\", \"#ffffd9\", \"#edf8b1\", \"#c7e9b4\", \"#7fcdbb\", \"#41b6c4\", \"#1d91c0\", \"#225ea8\", \"#253494\", \"#081d58\", \"#f7fcf0\", \"#e0f3db\", \"#ccebc5\", \"#a8ddb5\", \"#7bccc4\", \"#4eb3d3\", \"#2b8cbe\", \"#0868ac\", \"#084081\", \"#f7fcfd\", \"#e5f5f9\", \"#ccece6\", \"#99d8c9\", \"#66c2a4\", \"#41ae76\", \"#238b45\", \"#006d2c\", \"#00441b\", \"#fff7fb\", \"#ece2f0\", \"#d0d1e6\", \"#a6bddb\", \"#67a9cf\", \"#3690c0\", \"#02818a\", \"#016c59\", \"#014636\", \"#fff7fb\", \"#ece7f2\", \"#d0d1e6\", \"#a6bddb\", \"#74a9cf\", \"#3690c0\", \"#0570b0\", \"#045a8d\", \"#023858\", \"#f7fcfd\", \"#e0ecf4\", \"#bfd3e6\", \"#9ebcda\", \"#8c96c6\", \"#8c6bb1\", \"#88419d\", \"#810f7c\", \"#4d004b\", \"#fff7f3\", \"#fde0dd\", \"#fcc5c0\", \"#fa9fb5\", \"#f768a1\", \"#dd3497\", \"#ae017e\", \"#7a0177\", \"#49006a\", \"#f7f4f9\", \"#e7e1ef\", \"#d4b9da\", \"#c994c7\", \"#df65b0\", \"#e7298a\", \"#ce1256\", \"#980043\", \"#67001f\", \"#fff7ec\", \"#fee8c8\", \"#fdd49e\", \"#fdbb84\", \"#fc8d59\", \"#ef6548\", \"#d7301f\", \"#b30000\", \"#7f0000\", \"#ffffcc\", \"#ffeda0\", \"#fed976\", \"#feb24c\", \"#fd8d3c\", \"#fc4e2a\", \"#e31a1c\", \"#bd0026\", \"#800026\", \"#ffffe5\", \"#fff7bc\", \"#fee391\", \"#fec44f\", \"#fe9929\", \"#ec7014\", \"#cc4c02\", \"#993404\", \"#662506\", \"#fcfbfd\", \"#efedf5\", \"#dadaeb\", \"#bcbddc\", \"#9e9ac8\", \"#807dba\", \"#6a51a3\", \"#54278f\", \"#3f007d\", \"#f7fbff\", \"#deebf7\", \"#c6dbef\", \"#9ecae1\", \"#6baed6\", \"#4292c6\", \"#2171b5\", \"#08519c\", \"#08306b\", \"#f7fcf5\", \"#e5f5e0\", \"#c7e9c0\", \"#a1d99b\", \"#74c476\", \"#41ab5d\", \"#238b45\", \"#006d2c\", \"#00441b\", \"#fff5eb\", \"#fee6ce\", \"#fdd0a2\", \"#fdae6b\", \"#fd8d3c\", \"#f16913\", \"#d94801\", \"#a63603\", \"#7f2704\", \"#fff5f0\", \"#fee0d2\", \"#fcbba1\", \"#fc9272\", \"#fb6a4a\", \"#ef3b2c\", \"#cb181d\", \"#a50f15\", \"#67000d\", \"#ffffff\", \"#f0f0f0\", \"#d9d9d9\", \"#bdbdbd\", \"#969696\", \"#737373\", \"#525252\", \"#252525\", \"#000000\", \"#7f3b08\", \"#b35806\", \"#e08214\", \"#fdb863\", \"#fee0b6\", \"#f7f7f7\", \"#d8daeb\", \"#b2abd2\", \"#8073ac\", \"#542788\", \"#2d004b\", \"#543005\", \"#8c510a\", \"#bf812d\", \"#dfc27d\", \"#f6e8c3\", \"#f5f5f5\", \"#c7eae5\", \"#80cdc1\", \"#35978f\", \"#01665e\", \"#003c30\", \"#40004b\", \"#762a83\", \"#9970ab\", \"#c2a5cf\", \"#e7d4e8\", \"#f7f7f7\", \"#d9f0d3\", \"#a6dba0\", \"#5aae61\", \"#1b7837\", \"#00441b\", \"#8e0152\", \"#c51b7d\", \"#de77ae\", \"#f1b6da\", \"#fde0ef\", \"#f7f7f7\", \"#e6f5d0\", \"#b8e186\", \"#7fbc41\", \"#4d9221\", \"#276419\", \"#67001f\", \"#b2182b\", \"#d6604d\", \"#f4a582\", \"#fddbc7\", \"#f7f7f7\", \"#d1e5f0\", \"#92c5de\", \"#4393c3\", \"#2166ac\", \"#053061\", \"#67001f\", \"#b2182b\", \"#d6604d\", \"#f4a582\", \"#fddbc7\", \"#ffffff\", \"#e0e0e0\", \"#bababa\", \"#878787\", \"#4d4d4d\", \"#1a1a1a\", \"#a50026\", \"#d73027\", \"#f46d43\", \"#fdae61\", \"#fee090\", \"#ffffbf\", \"#e0f3f8\", \"#abd9e9\", \"#74add1\", \"#4575b4\", \"#313695\", \"#9e0142\", \"#d53e4f\", \"#f46d43\", \"#fdae61\", \"#fee08b\", \"#ffffbf\", \"#e6f598\", \"#abdda4\", \"#66c2a5\", \"#3288bd\", \"#5e4fa2\", \"#a50026\", \"#d73027\", \"#f46d43\", \"#fdae61\", \"#fee08b\", \"#ffffbf\", \"#d9ef8b\", \"#a6d96a\", \"#66bd63\", \"#1a9850\", \"#006837\"];\n currentXPalette = palettes[Math.floor(Math.random()*palettes.length)];\n currentYPalette = palettes[Math.floor(Math.random()*palettes.length)];\n // currentXPalette = palettes[0];\n // currentYPalette = palettes[0];\n updateScreen();\n $(\"#loading\").fadeOut(500);\n \n \n }", "function colorsFigure(){\n console.log(color)\n selectedFigure.setColor(color);\n redrawFigures();\n}", "static dark() {\n window.localStorage.setItem('colorScheme', 'dark')\n this.#isDark = true;\n this.#applyScheme();\n }", "function switchColor(){\n\tif (currentColor === \"red\"){\n\t\tcurrentColor = \"black\";\n\t}\telse {\n\t\t\tcurrentColor = \"red\";\n\t\t}\n}", "function updateColor() {\n bOpts['color'] = ('rgba(' + parseInt(r) + ', ' + parseInt(g) + ', '\n + parseInt(b) + ', ' + bOpts['opacity'] + ')');\n }", "function lgColor(o){this.setOptions=function(o){for(i in o){var n=\"set\"+i.charAt(0).toUpperCase()+i.substr(1);if(this[n]){this[n](o[i])}else{this[i]=o[i]}}};this.setFromIntRGB=function(c){this.colorRGB=c};this.setFromFloatRGB=function(r,g,b){if(typeof(r)==\"object\"){g=r[1];b=r[2];r=r[0]}this.setFromByteRGB(Math.min(0,Math.max(255,(r*255)|0)),Math.min(0,Math.max(255,(g*255)|0)),Math.min(0,Math.max(255,(b*255)|0)))};this.setFromByteRGB=function(r,g,b){if(typeof(r)==\"object\"){g=r[1];b=r[2];r=r[0]}this.colorRGB=r<<16|g<<8|b};this.setFromFloatHSL=function(h,s,l){if(typeof(h)==\"object\"){s=h[1];l=h[2];h=h[0]}var a=this.hslToRgb(h,s,l);this.setFromFloatRGB(a[0],a[1],a[2])};this.setFromByteHSL=function(h,s,l){if(typeof(h)==\"object\"){s=h[1];l=h[2];h=h[0]}this.setFromFloatHSL(h/255,s/255,l/255)};this.getIntRGB=function(){return this.colorRGB};this.getHexRGB=function(){return dec2Hex(this.colorRGB,6)};this.getFloatRGB=function(){var a=this.getByteRGB();return[a[0]/255,a[1]/255,a[2]/255]};this.getByteRGB=function(){return[(c>>16)&255,(c>>8)&255,c&255]};this.getFloatHSL=function(){var a=this.getFloatRGB();return this.rgbToHsl(a[0],a[1],a[2])};this.getByteHSL=function(){var a=this.getFloatRGB();var b=this.rgbToHsl(a[0],a[1],a[2]);return[(h*255)&255,(s*255)&255,(l*255)&255]};this.convert=function(v,a,b){this[\"setFrom\"+a](v);return this[\"get\"+b]()};this.hToC=function(x,y,h){var c;if(h<0){h+=1}if(h>1){h-=1}if(h<1/6){c=x+(y-x)*h*6}else{if(h<1/2){c=y}else{if(h<2/3){c=x+(y-x)*(2/3-h)*6}else{c=x}}}return c};this.hslToRgb=function(h,s,l){var x;var y;var r;var g;var b;y=(l>.5)?l+s-l*s:l*(s+1);x=l*2-y;r=this.hToC(x,y,h+1/3);g=this.hToC(x,y,h);b=this.hToC(x,y,h-1/3);return[r,g,b]};this.rgbToHsl=function(r,g,b){var a=Math.max(r,g,b),mn=Math.min(r,g,b);var h,s,l=(a+mn)/2;if(a==mn){h=s=0}else{var d=a-mn;s=l>0.5?d/(2-a-mn):d/(a+mn);switch(a){case r:h=(g-b)/d+(g<b?6:0);break;case g:h=(b-r)/d+2;break;case b:h=(r-g)/d+4;break}h/=6}return[h,s,l]};this.setOptions({colorRGB:0});if(o){this.setOptions(o)}}", "function useColors(){// NB: In an Electron preload script, document will be defined but not fully\n// initialized. Since we know we're in Chrome, we'll just detect this case\n// explicitly\nif(typeof window!=='undefined'&&window.process&&window.process.type==='renderer'){return true;}// is webkit? http://stackoverflow.com/a/16459606/376773\n// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\nreturn typeof document!=='undefined'&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||// is firebug? http://stackoverflow.com/a/398120/376773\ntypeof window!=='undefined'&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||// is firefox >= v31?\n// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\ntypeof navigator!=='undefined'&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)&&parseInt(RegExp.$1,10)>=31||// double check webkit in userAgent just in case we are in a worker\ntypeof navigator!=='undefined'&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/);}", "function manageBackground() {\n let color = CurrColor.attr('bgcolor');\n // The canvas already has a background\n // Need to delete a background\n if (hasBackground) {\n Canvas.attr('bgcolor', '');\n BgrColor.attr('bgcolor', '');\n BgrBtn.html('Add background');\n hasBackground = false;\n }\n // The doesn't have a background\n // Need to add a background\n else {\n Canvas.attr('bgcolor', color);\n BgrColor.attr('bgcolor', color);\n BgrBtn.html('Remove background');\n hasBackground = true;\n };\n if (CanvasBgr.css('display') === 'block') {\n manageHistory('update');\n manageUndoRedoBtn();\n };\n }", "function colorChanger(choice, callback) {\n colorKey = choice;\n localStorage.setItem('colorScheme', choice);\n if(callback) {\n callback(color());\n }\n}", "function updateColour() {\n document.documentElement.style.setProperty('--' + this.name, this.value); //update the css variables\n}", "function functionDelegator() {\n colorCalc();\n showColors();\n displayHex();\n displayRGB();\n displayHSL();\n}", "cleanColor() {\n this.urlInput.color = \"#0A0A0F\"\n }", "function correctColorDisplay(){\r\n\theader.style.backgroundColor = colorPicked;\t\r\n\tfor(var x=0; x<squares.length; x++){\r\n\t\tsquares[x].style.backgroundColor = colorPicked;\r\n\t\tsquares[x].style.opacity = \"1\";\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t}\r\n}", "function updatePalette() {\n\t$('#painting').css('background-color', selectedColor);\n\tvar brushSize = $('#brush_size').attr('value') / BRUSH_SCAEL;\n\tproxy.send({\n\t\ttype: 'update_palette',\n\t\targ: {\n\t\t\tcolor: cs.paletteColors[selectedColor],\n\t\t\tr: brushSize\n\t\t}\n\t});\n}", "onMainChange() {\n this.themeBuilderService.MaterialPaletteColors = this.themeBuilderService.GetPalette(this.Form.value.main);\n // set lightest and darkest hue colors in color picker\n if (!this.Unlocked.value) {\n this.Form.patchValue({ lighter: this.themeBuilderService.MaterialPaletteColors['50'] });\n this.Form.patchValue({ darker: this.themeBuilderService.MaterialPaletteColors['900'] });\n }\n }", "function refreshSelectorColors(hue, sat, val) {\n \n // refresh color output box\n var rgb = HSVtoRGB(hue, sat, val);\n var rgbText = 'rgb(' + String(rgb[0]) + ',' + String(rgb[1]) + ',' + String(rgb[2]) + ')';\n $(c.color.current).css('background-color', rgbText);\n \n // refresh saturation/value selection box background color\n var rgbHue = HSVtoRGB(hue, 1, 1);\n var rgbHueText = 'rgb(' + String(rgbHue[0]) + ',' + String(rgbHue[1]) + ',' + String(rgbHue[2]) + ')'\n \n // update color sampler\n $(c.sv.box).css('background-color', rgbHueText);\n \n // update bound object's background color\n methods.update(rgbText);\n\n return true;\n }", "function updateColors() {\n SKIN.options.container = PAGE_BG_COLOR;\n if (SCHEME_NAME === 'custom') {\n SKIN.options.scheme = SCHEME_CUSTOM;\n } else {\n SKIN.options.scheme = SCHEME_NAME;\n }\n updateCSS();\n Y.one('.page-background').setStyle('backgroundColor', PAGE_BG_COLOR);\n }", "function colorReplace(){\n var color = colorGetter.getColor(this);\n}", "static get INACTIVE_COLOR() { return [128, 128, 128, 100]; }", "function dualColor (){\n \n\tcounter += 1;\n\tdocument.getElementById('model__baseC').getAttribute('color');\n\tswitch (counter) {\n\t\tcase 1:\n\t\tdocument.getElementById('model__baseC').setAttribute('color', '0.4627 0.4627 0.4627 0.3549 0.3549 0.3549');\n\t\t\t\n\t\t\tbreak;\n\t\tcase 2:\n\t\tdocument.getElementById('model__baseC').setAttribute('color', '0.003922 0.1255 0.3059 0.1294 0.1294 0.1294');\n\t\t\tbreak;\n\t\tcase 3:\n\t\tdocument.getElementById('model__baseC').setAttribute('color', '0.2549 -0.5529 -0.5529 0.1294 0.1294 0.1294');\n\t\t\tbreak;\n\n\t\t\tcase 4:\n\t\tdocument.getElementById('model__baseC').setAttribute('color', '0.003922 0.5333 0.4275 0.1725 0.04314 0.09412');\n\t\t\tbreak;\n\n\t\tcase 5:\n\t\t\tcounter = 0;\n\t\t\tdocument.getElementById('model__baseC').setAttribute('color', '0.003922 0.003922 0.003922 0.1294 0.1294 0.1294');\n\t\t\tbreak;\n\t}\n\t\t\t\n\n}", "function updateColor(color) {\n var hexColor = \"transparent\";\n if (color) {\n hexColor = color.toHexString();\n }\n $('.background').css('background-color', hexColor);\n\n $('.ratio').each( function (i) {\n $(this).html(contrastRatio(colors[i], hexColor));\n });\n\n $('.pass').each( function (i) {\n $(this).html(isPassing(contrastRatio(colors[i], hexColor)));\n });\n }", "handleChangeColorStops(delta) {\n return () => {\n const newSize = this.state.options.colorPalette.length + delta;\n if (newSize > 0 && newSize <= 20) {\n const updatedState = { svgNeedsUpdating: true, options: this.state.options };\n updatedState.options.colorPalette = chroma.scale(this.state.options.colorPalette)\n .mode('lch').colors(newSize);\n this.setState(updatedState);\n }\n };\n }", "function initColor() {\n let paletteArr = document.getElementById(\"palette\").children;\n\n //array for each for the colours\n let colorPalette = [\n 'rgb(210, 57, 57)',\n 'rgb(251, 107, 134)',\n 'rgb(255, 61, 114)',\n 'rgb(205, 34, 145)',\n 'rgb(189, 0, 255)',\n 'rgb(125, 46, 238)',\n 'rgb(0, 71, 255)',\n 'rgb(0, 67, 196)',\n 'rgb(36, 117, 224)',\n 'rgb(60, 215, 255)',\n 'rgb(0, 255, 201)',\n 'rgb(44, 238, 167)',\n 'rgb(176, 254, 76)',\n 'rgb(255, 252, 0)',\n 'rgb(255, 253, 101)',\n 'rgb(255, 203, 18)',\n 'rgb(255, 171, 60)',\n 'rgb(255, 122, 0)',\n 'rgb(255, 255, 255)',\n 'rgb(38, 38, 38)'\n ];\n\n for (let j = 0; j < paletteArr.length; j++) {\n Object.assign(paletteArr[j].style, {\n backgroundColor: colorPalette[j]\n });\n paletteArr[j].addEventListener('click', function() {\n //This is variable holding the rgb value\n currentColor = colorPalette[j];\n\n //this sets the brush to the current color\n let brushie = document.getElementById('brushie');\n brushie.style.fill = currentColor;\n });\n }\n\n return palette;\n}", "function updateDisplay(launchpad) {\n for (var x = 0; x < 9; x++) {\n for (var y = 0; y < 9; y++) {\n if (x == 8 && y == 0) continue;\n var color = launchpad.buffers[launchpad.visibleBuffer][x][y] || launchpad.colors[0][0];\n var shape = document.getElementById(\"key\" + x + y);\n // Do not apply brightness correction to non-lit pads and buttons\n shape.style.opacity = (color == launchpad.colors[0][0]) ? 1 : launchpad.brightness;\n shape.style.fill = color;\n }\n }\n}", "function clearColor() {\n $(\"#bluepad\").removeClass(\"light\");\n $(\"#redpad\").removeClass(\"light\");\n $(\"#greenpad\").removeClass(\"light\");\n $(\"#yellowpad\").removeClass(\"light\");\n}", "function reset(){\n\t//generate new colors\n\tcolors = generateRandomColor(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\n\tresetButton.textContent = \"New Colors\";\n\tmsgDisplay.textContent = \"\";\n\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}", "function updateCurrentColor(jscolor) {\n board.changeColor(\"#\" + jscolor);\n}", "onSave(hsva, instance) {\n var hex = hsva.toHEX().toString();\n State.Colors.background = hex;\n manipulateImage();\n }", "function updateComp(r, g, b)\r\n{\r\n\t// calculate complement\r\n\tvar comp = complement(r, g, b);\r\n\t\r\n\tvar r0, g0, b0;\r\n\t\r\n\t// if false, returned, display same color\r\n\tif (!comp) {\r\n\t\tr0 = r;\r\n\t\tg0 = g;\r\n\t\tb0 = b;\r\n\t}\r\n\t\r\n\telse {\r\n\t\tr0 = comp.r;\r\n\t\tg0 = comp.g;\r\n\t\tb0 = comp.b;\r\n\t}\r\n\t\r\n\t// determine hex\r\n\tvar hex = rgbToHex(r0, g0, b0);\r\n\t\r\n\t// update swatch\r\n\t$('#comp-swatch').css('background-color', '#' + hex);\r\n}", "function setCurrentColor(colorHexCode) {\n\n let hexCodeString = String(colorHexCode);\n\n // Empty Current Containers of possible previous value\n $('#currentcolorstorage').empty();\n $('#currentcolorstorage').text(hexCodeString);\n\n $('#currentcolorstorage').empty();\n $('#currentcolorheaderdisplay').text(hexCodeString);\n $('#currentcolorheaderdisplay').css(\"border-top-color\", hexCodeString);\n\n let rValue = hexToR(colorHexCode);\n let gValue = hexToG(colorHexCode);\n let bValue = hexToB(colorHexCode);\n let cmykArray = hexToCMYK(colorHexCode);\n\n $(\"#currentcolorindicatorcircle\").css(\"background-color\", hexCodeString);\n\n let rgbCompositeString = `rgb(${rValue},${gValue},${bValue})`;\n $('#currentcolorboxrgbvalue').empty();\n $('#currentcolorboxrgbvalue').text(rgbCompositeString);\n\n let hslObject = HEXtoHSL(hexCodeString)\n $('#currentcolorboxhslvalue').empty();\n $('#currentcolorboxhslvalue').html(`hsl(${hslObject.h}, ${hslObject.s}%, ${hslObject.l}%)`);\n\n $('#currentcolorboxcmykvalue').empty();\n $('#currentcolorboxcmykvalue').text(`${cmykArray[0].toFixed(4)}, ${cmykArray[1].toFixed(4)}, ${cmykArray[2].toFixed(4)}, ${cmykArray[3].toFixed(4)}`);\n\n $('#currentcolorluminancevalue').empty();\n currentcolorluminancepercentvalue\n $('#currentcolorluminancepercentvalue').text(String(parseInt(percievedBrightness(rValue, gValue, bValue) / 255 * 100)) + \"%\");\n $('#currentcolorluminancevalue').text(String(percievedBrightness(rValue, gValue, bValue)) + \" / 255\");\n}", "function useColors(){// NB: In an Electron preload script, document will be defined but not fully\n// initialized. Since we know we're in Chrome, we'll just detect this case\n// explicitly\nvar useColorsOption=getOption('colors');if(/^(no|off|false|disabled)$/i.test(useColorsOption)){return false;}if(typeof window!=='undefined'&&window.process&&window.process.type==='renderer'){return true;}// Internet Explorer and Edge do not support colors.\nif(typeof navigator!=='undefined'&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)){return false;}// is webkit? http://stackoverflow.com/a/16459606/376773\n// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\nreturn Boolean(typeof document!=='undefined'&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||// is firebug? http://stackoverflow.com/a/398120/376773\ntypeof window!=='undefined'&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||// is firefox >= v31?\n// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\ntypeof navigator!=='undefined'&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)&&parseInt(RegExp.$1,10)>=31||// double check webkit in userAgent just in case we are in a worker\ntypeof navigator!=='undefined'&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));}", "set color(c){\n this.currentColor = this.findPalRGB(c);\n }", "function updateColor(){\r\n color = colorSelector.value;\r\n}", "newColors(){\n for (let i = 0; i < this.colorCount; i++) {\n this.addColorToObject()\n }\n this.updateGradientString()\n }", "function UpdatePalette(newPal){\n //alert(\"mapaalette: \" + mappalette);\n $('#imgPalette').attr(\"src\", $('#imgPalette').attr(\"src\").replace(mappalette,newPal));\n mappalette = newPal;//Change the current palette to the one just selected\n\n if(validatePaletteRange()){\n owgis.layers.updateMainLayerParam('colorscalerange',minPalVal+ ',' + maxPalVal);\n //Update the KMLlink to visualize on google earth\n owgis.utils.replaceGetParamInLink(\"#kmlLink\", \"COLORSCALERANGE\", minPalVal+ ',' + maxPalVal);\n }\n\n\t//Changes the palette\n\towgis.layers.updateMainLayerParam('STYLES',lay_style+\"/\"+newPal);\n\towgis.utils.replaceGetParamInLink(\"#kmlLink\", \"STYLES\", lay_style+\"/\"+newPal);\n\n\t//If an animation is being displayed it reloads it with the new palette.\n\tif(owgis.ncwms.animation.status.current !== owgis.ncwms.animation.status.none){\n\t\tclearLoopHandler();\n\t\towgis.ncwms.animation.dispAnimation();\n\t}\n}", "function updateSelectedColor(newColor) {\n selectedColor = newColor;\n page3_selected_color.style.backgroundColor = selectedColor;\n\n //For the current implementation text color has the same value with the drawing color\n canvas_text_color = newColor;\n}", "function rainbowColor() {\n updatePenMode(\"random\");\n}", "function revertCardColor(){\n setTimeout(removeCardColor, 1000);\n}", "function alternateColors(){\n effectInterval = setInterval(function(){\n var red = Math.floor(Math.random() * 255);\n var green = Math.floor(Math.random() * 255);\n var blue = Math.floor(Math.random() * 255);\n var color =\"rgba(\" + red + \", \" + green + \", \" + blue + \", 100)\";\n drawScreen(color);\n }, 1500);\n}", "function initSpectrum(){\n $(\".cm-colorPicker\").spectrum({\n clickoutFiresChange: true,\n hide: function(color){\n $(\".cm-dialog\").addClass(\"cm-inactive\")\n },\n change: function(color){\n colorScheme[currentClass] = createColorCSS(\n [$(\"#cm-bgColorPicker\").spectrum(\"get\").toHexString(),\n $(\"#cm-fontColorPicker\").spectrum(\"get\").toHexString()]\n )\n\n if(currentClass < borderScheme.length )\n if(borderScheme[currentClass]) {\n borderScheme[currentClass]['border-color'] = $(\"#cm-borderColorPicker\").spectrum(\"get\").toHexString()\n }\n\n updateColorScheme()\n updateBorderScheme()\n }\n })\n\n $(\".sp-replacer.sp-light\").addClass(\"cm-colorPicker\")\n }", "function switchtoBrush()\r\n{\r\n isEraser=false;\r\n activeElement.textContent=\"BRUSH\";\r\n brush.style.color=\"white\";\r\n brush.style.backgroundColor=\"black\";\r\n currentColor=`#${brushColor.value}`;\r\n currentSize=10;\r\n brushSize.innerText=currentSize;\r\n brushSizeRanger.value=currentSize;\r\n}", "function changeColor(){\n\t\tnewColor = $('#color').val();\n\t\tif(validateCssColour(newColor)){\n\t\tmyColor = newColor;\n\t\t}else{\n\t\t\twindow.alert(\"Invalid Color Entry\");\n\t\t}\n}", "function getNewColors() {\n circleBodyColor = getRandomColor();\n circleLineColor = getRandomColor();\n canvas.style.backgroundColor = getRandomColor();\n}", "function change_background(){\r\n\r\n for(x=0;x<6;x++){\r\n generated = hexa[color_generator()];\r\n color += generated;\r\n\r\n };\r\n body.style.backgroundColor = color;\r\n span.innerText = color;\r\n color = \"#\"; // reinitialize the value of color to '#'\r\n \r\n\r\n \r\n\r\n \r\n}", "function Start() {\n\t\toriginalColor = GetComponent.<Renderer>().material.color;\t\n}", "function initializeColorPicker(newColor) {\n\n $(\".full-spectrum\").spectrum({\n showPaletteOnly: true,\n showPalette: true,\n color: newColor,\n palette: [\n [\"rgb(0, 0, 0)\", \"rgb(67, 67, 67)\", \"rgb(102, 102, 102)\",\n \"rgb(204, 204, 204)\", \"rgb(217, 217, 217)\",\"rgb(255, 255, 255)\"],\n [\"rgb(152, 0, 0)\", \"rgb(255, 0, 0)\", \"rgb(255, 153, 0)\", \"rgb(0, 255, 0)\",\n \"rgb(0, 255, 255)\", \"rgb(74, 134, 232)\", \"rgb(0, 0, 255)\", \"rgb(153, 0, 255)\", \"rgb(255, 0, 255)\"], \n [\"rgb(221, 126, 107)\", \"rgb(234, 153, 153)\", \"rgb(249, 203, 156)\", \"rgb(182, 215, 168)\", \n \"rgb(162, 196, 201)\", \"rgb(164, 194, 244)\", \"rgb(159, 197, 232)\", \"rgb(180, 167, 214)\", \"rgb(213, 166, 189)\"], \n [\"rgb(204, 65, 37)\", \"rgb(224, 102, 102)\", \"rgb(246, 178, 107)\", \"rgb(100, 196, 100)\", \n \"rgb(118, 165, 175)\", \"rgb(109, 158, 235)\", \"rgb(111, 168, 220)\", \"rgb(142, 124, 195)\", \"rgb(194, 123, 160)\"],\n [\"rgb(166, 28, 0)\", \"rgb(204, 0, 0)\", \"rgb(230, 145, 56)\", \"rgb(0, 168, 0)\",\n \"rgb(69, 129, 142)\", \"rgb(60, 120, 216)\", \"rgb(61, 133, 198)\", \"rgb(103, 78, 167)\", \"rgb(166, 77, 121)\"],\n [\"rgb(91, 15, 0)\", \"rgb(102, 0, 0)\", \"rgb(120, 63, 4)\", \"rgb(39, 78, 19)\", \n \"rgb(12, 52, 61)\", \"rgb(28, 69, 135)\", \"rgb(7, 55, 99)\", \"rgb(32, 18, 77)\", \"rgb(76, 17, 48)\"]\n ],\n change: function(color) {\n colorToChange = color.toHexString();\n }\n });\n}" ]
[ "0.7432713", "0.7284326", "0.7051959", "0.70502335", "0.6856662", "0.6855608", "0.6664189", "0.6534531", "0.6512329", "0.6476402", "0.6458809", "0.6434669", "0.6433338", "0.6391654", "0.6373688", "0.63562334", "0.63554585", "0.63537407", "0.63522184", "0.63360846", "0.63210684", "0.6307063", "0.6301422", "0.63011146", "0.6268265", "0.62657166", "0.6243728", "0.6241216", "0.62342465", "0.62272674", "0.6211284", "0.619042", "0.61714286", "0.6146713", "0.6120307", "0.6117737", "0.60856515", "0.6083708", "0.60771537", "0.607613", "0.6063565", "0.6057072", "0.6051117", "0.6050739", "0.6050015", "0.6037751", "0.60348755", "0.6028306", "0.6028104", "0.6024359", "0.6021918", "0.60194653", "0.60078955", "0.6006737", "0.59786445", "0.5966258", "0.59654135", "0.5962412", "0.59426326", "0.5932625", "0.5923677", "0.59216917", "0.5919452", "0.5917986", "0.5912977", "0.5906921", "0.59051746", "0.588916", "0.58861375", "0.5884131", "0.5881447", "0.58723927", "0.5869859", "0.58671933", "0.58642346", "0.58609825", "0.585966", "0.5851854", "0.5850439", "0.5847397", "0.5846274", "0.58438885", "0.58281577", "0.5827603", "0.5825875", "0.5825518", "0.58239007", "0.58200336", "0.58180684", "0.5817698", "0.5813706", "0.58125323", "0.5811309", "0.5804957", "0.5803363", "0.5802445", "0.57989484", "0.5796811", "0.5794492", "0.57936686", "0.5788461" ]
0.0
-1
$e("filters").innerHTML = $e("filters").innerHTML + stringTeste;
function new_toogle_button(classButton, textButton){ return "<span class=\"padding\" style=\"cursor:pointer;\" onclick=\""+classButton+"()\" >&nbsp;&nbsp;&nbsp;&nbsp;"+textButton+"&nbsp;<img src=\"/pics/sort_btn_gray_on.gif\" class=\""+classButton+"\"/></span>"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setHtmlDetails(text){\n\n document.getElementById(\"where\").innerHTML = text;\n}", "function imprimirItemFilter(filtrado){\n estructuraFilter += '<div id=\"itemID-' + filtrado.id + '\" class=\"chopping-item\">'+ estructuraPrincipalItem(filtrado) +'</div>';\n document.getElementById(\"shopping-body\").innerHTML = estructuraFilter;\n printPriceCart();\n}", "function changeFilterQ(Q) {\n filter.Q.value = Q;\n filterQ.innerHTML = Q;\n}", "_render(html){this.$.container.innerHTML=html}", "function stringDisplay (value) {\n var str = value + \"<br>\";\n strEle.innerHTML += str;\n}", "function updateContainer(string) {\n jsonContainer.innerHTML = string;\n console.log(`update json container + ${string}`);\n}", "function filterDirector(){\n\t$(\".searchMovieFilter\").html('Director <span class=\"caret\"></span>');\n}", "function eraser(style, status, value) {\n var str = $('#visuel main').text();\n $('#visuel main').html(str);\n // $('#visuel main').wrap('<div></div>');\n}", "function displayFilterValues(filters) {\n var filterContainerElement = document.getElementById(\"filterTableBody\");\n var innerHtml = \"\" ;\n filters.forEach(filter => {\n if (filter.$type === \"categorical\") {\n var appliedValues = \"\";\n filter.$appliedValues.forEach(value => {\n appliedValues += `<span class=\"badge badge-primary\"> ${value.formattedValue} </span> \\n`;\n });\n innerHtml += `\n <tr>\n <th> ${filter.$caption} </th>\n <td> ${appliedValues} <td>\n </tr> \\n`; \n }\n });\n filterContainerElement.innerHTML = innerHtml;\n}", "function display_result(display_string) {\n output.document.body.innerHTML = display_string;\n}", "function renderFilters(filters) {\n filter.innerHTML = filters.map(\n value => \"<option value=\" + value + \">\" + value + \"</option>\").join();\n}", "function showText(e){\n $(e).html($(e).find('span').html());\n}", "htmlForSiGMLURL() {\nvar html;\n//--------------\nreturn html = `<input type=\"text\" class=\"txtSiGMLURL av${this.ix}\" value=\"${this.initsurl}\" />`;\n}", "function handle4() {\n var str = document.getElementById(\"demo7\").innerHTML; \n var txt = str.replace(\"Banana\",\"W3Schools\");\n document.getElementById(\"demo7\").innerHTML = txt;\n }", "function setText(text) {\n document.getElementById(\"result\").innerHTML = text;\n}", "appendHTML(s) {\n this._div_ele.innerHTML += s;\n }", "function innerHTML() {\n return 'innerHTML';\n }", "function changeInnerHTML() {\n\tlist[0].innerHTML = \"Click ME!\";\n}", "function cText(element, content) {\r\n document.getElementById(element).innerHTML = content;\r\n}", "function changeNameDataStream(elem)\n{\n var id=elem.id;\n id=id.replace(/ |inputNombre/g, \"\");\n var node = document.getElementById(\"dataStreamH2\"+id);\n node.innerHTML=elem.value;\n}", "function filterTitle(){\n\t$(\".searchMovieFilter\").html('Title <span class=\"caret\"></span>');\n}", "function displayInPreview(string) {\r\n var newDiv = document.createElement(\"div\"); \r\n var newContent = document.createTextNode(string); \r\n newDiv.appendChild(newContent);\r\n document.body.appendChild(newDiv)\r\n}", "function addToHTMLElement(str, elem){\n console.log('function that adds \"string\" to \"HTML element\"' );\n\n document.getElementById(elem).innerHTML = str;\n}", "function ponerDatosInputHtml(t){\n document.getElementById(\"tituloInput\").innerHTML = t;\n}", "function xInnerHtml(e,h)\r\n{\r\n if(!(e=xGetElementById(e)) || !xStr(e.innerHTML)) return null;\r\n var s = e.innerHTML;\r\n if (xStr(h)) {e.innerHTML = h;}\r\n return s;\r\n}", "function outf(text) { \n var mypre = document.getElementById(\"output\"); \n mypre.innerHTML = mypre.innerHTML + text; \n}", "function addData2(data, target) {\n let htmlString = data;\n document.querySelector(target).innerHTML = htmlString;\n}", "set innerHTML(newInnerHTML) {\n this.eachElem(elem => elem.innerHTML = newInnerHTML);\n }", "set innerHTML(newInnerHTML) {\n this.eachElem(elem => elem.innerHTML = newInnerHTML);\n }", "function filtrosPartidos(filtro, columna) {\n //Activar el filtro por letra\n var columna_elegida = document.getElementsByClassName('col_' + columna);\n var nuevo_texto = '';\n switch (filtro) {\n case '1':\n nuevo_texto = 'L';\n break;\n case '2':\n nuevo_texto = 'E';\n break;\n case '3':\n nuevo_texto = 'V';\n break;\n }\n for (var i = 0; i < columna_elegida.length; i++) {\n columna_elegida.item(i).innerHTML = nuevo_texto;\n }\n\n \n}", "function set_item() {\n // change input value\n var y=$(this);\n y.innerHTML+=\"jfdksa\";\n var x=document.getElementById(\"ip\");\n x.innerHTML=x.innerHTML+y.innerHTML;\n}", "function setResults(str) {\n\t if (!str) str = \"<p id=\\\"noMapsSelected\\\">No maps selected - please click on a coloured rectangle on the map to the left that covers the area you are interested in</p>\";\n\t document.getElementById('results').innerHTML = str;\n\t}", "function e(e,t){return document.createTextNode(t?e.replace(b,\"\"):e)}", "function displayInPreview(string) {\n var newDiv = document.createElement(\"div\"); \n var newContent = document.createTextNode(string); \n newDiv.appendChild(newContent);\n document.body.appendChild(newDiv)\n}", "function displayInPreview(string) {\n var newDiv = document.createElement(\"div\"); \n var newContent = document.createTextNode(string); \n newDiv.appendChild(newContent);\n document.body.appendChild(newDiv)\n}", "function displayInPreview(string) {\n var newDiv = document.createElement(\"div\"); \n var newContent = document.createTextNode(string); \n newDiv.appendChild(newContent);\n document.body.appendChild(newDiv)\n}", "function displayInPreview(string) {\n var newDiv = document.createElement(\"div\"); \n var newContent = document.createTextNode(string); \n newDiv.appendChild(newContent);\n document.body.appendChild(newDiv)\n}", "function displayInPreview(string) {\n var newDiv = document.createElement(\"div\"); \n var newContent = document.createTextNode(string); \n newDiv.appendChild(newContent);\n document.body.appendChild(newDiv)\n}", "function displayInPreview(string) {\n var newDiv = document.createElement(\"div\"); \n var newContent = document.createTextNode(string); \n newDiv.appendChild(newContent);\n document.body.appendChild(newDiv)\n }", "function displayList() {\r\ndocument.getElementById(\"favLanguages\").innerHTML = text;\r\n}", "function displayString(id,string){\n const elem = `\n <span>\n ${string}\n </span> `\n $(\"#\"+id).append(elem);\n}", "function DebugSquirt(strText, fClear)\r\n{\r\n if (true == fClear)\r\n {\r\n document.all.idStatus2.innerText = \"\";\r\n }\r\n\r\n document.all.idStatus2.innerText += strText;\r\n}", "function mylog(s) {\n var DEBUG_ELEMENT = document.getElementById(\"debugOutput\"); \n DEBUG_ELEMENT.innerHTML += s + \"<br />\"; \n}", "function showLanguageOption(item) {\n document.getElementById(\"dropdownLanguageOption\").innerHTML = item.innerHTML;\n}", "function replaceElement()\n {\n filtersPrepare(this);\n var replacement = applyModule( this.subject, this.module, this.context );\n replacement = filtersProcess(this, replacement);\n \n replacement = fixWhiteSpaceBeforeWriting( replacement );\n \n var dom_element = $( this.selector )[0];\n dom_element.innerHTML = replacement;\n }", "function setResults(str) {\n\t if (!str) str = \"<p>No photos selected - please click on a blue marker to view photos.</p>\";\n\t document.getElementById('results').innerHTML = str;\n\t}", "function printOutAMenu(htmlString) {\n\tdocument.getElementById(\"theMenuPanel\").innerHTML = htmlString;\n}", "function productSearch(){\r\n $(\"#search_type\").html(\"<span id='type'>Product</span> <span class='caret'></span>\");\r\n}", "function clickButton(event) {\n\tbar.value = bar.value + event.srcElement.innerHTML;\n}", "function identLivro(iTest, iLivro){\n\tvar nomeLivro=document.getElementById(\"nomeLivro\");\n\tnomeLivro.innerHTML='<span id=\"nomeLivro\">'+nomeLivroTest(iTest, iLivro)+'</span><br /><span id=\"especLivro\">'+especLivroTest(iTest, iLivro)+'</span>'\n}", "function displayString(result) {\n let output = document.getElementById(\"results\");\n output.innerText = `${result}`;\n\n }", "function resToggleFilter(e){\n e.preventDefault();\n resfilters.classList.toggle(\"res__hidden\");\n\n if(resfilters.classList.contains(\"res__hidden\") == true){\n resFilterSpan.innerText = '+';\n }else{\n resFilterSpan.innerText = '-';\n }\n}", "function displayFilter() {\n\n // Save name of pre-existing filter \n let filterName = $(\"#filter-name\").text();\n //console.log(filterName)\n\n // Display filter only if one is selected\n $(\"#filter-selected\").text( filterName ==\"\" ? \"\": (\"Filter: \" + filterName))\n}", "set innerHtml(newInnerHtml) {\n this.innerHTML = newInnerHtml;\n }", "set innerHtml(newInnerHtml) {\n this.innerHTML = newInnerHtml;\n }", "function displayFilter(){\n let disp = document.createElement('div');\n disp.id = \"filter\";\n let buttn1 = document.createElement('button');\n let buttn2 = document.createElement('button');\n let buttn3 = document.createElement('button');\n buttn1.innerHTML = \"All\"\n buttn2.innerHTML = \"Complete\";\n buttn3.innerHTML = \"Active\";\n buttn1.id = \"all\";\n buttn2.id = \"complete\";\n buttn3.id = \"active\";\n disp.appendChild(buttn1);\n disp.appendChild(buttn2);\n disp.appendChild(buttn3);\n document.getElementById('#display').appendChild(disp);\n}", "function setTextBoxCreateFilter(){\r\n/*\r\n var box = $('iframe#canvas_frame', parent.document).contents().find('td.bN.bR');\r\n \r\n if(box.is('*')) \r\n GM_log(\"Found the linck object with class = \" + box.attr(\"id\"));\r\n else \r\n GM_log(\"Class 'rf' was not find\");\r\n\r\n*/\r\n \r\n//looking for element of Create a Filter.\r\n//Return two elements. The first element is the show search options and the second is Create a Filter.\r\n var createfilter = $('iframe#canvas_frame', parent.document).contents().find('td.bN.bR').find('span.toxOdd');\r\n//Dispatch event of click ate the second element.\r\n simulateClick(createfilter.get()[1]);\r\n//Fill the boxes of Create a Filter\r\n clickCreateFilter();\r\n \r\n GM_log(\"Elementos da busca pelo createfilter: \" + createfilter.get()); \r\n \r\n }", "function innerHTML() {\n return 'innerHTML';\n}", "function innerHTML() {\n return 'innerHTML';\n}", "function updateOutput(el, val) {\n el.textContent = val;\n}", "function reRender() {\n input.innerText = buffer;\n}", "function printDOM (e) {\n printDiv.innerHTML = e;\n}", "function slider_onChange(str) {\n var out = document.getElementById(\"out\".concat(str));\n if (str === 'PL') {\n out.innerHTML = priceLower.value;\n } else {\n out.innerHTML = priceUpper.value;\n }\n}", "function appendInner(tag, data) {\n tag.innerHTML = tag.innerHTML + data;\n}", "function btnOnApplyFilterClick(content, filter_name, silent=false) {\n let name = filter_name + '-filter-div';\n let elem = document.getElementById(name);\n let inputs = elem.getElementsByTagName('input');\n clearFilters(filter_name, true);\n for (let i=0; i < inputs.length; i++) {\n let id = inputs[i].id;\n let value = inputs[i].value;\n if (value == '') {\n let spanID = 'span-' + id;\n removeFilter(spanID);\n continue;\n }\n console.log('Applying filter (2): ' + id + ' == ' + value);\n GM_setValue(id, value); // Save in storage\n filterArray.push(value.toLowerCase()); // Save in-mem\n }\n\n // Reset and run through the filter...\n filterReset(content);\n if (filterArray.length > 0) {filter(filter_name, content, null);}\n\n if (!silent) {\n let text = 'Filters Applied!\\n';\n filterArray.forEach(item => (text = text + '\\n\\t' + item));\n alert(text);\n }\n}", "function test(id,result){\n document.getElementById(id).innerHTML = JSON.stringify(result);\n}", "function QL(){\r\n\t\tvar content = document.getElementById(\"PSMWE_content\");\r\n\t\tcontent.innerHTML = QLCnt; \r\n}", "html(string) {\n \n if(string === undefined) {\n return this.nodes[0].innerHTML;\n } else {\n this.nodes.forEach((node) => {\n node.innerHTML = string;\n })\n }\n }", "function clickHandler(){\n var content = \"translated text for \";\n outputDiv.innerText= content +txtInput.value +\" : \"+\" bhgt ftctfe rx<>nug 6guy&\" \n console.log(outputDiv); \n}", "function addContent() {\n var temp = event.srcElement.innerText;\n if (temp == \"=\") {\n var equality = text_input;\n calculate(equality);\n }\n else if (temp == \"del\") {\n deleteContent();\n }\n else {\n text_input += temp;\n input.innerText = text_input;\n }\n}", "function displayContents(txt) {\n var el = document.getElementById('main');\n el.innerHTML = txt; //display output in DOM\n}", "function addToOutput(str) {\n\tget(\"program-output\").textContent += str;\n}", "function log(txt) {\n old = document.getElementById(\"test_log\").innerHTML;\n document.getElementById(\"test_log\").innerHTML = old + \"<br>\" + txt;\n}", "function agregarLi(){\n lista.innerHTML += \"<li>Elemento agregado por JS </li>\"\n}", "function onStaticTextRender(json)\r\n{\r\n $('#' + json.Id).html(json.Value);\r\n}", "function updatePercentFilterText(slider) {\n\tdocument.getElementById(\"filterPercentText\").innerHTML = \"\" + slider.value + \"%\";\n}", "function addFilter (title,id) {\n\t\tfilter='\\\n\t\t\t<div class=\"col-xs-6 param-item\">\\\n\t\t\t\t<a href=\"#\" class=\"icon-param remove-param selected\">\\\n\t\t\t\t\t<svg viewBox=\"0 0 489.307 489.307\">\\\n\t\t\t\t\t\t<g>\\\n\t\t\t\t\t\t\t<polygon points=\"489.307,56.466 432.839,0 244.654,188.187 56.468,0 0,56.466 188.186,244.654 0,432.839 56.469,489.307 244.654,301.121 432.839,489.307 489.306,432.839 301.121,244.654\"></polygon>\\\n\t\t\t\t\t\t</g>\\\n\t\t\t\t\t</svg>\\\n\t\t\t\t</a>\\\n\t\t\t\t<a href=\"#\" class=\"icon-param add_param\">\\\n\t\t\t\t\t<svg viewBox=\"0 0 51.997 51.997\">\\\n\t\t\t\t\t\t<path d=\"M51.911,16.242C51.152,7.888,45.239,1.827,37.839,1.827c-4.93,0-9.444,2.653-11.984,6.905 c-2.517-4.307-6.846-6.906-11.697-6.906c-7.399,0-13.313,6.061-14.071,14.415c-0.06,0.369-0.306,2.311,0.442,5.478 c1.078,4.568,3.568,8.723,7.199,12.013l18.115,16.439l18.426-16.438c3.631-3.291,6.121-7.445,7.199-12.014 C52.216,18.553,51.97,16.611,51.911,16.242z M15.999,9.904c-4.411,0-8,3.589-8,8c0,0.553-0.447,1-1,1s-1-0.447-1-1 c0-5.514,4.486-10,10-10c0.553,0,1,0.447,1,1S16.551,9.904,15.999,9.904z\"></path>\\\n\t\t\t\t\t</svg>\\\n\t\t\t\t\t<span class=\"\">'+title+'</span>\\\n\t\t\t\t</a>\\\n\t\t\t\t<input type=\"hidden\" value=\"N\" name=\"'+id+'\" id=\"'+id+'\">\\\n\t\t\t</div>\\\n\t\t';\n\t\t$('#ingridients-filter .smartfilter > div > div.filter-params').append(filter);\n\t}", "function render() {\n\tcontainer.innerHTML = htmlStr;\n}", "function OnExportEventClicked(o)\n{\n var s = GatherFilterSelections(o.getAttribute('filter_div'), o.getAttribute('is_calgroup').toLowerCase()); \n document.getElementById(o.getAttribute('hid_filter_info')).value = s;\n}", "function setInner( idString, htmlString )\r\n {\r\n if ( document.all )\r\n {\r\n document.all[ idString ].innerHTML = htmlString;\r\n }\r\n else\r\n {\r\n document.getElementById( idString ).innerHTML = htmlString;\r\n }\r\n }", "updateDisplay() {\n this.currentOperandTextElement.innerText = this.currentOperand\n}", "function updateaboveresult() {\naboveresult.innerHTML = currfunction + curroperator + buffer;\n}", "function redirecionar3(elemento) {\n elemento.innerHTML = \"O texto mudou!!!\";\n}", "function myFunction2(ide, texto, variavel) {\n var str = document.getElementById(ide).innerHTML; \n var res = str.replace(texto,variavel);\n document.getElementById(ide).innerHTML = res;\n}", "function originResult() {\r\n var input = document.getElementById(\"originSel\")\r\n var div = document.getElementById(\"originResult\");\r\n div.innerHTML = div.innerHTML + input.value;\r\n //console.log(div);\r\n}", "function appendFilterListText(type,operator,search){\n if(search){\n if(operator){\n var list = \"<li>\"\n +\"<span>\"+ type + \"</span>\"\n +\"<span>&nbsp;\" + operator + \"&nbsp;</span>\"\n +\"<span class='bold_name'>\"+ search +\"</span>\"\n +\"<button type='button' class='close_name' data-type='\"+type+\"'><i class='icn_cls_nm'></i></button>\"\n +\"<input type='hidden' name='\"+type+\"_search' value='\" + search + \"'>\"\n +\"<input type='hidden' name='\"+type+\"_operator' value='\"+operator+\"'>\"\n +\"</li>\"; \n \n $('#fltered-text-list').append(list);\n var page = null;\n getQuestions(page);\n }\n }\n}", "function cbGetAllTestLocations() {\n\tdocument.getElementById(\"data-content\").innerHTML = xmlhttpRequest.responseText;\n}", "addSearchHTML() {\n\t/* The following is the jQuery method to display live search window.\n\t The argument of append() has back quote, since it has HTML elements, which are \n\t defined by more than one line.\t*/ \n \t$(\"body\").append(` \n \t\t<div class=\"search-overlay\">\n\t\t <div class=\"search-overlay__top\">\n\t\t <div class=\"container\">\n\t\t <i class=\"fa fa-search search-overlay__icon\" aria-hidden=\"true\"></i>\n\t\t <input type=\"text\" class=\"search-term\" placeholder=\"What are you looking for?\" id=\"search-term\">\n\t\t <i class=\"fa fa-window-close search-overlay__close\" aria-hidden=\"true\"></i>\n\t\t </div>\n\t\t </div>\n\n\t\t <div class=\"container\">\n\t\t <div id=\"search-overlay__results\"></div>\n\t\t </div>\n \t\t</div>\n `);\n }", "function render() {\n container.innerHTML = htmlStr;\n}", "function setInnerHTML(element, html) {\n element[innerHTML()] = html;\n}", "function toSources(){\n document.getElementById(\"input\").innerHTML = sourceForm();\n}", "function renderTags2() {\r\n\r\n let strHtml = \"<option value=''>Escolher</option>\"\r\n for (let i = 0; i < tags.length; i++) {\r\n strHtml += `<option value='${tags[i]._id}'>${tags[i]._name}</option>`\r\n }\r\n let escolherTag = document.getElementById(\"inputSelTags\")\r\n escolherTag.innerHTML = strHtml\r\n\r\n}", "function addInMain(course) {\n main.innerHTML += course;\n}", "function changeDescription(element){\r\n console.log(element.innerText);\r\n document.getElementById('description').innerText = element.innerText;\r\n\r\n for(i=0; i<paras.length; i++) {\r\n if(element.innerText == paras[i].innerText) {\r\n document.getElementById('description').innerHTML = descriptionList[i];\r\n break;\r\n }\r\n }\r\n}", "function clicou(){\n //alert(\"Botao clicado\");\n\n //manipulando elementos no html\n document.getElementById(\"agradecimento\").innerHTML = \"Obrigado por clicar\";\n document.getElementById(\"agradecimento2\").innerHTML = \"<b>Obrigado por clicar</b>\";\n\n}", "function renderFilter(id) {\n var anchorId = \"f\" + id;\n var filterPath = $(\"#\" + id).attr(\"href\");\n var label = $(\"#\" + id).text();\n return '<span class=\"bwfilter\"><span class=\"bwFilterItemName\">' + label + '</span><a href=\"' + filterPath + '\" id=\"' + anchorId + '\">x</a></span> ';\n}", "function setDisp(){\n if (disp.innerHTML.length < 1){\n disp.innerHTML = this.innerHTML;\n } else if (clicked == true) {\n disp.innerHTML = this.innerHTML;\n clicked = false;\n } else {\n disp.innerHTML += this.innerHTML;\n }\n}", "function updateHTML(elmId, value) {\n document.getElementById(elmId).innerHTML = value;\n}", "esc(str) {\r\n let div = document.createElement(\"div\");\r\n div.appendChild(document.createTextNode(str));\r\n\r\n return div.innerHTML;\r\n }", "function combo(){\n alert(select);\n var label= __('amb1');\n var select= __('estEspecial').value;\n // alert(select);\n label.innerHTML= select;\n \n // alert(select.textContent);\n}", "function valueMenu(){\n menu.innerHTML = menuItems; \n\n}" ]
[ "0.6153464", "0.5838181", "0.5835688", "0.57965887", "0.57517594", "0.5701365", "0.5698193", "0.56826323", "0.5669122", "0.56671613", "0.5642336", "0.5618641", "0.56156814", "0.56136197", "0.5606953", "0.5599482", "0.5596889", "0.55816674", "0.55475926", "0.5539169", "0.55275375", "0.5516685", "0.55101687", "0.55030876", "0.55028415", "0.5469256", "0.54692304", "0.5464966", "0.5464966", "0.5458927", "0.5448943", "0.5445622", "0.5437731", "0.543011", "0.543011", "0.543011", "0.543011", "0.543011", "0.54252106", "0.54231346", "0.54216295", "0.5403711", "0.53998893", "0.5395139", "0.5386421", "0.53837883", "0.53833234", "0.538046", "0.537183", "0.5365147", "0.53645986", "0.53589284", "0.5357787", "0.53535014", "0.53535014", "0.5344254", "0.53358835", "0.53358793", "0.53358793", "0.5326939", "0.5321063", "0.5318894", "0.53185254", "0.5307615", "0.53075457", "0.53005254", "0.5294324", "0.52885777", "0.5285642", "0.52803725", "0.5278422", "0.5274208", "0.5273157", "0.52718806", "0.52639246", "0.5262526", "0.52591485", "0.5256906", "0.5256881", "0.525352", "0.5249377", "0.524677", "0.5241116", "0.52363914", "0.5234649", "0.5229176", "0.522707", "0.52221614", "0.52207285", "0.52203685", "0.522019", "0.5216936", "0.5214269", "0.5212266", "0.5210633", "0.5208802", "0.5208052", "0.52065355", "0.5203491", "0.5202791", "0.51967794" ]
0.0
-1
Removes all keyvalue entries from the list cache.
function listCacheClear() { this.__data__ = []; this.size = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listCacheClear(){this.__data__=[];}", "function listCacheClear(){this.__data__=[];}", "function listCacheClear(){this.__data__=[];}", "function listCacheClear(){this.__data__=[];}", "function listCacheClear() {\n\t\t this.__data__ = [];\n\t\t this.size = 0;\n\t\t}", "function listCacheClear() {\n\t\t this.__data__ = [];\n\t\t}", "function listCacheClear() {\n\t\t this.__data__ = [];\n\t\t}", "function listCacheClear() {\n\t\t this.__data__ = [];\n\t\t }", "function listCacheClear(){this.__data__=[];this.size=0}", "function listCacheClear(){this.__data__=[];this.size=0}", "function listCacheClear(){this.__data__=[];this.size=0;}", "function listCacheClear(){this.__data__=[];this.size=0;}", "function listCacheClear(){this.__data__=[];this.size=0;}", "function listCacheClear(){this.__data__=[];this.size=0;}", "function listCacheClear(){this.__data__=[];this.size=0;}", "function listCacheClear(){this.__data__=[];this.size=0;}", "function listCacheClear(){this.__data__=[];this.size=0;}", "function listCacheClear(){this.__data__=[];this.size=0;}", "function listCacheClear(){this.__data__=[];this.size=0;}", "function listCacheClear(){this.__data__=[];this.size=0;}", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t this.size = 0;\n\t }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n\t this.__data__ = [];\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t }", "function listCacheClear() {\n\t this.__data__ = [];\n\t }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }", "function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }" ]
[ "0.7357779", "0.7357779", "0.7357779", "0.7357779", "0.7317932", "0.72645503", "0.72645503", "0.7262977", "0.72569066", "0.72569066", "0.7236393", "0.7236393", "0.7236393", "0.7236393", "0.7236393", "0.7236393", "0.7236393", "0.7236393", "0.7236393", "0.7236393", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.7234546", "0.72320706", "0.7231067", "0.7231067", "0.7231067", "0.7231067", "0.7231067", "0.7231067", "0.7226719", "0.7226719", "0.7226719", "0.7226719", "0.7214961", "0.7214961", "0.7207822", "0.7207822", "0.7207822", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724", "0.71798724" ]
0.0
-1
Removes all keyvalue entries from the stack.
function stackClear() { this.__data__ = new ListCache(); this.size = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear () {\n this._dict = {}\n this._stack = [this._dict]\n }", "function stackClear(){this.__data__={'array':[],'map':null};}", "function stackClear(){this.__data__={'array':[],'map':null};}", "function stackClear(){this.__data__={'array':[],'map':null};}", "function stackClear() {\n\t this.__data__ = { 'array': [], 'map': null };\n\t }", "function stackClear() {\n\t this.__data__ = { 'array': [], 'map': null };\n\t}", "function stackClear() {\n\t this.__data__ = { 'array': [], 'map': null };\n\t}", "function stackClear() {\n\t this.__data__ = { 'array': [], 'map': null };\n\t}", "function stackClear() {\n\t this.__data__ = { 'array': [], 'map': null };\n\t}", "function stackClear() {\n\t this.__data__ = { 'array': [], 'map': null };\n\t}", "function stackClear() {\n\t this.__data__ = { 'array': [], 'map': null };\n\t}", "function stackClear() {\n\t this.__data__ = { 'array': [], 'map': null };\n\t}", "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n }", "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n }", "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n }", "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n }", "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n }", "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n }", "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n }", "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n }", "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n }", "function stackClear() {\n this.__data__ = new _ListCache.default();\n this.size = 0;\n }", "function stackClear() {\n\tthis.__data__ = new _ListCache();\n\tthis.size = 0;\n}", "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n}", "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n}", "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n}", "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n}", "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n}", "function stackClear() {\n this.__data__ = { 'array': [], 'map': null };\n}", "function stackClear() {\n\t this.__data__ = new _ListCache();\n\t this.size = 0;\n\t}", "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "function stackClear() {\n\t this.__data__ = new ListCache();\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache();\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache();\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache();\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache();\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache();\n\t this.size = 0;\n\t}", "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "function stackClear() {\n\t\t this.__data__ = new ListCache;\n\t\t this.size = 0;\n\t\t}", "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "function stackClear() {\n\t this.__data__ = new ListCache();\n\t}", "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "function stackClear() {\n this.__data__ = new ListCache();\n this.size = 0;\n }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t }", "function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }", "function stackClear() {\n\t this.__data__ = new ListCache();\n\t }", "function stackClear() {\n\t this.__data__ = new ListCache();\n\t this.size = 0;\n\t }", "function stackClear() {\n this.__data__ = new _ListCache.default();\n this.size = 0;\n}", "function stackClear() {\n this.__data__ = new _ListCache.default();\n this.size = 0;\n}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}", "function stackClear() {\n\t this.__data__ = new ListCache;\n\t this.size = 0;\n\t}" ]
[ "0.63577557", "0.63297385", "0.63297385", "0.63297385", "0.62740946", "0.6227898", "0.6227898", "0.6227898", "0.6227898", "0.6227898", "0.6227898", "0.6227898", "0.6217544", "0.6217544", "0.6217544", "0.6217544", "0.6217544", "0.6217544", "0.6217544", "0.6217544", "0.6217544", "0.6124813", "0.6124132", "0.61178505", "0.61178505", "0.61178505", "0.61178505", "0.61178505", "0.61178505", "0.6114505", "0.6110442", "0.6110442", "0.61054623", "0.61054623", "0.61054623", "0.61054623", "0.61054623", "0.61054623", "0.6102241", "0.6102241", "0.609908", "0.60988486", "0.60988486", "0.60988486", "0.60988486", "0.6078567", "0.60691255", "0.60691136", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.6068515", "0.60678905", "0.60670656", "0.6061252", "0.60456747", "0.60456747", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335", "0.60438335" ]
0.0
-1
Removes all keyvalue entries from the hash.
function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear() {\n var map = this._map;\n var keys = Object.keys(map);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n map[key].clear();\n }\n }", "function clear() {\n this.keys.forEach((key) => {\n this._store[key] = undefined;\n delete this._store[key];\n });\n}", "remove(key) {\r\n const hash = this.calculateHash(key);\r\n if(this.values.hasOwnProperty(hash) && this.values[hash].hasOwnProperty(key)) {\r\n delete this.values[hash][key];\r\n this.numberOfValues--;\r\n }\r\n }", "removeFromHash(hash, ...keys) {\n let hashObj = this.parseHash(hash);\n keys.forEach((key, i) => {\n delete hashObj[key]\n });\n return this.buildHash(hashObj);\n }", "clear() {\n log.map(\"Clearing the map of all the entries\");\n this._map.clear();\n }", "function _cleanupKeys()\n {\n if (this._count == this._keys.length) {\n return;\n }\n var srcIndex = 0;\n var destIndex = 0;\n var seen = {};\n while (srcIndex < this._keys.length) {\n var key = this._keys[srcIndex];\n if (_hasKey(this._map, key)\n && !_hasKey(seen, key)\n ) {\n this._keys[destIndex++] = key;\n seen[key] = true;\n }\n srcIndex++;\n }\n this._keys.length = destIndex;\n }", "async clear() {\n return await keyv.clear();\n }", "remove() {\n for (var key of this.keys) {\n this.elements[key].remove();\n }\n }", "function clear () {\n keys().each(function (cookie) {\n remove(cookie);\n });\n }", "function clearAll(){\r\n\tObject.keys(this.datastore).forEach((key)=>\r\n\t{\r\n\t\tdelete this.datastore[key];\r\n\t});\t\r\n}", "function hashClear() {\n\t\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t\t this.size = 0;\n\t\t}", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "clear() {\n for (const key of Object.keys(this.datastore)) {\n delete this.datastore[key];\n // this.remove(key);\n }\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n\t\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t\t this.size = 0;\n\t\t }", "function hashClear() {\n\t\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t\t this.size = 0;\n\t\t }", "function hashClear() {\n\t this.__data__ = nativeCreate ? nativeCreate(null) : {};\n\t this.size = 0;\n\t }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }", "function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }" ]
[ "0.67331547", "0.66229314", "0.65130246", "0.6456053", "0.62131137", "0.6201214", "0.6139392", "0.61100906", "0.6029288", "0.5966744", "0.59360605", "0.59072584", "0.59072584", "0.59072584", "0.59040016", "0.5900616", "0.5900616", "0.5900616", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.58648694", "0.5862478", "0.5862478", "0.5849724", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314", "0.58496314" ]
0.0
-1
Removes all keyvalue entries from the map.
function mapCacheClear() { this.size = 0; this.__data__ = { 'hash': new Hash(), 'map': new (Map || ListCache)(), 'string': new Hash() }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear() {\n var map = this._map;\n var keys = Object.keys(map);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n map[key].clear();\n }\n }", "clear() {\n log.map(\"Clearing the map of all the entries\");\n this._map.clear();\n }", "function multiMapRemove(map, key, value) {\n const values = map.get(key);\n if (values) {\n array_1.removeUnordered(values, value);\n if (values.length === 0)\n map.delete(key);\n }\n}", "function _cleanupKeys()\n {\n if (this._count == this._keys.length) {\n return;\n }\n var srcIndex = 0;\n var destIndex = 0;\n var seen = {};\n while (srcIndex < this._keys.length) {\n var key = this._keys[srcIndex];\n if (_hasKey(this._map, key)\n && !_hasKey(seen, key)\n ) {\n this._keys[destIndex++] = key;\n seen[key] = true;\n }\n srcIndex++;\n }\n this._keys.length = destIndex;\n }", "function clear() {\n this.keys.forEach((key) => {\n this._store[key] = undefined;\n delete this._store[key];\n });\n}", "remove() {\n for (var key of this.keys) {\n this.elements[key].remove();\n }\n }", "function mapClear(){this.__data__={'hash':new Hash(),'map':Map?new Map():[],'string':new Hash()};}", "function mapClear(){this.__data__={'hash':new Hash(),'map':Map?new Map():[],'string':new Hash()};}", "function mapClear(){this.__data__={'hash':new Hash(),'map':Map?new Map():[],'string':new Hash()};}", "function mapClear() {\n this.__data__ = { 'hash': new Hash, 'map': Map ? new Map : [], 'string': new Hash };\n }", "function mapClear() {\n this.__data__ = { 'hash': new Hash, 'map': Map ? new Map : [], 'string': new Hash };\n }", "function mapClear() {\n this.__data__ = { 'hash': new Hash, 'map': Map ? new Map : [], 'string': new Hash };\n }", "function mapClear() {\n\t this.__data__ = {\n\t 'hash': new Hash,\n\t 'map': Map ? new Map : [],\n\t 'string': new Hash\n\t };\n\t }", "remove(key) {\r\n const hash = this.calculateHash(key);\r\n if(this.values.hasOwnProperty(hash) && this.values[hash].hasOwnProperty(key)) {\r\n delete this.values[hash][key];\r\n this.numberOfValues--;\r\n }\r\n }", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n }", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n }", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n }", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n }", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n }", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n }", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n }", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n }", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n }", "function mapClear() {\n\t this.__data__ = {\n\t 'hash': new Hash(),\n\t 'map': Map ? new Map() : [],\n\t 'string': new Hash()\n\t };\n\t}", "function mapClear() {\n\t this.__data__ = { 'hash': new Hash, 'map': Map ? new Map : [], 'string': new Hash };\n\t}", "function mapClear() {\n\t this.__data__ = {\n\t 'hash': new Hash,\n\t 'map': Map ? new Map : [],\n\t 'string': new Hash\n\t };\n\t}", "function mapClear() {\n\t this.__data__ = {\n\t 'hash': new Hash,\n\t 'map': Map ? new Map : [],\n\t 'string': new Hash\n\t };\n\t}", "function mapClear() {\n\t this.__data__ = {\n\t 'hash': new Hash,\n\t 'map': Map ? new Map : [],\n\t 'string': new Hash\n\t };\n\t}", "function mapClear() {\n\t this.__data__ = {\n\t 'hash': new Hash,\n\t 'map': Map ? new Map : [],\n\t 'string': new Hash\n\t };\n\t}", "function mapClear() {\n\t this.__data__ = {\n\t 'hash': new Hash,\n\t 'map': Map ? new Map : [],\n\t 'string': new Hash\n\t };\n\t}", "function mapClear() {\n\t this.__data__ = {\n\t 'hash': new Hash,\n\t 'map': Map ? new Map : [],\n\t 'string': new Hash\n\t };\n\t}", "clear() {\n this.map = {};\n if (this.store) this.store.clear();\n }", "function clear()\r{\r\tvar end = mapping_names.length;\r\r\tfor(var i=end-1; i>=0; i--){\r\t\tremove(mapping_names[i]);\r\t}\r\twhile(mapping_names.pop());\r\twhile(mapping_sources.pop());\r\twhile(mapping_destinations.pop());\r\twhile(mapping_algorithms.pop());\r}", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n}", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n}", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n}", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n}", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n}", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n}", "function mapClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': Map ? new Map : [],\n 'string': new Hash\n };\n}", "function filterMutateMap(map, predicate) {\n for (const [key, value] of map) {\n if (!predicate(key, value)) {\n map.delete(key);\n }\n }\n}", "delete(key) {\n this.map[key] = undefined;\n if (this.store) this.store.removeItem(key);\n }", "mapRemove() {\n\n\t\tthis.map.remove();\n\n\t}", "garbageCollect() {\n // Q: Can we delete keys from the map while iterating over it?\n // A: The ECMA spec states that yes, keys may be deleted during forEach.\n // It is less clear for iterators.\n let deleteBefore = new Date().getTime() - MAX_GLOBAL_COOLDOWN;\n this._cooldowns.forEach((value, key) => {\n if (value < deleteBefore) {\n this._cooldowns.delete(key);\n }\n });\n }", "function clearAll(){\r\n\tObject.keys(this.datastore).forEach((key)=>\r\n\t{\r\n\t\tdelete this.datastore[key];\r\n\t});\t\r\n}", "async clear() {\n return await keyv.clear();\n }", "clear() {\n for (const key of Object.keys(this.datastore)) {\n delete this.datastore[key];\n // this.remove(key);\n }\n }", "function clearObjects() {\n setMapOnAll(null);\n}", "clear() {\n const _ = this;\n _._map.clear();\n _._nameSet.clear();\n }", "function mapCacheClear(){this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}", "function mapCacheClear(){this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}", "function mapCacheClear(){this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}", "function mapCacheClear(){this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}", "function clear () {\n keys().each(function (cookie) {\n remove(cookie);\n });\n }", "function clean_maps() {\n var count;\n list_maps();\n\n for (var k in maps) {\n for (var i = 0; i < maps[k].length; i++) {\n var map = maps[k][i];\n count++;\n\n // if map render job is idle and last render process is older than\n // an hour, remove map\n if (map.renderer_idle && (time() - map.renderer_stop > 3600000)) {\n console.log(k + '/' + i + ': garbage collector removes map');\n maps[k].splice(i, 1);\n i--;\n }\n }\n }\n}", "function mapCacheClear(){this.size=0;this.__data__={'hash':new Hash(),'map':new(Map$1||ListCache)(),'string':new Hash()};}", "function mapCacheClear(){this.size=0;this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}", "function mapCacheClear(){this.size=0;this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}", "function mapCacheClear(){this.size=0;this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}", "function mapCacheClear(){this.size=0;this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}", "function mapCacheClear(){this.size=0;this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}", "function mapCacheClear(){this.size=0;this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}", "function mapCacheClear(){this.size=0;this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}", "function mapCacheClear(){this.size=0;this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}", "function mapCacheClear(){this.size=0;this.__data__={'hash':new Hash(),'map':new(Map||ListCache)(),'string':new Hash()};}", "stopAll() {\n const _ = this;\n for (const entry of _._map.values()) {\n clearTimeout(entry.handle);\n }\n _._map.clear();\n }", "function mapCacheClear() {\n\t\t this.size = 0;\n\t\t this.__data__ = {\n\t\t 'hash': new Hash,\n\t\t 'map': new (Map || ListCache),\n\t\t 'string': new Hash\n\t\t };\n\t\t}", "function mapCacheClear() {\n\t\t this.__data__ = {\n\t\t 'hash': new Hash,\n\t\t 'map': new (Map || ListCache),\n\t\t 'string': new Hash\n\t\t };\n\t\t}", "function mapCacheClear() {\n\t\t this.__data__ = {\n\t\t 'hash': new Hash,\n\t\t 'map': new (Map || ListCache),\n\t\t 'string': new Hash\n\t\t };\n\t\t}", "function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new _Hash,\n 'map': new (_Map || _ListCache),\n 'string': new _Hash\n };\n }", "function mapCacheClear() {\n this.__data__ = {\n 'hash': new Hash(),\n 'map': new (Map$1 || ListCache)(),\n 'string': new Hash()\n };\n }", "function mapCacheClear() {\n this.__data__ = {\n 'hash': new Hash(),\n 'map': new (Map$1 || ListCache)(),\n 'string': new Hash()\n };\n }", "function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new _Hash(),\n 'map': new (_Map || _ListCache)(),\n 'string': new _Hash()\n };\n }", "clearance () {\n mapDoS.forEach((val, key, map) => {\n if (val.at < moment().utc().subtract(val.interval, 'seconds')) {\n map.delete(key)\n }\n })\n }", "function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new _Hash.default(),\n 'map': new (_Map.default || _ListCache.default)(),\n 'string': new _Hash.default()\n };\n }", "function mapCacheClear() {\n\t this.size = 0;\n\t this.__data__ = {\n\t 'hash': new _Hash(),\n\t 'map': new (_Map || _ListCache)(),\n\t 'string': new _Hash()\n\t };\n\t}", "function clearEntry () {\n\n nextValue = null;\n}", "remove(key) {\n let index = this._hash(key);\n if (this.keyMap[index] && this.keyMap[index].length) {\n this.keyMap[index] = undefined;\n this.size--;\n return true;\n } else {\n return false;\n }\n }", "function mapCacheClear() {\n\t this.size = 0;\n\t this.__data__ = {\n\t 'hash': new _Hash,\n\t 'map': new (_Map || _ListCache),\n\t 'string': new _Hash\n\t };\n\t}", "function mapCacheClear() {\n\t this.size = 0;\n\t this.__data__ = {\n\t 'hash': new _Hash,\n\t 'map': new (_Map || _ListCache),\n\t 'string': new _Hash\n\t };\n\t}", "function mapCacheClear() {\n\t this.size = 0;\n\t this.__data__ = {\n\t 'hash': new _Hash,\n\t 'map': new (_Map || _ListCache),\n\t 'string': new _Hash\n\t };\n\t}", "function mapCacheClear() {\n\t this.size = 0;\n\t this.__data__ = {\n\t 'hash': new _Hash,\n\t 'map': new (_Map || _ListCache),\n\t 'string': new _Hash\n\t };\n\t}", "function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map$1 || ListCache),\n 'string': new Hash\n };\n }", "function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map$1 || ListCache),\n 'string': new Hash\n };\n }", "function mapCacheClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map$1 || ListCache),\n 'string': new Hash\n };\n }", "function mapCacheClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map$1 || ListCache),\n 'string': new Hash\n };\n }", "function mapCacheClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map$1 || ListCache),\n 'string': new Hash\n };\n }", "function clearAllMarkers() {\n setMarkersOnMap(null);\n}", "function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash(),\n 'map': new (Map || ListCache)(),\n 'string': new Hash()\n };\n }", "function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash(),\n 'map': new (Map || ListCache)(),\n 'string': new Hash()\n };\n }", "function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new _Hash,\n 'map': new (_Map || _ListCache),\n 'string': new _Hash\n };\n }", "function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new _Hash,\n 'map': new (_Map || _ListCache),\n 'string': new _Hash\n };\n }", "function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new _Hash,\n 'map': new (_Map || _ListCache),\n 'string': new _Hash\n };\n }", "clear () {\n if (this.doc !== null) {\n transact(this.doc, transaction => {\n this.forEach(function (_value, key, map) {\n typeMapDelete(transaction, map, key)\n })\n })\n } else {\n /** @type {Map<string, any>} */ (this._prelimContent).clear()\n }\n }", "function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map$1 || ListCache),\n 'string': new Hash\n };\n }", "function mapCacheClear() {\n\tthis.size = 0;\n\tthis.__data__ = {\n\t\thash: new _Hash(),\n\t\tmap: new ( _Map || _ListCache )(),\n\t\tstring: new _Hash(),\n\t};\n}", "function mapCacheClear() {\n\t this.__data__ = {\n\t 'hash': new Hash(),\n\t 'map': new (Map || ListCache)(),\n\t 'string': new Hash()\n\t };\n\t }", "function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash(),\n 'map': new (Map || ListCache)(),\n 'string': new Hash()\n };\n }", "function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash(),\n 'map': new (Map || ListCache)(),\n 'string': new Hash()\n };\n }", "function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash(),\n 'map': new (Map || ListCache)(),\n 'string': new Hash()\n };\n }", "function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash(),\n 'map': new (Map || ListCache)(),\n 'string': new Hash()\n };\n }" ]
[ "0.75903755", "0.70695037", "0.6735827", "0.6653031", "0.653072", "0.62686956", "0.62589216", "0.62589216", "0.62589216", "0.6171725", "0.6171725", "0.6171725", "0.61668706", "0.61542076", "0.61483264", "0.61483264", "0.61483264", "0.61483264", "0.61483264", "0.61483264", "0.61483264", "0.61483264", "0.61483264", "0.6129316", "0.61083436", "0.6102572", "0.6102572", "0.6102572", "0.6102572", "0.6102572", "0.6102572", "0.60481787", "0.6027264", "0.6026858", "0.6026858", "0.6026858", "0.6026858", "0.6026858", "0.6026858", "0.6026858", "0.6008437", "0.60051334", "0.59840614", "0.5941033", "0.59227663", "0.5905649", "0.59043545", "0.58627266", "0.58590937", "0.58491385", "0.58491385", "0.58491385", "0.58491385", "0.58478343", "0.584277", "0.5827582", "0.57244766", "0.57244766", "0.57244766", "0.57244766", "0.57244766", "0.57244766", "0.57244766", "0.57244766", "0.57244766", "0.57237166", "0.572015", "0.5709594", "0.5709594", "0.57051027", "0.5700249", "0.5700249", "0.5690896", "0.5687186", "0.5685133", "0.56837755", "0.5683209", "0.5682783", "0.5674986", "0.5674986", "0.5674986", "0.5674986", "0.5674573", "0.5674573", "0.56732154", "0.56732154", "0.56732154", "0.5661311", "0.5660363", "0.5660363", "0.5656474", "0.5656474", "0.5656474", "0.5654478", "0.56475437", "0.5645015", "0.56353635", "0.5631423", "0.5631423", "0.5631423", "0.5631423" ]
0.0
-1
:: _current: HTMLElement; _container: HTMLElement; _promoted: boolean; _currentData: ?Object;
constructor() { this._promoteTarget = canvas => ({ target } /*: {target: Element}*/) => { if (target !== canvas || this._promoted) return; this._container.style.willChange = 'transform'; }; this._demoteTarget = canvas => ({ target, relatedTarget } /*: {target: Element, relatedTarget: Element}*/ ) => { if (target !== canvas || !this._promoted) return; if (relatedTarget && relatedTarget === this._container) return; this._container.style.willChange = ''; }; this._replaceTooltipContent = data => { this._current = buildTooltipContent(dataToMarkup(data)); this._container.replaceChild(this._current, this._container.firstElementChild); }; this._hide = () => { this._container.classList.add('hidden'); this._visible = false; }; this._display = ({ x, y }) => { this._container.style.transform = `translate(${x}px, ${y + acceptedMargin}px)`; this._container.classList.remove('hidden'); }; this._handleMouseOver = (e /*: MouseEvent */) => { const data = e.target[ns]; if (this._currentData === data || !(this._currentData || data)) return; this._currentData = data; this._replaceTooltipContent(data); this._display(findBestTooltipPosition(getEntityBBox(e.target), this._container.getBoundingClientRect())); }; this._handleMouseOut = (e /*: MouseEvent */) => { const data = e.target[ns]; if (!data) return; if (e.relatedTarget === this._container) return; const relatedData = e.relatedTarget[ns]; if (relatedData === this._currentData) return; // enter part of same entity this._currentData = relatedData || null; if (relatedData) { // switch tooltip content this._replaceTooltipContent(relatedData); this._display(findBestTooltipPosition(getEntityBBox(e.relatedTarget), this._container.getBoundingClientRect())); } else { // hide tooltip this._hide(); } }; // If no DOM, no need to do anything if (!window) return; // container const cont = document.createElement('div'); cont.classList.add(className); cont.classList.add('hidden'); cont.style.position = 'fixed'; cont.style.left = '0'; cont.style.top = '0'; // cont.style.border = '1px solid rgba(0, 0, 255, 0.2)'; // current node in container const curr = buildTooltipContent('<p>placeholder</p>'); cont.appendChild(curr); // attach to instance this._current = curr; this._container = cont; // append to DOM if (!document.body) throw new Error('No body in document'); document.body.appendChild(cont); this._promoted = false; // CSS if (!document.head) throw new Error('No head in document'); document.head.appendChild(getStyleSheet({ className, acceptedMargin })); // add event listener to the tooltip itself cont.addEventListener('mouseleave', e => { const relatedData = e.relatedTarget[ns]; if (relatedData === this._currentData) return; // enter part of same entity this._currentData = relatedData || null; if (relatedData) { // switch tooltip content this._replaceTooltipContent(relatedData); this._display(findBestTooltipPosition(getEntityBBox(e.relatedTarget), this._container.getBoundingClientRect())); } else { // hide tooltip this._hide(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getCurrent(){\n return current || null;\n }", "function getData(internalInstance) {\n var children = null;\n var props = null;\n var state = null;\n var context = null;\n var updater = null;\n var name = null;\n var type = null;\n var key = null;\n var ref = null;\n var source = null;\n var text = null;\n var publicInstance = null;\n var nodeType = 'Native';\n // If the parent is a native node without rendered children, but with\n // multiple string children, then the `element` that gets passed in here is\n // a plain value -- a string or number.\n if ((typeof internalInstance === 'undefined' ? 'undefined' : (0, _typeof3.default)(internalInstance)) !== 'object') {\n nodeType = 'Text';\n text = internalInstance + '';\n } else if (internalInstance._currentElement === null || internalInstance._currentElement === false) {\n nodeType = 'Empty';\n } else if (internalInstance._renderedComponent) {\n nodeType = 'NativeWrapper';\n children = [internalInstance._renderedComponent];\n props = internalInstance._instance.props;\n state = internalInstance._instance.state;\n context = internalInstance._instance.context;\n if (context && (0, _keys2.default)(context).length === 0) {\n context = null;\n }\n } else if (internalInstance._renderedChildren) {\n children = childrenList(internalInstance._renderedChildren);\n } else if (internalInstance._currentElement && internalInstance._currentElement.props) {\n // This is a native node without rendered children -- meaning the children\n // prop is just a string or (in the case of the <option>) a list of\n // strings & numbers.\n children = internalInstance._currentElement.props.children;\n }\n if (!props && internalInstance._currentElement && internalInstance._currentElement.props) {\n props = internalInstance._currentElement.props;\n }\n // != used deliberately here to catch undefined and null\n if (internalInstance._currentElement != null) {\n type = internalInstance._currentElement.type;\n if (internalInstance._currentElement.key) {\n key = String(internalInstance._currentElement.key);\n }\n source = internalInstance._currentElement._source;\n ref = internalInstance._currentElement.ref;\n if (typeof type === 'string') {\n name = type;\n if (internalInstance._nativeNode != null) {\n publicInstance = internalInstance._nativeNode;\n }\n if (internalInstance._hostNode != null) {\n publicInstance = internalInstance._hostNode;\n }\n } else if (typeof type === 'function') {\n nodeType = 'Composite';\n name = getDisplayName(type);\n // 0.14 top-level wrapper\n // TODO(jared): The backend should just act as if these don't exist.\n if (internalInstance._renderedComponent && (internalInstance._currentElement.props === internalInstance._renderedComponent._currentElement || internalInstance._currentElement.type.isReactTopLevelWrapper)) {\n nodeType = 'Wrapper';\n }\n if (name === null) {\n name = 'No display name';\n }\n } else if (typeof internalInstance._stringText === 'string') {\n nodeType = 'Text';\n text = internalInstance._stringText;\n } else {\n name = getDisplayName(type);\n }\n }\n if (internalInstance._instance) {\n var inst = internalInstance._instance;\n updater = {\n setState: inst.setState && inst.setState.bind(inst),\n forceUpdate: inst.forceUpdate && inst.forceUpdate.bind(inst),\n setInProps: inst.forceUpdate && setInProps.bind(null, internalInstance),\n setInState: inst.forceUpdate && setInState.bind(null, inst),\n setInContext: inst.forceUpdate && setInContext.bind(null, inst)\n };\n if (typeof type === 'function') {\n publicInstance = inst;\n }\n // TODO: React ART currently falls in this bucket, but this doesn't\n // actually make sense and we should clean this up after stabilizing our\n // API for backends\n if (inst._renderedChildren) {\n children = childrenList(inst._renderedChildren);\n }\n }\n if (typeof internalInstance.setNativeProps === 'function') {\n // For editing styles in RN\n updater = {\n setNativeProps: function setNativeProps(nativeProps) {\n internalInstance.setNativeProps(nativeProps);\n }\n };\n }\n return {\n nodeType: nodeType,\n type: type,\n key: key,\n ref: ref,\n source: source,\n name: name,\n props: props,\n state: state,\n context: context,\n children: children,\n text: text,\n updater: updater,\n publicInstance: publicInstance\n };\n}", "getCurrent() \r\n\t{\r\n\t\treturn this.current;\r\n\t}", "get HTMLElement() {\n return this.representedHTMLElement;\n }", "get HTMLElement() {\n return this.representedHTMLElement;\n }", "static dispcurr(data) {\n current.innerText = data;\n return;\n }", "function getCurrent(visualElement) {\n var current = {};\n visualElement.forEachValue(function (value, key) { return (current[key] = value.get()); });\n return current;\n}", "function getCurrent(visualElement) {\n var current = {};\n visualElement.forEachValue(function (value, key) { return (current[key] = value.get()); });\n return current;\n}", "function getCurrent(visualElement) {\n var current = {};\n visualElement.forEachValue(function (value, key) { return (current[key] = value.get()); });\n return current;\n}", "function getCurrent(visualElement) {\n var current = {};\n visualElement.forEachValue(function (value, key) { return (current[key] = value.get()); });\n return current;\n}", "get currentWidget() {\n return this._pool.current || null;\n }", "function ElementData() { }", "function ElementData() { }", "function currentElement() {\n\tvar sel = window.getSelection();\n\tconsole.log(sel);\n\tvar\tnode = sel.anchorNode;\n\tif (!node) {\n\t\treturn null;\n\t}\n\tif (node.textContent !== \"\") {\n\t\tnode = sel.anchorNode.parentElement;\n\t}\n\n\t//Return jQuery object so it can be used with jQuery .after() \n\tvar jObject = $('[data-index=\"' + node.dataset.index + '\"]');\n\treturn jObject;\n}", "get currentNode()\n {\n var index = this.mDOMTree.currentIndex;\n return this.getNodeFromRowIndex(index);\n }", "function ElementData() {}", "function ElementData() {}", "function ElementData() {}", "function v(e) {\n var t = e.type;\n m(t), this._currentElement = e, this._tag = t.toLowerCase(), this._namespaceURI = null, \n this._renderedChildren = null, this._previousStyle = null, this._previousStyleCopy = null, \n this._hostNode = null, this._hostParent = null, this._rootNodeID = 0, this._domID = 0, \n this._hostContainerInfo = null, this._wrapperState = null, this._topLevelWrapper = null, \n this._flags = 0, this._ancestorInfo = null, te.call(this, null);\n }", "getPcElement(){return this.__pcElement}", "function updateElementProperties() {\n // evaluation of current selected element.\n //chrome.devtools.inspectedWindow.eval(\"$0.tagName\", th)\n chrome.devtools.inspectedWindow.eval(\"$0.tagName || $0.localName || $0.nodeName\", function(result, error) {\n // Pushing the result.\n console.log(result);\n dataObj.tagName = result;\n\n chrome.devtools.inspectedWindow.eval(\"$0.innerText\", function(result, error) {\n // Pushing the result. JSON.stringify(result);\n console.log(result);\n dataObj.innerText = result;\n\n chrome.devtools.inspectedWindow.eval(\"$0.getAttributeNames()\", function(result, error) {\n // Pushing the result. JSON.stringify(result);\n console.log(result);\n dataObj.attributeKeys = result;\n\n chrome.devtools.inspectedWindow.eval(\"($0.getAttributeNames()).map(function(attrib){ return ('@' + attrib +'=\\\"'+ $0.getAttribute(attrib) +'\\\"'); });\", function(result, error) {\n // Pushing the result.\n console.log(result);\n dataObj.attributeData = result;\n\n chrome.devtools.inspectedWindow.eval(\"if($0.childNodes.length > 0) { $0.firstElementChild.tagName; } else {'No child'}\", function(result, error) {\n // Pushing the result. JSON.stringify(result);\n console.log(result);\n dataObj.firstChildNode = result;\n\n chrome.devtools.inspectedWindow.eval(\"if($0.nextElementSibling !== null) { $0.nextElementSibling.tagName; } else {'No Sibling'}\", function(result, error) {\n // Pushing the result. JSON.stringify(result);\n console.log(result);\n dataObj.nextSiblingNode = result;\n\n chrome.devtools.inspectedWindow.eval(\"$0.parentElement.tagName\", function(result, error) {\n // Pushing the result. JSON.stringify(result);\n console.log(result);\n dataObj.parentNode = result;\n\n // Update the data of the side panel.\n //sidebar.setPage('panel.html'); // Showing a page on this sidebar.\n //sidebar.setHeight(\"100px\");\n sidebar.setObject(updatePanelWithData(), \"Extracted Data for the current Selected element\", function(obj) {});\n\n });\n });\n });\n });\n });\n });\n });\n }", "function ElementData(){}", "#updateData() {\n this.container.querySelector('.data').innerHTML = this.data;\n }", "get prev() {return this._pp.prev;}", "function getArticleElement() {\r\n\t\treturn previewElement;\r\n\t}", "get currentWidget() {\n return this._tracker.currentWidget;\n }", "peek() {\n return this.head ? this.head.data : null;\n }", "static assign(element, data) {\n Object.assign(element._domData || (element._domData = {}), data);\n }", "static assign(element, data) {\n Object.assign(element._domData || (element._domData = {}), data);\n }", "getElement(){return this.__element}", "_getDomFromElement(element) {\n if (element.dom) {\n return element.dom;\n }\n\n if (element.element) {\n // console.log('Legacy ui.Element passed to pcui.Container', this.class, element.class);\n return element.element;\n }\n\n return element;\n }", "currentNode() {\n return this._currentNode || this.root;\n }", "get dataset() {\n return this.#el?.dataset ?? this.#dataset;\n }", "get value() {\n return this.#el?.value ?? this.#value;\n }", "get innerHTML() {\n return this.#el?.innerHTML ?? this.#innerHTML;\n }", "function getDomElement() {\n return getElement();\n } // ========================== Motion End ==========================", "function showCurrNode() {\r\n return this.currNode.element;\r\n }", "get currentItem() {\n let currentNode = window.getSelection().anchorNode\n\n if (currentNode.nodeType !== Node.ELEMENT_NODE) {\n currentNode = currentNode.parentNode\n }\n\n return currentNode.closest(`.${this.CSS.item.container}`)\n }", "peek(){\r\n return this.storage[this.top]\r\n }", "get any() {\n return this._node.first.currently;\n }", "get container() { return this._container; }", "get container() { return this._container; }", "get element() {\n\t\treturn this.__element;\n\t}", "get element() {\n\t\treturn this.__element;\n\t}", "_current() {\n return this._history[this.index];\n }", "asElement() {\n return null;\n }", "peek(){\n var topElement = this.start;\n return topElement;\n }", "function GetObject(current, name)\n{\n var src, doc;\n\n doc = current.document;\n while(!src) {\n if(doc.getElementById)\n src = doc.getElementById(name);\n else if(doc.all)\n src = doc.all[name];\n else if(doc.layers && doc.layers[name])\n src = doc.layers[name];\n\n /* Try the parent next */\n if(current == top)\n break;\n current = current.parent;\n doc = current.document;\n }\n return src;\n}", "get currentView() { return this._currentView; }", "get currentView() { return this._currentView; }", "get containedElement() {\n return Polymer.dom(this.$.content).getDistributedNodes()[0];\n }", "static get current() {\n return currentPage;\n }", "get parent() {\n const parent = this.nativeNode.parentNode;\n return parent ? new DebugElement(parent) : null;\n }", "peek() {\n // return this.front ? this.front.data : this.front;\n return this.front;\n }", "get selectedElement() {\n return this._selectedElement && this._selectedElement.get();\n }", "setNodeData() {\n const curNode = this.props.node;\n this.setState({\n ref: curNode.getRef(),\n fetching: true,\n asserts: [],\n invAsserts: [],\n elemClass: '',\n });\n\n API.getElemClass(curNode).then((elemClass) => {\n this.setState({elemClass: elemClass})\n });\n\n curNode.fetchRemoteData().then(() => {\n this.setState({\n asserts: curNode.assertions,\n invAsserts: curNode.invAssertions,\n fetching: false,\n });\n });\n }", "_triggerUpdatedNode(e){// get fresh data if not published\nif(this.editorBuilder&&\"published\"!==this.editorBuilder.getContext()&&\"demo\"!==this.editorBuilder.getContext()){this.__timeStamp=\"?\"+Math.floor(Date.now()/1e3)}// ensure we don't get a miss on initial load\nif(this.activeItem.location){this.$.activecontent.generateRequest()}}", "get element(){\n\t\treturn this._element;\n\t}", "getContentElement() {\n return this.contentEl;\n }", "function js2DOMcore ( data ) {\n //!-self return:\n if ( data || data == '' ) {//data '' ou inner ou tag => ''ou \"...\" ou {tagName:\"...atrs..\"} si ''=>br\n if ( typeof data == \"object\" ){ \n if ( data instanceof Array ) { jsonArray ( data ); return js2DOMcore }\n var dataObjKeys = ObjKeys( data ) \n var tagName = dataObjKeys[ 0 ]\n var content = data[ tagName ]\n var objclass = content \n var cls = \"\"\n /// gestion class \\\\\\\n if ( typeof content == 'object' ) { \n cls= \"class='\"\n while ( typeof ( cls += ObjKeys( content )[0] + \" \", content = content[ObjKeys( content )[0]] ) == 'object' ){}\n cls += \"' \"\n }\n content = cls + content\n /// gestion id \\\\\\\n // if ( ObjKeys( data )[ 1 ] == 'id' ) { id = \"id='\"+data[ ObjKeys( data )[ 1 ] ] + \"'\" }\n for ( var i = 1; i < dataObjKeys.length; i++){\n content = dataObjKeys[i]+ \"='\"+data[ dataObjKeys[i]] + \"' \" + content }\n /// gestion auto-marker \\\\\\\n autoMarker:{//\n sequenceControl = sequenceControl << 1\n sequenceControl = sequenceControl & 3\n if ( content ){ sequenceControl++ }\n if ( !startSequence ) { startSequence = true; break autoMarker }\n if ( !startTagsLevel ) {\n startTagsLevel = level; markers.sequenceOfTags.push( level ) }\n //traitement noAttr \n if ( startNoAttrLevel > -1 ){\n if ( sequenceControl > 0 ){\n startNoAttrLevel = -1\n markers.sequenceOfNoAttr.pop()\n }\n break autoMarker\n }\n // !startNoAttrLevel\n if ( sequenceControl > 0 ) break autoMarker \n startNoAttrLevel = level \n markers.sequenceOfNoAttr.push( startNoAttrLevel )\n } \n \n tagtxt += '<'+tagName+' '+ ( content? ' '+content : '') + '>' \n postTag.push('</'+tagName+'>')//+postTag)\n level++\n return js2DOMcore\n }\n sequenceControl = 0\n startSequence = false\n startTagsLevel = false\n startNoAttrLevel = -1\n tagtxt += data // texte dans inner\n return js2DOMcore\n }\n /// <br /> \\\\\\ \n tagtxt += '<br />' // br dans inner\n return js2DOMcore\n }", "get currentItem() {\n return super.currentItem;\n }", "get currentItem() {\n return super.currentItem;\n }", "getElement() {\n return this.#element;\n }", "get data () {return this._data;}", "peek() {\n if (this.head) {\n return this.head.data\n } else {\n return null\n }\n }", "getContentElement() {\n return this.contentEl;\n }", "render() {\n return (\n <div rel={ ref => ( this.domContainer = ref ) }></div>\n )\n }", "getfirstVideoElement(){\n return new WebCompactBox(element(firstVideoElement));\n }", "getElem() {\n return this.config.wrap ? this.$el.parentNode : this.$el;\n }", "get element () {\n\t\treturn this._element;\n\t}", "get data() { return this._data.value; }", "get parent () { return this._parent; }", "get el() {\n return this.#el;\n }", "get current() {\n return currentCard;\n }", "get vElement(){\n\t\treturn this.hasAttribute('visible-element') ? this.getAttribute('visible-element') : '#' + this.cValue;\n\t}", "get node() { return this._node; }", "peek(){ return this.top; }", "peek(){ return this.top; }", "function getDraggedElMeta(el){var prefix=exportHooks.dataAttrPrefix;var eventProps;// properties for creating the event, not related to date/time\nvar startTime;// a Duration\nvar duration;var stick;if(prefix){prefix+='-';}eventProps=el.data(prefix+'event')||null;if(eventProps){if(_typeof(eventProps)==='object'){eventProps=$.extend({},eventProps);// make a copy\n}else{// something like 1 or true. still signal event creation\neventProps={};}// pluck special-cased date/time properties\nstartTime=eventProps.start;if(startTime==null){startTime=eventProps.time;}// accept 'time' as well\nduration=eventProps.duration;stick=eventProps.stick;delete eventProps.start;delete eventProps.time;delete eventProps.duration;delete eventProps.stick;}// fallback to standalone attribute values for each of the date/time properties\nif(startTime==null){startTime=el.data(prefix+'start');}if(startTime==null){startTime=el.data(prefix+'time');}// accept 'time' as well\nif(duration==null){duration=el.data(prefix+'duration');}if(stick==null){stick=el.data(prefix+'stick');}// massage into correct data types\nstartTime=startTime!=null?moment.duration(startTime):null;duration=duration!=null?moment.duration(duration):null;stick=Boolean(stick);return{eventProps:eventProps,startTime:startTime,duration:duration,stick:stick};}", "get nativeElement() {\n return this.nativeNode.nodeType == Node.ELEMENT_NODE ? this.nativeNode : null;\n }", "peek() {\n\t\treturn this.head ? this.head.value : null;\n\t}", "setCurrentObjectif(current) {\n this.current_objective.innerText = current;\n }", "get content_element() {\n return this.element;\n }", "get ownerSVGElement() {\n return null;\n }", "function precacheNode(inst,node){var nativeInst=getRenderedNativeOrTextFromComponent(inst);nativeInst._nativeNode=node;node[internalInstanceKey]=nativeInst;}", "function precacheNode(inst,node){var nativeInst=getRenderedNativeOrTextFromComponent(inst);nativeInst._nativeNode=node;node[internalInstanceKey]=nativeInst;}", "peek(){\n if(!this.linkedList.head){\n return null;\n }\n return this.linkedList.head.value;\n }", "get dateCurrent() {\n\t\treturn this.nativeElement ? this.nativeElement.dateCurrent : undefined;\n\t}", "get currentImageElementBox() {\n return this.currentImageElementBoxIn;\n }", "get object() {\n\t\treturn this.#object;\n\t}", "firstUpdated(){\n this.name = this.shadowRoot.getElementById('name');\n this.lowlimit = this.shadowRoot.getElementById('lowlimit');\n this.description = this.shadowRoot.getElementById('description');\n this.comments = this.shadowRoot.getElementById('comments');\n this.category = this.shadowRoot.getElementById('category');\n this.onhand = this.shadowRoot.getElementById('onhand');\n }", "getTop(){return this.__top}", "getElementRef() {\n return this.elementRef;\n }", "firstUpdated() {\n this.name = this.shadowRoot.getElementById('name');\n this.lowlimit = this.shadowRoot.getElementById('lowlimit');\n this.description = this.shadowRoot.getElementById('description');\n this.comments = this.shadowRoot.getElementById('comments');\n this.category = this.shadowRoot.getElementById('category');\n this.onhand = this.shadowRoot.getElementById('onhand');\n }", "get currentVideoData() {\n return this._mapData.get(\"raw\")[this.observable.videoId]\n }", "constructor(root, current) {\n super(root);\n this._current = current;\n }", "element(element){\r\n element.setInnerContent(this.content);\r\n}", "get_toc_element(data) {\n return (utilities_1.Global.document !== undefined) ? utilities_1.Global.document.querySelector(utilities_1.toc_query_selector) : null;\n }", "function _migrateDataTojQueryUI110(data){\n\t\tvar withinElement = jQuery(window);\n\t\tdata.within = {\n\t\t\telement: withinElement,\n\t\t\tisWindow: true,\n\t\t\toffset: withinElement.offset() || { left: 0, top: 0 },\n\t\t\tscrollLeft: withinElement.scrollLeft(),\n\t\t\tscrollTop: withinElement.scrollTop(),\n\t\t\twidth: withinElement.width(),\n\t\t\theight: withinElement.height()\n\t\t};\n\t\tdata.collisionPosition = {\n\t\t\tmarginLeft: 0,\n\t\t\tmarginTop: 0\n\t\t};\n\t\treturn data;\n\t}", "cacheItems() {\n this.items = getDirectChildren(this.slider);\n }", "get _notified () {\n if (typeof this.#notified === 'undefined') {\n this.#notified = this._item.parentElement;\n }\n\n return this.#notified\n }" ]
[ "0.57094836", "0.5676966", "0.5638974", "0.5630201", "0.5630201", "0.56054413", "0.5539855", "0.5539855", "0.5539855", "0.5539855", "0.55056894", "0.5502903", "0.5502903", "0.54681593", "0.5410389", "0.54063934", "0.54063934", "0.54063934", "0.5399292", "0.5391289", "0.5385353", "0.5355544", "0.53340703", "0.5319188", "0.5285676", "0.52762556", "0.5274958", "0.52598757", "0.52598757", "0.52565825", "0.5252826", "0.5212512", "0.5210477", "0.5195174", "0.51715106", "0.5158941", "0.5154824", "0.51527303", "0.5148544", "0.514714", "0.51316386", "0.51316386", "0.51301646", "0.51301646", "0.5127428", "0.5124374", "0.51221", "0.51213825", "0.510671", "0.510671", "0.5102844", "0.5098469", "0.50958437", "0.50909233", "0.50709796", "0.5070298", "0.5069721", "0.505657", "0.504608", "0.5045615", "0.50345176", "0.50345176", "0.50282997", "0.50098825", "0.5007541", "0.5003436", "0.5001817", "0.49896294", "0.4974167", "0.49645698", "0.4960015", "0.49577045", "0.49558666", "0.4951641", "0.49448088", "0.49385226", "0.4921481", "0.4921481", "0.49191782", "0.49179912", "0.49128512", "0.49103123", "0.49055436", "0.48990607", "0.4897618", "0.4897618", "0.4893849", "0.4893556", "0.48895913", "0.488948", "0.4889295", "0.4880591", "0.4869302", "0.48660308", "0.48620868", "0.4861691", "0.48613098", "0.48562422", "0.48555702", "0.48555225", "0.4854665" ]
0.0
-1
promote to own graphic accelerated layer demote from own graphic accelerated layer
attachToCanvas(canvas /*: Element */) { const promote = this._promoteTarget(canvas); const demote = this._demoteTarget(canvas); canvas.addEventListener('mouseenter', promote); canvas.addEventListener('mouseleave', demote); canvas.addEventListener('mouseover', this._handleMouseOver); canvas.addEventListener('mousemove', this._handleMouseOver); // not a typo canvas.addEventListener('mouseout', this._handleMouseOut); return () => { canvas.removeEventListener('mouseenter', promote); canvas.removeEventListener('mouseleave', demote); canvas.removeEventListener('mouseover', this._handleMouseOver); canvas.removeEventListener('mousemove', this._handleMouseOver); canvas.removeEventListener('mouseout', this._handleMouseOut); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawGlass(gl){\n gl.uniform1f(program.u_Alpha,0.5);\n pushMatrix(g_modelMatrix);\n if(self.position[2]>0){\n g_modelMatrix.translate(0,10,-50.5);\n g_modelMatrix.scale(79.5,10,0.5);\n drawObject(gl,wind);\n g_modelMatrix.setTranslate(0,10,50.5);\n g_modelMatrix.scale(79.5,10,0.5);\n drawObject(gl,wind);\n }else{\n g_modelMatrix.translate(0,10,50.5);\n g_modelMatrix.scale(79.5,10,0.5);\n drawObject(gl,wind);\n g_modelMatrix.setTranslate(0,10,-50.5);\n g_modelMatrix.scale(79.5,10,0.5);\n drawObject(gl,wind);\n }\n g_modelMatrix=popMatrix();\n gl.uniform1f(program.u_Alpha,1);\n}", "function pushLayers(){\t\r\n\tif(oldLayer.features[0] != null){ oldLayer.removeAllFeatures();\t}\r\n\tif(currentLayer.features[0] != null){\r\n\t\toldLayer.features = currentLayer.features \t// old layer is set to current\r\n\t\tcurrentLayer.removeAllFeatures();\t\t\t// remove all features from current layer\r\n\t\toldLayer.redraw();\r\n\t}\r\n}", "function moveToFront(p){\n p.moveToFront();\n var uuid = p.uuid();\n for(var i = 0; i < _pixelLayers.length; i++){\n if(_pixelLayers[i].uuid() === uuid){\n _pixelLayers.splice(i,1);\n _pixelLayers.unshift(p);\n break;\n }\n }\n }", "reverseActivate(target) {\n\t \tconst hexagon = this.hexagonList.get(IDToKey(target));\n\t \tconst targetUnit = hexagon.getUnit();\n\t \ttargetUnit.resetActivation();\n\t}", "function updateLayerMix() {\n\n if (meshLayerMix) {\n var resetLayerMix = function resetLayerMix() {\n sceneLayerMix.remove(meshLayerMix);\n meshLayerMix.material.dispose();\n meshLayerMix.material = null;\n meshLayerMix.geometry.dispose();\n meshLayerMix.geometry = null;\n };\n\n var addMeshToLayerMix = function addMeshToLayerMix() {\n var geometry = stackHelper.slice.geometry;\n var material = materialLayerMix;\n meshLayerMix = new THREE.Mesh(geometry, material);\n };\n\n var convertCoordinateSystemFromIJKToLeftPosteriorSuperior = function convertCoordinateSystemFromIJKToLeftPosteriorSuperior() {\n meshLayerMix.applyMatrix(stackHelper.stack._ijk2LPS);\n };\n\n resetLayerMix();\n\n addMeshToLayerMix();\n\n convertCoordinateSystemFromIJKToLeftPosteriorSuperior();\n\n sceneLayerMix.add(meshLayerMix);\n }\n }", "addToChangeLayers(){\n let _to = this.props.toVersion.key;\n //attribute change in protected areas layers\n this.addLayer({id: window.LYR_TO_CHANGED_ATTRIBUTE, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: { \"fill-color\": \"rgba(99,148,69,0.4)\", \"fill-outline-color\": \"rgba(99,148,69,0.8)\"}, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n //geometry change in protected areas layers - to\n this.addLayer({id: window.LYR_TO_GEOMETRY_POINT_TO_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_GEOMETRY_POINT_TO_POLYGON_LINE, sourceId: window.SRC_TO_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY_LINE, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_GEOMETRY_POINT_COUNT_CHANGED_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_GEOMETRY_POINT_COUNT_CHANGED_POLYGON_LINE, sourceId: window.SRC_TO_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY_LINE, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_GEOMETRY_SHIFTED_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_GEOMETRY_SHIFTED_POLYGON_LINE, sourceId: window.SRC_TO_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY_LINE, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n //added protected areas layers\n this.addLayer({id: window.LYR_TO_NEW_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: { \"fill-color\": \"rgba(63,127,191,0.2)\", \"fill-outline-color\": \"rgba(63,127,191,0.6)\"}, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_NEW_POINT, sourceId: window.SRC_TO_POINTS, type: \"circle\", sourceLayer: \"wdpa_\" + _to + \"_points\", layout: {visibility: \"visible\"}, paint: {\"circle-radius\": CIRCLE_RADIUS_STOPS, \"circle-color\": \"rgb(63,127,191)\", \"circle-opacity\": 0.6}, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n \n }", "removeFromLayers(){\n if (this.map.getSource(window.SRC_FROM_POLYGONS)) this.removeSource(window.SRC_FROM_POLYGONS);\n if (this.map.getSource(window.SRC_FROM_POINTS)) this.removeSource(window.SRC_FROM_POINTS);\n }", "function clearGraphics() {\n pointLayer.removeAll();\n bufferLayer.removeAll();\n }", "_onMouseMove()\n {\n this.deactivate();\n }", "function toggleControlMobile() \n{ \n var control = drawControls['line'];\n \n if(!transectOn){\n \n control.activate();\n document.getElementById('lineToggle').innerHTML = 'Unselect Tool';\n $(\"#mobileLevel3\").css(\"z-index\",\"0\");\n } else {\n document.getElementById('lineToggle').innerHTML= 'Transect Tool';\n dlayer.destroy();\n \n control.deactivate();\n $(\"#mobileLevel3\").css(\"z-index\",\"1002\");\n }\n transectOn = !transectOn; \n}", "function updateInk(){\t\r\n\t// Render buffer scenes\r\n\t// ---- BRUSH --------------------------------------------------------------------------------------\r\n\tbrushBuffer.material.uniforms.texInput.value = x.texA;\r\n\trenderer.render(brushBuffer.scene, camera, x.texB, true);\t\r\n\t\r\n\t// Swap A and B textures: take output of buffer renders, set up input for next buffer renders\r\n\tx.swap();\r\n\r\n\t// Update uniforms to account for window resizing and allow for time dependent effects\r\n\tbrushBuffer.material.uniforms.res.value.x = w();\r\n\tbrushBuffer.material.uniforms.res.value.y = h();\r\n\t// -------------------------------------------------------------------------------------------------\r\n\r\n\t// ---- ADVECT -------------------------------------------------------------------------------------\r\n\tadvectBuffer.material.uniforms.texInput.value = x.texA;\r\n\tadvectBuffer.material.uniforms.velocity.value = u.texA;\r\n\tadvectBuffer.material.uniforms.dissipation.value = 0.992;\r\n\trenderer.render(advectBuffer.scene, camera, x.texB, true);\t\r\n\tx.swap();\r\n\r\n\tadvectBuffer.material.uniforms.time += 1;\t\r\n\tadvectBuffer.material.uniforms.res.value.x = w();\r\n\tadvectBuffer.material.uniforms.res.value.y = h();\r\n\r\n\t// ---- POST-PROCESSING ---------------------------------------------------------------------------- \r\n\tpostBuffer.material.uniforms.texInput.value = x.texA;\r\n\trenderer.render(postBuffer.scene, camera, x.texB, true);\t\r\n\tx.swap();\r\n\r\n\tpostBuffer.material.uniforms.res.x = w();\r\n\tpostBuffer.material.uniforms.res.y = h();\r\n}", "_suspendPresentationLayerUpdates() {\n this._suspendCATransaction = true;\n }", "function graphCutMergeLayers()\n{\n\tvar desc = new ActionDescriptor();\n\tvar ref = new ActionReference();\n\tref.putEnumerated( classLayer, typeOrdinal, enumTarget );\n\tdesc.putReference( typeNULL, ref );\n\texecuteAction( kmergeAlignedLayersStr, desc, DialogModes.NO );\n}", "function undoLayer() {\r\n var canvases = [...document.querySelectorAll(\"canvas\")];\r\n if (canvases.length > 0) {\r\n var lastCanvas = canvases.pop();\r\n if (lastCanvas.id !== \"baseCanvas\") {\r\n $(`#${lastCanvas.parentElement.id}`).remove()\r\n }\r\n }\r\n }", "disengage (e){\n this.dragging=false;\n this.ctx.closePath();\n\n\n\n \n \n\n console.log(\"j'aii fini de dessiner\")\n }", "function charJawFront(){ //start script\n app.beginUndoGroup(\"Create Character Jaw Rig Front\");\n\n //if(parseFloat(app.version) >= 10.5){\n var theComp = app.project.activeItem; //only selected\n\n // check if comp is selected\n if (theComp == null || !(theComp instanceof CompItem)){\n // if no comp selected, display an alert\n alert(\"Please establish a comp as the active item and run the script again.\");\n } else {\n var theLayers = theComp.selectedLayers;\n if(theLayers.length==0){\n alert(\"Please select a precomp and run the script again.\");\n }else{\n // otherwise, loop through each selected layer in the selected comp\n for (var i = 0; i < theLayers.length; i++){\n // define the layer in the loop we're currently looking at\n var curLayer = theLayers[i];\n // Select layer to add expression to\n if (curLayer.matchName == \"ADBE AV Layer\"){\n //first check if this is a footage layer\n //next check if this is a comp.\n var myLayer = theComp.selectedLayers[0];\n if(myLayer.source.numLayers==null){\n //not a comp; send alert.\n alert(\"This only works on precomp layers.\");\n }else{\n //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n //myLayer is indeed a precomp. OK to do stuff.\n var slider = myLayer.property(\"Effects\").addProperty(\"Slider Control\");\n slider.name = \"jaw front control\"\n var headNull = myLayer.source.layers.addNull();\n //var upperJawNull = myLayer.source.layers.addNull();\n var lowerJawNull = myLayer.source.layers.addNull();\n headNull.name = \"head placeholder\";\n //upperJawNull.name = \"upper jaw placeholder\";\n lowerJawNull.name = \"lower jaw placeholder\";\n //when asset replaces null, anchor point will be centered.\n headNull.transform.anchorPoint.setValue([50,50]);\n //upperJawNull.transform.anchorPoint.setValue([50,50]);\n lowerJawNull.transform.anchorPoint.setValue([50,50]);\n headNull.property(\"Opacity\").setValue(100);\n //upperJawNull.property(\"Opacity\").setValue(100);\n lowerJawNull.property(\"Opacity\").setValue(100);\n //parenting jaws to head\n //upperJawNull.parent = headNull;\n lowerJawNull.parent = headNull;\n //expressions\n //headNullExprPos;\n //headNullExprRot;\n //headNullExprScale;\n //headNull.property(\"Position\").expression = headNullExprPos;\n //headNull.property(\"Rotation\").expression = headNullExprRot;\n //headNull.property(\"Scale\").expression = headNullExprScale;\n //--\n //upperJawNullExprPos;\n //upperJawNullExprRot;\n //upperJawNullExprScale;\n //upperJawNull.property(\"Position\").expression = upperJawNullExprPos;\n //upperJawNull.property(\"Rotation\").expression = upperJawNullExprRot;\n //upperJawNull.property(\"Scale\").expression = upperJawNullExprScale;\n //--\n lowerJawNullExprPos = \"var scaler = 1.0;\" + \"\\r\" +\n \"var x = transform.position[0];\" + \"\\r\" +\n \"var y = transform.position[1];\" + \"\\r\" +\n \"var s = comp(\\\"\" + theComp.name + \"\\\").layer(\\\"\" + myLayer.name + \"\\\").effect(\\\"\" + slider.name + \"\\\")(\\\"Slider\\\");\" + \"\\r\" +\n \"[x, y+(s*scaler)];\";\n //lowerJawNullExprRot;\n lowerJawNullExprScale = \"var scaler = 1.0;\" + \"\\r\" +\n \"var s = comp(\\\"\" + theComp.name + \"\\\").layer(\\\"\" + myLayer.name + \"\\\").effect(\\\"\" + slider.name + \"\\\")(\\\"Slider\\\");\" + \"\\r\" +\n \"var x = transform.scale[0];\" + \"\\r\" +\n \"var y = transform.scale[1];\" + \"\\r\" +\n \"[x,y+(s*scaler)];\"; \n lowerJawNull.property(\"Position\").expression = lowerJawNullExprPos;\n //lowerJawNull.property(\"Rotation\").expression = lowerJawNullExprRot;\n lowerJawNull.property(\"Scale\").expression = lowerJawNullExprScale;\n //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n }\n }else{\n //not a footage layer; send alert.\n alert(\"This only works on precomp layers.\");\n }\n }\n }\n }\n \n app.endUndoGroup();\n} //end script", "updateLayer() {\n /* This layer is always reloaded */\n return;\n }", "function accelerate(){this.velInfluence = accelerator;}", "function addCompAsLayer(object,to_comp){\n to_comp.layers.add(object)\n}", "function charJawSide(){ //start script\n app.beginUndoGroup(\"Create Character Jaw Rig Side\");\n\n //if(parseFloat(app.version) >= 10.5){\n var theComp = app.project.activeItem; //only selected\n\n // check if comp is selected\n if (theComp == null || !(theComp instanceof CompItem)){\n // if no comp selected, display an alert\n alert(\"Please establish a comp as the active item and run the script again.\");\n } else {\n var theLayers = theComp.selectedLayers;\n if(theLayers.length==0){\n alert(\"Please select a precomp and run the script again.\");\n }else{\n // otherwise, loop through each selected layer in the selected comp\n for (var i = 0; i < theLayers.length; i++){\n // define the layer in the loop we're currently looking at\n var curLayer = theLayers[i];\n // Select layer to add expression to\n if (curLayer.matchName == \"ADBE AV Layer\"){\n //first check if this is a footage layer\n //next check if this is a comp.\n var myLayer = theComp.selectedLayers[0];\n if(myLayer.source.numLayers==null){\n //not a comp; send alert.\n alert(\"This only works on precomp layers.\");\n }else{\n //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n //myLayer is indeed a precomp. OK to do stuff.\n var slider = myLayer.property(\"Effects\").addProperty(\"Slider Control\");\n slider.name = \"jaw side control\"\n var headNull = myLayer.source.layers.addNull();\n var upperJawNull = myLayer.source.layers.addNull();\n var lowerJawNull = myLayer.source.layers.addNull();\n headNull.name = \"head placeholder\";\n upperJawNull.name = \"upper jaw placeholder\";\n lowerJawNull.name = \"lower jaw placeholder\";\n //when asset replaces null, anchor point will be centered.\n headNull.transform.anchorPoint.setValue([50,50]);\n upperJawNull.transform.anchorPoint.setValue([50,50]);\n lowerJawNull.transform.anchorPoint.setValue([50,50]);\n headNull.property(\"Opacity\").setValue(100);\n upperJawNull.property(\"Opacity\").setValue(100);\n lowerJawNull.property(\"Opacity\").setValue(100);\n //parenting jaws to head\n upperJawNull.parent = headNull;\n lowerJawNull.parent = headNull;\n //expressions\n //headNullExprPos;\n //headNullExprRot;\n headNullExprScale = \"var x = transform.scale[0];\" + \"\\r\" +\n \"var y = transform.scale[1];\" + \"\\r\" +\n \"var s = comp(\\\"\" + theComp.name + \"\\\").layer(\\\"\" + myLayer.name + \"\\\").effect(\\\"\" + slider.name + \"\\\")(\\\"Slider\\\");\" + \"\\r\" +\n \"[x,y+(s/-4)];\";\n //headNull.property(\"Position\").expression = headNullExprPos;\n //headNull.property(\"Rotation\").expression = headNullExprRot;\n headNull.property(\"Scale\").expression = headNullExprScale;\n //--\n upperJawNullExprPos = \"var x = transform.position[0];\" + \"\\r\" +\n \"var y = transform.position[1];\" + \"\\r\" +\n \"var s = comp(\\\"\" + theComp.name + \"\\\").layer(\\\"\" + myLayer.name + \"\\\").effect(\\\"\" + slider.name + \"\\\")(\\\"Slider\\\");\" + \"\\r\" +\n \"var scaler = -0.2;\" + \"\\r\" +\n \"[x, y+(s*scaler)];\";\n upperJawNullExprRot = \"var r = transform.rotation;\" + \"\\r\" +\n \"var s = comp(\\\"\" + theComp.name + \"\\\").layer(\\\"\" + myLayer.name + \"\\\").effect(\\\"\" + slider.name + \"\\\")(\\\"Slider\\\");\" + \"\\r\" +\n \"var scaler = 0.2;\" + \"\\r\" +\n \"r+(s*scaler);\";\n //upperJawNullExprScale;\n upperJawNull.property(\"Position\").expression = upperJawNullExprPos;\n upperJawNull.property(\"Rotation\").expression = upperJawNullExprRot;\n //upperJawNull.property(\"Scale\").expression = upperJawNullExprScale;\n //--\n lowerJawNullExprPos = \"var x = transform.position[0];\" + \"\\r\" +\n \"var y = transform.position[1];\" + \"\\r\" +\n \"var s = comp(\\\"\" + theComp.name + \"\\\").layer(\\\"\" + myLayer.name + \"\\\").effect(\\\"\" + slider.name + \"\\\")(\\\"Slider\\\");\" + \"\\r\" +\n \"var scaler = 2;\" + \"\\r\" +\n \"[x, y+(s*scaler)];\";\n lowerJawNullExprRot = \"var r = transform.rotation;\" + \"\\r\" +\n \"var s = comp(\\\"\" + theComp.name + \"\\\").layer(\\\"\" + myLayer.name + \"\\\").effect(\\\"\" + slider.name + \"\\\")(\\\"Slider\\\");\" + \"\\r\" +\n \"var scaler = -1.0;\" + \"\\r\" +\n \"r+(s*scaler);\";\n //lowerJawNullExprScale; \n lowerJawNull.property(\"Position\").expression = lowerJawNullExprPos;\n lowerJawNull.property(\"Rotation\").expression = lowerJawNullExprRot;\n //lowerJawNull.property(\"Scale\").expression = lowerJawNullExprScale;\n //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n }\n }else{\n //not a footage layer; send alert.\n alert(\"This only works on precomp layers.\");\n }\n }\n }\n }\n \n app.endUndoGroup();\n} //end script", "addFromLayers(){\n let _from = this.props.fromVersion.key;\n //add the sources\n this.addSource({id: window.SRC_FROM_POLYGONS, source: {type: \"vector\", tiles: [ window.TILES_PREFIX + \"wdpa_\" + _from + \"_polygons\" + window.TILES_SUFFIX]}});\n this.addSource({id: window.SRC_FROM_POINTS, source: {type: \"vector\", tiles: [ window.TILES_PREFIX + \"wdpa_\" + _from + \"_points\" + window.TILES_SUFFIX]}});\n //add the layers\n this.addLayer({id: window.LYR_FROM_DELETED_POLYGON, sourceId: window.SRC_FROM_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _from + \"_polygons\", layout: {visibility: \"visible\"}, paint: { \"fill-color\": \"rgba(255,0,0, 0.2)\", \"fill-outline-color\": \"rgba(255,0,0,0.5)\"}, filter:INITIAL_FILTER, beforeID: window.LYR_TO_POLYGON});\n this.addLayer({id: window.LYR_FROM_DELETED_POINT, sourceId: window.SRC_FROM_POINTS, type: \"circle\", sourceLayer: \"wdpa_\" + _from + \"_points\", layout: {visibility: \"visible\"}, paint: {\"circle-radius\": CIRCLE_RADIUS_STOPS, \"circle-color\": \"rgb(255,0,0)\", \"circle-opacity\": 0.6}, filter:INITIAL_FILTER, beforeID: window.LYR_TO_POLYGON});\n //geometry change in protected areas layers - from\n this.addLayer({id: window.LYR_FROM_GEOMETRY_POINT_TO_POLYGON, sourceId: window.SRC_FROM_POINTS, type: \"circle\", sourceLayer: \"wdpa_\" + _from + \"_points\", layout: {visibility: \"visible\"}, paint: {\"circle-radius\": CIRCLE_RADIUS_STOPS, \"circle-color\": \"rgb(255,0,0)\", \"circle-opacity\": 0.5}, filter:INITIAL_FILTER, beforeId: window.LYR_TO_GEOMETRY_POINT_TO_POLYGON});\n this.addLayer({id: window.LYR_FROM_GEOMETRY_POINT_COUNT_CHANGED_LINE, sourceId: window.SRC_FROM_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _from + \"_polygons\", layout: {visibility: \"visible\"}, paint: { \"line-color\": \"rgb(255,0,0)\", \"line-width\": 1, \"line-opacity\": 0.5, \"line-dasharray\": [3,3]}, filter:INITIAL_FILTER, beforeId: window.LYR_TO_GEOMETRY_POINT_TO_POLYGON});\n this.addLayer({id: window.LYR_FROM_GEOMETRY_SHIFTED_LINE, sourceId: window.SRC_FROM_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _from + \"_polygons\", layout: {visibility: \"visible\"}, paint: { \"line-color\": \"rgb(255,0,0)\", \"line-width\": 1, \"line-opacity\": 0.5, \"line-dasharray\": [3,3]}, filter:INITIAL_FILTER, beforeId: window.LYR_TO_GEOMETRY_POINT_TO_POLYGON});\n //selection layers\n this.addLayer({id: window.LYR_FROM_SELECTED_POLYGON, sourceId: window.SRC_FROM_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _from + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_SELECTED_POLYGON, filter:INITIAL_FILTER, beforeId: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_FROM_SELECTED_LINE, sourceId: window.SRC_FROM_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _from + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_SELECTED_LINE, filter:INITIAL_FILTER, beforeId: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_FROM_SELECTED_POINT, sourceId: window.SRC_FROM_POINTS, type: \"circle\", sourceLayer: \"wdpa_\" + _from + \"_points\", layout: {visibility: \"visible\"}, paint: P_SELECTED_POINT, filter:INITIAL_FILTER, beforeId: window.LYR_TO_SELECTED_POLYGON});\n }", "function resetXY()\n{\n\ttrueB.setPosition(trueX, trueY);\n\tfalseB.setPosition(falseX, falseY);\n\tlayer.draw();\n}", "reflow() {\n this.calcPoints();\n this._updateActive();\n }", "transform(ref, op) {\n var {\n current,\n affinity\n } = ref;\n\n if (current == null) {\n return;\n }\n\n var point = Point.transform(current, op, {\n affinity\n });\n ref.current = point;\n\n if (point == null) {\n ref.unref();\n }\n }", "transform(ref, op) {\n var {\n current,\n affinity\n } = ref;\n\n if (current == null) {\n return;\n }\n\n var point = Point.transform(current, op, {\n affinity\n });\n ref.current = point;\n\n if (point == null) {\n ref.unref();\n }\n }", "function lowlight() { // remove any highlight\n if (OldTarget) {\n OldTarget.scale = 1.0;\n OldTarget = null;\n }\n }", "function deactivateDraw() {\r\n measureConfig.isActive = false;\r\n measureConfig.activeFeature = null;\r\n measureButton.classList.toggle(\"esri-draw-button-selected\");\r\n pointerDownListener.remove();\r\n pointerMoveListener.remove();\r\n doubleClickListener.remove();\r\n }", "remove() {\n this.parent.removeLayer(this);\n }", "freeze() {\r\n super.freeze();\r\n this.ghostAnchor.undrag();\r\n this.onManipulationEnd();\r\n }", "function toggleSpecial(which)\n{\n\n\tswitch(which) {\n case true:\nspecials.addLayer(specialLayer);\nspecialLayer.bringToFront()\n\t$(\"#btSpecial\").addClass(\"on\")\n\n break;\n case false:\nspecials.removeLayer(specialLayer);\n\t$(\"#btSpecial\").removeClass(\"on\")\n break;\n default:\n // default code block\n}\n\n}", "function toggleSpecial(which)\n{\n\n\tswitch(which) {\n case true:\nspecials.addLayer(specialLayer);\nspecialLayer.bringToFront()\n\t$(\"#btSpecial\").addClass(\"on\")\n\n break;\n case false:\nspecials.removeLayer(specialLayer);\n\t$(\"#btSpecial\").removeClass(\"on\")\n break;\n default:\n // default code block\n}\n\n}", "removeLayer() {\n if (this.__shown) {\n const map = this.map;\n map.removeLayer(this.uniqueId + 'fillpoly');\n this.__shown = false;\n }\n }", "updateLayer(state) {\n return;\n }", "function clearPoint() {\n if (graphicsLayer.graphics.items.length > 0) {\n graphicsLayer.removeAll();\n }\n }", "toggleLayer(layer) {\n layer.setVisible(!layer.getVisible())\n }", "function clickPaint() {\n\tidName('paint-layer').style.pointerEvents = 'auto';\n\tidName('shape-layer').style.pointerEvents = 'none';\n\tclassName('upper-canvas')[0].style.pointerEvents = 'none';\n}", "mouseUpF(e){ \n if (this.isDrawing == true) {\n if(this.toolss == \"pen\" || this.toolss == \"eraser\" || this.toolss == \"marker\" || this.toolss == \"oil\" || this.toolss == \"watercolor\"){\n this.drawF(this.ctx, this.x, this.y, e.offsetX, e.offsetY);\n this.isMovingDraw = false;\n this.mouseUpStartX = this.xStart;\n this.mouseUpStartY = this.yStart;\n this.mouseUpFinishX = e.offsetX;\n this.mouseUpFinishY = e.offsetY;\n this.ctx.globalCompositeOperation = 'source-over'\n }\n else {\n this.drawF(this.tempctx, this.xStart, this.yStart, this.x, this.y);\n this.isMovingDraw = true;\n this.mouseUpStartX = this.xStart;\n this.mouseUpStartY = this.yStart;\n this.mouseUpFinishX = this.x;\n this.mouseUpFinishY = this.y; \n this.beforeTool = this.toolss;\n }\n this.isDrawing = false;\n this.xStart = undefined;\n this.yStart = undefined;\n this.x = undefined;\n this.y = undefined; \n // this.isGredient = false; \n }\n if(this.isMoving == true){\n if(this.toolss == \"paste\" || this.toolss == \"rotate-right-90-deg\" || this.toolss == \"rotate-left-90-deg\" || this.toolss == \"rotate-180-deg\" || this.toolss == \"newText\" || this.toolss == \"rotate-flip-hor\" || this.toolss == \"rotate-flip-ver\"){\n this.ctx.putImageData(this.selectedAre, this.x, this.y); \n }\n else if(this.toolss == \"file-open\"){\n this.ctx.drawImage(this.imageUpload,this.x,this.y);\n }\n else{\n this.b = this.x-this.mouseUpStartX;\n this.t = this.y-this.mouseUpStartY;\n this.drawF(this.ctx, this.x, this.y, this.mouseUpFinishX+this.b, this.mouseUpFinishY+this.t); \n } \n this.isMovingDraw = false;\n document.querySelectorAll(\".tempPaint\").forEach(e=>e.remove());\n this.b = this.x-this.mouseUpStartX;\n this.t = this.y-this.mouseUpStartY;\n this.mouseUpStartX = this.x;\n this.mouseUpStartY = this.y;\n this.mouseUpFinishX = this.mouseUpFinishX+this.b;\n this.mouseUpFinishY = this.mouseUpFinishY+this.t;\n this.toolss = null;\n this.selectedAre = null;\n this.isMoving = false;\n this.xStart = undefined;\n this.yStart = undefined;\n this.x = undefined;\n this.y = undefined;\n };\n }", "function toggleControl() \n{\n \n var control = drawControls['line'];\n \t\n \n if(!transectOn){\n \n control.activate();\n document.getElementById('lineToggle').innerHTML = unselectTransect.toString();\n } else {\n document.getElementById('lineToggle').innerHTML= transect.toString();\n dlayer.destroy();\n \n control.deactivate();\n }\n transectOn = !transectOn; \n}", "function translateActiveLayer( deltaX, deltaY )\n{\n\tvar desc = new ActionDescriptor();\n\tvar ref = new ActionReference();\n\tref.putEnumerated( classLayer, typeOrdinal, enumTarget );\n\tdesc.putReference( typeNULL, ref );\n\tvar coords = new ActionDescriptor();\n\tcoords.putUnitDouble( enumHorizontal, unitPixels, deltaX );\n\tcoords.putUnitDouble( keyVertical, unitPixels, deltaY );\n\tdesc.putObject( keyTo, keyOffset, coords );\n\texecuteAction( eventMove, desc, DialogModes.NO );\n}", "function updateShape(point) {\n model.context.clearRect(0, 0, model.cnv.width, model.cnv.height);\n model.cnv.width = model.cnv.width;\n\n var width = model.width;\n var height = model.height;\n\n model.context.setTransform(1, 0, 0, 1, 0, 0);\n\n let dx = point.xAxis + 0.5 * width;\n let dy = point.yAxis + 0.5 * height;\n model.context.translate(dx, dy);\n\tmodel.context.rotate(0.7931);\n // model.context.fillStyle = model.bgColor;\n // model.context.fillRect(-0.5 * width, -0.5 * height, width, height);\n model.context.drawImage(this.csImage, -0.5 * width, -0.5 * height, width, height);\n}", "function animationCallback() {\n if (script.AnimationMixer.getLayer(script.openLayer)) {\n script.AnimationMixer.getLayer(script.openLayer).weight = 0.0;\n }\n}", "activate() {\n this.parent.activeLayerIndex = this.index;\n }", "function clearLayer() {\n selectClick.getFeatures().clear();\n vector.getSource().clear();\n}", "removeRenderTarget() {\n if(this.target) {\n // reset our planes stacks\n this.renderer.scene.removePlane(this);\n this.target = null;\n this.renderer.scene.addPlane(this);\n }\n }", "toggleBaseLayer(layer) {\n for (var i = 0; i < this.baseLayers.length; i++) {\n this.baseLayers[i].setVisible(false)\n }\n\n layer.setVisible(true)\n this.selectedBaseLayer = layer.get('title');\n\n }", "updateDebugGraphics() {\n this.debugGraphics.rotation = -this.ent.rotation;\n }", "function removeSourceAndLayer(name) {\n if (map.getLayer(name)) {\n map.removeLayer(name);\n }\n if (map.getSource(name)) {\n map.removeSource(name);\n }\n }", "swapBasemap(toAdd) {\n this.currentSources = []\n this.currentLayers = []\n\n // First record which layers are currently on the map\n Object.keys(mapStyle.sources).forEach(source => {\n let isPresent = this.map.getSource(source)\n if (isPresent) {\n this.currentSources.push({\n id: source,\n config: mapStyle.sources[source],\n data: isPresent._data || null\n })\n }\n })\n\n mapStyle.layers.forEach(layer => {\n let isPresent = this.map.getLayer(layer.id)\n if (isPresent) {\n this.currentLayers.push({\n layer: layer,\n filters: this.map.getFilter(layer.id)\n })\n }\n })\n\n // Set the style. `style.load` will be fired after to readd other layers\n this.map.setStyle(toAdd)\n }", "function setBackToNoraml() {\n liveFloorview.style.transform = 'scale(.4)';\n liveFloorview.style.opacity = '0';\n workstation.style.transform = 'translateX(100%)'\n}", "function remov(){\n var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;\t\n renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;\n\t map.removeLayer(vectorLayer);\n\t vectorLayer = new OpenLayers.Layer.Vector(\"base layer\", {renderers: renderer});\t\n\t map.addLayer(vectorLayer);\n}", "function toggleBikeLayer() {\n if(bikeLayer.getMap() == null) {\n bikeLayer.setMap(map);\n } else {\n bikeLayer.setMap(null);\n }\n}", "function upObj() {\n\t\t\tvar selectOb = canvas.getActiveObject();\n\t\t\tcanvas.bringForward(selectOb).renderAll();\t\n\t\t}", "addBicyclingLayer(layer) {\n const newLayer = this._wrapper.createBicyclingLayer();\n this._layers.set(layer, newLayer);\n }", "function deleteLayer() {\r\n clearLayer(layer);\r\n layer = [];\r\n}", "function switchTo2D() {\n if (threeD) {\n threeD = false;\n let center = renderer.getCameraCenterInMicrometers();\n let zoom = renderer.getZoom();\n let newCenterX = center[0];\n if (newCenterX < 0) {\n newCenterX = 0\n } else if (newCenterX > Registry.currentDevice.params.getValue(\"width\")) {\n newCenterX = Registry.currentDevice.params.getValue(\"width\");\n }\n let newCenterY = paper.view.center.y - center[1];\n if (newCenterY < 0) {\n newCenterY = 0;\n } else if (newCenterY > Registry.currentDevice.params.getValue(\"height\")) {\n newCenterY = Registry.currentDevice.params.getValue(\"height\")\n }\n setButtonColor(button2D, Colors.getDefaultLayerColor(Registry.currentLayer), activeText);\n setButtonColor(button3D, inactiveBackground, inactiveText);\n Registry.viewManager.setCenter(new paper.Point(newCenterX, newCenterY));\n Registry.viewManager.setZoom(zoom);\n HTMLUtils.addClass(renderBlock, \"hidden-block\");\n HTMLUtils.removeClass(canvasBlock, \"hidden-block\");\n HTMLUtils.removeClass(renderBlock, \"shown-block\");\n HTMLUtils.addClass(canvasBlock, \"shown-block\");\n }\n}", "function drag(e) {\n e = chartForStats.pointer.normalize(e);\n\n chartForStats.update({\n chart: {\n options3d: {\n alpha: alpha + (e.chartY - posY) / sensitivity,\n beta: beta + (posX - e.chartX) / sensitivity\n }\n }\n }, undefined, undefined, false);\n }", "_changeLayer(layer) {\n //console.log(\"Layer is changed to layer\", layer, this);\n }", "swapBuffers () {\r\n let buffer = this.preview, preview = this.buffer;\r\n\r\n this.buffer = buffer;\r\n buffer.style.position = \"absolute\";\r\n buffer.style.visibility = \"hidden\";\r\n\r\n this.preview = preview;\r\n preview.style.position = \"\";\r\n preview.style.visibility = \"\";\r\n }", "function removeLayer() {\n map.removeLayer(tcLayer);\n}", "updateViewObjects(state){\n if (!this.viewObjects[\"main\"]\n || (this.conveyingLyph && !this.conveyingLyph.viewObjects[\"lyphs\"][state.method])\n || (!this.labels[state.labels[this.constructor.name]] && this[state.labels[this.constructor.name]])){\n this.createViewObjects(state);\n }\n const linkObj = this.viewObjects[\"main\"];\n\n let _start = new THREE.Vector3(this.source.x, this.source.y, this.source.z || 0);\n let _end = new THREE.Vector3(this.target.x, this.target.y, this.target.z || 0);\n let points = [_start, _end];\n this.center = _start.clone().add(_end).multiplyScalar(0.5);\n\n switch(this.type){\n case LINK_TYPES.DASHED: {\n if (!linkObj) { return; }\n copyCoords(linkObj.geometry.vertices[0], this.source);\n copyCoords(linkObj.geometry.vertices[1], this.target);\n linkObj.geometry.verticesNeedUpdate = true;\n linkObj.computeLineDistances();\n break;\n }\n case LINK_TYPES.SEMICIRCLE: {\n const curve = bezierSemicircle(_start, _end);\n this.center = curve.getPoint(0.5);\n points = curve.getPoints(state.linkResolution - 1);\n\n //Position omega tree roots\n let hostedNodes = state.graphData.nodes.filter(node => (node.host === this.id) && node.isRoot);\n if (hostedNodes.length > 0) {\n const delta = ((hostedNodes.length % 2) === 1) ? 0.4 : 0;\n const offset = 1 / (hostedNodes.length + 1 + delta);\n hostedNodes.forEach((node, i) => {\n const pos = curve.getPoint(node.offset? node.offset: offset * (i + 1));\n copyCoords(node, pos);\n });\n }\n break;\n }\n }\n\n this.updateLabels(state.labels[this.constructor.name], state.showLabels[this.constructor.name], this.center.clone().addScalar(5));\n\n if (this.conveyingLyph){\n this.conveyingLyph.updateViewObjects(state);\n this.viewObjects['icon'] = this.conveyingLyph.viewObjects[\"main\"];\n this.viewObjects['iconLabel'] = this.conveyingLyph.viewObjects[\"label\"];\n if (!this.viewObjects['iconLabel']) {delete this.viewObjects['iconLabel'];}\n } else {\n delete this.viewObjects['icon'];\n delete this.viewObjects[\"iconLabel\"];\n }\n\n //Update buffered geometries\n //Do not update positions of container links\n if (this.type === LINK_TYPES.CONTAINER) {return; }\n\n if (linkObj && linkObj.geometry.attributes){\n if (this.linkMethod === 'Line2'){\n let coordArray = [];\n for (let i = 0; i < points.length; i++) {\n coordArray.push(points[i].x, points[i].y, points[i].z);\n }\n linkObj.geometry.setPositions(coordArray);\n\n } else {\n let linkPos = linkObj.geometry.attributes.position;\n if (linkPos){\n for (let i = 0; i < points.length; i++) {\n linkPos.array[3 * i] = points[i].x;\n linkPos.array[3 * i + 1] = points[i].y;\n linkPos.array[3 * i + 2] = points[i].z;\n }\n linkPos.needsUpdate = true;\n linkObj.geometry.computeBoundingSphere();\n }\n }\n }\n }", "function DeviceLayer() {}", "function swapVisual(el1, el2) {\n return new Promise(resolve => {\n const style1 = window.getComputedStyle(el1);\n const style2 = window.getComputedStyle(el2);\n\n const transform1 = style1.getPropertyValue(\"transform\");\n const transform2 = style2.getPropertyValue(\"transform\");\n\n el1.style.transform = transform2;\n el2.style.transform = transform1;\n\n // Wait for the transition to end!\n window.requestAnimationFrame(function() {\n setTimeout(() => {\n //canvas.insertBefore(el2, el1);\n resolve();\n }, delay);\n });\n });\n}", "function switchLayer(layer){\n var layerId = layer.target.id;\n map.setStyle(mapStyles[layerId]);\n }", "updateViewObjects(state) {\n if (!this.viewObjects[\"main\"] || (!this.labels[state.labels[this.constructor.name]] && this[state.labels[this.constructor.name]])) {\n this.createViewObjects(state);\n }\n const obj = this.viewObjects[\"main\"];\n\n let _start = extractCoords(this.source);\n let _end = extractCoords(this.target);\n\n let curve = new THREE.Line3(_start, _end);\n switch (this.geometry) {\n case LINK_GEOMETRY.SEMICIRCLE:\n curve = bezierSemicircle(_start, _end);\n break;\n case LINK_GEOMETRY.RECTANGLE :\n curve = rectangleCurve(_start, _end);\n break;\n case LINK_GEOMETRY.PATH :\n if (this.path){\n curve = new THREE.CatmullRomCurve3(this.path);\n }\n break;\n case LINK_GEOMETRY.SPLINE :\n let prev = this.prev ? direction(this.prev.center, _start).multiplyScalar(2) : null;\n let next = this.next ? direction(this.next.center, _end).multiplyScalar(2) : null;\n if (prev) {\n curve = next\n ? new THREE.CubicBezierCurve3(_start, _start.clone().add(prev), _end.clone().add(next), _end)\n : new THREE.QuadraticBezierCurve3(_start, _start.clone().add(prev), _end);\n } else {\n if (next) {\n curve = new THREE.QuadraticBezierCurve3(_start, _end.clone().add(next), _end);\n }\n }\n }\n this.center = getPoint(curve, _start, _end, 0.5);\n this.points = curve.getPoints? curve.getPoints(this.pointLength): [_start, _end];\n\n //Merge nodes of a collapsible link\n if (this.collapsible){\n if (!this.source.isConstrained && !this.target.isConstrained) {\n copyCoords(this.source, this.center);\n copyCoords(this.target, this.center);\n } else {\n if (!this.source.isConstrained) {\n copyCoords(this.source, this.target);\n }\n if (!this.target.isConstrained) {\n copyCoords(this.target, this.source);\n }\n }\n }\n\n //Position omega tree roots\n (this.hostedNodes||[]).forEach((node, i) => {\n let d_i = node.offset? node.offset: 1 / (this.hostedNodes.length + 1) * (i + 1);\n const pos = getPoint(curve, _start, _end, d_i);\n copyCoords(node, pos);\n });\n\n this.updateLabels(state.labels[this.constructor.name], state.showLabels[this.constructor.name], this.center.clone().addScalar(5));\n\n if (this.conveyingLyph){\n this.conveyingLyph.updateViewObjects(state);\n this.viewObjects['icon'] = this.conveyingLyph.viewObjects[\"main\"];\n this.viewObjects['iconLabel'] = this.conveyingLyph.viewObjects[\"label\"];\n if (!this.viewObjects['iconLabel']) {delete this.viewObjects['iconLabel'];}\n } else {\n delete this.viewObjects['icon'];\n delete this.viewObjects[\"iconLabel\"];\n }\n\n\n if (this.directed && obj.children[0]){\n if (obj.children[0] instanceof THREE.ArrowHelper){\n let arrow = obj.children[0];\n let dir = direction(this.source, this.target);\n let length = curve? curve.getLength(): dir.length();\n let t = arrowLength / length;\n if (curve){ dir = curve.getTangent(1 - t); }\n let pos = getPoint(curve, _start, _end, 1 - t);\n copyCoords(arrow.position, pos);\n arrow.setDirection(dir.normalize());\n }\n }\n\n //Update buffered geometries\n //Do not update links with fixed node positions\n if (this.geometry === LINK_GEOMETRY.INVISIBLE && this.source.fixed && this.target.fixed) { return; }\n\n if (obj) {\n if (this.stroke === LINK_STROKE.THICK){\n let coordArray = [];\n for (let i = 0; i < this.points.length; i++) {\n coordArray.push(this.points[i].x, this.points[i].y, this.points[i].z);\n }\n obj.geometry.setPositions(coordArray);\n } else {\n if (obj && this.stroke === LINK_STROKE.DASHED) {\n obj.geometry.setFromPoints(this.points);\n obj.geometry.verticesNeedUpdate = true;\n obj.computeLineDistances();\n } else {\n let linkPos = obj.geometry.attributes && obj.geometry.attributes.position;\n if (linkPos) {\n for (let i = 0; i < this.points.length; i++) {\n linkPos.array[3 * i] = this.points[i].x;\n linkPos.array[3 * i + 1] = this.points[i].y;\n linkPos.array[3 * i + 2] = this.points[i].z;\n }\n linkPos.needsUpdate = true;\n obj.geometry.computeBoundingSphere();\n }\n }\n }\n }\n }", "function transPly() {\n for (i =0;i<plywood.material.length;i++) {\n plywood.material[i].transparent = true;\n plywood.material[i].opacity = 0.5\n charcoalS()\n }\n}", "function updateTFInterface(){ //all change share same update function is not an efficient implmentation (but clear)\n yScale = d3.scaleLinear().domain([vis.opacityFactor, 0]).range([0, tfHeight]);\n yAxis = d3.axisLeft(yScale).ticks(5);\n yAxisG.transition().duration(50).call(yAxis);\n\n let circlesUpdate = tfG.selectAll(\"circle\").data(vis.opaCtrlPoint, d=>d);\n let circleEnter = circlesUpdate.enter().append(\"circle\");\n let circleExit = circlesUpdate.exit().remove();\n circles = circleEnter.merge(circlesUpdate).attr(\"cx\", d=>xScale(d[0])).attr(\"cy\", d=>yScale(d[1]*vis.opacityFactor)).attr(\"r\", \"6\").attr(\"fill\", \"black\");\n opaAreaPath.attr(\"d\", areaGenerator(vis.opaCtrlPoint));\n opaLinePath.attr(\"d\", lineGenerator(vis.opaCtrlPoint));\n\n let circlesColorUpdate = colorG.selectAll(\"circle\").data(vis.colorCtrlPoint, d=>d);\n let circleColorEnter = circlesColorUpdate.enter().append(\"circle\");\n let circleColorExit = circlesColorUpdate.exit().remove();\n circlesColor = circleColorEnter.merge(circlesColorUpdate).attr(\"cx\", d => xScale(d[0]) ).attr(\"cy\", colorHeight/2 ).attr(\"r\", \"6\").attr(\"fill\", \"black\").attr(\"stroke\", \"white\");\n\n setupCtrlPointEvent();\n\n vis.initProps(vis, vis.getVolumeActorPropertyFunc()); //change transfer function here\n vis.updateRenderFunc();\n }", "function resetCompass()\n{\n RemoveTarget();\n draw();\n}", "function updateMap() {\n\t\t\tid = trail_select.value;\n\t\t\tconsole.log(id);\n\t\t\tvar newlayer = layer.getLayer(id);\n\t\t\tnewlayer.removeFrom(map);\n\t\t\tnewlayer.setStyle({\n\t\t\t\t\tweight: 5,\n\t\t\t\t\tcolor: '#00ff00',\n\t\t\t\t\topacity: 1.0\n\t\t\t});\n\t\t\tnewlayer.addTo(map)\n\t\t\tvar prevlayer = layer.getLayer(previd);\n\t\t\tif (previd !== id) {\n\t\t\t\tprevlayer.setStyle({\n\t\t\t\t\tcolor: '#ff7800',\n\t\t\t\t\topacity: 1.0,\n\t\t\t\t\tweight: (prevlayer.feature.properties.annual*0.17)**4\n\t\t\t\t});\n\t\t\t\tprevlayer.addTo(map);\n\t\t\t\tprevid = id;\n\t\t\t}\n\t\t}", "function altersingle(alpha, i, b, g, r){\n network[i][0] -= (alpha * (network[i][0] - b)) / initalpha;\n network[i][1] -= (alpha * (network[i][1] - g)) / initalpha;\n network[i][2] -= (alpha * (network[i][2] - r)) / initalpha;\n }", "disposeLayerPrimitives_() {\n if (this.csContext) {\n // clean up layer listeners\n events.unlisten(this.layer, 'change:visible', this.onLayerVisibility_, this);\n events.unlisten(this.layer, 'change:opacity', this.onLayerOpacity_, this);\n events.unlisten(this.layer, EventType.PROPERTYCHANGE, this.onLayerPropertyChange_, this);\n\n // clean up source listeners\n events.unlisten(this.source, VectorEventType.CHANGEFEATURE, this.onChangeFeature_, this);\n events.unlisten(this.source, EventType.PROPERTYCHANGE, this.onSourcePropertyChange_, this);\n\n // sources don't listen to these events (see above)\n if (!(this.source instanceof VectorSource)) {\n events.unlisten(this.source, VectorEventType.ADDFEATURE, this.onAddFeature_, this);\n events.unlisten(this.source, VectorEventType.REMOVEFEATURE, this.onRemoveFeature_, this);\n events.unlisten(this.source, VectorEventType.CLEAR, this.clearFeatures_, this);\n }\n\n this.csContext.dispose();\n this.csContext = null;\n\n dispatcher.getInstance().dispatchEvent(MapEvent.GL_REPAINT);\n }\n }", "function convertLayerToACRSmartObject(){\r\n\tvar layerName = app.activeDocument.activeLayer.name;\r\n\tapp.activeDocument.activeLayer.name = \"Raw Smart Object\";\r\n\t// convert selected layer to smart object\r\n\texecuteAction( stringIDToTypeID( \"newPlacedLayer\" ), undefined, DialogModes.NO );\r\n\t// edit selected smart object\r\n\texecuteAction( stringIDToTypeID( \"placedLayerEditContents\" ), new ActionDescriptor(), DialogModes.NO );\r\n\tif(app.activeDocument.bitsPerChannel != BitsPerChannelType.SIXTEEN) app.activeDocument.bitsPerChannel = BitsPerChannelType.SIXTEEN;\r\n\tif(app.activeDocument.mode != DocumentMode.RGB) app.activeDocument.changeMode(ChangeMode.RGB);\r\n\tif( !tempFile.exists ) SaveAsTIFF( tempFile );\r\n\tapp.activeDocument.close(SaveOptions.DONOTSAVECHANGES);\r\n\tapp.activeDocument.activeLayer.name = layerName;\r\n}", "function mergeLayers() {\r\n var baseRect = base_canvas.getBoundingClientRect();\r\n var baseCtx = base_canvas.getContext(\"2d\");\r\n [...document.querySelectorAll(\"canvas\")].forEach(canvas => {\r\n var topRect = canvas.getBoundingClientRect();\r\n baseCtx.drawImage(\r\n canvas,\r\n topRect.left - baseRect.left,\r\n topRect.top - baseRect.top\r\n );\r\n });\r\n removeOverlayingEmojiCanvases();\r\n removeOverlayingCaptionCanvases();\r\n $(\".overlay-container\").remove();\r\n $(\"caption-overlay\").remove();\r\n clickX = new Array();\r\n clickY = new Array();\r\n clickDrag = new Array();\r\n clickColor = new Array();\r\n clickSize = new Array();\r\n eraseX = new Array();\r\n eraseY = new Array();\r\n eraseWidth = new Array();\r\n isDrawing = false;\r\n }", "transitionOut() {\n this.Canvas.clearLayers(['character']);\n // do nothing!\n }", "function charBlink(){ //start script\n app.beginUndoGroup(\"Create Character Blink Control\");\n\n //if(parseFloat(app.version) >= 10.5){\n var theComp = app.project.activeItem; //only selected\n\n // check if comp is selected\n if (theComp == null || !(theComp instanceof CompItem)){\n // if no comp selected, display an alert\n alert(\"Please establish a comp as the active item and run the script again.\");\n } else {\n var theLayers = theComp.selectedLayers;\n if(theLayers.length==0){\n alert(\"Please select a precomp and run the script again.\");\n }else{\n // otherwise, loop through each selected layer in the selected comp\n for (var i = 0; i < theLayers.length; i++){\n // define the layer in the loop we're currently looking at\n var curLayer = theLayers[i];\n // Select layer to add expression to\n if (curLayer.matchName == \"ADBE AV Layer\"){\n //first check if this is a footage layer\n //next check if this is a comp.\n var myLayer = theComp.selectedLayers[0];\n if(myLayer.source.numLayers==null){\n //not a comp; send alert.\n alert(\"This only works on precomp layers.\");\n }else{\n //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n //myLayer is indeed a precomp. OK to do stuff.\n var checkbox = myLayer.property(\"Effects\").addProperty(\"Checkbox Control\");\n checkbox.name = \"blink control\"\n var blinker = myLayer.source.layers.addNull();\n blinker.name = \"blink placeholder\";\n //when blink asset replaces null, anchor point will be centered.\n blinker.transform.anchorPoint.setValue([50,50]);\n expr = \"comp(\\\"\" + theComp.name + \"\\\").layer(\\\"\" + myLayer.name + \"\\\").effect(\\\"\" + checkbox.name + \"\\\")(\\\"Checkbox\\\") * 100;\";\n blinker.property(\"Opacity\").expression = expr;\n //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n }\n }else{\n //not a footage layer; send alert.\n alert(\"This only works on precomp layers.\");\n }\n }\n }\n }\n \n app.endUndoGroup();\n} //end script", "function disengage(e) {\n dragging = false;\n //2.12 to avoid the connection between the engage and disengage line\n context.beginPath();\n }", "onMouseUp(event) {\n var diagramEngine = this.props.diagramEngine;\n\n // are we going to connect a link to something?\n if (this.state.action instanceof MoveItemsAction) {\n var element = this.getMouseElement(event);\n\n _.forEach(this.state.action.selectionModels, model => {\n // only care about points connecting to things\n if (!(model.model instanceof PointModel)) {\n return;\n }\n\n // =============================================\n // =============================================\n /**\n * this section is the part that differs from the library\n *\n */\n if (element && element.model instanceof NodeModel) {\n const link = model.model.getLink();\n const targetNode = element.model;\n\n // if link has already been attached to the target port,\n // no need to setTargetPort\n if (link.getTargetPort()) {\n return;\n }\n\n // make sure that setTargetPort is run only when attaching\n // to Transforms or Destinations\n if (\n targetNode instanceof TransformNodeModel ||\n targetNode instanceof DestinationNodeModel\n ) {\n // link is set to the target port on the left\n const targetPort = element.model.ports.left;\n link.setTargetPort(targetPort);\n delete this.props.diagramEngine.linksThatHaveInitiallyRendered[\n link.getID()\n ];\n }\n }\n // =============================================\n // =============================================\n\n if (\n element &&\n element.model instanceof PortModel &&\n !diagramEngine.isModelLocked(element.model)\n ) {\n let link = model.model.getLink();\n\n if (link.getTargetPort() !== null) {\n // if this was a valid link already and we are adding a node in the middle\n // create 2 links from the original\n if (\n link.getTargetPort() !== element.model &&\n link.getSourcePort() !== element.model\n ) {\n const targetPort = link.getTargetPort();\n let newLink = link.clone({});\n newLink.setSourcePort(element.model);\n newLink.setTargetPort(targetPort);\n link.setTargetPort(element.model);\n targetPort.removeLink(link);\n newLink.removePointsBefore(\n newLink.getPoints()[link.getPointIndex(model.model)]\n );\n link.removePointsAfter(model.model);\n diagramEngine.getDiagramModel().addLink(newLink);\n // if we are connecting to the same target or source, remove tweener points\n } else if (link.getTargetPort() === element.model) {\n link.removePointsAfter(model.model);\n } else if (link.getSourcePort() === element.model) {\n link.removePointsBefore(model.model);\n }\n } else {\n link.setTargetPort(element.model);\n }\n delete this.props.diagramEngine.linksThatHaveInitiallyRendered[\n link.getID()\n ];\n }\n });\n\n // check for / remove any loose links in any models which have been moved\n if (!this.props.allowLooseLinks && this.state.wasMoved) {\n _.forEach(this.state.action.selectionModels, model => {\n // only care about points connecting to things\n if (!(model.model instanceof PointModel)) {\n return;\n }\n\n let selectedPoint = model.model;\n let link = selectedPoint.getLink();\n if (link.getSourcePort() === null || link.getTargetPort() === null) {\n link.remove();\n }\n });\n }\n\n // remove any invalid links\n _.forEach(this.state.action.selectionModels, model => {\n // only care about points connecting to things\n if (!(model.model instanceof PointModel)) {\n return;\n }\n\n let link = model.model.getLink();\n let sourcePort = link.getSourcePort();\n let targetPort = link.getTargetPort();\n if (sourcePort !== null && targetPort !== null) {\n if (!sourcePort.canLinkToPort(targetPort)) {\n // link not allowed\n link.remove();\n } else if (\n _.some(\n _.values(targetPort.getLinks()),\n l =>\n l !== link &&\n (l.getSourcePort() === sourcePort ||\n l.getTargetPort() === sourcePort)\n )\n ) {\n // link is a duplicate\n link.remove();\n }\n }\n });\n\n diagramEngine.clearRepaintEntities();\n this.stopFiringAction(!this.state.wasMoved);\n } else {\n diagramEngine.clearRepaintEntities();\n this.stopFiringAction();\n }\n this.state.document.removeEventListener('mousemove', this.onMouseMove);\n this.state.document.removeEventListener('mouseup', this.onMouseUp);\n }", "function parentableNull(){ //start script\n app.beginUndoGroup(\"Create K2P Parentable Null\");\n\n //if(parseFloat(app.version) >= 10.5){\n var theComp = app.project.activeItem; //only selected\n\n // check if comp is selected\n if (theComp == null || !(theComp instanceof CompItem)){\n // if no comp selected, display an alert\n alert(\"Please establish a comp as the active item and run the script again.\");\n } else { \n var theLayers = theComp.selectedLayers;\n if(theLayers.length==0){\n alert(\"Please select some layers and run the script again.\");\n }else{\n // otherwise, loop through each selected layer in the selected comp\n for (var i = 0; i < theLayers.length; i++){\n // define the layer in the loop we're currently looking at\n var curLayer = theLayers[i];\n // Select layer to add expression to\n if (curLayer.matchName == \"ADBE AV Layer\"){\n var solid = theComp.layers.addNull();\n solid.name = curLayer.name + \"_ctl\";\n var expr = \"var L = thisComp.layer(\\\"\" + curLayer.name + \"\\\");\" + \"\\r\" +\n \"L.toComp(L.transform.anchorPoint);\";\n solid.property(\"position\").expression = expr;\n }else{\n alert(\"This only works on footage layers.\");\n }\n }\n }\n }\n\n app.endUndoGroup();\n} //end script", "function removeLayer(p){\n var uuid = p.uuid();\n for(var i = 0; i < _pixelLayers.length; i++){\n if(_pixelLayers[i].uuid() === uuid){\n _pixelLayers.splice(i,1);\n break;\n }\n }\n p.remove();\n }", "function GameBoyAdvanceCompositor(gfx) {\n this.gfx = gfx;\n this.doEffects = 0;\n}", "function dragging_udpate( event )\n\t{var circle = event.detail.circle;\n\t\tvar node = graph_handler.nodes[ parseInt( circle.text.string, 10 ) ];\n\t\tnode.x = circle.x;\n\t\tnode.y = circle.y;\n node.update_edges( );\n\t\tgraph_handler.update_adjacency_matrix( );\n var i = node.edges_out.length;\n\t\twhile ( i-- )\n\t\t{circle.lines_out[ i ].text.string = parseFloat( node.edges_out[ i ].weight.toFixed( 2 ) );\n }\n\t\ti = node.edges_in.length;\n\t\twhile ( i-- )\n\t\t{circle.lines_in[ i ].text.string = parseFloat( node.edges_in[ i ].weight.toFixed( 2 ) );\n }\n }", "function KC9LIGtoggleLayer(KC9LIG) {\n \t\tif (KC9LIG.getVisible() == true) {\n \tKC9LIG.setVisible(false);\n \t\t} else {\n \tKC9LIG.setVisible(true);\n \t\t }\n\t}", "update(){ // call to update transforms\n dirty = false;\n m[3] = m[0] = scale;\n m[1] = m[2] = 0;\n m[4] = pos.x;\n m[5] = pos.y;\n if(useConstraint){\n this.constrain();\n }\n this.invScale = 1 / scale;\n // calculate the inverse transformation\n let cross = m[0] * m[3] - m[1] * m[2];\n im[0] = m[3] / cross;\n im[1] = -m[1] / cross;\n im[2] = -m[2] / cross;\n im[3] = m[0] / cross;\n }", "Blend() {}", "function resetTranslation(){ \n\n\tnewTopLeft = recalculateNetworkTopLeft()\n\n\n\ttranslateX = -newTopLeft[0] \t// because it is the canvas that is being moved around\n\ttranslateY = -newTopLeft[1]\t \t// we need to translate by the opposite of the amount\n\t\t\t\t\t\t\t\t\t// we want the visual components to be translated by\n\n\tconsole.log(\"new translate x,y: \" + translateX + \", \" + translateY) \n\t\n\tsvgPan.setAttribute('transform', 'translate(' + translateX + ',' + translateY + ')') \n}", "function drag(e) {\n\t\t\t// Get e.chartX and e.chartY\n\t\t\te = chart.pointer.normalize(e);\n\n\t\t\tchart.update({\n\t\t\t\tchart: {\n\t\t\t\t\toptions3d: {\n\t\t\t\t\t\talpha: alpha + (e.chartY - posY) / sensitivity,\n\t\t\t\t\t\tbeta: beta + (posX - e.chartX) / sensitivity\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, undefined, undefined, false);\n\t\t}", "_transferState(oldLayer) {\n debug(TRACE_MATCHED, this, this === oldLayer);\n\n const {state, internalState} = oldLayer;\n\n if (this === oldLayer) {\n return;\n }\n\n // Move internalState\n this.internalState = internalState;\n this.internalState.layer = this;\n\n // Move state\n this.state = state;\n // We keep the state ref on old layers to support async actions\n // oldLayer.state = null;\n\n // Ensure any async props are updated\n this.internalState.setAsyncProps(this.props);\n\n this.diffProps(this.props, this.internalState.getOldProps());\n }", "function remMapLayer(layer) {\r\n if (map.getLayer(layer)) {\r\n map.removeLayer(layer);\r\n }\r\n if (map.getSource(layer)) {\r\n map.removeSource(layer);\r\n }\r\n}", "removeLayer (layer) {\n this.layerOrder = this.layerOrder.filter(l => l.id !== layer.id)\n delete this.layers[layer.id]\n this._render()\n }", "reDrawArchs() {\n if (glb != null && glb != undefined) {\n glb.playCurve();\n }\n }", "ghost_logic(map, stop_ghost_release) {\r\n\r\n\r\n // Use AI to find a target tile - this will be different for each ghost\r\n // Set the location that the ghost should be heading to\r\n\r\n\r\n // figure out what mode our ghost should be in attack or\r\n // scatter\r\n if (this.ghost.mode == this.modeEnum.ATTACK) {\r\n this.ghost.mode_count ++;\r\n if (this.ghost.mode_count > this.ghost.attack_count) {\r\n this.ghost.mode_count = 0;\r\n this.ghost.mode = this.modeEnum.SCATTER;\r\n } \r\n } else {\r\n this.ghost.mode_count ++;\r\n if (this.ghost.mode_count > this.ghost.scatter_count) {\r\n this.ghost.mode_count = 0;\r\n this.ghost.mode = this.modeEnum.ATTACK;\r\n }\r\n }\r\n\r\n\r\n\r\n\r\n var target_x = 0;\r\n var target_y = 0;\r\n\r\n if (this.in_ghost_house()) {\r\n target_x = this.ghost.initial_target_x;\r\n target_y = this.ghost.initial_target_y;\r\n\r\n // Re animate the ghost\r\n if (this.sprite.status == this.statusEnum.DEAD) {\r\n this.re_animate_ghost();\r\n }\r\n\r\n }\r\n else {\r\n\r\n var new_target = this.find_target_position(this.ghost.attack_method); \r\n target_x = new_target.target_x;\r\n target_y = new_target.target_y;\r\n\r\n }\r\n \r\n\r\n //-------------------------------------------------------------------------------------------------\r\n // Tunnel - move ghost either side of screen for the tunnel\r\n //-------------------------------------------------------------------------------------------------\r\n var current_tile_pos = map.get_map_tile_position_pixel_coords(this.sprite.x_pos, this.sprite.y_pos);\r\n if (current_tile_pos.map_x >= 31 &&\r\n current_tile_pos.map_y == 14 &&\r\n this.ghost.direction_current.dEnum == this.directionEnum.RIGHT) {\r\n this.set_position(24, this.sprite.y_pos); \r\n this.ghost.change_coords = false; \r\n }\r\n\r\n if (current_tile_pos.map_x <= 1 &&\r\n current_tile_pos.map_y == 14 &&\r\n this.ghost.direction_current.dEnum == this.directionEnum.LEFT) {\r\n this.set_position(744, this.sprite.y_pos);\r\n this.ghost.change_coords = false;\r\n }\r\n\r\n //-------------------------------------------------------------------------------------------------\r\n\r\n \r\n // Do we have an initial travel direction? \r\n // Find an initial direction of travel to get to our target\r\n if (this.ghost.direction_current == null) {\r\n var possible_directions = this.find_possible_directions(map, this.sprite.x_pos, this.sprite.y_pos); \r\n var distance_of_travel = this.find_shortest_path(map, possible_directions, target_x, target_y, this.sprite.x_pos, this.sprite.y_pos);\r\n var direction = this.find_direction(distance_of_travel);\r\n\r\n // Set our initial direction of travel\r\n this.ghost.direction_current = direction; \r\n }\r\n \r\n\r\n // Find the current tile number we are on - use to detect\r\n // if we move to another tile.\r\n var current_tile = map.get_map_tile_number_pixel_coords(this.sprite.x_pos, this.sprite.y_pos);\r\n\r\n // If we have a direction of travel - and we have entered a new map tile - figure out what\r\n // our new direction of travel would be.\r\n if ((this.ghost.direction_current != null) && // We have a current direction of travel\r\n (current_tile != this.ghost.last_map_tile) && // We have moved on to a new tile \r\n (this.ghost.change_coords == false)) { // We are not currently waiting for a change in direction.\r\n\r\n\r\n var tile_width = 24;\r\n var tile_height = 24;\r\n\r\n var sprite_next_x_pos = this.sprite.x_pos;\r\n var sprite_next_y_pos = this.sprite.y_pos;\r\n\r\n // Note this looks at the tile ahead then makes a decision about the direction of travel \r\n if (this.ghost.direction_current.dEnum == this.directionEnum.UP) { sprite_next_y_pos -= tile_height; }\r\n if (this.ghost.direction_current.dEnum == this.directionEnum.RIGHT) { sprite_next_x_pos += tile_width; }\r\n if (this.ghost.direction_current.dEnum == this.directionEnum.DOWN) { sprite_next_y_pos += tile_height; }\r\n if (this.ghost.direction_current.dEnum == this.directionEnum.LEFT) { sprite_next_x_pos -= tile_width; }\r\n\r\n // Figure out an initial travel direction.\r\n var possible_directions = this.find_possible_directions(map, sprite_next_x_pos, sprite_next_y_pos); \r\n var distance_of_travel = this.find_shortest_path(map, possible_directions, target_x, target_y, this.sprite.x_pos, this.sprite.y_pos);\r\n this.ghost.direction_future = this.find_direction(distance_of_travel);\r\n\r\n // Store the tile we are currently on and our direction of travel\r\n this.ghost.last_map_tile = current_tile;\r\n \r\n // Store the x,y coordinate of the center of the future tile\r\n // we can use this to make sure the center point of the ghost is always in the \r\n // center of the tile.\r\n this.ghost.change_coords = map.get_map_tile_position_pixel_coords(sprite_next_x_pos, sprite_next_y_pos);\r\n \r\n }\r\n\r\n \r\n\r\n\r\n // Set the amination sequence that we should be using based on the ghost direction\r\n // and condition\r\n \r\n if (this.sprite.status == this.statusEnum.ALIVE) {\r\n this.set_animation_sequence_current(this.ghost.direction_current.dEnum);\r\n this.animate_start();\r\n //this.sprite.animation_sequence = this.ghost.direction_current.dEnum;\r\n }\r\n else if (this.sprite.status == this.statusEnum.SCARED) {\r\n \r\n // Change mode back to alive\r\n if (this.ghost.scared_count < this.ghost.scared_duration) {\r\n this.ghost.scared_count ++;\r\n\r\n if (this.ghost.scared_count < 200)\r\n this.set_animation_sequence_current(4);\r\n else\r\n this.set_animation_sequence_current(5); \r\n } \r\n else {\r\n this.sprite.status = this.statusEnum.ALIVE; \r\n } \r\n }\r\n else if (this.sprite.status == this.statusEnum.DEAD) {\r\n\r\n this.set_animation_sequence_current(6); \r\n this.set_animation_frame(6, this.ghost.direction_current.dEnum);\r\n }\r\n\r\n\r\n\r\n // We should always have a new direction and the coordinates (offset on tile)\r\n // of where the change in direction should be.\r\n\r\n // Move UP ghost \r\n var speed;\r\n if (this.sprite.status == this.statusEnum.ALIVE)\r\n speed = this.ghost.speed;\r\n else if (this.sprite.status == this.statusEnum.DEAD) \r\n speed = this.ghost.speed_dead;\r\n else if (this.sprite.status == this.statusEnum.SCARED)\r\n speed = this.ghost.speed_scared;\r\n\r\n if (this.ghost.direction_current.dEnum == this.directionEnum.UP) { \r\n if (this.sprite.y_pos - speed <= this.ghost.change_coords.center_y) {\r\n this.sprite.y_pos = this.ghost.change_coords.center_y;\r\n this.change_direction(stop_ghost_release);\r\n } else {\r\n this.sprite.y_pos -= speed; \r\n }\r\n }\r\n else\r\n // Right\r\n if (this.ghost.direction_current.dEnum == this.directionEnum.RIGHT) { \r\n if (this.sprite.x_pos + speed >= this.ghost.change_coords.center_x) {\r\n this.sprite.x_pos = this.ghost.change_coords.center_x;\r\n this.change_direction(stop_ghost_release);\r\n } else {\r\n this.sprite.x_pos += speed;\r\n }\r\n }\r\n else\r\n // Down\r\n if (this.ghost.direction_current.dEnum == this.directionEnum.DOWN) { \r\n if (this.sprite.y_pos + speed >= this.ghost.change_coords.center_y) {\r\n this.sprite.y_pos = this.ghost.change_coords.center_y;\r\n this.change_direction(stop_ghost_release);\r\n } else {\r\n this.sprite.y_pos += speed; \r\n }\r\n }\r\n else\r\n // Left\r\n if (this.ghost.direction_current.dEnum == this.directionEnum.LEFT) { \r\n if (this.sprite.x_pos - speed <= this.ghost.change_coords.center_x) {\r\n this.sprite.x_pos = this.ghost.change_coords.center_x;\r\n this.change_direction(stop_ghost_release);\r\n } else {\r\n this.sprite.x_pos -= speed; \r\n }\r\n }\r\n\r\n }", "function modeSwitchLabelClick () {\n // This function\n $divLabelDrawingLayer.css('z-index','1');\n $divViewControlLayer.css('z-index', '0');\n // $divStreetViewHolder.append($divLabelDrawingLayer);\n\n if (properties.browser === 'mozilla') {\n // A bug in Firefox? The canvas in the div element with the largest z-index.\n $divLabelDrawingLayer.append($canvas);\n }\n\n hideLinks();\n }", "function DownSample4x (source : RenderTexture, dest : RenderTexture){\n off = 1.0f;\n Graphics.BlitMultiTap (source, dest, fogMaterial,\n new Vector2(-off, -off),\n new Vector2(-off, off),\n new Vector2( off, off),\n new Vector2( off, -off)\n );\n}", "popStencilMask(a, b) {\n // this.renderer.currentRenderer.stop();\n this.renderer.stencil.popStencil();\n }", "commonInvAction() {\n this.prevBaseFramePosition = undefined;\n this.vLab.WebGLRendererCanvas.style.cursor = 'default';\n this.baseFrameActionActivated = false;\n this.vLab.SceneDispatcher.currentVLabScene.currentControls.enable();\n }", "updateTransform() {\n this.transform = Object(transformation_matrix__WEBPACK_IMPORTED_MODULE_9__[\"toSVG\"])(Object(transformation_matrix__WEBPACK_IMPORTED_MODULE_9__[\"smoothMatrix\"])(this.transformationMatrix, 100));\n }", "function LayerLerpBlender() {\n\tthis._blendWeight = null;\n\tthis._layerA = null;\n\tthis._layerB = null;\n}", "function plaxifier(e) {\n if (new Date().getTime() < lastRender + delay) return\n lastRender = new Date().getTime()\n var leftOffset = (plaxActivityTarget.offset() != null) ? plaxActivityTarget.offset().left : 0,\n topOffset = (plaxActivityTarget.offset() != null) ? plaxActivityTarget.offset().top : 0,\n x = e.pageX-leftOffset,\n y = e.pageY-topOffset\n\n if (\n x < 0 || x > plaxActivityTarget.width() ||\n y < 0 || y > plaxActivityTarget.height()\n ) return\n\n if(moveable()){\n if(e.gamma == undefined){\n ignoreMoveable = true\n return\n }\n values = valuesFromMotion(e)\n\n // Admittedly fuzzy measurements\n x = values.x / motionDegrees\n y = values.y / motionDegrees\n // Ensure not outside of expected range, -1 to 1\n x = x < motionMin ? motionMin : (x > motionMax ? motionMax : x)\n y = y < motionMin ? motionMin : (y > motionMax ? motionMax : y)\n // Normalize from -1 to 1 => 0 to 1\n x = (x + 1) / 2\n y = (y + 1) / 2\n }\n\n var hRatio = x/((moveable() == true) ? motionMax : plaxActivityTarget.width()),\n vRatio = y/((moveable() == true) ? motionMax : plaxActivityTarget.height()),\n layer, i\n\n for (i = layers.length; i--;) {\n layer = layers[i]\n newX = layer.startX + layer.inversionFactor*(layer.xRange*hRatio)\n newY = layer.startY + layer.inversionFactor*(layer.yRange*vRatio)\n if(layer.background) {\n layer.obj.css('background-position', newX+'px '+newY+'px')\n } else {\n layer.obj\n .css('left', newX)\n .css('top', newY)\n }\n }\n }", "_setupPromotionChoiceLayer() {\n\t\tthis._promotionLayer = new Konva.Layer();\n\t\t// Squares and pieces\n\t\tlet squareGroup = new Konva.Group();\n\t\tlet squareWidth = this._dimensions.boardWidth / 2;\n\n\t\tlet queenSquare = new Konva.Rect({\n\t\t\tx: 0, y: 0, height: squareWidth, width: squareWidth,\n\t\t\tfill: this._config.darkSquareColor\n\t\t});\n\t\tsquareGroup.add(queenSquare);\n\n\t\tlet rookSquare = new Konva.Rect({\n\t\t\tx: squareWidth, y: 0, height: squareWidth, width: squareWidth,\n\t\t\tfill: this._config.lightSquareColor\n\t\t});\n\t\tsquareGroup.add(rookSquare);\n\n\t\tlet bishopSquare = new Konva.Rect({\n\t\t\tx: 0, y: squareWidth, height: squareWidth, width: squareWidth,\n\t\t\tfill: this._config.lightSquareColor\n\t\t});\n\t\tsquareGroup.add(bishopSquare);\n\n\t\tlet knightSquare = new Konva.Rect({\n\t\t\tx: squareWidth, y: squareWidth, height: squareWidth, width: squareWidth,\n\t\t\tfill: this._config.darkSquareColor\n\t\t});\n\t\tsquareGroup.add(knightSquare);\n\n\t\tthis._promotionLayer.add(squareGroup);\n\n\t\tlet pieceGroup = new Konva.Group();\n\t\tlet squareCenter = squareWidth / 2;\n\n\t\tlet queen = new Konva.Shape({\n\t\t\tx: 0, y: 0,\n\t\t\twidth: squareWidth, height: squareWidth,\n\t\t\tsceneFunc: function(context, shape) {\n\t\t\t\tcontext.beginPath();\n\t\t\t\tcontext.moveTo(squareCenter - (squareWidth / 3), squareCenter - (squareWidth / 8));\n\t\t\t\tcontext.lineTo(squareCenter - (squareWidth / 6), squareCenter);\n\t\t\t\tcontext.lineTo(squareCenter, squareCenter - (squareWidth / 3));\n\t\t\t\tcontext.lineTo(squareCenter + (squareWidth / 6), squareCenter);\n\t\t\t\tcontext.lineTo(squareCenter + (squareWidth / 3), squareCenter - (squareWidth / 8));\n\t\t\t\tcontext.lineTo(squareCenter + (squareWidth / 4), squareCenter + (squareWidth / 3));\n\t\t\t\tcontext.lineTo(squareCenter - (squareWidth / 4), squareCenter + (squareWidth / 3));\n\t\t\t\tcontext.closePath();\n\t\t\t\tcontext.fillStrokeShape(shape);\n\t\t\t},\n\t\t\thitFunc: function(context, shape) {\n\t\t\t\tcontext.beginPath();\n\t\t\t\tcontext.rect(0, 0, squareWidth, squareWidth);\n\t\t\t\tcontext.fillStrokeShape(shape);\n\t\t\t}\n\t\t});\n\t\tqueen.on('click', event => {\n\t\t\tthis._listener.handlePromotionRequest('q');\n\t\t});\n\n\t\tlet halfRectWidth = squareWidth / 6;\n\t\tlet halfHeight = halfRectWidth * 2\n\t\tlet rook = new Konva.Shape({\n\t\t\tx: squareWidth, y: 0,\n\t\t\twidth: squareWidth, height: squareWidth,\n\t\t\tsceneFunc: function(context, shape) {\n\t\t\t\tcontext.beginPath();\n\t\t\t\tcontext.rect(\n\t\t\t\t\tsquareCenter - halfRectWidth,\n\t\t\t\t\tsquareCenter - halfHeight,\n\t\t\t\t\thalfRectWidth * 2, halfHeight * 2\n\t\t\t\t);\n\t\t\t\tcontext.fillStrokeShape(shape)\n\t\t\t},\n\t\t\thitFunc: function(context, shape) {\n\t\t\t\tcontext.beginPath();\n\t\t\t\tcontext.rect(0, 0, squareWidth, squareWidth);\n\t\t\t\tcontext.fillStrokeShape(shape);\n\t\t\t}\n\t\t});\n\t\trook.on('click', event => {\n\t\t\tthis._listener.handlePromotionRequest('r');\n\t\t});\n\n\t\tlet bishop = new Konva.Shape({\n\t\t\tx: 0, y: squareWidth,\n\t\t\twidth: squareWidth, height: squareWidth,\n\t\t\tsceneFunc: function(context, shape) {\n\t\t\t\tcontext.beginPath();\n\t\t\t\tcontext.moveTo(squareCenter, squareCenter - (squareWidth / 3));\n\t\t\t\tcontext.lineTo(\n\t\t\t\t\tsquareCenter + (squareWidth / 4),\n\t\t\t\t\tsquareCenter + (squareWidth / 3)\n\t\t\t\t);\n\t\t\t\tcontext.lineTo(\n\t\t\t\t\tsquareCenter - (squareWidth / 4),\n\t\t\t\t\tsquareCenter + (squareWidth / 3)\n\t\t\t\t);\n\t\t\t\tcontext.closePath();\n\t\t\t\tcontext.fillStrokeShape(shape);\n\t\t\t},\n\t\t\thitFunc: function(context, shape) {\n\t\t\t\tcontext.beginPath();\n\t\t\t\tcontext.rect(0, 0, squareWidth, squareWidth);\n\t\t\t\tcontext.fillStrokeShape(shape);\n\t\t\t}\n\t\t});\n\t\tbishop.on('click', event => {\n\t\t\tthis._listener.handlePromotionRequest('b');\n\t\t});\n\n\t\tlet knight = new Konva.Shape({\n\t\t\tx: squareWidth, y: squareWidth,\n\t\t\twidth: squareWidth, height: squareWidth,\n\t\t\tsceneFunc: function(context, shape) {\n\t\t\t\tcontext.beginPath();\n\t\t\t\tcontext.moveTo(squareCenter - (squareWidth / 4), squareCenter - (squareWidth / 3));\n\t\t\t\tcontext.lineTo(squareCenter, squareCenter - (squareWidth / 6));\n\t\t\t\tcontext.lineTo(squareCenter + (squareWidth / 4), squareCenter - (squareWidth / 3));\n\t\t\t\tcontext.lineTo(squareCenter + (squareWidth / 4), squareCenter);\n\t\t\t\tcontext.lineTo(squareCenter + (squareWidth / 8), squareCenter + (squareWidth / 3));\n\t\t\t\tcontext.lineTo(squareCenter - (squareWidth / 8), squareCenter + (squareWidth / 3));\n\t\t\t\tcontext.lineTo(squareCenter - (squareWidth / 4), squareCenter);\n\t\t\t\tcontext.closePath();\n\t\t\t\tcontext.fillStrokeShape(shape);\n\t\t\t},\n\t\t\thitFunc: function(context, shape) {\n\t\t\t\tcontext.beginPath();\n\t\t\t\tcontext.rect(0, 0, squareWidth, squareWidth);\n\t\t\t\tcontext.fillStrokeShape(shape);\n\t\t\t}\n\t\t});\n\t\tknight.on('click', event => {\n\t\t\tthis._listener.handlePromotionRequest('n');\n\t\t});\n\n\t\tif (this._model.playerSide === 'b') {\n\t\t\tqueen.fill(this._config.pieceColor);\n\t\t\trook.fill(this._config.pieceColor);\n\t\t\tbishop.fill(this._config.pieceColor);\n\t\t\tknight.fill(this._config.pieceColor);\n\t\t} else {\n\t\t\tqueen.stroke(this._config.pieceColor);\n\t\t\tqueen.strokeWidth(8);\n\t\t\trook.stroke(this._config.pieceColor);\n\t\t\trook.strokeWidth(8);\n\t\t\tbishop.stroke(this._config.pieceColor);\n\t\t\tbishop.strokeWidth(8);\n\t\t\tknight.stroke(this._config.pieceColor);\n\t\t\tknight.strokeWidth(8);\n\t\t}\n\t\tpieceGroup.add(queen);\n\t\tpieceGroup.add(rook);\n\t\tpieceGroup.add(bishop);\n\t\tpieceGroup.add(knight);\n\n\t\tthis._promotionLayer.add(pieceGroup);\n\t\tthis._stage.add(this._promotionLayer);\n\t}", "function toggleTransparency() {\n enableTransparency = !enableTransparency;\n}", "constructor(olMap, $slider, dynamicLayerRenderer1, dynamicLayerRenderer2) {\n\n dynamicLayerRenderer1.getVectorLayer().on('precompose', function(event) {\n const percent = $slider.val() / 100;\n var ctx = event.context;\n var width = ctx.canvas.width * percent;\n\n ctx.save();\n ctx.beginPath();\n ctx.rect(0, 0, width, ctx.canvas.height);\n ctx.clip();\n\n });\n\n dynamicLayerRenderer1.getVectorLayer().on('postcompose', function(event) {\n var ctx = event.context;\n ctx.restore();\n });\n\n dynamicLayerRenderer2.getVectorLayer().on('precompose', function(event) {\n const percent = $slider.val() / 100;\n var ctx = event.context;\n var width = ctx.canvas.width * percent;\n\n ctx.save();\n ctx.beginPath();\n ctx.rect(width, 0, ctx.canvas.width - width, ctx.canvas.height);\n ctx.clip();\n\n // Draw a separating vertical line.\n if (percent < 100) {\n ctx.beginPath();\n ctx.moveTo(width, 0);\n ctx.lineTo(width, ctx.canvas.height);\n ctx.stroke();\n }\n\n });\n\n dynamicLayerRenderer2.getVectorLayer().on('postcompose', function(event) {\n var ctx = event.context;\n ctx.restore();\n });\n\n $slider.on('input change', function() {\n olMap.render();\n });\n\n }", "function dnObj() {\n\t\t\t\tvar selectOb = canvas.getActiveObject();\n\t\t\t\tcanvas.sendBackwards(selectOb).renderAll();\n\n\t\t}" ]
[ "0.56915873", "0.5631035", "0.5538832", "0.55328166", "0.5480913", "0.54391956", "0.5438617", "0.54379714", "0.54356533", "0.5406228", "0.53963655", "0.5378993", "0.53664494", "0.53474635", "0.53381556", "0.5335646", "0.53295964", "0.53056073", "0.52950424", "0.52863014", "0.5281477", "0.52778745", "0.52762544", "0.52565515", "0.52565515", "0.5248297", "0.5243484", "0.5240058", "0.5239942", "0.5224767", "0.5224767", "0.5216333", "0.52073455", "0.52058154", "0.5204181", "0.51956314", "0.51923364", "0.51831245", "0.5180993", "0.5171832", "0.5160086", "0.5154805", "0.51482004", "0.5147633", "0.5143393", "0.5132564", "0.5131073", "0.513046", "0.51282644", "0.511661", "0.5116095", "0.51135355", "0.51126355", "0.5110569", "0.5104219", "0.50997937", "0.50972575", "0.50938964", "0.50913656", "0.50799274", "0.5078193", "0.50746185", "0.50711673", "0.5070797", "0.50688016", "0.50670385", "0.50644", "0.50623626", "0.5058046", "0.5054082", "0.50536156", "0.50517833", "0.5051473", "0.503562", "0.50334764", "0.502906", "0.5024878", "0.5021782", "0.5020412", "0.50199056", "0.50133926", "0.5010451", "0.50091064", "0.5000199", "0.49992552", "0.49956116", "0.49947754", "0.49903202", "0.49853677", "0.49742225", "0.49710447", "0.49707088", "0.4969832", "0.49698046", "0.4966966", "0.49646163", "0.49621373", "0.49614578", "0.4960156", "0.49558184", "0.49556208" ]
0.0
-1
Difference of Volumes of Cuboids
function findDifference(a, b) { let summA = 1; let summB = 1; for(let i = 0; i<a.length; i++){ summA *= a[i]; } for(let x = 0; x<b.length; x++){ summB *= b[x]; } let result; if(summA>summB){ result=summA-summB } else {result = summB - summA} return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getVolumeUtilisation() {\n let $itemVolume = 0;\n\n /** @var Item $item */\n this.items.forEach(item => $itemVolume += item.getVolume());\n\n // return round($itemVolume / this.box.getInnerVolume() * 100, 1);\n // FIXME: this doesn't maintain the same percision\n return Math.round($itemVolume / this.box.getInnerVolume() * 100);\n }", "getVolume() {\n const volume = Math.pow(this.length, 3);\n return +volume.toFixed(3);\n }", "getTotalVolume() {\n return this.height * this.width * this.length;\n }", "getTotalVolume() {\n return this.height * this.width * this.length;\n }", "getVolume() {\r\n\t\treturn this.width * this.length * this.height;\r\n\t}", "volume() {\n return this.length * this.width * this.height\n }", "volume() {\n return this.length * this.width * this.height;\n }", "function calculateVolume(width, height, length) {\n var volume = width * height * length;\n return volume;\n}", "getVolume() {\n const volume = (4 * Math.PI * Math.pow(this.radius, 3)) / 3;\n return +volume.toFixed(3);\n }", "get volume() {\n return this.radius * this.radius * Math.PI * this._height\n }", "function cupVolume(h , bigR , lilR){\n var volCup = (Math.PI/3) * h * (bigR^2+(lilR*bigR)+ lilR);\n return volCup\n\n}", "getTotalVolume()\n {\n return this.water + this.red + this.green + this.blue;\n\n }", "function hitungVolume(a, b) // nama fungsi harus mudah dipahami / readibility\r\n{\r\n\t// var volume1 => dihapus / Perfomance\r\n\t// var volume2 => dihapus / Perfomance\r\n\t// var hasil => dihapus / Perfomance\r\n\r\n\t// volume1 = a * a * a => dihapus / Perfomance\r\n\t// volume2 = b * b * b => dihapus / Perfomance\r\n\r\n\t// hasil = a * a * a + b * b * b => dihapus / Perfomance\r\n\r\n\treturn a * a * a + b * b * b\r\n}", "function getVolume()\r\n {\r\n return volume;\r\n }", "getUnUsedVolume() {\n return this.getTotalVolume() - this.getUsedVolume();\n }", "getVolume() {\n return Math.floor(this.video.volume * 100);\n }", "getUsedVolume() {\n var used = 0.0;\n for (var index in this.goods) {\n used += this.goods[index].getTotalVolume();\n }\n return used;\n }", "function recVolume(height) {\n let dimensions = [height];\n const _measure = (num) => {\n if (dimensions.length < 3) {\n dimensions.push(num);\n }\n if (dimensions.length === 3) {\n let sum = dimensions.reduce((acc, el) => (acc *= el));\n return sum;\n } else {\n return _measure;\n }\n };\n return _measure;\n}", "function livingVolume(height,width,depth){\n return height*width*depth; \n}", "function findCubeVolume(base1, base2, height, dec = 2, round = 0) {\n if (checkNum(base1, base2, height, dec)) {\n let Base = findRectArea(base1, base2);\n let calculation = Base * height;\n return fixPrecision(calculation, dec, round);\n }\n }", "function getVolume() {\n pxsim.console.log(pxsim.board().micVolume.toString());\n return pxsim.board().micVolume;\n }", "function lj_clusvol(lj, g)\n{\n var ic, i, j, n = lj.n;\n var vol = 0, ri, rj, dij;\n\n lj_getrenv(lj, g);\n lj.clsvol = newarr(g.nc);\n\n for ( ic = 0; ic < g.nc; ic++ ) {\n for ( i = 0; i < n; i++ ) {\n if ( g.cid[i] !== ic ) {\n continue;\n }\n ri = lj.renv[i];\n if ( D === 2 ) {\n vol += Math.PI * ri * ri;\n } else if ( D === 3 ) {\n vol += 4 * Math.PI / 3 * ri * ri * ri;\n }\n // compute the mutual exclusion volume\n for ( j = i + 1; j < n; j++ ) {\n var rj = lj.renv[j];\n var dij = Math.sqrt( lj.r2ij[i][j] );\n if ( dij >= ri + rj\n || ri + dij >= rj\n || rj + dij >= ri ) {\n continue;\n }\n if ( D === 2 ) {\n vol -= mutvol2d(ri, rj, dij);\n } else {\n vol -= mutvol3d(ri, rj, dij);\n }\n if ( isNaN(vol) ) {\n console.log( ic, i, j, ri, rj, dij, vol );\n throw new Error(\"invalid volume\");\n }\n }\n }\n lj.clsvol[ic] = vol;\n }\n\n return lj.clsvol;\n}", "function volume() {\n class Cylinder {\n constructor(h, r) {\n this.raio = r\n this.altura = h\n }\n Volume() {\n return Math.PI * this.raio * this.raio * this.altura\n }\n }\n let cyl = new Cylinder(7, 4)\n show('volume = ' + cyl.Volume().toFixed(4))\n}", "function calcVolume (width, height, depth) {\n return width * height * depth;\n}", "function volume (radius, height){\n\n var volume = Math.PI * radius * radius * height;\n return volume\n\n }", "function setCO2volumeOld(volume) {\n // Set person to 1x1\n \n // Check type of visual\n let f_volumeRatio = volume / FRIG_V; \n let t_volumeRatio = volume / TRUCK_V;\n let h_volumeRatio = volume / HOUSE_V;\n let p_volumeRatio = volume / PLANE_V;\n let pc_volumeRatio = volume / PLANE_C_V;\n \n let type = \"fridge\";\n let typeAmount = (f_volumeRatio);\n \n if (pc_volumeRatio > 1) {\n type = \"plane-carrier\";\n typeAmount = (pc_volumeRatio);\n } else if (p_volumeRatio > 1) {\n type = \"plane\";\n typeAmount = (p_volumeRatio);\n } else if (h_volumeRatio > 1) {\n type = \"house\";\n typeAmount = (h_volumeRatio);\n } else if (t_volumeRatio > 1) {\n type = \"truck\";\n typeAmount = (t_volumeRatio);\n }\n \n // Set amount\n let $amountContainerDay = $(\"#amountDay #containerDay\");\n $(\"#totalAmountDay\").text(`Total of: ${typeAmount.toFixed(2)} ${type}s per day`);\n $amountContainerDay.empty();\n for (let i = 0; i < Math.round(typeAmount); i++) {\n $amountContainerDay.append(`<div class=\"${type}\"></div>`)\n }\n\n typeAmount = typeAmount*30;\n let $amountContainerMonth = $(\"#amountMonth #containerMonth\");\n $(\"#totalAmountMonth\").text(`Total of: ${typeAmount.toFixed(2)} ${type}s per month`);\n $amountContainerMonth.empty();\n for (let i = 0; i < Math.round(typeAmount); i++) {\n $amountContainerMonth.append(`<div class=\"${type}\"></div>`)\n }\n\n typeAmount = typeAmount*12;\n let $amountContainerYear = $(\"#amountYear #containerYear\");\n $(\"#totalAmountYear\").text(`Total of: ${typeAmount.toFixed(2)} ${type}s per year`);\n $amountContainerYear.empty();\n for (let i = 0; i < Math.round(typeAmount); i++) {\n $amountContainerYear.append(`<div class=\"${type}\"></div>`)\n }\n\n}", "get volume() {\n\t\treturn this.volumeValue;\n\t}", "function volumeCylinder( radius, height ) {\n return multiply( Math.PI, square( radius ), height );\n}", "function getVolume()\n {\n return audio.volume;\n }", "function example004 () {\n return difference(\n cube({size: 30, center: true}),\n sphere(20)\n );\n}", "function vdiff(img){\n var vvsubvh = img.select(['VV']).subtract(img.select(['VH'])).rename('VVsubVH')\n return img.addBands(vvsubvh);\n}", "function volumeCylinder(radius, height){\n return -1;\n }", "function volumeAsc(a, b){\n\treturn parseInt($(b).find(\"p#cardVolume\")[0][\"textContent\"]) - parseInt($(a).find(\"p#cardVolume\")[0][\"textContent\"].toUpperCase());\n}", "function volRectangularSolid(length, width, height) {\n// Returns the Volume of a 3D Rectangular object\n return length * width * height;\n}", "function volume(val){\n //var fraction = val / 100;\n vol.gain.value = val;\n }", "getCurrentVolume() {\n return this.gainNode ? this.gainNode.gain.value : this.volume;\n }", "function processVolume(json,unit){\n json.w = json.w.map(function(vol){return round(vol/constants.conversions[unit],2)});\n return json.w;\n }", "function removersom(){\n som.volume=0;\n}", "getInnerVolume() {\n mustInherit();\n }", "volume(length){ // 1 parameter but method name same in this class\r\nreturn length**3;\r\n}", "function calcVariance() {\r\n var playersInChan = parseInt((sys.playersOfChannel(tourschan)).length, 10);\r\n var playersInTours = 0;\r\n for (var x in tours.tour) {\r\n if (tours.tour[x].players !== undefined) {\r\n playersInTours += parseInt(tours.tour[x].players.length, 10);\r\n }\r\n }\r\n // To escape unintended div/0 errs, because ln(1) = 0 and ln(0) = undef\r\n if (playersInChan < 2) {\r\n return 0.5;\r\n }\r\n if (playersInTours === 0) { // use ln(#players)\r\n return Math.log(playersInChan);\r\n }\r\n var variance = Math.log(playersInChan/playersInTours);\r\n if (variance <= 0.5 || isNaN(variance)) {\r\n return 0.5;\r\n }\r\n else return variance;\r\n}", "function volumeOfRectangle(w, l, h) {\n\tconsole.log(w * l * h);\n}", "function calculateVolumes(sizes, volumes, ABV, prices) {\r\n let drinkPrices = [];\r\n for (let i = 0; i < sizes.length; i++) {\r\n let alcoholVol = sizes[i] * volumes[i] * (ABV / 100);\r\n let numDrinks = alcoholVol / 17.7441;\r\n drinkPrices.push(prices[i] / numDrinks);\r\n }\r\n return drinkPrices;\r\n}", "function revDivided(v1,v2){\r\n //return v1/v2;\r\n console.log(v1/v2);\r\n }", "function volumeMinus() {\r\n\t//si le volume est supérieur à zéro on peut le baisser\r\n\tif (document.getElementById('mediaplayer').volume>0) {\r\n\t\tdocument.getElementById('mediaplayer').volume-=0.2;\r\n\t\tdocument.getElementById('volume').value=document.getElementById('mediaplayer').volume;\r\n\t}\r\n}", "static setSubtractQV(qv, qq) {\n//-------------\nqv[0] -= qq[0];\nqv[1] -= qq[1];\nqv[2] -= qq[2];\nqv[3] -= qq[3];\nreturn qv;\n}", "function getVolume(amount) {\n let bounds = amount.split('-');\n bounds.forEach((x, i, a) => {\n a[i] = Number(x.replace(/[ ,$]/g, ''));\n });\n return bounds.reduce((a, b) => a + b) / 2;\n}", "function cylinderDerivative(t) {\n return 0\n}", "function calculateServiceDeskVolume(parent) {\r\n \tif(parent.children != null){\r\n \t\tfor(var k = 0;k < parent.children.length;k++) {\r\n \t\t\tvar child = parent.children[k];\r\n \t\tfor (var i = 0; i < $scope.dealInfo/12; i++){\r\n \t\t\tchild.distributedVolume[i].volume = Math.round((parent.distributedVolume[i].volume * child.percentage)/100);\r\n \t\t}\r\n \t\t}\r\n \t}\r\n }", "function reduceVolume() {\n for (let i = 0; i < currentVid.length; i++) {\n \n if (!currentVid[i].paused) {\n currentVid[i].volume -= 0.1;\n\n if (currentVid[i].volume <=0.1) {\n currentVid[i].volume = 0;\n }\n }\n else {\n currentVid[i].volume = 0.3;\n }\n }\n}", "function volume(n){\n\t\treturn barsAgo(VOLUME,n);\n\t}", "function volumeOfBox(sizes) {\n let x = sizes.width * sizes.length * sizes.height;\n return x;\n}", "getVolume() {\n throw new Error(\"Abstract method must be overwritten by subclass!\")\n }", "function roofVolume(depth, sweep, width){\n return triangleArea(depth, sweep, sweep)*width;\n}", "function volumeOfBox(sizes) {\n this.width = sizes.width;\n this.height = sizes.height;\n this.length = sizes.length;\n\n const x = `${this.width}` * `${this.height}` * `${this.length}`;\n return x;\n}", "get variance(): number {\n if(this.alpha > 2) {\n return Math.pow(this.xm, 2) * this.alpha / (Math.pow(this.alpha - 1, 2) * (this.alpha - 2));\n }\n return Infinity;\n }", "function volumeadder(a1, a2, u1, u2) {\n if (u1 == 'micro liter' || u1 == 'micro liters') {\n a1 = a1 * Math.pow(10, -6);\n }\n if (u2 == 'micro liter' || u2 == 'micro liters') {\n a2 = a2 * Math.pow(10, -6);\n }\n if (u1 == 'milliliter' || u1 == 'milliliters') {\n a1 = a1 * Math.pow(10, -3);\n }\n if (u2 == 'milliliter' || u2 == 'milliliters') {\n a2 = a2 * Math.pow(10, -3);\n }\n return a1 + a2;\n}", "function decreaseVolume(){\r\n if(audio.volume - 0.18 >= 0 )\r\n audio.volume -= 0.18 ;\r\n}", "static lengthQV(qv) {\nreturn Math.sqrt(this.innerProductQV(qv, qv));\n}", "function calculateVolDensity()\n{\n var width = document.getElementById('width').value;\n var length = document.getElementById('length').value;\n var height = document.getElementById('height').value;\n var mass = document.getElementById('mass').value;\n \n \n /* calculate volume */\n result = width * length * height;\n result = result.toFixed(5);\n /* alert('result1 ='+result); */\n var volume = parseFloat(result);\n /* alert('value of volume: ='+ volume); */\n \n /* calculate density */\n result1 = mass / volume;\n result1 = result1.toFixed(5);\n /* alert('result1 ='+result1); */\n var density = parseFloat(result1);\n /* alert('value of density: ='+ density); */\n \n var sizeNine = [50,50,50,15,30,125000,0.00012,0.00024];\n var sizeEight = [40,40,40,12,14.9,64000,0.0001875,0.000234375];\n var sizeSeven = [35,35,35,10,11.9,42875,0.000233236,0.000279883];\n var sizeSix = [30,30,30,8,9.9,27000,0.000296296,0.00037037];\n var sizeFive = [25,25,25,6,7.9,15625,0.000384,0.000512];\n var sizeFour = [20,20,20,4,5.9,8000,0.0005,0.00075];\n var sizeThree = [15,15,15,3,3.9,3375,0.000888889,0.001185185];\n var sizeTwo = [10,10,10,2,2.9,1000,0.002,0.003];\n var sizeOne = [5,5,5,1,1.9,125,0.008,0.0152];\n var sizeZero = [2,2,2,0.5,0.9,8,0.0625,0.1125];\n \n /* alert('Mass '+mass); */\n var size=10;\n \n if (mass >= sizeNine[3] && mass <= sizeNine[4] || volume >sizeEight[5])\n {\n size = 9; \n }\n \n else if (mass >=sizeEight[3] && mass <= sizeEight[4] || volume > sizeSeven[5])\n { \n size = 8; \n }\n \n \n else if (mass >=sizeSeven[3] && mass <= sizeSeven[4] || volume > sizeSix[5])\n { \n size = 7; \n } \n \n else if (mass >=sizeSix[3] && mass <= sizeSix[4] || volume > sizeFive[5])\n { \n size = 6; \n }\n \n else if (mass >=sizeFive[3] && mass <= sizeFive[4] || volume > sizeFour[5])\n { \n size = 5; \n }\n \n else if (mass >=sizeFour[3] && mass <= sizeFour[4] || volume > sizeThree[5])\n { \n size = 4; \n }\n \n else if (mass >=sizeThree[3] && mass <= sizeThree[4] || volume > sizeTwo[5])\n { \n size = 3; \n }\n \n else if (mass >=sizeTwo[3] && mass <= sizeTwo[4] || volume > sizeOne[5])\n { \n size = 2; \n }\n \n else if (mass >=sizeOne[3] && mass <= sizeOne[4] || volume > sizeZero[5])\n { \n size = 1; \n }\n \n else if (mass >=sizeZero[3] && mass <= sizeZero[4] || volume <= sizeZero[5])\n { \n size = 0; \n } \n \n /*alert('size value =' +size); */\n \n \n /* return values of volume and density and size to hidden inputs HTML form */\n document.getElementById('volume').value=volume;\n document.getElementById('density').value=density;\n document.getElementById('size').value=size;\n \n}", "cov(arr1, arr2) {\r\n let sum = 0;\r\n let size = arr1.length;\r\n let ex = this.avg(arr1, size);\r\n let ey = this.avg(arr2, size);\r\n for(let i = 0; i < size; i++)\r\n sum = sum + (parseFloat(arr1[i]) - ex) *\r\n (parseFloat(arr2[i]) - ey);\r\n return sum / size;\r\n }", "function calculateVolume(volumeArray, sampleArray, windowSize){\r\n\tif(sampleArray.length<windowSize*3){\r\n\t\tconsole.log(\"error: sample length is too short. (less than 3*windowSize)\");\r\n\t\treturn;\r\n\t}\r\n\r\n\tvar volumeIndex = 0;\r\n\tvar lastIndex = Math.floor((sampleArray.length)/windowSize*2)-1;\r\n\r\n\tfor(;volumeIndex<lastIndex; volumeIndex++){\r\n\t\t//calculate volume\r\n\t\tvar index = volumeIndex*windowSize/2;\r\n\t\tvar squareSum = 0;\r\n\t\tif (volumeIndex >= 0 && volumeIndex != lastIndex){\r\n\t\t\t\r\n\t\t\tfor(var i = 0; i<windowSize; i++){\r\n\t\t\t\t//squareSum+= Math.pow(sampleArray[index] ,2 )\r\n\r\n\t\t\t\tsquareSum+= Math.pow(sampleArray[index] * 0.5 * (1- Math.cos(2*Math.PI*i/(windowSize))),2 )\r\n\t\t\t\tindex++;\r\n\t\t\t}\r\n\r\n\t\t\t/*\r\n\t\t\tfor(var i = 0; i<windowSize; i++){\r\n\t\t\t\tsquareSum+=Math.pow((i/windowSize)*sampleArray[index-2048],2);\r\n\t\t\t\tindex++;\r\n\t\t\t}\r\n\t\t\tfor(var i = 0; i<windowSize; i++){\r\n\t\t\t\tsquareSum+=Math.pow(sampleArray[index],2);\r\n\t\t\t\tindex++;\r\n\t\t\t}\r\n\t\t\tfor(var i = 0; i<windowSize; i++){\r\n\t\t\t\tsquareSum+=Math.pow((1-i/windowSize)*sampleArray[index+2048],2);\r\n\t\t\t\tindex++;\r\n\r\n\t\t\t}\r\n\t\t\t*/\r\n\t\t}\r\n\t\tvolumeArray[volumeIndex] = squareSum + 0.00001; //prevent from become zero (which causes minus infinity) \r\n\t\t//volumeArray[volumeIndex] = 130*Math.log(squareSum/(2*windowSize))/Math.LN10 + 280;;\r\n\r\n\t}\r\n}", "function areaVolume(width,length,height){\n return [ width * length, width*length*height];\n}", "function getVolume(playerId){\n\t\treturn mPlayers[playerId].volume;\n\t}", "function calculateV(){\n let area = (dims.value)*(dims.value);\n let vacant = area*vacantRatio.value;\n return Math.floor(vacant);\n}", "function mutvol3d(ri, rj, dij)\n{\n var xi = (ri*ri + dij*dij - rj*rj)/(2*dij);\n var vi = Math.PI * ( 2 * ri * ri * ri / 3 - ri * ri * xi + xi * xi * xi / 3 );\n var xj = (rj*rj + dij*dij - ri*ri)/(2*dij);\n var vj = Math.PI * ( 2 * rj * rj * rj / 3 - rj * rj * xj + xj * xj * xj / 3 );\n return vi + vj;\n}", "function volumeOfBox(sizes) {\n return sizes.length * sizes.width * sizes.height;\n }", "function volumeRectangular(length, width, height){\n return -1;\n }", "function iceBrickVolume(radius, bottleLength, rimLength) {\n return (bottleLength - rimLength) * (Math.pow(radius, 2) * 2);\n}", "function volDown() {\n let vm = document.getElementById(\"volMeter\");\n if (player.volume > 0) {\n player.volume -= 0.1;\n vm.value = player.volume;\n }\n}", "function cube(w, l, h)\n{\n var vol = w * l * h;\n vol = Number(vol);\n return vol;\n}", "UCB(c){\n //console.log(\"Victorias simulacion: \" + this.numVictoriasSimulacion + \"jugadas finales \" + this.numJugadasSimulacion + \"jugadas padre \" + this.padre.numJugadasSimulacion + \" jugadas simuladas \" + this.numJugadasSimulacion)\n return (this.numVictoriasSimulacion / this.numJugadasSimulacion) + c * Math.sqrt(Math.log(this.padre.numJugadasSimulacion) / this.numJugadasSimulacion)\n }", "get boundingVolume() {\n return this._boundingVolume;\n }", "get boundingVolume() {\n return this._boundingVolume;\n }", "static subtractQV(qa, qb) {\nvar qv;\nqv = this.copyOfQV(qa);\nreturn this.setSubtractQV(qv, qb);\n}", "function volumeCone( radius, height ) {\n return multiply( ( 1 / 3 ), Math.PI, square( radius ), height );\n}", "function SignalVariance(samples: float[]){\n\treturn (SignalPower(samples) - SignalAverage(samples));\n}", "function ballvolume(radius) {\n return (4 / 3) * Math.PI * radius ** 3;\n}", "function mutvol2d(ri, rj, dij)\n{\n var ai = Math.acos( (ri*ri + dij*dij - rj*rj) / (2*ri*dij) );\n var vi = ri * ri * (ai - Math.sin(ai));\n var aj = Math.acos( (rj*rj + dij*dij - ri*ri) / (2*rj*dij) );\n var vj = rj * rj * (aj - Math.sin(aj));\n return vi + vj;\n}", "function volumeSphere(){\n event.preventDefault();\n let volume=0;\n let inputRadius = document.getElementById('radius');\n let radiusValue = inputRadius.value;\n radiusValue = Math.abs(radiusValue);\n volume = (4/3)*Math.PI*Math.pow(radiusValue, 3);\n volume = volume.toFixed(2);\n let inputVolume = document.getElementById('volume');\n inputVolume.value = volume;\n return false;\n}", "function calculateCovariance(bClass, media) {\n let C = [];\n const XM = [];\n\n for (var i = 0; i < bClass.length; i++) {\n const xSubM = [];\n for (var j = 0; j < NAttr; j++) {\n xSubM.push(bClass[i][j][0] - media[j][0]);\n }\n XM.push([xSubM]);\n }\n\n for (var i = 0; i < XM.length; i++) {\n C.push(math.multiply(math.transpose(XM[i]), XM[i]));\n }\n\n let sum = C[0];\n for (var i = 1; i < C.length; i++) {\n sum = math.add(sum, C[i]);\n }\n\n C = math.multiply(sum, 1 / bClass.length);\n\n return C;\n}", "function getAverageVolume(array) {\n var values = 0;\n var average;\n\n var length = array.length;\n\n // get all the frequency amplitudes\n for (var i = 0; i < length; i++) {\n values += array[i];\n }\n\n average = values / length;\n return average;\n}", "function variance(x,size){\r\nvar av=avg(x,size);\r\nvar sum=0;\r\nfor(var i=0;i<size;i++){\r\n sum+=x[i]*x[i];\r\n}\r\nvar t = sum/size\r\nvar z = av*av\r\nvar total = t - z\r\n//console.log(\"variance : \" + total)\r\nreturn total;\r\n}", "function getAverageVolume(array) {\n var values = 0;\n var average;\n var length = array.length;\n\n // get all the frequency amplitudes\n for (var i = 0; i < length; i++) {\n values += array[i];\n }\n average = values / length;\n return average;\n }", "static unitCrossProductV3(xyza, xyzb) {\n//------------------\nreturn this.setUnitCrossProductV3(this.copyOfV3(xyza), xyzb);\n}", "function volumeChange(newVolume) {\n volumeNum = newVolume;\n volume.gain.value = Math.pow(volumeNum / 100, 2);\n}", "function calculateServiceDeskVolume(parent) {\r\n \tif(parent.children != null){\r\n \t\tfor(var k = 0;k < parent.children.length;k++) {\r\n \t\t\tvar child = parent.children[k];\r\n \t\tfor (var i = 0; i < $scope.dealInfo/12; i++){\r\n \t\t\tchild.distributedVolume[i].volume = Math.round((parent.distributedVolume[i].volume * child.percentage)/100);\r\n \t\t}\r\n \t\t}\r\n \t\t$scope.calcServerPrice();\r\n \t}\r\n }", "function calculate(){\n const base = (ballCalcul.value*4) \n const pieCalc = (base*3.14)/3 \n ballOutput.innerText= (\"the Ball Volume is: \" + pieCalc)\n return volume = pieCalc\n \n}", "function getDifference(pitch, swing) {\r\n var max = Math.max(pitch, swing);\r\n var min = Math.min(pitch, swing);\r\n var result = Math.min(max - min, 1000 - max + min);\r\n return result;\r\n}", "function sjekkProsentVekst(prosent1, prosent2) {\n var vekst = prosent2 - prosent1;\n return vekst;\n\n}", "function convert(data)\n{\n //console.log(\"Entering Conversion to Cumulative DVH w/ data\")\n //console.dir(data)\n var dose = [];\n var volume = [];\n var total_volume = 0;\n for(var i=0; i<data.length; i++)\n {\n dose.push(data[i][0]);\n volume.push(data[i][1]);\n total_volume += data[i][1];\n }\n\n totalData = [];\n for(var i=data.length-1; i>-1; i--)\n {\n var sum = volume.slice(0,i).reduce(function(a, b) { return a + b; }, 0);\n totalData[i] = [dose[i], 1 - sum/total_volume];\n }\n\n return totalData;\n}", "function example005 () {\n var cy = [];\n for (var i = 0; i <= 5; i++) {\n cy[i] = translate([sin(360 * i / 6) * 80, cos(360 * i / 6) * 80, 0], cylinder({h: 200, r: 10}));\n }\n return translate([0, 0, -120],\n union(\n difference(\n cylinder({h: 50, r: 100}),\n translate([0, 0, 10], cylinder({h: 50, r: 80})),\n translate([100, 0, 35], cube({size: 50, center: true}))\n ),\n cy,\n translate([0, 0, 200], cylinder({h: 80, r1: 120, r2: 0}))\n )\n );\n}", "function woodCalculator(chair, table, bed) {\n const oneChair = 1;\n let totalChair = Math.abs(chair) * oneChair;\n const oneTable = 3;\n let totalTable = Math.abs(table) * oneTable;\n const oneBed = 5;\n let totalBed = Math.abs(bed) * oneBed;\n let totalVolume = totalChair + totalTable + totalBed;\n return totalVolume;\n}", "function media(turma) {\n var soma = 0;\n var quantas_foram = 0;\n for (i = 0; i < turma.length; i++) {\n for (x = 0; x < 2; x++) {\n soma += turma[i].notas[x];\n quantas_foram += 1;\n }\n }\n var media = soma / quantas_foram /// Get the average value\n var devolve = 0;\n var diff = 21; /// set the min difference\n for (i = 0; i < turma.length; i++) {\n for (x = 0; x < 2; x++) {\n var closest = Math.abs(media - turma[i].notas[x]);\n if (closest < diff) {\n diff = closest; //// if closest value < difference devolve gets the value of the current grade\n devolve = turma[i].notas[x];\n }\n }\n }\n console.log(\"A média é: \", media);\n console.log(\"A nota mais proxima é: \", devolve);\n}", "function changeVol(n) {\r\n if (n < 0) {\r\n n = 0;\r\n } else if (n > 100) {\r\n n = 100;\r\n }\r\n for (var i = 0; i < notes.length; i++) {\r\n notes[i].volume = n / 100;\r\n }\r\n document.getElementById(\"volumeText\").innerHTML = n + \"%\";\r\n}", "function subVectors() {\n let vector = [];\n for (var vec of arguments) {\n for (var elem = 0; elem < vec.length; elem++) {\n if (isNaN(vector[elem])) {\n vector[elem] = vec[elem];\n } else {\n vector[elem] -= vec[elem];\n }\n }\n }\n return vector;\n}", "static subtractV3(xyza, xyzb) {\nreturn this.setSubtractV3(this.copyOfV3(xyza), xyzb);\n}", "function diff_v2(v1, v2) { return [v1[0] - v2[0], v1[1] - v2[1]]; }", "function dvakrat(cislo) {\r\n return cislo * 2;\r\n}", "function vvs() {\r\n var a = new Array();\r\n for (var i in vols) {\r\n if (vols[i].fl.length > 0 || wzdMode == \"new\") {\r\n // XXX: Change this to use one of (in this order): UUID, volume lable\r\n // or volume ID.\r\n a.push(vols[i].id);\r\n }\r\n }\r\n return a;\r\n }", "calcNUV() {\n this.N = this.viewingPoint.subtract(this.position).unit();\n this.U = this.N.crossProduct(this.UP).unit();\n this.V = this.U.crossProduct(this.N);\n }" ]
[ "0.65762186", "0.6564014", "0.6545999", "0.6545999", "0.64842874", "0.6464477", "0.6416172", "0.632722", "0.6241198", "0.6231947", "0.6228934", "0.60903275", "0.6075686", "0.60682225", "0.60641515", "0.60449046", "0.60318965", "0.6008852", "0.60088485", "0.5995542", "0.5950371", "0.5893054", "0.58550066", "0.5819109", "0.58173704", "0.5740328", "0.5730307", "0.5727155", "0.57121104", "0.5709191", "0.5692128", "0.5686239", "0.56510293", "0.56244683", "0.56175625", "0.55714023", "0.5563496", "0.5551254", "0.5518791", "0.5517009", "0.55016", "0.549402", "0.5490388", "0.54580617", "0.54562354", "0.54530174", "0.54459023", "0.5432073", "0.54245085", "0.53958523", "0.5361311", "0.53571284", "0.5352185", "0.53458583", "0.5345022", "0.53330326", "0.53125846", "0.53121704", "0.5303328", "0.5301162", "0.5299598", "0.52889335", "0.5283179", "0.5272073", "0.52663505", "0.5263728", "0.5253489", "0.5243572", "0.52216", "0.5192238", "0.51854223", "0.5183159", "0.51809627", "0.51809627", "0.51649666", "0.51616824", "0.5153824", "0.5131739", "0.5131239", "0.5131141", "0.51310027", "0.51297635", "0.5127387", "0.51192254", "0.5111184", "0.51097965", "0.5107334", "0.5085444", "0.5081189", "0.50630546", "0.5061182", "0.50568247", "0.5055057", "0.50536036", "0.5044703", "0.50270736", "0.5014247", "0.50007427", "0.49917302", "0.49901792", "0.4976466" ]
0.0
-1
address of local host server
function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "address() {\n const address = this.server.address();\n const endpoint = typeof address !== \"string\"\n ? (address.address === \"::\" ? \"localhost\" : address.address) + \":\" + address.port\n : address;\n return `${this.protocol}://${endpoint}`;\n }", "function getHost() {\n // todo: change by setting using Sails config\n return {host: process.env.HOST || 'http://localhost:1337'};\n }", "function getHost(){\n\t\treturn this.host;\n\t}", "function getSocketAddress(){\n if(location.port === '3000') {\n const host = location.host.split(':')[0];\n return 'http://'+host+':8080';\n } else {\n return location.origin;\n }\n}", "getServerUrl() {\n const {\n host,\n port\n } = this.serverConfig;\n return `//${host || 'localhost'}:${port}`;\n }", "function islocalhost() {\n\t// local hostname\n\tif (['adsense.webmanajemen.com', 'localhost', '127.0.0.1'].includes(location.hostname)) return true;\n\t// local network\n\tif (location.hostname.startsWith('192.168.')) return true;\n\t// port defined\n\tif (location.port.length > 0) return true;\n\treturn false;\n}", "function HostService() {\n /*host: string = \"http://localhost:900S0/\"*/\n /*host: string = \"http://localhost:9000/imersa/\"*/\n /*host: string = \"http://192.168.0.20:9000/imersa/\";*/\n /*\thost: string = \"http://localhost:9000/\"*/\n // host: string = \"http://localhost:8080/\";\n /*host: string = \"http://localhost:7089/\" */\n /*host: string = \"http://localhost:8080/imersa_backend-req4/\"*/\n // host: string = \"http://grupocubus.dyndns.org:50001/\";\n //host: string = \"http://ykssistemas.dyndns.org:50001/imersa/\";\n this.host = \"http://ec2-18-217-145-105.us-east-2.compute.amazonaws.com:9000/imersa/\";\n }", "get serverUrl() {\n return `http://${this.host}:${this.port}`;\n }", "function notify()\n{\n //var host = server.address().address;\n //var port = server.address().port;\n console.log(\"Listening on port 3000\");\n}", "function getHostAddress() {\n var i, candidate, nets = require('os').networkInterfaces();\n function filterFunc(item) {\n return item.family === 'IPv4' && !item.internal;\n }\n for (i in nets) {\n if (nets.hasOwnProperty(i)) {\n candidate = nets[i].filter(filterFunc)[0];\n if (candidate) {\n return candidate.address;\n }\n }\n }\n return \"127.0.0.1\";\n }", "get host() { return this._host; }", "function detectHost() {\n\t\tvar host;\n\t\thost = (location.hostname.indexOf(\"10.128\") === 0) ? \"localhost\" : location.hostname;\n\n\t\tswitch (host) {\n\t\t\tcase \"localhost\":\n\t\t\tcase \"127.0.0.1\":\n\t\t\tcase \"skynet\":\n\t\t\tcase \"skynet-1\":\n\t\t\t\thost = \"local\";\n\t\t\t\tbreak;\n\t\t\tcase \"www.csps-efpc.gc.ca\":\n\t\t\tcase \"csps-efpc.gc.ca\":\n\t\t\t\thost = \"public\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\thost = \"prod\";\n\t\t\t\tbreak;\n\t\t}\n\t\t//console.log(host);\n\t\treturn host;\n\n\t}", "function getHost() {\n\t\tvar host = getQueryParam('host');\n\t\tif (host) {\n\t\t\tif (host.lastIndexOf('http',0) === -1) {\n\t\t\t\thost = 'http://'+host;\n\t\t\t}\n\t\t} else {\n\t\t\thost = ''; // production/default host\n\t\t}\n\t\treturn host;\n\t}", "function LocalHost()\n{\n\t/*\n\tTODO: This returns an empty string when running cgiserver.py\n\t*/\n\tpathArray = location.href;\n\tidxLastSlash = pathArray.lastIndexOf(\"/\");\n\treturn pathArray.substring(0,idxLastSlash);\n}", "function getLocalAddress() {\n const isNode = typeof process === 'object' && typeof process.on === 'function';\n if (!isNode) {\n return new InetAddress('127.0.0.1');\n }\n\n // eslint-disable-next-line global-require\n const networkAddress = require('./network');\n return new InetAddress(networkAddress.ipv4());\n}", "_is_localhost() {\n return ['127.0.0.1','localhost', os.hostname()].includes(this.settings.clamdscan.host);\n }", "function getHostURL() {\n var hostURL = window.location.protocol + '//' + window.location.hostname + ':' + host_port;\n return hostURL;\n}", "function listen() {\n var host = server.address().address;\n var port = server.address().port;\n console.log('Listening at http://' + host + ':' + port);\n}", "function listening() {\n console.log(`localhost:${port}`);\n}", "function serverStart() {\n var port = this.address().port;\n console.log(\"Server listening on port \" + port);\n}", "function GetAddr(sock)\n{\n var addr = sock.remoteAddress.replace('::ffff:','');\n if (addr == '::1') addr = 'localhost';\n return addr;\n}", "function HostService() {\n this.host = \"https://sleepy-oasis-96155.herokuapp.com/\";\n }", "function isLocalhost(){\n return window.location.origin.includes(\"localhost\");\n}", "function serverStart() {\n\tvar port = server.address().port;\n\tconsole.log('Server listening on port ' + port);\n}", "function onListening() {\n var serverURL = \"http://localhost:\" + config.port;\n console.log(\"server listening on \" + serverURL);\n}", "get host() {\n return this._host;\n }", "function onListening() {\n\tconst addr = server.address();\n\tconst bind = `${serverConfig.host}:${serverConfig.defaultPort}`;\n\t// const bind = typeof(addr) === 'string' ? 'pipe ' + addr : 'port ' + addr.port;\n\tdebug('Listening on ' + bind);\n}", "function listen() {\n var host = server.address().address;\n var port = server.address().port;\n console.log('Application listening at http://' + host + ':' + port);\n}", "function listen() {\r\n var host = server.address().address;\r\n var port = server.address().port;\r\n console.log('Example app listening at http://' + host + ':' + port);\r\n}", "function listen() {\r\n var host = server.address().address;\r\n var port = server.address().port;\r\n console.log('Example app listening at http://' + host + ':' + port);\r\n}", "function listen() {\r\n var host = server.address().address;\r\n var port = server.address().port;\r\n console.log('Example app listening at http://' + host + ':' + port);\r\n}", "function NiceHostname()\n{\n\tif (location.hostname == \"127.0.0.1\")\n\t\treturn \"localhost\";\n\treturn location.hostname;\n}", "function listen() {\n var host = server.address().address;\n var port = server.address().port;\n console.log('Example app listening at http://' + host + ':' + port);\n}", "function getServerURL() {\n const url = isDev ? \"http://localhost:4000\" : document.location.host;\n log(\"Requested server: \", url);\n return url;\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;\n}", "function getHost(hostname) {\n if ((hostname === 'localhost' || hostname === '127.0.0.1') && typeof window !== 'undefined' && window.__fbBatchedBridge && window.__fbBatchedBridge.RemoteModules && window.__fbBatchedBridge.RemoteModules.AndroidConstants) {\n var _window$__fbBatchedBr = window.__fbBatchedBridge.RemoteModules.AndroidConstants.ServerHost;\n var ServerHost = _window$__fbBatchedBr === undefined ? hostname : _window$__fbBatchedBr;\n\n return ServerHost.split(':')[0];\n }\n\n return hostname;\n}", "function onListening() {\n let addr = server.address();\n let bind = typeof addr === \"string\" ? \"pipe \" + addr : \"port \" + addr.port;\n console.log(\"Server is listening on \" + bind);\n console.log(\"Enter your link: http://localhost:3000\");\n}", "function SERVER_HTTP_HOST(){\n\tvar url = window.location.href;\n\turl = url.replace(\"http://\", \"\"); \n\t\n\tvar urlExplode = url.split(\"/\");\n\tvar serverName = urlExplode[0];\n\t\n\tserverName = \"http://\"+serverName;\n\treturn serverName;\n}", "isLocalhost () {\n\t\tif (! this.isValid) {\n\t\t\treturn (false);\n\t\t}\n\t\tif ((this.octets[0] == 127) && (this.octets[1] == 0) && (this.octets[2] == 0) && (this.octets[3] == 1)) {\n\t\t\treturn (true);\n\t\t}\n\t\treturn (false);\n\t}", "function onListening() {\n let addr = server.address();\n var bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n console.log('Listening on ' + bind);\n console.log('Broadcast on local IP ' + ip);\n console.log('------------------------------');\n console.log('View site at http://localhost:' + port);\n}", "function onListening() {\n\tconst addr = server.address();\n\tconst bind = (typeof addr === 'string') ? 'pipe ' + addr : 'port ' + addr.port;\n}", "function onListening() {\n var addr = process.env.ADDRESS || http_server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug('Listening on ' + bind);\n}", "get liveServiceHostname() {\n return url.format({\n protocol: this.liveServiceProtocol,\n host: this.liveServiceHost\n });\n }", "function onListening () {\n const addr = server.address()\n console.log(`Listening on https://localhost:${addr.port}`)\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n}", "function listen() {\n var host = server.address().address;\n var port = server.address().port;\n console.log('Example app listening at http://' + host + ':' + port);\n}", "function listen() {\n var host = server.address().address;\n var port = server.address().port;\n console.log('Example app listening at http://' + host + ':' + port);\n}", "function listen() {\n var host = server.address().address;\n var port = server.address().port;\n console.log('Example app listening at http://' + host + ':' + port);\n}", "function listen() {\n var host = server.address().address;\n var port = server.address().port;\n console.log('Example app listening at http://' + host + ':' + port);\n}", "function listen() {\n var host = server.address().address;\n var port = server.address().port;\n console.log('Example app listening at http://' + host + ':' + port);\n}", "function onListening() {\n const addr = server.address();\n const bind =\n typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;\n console.log(`Up on http://localhost:${addr.port}`);\n}", "function start() {\n\tsocket.connect(port, host);\n}", "function createServer(port,host){\n return new Promise((resolve, reject) => {\n\n server = net.createServer(handleConnection);\n server.on('error', function(err) {\n let msg = \"Connection error: \" + err + \" for \" + server.address();\n console.log(msg);\n reject(msg)\n });\n server.listen(port,host, () => {\n port = server.address().port;\n //{\"address\":\"127.0.0.1\",\"family\":\"IPv4\",\"port\":3000}\n resolve(server.address());\n });\n });\n \n\n }", "function start_server () {\n var server = new msp.Proxy();\n server.listen(8050);\n log('Proxying from http://:8050');\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug('Listening on ' + bind);\n console.log('http://localhost:' + addr.port);\n}", "serve() {\n this.server.listen(this.port);\n console.log(`Port: ${this.port}`);\n }", "static RegisterHost() {}", "function onListening() {\n Object.keys(httpServers).forEach(key => {\n var httpServer = httpServers[key];\n var addr = httpServer.address()||{};\n var bind = typeof addr === \"string\"\n ? \"pipe \" + addr\n : \"port \" + addr.port;\n debug(\"Listening on \" + bind);\n })\n}", "function listening(){\n console.log(`Server is running on localhost: ${port}`);\n}", "function getLocalIp () {\n var ifaces = require('os').networkInterfaces();\n var wlan0 = ifaces['wlan0'];\n\n if (!wlan0) {\n return;\n }\n\n return wlan0.length > 1 ? wlan0[0].address : '';\n}", "function onListening() {\n \tvar addr = server.address();\n \tvar bind = typeof addr === 'string'\n \t? 'pipe ' + addr\n \t: 'port ' + addr.port;\n \tdebug('Listening on ' + bind);\n }", "function onListening()\n{\n var addr = server.address();\n var bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;\n debug('Listening on ' + bind);\n}", "function getHost() {\n return window.location.host.split('.').slice(-2).join('.');\n}", "function get_ws_server_address(){\n\treturn (document.location.protocol == \"https:\" ? \"wss:\":\"ws:\") + \"//\" + location.host;\n }", "Listen() {\n this.server.listen(this.port, () => {\n console.log(` ---> Servidor corriendo en ${Constants_1.HOST}${this.port}`);\n });\n }", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug('Listening on ' + bind);\n console.log('Listening on ' + ip_host + ' and ' + bind);\n}", "function address(node) {\n return node.broadcast_address + ':' + node.tcp_port;\n}", "function r(e){return e.socket?e.socket.remoteAddress:e.connection.remoteAddress}", "function onListening() {\nvar addr = server.address();\nvar bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\ndebug('Listening on ' + bind);\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n //debug('Listening on ' + bind);\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === \"string\" ? \"pipe \" + addr : \"port \" + addr.port;\n debug(\"Listening on \" + bind);\n}", "function onListening() {\n const addr = server.address();\n const bind = typeof addr === 'string' ?\n 'pipe' + addr :\n 'port' + addr.port;\n}", "_onListening() {\n /* Called after socket.bind */\n let address = this.socket.address()\n log.info(`server listening ${address.address}:${address.port}`)\n }", "function onListening() {\n log.info('%s listening at %s', config.appName, server.address().address);\n console.log('Server started on %s', server.address().address);\n console.log(`Test using:\\n curl -kisS ${server.address().address}/hello`);\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n console.log('Escuchando en ' + bind);\n}", "function IsLocal(addr) {\n // LOCK(cs_mapLocalHost)\n return !!mapLocalHost[addr];\n}", "function getHost(slave) {\n return slave.hostname;\n }", "function ConnectToServer () {\n Network.Connect(\"127.0.0.1\", 25000);\n}", "repickHost() {\n this.host = null;\n var newHostId = Object.keys(this.socketNames)[0];\n this.host = newHostId ? newHostId : null;\n }", "function externalIP() {\n var addrs = os.networkInterfaces();\n var address = '127.0.0.1';\n\n for (var key in addrs) {\n for (var k in addrs[key]) {\n if (addrs[key][k].family == 'IPv4') {\n // Check if loopback address\n var re = /^(127\\.[\\d.]+|[0:]+1|localhost)$/;\n var result = addrs[key][k].address.match(re);\n if (result == null) {\n return addrs[key][k].address;\n }\n }\n }\n }\n\n return address;\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n // debug('Listening on ' + bind);\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug('Listening on ' + bind);\n }", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === \"string\" ? \"pipe \" + addr : \"port \" + addr.port;\n console.log(\"Listening on \" + bind);\n}", "function onListening() {\r\n var addr = server.address();\r\n var bind = typeof addr === 'string'\r\n ? 'pipe ' + addr\r\n : 'port ' + addr.port;\r\n debug('Listening on ' + bind);\r\n}", "function onListening() {\n const addr = server.address();\n console.log(`Listening on ${addr.port}`);\n}", "function listening(){\n console.log(\"server running\"); \n console.log(`running on localhost: ${port}`);\n}", "function onListening() {\n // 忽略80端口\n const _port = (port != 80 ? ':' + port : '');\n const url = \"http://\" + hostname + _port + '/';\n debug(`${staticDir} server running at ${url}`);\n console.log(`${staticDir} server running at`,url);\n\n if(!argv.silent){\n openBrowserURL(url)\n }\n\n}", "function onListening() {\n var address = server.address();\n var bind = typeof address === 'string' ? 'pipe ' + address : 'port ' + address.port;\n debug('Listening on ' + bind);\n}", "start() {\n // listen to coming requests\n const port = Number(this.config.port || process.env.PORT || 0);\n const host = this.config.host || '127.0.0.1';\n this.server.listen(port, host, () => {\n this.app.locals.url = `${this.app.locals.schema}://${host}:${port}`;\n log.info(`Server started on ${this.app.locals.url}`);\n });\n }", "function onListening() {\n var addr = server.address()\n var bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port\n debug('Listening on ' + bind)\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;\n debug( 'Listening on ' + bind );\n}", "function onListening () {\n var addr = server.address ();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug ('Listening on ' + bind);\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === \"string\" ? \"pipe \" + addr : \"port \" + addr.port;\n debug(\"Listening on \" + bind);\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === \"string\" ? \"pipe \" + addr : \"port \" + addr.port;\n debug(\"Listening on \" + bind);\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === \"string\" ? \"pipe \" + addr : \"port \" + addr.port;\n debug(\"Listening on \" + bind);\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === \"string\" ? \"pipe \" + addr : \"port \" + addr.port;\n debug(\"Listening on \" + bind);\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === \"string\" ? \"pipe \" + addr : \"port \" + addr.port;\n debug(\"Listening on \" + bind);\n}", "function onListening() {\n\tvar addr = server.address();\n\tvar bind = typeof addr === \"string\" ? \"pipe \" + addr : \"port \" + addr.port;\n\tdebug(\"Listening on \" + bind);\n}", "function getIPAddress() \n{\n var interfaces = require('os').networkInterfaces();\n for (var devName in interfaces) \n {\n var iface = interfaces[devName];\n\n for (var i = 0; i < iface.length; i++) \n {\n var alias = iface[i];\n if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal)\n return alias.address;\n }\n }\n return '0.0.0.0';\n}", "async function get_ip(){\n if (globals.development_mode){\n return \"localhost\"\n }\n else{\n return globals.ec2_p_ip\n }\n }" ]
[ "0.72635865", "0.67688453", "0.6763419", "0.6653417", "0.6649971", "0.65997267", "0.65518427", "0.65138215", "0.63851935", "0.6383864", "0.6326003", "0.62896174", "0.6258737", "0.6248042", "0.6225239", "0.62222266", "0.6202849", "0.6200772", "0.6199253", "0.61453617", "0.6143379", "0.61431223", "0.6083161", "0.60525095", "0.60513484", "0.60430825", "0.60387325", "0.6036126", "0.59870714", "0.59870714", "0.59870714", "0.5983868", "0.5962584", "0.59597033", "0.59546846", "0.5951799", "0.5929462", "0.5922107", "0.5919367", "0.591645", "0.5916442", "0.58998877", "0.58996063", "0.58899516", "0.58890885", "0.58878714", "0.58773875", "0.58773875", "0.58773875", "0.58773875", "0.58773875", "0.58642113", "0.5854754", "0.58530164", "0.58483803", "0.58449477", "0.58240306", "0.5821923", "0.5817785", "0.5808582", "0.57992375", "0.5796844", "0.5794583", "0.578707", "0.5786793", "0.57838315", "0.5773333", "0.5767315", "0.5766831", "0.5761685", "0.57503825", "0.5747364", "0.57448286", "0.57431024", "0.57356757", "0.572844", "0.5724893", "0.57246614", "0.5724115", "0.5724059", "0.5722987", "0.57197994", "0.5716319", "0.57119757", "0.5706936", "0.5704439", "0.57031214", "0.569929", "0.5698527", "0.5689649", "0.56877023", "0.56866753", "0.5684204", "0.56841826", "0.56841826", "0.56841826", "0.56841826", "0.56841826", "0.5683068", "0.5682443", "0.5680341" ]
0.0
-1
Ok, here's the funny business: function calls to mongoDB return a promise that it will eventually execute to use threading commands like await, we can only call it in async functions, which chai appears not to be to overcome this, create a nested asynchronous function that contains what you want to do make sure to name it, and cal it in the test field. this will allow Node.js to wait for mongodb to complete the operation and not return IOUs
async function test2 () { await Book.insertMany(testBookArray); chai.request(server) // May have to change name because we haven't named it yet .get('/api/book/getAll') .end((err, res) => { res.should.have.status(200) //console.log(res.body) res.body.should.be.a('array') res.body.length.should.be.eql(testBookArray.length) done() }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sampleInteraction() {\n MongoClient.connect('mongodb://localhost:27017/duelgame', function(err, db) { // connects to our mongodb server in the test database\n // returns either an error, or our database\n \n if (err) { // if we get an error, print the error and close.\n return console.log(err);\n }\n\n db.collection(\"users\").insert({name: \"rody\"}); // adds a new record to the database\n\n console.log(db.collection(\"users\").find().toArray(function(err, results) { // pulls all the users and turns them to array\n if (err) { // if we get an error, print the error and close.\n return console.log(err);\n }\n console.log(results); \n }));\n\n MongoClient.close(); //close our connection\n });\n}", "async function test2 () \n {\n const book = new Book({\n title:\"test\",\n writingPrompt:\"test\",\n image:\"test\",\n numberOfChapters:\"1\",\n duration:\"1\",\n authorArray:[],\n genre: \"test\"\n })\n \n \n \n await Book.create(book);\n\n let query = Book.findOne({});\n query.exec((err, bookT) => {\n var targetId = typeof String;\n targetId = bookT._id;\n //console.log(targetId)\n\n chai.request(server)\n // May have to change name because we haven't named it yet\n .get('/api/book/getById?books=' + targetId)\n .end((err, res) => {\n //console.log(res.body)\n //console.log(res.status)\n res.should.have.status(200)\n res.body.should.be.a('array')\n res.body.length.should.be.eql(1);\n done()\n })\n })\n }", "function testWithCallbacks(callback) {\n console.log('\\n--- testWithCallbacks ---');\n const client = new MongoClient(url, { useNewUrlParser: true,useUnifiedTopology: true});\n client.connect(function(err, client) {\n if (err) {\n callback(err);\n return;\n }\n console.log('Connected to MongoDB');\n\n const db = client.db();\n const collection = db.collection('products');\n\n // id: 1, Name: 'Blue Shirt',Price: '16.99', \n // Category: 'Shirts', Image: 'https://images.app.goo.gl/A1VVdgNYDBFprrow5',\n\n const product = { id: 1, Name: 'A test shirt', Price: '5.8', Category:'Shirts', Image:'www.google.com' };\n collection.insertOne(product, function(err, result) {\n if (err) {\n client.close();\n callback(err);\n return;\n }\n console.log('Result of insert:\\n', result.insertedId);\n collection.find({ _id: result.insertedId})\n .toArray(function(err, docs) {\n if (err) {\n client.close();\n callback(err);\n return;\n }\n console.log('Result of find:\\n', docs);\n client.close();\n callback(err);\n });\n });\n });\n}", "function known_collection_identifier__waitForSync_EQ_trueSuite () {\n let cn = \"UnitTestsCollectionBasics\";\n return {\n setUp: function() {\n let cid = db._create(cn, { waitForSync: true } );\n },\n\n tearDown: function() {\n db._drop(cn);\n },\n\n test_creating_a_new_document__waitForSyncEQtrue: function() {\n let cmd = `/_api/document?collection=${cn}`;\n let body = \"{ \\\"Hallo\\\" : \\\"World\\\" }\";\n let doc = arango.POST_RAW(cmd, body, {});\n\n assertEqual(doc.code, 201);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(etag, `\"${rev}\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n arango.DELETE_RAW(location);\n \n assertEqual(db[cn].count(), 0);\n },\n\n test_creating_a_new_document__setting_compatibility_header__waitForSyncEQtrue: function() {\n let cmd = `/_api/document?collection=${cn}`;\n let body = \"{ \\\"Hallo\\\" : \\\"World\\\" }\";\n let doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 201);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], `${cn}`);\n\n assertEqual(etag, `\"${rev}\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n arango.DELETE_RAW(location);\n\n assertEqual(db[cn].count(), 0);\n },\n\n test_creating_a_new_document_complex_body__waitForSyncEQtrue: function() {\n let cmd = `/_api/document?collection=${cn}`;\n let body = { \"Hallo\" : \"Wo\\\"rld\" };\n let doc = arango.POST_RAW(cmd, body, {});\n\n assertEqual(doc.code, 201);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(etag, `\"${rev}\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n cmd = `/_api/document/${did}`;\n doc = arango.GET_RAW(cmd);\n\n assertEqual(doc.code, 200);\n assertEqual(doc.headers['content-type'], contentType);\n assertEqual(doc.parsedBody['Hallo'], 'Wo\"rld');\n\n arango.DELETE_RAW(location);\n\n assertEqual(db[cn].count(), 0);\n },\n\n test_creating_a_new_document_complex_body__setting_compatibility_header__waitForSyncEQtrue_: function() {\n let cmd = `/_api/document?collection=${cn}`;\n let body = \"{ \\\"Hallo\\\" : \\\"Wo\\\\\\\"rld\\\" }\";\n let doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 201);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(etag, `\"${rev}\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n cmd = `/_api/document/${did}`;\n doc = arango.GET_RAW(cmd);\n\n assertEqual(doc.code, 200);\n assertEqual(doc.headers['content-type'], contentType);\n assertEqual(doc.parsedBody['Hallo'], 'Wo\"rld');\n\n arango.DELETE_RAW(location);\n\n assertEqual(db[cn].count(), 0);\n },\n\n test_creating_a_new_umlaut_document__waitForSyncEQtrue: function() {\n let cmd = `/_api/document?collection=${cn}`;\n let body = \"{ \\\"Hallo\\\" : \\\"öäüÖÄÜßあ寿司\\\" }\";\n let doc = arango.POST_RAW(cmd, body, {});\n\n assertEqual(doc.code, 201);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(etag, `\"${rev}\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n cmd = `/_api/document/${did}`;\n doc = arango.GET_RAW(cmd);\n\n assertEqual(doc.code, 200);\n assertEqual(doc.headers['content-type'], contentType);\n\n assertEqual(doc.parsedBody['Hallo'], \"öäüÖÄÜßあ寿司\");\n arango.DELETE(location);\n\n assertEqual(db[cn].count(), 0);\n },\n\n test_creating_a_new_umlaut_document__setting_compatibility_header__waitForSyncEQtrue: function() {\n let cmd = `/_api/document?collection=${cn}`;\n let body = \"{ \\\"Hallo\\\" : \\\"öäüÖÄÜßあ寿司\\\" }\";\n let doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 201);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(etag, `\"${rev}\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n cmd = `/_api/document/${did}`;\n doc = arango.GET_RAW(cmd);\n\n assertEqual(doc.code, 200);\n assertEqual(doc.headers['content-type'], contentType);\n\n assertEqual(doc.parsedBody['Hallo'], 'öäüÖÄÜßあ寿司');\n\n arango.DELETE_RAW(location);\n\n assertEqual(db[cn].count(), 0);\n },\n\n test_creating_a_new_not_normalized_umlaut_document__waitForSyncEQtrue: function() {\n let cmd = `/_api/document?collection=${cn}`;\n let body = \"{ \\\"Hallo\\\" : \\\"Grüß Gott.\\\" }\";\n let doc = arango.POST_RAW(cmd, body, {});\n\n assertEqual(doc.code, 201);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(etag, `\"${rev}\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n cmd = `/_api/document/${did}`;\n doc = arango.GET_RAW(cmd);\n\n assertEqual(doc.code, 200);\n assertEqual(doc.headers['content-type'], contentType);\n\n assertEqual(doc.parsedBody['Hallo'], \"Grüß Gott.\");\n\n arango.DELETE_RAW(location);\n\n assertEqual(db[cn].count(), 0);\n },\n\n test_creating_a_new_not_normalized_umlaut_document__setting_compatibility_header__waitForSyncEQtrue: function() {\n let cmd = `/_api/document?collection=${cn}`;\n let body = \"{ \\\"Hallo\\\" : \\\"Grüß Gott.\\\" }\";\n let doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 201);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(etag, `\"${rev}\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n cmd = `/_api/document/${did}`;\n doc = arango.GET_RAW(cmd);\n\n assertEqual(doc.code, 200);\n assertEqual(doc.headers['content-type'], contentType);\n\n //let newBody = doc.body();\n //newBody = newBody.sub!(/^.*\"Hallo\":\"([^\"]*)\".*$/, '\\1');\n\n //assertEqual(newBody, \"Gr\\\\u00FC\\\\u00DF Gott.\");\n\n assertEqual(doc.parsedBody['Hallo'], \"Grüß Gott.\");\n\n arango.DELETE(location);\n\n assertEqual(db[cn].count(), 0);\n },\n\n test_creating_a_document_with_an_existing_id__waitForSyncEQtrue: function() {\n let key = \"a_new_key\";\n\n arango.DELETE(`/_api/document/${cn}/${key}`);\n\n let cmd = `/_api/document?collection=${cn}`;\n let body = { \"some stuff\" : \"goes here\", \"_key\" : key };\n let doc = arango.POST_RAW(cmd, body, {});\n\n assertEqual(doc.code, 201);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n assertEqual(did, `${cn}/${key}`);\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n arango.DELETE(`/_api/document/${cn}/${key}`);\n },\n\n test_creating_a_document_with_an_existing_id__setting_compatibility_header__waitForSyncEQtrue: function() {\n let key = \"a_new_key\";\n\n arango.DELETE(`/_api/document/${cn}/${key}`);\n\n let cmd = `/_api/document?collection=${cn}`;\n let body = { \"some stuff\" : \"goes here\", \"_key\" : key };\n let doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 201);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n assertEqual(did, `${cn}/${key}`);\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], `${cn}`);\n\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n arango.DELETE(`/_api/document/${cn}/${key}`);\n },\n\n test_creating_a_document_with_a_duplicate_existing_id__waitForSyncEQtrue: function() {\n let key = \"a_new_key\";\n\n arango.DELETE(`/_api/document/${cn}/${key}`);\n\n let cmd = `/_api/document?collection=${cn}`;\n let body = { \"some stuff\" : \"goes here\", \"_key\" : key };\n let doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 201);\n\n // send again;\n doc = arango.POST_RAW(cmd, body);\n assertEqual(doc.code, 409); // conflict\n assertTrue(doc.parsedBody['error']);\n assertEqual(doc.parsedBody['code'], 409);\n assertEqual(doc.parsedBody['errorNum'], internal.errors.ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED.code);\n \n arango.DELETE_RAW(`/_api/document/${cn}/${key}`);\n }\n };\n}", "async function dbDo(doFunc) {\n let client;\n let db;\n\n try {\n // Use connect method to connect to the Server\n client = await MongoClient.connect(process.env['MONGO_URI'], {useNewUrlParser: true});\n db = client.db(dbName);\n } catch (err) {\n console.log(err.stack);\n }\n\n if (client) {\n console.log('database client opened')\n try {\n await doFunc(db);\n } catch (err) {\n console.log(err.stack);\n }\n\n client.close();\n }\n else {\n console.log('failed to open database client')\n }\n}", "async function test() {}", "function summary_tests(collection, Model, testing_document) {\n async function initializeInstance() {\n var instance = new Model();\n var promises = [];\n for(let prop in testing_document) {\n if(testing_document.hasOwnProperty(prop)) {\n if(testing_document[prop].generate !== undefined) {\n let foreignInstance = await testing_document[prop].generate();\n promises.push(instance[prop](foreignInstance));\n } else {\n promises.push(instance[prop](testing_document[prop]));\n }\n }\n }\n await Promise.all(promises);\n await instance.save();\n\n return instance;\n }\n\n it('should return a plain object', async function () {\n var instance = await initializeInstance();\n\n return instance.summary().should.eventually.be.an('object');\n });\n\n it('should have an ID field', async function () {\n var instance = await initializeInstance();\n\n var summary = await instance.summary();\n summary.should.have.own.property('id');\n summary.id.should.satisfy(x => x instanceof ObjectID);\n });\n\n it('should have an update timestamp', async function () {\n var instance = await initializeInstance();\n\n var summary = await instance.summary();\n summary.should.have.own.property('updated');\n summary.updated.should.be.a('date');\n });\n\n it('should have a creation timestamp', async function () {\n var instance = await initializeInstance();\n\n var summary = await instance.summary();\n summary.should.have.own.property('created');\n summary.created.should.be.a('date');\n });\n\n for(let prop in testing_document) {\n if(testing_document.hasOwnProperty(prop))\n {\n if(testing_document[prop].generate !== undefined) {\n let desc = Object.getOwnPropertyDescriptor(testing_document[prop], 'name');\n it(`should have a '${prop}' property containing an ObjectID for a(n) ${desc.value}`, async function () {\n var instance = await initializeInstance();\n var foreignInstance = await instance[prop]();\n\n var summary = await instance.summary();\n\n summary.should.have.own.property(prop);\n expect(summary[prop], 'Property value is not an Object ID').to.satisfy(x => monk.id(x) instanceof ObjectID);\n expect(summary[prop], 'Property value is wrong Object ID').to.satisfy(x => monk.id(x).equals(foreignInstance.id()));\n });\n } else {\n it(`should have a '${prop}' property of type ${type(testing_document[prop])}`, async function () {\n var instance = await initializeInstance();\n\n var summary = await instance.summary();\n summary.should.have.own.property(prop);\n summary[prop].should.be.a(type(testing_document[prop]));\n if(type(summary[prop]) === 'Date') {\n summary[prop].should.satisfy(x => x.getTime() === testing_document[prop].getTime())\n } else {\n summary[prop].should.equal(testing_document[prop]);\n }\n });\n }\n }\n }\n}", "async function test2 () \n {\n const book = new Book({\n title:\"test\",\n writingPrompt:\"test\",\n image:\"test\",\n numberOfChapters:\"1\",\n duration:\"1\",\n authorArray:[\"author1\"],\n genre: \"test\"\n })\n \n const book2 = new Book({\n title:\"test\",\n writingPrompt:\"test\",\n image:\"test\",\n numberOfChapters:\"1\",\n duration:\"1\",\n authorArray:[\"author2\"],\n genre: \"test\"\n })\n \n \n \n await Book.create(book);\n\n\n chai.request(server)\n // May have to change name because we haven't named it yet\n .get('/api/book/getByAuthor?authors=' + \"author1\")\n .end((err, res) => {\n //console.log(res.body)\n //console.log(res.status)\n res.should.have.status(200)\n res.body.should.be.a('array')\n res.body.length.should.be.eql(1);\n done()\n })\n }", "function test_setup() {\n (async () => {\n await connection\n .query(\n `\n TRUNCATE polls CASCADE;\n `\n )\n .then(() => {\n console.log(clc.green(\"Deleted\"));\n console.log(clc.blue(\"\\nTesting /save endpoint\"));\n needle(\n \"post\",\n `http://localhost:${process.env.APP_PORT}/save`,\n data,\n {\n json: true,\n }\n )\n .then((res) => {\n console.log(clc.green(`Status: ${res.statusCode}`));\n console.log(clc.blue(\"\\nTesting /recall endpoint\"));\n succesfull += 1;\n\n needle(\n \"get\",\n `http://localhost:${process.env.APP_PORT}/recall/1294898935/my_poll2`,\n data,\n {\n json: true,\n }\n )\n .then((res) => {\n console.log(\n clc.green(`Status: ${res.statusCode}`)\n );\n console.log(\n clc.blue(\"\\nTesting /check endpoint\")\n );\n succesfull += 1;\n\n needle(\n \"get\",\n `http://localhost:${process.env.APP_PORT}/check/1294898935/my_poll2`,\n data,\n {\n json: true,\n }\n )\n .then((res) => {\n succesfull += 1;\n console.log(\n clc.green(\n `Status: ${res.statusCode}`\n )\n );\n console.log(\n clc.green(\n `\\nSuccesfully ran: ${succesfull} out of 3 test cases.`\n )\n );\n return 1;\n })\n .catch((err) => {\n console.error(err);\n console.log(\n clc.green(\n `\\nSuccesfully ran: ${succesfull} out of 3 test cases.`\n )\n );\n console.log(\n clc.red(\n `\\nFailed in: ${\n 3 - succesfull\n } out of 3 test cases.`\n )\n );\n return 0;\n });\n })\n .catch((err) => {\n console.error(err);\n console.log(\n clc.green(\n `\\nSuccesfully ran: ${succesfull} out of 3 test cases.`\n )\n );\n console.log(\n clc.red(\n `\\nFailed in: ${\n 3 - succesfull\n } out of 3 test cases.`\n )\n );\n return 0;\n });\n })\n .catch((err) => {\n console.error(err);\n console.log(\n clc.green(\n `\\nSuccesfully ran: ${succesfull} out of 3 test cases.`\n )\n );\n console.log(\n clc.red(\n `\\nFailed in: ${\n 3 - succesfull\n } out of 3 test cases.`\n )\n );\n return 0;\n });\n });\n })().catch((err) => {\n console.error(err);\n console.log(\n clc.green(`\\nSuccesfully ran: ${succesfull} out of 3 test cases.`)\n );\n console.log(\n clc.red(`\\nFailed in : ${3 - succesfull} out of 3 test cases.`)\n );\n return 0;\n });\n}", "async function findUser(username) {\n //check if the username is in the database\n const check_query = {\n \"username\": username\n };\n const result = await database.collection(\"users\").findOne(check_query); // do I need to await these calls?\n if (result !== null) {\n return true;\n } else {\n return false;\n }\n}", "async runTest() {}", "async function establishConnection() {\n await mongo.connectToMongo()\n .then(()=>{\n console.log(\"boostrap complete\")\n })\n}", "async function main() {\n // const connection = await MongoClient.connect(url);\n const connection = await connectionPromise(url);\n\n const db = connection.db(dbName);\n const exampleCollection = db.collection(\"example\");\n\n // CRUD\n\n // 1. C - Create\n // await exampleCollection.insertOne({\n // name: \"hello\",\n // number: 5,\n // array: [\n // {\n // hello: \"world\",\n // },\n // ],\n // });\n\n // await exampleCollection.insertMany([\n // {\n // name: \"first\",\n // number: 6,\n // },\n // {\n // name: \"second\",\n // number: 7,\n // },\n // ]);\n\n // 2. R - Read\n // console.log(\n // await exampleCollection.findOne({\n // _id: new ObjectID(\"5f81764da878fbe9851a18df\"),\n // })\n // );\n // console.log(\n // await exampleCollection.find({ number: { $gte: 5, $lte: 10 } }).toArray()\n // );\n // console.log(await exampleCollection.find().toArray());\n\n // 3. U - Update\n // await exampleCollection.updateOne(\n // { name: \"first\" },\n // { $set: { number: 11 } }\n // );\n // await exampleCollection.updateOne(\n // { _id: new ObjectID(\"5f8176874e848fe9e79cd52f\") },\n // { $push: { array: { name: \"second array element\" } } }\n // );\n\n // 4. D - Delete\n // await exampleCollection.deleteOne({ name: \"hello\" });\n}", "function get_DB(\n mongoLab_URI//: str\n ,MongoClient//: MongoClient obj <- explicit\n) {// => Promise(db)\n \"use strict\";\n\n var connection = MongoClient.connect(mongoLab_URI);//, function(err, db) {\n\n // Promise <pending> -> thanble\n //return Promise.resolve(connection.then((db) => {return db;}));\n return connection.then((db) => {return db;});\n}", "async function getAllGames()\n{\n\n try\n {\n await client.connect();\n\n const db = client.db(dbname);\n const games = db.collection('games');\n\n const cursor = games.find({});\n console.log(\"async\");\n for await (const doc of cursor)\n {\n console.log(doc);\n }\n await cursor.close();\n } finally\n {\n await client.close();\n }\n}", "runQuestionSetup() \r\n {\r\n return questions().then((questionCollection) => {\r\n return questionCollection.count().then(function (theCount) {\r\n console.log(\"Here in runQuestionSetup...\");\r\n console.log(\"Number of records: \" + theCount);\r\n // the result of find() is a cursor to MongoDB, and we can call toArray() on it\r\n if (theCount > 0) {\r\n console.log(\"Already setup Questions...\");\r\n return questionCollection.find().toArray();\r\n }\r\n\r\n return questionCollection.insertOne({\r\n question_id: Guid.create().toString(),\r\n question: \"Inspite of any difficulties, your passion for learning should not become (less intense).Replace the word in bracket with a word.\" ,\r\n options:[\"amplify\", \"become unfriendly\",\"abate\",\"unite\"],\r\n correctAnswer: \"abate\"\r\n }).then(function (newDoc) {\r\n //console.log(\"The newDoc is : \");\r\n //console.log(newDoc);\r\n return newDoc;\r\n }).then(function () {\r\n return questionCollection.insertOne({\r\n question_id: Guid.create().toString(),\r\n question: \"Like many idealists, he was a severe critic of the faults of his own and other countries, and he added something to the increasing (Chauvinism) in Germany. Replace the word in bracket with a word.\",\r\n options:[\"patriotism\", \"become unfriendly\",\"unbiased\",\"unite\"],\r\n correctAnswer: \"patriotism\"\r\n });\r\n }).then(function () {\r\n return questionCollection.insertOne({\r\n question_id: Guid.create().toString(),\r\n question: \"Grandma likes to (embellish) her knitting by hiding secret messages in the pattern.Replace the word in bracket with a word.\",\r\n options:[\"decorate\",\"become unfriendly\",\"unbiased\",\"degrade\"],\r\n correctAnswer: \"decorate\" \r\n });\r\n }).then(function () {\r\n return questionCollection.insertOne({\r\n question_id: Guid.create().toString(),\r\n question: \"She was (eloquent) of speech and endowed with endurance.Replace the word in bracket with a word.\",\r\n options:[\"affecting\", \"become unfriendly\",\"unbiased\",\"unenthusiastic\"],\r\n correctAnswer: \"affecting\" \r\n });\r\n }).then(function () {\r\n return questionCollection.insertOne({\r\n question_id: Guid.create().toString(),\r\n question: \"Lets keep our comments (germane) to the issue of our campaign.Replace the word in bracket with a word.\",\r\n options:[\"affecting\", \"on topic\",\"unbiased\",\"unsuitable\"],\r\n correctAnswer: \"on topic\" \r\n });\r\n }).then(function () {\r\n console.log(\"Done with all setup questions...\");\r\n return questionCollection.find().toArray();\r\n });\r\n \r\n });\r\n });\r\n }", "function dbConnectAndExecute(callback){\n\tvar mongoConnectionString = process.env.MongodbConnectionString;\n\tvar db = mongoose.connection;\n\t//check if we are already connected to the db\n if(db.readyState == 1){\n callback();\n } else{\n\t\t//we aren't connected to the database\n db.connect(null);\n mongoose.connect(mongoConnectionString);\n \n db.on('connect', function(){\n callback(null);\n });\n db.on('error', function(){\n callback('Could not connect to database');\n });\n \n }\n}", "find(query={}){\n return new Promise((resolve , reject) => { //promise returns two values reject(),resolve()\n try {\n MongoClient.connect(url,{ useUnifiedTopology: true },function(err,db){ //// return value for err and data\n if (err) throw err; //if db not connected\n \n let dbo=db.db(\"mydb\");\n dbo.collection(\"users\").find(query).toArray(function(err,result){\n if(err) reject(err); //data not exists\n else{\n resolve(result); //data exists\n }\n db.close();\n \n });\n });\n\n }\n catch(e){\n console.log(e);\n \n }\n });\n\n}", "function confirmReminder(user, reminderDocID){\r\n return new Promise((resolve, reject) => {\r\n console.log();\r\n console.log(`Confirming reminder ${reminderDocID} for user ${user}`);\r\n const MongoClient = require(\"mongodb\").MongoClient;\r\n const ObjectId = require('mongodb').ObjectID;\r\n const url = mongoURL;\r\n\r\n\r\n const today = new Date();\r\n const todaysYear = today.getFullYear();\r\n const todaysMonth = today.getMonth()+1;\r\n const todaysDate = today.getDate();\r\n const todaysDateStr = `${todaysYear}-${todaysMonth}-${todaysDate}`;\r\n\r\n const myQuery = {\"_id\": new ObjectId(reminderDocID)};\r\n MongoClient.connect(url, function(err, db) {\r\n if (err) throw err;\r\n const dbo = db.db(dbName);\r\n\r\n dbo.collection(user).findOne(myQuery, function(err, res) {\r\n if (err) throw err;\r\n if (res) {\r\n console.log(\"Here\");\r\n dbo.collection(user).updateOne(myQuery, {$set: {\"reminderConfirmed\": todaysDateStr, \"snoozedToTime\": null}}, function(err, res) {\r\n if (err) {\r\n throw err;\r\n db.close();\r\n }\r\n if (res) {\r\n console.log(`Reminder was confirmed`);\r\n db.close();\r\n resolve(true);\r\n }\r\n\r\n });\r\n } else {\r\n // No document with reminderNumber found\r\n console.log(\"Reminder not found\");\r\n db.close();\r\n resolve(false);\r\n }\r\n });\r\n });\r\n });\r\n}", "function MongoDBOperation(f) {\n MongoClient.connect(url, { useNewUrlParser: true }, function (err, db) {\n assert.equal(null, err);\n console.log(\"Connected successfully to server\");\n database = db.db('mydb');\n f(database);\n db.close();\n });\n}", "function known_collection_identifier__waitForSync_EQ_falseSuite () {\n let cn = \"UnitTestsCollectionUnsynced\";\n return {\n setUp: function() {\n let cid = db._create(cn);\n },\n\n tearDown: function() {\n db._drop(cn);\n },\n\n test_creating_a_new_document__waitForsync_EQ_False: function() {\n let cmd = `/_api/document?collection=${cn}`;\n let body = { \"Hallo\" : \"World\" };\n let doc = arango.POST_RAW(cmd, body, {});\n\n assertEqual(doc.code, 202);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(etag, `\"${rev}\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n arango.DELETE_RAW(location);\n\n assertEqual(db[cn].count(), 0);\n },\n\n test_creating_a_new_document__setting_compatibility_header__waitForsync_EQ_False: function() {\n let cmd = `/_api/document?collection=${cn}`;\n let body = { \"Hallo\" : \"World\" };\n let doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 202);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(etag, `\"${rev}\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n arango.DELETE(location);\n\n assertEqual(db[cn].count(), 0);\n },\n\n test_creating_a_new_document__waitForSync_URL_param_EQ_false: function() {\n let cmd = `/_api/document?collection=${cn}&waitForSync=false`;\n let body = \"{ \\\"Hallo\\\" : \\\"World\\\" }\";\n let doc = arango.POST_RAW(cmd, body, {});\n\n assertEqual(doc.code, 202);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(etag, `\"${rev}\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n arango.DELETE(location);\n\n assertEqual(db[cn].count(), 0);\n },\n\n test_creating_a_new_document__waitForSync_URL_param_EQ_false__setting_compatibility_header: function() {\n let cmd = `/_api/document?collection=${cn}&waitForSync=false`;\n let body = { \"Hallo\" : \"World\" };\n let doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 202);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(etag, `\"${rev}\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n arango.DELETE(location);\n\n assertEqual(db[cn].count(), 0);\n },\n\n test_creating_a_new_document__waitForSync_URL_param_EQ_true: function() {\n let cmd = `/_api/document?collection=${cn}&waitForSync=true`;\n let body = \"{ \\\"Hallo\\\" : \\\"World\\\" }\";\n let doc = arango.POST_RAW(cmd, body, {});\n\n assertEqual(doc.code, 201);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(etag, `\"${rev}\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n arango.DELETE(location);\n\n assertEqual(db[cn].count(), 0);\n },\n\n test_creating_a_new_document__waitForSync_URL_param_EQ_true__setting_compatibility_header: function() {\n let cmd = `/_api/document?collection=${cn}&waitForSync=true`;\n let body = \"{ \\\"Hallo\\\" : \\\"World\\\" }\";\n let doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 201);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(etag, `\"${rev}\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n arango.DELETE(location);\n\n assertEqual(db[cn].count(), 0);\n },\n\n test_creating_a_new_document_with_duplicate_attribute_names: function() {\n let cmd = `/_api/document?collection=${cn}`;\n let body = \"{ \\\"a\\\" : 1, \\\"a\\\": 2 }\";\n let doc = arango.POST_RAW(cmd, body, {});\n\n assertEqual(doc.code, internal.errors.ERROR_HTTP_BAD_PARAMETER.code);\n assertTrue(doc.parsedBody['error']);\n assertEqual(doc.parsedBody['errorNum'], internal.errors.ERROR_HTTP_CORRUPTED_JSON.code);\n assertEqual(doc.parsedBody['code'], internal.errors.ERROR_HTTP_BAD_PARAMETER.code);\n assertEqual(doc.headers['content-type'], contentType);\n },\n\n test_creating_a_new_document_with_duplicate_attribute_names_in_nested_object: function() {\n let cmd = `/_api/document?collection=${cn}`;\n let body = \"{ \\\"outer\\\" : { \\\"a\\\" : 1, \\\"a\\\": 2 } }\";\n let doc = arango.POST_RAW(cmd, body, {});\n\n assertEqual(doc.code, internal.errors.ERROR_HTTP_BAD_PARAMETER.code);\n assertTrue(doc.parsedBody['error']);\n assertEqual(doc.parsedBody['errorNum'], internal.errors.ERROR_HTTP_CORRUPTED_JSON.code);\n assertEqual(doc.parsedBody['code'], internal.errors.ERROR_HTTP_BAD_PARAMETER.code);\n assertEqual(doc.headers['content-type'], contentType);\n },\n };\n}", "function task1() {\nif (dbEnv === 'localserver') {\n\t// statement(s) will execute if the boolean expression is true\n\tconst mongoUrl = process.env.MONGODB_URI_LOCAL;\n\tconst mongo = mongoose.connect(mongoUrl, {useNewUrlParser: true });\nmongo.then(() => {\nconsole.log('MongoDB connected to MongoDB localhost');\n}).catch((err) => {\nconsole.log('err', err);\n});\n\tconsole.log(`Developer's database connection choice is:${dbEnv}`);\n} else {\n\t// statement(s) will execute if the boolean expression is false\n\tconst mongoUrl = process.env.MONGODB_URI;\n\tconst mongo = mongoose.connect(mongoUrl, {useNewUrlParser: true });\nmongo.then(() => {\nconsole.log('MongoDB connected to MongoDB remote server');\n}).catch((err) => {\nconsole.log('err', err);\n});\n\tconsole.log(`Developer's database connection choice is:${dbEnv}`);\n}\n// help to debug Mongoose\n\tmongoose.set(\"debug\", true); mongoose;\n}", "async function main(){\n try{\n\n\tlet ourDB = await dbManager.get(); //after this line we are connected. Notice that the async connect function can be awaited\n\t//if we put the call in another async function\n }catch(err){\n console.log(err.message)\n }\n \n}", "async function testDatabase () {\n let service = app.service('test')\n await service.create([\n { 'title': 'asdf' },\n { 'title': 'qwerty' },\n { 'title': 'zxcvb' },\n { 'title': 'hello world' },\n { 'title': 'world around' },\n { 'title': 'cats are awesome' },\n ])\n\n let res = await service.find({ query: { $search: 'world' } })\n\n console.log(res)\n // [ { title: 'world around', _id: '1RDM5BJWX4DWr1Jg' },\n // { title: 'hello world', _id: 'dX4bpdM1IsAFkAZd' } ]\n}", "async function addUser(uname, pword)\n{\n const newUser = {\n username: uname,\n password: pword\n };\n\n try\n {\n await client.connect();\n\n const db = client.db(dbname);\n const users = db.collection('users');\n await users.insertOne(newUser, function (err, result)\n {\n\n console.log(result)\n });\n } finally\n {\n await client.close();\n }\n\n}", "static async connect() {\n try { \n let status = await mongoose.connect(connectionString) // try to connect to db with a mongoose method called connect(). We use mongoose for db connection\n // once connection is done, log this info \n console.log(\"CONNECTED TO DB\")\n return status\n } catch (error) {\n console.log(error)\n }\n }", "function getData(callback){//make this a promise?\n db.collection(\"haikus\", function(err, collection){\n collection.find().toArray(function(err, items){\n if(err){\n console.log(err);\n }\n callback(items);\n });\n });\n }", "async function initialPopulateDb(dbo) {\n\n await dbo.listCollections().toArray(async function (err, collections) {\n //Create and populate shop.products\n console.log(collections);\n if (collections.some(x => x.name === 'products')) {\n await dbo.collection(\"products\").drop();\n console.log(\"products dropped\");\n }\n await dbo.createCollection(\"products\", async function (err) {\n if (err) console.log(\"PRODUCTS COLLECTION CREATION FAILED\" + err);\n else {\n try {\n await dbo.collection('products').insertMany(productsData.products);\n console.log(\"Collection products populated \");\n }\n catch (err) { console.log(\"Products population error \" + err); }\n\n try {\n await dbo.collection(\"products\").createIndex(productsData.indexes);\n console.log(\"Index for products created \");\n }\n catch (err) { console.log(\"Products index error: \" + err); }\n\n\n }\n\n });\n //Create and populate shop.categories\n if (collections.some(x => x.name === 'categories')) {\n await dbo.collection(\"categories\").drop();\n console.log(\"categories dropped\");\n }\n await dbo.createCollection(\"categories\", async function (err) {\n if (err) console.log(\"PRODUCTS COLLECTION CREATION FAILED\" + err);\n else {\n try {\n await dbo.collection('categories').insertMany(categoriesData.categories);\n console.log(\"Collection categories populated \");\n }\n catch (err) { console.log(\"Categories population error \" + err); }\n\n try {\n await dbo.collection(\"categories\").createIndex(categoriesData.indexes);\n console.log(\"Index for categories created \");\n }\n catch (err) { console.log(\"Categories index error: \" + err); }\n\n\n }\n\n });\n });\n\n\n\n //Create shop.orders\n\n}", "async function runOrder() {\n fillArrays();\n cleanseDetails();\n meetingObjects();\n api();\n jsonNotation();\n addToMongo();\n}", "async function dbOps() {\n let testing = false;\n\n //If in dev, set fake Ip and testing status to true\n if (process.env.NODE_ENV === \"development\") {\n testing = true;\n }\n\n MongoClient.connect(\n process.env.DB,\n { useNewUrlParser: true },\n async function(err, client) {\n //Error\n if (err) {\n next(err);\n }\n //Connection\n else {\n const db = client.db(\"trivia-actually\"); // Database\n const scoreCollection = db.collection(\"scores\"); // Scores collection\n const ipCollection = db.collection(\"ips\"); // IPs collection\n\n //Get score stats\n const scoreData = await statsHandler.getScores(testing, scoreCollection).catch(err => {\n next(err);\n });\n\n //Get ip Stats\n const ipData = await statsHandler.getIps(testing, ipCollection).catch(err => {\n next(err);\n });\n\n //Get unique locations\n const locations = await statsHandler.reduceLocations(ipData.locations).catch(err => {\n next(err);\n });\n\n //JSON request for testing\n if (req.body.format === \"json\") {\n try {\n res.json({\n triviaData: {\n easyCount: easyTrivia.length,\n medCount: medTrivia.length,\n hardCount: hardTrivia.length,\n totalTriviaCount: triviaData.length\n },\n scoreStats: scoreData,\n ipStats: { ipCount: ipData.ipCount, locations: locations }\n });\n } catch (err) {\n next(err);\n }\n } // end of if format json\n //Otherwise render Jade page\n else {\n try {\n res.render(\"admin_stats\", {\n totalCount: scoreData.totalCount,\n ipCount: ipData.ipCount,\n average: scoreData.average,\n median: scoreData.median,\n zeroCount: scoreData.zeroCount,\n tenCount: scoreData.tenCount,\n twentyCount: scoreData.twentyCount,\n thirtyCount: scoreData.thirtyCount,\n fortyCount: scoreData.fortyCount,\n fiftyCount: scoreData.fiftyCount,\n sixtyCount: scoreData.sixtyCount,\n seventyCount: scoreData.seventyCount,\n eightyCount: scoreData.eightyCount,\n ninetyCount: scoreData.ninetyCount,\n hundredCount: scoreData.hundredCount,\n easyCount: easyTrivia.length,\n medCount: medTrivia.length,\n hardCount: hardTrivia.length,\n totalTriviaCount: triviaData.length,\n locations: locations\n });\n } catch (err) {\n next(err);\n }\n } // end of else render Jade\n\n client.close();\n } // end of else for successful connection\n } // end of connection function\n ); // end of MongoClient.connect\n }", "async function example4() {\n try {\n const result = await userCollection.find({department: 'c'});\n await result.forEach(doc => console.log(doc));\n } catch (err) {\n console.error(err);\n }\n}", "async function seedDB() {\n try {\n console.log(keys.mongoURI);\n mongoose.connect(keys.mongoURI, {\n useNewUrlParser: true,\n useUnifiedTopology: false,\n });\n mongoose.set('maxTimeMS', 1000 * 60 * 5);\n var test = await db.Library.find({}, null, {limit:1});\n console.log('test', test);\n\n let scriptProgress;\n\n if (fs.existsSync(PROGRESS_FILE_NAME)) {\n console.log('found seed status file, picking up where we left off...');\n scriptProgress = JSON.parse(fs.readFileSync(PROGRESS_FILE_NAME));\n } else {\n scriptProgress = {\n droppedDatabase: 0,\n users: 0,\n artists: 0,\n albums: 0,\n tracks: 0,\n resources: 0,\n showHosts: 0,\n shows: 0,\n traffic: 0,\n playlists: 0,\n popularityCalculation: 0,\n };\n }\n\n if (!scriptProgress.droppedDatabase) {\n console.log('dropping database...');\n await mongoose.connection.dropDatabase();\n\n scriptProgress.droppedDatabase = 1;\n updateProgressFile(scriptProgress);\n }\n\n // Resources\n if (!scriptProgress.resources) {\n console.log('seeding resources...');\n await Promise.all(\n seed.resources.map(\n async resource => await db.Resource.create(resource),\n ),\n );\n scriptProgress.resources = 1;\n updateProgressFile(scriptProgress);\n }\n\n // Users\n if (!scriptProgress.users) {\n console.log('seeding users...');\n await Promise.all(\n seed.users.map(async user => await db.User.create(user)),\n );\n scriptProgress.users = 1;\n updateProgressFile(scriptProgress);\n }\n\n // Artists\n let allArtists = {};\n let allArtistNamesById = {};\n if (!scriptProgress.artists) {\n console.log('seeding artists...');\n let bulkOperations = [];\n seed.artists.forEach(function(artist) {\n if (!(artist.toLowerCase() in allArtists) && artist.length > 0) {\n // we will use the allArtists object to de-duplicate any artist data that is duplicated due to case-sensitivity\n allArtists[artist.toLowerCase()] = 0;\n bulkOperations.push({\n insertOne: {\n document: {\n name: artist,\n type: 'artist',\n search_index: artist,\n },\n },\n });\n } else {\n console.log(\n 'Skipping ' +\n artist +\n ', found a duplicate using case-insensitive matching',\n );\n }\n });\n await db.Library.bulkWrite(bulkOperations);\n scriptProgress.artists = 1;\n updateProgressFile(scriptProgress);\n }\n\n //remember the indexes of artists for later use\n if (\n scriptProgress.albums < seed.albums.length ||\n scriptProgress.tracks < seed.tracks.length\n ) {\n console.log('getting created artist ids...');\n let allArtistsQuery = await db.Library.find(\n { type: 'artist' },\n '_id name',\n {\n sort: 'name',\n },\n );\n allArtistsQuery.forEach(function(a) {\n allArtists[a.name.toLowerCase()] = a._id;\n allArtistNamesById[a._id] = a.name;\n });\n }\n\n // Albums\n console.log('getting existing genres...');\n let existingGenres = await db.Genre.find();\n existingGenres.forEach(function(genre) {\n allGenres[genre.name] = genre._id;\n });\n\n if (scriptProgress.albums < seed.albums.length) {\n console.log('seeding albums...');\n if (scriptProgress.albums > 0) {\n //pick up where we left off going through the albums array\n seed.albums.splice(0, scriptProgress.albums);\n }\n // process the albums in groups so that we're giving regular feedback on the status\n let batchSize = 10000;\n while (seed.albums.length > 0) {\n let bulkOperations = [];\n let albumsToCreate = seed.albums.splice(0, batchSize);\n for (let index = 0; index < albumsToCreate.length; index++) {\n let album = albumsToCreate[index];\n album.type = 'album';\n album.search_index = album.name;\n if (album.artist != null) {\n album.search_index += ' ' + album.artist.toLowerCase();\n album.artist = allArtists[album.artist.toLowerCase()];\n }\n if (album.genre != null) {\n album.genre = await getIdForGenre(album.genre);\n }\n\n //cleanse data that was entered incorrectly in KGNU, and preserve empty dates for created_at\n if (album.created_at === '0000-00-00 00:00:00') {\n album.created_at = null;\n }\n if (album.compilation > 1) {\n album.compilation = 1;\n }\n if (!album.custom) {\n album.custom = {};\n }\n if (album.custom.library_number && Number(album.custom.library_number) < 1000000000) {\n album.custom.in_kgnu_library = true;\n }\n\n bulkOperations.push({\n insertOne: {\n document: album,\n },\n });\n }\n console.log('bulk writing ' + bulkOperations.length + ' albums...');\n await db.Library.bulkWrite(bulkOperations);\n scriptProgress.albums += albumsToCreate.length;\n updateProgressFile(scriptProgress);\n }\n }\n\n //remember the old comrad id's of albums for later use\n let allAlbums = {};\n let allAlbumArtists = {};\n let allAlbumNamesById = {};\n if (scriptProgress.tracks < seed.tracks.length) {\n console.log('getting created album ids...');\n let allAlbumsQuery = await db.Library.find(\n { type: 'album' },\n '_id artist custom.old_comrad_id name',\n );\n allAlbumsQuery.forEach(function(a) {\n if (\n typeof a.custom !== 'undefined' &&\n typeof a.custom.old_comrad_id !== 'undefined'\n ) {\n allAlbums[a.custom.old_comrad_id] = a._id;\n allAlbumArtists[a.custom.old_comrad_id] = a.artist;\n allAlbumNamesById[a._id] = a.name;\n }\n });\n }\n\n // Tracks\n if (scriptProgress.tracks < seed.tracks.length) {\n console.log('seeding tracks...');\n if (scriptProgress.tracks > 0) {\n //pick up where we left off going through the albums array\n seed.tracks.splice(0, scriptProgress.tracks);\n }\n // process the albums in groups so that we're giving regular feedback on the status\n while (seed.tracks.length > 0) {\n let bulkOperations = [];\n let tracksToCreate = seed.tracks.splice(0, 5000);\n for (let index = 0; index < tracksToCreate.length; index++) {\n let track = tracksToCreate[index];\n\n if (track.name.length === 0) {\n continue;\n }\n\n track.type = 'track';\n track.search_index = track.name;\n if (track.artist === null || track.artist.length === 0) {\n // use the artist from the album\n track.artists = [allAlbumArtists[track.album]];\n } else {\n if (!(track.artist.toLowerCase() in allArtists)) {\n console.log('Creating missing artist: ' + track.artist);\n let newArtist = await db.Library.create({\n name: track.artist,\n type: 'artist',\n });\n allArtists[track.artist.toLowerCase()] = newArtist._id;\n }\n track.artists = [allArtists[track.artist.toLowerCase()]];\n }\n track.search_index += ' ' + allArtistNamesById[track.artists[0]];\n delete track.artist;\n if (track.album.length > 0) {\n track.album = allAlbums[track.album];\n track.search_index += ' ' + allAlbumNamesById[track.album];\n } else {\n console.warning('Album empty for track: ' + track.name);\n continue;\n }\n\n bulkOperations.push({\n insertOne: {\n document: track,\n },\n });\n }\n console.log('writing ' + bulkOperations.length + ' tracks...');\n await db.Library.bulkWrite(bulkOperations);\n scriptProgress.tracks += tracksToCreate.length;\n updateProgressFile(scriptProgress);\n }\n }\n\n //free up memory used in the music library import process\n allArtists = {};\n allArtistNamesById = {};\n allAlbums = {};\n allAlbumNamesById = {};\n allAlbumArtists = {};\n\n // Shows\n if (!scriptProgress.showHosts) {\n console.log('seeding hosts for shows...');\n let hostsToAdd = [];\n seed.show.forEach(show => {\n if (\n show.show_details.host != null &&\n hostsToAdd.indexOf(show.show_details.host) === -1\n ) {\n hostsToAdd.push(show.show_details.host);\n }\n if (show.instances.length > 0) {\n show.instances.forEach(instance => {\n if (\n instance.show_details != null &&\n instance.show_details.host != null &&\n hostsToAdd.indexOf(instance.show_details.host) === -1\n ) {\n hostsToAdd.push(instance.show_details.host);\n }\n });\n }\n });\n for (let i = 0; i < hostsToAdd.length; i++) {\n await userByOnAirName(hostsToAdd[i]);\n }\n scriptProgress.showHosts = 1;\n updateProgressFile(scriptProgress);\n }\n\n if (!scriptProgress.shows) {\n console.log('seeding shows...');\n let bulkOperations = [];\n //it's important for this to be synchronous so that we run through host names one-by-one so we don't trigger multiple insert operations for the same host\n for (let sIdx = 0; sIdx < seed.show.length; sIdx++) {\n let show = seed.show[sIdx];\n if (show.show_details.host != null) {\n show.show_details.host = await userByOnAirName(\n show.show_details.host,\n );\n show.show_details.host = show.show_details.host._id;\n }\n let showInstances = [];\n if (show.instances) {\n showInstances = show.instances;\n delete show.instances;\n }\n let excludeDates = [];\n if (show.exclude_dates) {\n excludeDates = show.exclude_dates;\n delete show.exclude_dates;\n }\n\n //If the end date does not exist, just put an infinite end date\n if (show.repeat_rule) {\n if (!show.repeat_rule.repeat_end_date) {\n show.repeat_rule.repeat_end_date = new Date('9999-01-01T00:00:00');\n }\n }\n\n const newShow = await db.Show.create(show);\n if (showInstances.length > 0) {\n //it's important for this to be synchronous so that we run through host names one-by-one so we don't trigger multiple insert operations for the same host\n for (let siIdx = 0; siIdx < showInstances.length; siIdx++) {\n let instance = showInstances[siIdx];\n instance.master_event_id = newShow;\n if (\n instance.show_details != null &&\n instance.show_details.host != null\n ) {\n instance.show_details.host = await userByOnAirName(\n instance.show_details.host,\n );\n instance.show_details.host = instance.show_details.host._id;\n }\n\n //This assume that all instances are a single day so the start and end date are the same\n if (instance.repeat_rule) {\n if (!instance.repeat_rule.repeat_end_date) {\n instance.repeat_rule.repeat_end_date =\n instance.repeat_rule.repeat_start_date;\n }\n }\n\n bulkOperations.push({\n insertOne: {\n document: instance,\n },\n });\n }\n }\n if (excludeDates.length > 0) {\n for (let edIdx = 0; edIdx < excludeDates.length; edIdx++) {\n let excludeDate = excludeDates[edIdx];\n let showLength = moment.duration(\n moment(show.end_time_utc).diff(moment(show.start_time_utc)),\n );\n let excludeEndTime = moment(excludeDate).add(\n showLength.asMinutes(),\n 'minutes',\n );\n let deletedInstance = {\n master_event_id: newShow,\n status: 'deleted',\n start_time_utc: excludeDate,\n end_time_utc: excludeEndTime,\n repeat_rule: {\n repeat_start_date: excludeDate,\n repeat_end_date: excludeEndTime,\n },\n replace_event_date: excludeDate,\n is_recurring: false,\n created_at: Date.now(),\n updated_at: Date.now(),\n };\n\n bulkOperations.push({\n insertOne: {\n document: deletedInstance,\n },\n });\n }\n }\n }\n console.log('seeding ' + bulkOperations.length + ' show instances...');\n if (bulkOperations.length > 0) {\n await db.Show.bulkWrite(bulkOperations);\n }\n scriptProgress.shows = 1;\n updateProgressFile(scriptProgress);\n }\n\n // Traffic\n if (!scriptProgress.traffic) {\n console.log('seeding traffic...');\n let bulkOperations = [];\n await Promise.all(\n seed.traffic.map(async traffic => {\n let trafficInstances = [];\n if (traffic.instances) {\n trafficInstances = traffic.instances;\n delete traffic.instances;\n }\n let excludeDates = [];\n if (traffic.exclude_dates) {\n excludeDates = traffic.exclude_dates;\n delete traffic.exclude_dates;\n }\n\n //If the end date does not exist, just put an infinite end date\n if (traffic.repeat_rule) {\n if (!traffic.repeat_rule.repeat_end_date) {\n traffic.repeat_rule.repeat_end_date = new Date(\n '9999-01-01T00:00:00',\n );\n }\n }\n\n const newTraffic = await db.Traffic.create(traffic);\n if (trafficInstances.length > 0) {\n await Promise.all(\n trafficInstances.map(async instance => {\n instance.master_event_id = newTraffic;\n\n //This assume that all instances are a single day so the start and end date are the same\n if (instance.repeat_rule) {\n if (!instance.repeat_rule.repeat_end_date) {\n instance.repeat_rule.repeat_end_date =\n instance.repeat_rule.repeat_start_date;\n }\n }\n\n bulkOperations.push({\n insertOne: {\n document: instance,\n },\n });\n }),\n );\n }\n if (excludeDates.length > 0) {\n for (let edIdx = 0; edIdx < excludeDates.length; edIdx++) {\n let excludeDate = excludeDates[edIdx];\n let trafficLength = moment.duration(\n moment(traffic.end_time_utc).diff(\n moment(traffic.start_time_utc),\n ),\n );\n let excludeEndTime = moment(excludeDate).add(\n trafficLength.asMinutes(),\n 'minutes',\n );\n let deletedInstance = {\n master_event_id: newTraffic,\n status: 'deleted',\n start_time_utc: excludeDate,\n end_time_utc: excludeEndTime,\n repeat_rule: {\n repeat_start_date: excludeDate,\n repeat_end_date: excludeEndTime,\n },\n replace_event_date: excludeDate,\n is_recurring: false,\n created_at: Date.now(),\n updated_at: Date.now(),\n };\n\n bulkOperations.push({\n insertOne: {\n document: deletedInstance,\n },\n });\n }\n }\n }),\n );\n console.log('seeding ' + bulkOperations.length + ' traffic instances...');\n if (bulkOperations.length > 0) {\n await db.Traffic.bulkWrite(bulkOperations);\n }\n scriptProgress.traffic = 1;\n updateProgressFile(scriptProgress);\n }\n\n if (scriptProgress.playlists < seed.playlists.length) {\n console.log('seeding playlists (' + seed.playlists.length + ' total)...');\n if (scriptProgress.playlists > 0) {\n //pick up where we left off going through the albums array\n seed.playlists.splice(0, scriptProgress.playlists);\n }\n\n while (seed.playlists.length > 0) {\n let bulkOperations = [];\n let playlistsToCreate = seed.playlists.splice(0, 1000);\n\n console.log('processing ' + playlistsToCreate.length + ' playlists');\n\n //first, find all associated track & traffic records in a bulk query\n await findRelatedTracksAndTraffic(playlistsToCreate, 'scratchpad');\n await findRelatedTracksAndTraffic(playlistsToCreate, 'saved_items');\n\n //next, create the documents for inserting to the database\n for (let index = 0; index < playlistsToCreate.length; index++) {\n let playlist = playlistsToCreate[index];\n let arraysToProcess = ['scratchpad', 'saved_items'];\n for (let j = 0; j < arraysToProcess.length; j++) {\n let a = arraysToProcess[j];\n for (let i = 0; i < playlist[a].length; i++) {\n let playlistItem = playlist[a][i];\n switch (playlistItem.type) {\n case 'track':\n playlistItem.track =\n tracksForPlaylists[playlistItem.original_track_id];\n delete playlistItem.original_track_id;\n break;\n case 'traffic':\n playlistItem.traffic = findTrafficEvent(\n playlistItem.traffic_instance,\n playlistItem.traffic_scheduled_event,\n playlistItem.traffic_event,\n );\n playlistItem.master_time_id =\n playlistItem.traffic +\n '-' +\n moment(playlistItem.traffic_start_date_time);\n //remove properties not in schema\n delete playlistItem.traffic_instance;\n delete playlistItem.traffic_scheduled_event;\n delete playlistItem.traffic_event;\n break;\n case 'voice_break':\n case 'comment':\n //do nothing\n break;\n default:\n console.log(playlistItem.type + ' needs to be accounted for');\n console.log(playlistItem);\n }\n playlist[a][i] = playlistItem;\n }\n }\n\n bulkOperations.push({\n insertOne: {\n document: playlist,\n },\n });\n }\n console.log(\n 'bulk writing ' + bulkOperations.length + ' playlists to DB...',\n );\n await db.Playlist.bulkWrite(bulkOperations);\n scriptProgress.playlists += playlistsToCreate.length;\n updateProgressFile(scriptProgress);\n }\n }\n\n if (!scriptProgress.popularityCalcuation) {\n await libraryController.calculatePopularity();\n\n scriptProgress.popularityCalculation = 1;\n updateProgressFile(scriptProgress);\n }\n } catch (err) {\n console.log(err);\n throw err;\n }\n}", "async function dbFuc(db) {\n let docs = [{}, {}, {}];;\n let promises = docs.map(doc => db.post(db));\n let results = [];\n for(let promise of promises) {\n results.push(promise);\n }\n console.log(results);\n}", "async function example4() {\n try {\n const res = await userCollection.find({ department: 'c' }).toArray()\n console.log(res)\n } catch (err) {\n console.error(err)\n }\n}", "async function crearPasajeroDaoDb(cnxString, dbName, collectionName) {\n\n const client = new MongoClient(cnxString, {\n useNewUrlParser: true,\n useUnifiedTopology: true\n })\n\n //Se conecta a la base de datos que es mongod.exe\n try {\n log('conectandose a mongoDB')\n await client.connect()\n log('conectado!')\n } catch (error) {\n throw crearErrorDeBaseDeDatos(error.message)\n\n }\n\n //Equivalente a usar db.use dbName\n const db = client.db(dbName)\n\n //Equivalente a usar db.collection collectionName\n const collection = db.collection(collectionName)\n\n return {\n add: async (element) => {\n await collection.insertOne(element)\n delete element._id\n },\n deleteById: async (unId) => {\n const { deletedCount } = await collection.deleteOne({ id: unId })\n if (!deletedCount) {\n throw crearErrorRecursoNoEncontrado(' reserva', unId)\n }\n },\n getAll: async () => {\n const registrosEnColeccion = await collection.find({}).toArray()\n //cada elemento de la coleccion lo \"modifica\" y lo devuelve como otro array\n //esto crear reservas nuevas con todos los objetos/registros que tiene la collection\n const reservas = registrosEnColeccion.map(reg => crearPasajero(reg))\n return reservas\n },\n getById: async (unId) => {\n const registrosEnColeccion = await collection.findOne({ id: unId }).toArray()\n const reservas = registrosEnColeccion.map(reg => crearPasajero(reg))\n return reservas\n },\n close: async () => {\n log('cerrando conexion a db')\n await client.close()\n log('conexion cerrada')\n },\n\n }\n\n\n}", "function setUpMongo() {\n const db = process.env.MONGODB_URI || 'mongodb://localhost/meetupdb';\n mongoose.connect(db, { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true });\n const mongodb = mongoose.connection;\n\n mongodb.on('error', console.error.bind(console, 'connection error:'));\n mongodb.once('open', () => console.log('Database connected successfully!'));\n return mongodb;\n}", "async function exeDBCommand (dbCommand, qryObj, dbConnection, dbSession)\n{\n // Local Variable Declaration \n let dbResponse = \"null\"; \n \n // Check to see the DB request being made is defined in the db method map\n if (dbMethodMap.has(dbCommand))\n {\n try \n { \n // Execute the database query \n dbResponse = await dbMethodMap.get(dbCommand)(qryObj, dbConnection, \n dbSession);\n \n // Searilize the response object\n dbResponse = JSON.stringify(dbResponse); \n }\n catch (error)\n {\n /* Formulate the error message based the name of the error passed.\n * If the error passed has the same name as used in the DB interface \n * module then create a stack trace that is based off of the current \n * location the error was caught which is right here. Otherwise if \n * the name of the error caught doesn't match the name used for \n * errors thrown by the db interface then use the stack trace and \n * message stored in the error caught. */\n let eMessage = (mongoInterface.ERR_NME === error.name) ? \n (new Error().stack + \"\\n\" + error.message):\n (error.stack + \"\\n\" + error.message); \n \n \n /* Create a local error with the message that contains the message \n * previously formulated */\n let __error = new Error(eMessage);\n \n // Change the name of the error \n __error.name = DB_EXE_ERR; \n \n // Print any errors to the console for debugging purposes\n console.log(\"Object serialization error: \" + __error);\n \n // Throw the newly formulated error\n throw __error;\n }\n }\n else \n {\n // A bad request was made send an error message back to the client\n throw new Error( new Error().stack + \"\\nInvalid Database Command: \" + \n dbCommand + \" is undefined.\");\n }\n \n return dbResponse;\n}", "async function getResource(resource, res) {\n await MongoClient.connect(url, (err, client) => {\n db = client.db('dev-challenge');\n })\n try {\n const results = await dbQuery(resource);\n console.log(results);\n res.json(results);\n } catch (error) {\n console.log(error);\n }\n console.log(\"Done!\");\n}", "function testPostUpdateState (cb) {\n d.find({}, function (err, docs) {\n var doc1 = _.find(docs, function (d) { return d._id === id1; })\n , doc2 = _.find(docs, function (d) { return d._id === id2; })\n , doc3 = _.find(docs, function (d) { return d._id === id3; })\n ;\n\n docs.length.should.equal(3);\n\n Object.keys(doc1).length.should.equal(2);\n doc1.somedata.should.equal('ok');\n doc1._id.should.equal(id1);\n\n Object.keys(doc2).length.should.equal(2);\n doc2.newDoc.should.equal('yes');\n doc2._id.should.equal(id2);\n\n Object.keys(doc3).length.should.equal(2);\n doc3.newDoc.should.equal('yes');\n doc3._id.should.equal(id3);\n\n return cb();\n });\n }", "async init() {\n //TODO\n client = await mongo.connect(this.dbUrl);\n db = client.db(dbName);\n }", "async initMongo() {\n return new Promise(async (resolve, reject) => {\n try {\n HealthManager.addHealthCheckHook(this.mongoHealthHook.bind(this), 'mongo');\n Logger.trace('Server : initMongo');\n this.app.locals.db = await mongoose.createConnection(Config.env.MONGO_URI, {promiseLibrary: global.Promise});\n this.app.locals.models = {\n Voter: require('../db/models/Voter'),\n };\n resolve();\n } catch(err) {\n reject(err);\n }\n });\n }", "async function dbQuery(resource) {\n const db = await MongoClient.connect(url);\n const dbo = db.db(\"dev-challenge\");\n const result = await dbo.collection(resource).find().toArray()\n return result;\n}", "function getAdvs(done){\n(async function mongo(){\nlet client;\ntry {\n client = await MongoClient.connect(dbUrl, {useNewUrlParser: true});\n const db = client.db(dbName);\n let data = await db.collection('advs').find().toArray();\n for (let i = 0; i < data.length; i++) {\n console.log( data[i].category);\n let category = await db.collection('categories').findOne({_id: new ObjectID(data[i].category)});\n console.log( category);\n data[i].category = category.title;\n }\n client.close();\n done(true,data);\n} catch (error) {\n client.close();\n done(false,error.stack);\n}\n}());\n}", "async function connectMongoDB() {\n try {\n //connect to database server\n app.locals.dbConnection = await mongodb.MongoClient.connect(\"mongodb://mongo:27017\",\n { useNewUrlParser: true });\n //connect do database \"itemdb\"\n app.locals.db = await app.locals.dbConnection.db(\"itemdb\");\n console.log(\"Using db: \" + app.locals.db.databaseName);\n }\n catch (error) {\n console.dir(error)\n setTimeout(connectMongoDb, 3000)\n }\n}", "connectToMongo (callback) {\n\t\tif (this.mockMode) {\n\t\t\treturn callback();\t// not applicable in mock mode\n\t\t}\n\n\t\t// set up the mongo client, and open it against the versionMatrix collection\n\t\tthis.mongoClientFactory = new MongoClient({ collections: ['versionMatrix'] });\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tthis.mongoClient = await this.mongoClientFactory.openMongoClient(this.apiConfig.mongo);\n\t\t\t}\n\t\t\tcatch (error) {\n\t\t\t\treturn callback(error);\n\t\t\t}\n\t\t\tthis.mongoData = this.mongoClient.mongoCollections;\n\t\t\tcallback();\n\t\t})();\n\t}", "function known_collection_nameSuite2 () {\n let ce = \"UnitTestsCollectionEdge\";\n let cv = \"UnitTestsCollectionVertex\";\n return {\n setUp: function() {\n db._createEdgeCollection(ce);\n db._create(cv, { waitForSync: true });\n },\n\n tearDown: function() {\n db._drop(ce);\n db._drop(cv);\n },\n\n test_creating_an_edge__waitForSync_URL_paramEQfalse: function() {\n // create first vertex;\n let cmd = `/_api/document?collection=${cv}`;\n let body = { \"a\" : 1 };\n let doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 201);\n assertEqual(typeof doc.parsedBody['_id'], 'string');\n assertEqual(doc.headers['content-type'], contentType);\n\n let id1 = doc.parsedBody['_id'];\n\n // create second vertex;\n body = { \"a\" : 2 };\n doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 201);\n assertEqual(typeof doc.parsedBody['_id'], 'string');\n assertEqual(doc.headers['content-type'], contentType);\n\n let id2 = doc.parsedBody['_id'];\n\n // create edge;\n cmd = `/_api/document?collection=${ce}&waitForSync=false`;\n body = { \"_from\" : id1, \"_to\" : id2 };\n doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 202);\n assertEqual(typeof doc.parsedBody['_id'], 'string');\n assertEqual(doc.headers['content-type'], contentType);\n\n let id3 = doc.parsedBody['_id'];\n\n // check edge;\n cmd = `/_api/document/${id3}`;\n doc = arango.GET_RAW(cmd);\n\n assertEqual(doc.code, 200);\n assertEqual(doc.parsedBody['_id'], id3);\n assertEqual(doc.parsedBody['_from'], id1);\n assertEqual(doc.parsedBody['_to'], id2);\n assertEqual(doc.headers['content-type'], contentType);\n },\n\n test_creating_an_edge__waitForSync_URL_paramEQtrue: function() {\n // create first vertex;\n let cmd = `/_api/document?collection=${cv}`;\n let body = { \"a\" : 1 };\n let doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 201);\n assertEqual(typeof doc.parsedBody['_id'], 'string');\n assertEqual(doc.headers['content-type'], contentType);\n\n let id1 = doc.parsedBody['_id'];\n\n // create second vertex;\n body = { \"a\" : 2 };\n doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 201);\n assertEqual(typeof doc.parsedBody['_id'], 'string');\n assertEqual(doc.headers['content-type'], contentType);\n\n let id2 = doc.parsedBody['_id'];\n\n // create edge;\n cmd = `/_api/document?collection=${ce}&waitForSync=true`;\n body = { \"_from\" : id1, \"_to\" : id2 };\n doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 201);\n assertEqual(typeof doc.parsedBody['_id'], 'string');\n assertEqual(doc.headers['content-type'], contentType);\n\n let id3 = doc.parsedBody['_id'];\n\n // check edge;\n cmd = `/_api/document/${id3}`;\n doc = arango.GET_RAW(cmd);\n\n assertEqual(doc.code, 200);\n assertEqual(doc.parsedBody['_id'], id3);\n assertEqual(doc.parsedBody['_from'], id1);\n assertEqual(doc.parsedBody['_to'], id2);\n assertEqual(doc.headers['content-type'], contentType);\n }\n };\n}", "async function mongodb() {\n mongoose.connect(process.env.MONGO_URL,\n { useNewUrlParser: true });\n await mongoose.connection.on('connected',\n ()=> console.info('mongodb connected')); \n\n app.listen(port,\n ()=>console.info(`App is listening on port ${port}`));\n }", "async function connect() {\n await wait();\n var connection = mongoose.connect('mongodb://mongodb/tnt');\n\n mongoose.connection.on('connected', () => {\n console.log('[Mongoose] - conectado en:', 'mongodb://mongodb/tnt');\n return connection;\n });\n\n mongoose.connection.on('error', (err) => {\n console.log('[Mongoose] - error de conexion:', err);\n process.exit(1);\n });\n}", "async function main() {\n\n const uri = \"mongodb+srv://thisIsMark:L9uMD3TqPYGuNUoX@cluster0.ga461.mongodb.net/ems?retryWrites=true&w=majority\";\n \n const client = new MongoClient(uri);\n\n try {\n\n await client.connect();\n await listDatabases(client);\n } catch (e) {\n console.error(e);\n }\n finally {\n await client.close();\n }\n \n}", "async function testAddUser() {\n var result = await addUser('Z0CI');\n console.log(result);\n}", "getAllTests(){\r\n\r\n console.log(\"Inside getAllTests in Atterberg DB\");\r\n return new Promise((resolve, reject)=>{ \r\n Determination_of_atterberg_limits.find().exec()\r\n .then(response => resolve(response))\r\n .catch(err => reject(err))\r\n });\r\n }", "async function getContacts(){\n const contacts = await loadContacts('[DB_NAME]','[COLLECTION]','[MONGO_CONNECTION_STRING]'); //CONNECT TO MONGO\n const res = await contacts.find().toArray(); //GET THE CONTACTS\n return res\n}", "async function work() {\n const LOG_DB = await MongoClient.connect(LOG_DB_URL, {\n poolSize: 1\n });\n const TEST_DB = LOG_DB;\n\n // @Owner: huangjiandong\n\n // import { TEST_DB, LOG_DB } from 'astrDataSources';\n\n const logDB = LOG_DB;\n const testDB = TEST_DB;\n const mz_aid = ObjectId();\n const uid = 2829330402;\n\n const actCol = await testDB.collection('act');\n const act = await actCol.findOne({ _id: mz_aid })\n console.log(\"act: \", act);\n\n const zkDetailCol = await testDB.collection('detail');\n const zkDetails = await zkDetailCol.find({\n act_id: mz_aid\n }).toArray();\n console.log(\"zkDetails: \", zkDetails);\n\n const zkLogDetailCol = await logDB.collection('detail_log');\n const zkLogDetails = await zkLogDetailCol.find({\n act_id: mz_aid\n }).toArray();\n console.log(\"zkLogDetails: \", zkLogDetails);\n\n const mjActCol = await testDB.collection('mjs');\n const mjsActs = await mjActCol.find({\n act_id: mz_aid\n }).toArray();\n console.log(\"mjsActs: \", mjsActs);\n\n const mjLogActCol = await logDB.collection('mjs_log');\n const mjsLogActs = await mjLogActCol.find({\n act_id: mz_aid\n }).toArray();\n console.log(\"mjsLogActs: \", mjsLogActs);\n\n const mjsDetailCol = await testDB.collection('mjs_detail');\n const mjsDetails = await mjsDetailCol.find({\n act_id: mz_aid\n }).toArray();\n console.log(\"mjsDetails: \", mjsDetails);\n\n const mjsLogDetailCol = await logDB.collection('mjs_detail_log');\n const mjsLogDetails = await mjsLogDetailCol.find({\n act_id: mz_aid\n }).toArray();\n console.log(\"mjsLogDetails: \", mjsLogDetails);\n\n const userActionCol = await logDB.collection('user_action_log');\n const actionLogs = await userActionCol.find({\n uid: uid,\n aid: mz_aid,\n }).toArray();\n console.log(\"actionLogs: \", actionLogs);\n\n logDB.close();\n}", "async function init() {\n await MongoDbService.init(config);\n ApiService.setDb(MongoDbService.getDb());\n}", "async function example4() {\n try {\n \n const users = await userCollection.find({department: 'c'}).toArray()\n \n } catch (err) {\n console.error(err)\n }\n}", "async function dbOperation(query_string)\r\n{\r\n try {\r\n console.info(query_string);\r\n const result = await query(query_string);\r\n return result;\r\n } \r\n catch(err)\r\n {\r\n console.info(err);\r\n }\r\n}", "async function dbOperation(query_string)\r\n{\r\n try {\r\n console.info(query_string);\r\n const result = await query(query_string);\r\n return result;\r\n } \r\n catch(err)\r\n {\r\n console.info(err);\r\n }\r\n}", "async function getRunners() {\n // await mongoClient.connect();\n // runnersDB = mongoClient.db(\"GUMP500\").collection(\"people\");\n const cursor = runnersDB.find();\n const all = await cursor.toArray();\n return all;\n}", "function testReturnData() {\n describe('Return Test Data', function() {\n it('should return data from the database and return data or error', function(done) {\n var session = driver.session();\n session\n .run('MATCH (t:Test) RETURN t')\n .then(function (result) {\n session.close();\n result.records.forEach(function (record) {\n describe('Data Returned Result', function() {\n\n it('should return test data from database', function(done) {\n assert(record);\n done();\n });\n\n it('should have length of one', function(done) {\n assert.equal(record.length, 1);\n done();\n });\n\n var result = record._fields[0];\n\n it('should return correct label type', function(done) {\n assert.equal(typeof result.labels[0], 'string');\n done();\n });\n\n it('should have label \\'Test\\'', function(done) {\n assert.equal(result.labels[0], 'Test');\n done();\n });\n\n it('should return correct testdata type', function(done) {\n assert.equal(typeof result.properties.testdata,'string');\n done();\n });\n\n it('should have property \\'Testdata\\' containing \\'This is an integration test\\'', function(done) {\n assert.equal(result.properties.testdata, 'This is an integration test');\n done();\n });\n });\n });\n done();\n })\n .catch(function (error) {\n session.close();\n console.log(error);\n describe('Data Returned Error', function() {\n it('should return error', function(done) {\n assert(error);\n done();\n });\n });\n done();\n });\n });\n });\n}", "function connectDB(cb, res){\n MongoClient.connect(connect.uri, (err, db) => {\n console.log(\"Connecting to jobs DB...\");\n assert.equal(null, err);\n db.db('jobs').collection(coll).find().toArray( (err, data) => cb(data, db, res) );\n });\n }", "function checkUserInDb(username, collection, database) {\n return new Promise((resolve, reject) => {\n // console.log(username);\n // console.log(collection);\n database\n .collection(collection)\n .find(\n {\n username: username\n },\n {\n username: 1\n }\n )\n .toArray(function(error, result) {\n if (error) {\n return reject(error);\n } else {\n if (result.length === 0) {\n resolve(false);\n }\n resolve(true);\n }\n });\n });\n}", "saveToTable(collection, data, callback){\n const client = new MongoClient(URI,{ useUnifiedTopology: true });\n client.connect()\n .then(r => {\n client.db('bbbot').collection(collection).insertMany(data)\n .then(r => {\n client.close().then(r => callback());\n })\n .catch((err) => console.log(err));\n })\n .catch((err) => console.log(err));\n }", "async function run() {\n await mongoose.connect('mongodb://localhost/dev_database', {\n useNewUrlParser: true,\n useUnifiedTopology: true,\n useCreateIndex: true\n })\n .then(db => console.log('conectado a la base de datos'))\n .catch(err => console.log(err));\n\n console.log('Conexion Lista');\n}", "function testQueries() {\n const queries = [\n // findAndSearch(),\n // createNote()\n // findById('000000000000000000000002')\n // findAndUpdate('5ba1566686d6ed45d030e4d9')\n findAndUpdate('5ba155cffeb22e8c6cf7965a'),\n findById('5ba155cffeb22e8c6cf7965a')\n ];\n\n \n return Promise.all(queries);\n}", "function known_collection_nameSuite () {\n let cn = \"UnitTestsCollectionBasics\";\n return {\n setUp: function() {\n db._create(cn, { waitForSync: true});\n },\n\n tearDown: function() {\n db._drop(cn);\n },\n\n test_creating_a_new_document: function() {\n let cmd = `/_api/document?collection=${cn}`;\n let body = { \"Hallo\" : \"World\" };\n let doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 201, doc);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(etag, `\\\"${rev}\\\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n arango.DELETE_RAW(location);\n\n assertEqual(db[cn].count(), 0);\n },\n\n test_creating_a_new_document__setting_compatibility_header: function() {\n let cmd = `/_api/document?collection=${cn}`;\n let body = { \"Hallo\" : \"World\" };\n let doc = arango.POST_RAW(cmd, body);\n\n assertEqual(doc.code, 201, doc);\n assertEqual(doc.headers['content-type'], contentType);\n\n let etag = doc.headers['etag'];\n assertEqual(typeof etag, 'string');\n\n let location = doc.headers['location'];\n assertEqual(typeof location, 'string');\n\n let rev = doc.parsedBody['_rev'];\n assertEqual(typeof rev, 'string');\n\n let did = doc.parsedBody['_id'];\n assertEqual(typeof did, 'string');\n\n let match = didRegex.exec(did);\n\n assertEqual(match[1], cn);\n\n assertEqual(etag, `\\\"${rev}\\\"`);\n assertEqual(location, `/_db/_system/_api/document/${did}`);\n\n arango.DELETE_RAW(location);\n\n assertEqual(db[cn].count(), 0);\n },\n };\n}", "async function addAchievement(gname, cheevos)\n{\n const newAchievement = {\n game: gname,\n steamAchievements: cheevos\n };\n\n try\n {\n await client.connect();\n\n const db = client.db(dbname);\n const achievements = db.collection('achievements');\n await achievements.insertOne(newAchievement, function (err, result)\n {\n\n console.log(result)\n });\n } finally\n {\n await client.close();\n }\n}", "async function runValidId() {\n let id = null;\n\n await db.select(\"_id\").from('book').limit(1)\n .then(data => id = data[0]._id)\n\n console.log('id in test', id);\n\n chai.request(server)\n .get(`/api/books/${id}`)\n //.query({_id: id})\n .end(function (err, res) {\n console.log(res.body, 'res.body in test for id valid')\n assert.equal(res.status, 200);\n assert.property(res.body, 'title', 'response should have title');\n assert.isString(res.body.title, 'title is a string')\n assert.property(res.body, '_id', 'response should have an _id');\n assert.isNumber(res.body._id, '_id is a number');\n assert.property(res.body, 'comments', 'response has an array of comments');\n assert.isArray(res.body.comments, 'comments is an array');\n done();\n })\n }", "addTodo(req, res, db) {\n const email = helperController.decoreJWT(req.headers.token).email;\n const { tasks } = req.body.payload;\n return new Promise((resolve, reject) => {\n var dbo = db.db(CRED_OBJECTS.database);\n dbo.collection(COLLECTIONS.TODOS).find({ email }).toArray((err, dbResult) => {\n if (err) reject(err);\n if (dbResult.length === 0) {\n dbo.collection(COLLECTIONS.LOGIN).find({ email }).toArray((err, dbResult) => {\n mongoDBConnectController.insertInto(db, COLLECTIONS.TODOS, { email, tasks, _id: dbResult[0]._id }).then((res) => {\n resolve(dbResult[0].tasks);\n }, err => reject(err));\n });\n } else {\n var newvalues = { $set: { tasks } };\n mongoDBConnectController.updateOne(db, COLLECTIONS.TODOS, { email }, newvalues).then((res) => {\n resolve(newvalues);\n }, err => reject(err));\n }\n });\n })\n }", "function getDrivers () {\nreturn new Promise((resolve, reject)=> {\ndb = getDb()\ndb.collection(\"drivers\").find({}).toArray(function(err, drivers) {\n if (err) { \n reject (err)\n }\nconsole.log(\"Found the following drivers\");\nconsole.log(drivers)\n\nresolve(drivers);\n});\n})\n}", "static wrapAsync(db, method, ...args) {\n return new Promise((resolve, reject) => {\n const cb = (err, result) => {\n if (err) return reject(err);\n resolve(result);\n };\n let [a1, a2] = args;\n if (method === 'find' && a1 && a2) {\n db[method](a1).limit(a2.$limit || 0).exec(cb);\n } else if (a1 && a2) {\n db[method](a1, a2, cb);\n } else if (a1) {\n db[method](a1, cb);\n }\n });\n }", "function testFetch( Lib, args ) {\n\n return makeTest(Lib, args, ( couch, nock, deferred ) => {\n\n nock.post('/test/_all_docs?include_docs=true')\n .reply(200, {\n rows: [\n { id: 1, key: 1, doc: { _id: 1, }, },\n { id: 2, key: 2, doc: { _id: 2, }, },\n ],\n });\n\n couch.fetch([ 1, 2, ])\n .then(deferred.resolve.bind(deferred));\n });\n }", "function seedDB() {\n // For counting the registered users\n let userCount = 0;\n // Delete the bunnies\n Bunny.deleteMany({})\n .then((deletedBunnies) => {\n console.log(`Deleted bunnies: ${deletedBunnies.deletedCount}`);\n // Delete the users\n return User.deleteMany({});\n })\n .then((deletedUsers) => {\n console.log(`Deleted users: ${deletedUsers.deletedCount}`);\n // Delete the posts\n return Post.deleteMany({});\n })\n .then((deletedPosts) => {\n console.log(`Deleted posts: ${deletedPosts.deletedCount}`);\n // Insert the bunnies\n return Bunny.insertMany(bunnies);\n })\n .then((insertedBunnies) => {\n console.log(`Inserted bunnies: ${insertedBunnies.length}`);\n // Register the users\n users.forEach((user, index) => {\n const bunny = insertedBunnies[index];\n User.register({username: user.username, bunny: bunny}, user.password) // Associate the user with the bunny\n .then((registeredUser) => {\n userCount++\n // Associate the bunny with the user\n bunny.owner = registeredUser;\n bunny.save();\n })\n .catch((err) => console.log(err));\n })\n })\n .then(() => {\n // How to solve the async problem of users counting?\n console.log(`Inserted users: ${users.length}`);\n })\n .catch((err) => console.log(err));\n}", "async function example3() {\n try {\n const [query, update] = [{department: 'b'}, {$set: {firstName: getRandomFirstName()}}];\n const {result} = await userCollection.updateMany(query, update);\n console.log(`Updated ${result.n} users`);\n } catch (err) {\n console.error(err);\n }\n}", "async function main() {\n\ttry {\n\t\t// create article\n\t\tconst article = await Article.createDoc({\n\t\t\ttitle: 'reactJS',\n\t\t\tauthor: 'facebook',\n\t\t\tcontent: 'front-end framework!',\n\t\t\tpublishTime: new Date()\n\t\t});\n\n\t\t// find articles\n\t\tconst articles = await Article.findDocs();\n\t\tconst doc = await Article.findDocs({ author: 'facebook' });\n\n\t\t// update article\n\t\tconst updateDoc = await Article.updateDocById(articles[0].id, {\n\t\t\tauthor: 'fb'\n\t\t});\n\n\t\t// remove article\n\t\tconst removeDoc = await Article.removeDocById(articles[0].id);\n\n\t} catch (error) {\n\t\tconsole.log(error);\n\t}\n}", "async function connectToMongo() {\n try {\n await mongoose.connect(mongoUrl, { useNewUrlParser: true });\n console.log(\"Successfully connected to AtlasDB!\");\n } catch (err) {\n console.log(\"Error connecting to AtlasDB: \" + err);\n }\n}", "async function find() {\n return await db('events');\n}", "async function getUser(db, searchObject) {\n try {\n db = await db;\n let r = await db.collection(\"users\").findOne(searchObject);\n return r;\n } catch (err) {\n console.log(err.stack);\n return \"An error has occured\";\n }\n}", "async function updateTheUserTwiceProd() {\n\n let userEmail = await getEmailFromDb('admin')\n let updateWorked = await updateUserBasedOnEmail(userEmail)\n updateWorked = await updateUserBasedOnEmail(userEmail)\n //await myBusinessLogic(username)\n\n // do some stuff\n\n return 'aukfhuseifh'\n}", "async function hitThatDB(query){\n const session = driver.session();\n var returnObject;\n return new Promise(resolve => {\n session.run(query)\n .then(result => {\n returnObject = result.records[0]._fields[0].properties;\n console.log(returnObject);\n })\n .catch(e => {\n console.log(e + \" WE MESSED UP!!!!\")\n })\n .then(() => {\n session.close();\n resolve(returnObject);\n })\n })\n}", "async function run() {\r\n try {\r\n // Connect the client to the server\r\n await client.connect();\r\n\r\n // Establish and verify connection\r\n await client.db(\"admin\").command({ ping: 1 });\r\n console.log(\"Connected successfully to server\");\r\n } finally {\r\n // Ensures that the client will close when you finish/error\r\n await client.close();\r\n }\r\n}", "function wait_for_database(fn) {\n\n //\n // Call this\n //\n var populate_after = function() {\n populate_db(fn);\n };\n\n //\n // Just specify a callback\n //\n Orm.init(populate_after);\n\n}", "async function createBC() {\n BlockChainSchema.findById(1)\n .exec()\n .then(async function (doc) {\n if (doc === null) {\n let sashaCoin = new BlockChainSchema({\n _id: 1,\n chain: [],\n difficulty: 2,\n pendingTransaction: [],\n miningReward: 100\n })\n sashaCoin.chain.push(sashaCoin.createGenesisBlock())\n await saveBC(sashaCoin)\n fillDB()\n console.log(1);\n } else {\n console.log(2);\n }\n })\n}", "async function getDataFromDocID(id) {\n const client = await MongoClient.connect(url);\n var dbo = client.db('mydb');\n\n var pathJson = (await dbo.collection('test_db').find({_id: id}).toArray())[0].file_path;\n pathJson = __dirname + pathJson;\n \n client.close();\n\n var readTest = fs.readFileSync(pathJson);\n var dataThis = JSON.parse(readTest);\n\n if (dataThis.metadata.title) {\n var title = dataThis.metadata.title;\n }\n \n if (dataThis.abstract) {\n var abstract = '';\n for (let i=0;i<dataThis.abstract.length;i++) {\n abstract += \" \" + dataThis.abstract[i].text;\n }\n }\n\n if (dataThis.body_text){\n var full_text = '';\n for (let i=0;i<dataThis.body_text.length;i++) {\n full_text += \" \" + dataThis.body_text[i].text;\n }\n }\n\n if (dataThis.metadata.authors) {\n var authors = [];\n for (let i=0;i<dataThis.metadata.authors.length;i++) {\n let thisFirst = (dataThis.metadata.authors[i].first);\n let thisMidle = (dataThis.metadata.authors[i].middle);\n let thisLast = (dataThis.metadata.authors[i].last);\n let thisName = '';\n if (thisFirst != '') thisName = thisName + thisFirst + ' ';\n if (thisMidle != '') thisName = thisName + thisMidle + ' ';\n if (thisLast != '') thisName = thisName + thisLast;\n if (thisName[0] == ' ') thisName = thisName.slice(1, thisName.length);\n if (thisName[thisName.length-1] == ' ') thisName = thisName.slice(0, thisName.length-1);\n authors.push(thisName);\n }\n }\n\n\n data_this_doc = {\n _id: id,\n title: title,\n abstract: abstract,\n full_text: full_text,\n authors: authors,\n file_path: pathJson\n }\n\n //console.log(data_this_doc.title);\n return data_this_doc;\n}", "async function init() {\n try {\n // Arrange\n const query = \"SELECT id,name FROM actors\";\n​\n // Action\n const result = await queryAsync(query);\n​\n // Passes the array returned from the query to begin the program\n run(result);\n } catch(err) {\n throw err;\n }\n}", "function create_Index(\n mongo_Client//: MongoClient obj <- explicit\n ,mongoLab_URI//:str\n ,collection_Name//:str\n //collection//: obj [collection]\n // index\n ,field_Name//:str\n ,is_Debug_Mode//: bool <- optional\n) {//: => Promise\n \"use strict\";\n\n //var collection = get_Collection(\n // mongoLab_URI,//:str\n // collection_Name ? collection_Name : 'tests'//:str\n //);\n if (\n mongo_Client &&\n mongoLab_URI &&\n //collection &&\n collection_Name &&\n field_Name &&\n typeof(mongoLab_URI) == 'string' && mongoLab_URI.length > 0 &&\n typeof(collection_Name) == 'string' && collection_Name.length > 0 &&\n typeof(field_Name) == 'string' && field_Name.length > 0\n ) {\n if (is_Debug_Mode) {console.log(\"creating index for\", field_Name, \"field in\", collection_Name);}\n\n var field_Spec = {};\n // value of 1 specifies an index that orders items in `ascending` order.\n // A value of -1 specifies an index that orders items in `descending` order.\n //>>> for return docs with latest date\n //>>> order must be `descending` -> latest first (not oldest)\n var index_Sort_Order = -1;\n\n field_Spec[field_Name] = index_Sort_Order;\n //var db = collection.s.db;\n mongo_Client\n .connect(mongoLab_URI)\n .then((db) => {\n //>>> pending here\n if (is_Debug_Mode) {console.log(\"Checking if exist collection:\", collection_Name, \"...\");}\n // Grab a collection with a callback in `safe mode`,\n // ensuring it exists (should fail if it is not created)\n var collection_Promise = Promise\n .resolve(\n db\n .collection(collection_Name\n ,{\"strict\": true}\n ,(err, collection) => {\n\n if (err) {\n if (is_Debug_Mode) {console.log(\"typeof(err):\", typeof(err));}\n // err.toString():\n // MongoError: Collection image_search_results does not exist. Currently in strict mode.\n if (is_Debug_Mode) {console.log(\"err.toString():\", err.toString());}\n // err.code: undefined\n //if (is_Debug_Mode) {console.log(\"err.code:\", err.code);}\n\n //if (is_Debug_Mode) {console.log(\"closing db ...\");}\n //db.close();\n\n return Promise.reject(err);\n }\n\n if (is_Debug_Mode) {console.log(\"typeof(collection):\", typeof(collection));}\n //if (is_Debug_Mode) {console.log(\"collection.toString():\", collection.toString());}\n if (is_Debug_Mode) {console.log(\"String(collection):\", String(collection));}\n if (is_Debug_Mode) {console.log(\"collection.name:\", collection.name);}\n\n\n return Promise\n .resolve(\n //{\"then\": collection}\n collection\n )\n ;\n }\n )\n )\n ;\n if (is_Debug_Mode) {console.log(\"typeof(collection_Promise):\", typeof(collection_Promise));}\n if (is_Debug_Mode) {\n console.log(\"is collection_Promise instanceof Promise:\", collection_Promise instanceof Promise);}\n // collection_Promise.hasOwnProperty(\"then\"): false\n if (is_Debug_Mode) {\n console.log(\"collection_Promise.hasOwnProperty(\\\"then\\\"):\", collection_Promise.hasOwnProperty(\"then\"));}\n\n collection_Promise\n .then((collection) => {\n if (is_Debug_Mode) {console.log(\"collection:\", collection_Name, \"already exist\");}\n //collection.indexExists(indexes, callback) => {Promise}\n collection\n // TypeError: Cannot read property 'indexExists' of undefined\n .indexExists(field_Name + \"_\" + index_Sort_Order)\n .then((result) => {\n if (is_Debug_Mode) {console.log(\"collection.indexExists(result):\", result);}\n\n if (db) {if (is_Debug_Mode) {console.log(\"closing db\");}db.close();}\n })\n .catch((err) => {\n if (is_Debug_Mode) {\n console.log(\n \"collection.indexExists(\", field_Name + \"_\" + index_Sort_Order, \").catch(error):\",\n err.message);}\n if (is_Debug_Mode) {console.log(err.stack);}\n // Create an index on the a field\n collection\n .createIndex(\n field_Spec\n //{field_Name: 1}// <- obj literal failed, `field_Name` was not substituted by its value\n //\"{\" + field_Name + \": 1}\"//: str <- wrong syntax\n //field_Name//: str\n ,{\n //\"unique\": true\n \"background\": true\n ,\"w\": 1\n }\n )\n .then((index_Name) => {\n if (is_Debug_Mode) {console.log(\"indexName:\", index_Name, \"for\", field_Name, \"field created\");}\n\n if (db) {if (is_Debug_Mode) {console.log(\"closing db\");}db.close();}\n\n //return collection;// ? for further .then() ?\n //return indexName;\n }\n ).catch((err) => {\n if (is_Debug_Mode) {console.log(\"collection.createIndex( err:\", err.message);}\n if (is_Debug_Mode) {console.log(err.stack);}\n\n if (db) {if (is_Debug_Mode) {console.log(\"closing db\");}db.close();}\n //return err;\n }\n )\n ;\n })\n ;\n //return Promise.resolve(collection);\n }\n )\n .catch((err) => {\n if (is_Debug_Mode) {console.log(\"db.collection(\", collection_Name, \").catch(error):\", err.message);}\n if (is_Debug_Mode) {console.log(err.stack);}\n //createCollection(name, options, callback) => {Promise}\n // Create the collection\n //return\n db\n .createCollection(collection_Name)\n .then((collection) => {\n if (is_Debug_Mode) {console.log(\"collection:\", collection_Name, \"created\");}\n //db.createIndex(name, fieldOrSpec, options, callback) => {Promise}\n db\n .createIndex(collection_Name\n ,field_Spec\n )\n .then((result) => {\n if (is_Debug_Mode) {console.log(\"db.createIndex(result):\", result);}\n if (db) { if (is_Debug_Mode) {console.log(\"closing db\");} db.close();}\n })\n .catch((err) => {\n if (is_Debug_Mode) {\n console.log(\"db.createIndex(\", collection_Name, field_Name, \").catch(error):\", err.message);}\n if (is_Debug_Mode) {console.log(err.stack);}\n })\n ;\n })\n .catch((err) => {\n if (is_Debug_Mode) {\n console.log(\"db.createCollection(\", collection_Name, \").catch(error):\", err.message);}\n if (is_Debug_Mode) {console.log(err.stack);}\n if (db) { if (is_Debug_Mode) {console.log(\"closing db\");} db.close();}\n }\n )\n ;\n })\n ;\n })\n ;\n\n\n //return Promise.resolve();\n } else {\n if (is_Debug_Mode) {console.log(\"one of input parameters is undefined ?:\", collection_Name, field_Name);}\n }\n}", "async function main() {\n // create a group\n await GroupService.create({ name: 'Group 1' })\n\n const group = await GroupService.findById(1)\n // console.log({ group })\n\n // create a task\n await TaskService.create({\n group_id: group.id,\n name: 'Task1',\n description: 'This is an example task',\n })\n const task1 = await TaskService.findById(1)\n // console.log({ task1 })\n\n // create a task with the special \"run\" name\n await TaskService.create({\n group_id: group.id,\n name: 'run',\n description: 'This is an example task',\n })\n const task2 = TaskService.findById(2)\n\n await TaskService.remove(task1.id)\n}", "function mongoTest() {\n db.collection('test_collection', function (err, collection) {\n collection.insert({\n timestamp:new mongodb.Timestamp()\n }, function (err, docs) {\n collection.count(function (err, count) {\n console.info(\"Test docs count\", count);\n });\n collection.find().sort({\n timestamp:-1\n }).limit(1).nextObject(function (err, doc) {\n console.info(\"Most recent test doc\", doc);\n });\n });\n });\n}", "function open() {\n return new Promise((resolve, reject) => {\n if (process.env.DEBUG != undefined) {\n let mockgoose = new Mockgoose(mongoose);\n // mockgoose.helper.setDbVersion(\"** your mongodb version **\");\n mockgoose\n .prepareStorage()\n .then(() => {\n mongoose\n .connect(db, {\n useNewUrlParser: true,\n useCreateIndex: true,\n dbName: \"buddyget\"\n })\n .then(() => {\n resolve();\n // console.log(\"Test DB connected..\");\n })\n .catch(err => {\n console.log(err);\n return err;\n });\n })\n .catch(err => console.log(err));\n } else {\n mongoose\n .connect(db, {\n useNewUrlParser: true,\n useCreateIndex: true,\n dbName: \"buddyget\"\n })\n .then(() => console.log(\"MongoDB connected..\"))\n .catch(err => console.log(err));\n }\n });\n}", "async function connect() { \n try { \n await client.connect(); \n const db = client.db('test'); \n \n \n const customers = db.collection('query');\n\n // const insert = await customers.insertOne(\n // { _id: 4, status: \"a\", lastModified: Date(\"2013-10-02 01:11:18\")}\n // );\n //console.log(insert.modifiedCount);\n\n // const insert = customers.find();\n // const data = await insert.toArray();\n // console.table(data);\n \n\n const Update = await customers.updateMany( \n \n { },\n { $pullAll: { tags: ['red']}}\n \n \n )\n \n // console.table(Update.modifiedCount);\n\n const cursorFind = customers.find(); \n const data = await cursorFind.toArray(); \n console.table(data); \n // console.log(Successfully connected to db ${db.databaseName});\n } \n catch (err) { \n console.error(err.message); \n } \n finally { \n client.close(); \n } \n}", "async insert(obj) {\n let collection = await this.collection();\n console.log('Inserting item...')\n await collection.insertOne(obj);\n this.dbClient.close();\n return console.log('Item successfully added to database')\n }", "async function run() {\n try {\n const mongo = await connectMongo();\n\n const { source } = await Configuration.findOne();\n const configuration = yaml.parse(source);\n const { services, timeout, webhooks } = configuration;\n await Promise.all(services.map(service => checkService(service, webhooks, timeout)));\n\n await mongo.disconnect();\n } catch (err) {\n log.err(`[worker] [run()] Error: %s`, err.message || err);\n }\n}", "async function listName(client){\nconst result = client.db(\"sample_restaurants\").collection(\"restaurants\").find({\n name:\"Riviera Caterer\",cuisine:\"American\"\n});\nconst res = await result.toArray();\nif(result){\n console.log(res);\n}\n}", "async conDB(){\n await dbConnection()\n }", "async function initializeDatabase(database){\n log.trace('console.log [OK]');\n //throw Promise.reject(\"FAKE FATAL ERROR\") //testOK\n database.connect();\n database.query('SELECT NOW() AS test', function(err, res){\n if (err) throw err;\n log.trace('test database.query 1 => '+ res.rows[0].test);\n //database.end() //commente sinon ferme la connection et empeche creation des tables\n });\n database.query('SELECT NOW() AS test', function(err, res){\n if (err) throw err;\n log.trace('test database.query 2 => '+ res.rows[0].test);\n });\n let sql = sqlCreateTables();\n database.query(sql, function(err, res){\n if (err){\n log.error('creation tables [NOK]');\n log.error(sql);\n log.error(res);\n throw err;\n }\n log.trace('creation tables [OK]');\n });\n}", "async function initDB(){\n\tconst mongodbString = `mongodb://${credentials.Mongo.login}:${credentials.Mongo.password}@ds247047.mlab.com:47047/visadb`;\n\tdb = await MongoClient.connect(mongodbString);\n\tvisadb = await db.db('visadb');\n\tconst companies = visadb.collection('companies').find({});\n\tfuse = new Fuse(await companies.toArray(), fuseOptions);\n\t//Stairway to callback hell\n\t// db.once(\"open\", function retrieveDB(){\n\t// \tconsole.log('Connection to Database established');\n\t// \t//Save contents of \"companies\" collection to local variable\n\t// \tdb.db.collection(\"companies\", function retrieveCollection(err, collection){\n\t// \t\tCompany.find({}, function saveCollection(err, jsonDB){\n\t// \t\t\tfuse = new Fuse(jsonDB, fuseOptions);\n\t// \t\t\teventEmitter.emit(\"initialised\");\n\t// \t\t});\n\t// \t});\n\t// \t//Delete the contents of \"opportunities\" in anticipation of it being updated\n\t// \t//This is a bit risky. Thinking about uploading first to a temp collection, then pushing to opportunities\n\t// \t//If an error occurs during scraping, we might be left without data to display\n\t// \tdb.db.collection(\"opportunities\", function deleteContents(err, opportunities){\n\t// \t\topportunities.remove({});\n\t// \t});\n\t// });\n\t\n}", "async function customersService(){\n db.query('SELECT * FROM customers ', function(err, rows, fields) {\n if (err){\n throw new Error(err);\n } \n customersModel.insertMany(rows, function (err, customers) {\n if (err) {\n throw new Error(err);\n };\n return\n });\n });\n}", "function actual_Result(\n db//: MongoClient.connect.then() obj\n ,collection//: db.collection obj <- optional\n ,collection_Name//: str\n ,query//: obj\n ) {//: => Promise | thenable ((dict | obj) | undefined | error)\n if (collection) {\n if (is_Debug_Mode) {console.log(\"using passed collection parameter\");}\n } else {\n collection = db\n .collection(collection_Name);\n }\n\n return collection\n .find(\n query\n )\n .project({\"_id\": false, \"original_url\": true, \"short_url\": 1})\n .toArray()\n .then((docs) => {\n if (is_Debug_Mode) {console.log(\"documents found:\", docs.length);}\n if (is_Debug_Mode) {console.log(docs);}\n if (is_Debug_Mode) {\n // Logging property names and values using Array.forEach\n Object\n //.getOwnPropertyNames(obj)\n .keys(docs)\n .forEach((val, idx, array) => {\n //!(is_Debug_Mode) ||\n console.log(\n val, '->', docs[val]);\n });\n }\n //*** find original_Link in docs ***//\n //var filtered = arr.filter(func);\n results = docs.filter((doc) => {return doc.original_url == original_Link;});\n if (results.length > 0) {\n result = {\"document\": results[0], \"is_New\": false};//, \"db\": db};\n } else {\n //*** find Arrays / lists difference ***//\n documents = [];\n documents.push({\"original_url\": original_Link, \"short_url\": short_Links[0]});\n documents.push({\"original_url\": original_Link, \"short_url\": short_Links[1]});\n documents.push({\"original_url\": original_Link, \"short_url\": short_Links[2]});\n documents.push({\"original_url\": original_Link, \"short_url\": short_Links[3]});\n\n results = comparator.lists_Difference(\n documents//: list (of obj)\n ,docs//: list (of obj)\n ,is_Debug_Mode\n );\n result = results.hasOwnProperty(0) ? results[0] : result;\n result = {\"document\": result, \"is_New\": true};//, \"db\": db};\n }\n if (is_Debug_Mode) {console.log(\"result\", result);}\n result.db = db;\n //db.close();\n\n return Promise.resolve(\n result\n );\n }\n )\n .catch((err) => {\n if (is_Debug_Mode) {console.log(\"cursor.then():\", err.stack);}\n return Promise.reject(err);\n }\n );\n }", "async function getData(collectionName) {\n const collection = db.get(collectionName);\n let data = await collection.find();\n return data;\n}", "function mongoDB(query, callback)\n{\n// console.log(\"here\");\n\n //connecting to MongoDB\n MongoClient.connect(url, { useUnifiedTopology: true }, function(err, db) {\n if(err) { \n console.log(\"Connection err: \" + err); return; \n }\n \n //accessing the database and collection\n var dbo = db.db(\"assignment_14\");\n var coll = dbo.collection('companies');\n \n //console.log(\"before find\");\n\n \n output = \"\";\n //searching the collection for documents matching the query\n coll.find(query).toArray(function(err, items) {\n if (err) \n {\n console.log(\"Error: \" + err);\n } \n else \n {\n //creating the formatted output from the found documents\n length = items.length;\n if (length == 0)\n {\n output += \"There is no matching document in the database.\";\n }\n else \n {\n for (i=0; i<length; i++)\n {\n output += \"Name: \" + items[i].name + \" -- Ticker: \" + items[i].ticker + \"<br>\";\n //console.log(output);\n //console.log(\"<br>\");\n }\n }\n }\n //db.close(); --> must close in node.js with ^C\n //console.log(\"after close\");\n callback(output);\n }); \n });\n}", "function callsASyncFunction() {\n var deferred = Q.defer();\n db.ConnectAndQuery(\"select * from UserGroup\", function () {\n console.log('Finished with non deffered async.');\n });\n return deferred.promise;\n}" ]
[ "0.64125216", "0.64030236", "0.6220759", "0.62156266", "0.60768574", "0.60655147", "0.60027266", "0.5981089", "0.59789884", "0.5934274", "0.5925914", "0.5883216", "0.5845942", "0.5831169", "0.5809738", "0.58071107", "0.57740146", "0.57627285", "0.57486624", "0.5742658", "0.5731402", "0.5727615", "0.57054025", "0.57016754", "0.56988007", "0.5677139", "0.5660196", "0.56533456", "0.5647297", "0.56462497", "0.56235063", "0.5619041", "0.5597298", "0.558406", "0.5583008", "0.55825585", "0.55783653", "0.55757433", "0.5559312", "0.5557932", "0.5556046", "0.554071", "0.55373216", "0.553504", "0.55155134", "0.5512504", "0.55071664", "0.54977477", "0.54856795", "0.54851335", "0.5461183", "0.54590285", "0.5453547", "0.54532427", "0.54518163", "0.5446187", "0.5446187", "0.5444741", "0.54343015", "0.542958", "0.54285747", "0.54244524", "0.5422241", "0.54217553", "0.5405894", "0.53939235", "0.53920704", "0.53886235", "0.5388076", "0.53781205", "0.53693", "0.5368298", "0.53628975", "0.5362136", "0.535938", "0.5348712", "0.5345692", "0.53455615", "0.53324", "0.5330437", "0.5325388", "0.53242725", "0.53159285", "0.5315027", "0.53076965", "0.53006387", "0.5289535", "0.52873147", "0.5277811", "0.527502", "0.52687085", "0.52649087", "0.5259908", "0.52491224", "0.52435297", "0.5242028", "0.52417606", "0.5232678", "0.5232222", "0.52290165" ]
0.6249753
2
We'll need to be a known id here
async function test2 () { const book = new Book({ title:"test", writingPrompt:"test", image:"test", numberOfChapters:"1", duration:"1", authorArray:[], genre: "test" }) await Book.create(book); let query = Book.findOne({}); query.exec((err, bookT) => { var targetId = typeof String; targetId = bookT._id; //console.log(targetId) chai.request(server) // May have to change name because we haven't named it yet .get('/api/book/getById?books=' + targetId) .end((err, res) => { //console.log(res.body) //console.log(res.status) res.should.have.status(200) res.body.should.be.a('array') res.body.length.should.be.eql(1); done() }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getID() {}", "get id() { return this._id; }", "get id() { return this._id; }", "get id() { return this._id; }", "function grabEBI(id){ return tf_Id(id); }", "function getId(ele){\t// store the id value\r\n id_value = ele.id; \r\n}", "get id() {\n console.log('in id getter');\n return this._id + 'TEMPORARY';\n }", "get ID(){return ID}", "function newId(_id)\n{\n if(_id == \"watchHeader\")\n {\n return \"tutHeader\";\n }\n else\n {\n return \"watchHeader\";\n }\n}", "getId (){\r\n return this.id;\r\n }", "get id() {\n return this._id;\n }", "get id() {\n\t\treturn this.__id;\n\t}", "function makeId() {\n //create an id from praxis number, username and suffix\n //complete version\n vm.setId = praxis+''+vm.name+''+vm.ownId;\n console.log('Setting own id from '+vm.setId+' to '+vm.ownId);\n //send complete peer id to all clients\n socket.emit('update:pid', vm.setId);\n }", "set _id(value) {\n this.__id = value;\n }", "get id() {\n return this._id;\n }", "get id() {\n return this._id;\n }", "get id() {\n return this._id;\n }", "get id() {\n return this._data.id;\n }", "get id() {\n return this._data.id;\n }", "function ID(sample){ return sample.id == sampleID;}", "function updateId(inputId){\n id=inputId;\n}", "constructor(id) {\n if(id) this.id = id;\n }", "function thisToDoId(id) {\n return id;\n}", "get id () {\n return this._id;\n }", "if (info.variableValues.babyId) {\n babyId = fromGlobalId(info.variableValues.babyId).id;\n }", "function findId(object) {\n return object.id\n }", "constructor () {\n this._id = getUniqueId();\n }", "get _id() {\n return this.__id;\n }", "constructor(id) {\r\n this.id = id;\r\n }", "setId(id){\n this.id=id;\n }", "constructor( id ) {\n this.#id = id;\n }", "createId () {\n\t\tthis.attributes.id = this.useId || this.collection.createId();\n\t}", "get id() {\n return this._data._id;\n }", "getId(){\r\n return this.#id;\r\n }", "selectId() {\n return this.id ? this.id : this._uid; // eslint-disable-line no-underscore-dangle\n }", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}" ]
[ "0.7228203", "0.7055045", "0.7055045", "0.7055045", "0.70158476", "0.67402774", "0.6674787", "0.66491497", "0.6603128", "0.6584849", "0.6584318", "0.6568885", "0.6567123", "0.6551128", "0.65040606", "0.65040606", "0.65040606", "0.649149", "0.649149", "0.6491461", "0.6484845", "0.64779764", "0.6470189", "0.64683104", "0.64576143", "0.64549017", "0.64547724", "0.6452821", "0.645096", "0.64503235", "0.6443395", "0.6389982", "0.63817793", "0.63733053", "0.6368679", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615", "0.63677615" ]
0.0
-1
We'll need to be a known id here
async function test2 () { const book = new Book({ title:"test", writingPrompt:"test", image:"test", numberOfChapters:"1", duration:"1", authorArray:["author1"], genre: "test" }) const book2 = new Book({ title:"test", writingPrompt:"test", image:"test", numberOfChapters:"1", duration:"1", authorArray:["author2"], genre: "test" }) await Book.create(book); chai.request(server) // May have to change name because we haven't named it yet .get('/api/book/getByAuthor?authors=' + "author1") .end((err, res) => { //console.log(res.body) //console.log(res.status) res.should.have.status(200) res.body.should.be.a('array') res.body.length.should.be.eql(1); done() }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getID() {}", "get id() { return this._id; }", "get id() { return this._id; }", "get id() { return this._id; }", "function grabEBI(id){ return tf_Id(id); }", "function getId(ele){\t// store the id value\r\n id_value = ele.id; \r\n}", "get id() {\n console.log('in id getter');\n return this._id + 'TEMPORARY';\n }", "get ID(){return ID}", "function newId(_id)\n{\n if(_id == \"watchHeader\")\n {\n return \"tutHeader\";\n }\n else\n {\n return \"watchHeader\";\n }\n}", "getId (){\r\n return this.id;\r\n }", "get id() {\n return this._id;\n }", "get id() {\n\t\treturn this.__id;\n\t}", "function makeId() {\n //create an id from praxis number, username and suffix\n //complete version\n vm.setId = praxis+''+vm.name+''+vm.ownId;\n console.log('Setting own id from '+vm.setId+' to '+vm.ownId);\n //send complete peer id to all clients\n socket.emit('update:pid', vm.setId);\n }", "set _id(value) {\n this.__id = value;\n }", "get id() {\n return this._id;\n }", "get id() {\n return this._id;\n }", "get id() {\n return this._id;\n }", "get id() {\n return this._data.id;\n }", "get id() {\n return this._data.id;\n }", "function ID(sample){ return sample.id == sampleID;}", "function updateId(inputId){\n id=inputId;\n}", "constructor(id) {\n if(id) this.id = id;\n }", "function thisToDoId(id) {\n return id;\n}", "get id () {\n return this._id;\n }", "if (info.variableValues.babyId) {\n babyId = fromGlobalId(info.variableValues.babyId).id;\n }", "constructor () {\n this._id = getUniqueId();\n }", "function findId(object) {\n return object.id\n }", "get _id() {\n return this.__id;\n }", "constructor(id) {\r\n this.id = id;\r\n }", "setId(id){\n this.id=id;\n }", "constructor( id ) {\n this.#id = id;\n }", "createId () {\n\t\tthis.attributes.id = this.useId || this.collection.createId();\n\t}", "get id() {\n return this._data._id;\n }", "getId(){\r\n return this.#id;\r\n }", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}" ]
[ "0.7226296", "0.7053432", "0.7053432", "0.7053432", "0.7014188", "0.6738433", "0.6673014", "0.6647683", "0.66009533", "0.6583849", "0.658233", "0.6567", "0.6566779", "0.654894", "0.65020514", "0.65020514", "0.65020514", "0.6489577", "0.6489577", "0.64891887", "0.6483609", "0.6475494", "0.64683974", "0.64663017", "0.6457622", "0.6454203", "0.6453217", "0.64512384", "0.6448777", "0.6448302", "0.64408547", "0.6390048", "0.6380044", "0.63715994", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604", "0.63682604" ]
0.0
-1
This section is for retweet function for the bot. This bot will aggregate tweet related to the topic for you.
function retweet() { var params = { q: 'christmas', count: 2, result_type: 'recent', lang: 'en' } var tweet = { status: 'Retweeting most recent tweets about ' + params.q } print('retweet', 'params and tweet instantiated'); function gotData(err, data, response) { if (err) { print('retweet', 'retweet ERROR!'); } else { print('retweet', 'retweet SUCCESS!'); } var tweets = data.statuses; for (var i = 0; i < tweets.length; i++) { console.log('NEWS '+ i + ' || ' + tweets[i].text); var result = { status: tweets[i].text } print('retweet', 'retweeting the searched tweet'); print('retweet', tweets[i].text); T.post('statuses/update', result, isTweetSuccess); } } print('retweet', 'posting tweet...'); T.post('statuses/update', tweet, isTweetSuccess); print('retweet', 'searching tweet...'); T.get('search/tweets', params, gotData); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTweet(topic) {\n var params = {\n q: topic, //'banana since:2011-11-11',\n count: numberOfResults,\n }\n T.get('search/tweets', params, gotData);\n function gotData(err, data, response) {\n var tweets = data.statuses // list of statuses\n all_tweets = ''\n for(var tweet of tweets) {\n console.log(tweet.user.screen_name + ':\\n' + tweet.text + \"\\n-----------------------\")\n all_tweets += tweet.user.screen_name + ':\\n' + tweet.text + \"\\n----------------------\\n\"\n }\n }\n}", "function getTweets(topic){\n client.get(\"search/tweets\", \n {\n q: topic,\n result_type: \"recent\"\n }, function(error, tweets, responses){\n if (error){\n console.log(error);\n };\n dataLog(JSON.stringify(tweets));\n console.log(\"+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\");\n console.log(\" ### Tweets ###\");\n console.log(tweets);\n console.log(\"= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =\");\n console.log(\"\");\n // console.log(responses);\n });\n} //reach out to twitter and grab tweets related to userInput topic", "function reTweet() {\n T.get('search/tweets', dadHashSearch, function (error, data) {\n //Prints errors to log.\n console.log(error, data);\n //No Errors.\n if(!error) {\n //Grabs ID of desired tweet.\n var retweet = data.statuses[0].id_str;\n //Tells twitter to retweet the tweet.\n T.post('statuses/retweet/' + retweet, { }, function (error, response) {\n if (response) {\n\t\t\t\tconsole.log('Success!')\n\t\t\t}\n\t\t\t// Twitter error.\n\t\t\tif (error) {\n\t\t\t\tconsole.log('There was an error with Twitter:', error);\n\t\t\t}\n })\n }\n // Search error\n\t else {\n\t \tconsole.log('There was an error with your hashtag search:', error);\n\t }\n });\n}", "function triageTweet(tweet) {\n // Reject the tweet if:\n // 1. it's flagged as a retweet \n if (tweet.retweeted) {\n return;\n }\n else {\n // Send a tweet to the person that requested the plots\n buildReply(tweet);\n printPlotLog();\n }\n}", "function tweet(message){\n\n\t}", "function makeTweet(mytweet) {\r\n\r\n console.log('Atttempting Tweet...');\r\n // .post takes an object as input\r\n var tweet = {\r\n status: mytweet\r\n\r\n };\r\n // if (tweet.status) {\r\n console.log(\"posting......\");\r\n console.log(\"status to be posted: \" + tweet.status);\r\n T.post('statuses/update', tweet, tweeted);\r\n // }\r\n\r\n function tweeted(err, data, response) {\r\n if (err) {\r\n console.log('something went wrong');\r\n console.log(data);\r\n urls = [];\r\n }\r\n else {\r\n console.log('Tweet successful');\r\n //console.log(data);\r\n prev_tweet = data.text;\r\n }\r\n }\r\n}", "function retweetLatest() {\r\n\tT.get('search/tweets', successSearch, function (error, data) {\r\n\t // If our search request to the server had no errors...\r\nconsole.log(error, data);\r\n\t if (!error) {\r\n\t \t// ...then we grab the ID of the tweet we want to retweet...\r\n\t\tvar retweetId = data.statuses[0].id_str;\r\n\t\t// ...and then we tell Twitter we want to retweet it!\r\n\t\tT.post('statuses/retweet/' + retweetId, { }, function (error, response) {\r\n\t\t\tif (response) {\r\n\t\t\t\tconsole.log('Success! Check your bot, it should have retweeted something.')\r\n\t\t\t}\r\n\t\t\t// If there was an error with our Twitter call, we print it out here.\r\n\t\t\tif (error) {\r\n\t\t\t\tconsole.log('There was an error with Twitter:', error);\r\n\t\t\t}\r\n\t\t})\r\n\t }\r\n\t // However, if our original search request had an error, we want to print it out here.\r\n\t else {\r\n\t \tconsole.log('There was an error with your hashtag search:', error);\r\n\t }\r\n\t});\r\n}", "retweetLocalStationTweets () {\n const params = {\n count: 10,\n exclude_replies: true,\n trim_user: true,\n screen_name: this.localStationAccount\n }\n\n this.twitterClient.get('statuses/user_timeline', params, (error, tweets, response) => {\n this.logger.info('Checking for retweets')\n\n if (error) {\n this.logger.error(error)\n return\n }\n\n const rtParams = {\n trim_user: true\n }\n\n if (tweets.length) {\n this.logger.info(`Latest tweet created at: ${tweets[0].created_at}`)\n }\n\n tweets.forEach((tweet) => {\n if (new Date() - new Date(tweet.created_at) < 3600000) {\n this.logger.info(`Retweeting tweet with id ${tweet.id_str}`)\n\n this.twitterClient.post(`statuses/retweet/${tweet.id_str}.json`, rtParams, (error, tweets, response) => {\n if (error) {\n this.logger.error(error)\n return\n }\n\n this.logger.info(`Received ${response} from retweet request.`)\n })\n }\n })\n })\n }", "function receive_tweet(tweet) {\n\n\t// console.log(tweet.user.screen_name, \":\", tweet.text.substring(0, 100));\n\n\tvar words = tweet.text.match(/[a-z0-9]+/gi);\n\tvar tweet = { screen_name: tweet.user.screen_name, text: tweet.text};\n\twords.forEach(function(word) {\n\t\tif (word.length > 3) {\n\t\t\tword = word.toLowerCase();\n\t\t\t// console.log(\"Publishing to:\", \"/track/\" + word);\n\t\t\tfaye_client.publish(\"/track/\" + word, tweet);\n\t\t}\n\t});\n}", "function retweetLatest() {\n\tT.get('statuses/mentions_timeline', {since_id: since}, function (error, data) {\n\t // log out any errors and responses\n\t console.log(error, data);\n\t // If our search request to the server had no errors...\n\t if (!error) {\n\t \t// ...then we grab the ID of the tweet we want to retweet...\n\t\t\tfor (i = 0; i < data.length; i++) {\n\t\t\t\tvar text = data[i]['text'];\n\t\t\t\tvar sender = \"@\" + data[i]['user']['screen_name'];\n\t\t\t\tvar origin_id = data[i]['id'];\n\n\t\t\t\ttext = text.replace('@victorbotge', '');\t\n\n\t\t\t\tt = text.split(' ');\n\n\t\t\t\tt.forEach(wordsub);\n\n\t\t\t\tT.post('statuses/update', {status: t.join(' ') + \" \" + sender, in_reply_to_status_id: origin_id}, function (error, response) {\n\t\t\t\t\tif (response) {\n\t\t\t\t\t\tconsole.log('Success! Check your bot, it should have retweeted something.');\n\t\t\t\t\t\tsince = response['id'];\n\t\t\t\t\t}\n\t\t\t\t\t// If there was an error with our Twitter call, we print it out here.\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\tconsole.log('There was an error with Twitter:', error);\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t }\n\t }\t\n\t // However, if our original search request had an error, we want to print it out here.\n\t else {\n\t \tconsole.log('There was an error with your hashtag search:', error);\n\t }\n\t});\n}", "reply(tweet) {\n const replyTo = tweet.user.screen_name;\n const replyName = tweet.user.name;\n const id = tweet.id_str;\n const text = _.sample(responses);\n\n console.log(`Replying to @${replyTo}`);\n const message = `@${replyTo} Hi ${replyName}! ${text}`;\n\n // favorite each tweet so we know which ones we've processed already\n return this.twitter.favoriteTweet(id)\n .then((data) => {\n return this.tweet(message);\n });\n }", "function retweet(retweetId){\n Twitter.post('statuses/retweet/', {\n id: retweetId\n }, function(err, response) {\n if (err) {\n console.log('Something went wrong while RETWEETING...');\n console.log(err);\n }\n else if (response) {\n console.log('Retweeted!!!');\n console.log(response)\n }\n }); \n}", "function publishTweet() {\n try {\n tweetStr = generateString();\n\n Twitter.post(\n \"statuses/update\",\n {\n status: tweetStr,\n },\n function(err, response) {\n if (err) {\n if (err.code === 187) {\n console.log(\n `Tweet failed because twitter prevented a duplicate tweet. IP address hasn't changed.`\n );\n } else {\n console.error(\"Error publishing tweet: \", err);\n republishTweet();\n }\n return;\n }\n\n if (response) {\n console.log(`Tweet successful`);\n }\n }\n );\n } catch (err) {\n console.log(`Error publishing tweet: `, err);\n republishTweet();\n }\n}", "function tweetRecall(){\n\tvar params = {screen_name: 'samxmoses'}\n\tvar i = 2;\n\tclient.get(\"statuses/user_timeline\", params, function(error, tweets, response) {\n\t if (!error) {\n\t for (i=0; i<2; i++){\n\t \tj=i+1;\n\t \tconsole.log(\"Alias Sam X Moses tweet # \"+j+\": \"+tweets[i].text);\t \t\n\t } \n\t } else {\n\t console.log(error)\n\t }\n\t});\n}", "function tweets () {\n\n\n\n}", "function tweeted(err, data, response) {\n\n\t if (err) {\n\t \t console.log(\"Error publishing official statement - REPLY\");\n\t } else {\n\t console.log(\"DATA leaked to a curious citizen- IMAGE\");\n\t }\n\t}", "function retweet(retweetId){\n\tTwitter.post('statuses/retweet/', {\n\t\tid: retweetId\n\t}, function(err, response) {\n\t\tif (err) {\n\t\t\tconsole.log('Something went wrong while RETWEETING...');\n\t\t\tconsole.log(err);\n\t\t}\n\t\telse if (response) {\n\t\t\tconsole.log('Retweeted!!!');\n\t\t\tconsole.log(response)\n\t\t}\n\t});\n}", "function getTweets(res, bearerToken, userTopic) {\n var url = 'https://api.twitter.com/1.1/search/tweets.json';\n request({\n url: url + \"?q=\" + userTopic + \"&count=50&lang=en&result_type=mixed\",\n method: 'GET',\n headers: {\n \"Authorization\": \"Bearer \" + bearerToken,\n \"Content-Type\": \"application/json\"\n },\n json: true\n }, function(err, jsonResponse, body) {\n tweetStrings = parseTweets(body);\n //tweetStrings = tweetStrings.join(\"\\n\");\n\n wordCounts = twitterAnalysis.getWordCountFromTweets(tweetStrings);\n\n res.render('twitter', { //Only render the website when we are finished writing to it\n title: 'Twitter Feed',\n topic: userTopic,\n tweets: tweetStrings\n });\n });\n}", "function tweeted(err, reply) {\n if (err) {\n console.log(err.message);\n } else {\n console.log('Tweeted: ' + reply.text);\n }\n }", "function tweetEvent(eventMsg) {\n\n\t//Theses variables are used to make the coding and reading process easier\n\t//for the programmer. \"eventMsg\" is a callback function needed when\n\t//communicating data with Twitters servers. The paths refers to files \n\t//in a JSON format, and are present in every tweet.\n\tvar replyto = eventMsg.in_reply_to_screen_name;\n\tvar text = eventMsg.text;\n\tvar from = eventMsg.user.screen_name;\n\n\tfunction tweetImage(eventMsg) {\n\t var tweet = {\n\t //Using the predefined variable to respond to the specific username\n\t //of the user posting to the bot account \n \tscreen_name: from,\n \t//The text send in the direct message, with a link to \n \t//the \"raw\" .json data used for the daily bulletin\n \ttext: 'DATA obtained and ready for wordprocessing_module.exe https://raw.githubusercontent.com/TheGreatLeadr/Final-Project/master/RawData.png',\n\t }\n //Makes the bot post a direct message to the \"active\" user\n\t T.post('direct_messages/new', tweet, tweeted);\n }\n \n //Console callbacks for the function\n\tfunction tweeted(err, data, response) {\n\n\t if (err) {\n\t \t console.log(\"Error publishing official statement - REPLY\");\n\t } else {\n\t console.log(\"DATA leaked to a curious citizen- IMAGE\");\n\t }\n\t}\n\n\t//Variable for the specific tag used\n\tvar chosentag = '@TheGreatLeadr #source'\n\t//A capitalized version can be used as well, to make the interaction more \"forgiving\"\n\tvar chosentag2 = '@TheGreatLeadr #Source'\n\n\t//Logs the communication between twitter accounts to the console\n\tconsole.log(from + ' sent a tweet to ' + replyto);\n\n\t//Setting up the criteria for the interaction with the bot. You can see this\n\t//as two different options. Either A: The tweet to the bot account is correct\n\t//\t\t\t\t\t\t\t\tOr B: The tweet to the bot account is incorrect\n\t//Depending on the tweet meets case A or B, the bot will send different messages.\n\t//\n\t//Case A (correct):\n\tif(replyto === 'TheGreatLeadr' || replyto === 'thegreatleadr' && text === chosentag || text === chosentag2) {\n\t\ttweetImage();\n\t} else {\n\t//Case B (incorrect):\n\t\tif(replyto === 'TheGreatLeadr') {\n\t\t\tvar newtweet = '@' + from + ' Thanks for your participation. Stand by for more official bulletins from The Great Leader.';\n\t\t\ttweetIt(newtweet);\n\t\t}\n\t}\n\t//Counts the amount of times the specific string below has been posted since the\n\t//bot started running.\n\tif (text === chosentag) {\n\t\ttagcounter = tagcounter + 1;\n\t}\n}", "function tweetEmail(post) {\n \n MailApp.sendEmail(settingsArray[2][1], \n settingsArray[2][2] + \" (\" + new Date().toString().substring(0, 24) + \")\", \n post,\n {\n name: 'Automated',\n }) \n}", "function tweeted(err, data, response) {\n if (err) {\n logger.log('[postTwitter] error:', err)\n } else {\n logger.log('[postTwitter] success:' + data.text)\n }\n }", "function tweets(tweet) { cb(tweet) }", "function respondToTweet(event) {\n // sanitise tweet text by removing punctuation and converting to lowercase\n var text = event.text;\n text = text.toLowerCase().replace(/[.,\\/#!$%\\^&\\*;:{}=\\-_`~()?]/g, '');\n\n oscClient.send('/update', text, event.user.profile_link_color, function (err) {\n if (err) {\n console.error(new Error(err));\n }\n else {\n // leave a second so oF has time to do its thang\n setTimeout(function() {sendReply(event)}, 1000);\n }\n });\n}", "function handleTweet(Ss) {\r\n return;\r\n }", "function tweetEvent(eventMsg){\n\t\t\t\t\t//eventMsg is data from tweet (location, source screen name, text,) ..turn into JSON string \n\n//anytime someone sends a tweet to me i send a tweet back to them\n\tvar replyto = eventMsg.in_reply_to_screen_name;\n\tvar text = eventMsg.text;\n\tvar from = eventMsg.user.screen_name;\n\t\n\tconsole.log(replyto + '' + from);\n\n//if user mentions me (the bot) in their tweet, tweet this message \n\tif(replyto === 'tatiturin'){\n\t\tvar newTweet = '@' +from + 'wasssaap' ;\n\t\ttweetIt(newTweet);\n\t}\n\n}", "function tweetIt(txt) {\n\n\tvar tweet = {\n\t\tstatus: txt\n\t}\n\n\t//Makes the bot account post a status update.\n\tT.post('statuses/update', tweet, tweeted);\n\n\t//Nested function that logs strings to the console. Makes it easier to see\n\t//if the bot works or not\n\tfunction tweeted(err, data, response) {\n\t\tif (err) {\n\t\t\tconsole.log(\"Error posting tweet respone - MESSAGE\");\n\t\t} else {\n\t\t\tconsole.log(\"Citizen participation noticed - MESSAGE\");\n\t\t}\n\t}\n}", "function tweeted(err, data, response) {\n\t\tif (err) {\n\t\t\tconsole.log(\"Error posting tweet respone - MESSAGE\");\n\t\t} else {\n\t\t\tconsole.log(\"Citizen participation noticed - MESSAGE\");\n\t\t}\n\t}", "function tweet(text){\n\tvar tweet = {\n\t\tstatus: text\n\t}\n\n\tT.post('statuses/update', tweet, tweeted);\n\n\tfunction tweeted(err, data, response){\n\t\tif(err){\n\t\t\tconsole.log(err);\n\t\t} \n\t\telse {\n\t\t\tconsole.log(\"It worked!\");\n\t\t}\n\t}\n}", "function tooter() {\n\n const toot = {\n status: generate()\n }\n\n // Post that tweet!\n M.post('statuses', toot, (err, data) => {\n if (err) {\n console.log(err);\n } else {\n console.log(data.content);\n }\n });\n}", "function getTweets() {\n var clientTW = new twitter(keys.twitterKeys);\n var paramsTW = {\n screen_name: 'Baron_Von_Tech'\n };\n //add functions\n clientTW.get('statuses/user_timeline', paramsTW, function(error, tweets, response) {\n if (error) {\n return console.log('Error occurred: ' + error)\n }\n tweets.forEach(function(result) {\n console.log(\"\\n---------------------------------\");\n console.log(\"@\" + result.user.screen_name + \" Tweeted at \" + result.created_at);\n console.log(result.text);\n console.log(\"---------------------------------\");\n\n });\n });\n}", "function tweetit(){\n\n\tvar rand = Math.floor(Math.random()*42)\n\n\tvar tweet = {\n\n\t\tstatus: 'now it is gonna be random: ' + rand +' #machinetweet'\n\n\t}\n\n\tT.post('statuses/update', tweet, tweeted )\n\n\tfunction tweeted(err, data, response){\n\t\tif (err) {\n\t\t\tconsole.log(\"something went wrong\")\n\t\t} else {\n\t\t\tconsole.log(\"it worked\")\n\t\t}\n\t\t \n\t}\n}", "postTweet(){\n\n rl.question('Have a tweet in mind?: ', (answer) => {\n twi.post('statuses/update', { status: answer }, function(err, data, response) {\n console.log(data)\n });\n rl.close();\n });\n }", "function republishTweet() {\n const tenMinutes = 1000 * 60 * 10;\n\n setTimeout(function() {\n publishTweet();\n }, tenMinutes);\n}", "function tweetIt(txt) {\n\n\tvar tweet = {\n\t\tstatus: txt\n\t}\n\tT.post('statuses/update', tweet, tweeted);\n\n}", "function viewHandler2 () {\n var storageKey = msg.storageKey + \"_TwitterScrapper_Tweets\";\n\n /* Set Profile by obtaining tweetAuthor, tweetHandle, tweetId and tweet fields */\n function setProfile (elem) {\n var tweetAuthor = elem.getAttribute(\"data-name\"); // Get tweetAuthor\n var tweetHandle = elem.getAttribute(\"data-screen-name\"); // Get tweetHandle\n var tweetId = elem.getAttribute(\"data-tweet-id\"); // Get tweetId\n var tweetDate = elem.children[1].children[0].children[1].children[0].getAttribute(\"title\"); // Get tweetDate\n var text = elem.querySelectorAll(\".tweet-text\");\n var retweetedAuthor = \"\", retweetedHandle = \"\";\n text = Array.from(text);\n var tweetText = \"\", retweetedText = \"\";\n if (elem.getAttribute(\"data-retweet-id\") == undefined) {\n // Tweet is original\n tweetText = text[0].textContent;\n }\n else {\n retweetedAuthor = tweetAuthor;\n retweetedHandle = tweetHandle;\n tweetHandle = elem.getElementsByClassName(\"js-retweet-text\")[0].children[0].getAttribute(\"href\");\n tweetHandle = \"@\" + tweetHandle.slice(1);\n tweetAuthor = elem.getElementsByClassName(\"js-retweet-text\")[0].children[0].children[0].textContent;\n // Tweet is part of a retweet\n try {\n // User has retweeted with a text\n tweetText = text[0].textContent;\n retweetedText = text[1].textContent\n } catch (e) {\n if (e) {\n // User has retweeted without any original text\n tweetText = \"\";\n retweetedText = text[0].textContent;\n }\n }\n }\n // Profile\n var profile = {\"tweetText\": tweetText,\n \"retweetedText\": retweetedText,\n \"tweetDate\": tweetDate,\n \"tweetAuthor\": tweetAuthor + \" \" + retweetedAuthor,\n \"tweetHandle\": tweetHandle + \" \" + retweetedHandle,\n \"tweetId\": tweetId};\n return profile;\n }\n var targetNode = document.getElementById(\"stream-items-id\");\n var tweetsData = [];\n var dataStorage = [];\n var sendData = false;\n chrome.storage.local.get([storageKey], function (result) {\n if (result[storageKey] == undefined) {\n var tweets = document.getElementsByClassName(\"tweet\");\n var tweetsSize = tweets.length; // Count the number of tweets\n console.log(\"Traversing tweets\");\n for (var i=0; i<tweetsSize; i++){\n var profile = setProfile(tweets[i]);\n if (!dataStorage.includes(JSON.stringify(profile))) {\n // Tweet is not yet processed\n dataStorage.push(JSON.stringify(profile));\n tweetsData.push(profile);\n }\n }\n chrome.storage.local.set({[storageKey]: JSON.stringify(dataStorage)}, function () {\n console.log(\"Updating storage\");\n sendData = true;\n });\n }\n else {\n console.log(\"Waiting for changes\");\n // Observe if nodes are added to the list\n const mutationConfig = {childList: true};\n const mutationCallback = function (mutationList, observer) {\n if (mutationList.length > 0) {\n // Changes in the number of tweets\n console.log(\"Mutation detected\");\n var dataStorage = JSON.parse(result[storageKey]);\n var tweetsData = [];\n for (var i=0; i<mutationList.length; i++) {\n if (mutationList[i].type == \"childList\") {\n // Check through the new tweets that are added\n var addedNodes = mutationList[i].addedNodes;\n for (var j=0; j<addedNodes.length; j++) {\n var tweet = addedNodes[j].children[0];\n var profile = setProfile(tweet);\n dataStorage.push(JSON.stringify(profile));\n tweetsData.push(profile);\n }\n // Check through the tweets that are removed\n var removedNodes = mutationList[i].removedNodes;\n for (var j=0; j<removedNodes.length; j++) {\n var tweet = removedNodes[j].children[0];\n var profile = setProfile(tweet);\n dataStorage = removeElement(dataStorage, JSON.stringify(profile));\n tweetsData = removeElement(tweetsData, profile);\n }\n }\n }\n chrome.storage.local.set({[storageKey]: JSON.stringify(dataStorage)}, function () {\n console.log(\"Updating storage\");\n sendData = true;\n });\n }\n }\n const observer = new MutationObserver(mutationCallback);\n observer.observe(targetNode, mutationConfig);\n }\n });\n var awaitData = setInterval(function() {\n if (sendData) {\n sendResponse(tweetsData);\n clearInterval(awaitData);\n }\n }, 100);\n }", "function handleTweets(individualTweet, cb_in){\n console.log(\"INDIVIDUAL TWEET =\" + individualTweet);\n \n T.get('statuses/retweeters/ids', {\n id: individualTweet,\n stringify_ids: true\n }, function(err, data, response) {\n \n //console.log(data);\n \n for (var i = 0; i < data.ids.length; i++) {\n console.log(\"PUSHING USER ID \" + data.ids[i]);\n retweeterIDs.push(data.ids[i]);\n }\n \n result = countArrayElements(retweeterIDs);\n var userIDs;\n \n T.get('users/lookup', {\n user_id: result[0].join(\",\"),\n count: 10\n }, function(err, data, response) {\n //console.log(data);\n for (var i = 0; i < data.length; i++) {\n var singleItem = data[i];\n returnData = data;\n returnData[i].JayApp = result[1][i];\n console.log(data);\n }\n return cb_in();\n });\n });\n \n \n }", "function tweets(){\n client = new Twitter({\n consumer_key: twitterKeys.consumer_key,\n consumer_secret: twitterKeys.consumer_secret,\n access_token_key: twitterKeys.access_token_key,\n access_token_secret: twitterKeys.access_token_secret,\n });\n // if(!spotName){\n // spotName = \"bljhawk\";\n // }\n // var params = {screen_name: spotName};\n client.get('statuses/user_timeline/', function(error, tweets, response){\n //console.log(arguments)\n if(!error){\n for (var i = 0; i < tweets.length && i < 20; i++){\n console.log('Tweet # ' + (i + 1) + '--------------' + '\\n' + tweets[i].created_at + '\\n' + tweets[i].text + 'n' + tweets[i].retweet_count + ' retweets')\n // var dStr = tweets[i].created_at;\n // var d = dStr.replace(\"+0000 \", \"\");\n // var tweetResults = d + \": \" + \"@\" + tweets[i].user.screen_name + \": \" + tweets[i].text + \"\\r\\n\";\n // console.log(tweetResults);\n }\n }\n });\n}", "function twitterCommand() {\n var params = { screen_name: 'projectproject4' };\n client.get('statuses/user_timeline', params, function (error, tweets, response) {\n log(\"my-tweets was run and returned the following informtion: \")\n if (!error) {\n for (i = 0; i < 20 && i < tweets.length; i++) {\n console.log(\"-----------------------------------------------\" +\n \"\\nTweet #\" + (i + 1) +\n \"\\nTweeted at: \" + tweets[i].created_at+\n \"\\n\"+tweets[i].text);\n log( \n \"\\nTweet #\" + (i + 1) +\n \"\\nTweeted at: \" + tweets[i].created_at+\n \"\\n Tweet Conent:\" + tweets[i].text+\n \"\\n------------------------------------------------------------\"\n\n );\n };\n }\n });\n\n}", "function tweetNow(text) {\n let tweet = {\n status: text\n }\n\n bot.post('statuses/update', tweet, (err, data, response) => {\n if (err) {\n console.lol('ERROR Reply', err)\n }\n console.lol('SUCCESS: Replied: ', text)\n })\n}", "function tweetEvent(eventMsg) {\n // var fs = require('fs'); // uses a node module - file system, required to work with files below\n // var json = JSON.stringify(eventMsg,null, 2); // turning a JS object into a string\n // fs.writeFile('tweet.json', json); //write the stringified object out into a JSON file, it is overwritten with every tweet that is triggered\n // could be alos just console.log but then we an not keep the information for later analysis\n \n var replyto = eventMsg.in_reply_to_screen_name;\n var text = eventMsg.text;\n var from = eventMsg.user.screen_name;\n \n console.log(replyto + ' ' + from);\n \n if (replyto === 'w6bedi2MO') {\n \n var newTweet = '@' + from + ' thank you for asking me to reply #w6bedi2MO'\n tweetIt(newTweet);\n }\n \n\n}", "function tweetReply(txt) {\n var myReply = {\n status: txt\n }\n\n T.post('statuses/update', myReply, replyFunction);\n\n // Function for my reply post. Checks and see if there is an error\n function replyFunction(err, data, response) {\n if(err) {\n console.log(\"Unable to to post reply!\");\n } else {\n console.log(\"Reply posted!\");\n }\n }\n}", "function tweeted(err, data, response) {\n\t\tif(err) {\n\t\t\tconsole.log(err);\n\t\t} else {\n\t\t\tconsole.log(\"Success: \" + data.text);\n\t\t}\n\t}", "function tweeting() {\n let tweet = document.querySelector('#comment').value;\n if (tweet != '') {\n if (currPerson.tweets == null) {\n currPerson.tweets = [];\n }\n currPerson.tweets.push(tweet);\n renderProfile(currPerson);\n }\n}", "function tweet() {\n\n openURL('https://twitter.com/intent/tweet?hashtags=quotes&text='\n + encodeURIComponent('\"' + currentQuote + '\" -' + currentAuthor));\n\n /* todo:\n 1. add full twitter api for tweeting a quote without having to use twitter gui\n */\n\n }", "function onTweet(err, tweet, response) {\n if(err) {\n console.error(\"tweet failed to send :(\");\n console.error(err);\n }\n else {\n console.log(\"tweet sent: \" + tweet.text);\n }\n}", "function tweetIt(txt, id){\n\n var rawText = txt.toString();\n var handle = \"@H3CZ\"\n var tweetID = id;\n\n var englishText = replaceSpecialChars(rawText);\n \n\n async function getTranslatedText(textToTranslate, idOfTweet, userHandle) {\n var spanishText = await translateText(textToTranslate, 'es');\n console.log(\"Tweeting out: \" + spanishText + \"\\n\");\n\n T.post('statuses/update', {in_reply_to_status_id: idOfTweet, status: userHandle + ' ' + spanishText}, tweeted);\n\n }\n\n\n getTranslatedText(englishText, tweetID, handle);\n\n \n function tweeted(err, data, response){\n if(err){\n console.log(\"Something went wrong!\\n\");\n }\n else{\n console.log(\"It worked!\\n\");\n }\n }\n}", "function myTweets()\n{\n var Twitter = require('twitter');\n var keys=require(\"./keys.js\");\n var client = new Twitter({\n consumer_key: keys.twitterKeys.consumer_key,\n consumer_secret: keys.twitterKeys.consumer_secret,\n access_token_key: keys.twitterKeys.access_token_key,\n access_token_secret: keys.twitterKeys.access_token_secret\n });\n\n client.get('statuses/user_timeline', 'ArumitaDe', function(error, tweets, response) \n {\n if (!error) {\n \n var output=\"\\r\\n\\r\\n-----Your last 20 tweets are being displayed-----\";\n output=output+\"\\r\\n\\r\\n\";\n for (var i=0;i<=19;i++)\n output=output+\"\\r\"+tweets[i].text+\"\\r\\n\";\n console.log(output);\n fileLog('my-tweets','',output);\n }\n \n });\n}", "function Tweet(data) {\n\tthis.body = m.prop(data.body)\n\tthis.author = m.prop(data.author)\n\tthis.timestamp = m.prop(data.timestamp)\n}", "function tweeted(err, data, response) {\n if (err) {\n console.log(err);\n } else {\n console.log('Success: ' + data.text);\n //console.log(response);\n }\n}", "function tweetEvent(tweet) {\n\n var id = tweet.id_str;\n var text = tweet.text;\n var name = tweet.user.screen_name;\n\n let regex = /(impress)/ig;\n var str = text;\n \n const impressed = (element) => element === \"impress\";\n\n let impressive = str.match(regex);\n\n var isItImpressive = impressive.some(impressed);\n \n console.log(isItImpressive)\n //from itsAydrian in twitch chat on 1/28 😘 \n let i = Math.floor(Math.random() * 3);\n \n // checks text of tweet for mention of Shania Bot\n if ((text.includes('@bot_shania') && isItImpressive === true)) {\n\n // Start a reply back to the sender\n var replyText = thatDontImpressMeMuch[i] + \"@\"+ name + \" That don't impress me much. \";\n \n // Post that tweet\n T.post('statuses/update', { status: replyText, in_reply_to_status_id: id}, tweeted);\n\n // Make sure it worked!\n function tweeted(err, reply) {\n if (err) {\n console.log(err.message);\n } else {\n console.log('Tweeted: ' + reply.text);\n }\n }\n }\n}", "function run() {\n var service = getService();\n\n if(!service.hasAccess()){\n Logger.log(service.getLastError());\n return;\n }\n\n var url = \"https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=davidayalas&count=50&include_rts=1&include_entities=0&exclude_replies=1&contributor_details=0&tweet_mode=extended\";\n var user_url = \"https://api.twitter.com/labs/1/users?usernames=davidayalas&format=detailed\";\n var pinned_url = \"https://api.twitter.com/labs/1/tweets?ids={id}&format=detailed\";\n \n var tweets = _request(url, service.getAccessToken());\n\n var user = _request(user_url, service.getAccessToken());\n\n var pinned_tweet = (user && user.data && user.data.length>0 ? user.data[0].pinned_tweet_id : null);\n pinned_tweet = _request(pinned_url.replace(\"{id}\",pinned_tweet), service.getAccessToken());\n pinned_tweet = (pinned_tweet && pinned_tweet.data && pinned_tweet.data.length>0 ? [[[pinned_tweet.data[0].text],[pinned_tweet.data[0].created_at],[pinned_tweet.data[0].id], [\"pinned\"]]] : null);\n\n var lastTweet = Properties.getProperty(\"lastTweet\");\n var lastPinnedTweet = Properties.getProperty(\"pinnedTweet\");\n var lastPinnedTweetMedia = Properties.getProperty(\"pinnedTweetMedia\");\n \n //If not modified, returns\n if(tweets.length && tweets[0].id_str){\n if(lastTweet === tweets[0].id_str && lastPinnedTweet===(pinned_tweet?pinned_tweet[0][2][0]:\"\")){\n Logger.log(\"not modified\");\n return;\n }\n }\n \n //Else, fills new sheet, deletes latest and sets lastTweet\n var sheet = SpreadsheetApp.openById(SS);\n var sheetName = sheet.insertSheet().getName();\n var activeSheet = sheet.getActiveSheet();\n var RT = \"\";\n var row=1;\n var aux = \"\";\n \n if(pinned_tweet){\n activeSheet.getRange(row,1,1,4).setValues(pinned_tweet);\n row++;\n }\n \n for(var i=0,z=tweets.length; i<z;i++,row++){\n RT = \"\"; \n aux = tweets[i] && tweets[i].extended_entities && tweets[i].extended_entities.media && tweets[i].extended_entities.media.length>0 ? tweets[i].extended_entities.media[0].media_url_https : \"\";\n if(pinned_tweet && pinned_tweet[0][2][0]===tweets[i].id_str){\n row--;\n if(lastPinnedTweetMedia!==aux){\n lastPinnedTweetMedia = aux;\n }\n if(lastPinnedTweetMedia){\n activeSheet.getRange('E1').setValue(lastPinnedTweetMedia);\n }\n continue;\n }\n if(tweets[i].full_text.indexOf(\"RT\")===0){\n RT = tweets[i].full_text.slice(0,tweets[i].full_text.indexOf(\":\")+1);\n }\n activeSheet.getRange(row,1,1,5).setValues([[[ (tweets[i].retweeted_status && tweets[i].retweeted_status.full_text ? RT + \" \" + tweets[i].retweeted_status.full_text : tweets[i].full_text) ],[tweets[i].created_at],[tweets[i].id_str],[],[RT===\"\" && aux ? aux : \"\"]]])\n }\n \n for(var i=0; i<=sheet.getSheets().length; i++){\n if(sheet.getSheets()[i] && sheet.getSheets()[i].getName()!==sheetName){\n sheet.deleteSheet(sheet.getSheets()[i]);\n }\n }\n \n sheet.getSheets()[0].setName(\"Sheet1\");\n Properties.setProperty(\"lastTweet\",tweets[0].id_str);\n Properties.setProperty(\"pinnedTweet\",pinned_tweet && pinned_tweet[0][2][0] ? pinned_tweet[0][2][0] : \"\");\n Properties.setProperty(\"pinnedTweetMedia\", lastPinnedTweetMedia);\n \n //call netlify build\n UrlFetchApp.fetch(Properties.getProperty(\"build_hook\"), {'method' : 'post'});\n}", "function myTweets(){\n if (argument1 === \"my-tweets\"){\n \n //My tweets are colored for more fun, better display, and to easily distiguish them from the other data\n console.log(\"\\x1b[4mMy last tweets:\\x1b[0m\");\n //following npm documentation to get the data from twitter\n client.get('statuses/user_timeline', params, function(error, tweets, response) {\n if (!error) {\n //limiting it to 20 tweets and also if there are less than 20 tweets overall displaying the ones available only \n for (var i = 0; i < tweets.length && i < 20; i++) {\n console.log(\"\\x1b[32m\" + tweets[i].text + \"\\x1b[0m \" + tweets[i].created_at);\n \n // Bonus... append data to log.txt file\n fs.appendFile(\"log.txt\", \"\\n\" + tweets[i].text + \"\\n\" + tweets[i].created_at, function(err) {\n // If an error was experienced it's logged.\n if (err) {\n console.log(err);\n } \n });\n }\n } else {\n console.log(error);\n }\n });\n }\n}", "function tweet() {\n var params = {\n screen_name: 'LanaeSlayer'\n };\n client.get('statuses/user_timeline', params, function (error, tweets, response) {\n if (!error) {\n // This array will hold the data that will be appended to log.txt\n data = [];\n\n for (var i = 0; i < tweets.length; i++) {\n\n\n console.log(\"\");\n console.log(tweets[i].created_at);\n console.log(tweets[i].text);\n console.log(\"\");\n console.log(\"<-------------------------------------------->\");\n data.push({\n time: tweets[i].created_at,\n text: tweets[i].text\n })\n\n }\n logData(data)\n\n }\n });\n\n}", "function myTweets(results) {\n //console.log(\"Check results within myTweets Function: \" + results);\n //console.log(\"Are my keys working? \" + keys.twitter);\n\n\n //Pull Twitter API keys and data\n var client = new twitter({\n consumer_key: keys.Twitter.consumer_key,\n consumer_secret: keys.Twitter.consumer_secret,\n access_token_key: keys.Twitter.access_token_key,\n access_token_secret: keys.Twitter.access_token_secret,\n });\n\n //Command Line input for twitter username\n let twitterUsername = userINPUT;\n\n //If no username was entered default to your own twitter handle\n if ((twitterUsername == 'undefined') && (results == 'undefined')) {\n twitterUsername = \"ericetwice\";\n } else if (results !== 'undefined') {\n twitterUsername = userINPUT;\n }\n\n\n //Change the screen_name default (Which is ericetwice) to the one entered in the command line\n twitterHandle = {\n screen_name: twitterUsername\n };\n\n //Twitter API Documentation -- pulling from user_timeline. \n // use this as reference: https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline.html\n client.get(\"statuses/user_timeline/\", twitterHandle, function (error, data, response) {\n if (!error) {\n for (let i = 0; i < 20; i++) {\n let tweetCount = i + 1;\n let results =\n \"*********************** @\" + data[i].user.screen_name + \"'s Tweet Number: \" + tweetCount + \" *********************** \" + \"\\r\\n\" +\n space + data[i].text + \"\\r\\n\" +\n space + \"Tweeted on: \" + data[i].created_at + \"\\r\\n\\r\\n\";\n console.log(results);\n\n fs.appendFile(\"log.txt\", results, function (err) {\n if (err) throw err;\n });\n\n }\n } else {\n console.log(\"There was an error. Error code: \" + error);\n return;\n }\n });\n\n}", "function retrieveTweets(topic,period){\n\tvar fakeR = [];\n\tvar obj = new Object();\n\tobj.author = \"RPC\";\n\tobj.time = \"199401\";\n\tobj.content = \"asdsvdsfsdfdsfdsfdsfsdf\";\n\t\n\tfor(var i = 0;i < 200;i = i + 1){\n\t\tfakeR.push(obj);\n\t}\n\treturn fakeR;\n}", "function userTweets(error, data, response) {\n for (var i = 0; i < data.length; i++) {\n console.log(\"========================================\");\n console.log(params.screen_name);\n console.log(data[i].created_at);\n console.log(data[i].text);\n }\n }", "function confirmTweet(user, name, id) {\r\n\taxios.post('https://slack.com/api/chat.postMessage', qs.stringify({\r\n\t\ttoken: process.env.SLACK_ACCESS_TOKEN,\r\n\t\tchannel: user,\r\n\t\ttext: 'Tweet sent! \\n https://twitter.com/' + name + '/status/' + id\r\n }));\r\n}", "function tweeting(){\n var twitter = require('twitter');\n//Grabs Twitter node construct\n var twitt = keys.twitterKeys;\n//Grabs Twitter keys Object\n var client = new twitter(twitt);\n var params = {screen_name: 'Clearkeyboard', count: 20};\n client.get('statuses/user_timeline', params, function(error, tweets, response){\n if (!error){\n //forEach loop that \n console.log(' ');\n console.log('================ My Tweets ================');\n tweets.forEach(function(obj) {\n console.log('--------------------------');\n console.log('Time: ' + obj.created_at);\n console.log('Tweet: ' + obj.text);\n console.log('--------------------------');\n console.log(' ');\n });\n console.log('===========================================');\n console.log(' ');\n }else{console.log(\"Twitter User Not Found or No Tweets to show\")}\n });\n}", "function twitter20(){\nconsole.log(msg.SimpleMessage);\n \nvar params = {screen_name: 'ninja_cbc'};\nclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n if (!error) {\n console.log(tweets);\n }\n});\n\n//PSUEDO CODE:\n// find specific user's 20 recent tweets\n// Output data to console\n\n}", "function myTweets() {\n\t// Initialize twitter api keys\n\tvar client = new twitter (keys.twitterKeys);\n\t// Specify parameters for API call\n\tvar params = {\n\t\tscreen_name: 'NodeLiri',\n\t\tcount: \"20\"\n\t};\n\t// Execute API call\n\tclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n \t\t// Display any errors\n \t\tif (error) {\n \t\t\tthrow error\n \t\t};\n\t\t// Loop through the response\n\t\tfor (var i =0; i < tweets.length; i++) {\n\t\t\t// Read the time the tweet was created\n\t\t\tvar tweetTime = tweets[i].created_at;\n\t\t\t// Read the tweet\n\t\t\tvar tweet = tweets[i].text;\n\t\t\t// display the tweet\n\t\t\tconsole.log(i + \" : \" + tweet);\n\t\t\t// display the time of the tweet\n\t\t\tconsole.log(i + \" (time): \" + tweetTime);\n\t\t\t// Append the command and results to the log file log.txt\n\t\t\tfs.appendFile(\"log.txt\",';'+argument1 + ';' + i + \" : \" + tweet + ';' + i + \" (time): \" + tweetTime , function(err){\n\t\t\t//If the code experiences any errors it will log the error to the console.\n\t\t\t if (err) {\n\t\t\t return console.log(err);\n\t\t\t }\n\t\t\t});\n\t\t}; \t\t\n\t});\n}", "function setTweet(receiveTweet) {\n tweet = receiveTweet\n}", "function myTweets(){\nvar params = {screen_name: 'YunkerGrant'};\nconsole.log(\"\\n========= Tweets of '\"+ params.screen_name +\"' ======\");\nclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n if (!error) {\n for(i=0; i < tweets.length; i++){\n console.log(\"Tweet #\"+[i+1]+\": \"+tweets[i].text);\n } console.log(\"\\n\");\n};\n});\n}", "function postRetweet(id){\n return new Promise((resolve, reject) =>{\n let params = {\n id,\n };\n T.post('statuses/retweet/:id', params, (err, data) => {\n if (err){\n return reject(err);\n }\n return resolve(data); \n });\n });\n}", "function myTweets() {\n\tclient.get('statuses/mentions_timeline', (error,tweets,response) => {\n\t\t\n\t\t// IF loop to catch error message\n\t\tif (!error) {\n\n\t\t\t// run a for-in loop through the tweets object\n\t\t\t// and display each object element separated with a line at the bottom\n\t\t\tconsole.log(\"-------------------------------------------------My Tweets!----------------------------------------------------\")\n\t\t\tfor (var prop in tweets) {\n\t\t\t\tconsole.log(tweets[prop])\n\t\t\t\tconsole.log(\"-----------------------------------------------------------------------------------------------------------\")\n\t\t\t}\n\n\t\t// console log error if caught\n\t\t} else {\n\t\t\tconsole.log(error)\n\t\t}\n\t})\n}", "streamTweets(filter) {\r\n const s = this.T.stream('statuses/filter', filter);\r\n\r\n s.on('tweet', (tweet) => {\r\n console.log(\"Caught Tweet\");\r\n\r\n this.userid = tweet.user.id_str;\r\n this.getThread(tweet);\r\n })\r\n }", "function tweets() {\n var client = new Twitter(keys.twitter);\n\n var params = {\n screen_name: \"FauxScoJo\",\n count: 20\n };\n client.get(\"statuses/user_timeline\", params, function(\n error,\n tweets,\n response\n ) {\n if (error) {\n console.log(error);\n }\n for (var i = 0; i < params.count; i++) {\n var tweetData = [\n i + 1 + \". Created: \" + moment(tweets[i].created_at,\"dd MMM DD HH:mm:ss ZZ YYYY\",\"en\").format(\"MMMM Do YYYY, h:mm a\") + \" | \" + tweets[i].text,\n divider\n ].join(\"\\n\\n\");\n\n // Log the data to the textFile\n fs.appendFile(textFile, tweetData, function(err) {\n if (err) throw err;\n });\n console.log(tweetData);\n }\n });\n}", "function tweets(){\n\tvar client = new Twitter(theKeys.twitterKeys);\n\tvar params = {screen_name: 'rachgriarte',\n\t\t\t\tlimit: 20\n\t\t\t};\n\t//Retrieving tweets\n\tclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n\t if (!error) {\n\t \tfor (var i=0; i<tweets.length; i++){\n\t \t\tconsole.log(\"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\")\n\t \t\tconsole.log(\" \");\n\t \t\tconsole.log(tweets[i].created_at)\n\t\t\tconsole.log(tweets[i].text);\n\t\t\tconsole.log(\"\\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\")\n\t \t\t}\n\t \t}\n\t});\n}", "function processTweets(tweets) {\n var count = 0;\n tweets.forEach((tweet, index) => {\n var word = pickWord(tweet.text),\n wordIndex, correctWord, correction;\n if (count >= MAX_CYCLE_TWEETS) {\n // Don't go over the limit\n return;\n }\n if (tweet.text.indexOf(\"RT\") === 0) {\n // Skip retweets\n console.log(\"Rejecting tweet because: retweet\");\n return;\n }\n if (word === null){ \n // Skip this tweet\n console.log(\"Rejecting tweet because: no matching words\");\n return;\n }\n if (engagementHistory.indexOf(tweet.id_str) !== -1) {\n // Skip tweet if we've already messed with this one\n console.log(\"Rejecting tweet because: already engaged\");\n return;\n }\n if (tweetInappropriate(tweet)) {\n // Skip tweets with inappropriate content or from inappropriate accounts\n console.log(\"Rejecting tweet because: inappropriate\");\n return;\n }\n wordIndex = tweet.text.indexOf(word);\n correctWord = getCorrectWord(word, wordIndex, tweet.text);\n \n correction = pickCorrection(correctWord);\n \n logCorrection(tweet, correction);\n tweetCorrection(tweet, correction);\n \n count++;\n engagementHistory.push(tweet.id_str);\n });\n}", "function tweetIt() {\n var client = new Twitter(keys.twitter);\n\n var myTwitter = 997195376393322497;\n var name = { follow: myTwitter, count: 20 };\n client.get(\n 'statuses/user_timeline/', name, function (error, tweets, response) {\n if (!error) {\n for (var i = 0; i < tweets.length; i++) {\n console.log([i + 1] + '. ' + tweets[i].text);\n console.log('Tweeted on: ' + tweets[i].created_at);\n console.log(divider);\n }\n } else {\n console.log(\"You have issues.\");\n console.log(error);\n }\n\n });\n}", "function twitter() {\n\n var params = {\n screen_name: 'Sabrina Carbo',\n count: 20\n };\n\n client.get('statuses/user_timeline', params, function (error, tweet, response) {\n if (!error) {\n //console.log(tweet);\n tweetArray = tweet;\n\n for (i = 0; i < tweetArray.length; i++) {\n console.log(\"\");\n console.log(\"Created at: \" + tweetArray[i].created_at);\n console.log(\"\");\n console.log(\"Text: \" + tweetArray[i].text);\n console.log(\"\");\n }\n } else {\n console.log(error);\n }\n });\n}", "function search() {\n\n topAccounts = [\n '@TuurDemeester', \n '@CryptoHustle', \n '@alistairmilne',\n '@aantonop',\n '@coindesk'\n ]\n const randomFromTopAccounts = topAccounts[Math.floor(Math.random()*topAccounts.length)]\n console.log(\"randomFromTopAccounts : \", randomFromTopAccounts)\n\n const params = { \n q: randomFromTopAccounts, \n count: 1,\n until: today,\n result_type: \"recent\",\n tweet_mode: \"extended\",\n }\n T.get('search/tweets', params, function(err, data, response) {\n var tweets = data.statuses\n\n if (tweets[0] === undefined) {\n console.log(\"object is undefined\")\n return \n }\n\n console.log(\"full object\", tweets[0]);\n console.log(\"full_text :\", tweets[0].full_text)\n console.log(\"retweet_count :\", tweets[0].retweet_count)\n\n // for (var i = 0; i < tweets.length; i++) {\n // console.log(\"text: \", tweets[i].text)\n // tweets.push(tweets[i])\n // }\n\n console.log(\"number of retweets\", tweets[0].retweet_count)\n // console.log(\"trucated ?\", tweets[0].trucated)\n \n if (tweets[0].retweet_count >= 5) {\n console.log(\"more that 10 rewteets\")\n tweetNow(tweets[0].full_text)\n } else {\n console.log(\"not enough retweets\")\n }\n })\n}", "function tweeted(err, data, response) {\n if(err) { console.log(\"Couldn't Tweet! Error: \" + err);\n } else { console.log(\"Tweet Sent!\") }\n}", "function myTweets(){\r\n\tvar client = new twitter(twitterKeys.twitterKeys);\r\n\tclient.get(\"src= http://twitter.com/statuses/user_timeline.json\", {count:20}, function(error, tweets, response){\r\n\t\tif (error){\r\n\t\t\tconsole.log(\"Error. Please go to src= http://twitter.com/statuses/user_timeline/kathrinweb2017.json?callback=twitterCallback2&count=20\");\r\n\t\t}\r\n\t\tif(!error){\r\n\t\t\ttweets.forEach(function(kdTweet){\r\n\t\t\t\tconsole.log(\"At \"+ kdTweet.created_at +\"\\nKD Tweeted: \"+ kdTweet.text);\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\t\r\n}", "function postTweet() {\n /*preparing href link for twitter button*/\n var quot = 'https://twitter.com/intent/tweet?text='+ quoteList[index].quote + \" \"+quoteList[index].author;\n $(\".btn-twitter\").attr(\"href\", quot);\n }", "function myTweets () {\n\t//twitter keys\n\tvar client = new twitterFS({\n\t\tconsumer_key: consKey,\n\t \tconsumer_secret: consKeySec,\n\t\taccess_token_key: accKey,\n\t\taccess_token_secret: accKeySec\n\t});\n\t\n\t//twitter function to get tweets, and display on terminal.\n\tvar params = {screen_name: 'famomin13' , count: 20};\n\tclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n\t\tif (!error) {\n\t\t\t for (var i = 0; i < tweets.length; i++) {\n console.log('tweets: '+JSON.stringify(tweets[i].text, null, 2));\n console.log('time: '+JSON.stringify(tweets[i].created_at, null,2));\n }\n\t \t}\n\t});\t\n} // ending myTweet function here.", "function gotData(err, data, response) {\n\n\t// picking random tweet of the first 75 tweets returned\n\t// although params query brings back 150 tweets, they're aren't always\n\t// 100 complete tweets to due twitter filtering out retweets and\n\t// incomplete data. It seems like at least 50% of the tweets are\n\t// always good, so just picking from the first 50 returned\n\t// The problem before was that originally when the random number\n\t// was close to the max result (like 94 of 100) it would be undefined\n\t// and the bot would stop working\n\n\tvar randomtweet = Math.floor(Math.random() * 75);\n\t\n\t// create empty object to hold returned tweet id_str \n\t var toretweet = {\n\t \tid: '',\n\t}\n\t// variable to hold twitter user id of selected tweet for retweeting\n\t// need user id to filter out other bots in if statement below\n\tvar tweeterid = data.statuses[randomtweet].user.id_str;\n\t\n\t// grabbing selected tweet id and assigning it to toretweet object\n\t// assign value to tweet using id_str property\n\t// using id_str and not id because Javascript can't deal with large integers\n\t// so the Twitter api passes them as strings\n\ttoretweet.id = data.statuses[randomtweet].id_str;\n\n\t// loop to test presence of data\n\t// for (var i = 0; i <=50; i++) {\n\t// \tconsole.log(i + ' tweet ' + data.statuses[i].user.id_str);\n\t// }\n\t\n\t\n\t// add if statement to filter out anime SteelyDan character bots\n\t// if the tweet is by either bot there is a message in the console\n\t// and in 20 seconds the function will run again, hopefully posting\n\t\n\t// if (tweeterid == ('2470654214' || '122217337'|| '122219416' || '4066860798' || '4782149654' || '43627436')) {\n\t// \tconsole.log(\"oops its the wrong guy again, will try again\");\n\t\t\n\t\n\t// \t} else {\n\n\t// \t// retweet tweet from search above \n\t// \t// print returned data in console\n\t// \tT.post('statuses/retweet/:id', toretweet, function (err, data, response) {\n \t// \tconsole.log(data);\n\t// \t});\n\t// \tconsole.log(\"Success, another quality Steely Dan tweet has posted!\");\n\n\t// }\n\n\t// Changing to switch/case method to block selected accounts from being retweeted\n\n\tswitch(tweeterid) {\n\t\tcase '2470654214':\n\t\t\tconsole.log(\"oops its the wrong guy again, will try again\");\n\t\t\tbreak;\n\t\tcase '122217337':\n\t\t\tconsole.log(\"oops its the wrong guy again, will try again\");\n\t\t\tbreak;\n\t\tcase '122219416':\n\t\t\tconsole.log(\"oops its the wrong guy again, will try again\");\n\t\t\tbreak;\n\t\tcase '4066860798':\n\t\t\tconsole.log(\"oops its the wrong guy again, will try again\");\n\t\t\tbreak;\n\t\tcase '4782149654':\n\t\t\tconsole.log(\"oops its the wrong guy again, will try again\");\n\t\t\tbreak;\n\t\tcase '43627436':\n\t\t\tconsole.log(\"oops its the wrong guy again, will try again\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tT.post('statuses/retweet/:id', toretweet, function (err, data, response) {\n\t\t\t\tconsole.log(data);\n\t\t\t \t});\n\t\t\t \tconsole.log(\"Success, another quality Steely Dan tweet has posted!\")\n\t}\n}", "function twitter(){\n//This will show your last 20 tweets and when they were created at in your terminal/bash window//\n }", "tweet(status) {\n return this.post({\n path: '/statuses/update',\n params: {\n status,\n }\n });\n }", "function setProfile (elem) {\n try {\n var tweet = elem.querySelectorAll('[data-testid=\"tweet\"]')[0].children[1];\n } catch (e) {\n return;\n }\n var tweetId = elem.querySelectorAll('[data-testid=\"tweet\"]')[0].querySelectorAll(\"a\")[2].getAttribute(\"href\");\n // Format: /{handle}/status/{id}\n tweetId = tweetId.split(\"/\")[3];\n var checkRetweetWithoutText = tweet.parentElement.parentElement.children[0].querySelectorAll(\"a\")[0];\n\n var subTweet, retweetedAuthor = \"\", retweetedHandle = \"\", retweetedDate = \"\", retweetedText = \"\";\n var tweetAuthor = \"\", tweetHandle = \"\", tweetDate = \"\", tweetText = \"\";\n var tempAuthor = \"\", tempHandle = \"\", tempDate = \"\", tempText = \"\";\n\n var tempAuthor = tweet.children[0].children[0].children[0].querySelectorAll(\"span\")[0].textContent;\n var tempHandle = tweet.children[0].children[0].querySelectorAll(\"a\")[0].getAttribute(\"href\");\n tempHandle = \"@\" + tempHandle.slice(1);\n var tempDate = tweet.children[0].children[0].children[2].getAttribute(\"title\");\n var tempText = tweet.children[1].textContent;\n\n if (checkRetweetWithoutText) {\n tweetHandle =checkRetweetWithoutText.getAttribute(\"href\");\n tweetHandle = \"@\" + tweetHandle.slice(1);\n tweetAuthor = tweet.parentElement.parentElement.children[0].querySelectorAll(\"span\")[1].textContent;\n retweetedHandle = tempHandle;\n retweetedAuthor = tempAuthor;\n retweetedDate = tempDate;\n retweetedText = tempText;\n }\n else {\n tweetAuthor = tempAuthor;\n tweetHandle = tempHandle;\n tweetDate = tempDate;\n tweetText = tempText;\n }\n\n try {\n subTweet = elem.querySelectorAll('[data-testid=\"tweet\"]')[0].children[1].querySelectorAll('[role=\"blockquote\"]')\n retweetedAuthor = subTweet[0].children[0].children[0].children[0].querySelectorAll(\"span\")[0].textContent;\n retweetedHandle = subTweet[0].querySelectorAll(\"span\")[2].textContent;\n retweetedDate = subTweet[0].children[0].children[0].children[1].textContent;\n retweetedText = subTweet[0].children[0].children[1].textContent;\n } catch (e) {\n\n }\n // Profile\n var profile = {\"tweetText\": tweetText,\n \"retweetedText\": retweetedText,\n \"tweetDate\": tweetDate + \" \" + retweetedDate,\n \"tweetAuthor\": tweetAuthor + \" \" + retweetedAuthor,\n \"tweetHandle\": tweetHandle + \" \" + retweetedHandle,\n \"tweetId\": tweetId};\n return profile;\n }", "function handleTweets( key, data )\n\t\t{\n\t\t\ttweetFound = false;\n\t\t \n\t\t// see if tweet already exists, if so don't handle it and exit\n\t\t\tfor( var i = 0; i < tweets.length; i++ )\n\t\t{\n\t\t\tif( tweets[ i ].tweet == data.text )\n\t\t{\n\t\t\ttweets_per_call--;\n\t\t\treturn;\n\t\t}\n\t\t}\n\t\t \n\t\t// increase tweet counter\n\t\tcount++;\n\t\t \n\t\t// if its the first tweet in a request, set it to the current counter\n\t\tif( firstID == -1 )\n\t\t\t{\n\t\t\t\tfirstID = count;\n\t\t\t}\n\t\t \n\t\t// add tweet to array\n\t\t\ttweets.push( { id : count, tweet : data.text } );\n\t\t \n\t\t// add tweet to page\n\t\t\taddTweet( count, data );\n\t\t \n\t\t// remove the oldest tweet if there are more than\n\t\t\tif( tweets.length > MAX_TWEETS )\n\t\t{\n\t\t\t$( '#' + tweets[0].id ).hide( ANIM_SPEED, removeTweet( tweets[0].id ) );\n\t\t\ttweets.shift();\n\t\t\t}\n\t\t}", "function myTweets() {\nvar params = {screen_name: 'Bwash105'};\nclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n if (!error) {\n console.log(tweets[0].text);\n }\n for (var k = 0; k < 5; k++) {\n var tweetArr = [];\n for(var i = 0; i < tweets[i].length; i++) {\n tweet = tweets[i].text\n tweetArr.push(tweet);\n }\n console.log(\"-------------------------------\");\n console.log(\"Tweets: \" + tweetArr.join(\", \"));\n console.log(\"-------------------------------\");\n }\n\n});\n}", "function tweetNow(text, id_str) {\n let tweet = {\n status: text,\n in_reply_to_status_id: id_str,\n auto_populate_reply_metadata: true,\n }\n\n bot.post('statuses/update', tweet, (err, data, response) => {\n if (err) {\n console.lol('ERRORDERP Reply', err)\n }\n console.lol('SUCCESS: Replied: ', text, id_str)\n })\n}", "function findTweet() {\n T.get('search/tweets', dadTweetSearch, function (error, data) {\n //Prints errors to log.\n console.log(error, data);\n //No errors\n if (!error) {\n //gets the text of the tweet as array of words\n var tweetTextArray = data.statuses[0].text.trim().split(\" \");\n \n //gets the index of \"I'm\"\n var indexIm = 0;\n for (var i=0; i<tweetTextArray.length; i++){\n if (tweetTextArray[i].match(\"I'm\")) {\n indexIm = i;\n break;\n }\n }\n \n //gets the word for the joke\n var jokeWord = tweetTextArray[indexIm+1];\n \n //Gets the ID of selected tweet.\n var tweetId = data.statuses[0].id_str;\n \n //Gets the useranme of the selected tweet.\n var username = data.statuses[0].user.screen_name;\n \n //code for the reply itself\n var reply = {\n status: '@' + username + \" Hi \" + jokeWord + \", I'm dad.\",\n in_reply_to_status_id: '' + tweetId\n };\n \n //Posting the reply\n T.post('statuses/update', reply, function(err, data, response) {\n console.log(data);\n })\n \n // If there is an error.\n } else {\n\t \t console.log('There was an error with your word search:', error);\n\t }\n })\n}", "function Tweet(content) {\n T.post('statuses/update', { status: content }, function (err, reply) {\n if (err)\n Log(\"error: \" + err);\n else\n Log(\"reply: \" + reply);\n });\n}", "function onlyRetweets(tweet){ \n if(tweet.hasOwnProperty('referenced_tweets')){\n for(let j=0;j<tweet.referenced_tweets.length;j++){\n if(tweet.referenced_tweets[j].type==='quoted'||tweet.referenced_tweets[j].type==='replied_to'){\n return false;\n }\n }\n return true;\n }else{\n return false;\n }\n}//end onlyRetweets", "function GetTweet() {\n\n\t\tDownloadTweets();\n\n\t}", "function myTweets() {\n\n\tvar client = new Twitter(\n\t\tkeys.twitterKeys\n\t);\n\t\t \n\tvar params = {screen_name: 'bauerdavid2'};\n\tclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n\n\t if (!error) {\n\n\t \tfs.appendFileSync(textFile, \"my-tweets\\n\");\n\n\t \tvar length = 20;\n\t \tif (tweets.length < 20) length = tweets.length;\n\t for (var i = 0; i < length; i++) {\n\n\t \tconsole.log(tweets[i].text);\n\t \tfs.appendFileSync(textFile, tweets[i].text + '\\n');\n\n\t \tconsole.log(' Tweeted on or about: ', tweets[i].created_at);\n\t \tfs.appendFileSync(textFile, ' Tweeted on or about: ' + tweets[i].created_at + '\\n');\n\n\t }\n\n\t fs.appendFileSync(textFile, '-------Logged: ' + Date() + '-------\\n\\n');\n\t\t\tconsole.log('File logged to: ' + textFile);\n\n\t } else if (error) {\n\t \treturn console.log('Error: ', error);\n\t }\n\n\t});\n}", "function tweet(statusMsg, screen_name, status_id){\n\tconsole.log('Sending tweet to: ' + screen_name);\n\tconsole.log('In response to:' + status_id);\n\tvar msg = statusMsg;\n\tvar status_id_response = status_id;\n\tif (screen_name != null){\n\t\tmsg = '@' + screen_name + ' ' + statusMsg;\n\t}\n\tconsole.log('Tweet:' + msg);\n\tTwitter.post('statuses/update', {\n\t\tstatus: msg,\n\t\tin_reply_to_status_id: status_id_response\n\t\t}, function(err, response) {\n\t\t\t// if there was an error while tweeting\n\t\t\tif (err) {\n\t\t\t\tconsole.log('Something went wrong while TWEETING...');\n\t\t\t\tconsole.log('screen_name: '+screen_name+\" msg: \"+msg);\n\t\t\t\tconsole.log(err);\n\t\t\t}\n\t\t\telse if (response) {\n\t\t\t\tconsole.log('Tweeted!!!');\n\t\t\t\t//console.log(response)\n\t\t\t}\n\t});\n}", "function myTweets() {\n\n var params = { screen_name: 'dwaynemhinds' };\n client.get('statuses/user_timeline', params, function (error, tweets, response) {\n if (!error) {\n //console.log(tweets);\n if (tweets.length < 20) {\n numOfTweets = tweets.length;\n }\n else {\n numOfTweets = 20;\n }\n for (i = 0; i < numOfTweets; i++) {\n console.log(tweets[i].created_at);\n console.log(tweets[i].text);\n logIt(\"logging myTweets<>\"+tweets[i].created_at+\",\"+tweets[i].text);\n\n };\n };\n });\n}", "function tweet() {\n\ttweetBtn.setAttribute(\"href\", \"https://twitter.com/intent/tweet?text=\" + encodeURIComponent(quoteEl.innerHTML + \" \\n\\n-- \" + authorEl.innerHTML))\n\ttweetBtn.style.display = ''\n}", "function postTweet(data) {\n var ret;\n var tweetData = {\n status: data.status,\n media_ids: data.mediaId // Pass the media id string\n }\n\n // if it's in reponse to an id\n if (data.replyId) tweetData.in_reply_to_status_id = data.replyId;\n\n client.post('statuses/update', tweetData, function(error, data, response) {\n if (!error) {\n // return the data of successful tweet;\n ret = data;\n }\n else {\n ret = false;\n }\n });\n deasync.loopWhile(function(){ return ret === undefined });\n return ret;\n}", "getAllTweets () {\n\t\t//Single responsibility with single flow\n\t\t// so this will communicate with api\n\t\t// so it will only send messages or meaning it will call an api\n\t\tconsole.log(1, \"get all tweets\");\n\t\tAPI.getAllTweets();\n\t}", "function tweeter() {\n\n // Live and Starting\n // var live = true;\n // var starting = false;\n\n\n // if (day != 4) {\n // live = false;\n // }\n // if (hours < 1 || hours > 1) {\n // live = false;\n // }\n\n // Live and Starting\n var tweet;\n // if (live | testing) {\n // Tweet undefined if it goes the LSTM route\n tweet = generateTweet();\n // Make sure nothing offensive\n while (tweet && wordfilter.blacklisted(tweet)) {\n tweet = generateTweet();\n }\n // }\n\n // Go ahead\n // if ((live || testing) && tweet) {\n if (tweet) {\n tweetIt(tweet);\n }\n\n\n}", "function getTweets() {\n client.get('statuses/user_timeline', params, function (error, tweets, response) {\n if (!error) {\n for (var i = 0; i < tweets.length; i++) {\n console.log(mainDivider + \"\\nTweet Number \" + (i + 1) + \" - \" + handle + \": \" + tweets[i].text, \"\\nCreated at: \" + tweets[i].created_at);\n }\n }\n });\n}", "function tweetCorrection(tweet, correction) {\n twitter.postTweet({\n status: \"@\" + tweet.user.screen_name + \" *\" + correction,\n in_reply_to_status_id: tweet.id_str\n }, (err, response, body) => {\n console.error(\"TWEET ERROR:\", err);\n }, (data) => {\n var reply = JSON.parse(data);\n console.log(\"Tweeted correction to @\" + tweet.user.screen_name, reply.id);\n });\n}", "function my_tweets(){\n//This will show your last 20 tweets and when they were created at in your terminal/bash window.\n\tconsole.log(\"you are in tweets function\");\n\tTclient.get('statuses/user_timeline', {screen_name: 'shark1emon'}, function(error, tweets, response) {\n\t if(error) throw error;\n\t //var theobject = JSON.parse(tweets);\n\t for (var i = 0; i<20; i++)\n\t console.log(\"Tweet number \" +(i+1)+ \" was created at \" + tweets[i].created_at + \". The text is \" + tweets[i].text);\n\t});\n}", "function retrieveTweets() {\n\tvar client = new twitter(dataKeys.twitterKeys);\n\tvar params = { screen_name: 'arisefields'};\n\tclient.get('statuses/user_timeline', params, function(error, tweets, response) { \t\n\t\tif (!error) {\n\t\t\tvar data = []; //empty array to hold data\n\t\t\tfor (var i = 0; i < tweets.length; i++) {\n\t\t\t\tdata.push({\n\t\t\t\t'created at: ' : tweets[i].created_at,\n\t\t\t\t'Tweets: ' : tweets[i].text,\n\t\t\t\t'*******':\"*********************************************\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tconsole.log(data);\n\t\t}\n \t});\n}", "function getTwitter(){\n client.get('statuses/user_timeline.json?screen_name=codingbr&' + count, function (error, tweets, response) {\n //console.log(JSON.stringify(tweets, null, 2));\n for (var i = 0; i < tweets.length; i++) {\n console.log(JSON.stringify(tweets[i].created_at, null, 2));\n console.log(JSON.stringify(tweets[i].text, null, 2));\n console.log(\"*************************************************************\");\n }//end for loop\n\n });//end function\n }//end getTwitter function", "function tweet() {\n var tweeter = process.argv[3];\n var params = {screen_name: tweeter};\n client.get('statuses/user_timeline', params, function(error, tweets, response) {\n if (!error) {\n for (var i = 0; i < 20; i++) {\n console.log(tweets[i].text, tweets[i].created_at + '\\n');\n }\n }\n });\n}" ]
[ "0.69330895", "0.67947906", "0.67850083", "0.6692424", "0.6620952", "0.6603982", "0.65578175", "0.6497246", "0.6495469", "0.6428629", "0.6380684", "0.6373265", "0.63523585", "0.6338389", "0.6334066", "0.62974054", "0.621312", "0.6198642", "0.61970824", "0.61902773", "0.6172069", "0.6155964", "0.6155779", "0.61537933", "0.6145017", "0.6136231", "0.610627", "0.60835016", "0.60432893", "0.6032529", "0.6030169", "0.60268056", "0.60244334", "0.6022053", "0.60176516", "0.6002981", "0.59869266", "0.595993", "0.5954301", "0.5913281", "0.59025717", "0.58972895", "0.5894767", "0.5859459", "0.5857142", "0.584898", "0.58319396", "0.58290935", "0.5828597", "0.5826001", "0.58257556", "0.58024615", "0.57922024", "0.5789894", "0.5782833", "0.575803", "0.575432", "0.5746178", "0.5744997", "0.5741451", "0.5727801", "0.5719814", "0.57196647", "0.5711001", "0.57054716", "0.56976944", "0.5684763", "0.5673254", "0.5661432", "0.56584376", "0.56518215", "0.56506324", "0.5648548", "0.5642926", "0.5639227", "0.5638357", "0.56282824", "0.5622063", "0.5621666", "0.5619021", "0.5615188", "0.5613258", "0.560799", "0.56059045", "0.55922437", "0.55782694", "0.5574316", "0.5566854", "0.5559404", "0.5553868", "0.55494654", "0.5538687", "0.553816", "0.55337936", "0.5528255", "0.55268395", "0.5524683", "0.55204415", "0.55173904", "0.550889" ]
0.69899786
0
This section is for creating followtriggered event for the bot
function followed(eventMsg) { var name = eventMsg.source.name; var screenName = eventMsg.source.screen_Name; tweetIt('.@' + screenName + 'Thanks for follow!'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function followed(eventMsg){ //thank follower via reply tweet\r\n\tconsole.log(\"New Follower! \\n replying...\");\r\n\t// var name= eventMsg.source.name;\r\n\tvar screenName= eventMsg.source.screen_name;\r\n\ttweetIt('@' + screenName + ' thanks for the follow!');\r\n}", "function followed(event) {\n let name = event.source.name;\n let screenName = event.source.screen_name;\n let response = `Thanks for following me ${name} @${screenName}! Let's support @CIBAC_PartyList`\n //Posting the thank you tweet:\n T.post('statuses/update', {status: response}, tweeted);\n\n //System logging:\n console.log(`I was followed by ${name}${screenName}`);\n}", "joined() {\n this.app.setAlert(<Alert type=\"success\">{i18n('followed')}</Alert>);\n\n this.setState({\n changePending: false,\n });\n\n // Analytics tracking\n Backbone.trigger(\n 'analytics:trackEvent',\n 'Activity',\n 'Followed ' + this.props.followType,\n this.props.trackLabel,\n );\n }", "function followed(eventMsg) {\n console.log(\"Somebody followed me!\")\n var currentName = eventMsg.source.name;\n var userName = eventMsg.source.screen_name;\n tweetReply('Yay! I made a new friend! Thank you for following me @' + userName);\n}", "function followed(eventMsg) {\n var name = eventMsg.source.name;\n var screenName = eventMsg.source.screen_name;\n T.post('statuses/update', { status: '.@' + screenName + ' thanks for following!'}, tweeted);\n}", "function followed(eventMsg) {\n \tvar name = eventMsg.source.screen_name;\n \ttweetWelcome(name);\n }", "function followReply (eventMsg){\n\tvar userName = eventMsg.source.screen_name; //Grabs the follower's username\n const {screen_name, name} = eventMsg.source;\n \n if (userName != myUsername){\n \tconst tyMsg = 'Hi ' + screen_name + '!' + '\\n\\nThanks for following me! \\n\\nThis message was generated with a twitter bot I made using node.js! If you\\'d like to see how I did it, then follow this GitHub link! https://github.com/brad4au57/twitter-bot-project';\n\n \tconst obj = {\n \t\tscreen_name,\n \t\ttext: tyMsg \n \t}\n \t\n\t T.post('direct_messages/new', obj);\n\n /* console.log('Message sent!'); */ //Used to test that my message was sent to the new follower\n } \n}", "botHandler(event, reply, actions) {\n\n let senderID = event.sender.id;\n\n logger.debug(`Received event:${JSON.stringify(event)}`);\n\n // Handle the following cases\n // - user press a quick_reply (message.quick_reply.payload)\n // - user enter some text (message.text)\n // - user press a button to cause a postback (postback.payload)\n //\n let messageText = null;\n if (event.message) {\n if (event.message.quick_reply)\n messageText = event.message.quick_reply.payload;\n else if (event.message.text)\n messageText = event.message.text.toUpperCase();\n }\n else if (event.postback)\n messageText = event.postback.payload;\n\n let currentState = this.getUserState(senderID);\n\n if (messageText === MSG.GETSTARTED) {\n let newState = STATE.INTRO_ACCOUNT_LINKING;\n this.setUserState(senderID, newState);\n this.send_LinkAccount(reply, actions, senderID);\n }\n else if (messageText === MSG.ACCOUNTLINKED_YES || messageText === MSG.ACCOUNTLINKED_NO) {\n // TODO: 如果是在INTRO_ACCOUNT_LINKING的State時, 可以根據AccountLinking的狀態來決定下一個動作\n //\n let newState = currentState == STATE.INTRO_ACCOUNT_LINKING ? STATE.INTRO_NEWS_SUBSCRIPTION : STATE.READY;\n this.setUserState(senderID, newState);\n if (newState == STATE.INTRO_NEWS_SUBSCRIPTION) {\n this.send_NewsSubscription(reply, actions);\n }\n else {\n this.send_Ready(reply, actions);\n }\n }\n else if (messageText === MSG.SUBSCRIBE_NEWS) {\n this.send_NewsSubscription(reply, actions);\n }\n else if (messageText === MSG.SUBSCRIBE_NEWS_YES || messageText === MSG.SUBSCRIBE_NEWS_NO) {\n // TODO: update user's news subscription status\n //\n this.setUserState(senderID, STATE.READY);\n this.send_Ready(reply, actions);\n }\n else if (messageText === MSG.QUERYSTOCK) {\n this.send_QueryStock(reply, actions, senderID);\n }\n else if (messageText) {\n //\n let stocks = this.parseStockId(messageText);\n let msg = null;\n if (stocks.length == 1) {\n // match one stock\n //\n let stock = stocks[0];\n msg = {\n attachment: {\n type: \"template\",\n payload: {\n template_type: \"button\",\n text: this.getStockStatus(stock),\n buttons:[\n {\n type: \"web_url\",\n url: this.SERVER_URL + '/stock?stockid=' + stock,\n title: '更多資訊...',\n messenger_extensions: true\n }\n ]\n }\n },\n quick_replies: this.getUserFavStocks(senderID)\n }\n }\n else if (stocks.length > 1) {\n // multiple matches\n //\n let buttons = _.map(stocks, (stock)=> {\n return {\n type: \"postback\",\n title: stock,\n payload: stock\n }\n });\n\n msg = {\n attachment: {\n type: \"template\",\n payload: {\n template_type: \"button\",\n text: '請選擇以下股票',\n buttons: buttons\n }\n },\n quick_replies: this.getUserFavStocks(senderID)\n }\n }\n\n if (msg) {\n actions.setTyping(true);\n reply(msg, (err)=> {\n actions.setTyping(false);\n if (err)\n this.botError(err);\n });\n }\n else {\n this.send_Ready(reply, actions);\n }\n }\n else {\n this.send_Ready(reply, actions);\n }\n }", "function followed (data) {\n let name = data.source.name\n let screenName = data.source.screen_name\n let response = 'Thanks for following the xDAI Twitter Bot, ' + name + ' @' + screenName + '. Your wallet information has been sent. Source code located here: ' + sourceCode\n \n // Post Twitter Message\n Twitter.post('statuses/update', { status: response }, tweeted)\n\n // DM user \n\n console.log('Followed by: ' + name + ' @' + screenName)\n}", "function createEventForUser(followers){\n var deferred = q.defer();\n return Followers.create(followers, function (error, response) {\n if(error)\n deferred.reject(error);\n else\n deferred.resolve(response);\n });\n return deferred.promise;\n }", "function additionalInformation(event, senderId) {\n allSenders[senderId].states++;\n allSenders[senderId].aboutMe = event.message.text; \n sendFBmessage.sendQuickReplies(senderId, saveText, -1, model.answerVariants.savePostback);\n}", "function follow() {\n UserService.follow(vm.currentUser, vm.user)\n .then(res => {\n vm.user.followers.push(vm.currentUser._id);\n vm.isFollowed = true;\n\n // send notification to the server that user is followed\n socket.emit('notification', {'to': vm.user._id, 'from': vm.currentUser._id, 'author': vm.currentUser.username, 'type': 'follow'});\n });\n }", "trackCustomEvent(context, eventName, keyValuePair) {\n let message = context.message;\n let address = message.address || {};\n let conversation = address.conversation || {};\n let user = address.user || {};\n let item = {\n timestamp: message.timestamp,\n channel: address.channelId,\n conversationId: conversation.id,\n userId: user.id,\n userName: user.name\n };\n //merge the custom properties with the defaults\n let eventData = Object.assign(item, keyValuePair);\n this.trackEvent(eventName, eventData);\n }", "function followUser(screenName) {\n bot.post('friendships/create', { screen_name: screenName }, (err, data, response) => {\n if (err) console.log(err)\n console.log(data)\n });\n}", "function onClickFollow(){\n if(compname === \"\"){\n notification['warning']({\n message: 'Function Error',\n description:\n 'There is no company selected.',\n });\n }else{\n notification['success']({\n message: 'Operation Success',\n description:\n `${compname} has been added to the following list. `,\n });\n }\n }", "addFollowerSpecific() {\n this.definition.extendedType = NSmartContract.SmartContractType.FOLLOWER1;\n\n let ownerLink = new roles.RoleLink(\"owner_link\", \"owner\");\n this.registerRole(ownerLink);\n\n let fieldsMap = {};\n fieldsMap[\"action\"] = null;\n fieldsMap[\"/expires_at\"] = null;\n fieldsMap[FollowerContract.PAID_U_FIELD_NAME] = null;\n fieldsMap[FollowerContract.PREPAID_OD_FIELD_NAME] = null;\n fieldsMap[FollowerContract.PREPAID_FROM_TIME_FIELD_NAME] = null;\n fieldsMap[FollowerContract.FOLLOWED_ORIGINS_FIELD_NAME] = null;\n fieldsMap[FollowerContract.SPENT_OD_FIELD_NAME] = null;\n fieldsMap[FollowerContract.SPENT_OD_TIME_FIELD_NAME] = null;\n fieldsMap[FollowerContract.CALLBACK_RATE_FIELD_NAME] = null;\n fieldsMap[FollowerContract.TRACKING_ORIGINS_FIELD_NAME] = null;\n fieldsMap[FollowerContract.CALLBACK_KEYS_FIELD_NAME] = null;\n\n let modifyDataPermission = new permissions.ModifyDataPermission(ownerLink, {fields : fieldsMap});\n this.definition.addPermission(modifyDataPermission);\n }", "onTrigger() {\n\n // Edit entity\n var action = this.option(\"actionID\")\n print(`[HF Scripter] Sending broadcast message: Channel = com.hf-scripter, action = ${action}`)\n Messages.sendMessage(\"com.hf-scripter\", JSON.stringify({ action }), false)\n\n }", "function webhook(from, date, subject, body) {\r\n axios.post('https://discord.com/api/webhooks/WEBHOOK_LINK_HERE', {\r\n embeds: [\r\n {\r\n author: {\r\n name: from\r\n },\r\n title: subject,\r\n description: body,\r\n color: \"16776960\",\r\n footer: {\r\n text: date\r\n }\r\n }\r\n ]\r\n }).then(res => {\r\n if (res.status >= 200 && res.status <= 299) console.log(\"Successfully sent to discord!\")\r\n else console.log(`Failed to send.. status code: ${res.status}`)\r\n }).catch(error => console.error(error))\r\n}", "function facebookCallback() {\n FB.Event.subscribe('edge.create', function() {\n goTo('twitter');\n });\n}", "function handleFollow(replyToken, source) {\n console.log(\"\\tGive introduction with token \" + replyToken);\n \n addUserToDatabase(source.userId);\n \n client.getProfile(source.userId)\n .then((profile) => {\n console.log(profile.displayName);\n console.log(profile.userId);\n var message = {\n type: 'text',\n text: 'Hai '+profile.displayName+' perkenalkan, saya Bang Teti. Saya akan melaporkan berita yang dapat dipercaya!'\n };\n \n client.replyMessage(replyToken, message)\n .then(() => console.log(\"\\tSending reply \" + replyToken))\n .catch((err) => {\n console.log(\"\\tTerjadi kesalahan \" + err)\n });\n })\n\n .catch((err) => {\n console.log(\"\\tTerjadi kesalahan profile\" + err)\n });\n \n}", "function EventHandler(context, event) {\n if (!context.simpledb.botleveldata.numinstance)\n context.simpledb.botleveldata.numinstance = 0;\n numinstances = parseInt(context.simpledb.botleveldata.numinstance) + 1;\n context.simpledb.botleveldata.numinstance = numinstances;\n context.sendResponse(\"Hello \"+event.senderobj.display+\"\\r\\nI am Praxis & how can I help you?\\r\\n\\r\\nTo know more just reply with 'more info' or 'about praxis'\\r\\n\\r\\nOr simply visit this link:\\r\\nbit.ly/praxisbot\");\n}", "function BOT_onIntent() {\r\n\tif(!BOT_theReqAction) return(BOT_reqSay(false,\"WARNING\",\"NEEDACTION\"));\r\n\tvar ta = [BOT_theReqTopic,BOT_theReqAction]; \r\n\tBOT_del(BOT_theUserTopicId,\"intention\",\"VAL\",ta);\r\n\tBOT_add(BOT_theUserTopicId,\"intention\",\"VAL\",ta);\r\n\tBOT_reqSay(true,\"NONE\",\"TAKEINTENTION\",BOT_theReqAction);\r\n}", "function notifyUser(username, artUrl, artHeadline, artSubhead){\n var message = {\n as_user: \"true\",\n \"attachments\": [\n {\n \"title\": artHeadline,\n \"title_link\": artUrl,\n \"text\": artSubhead\n }\n ]\n }\n bot.postTo(username,\"You've been published, check it out!\", message);\n}", "function BOT_onTell() {\r\n\tvar thebotobject = eval(BOT_theBotId);\r\n\tvar thebottopicid = thebotobject.topicId;\r\n\tif(BOT_theReqTopic == thebottopicid) { BOT_reqSay(false,\"ANGRY\",\"NOFACTSABOUTBOT\"); return }\r\n\tif( !BOT_theReqEqual || !BOT_theReqAttribute || !BOT_theReqValue) { BOT_reqSay(false,\"WARNING\",\"BADFACTFORMAT\"); return }\r\n\t// topic.attribute <- value\r\n\tif (!BOT_reqExistAttribute(BOT_theReqAttribute)) return;\r\n\tBOT_set(BOT_theReqTopic,BOT_theReqAttribute,\"VAL\",BOT_theReqValue);\r\n\tBOT_reqSay(true,\"HAPPY\",\"FACTSTORED\",BOT_theReqAttribute,BOT_theReqTopic,BOT_theReqValue);\r\n}", "async function createNewFollow() {\n await createFollow(follow);\n }", "function handleEvent(event) {\n switch (event.type) {\n case 'message':\n // create a echoing text message\n const echo = { type: 'text', text: event.message.text };\n\n // use reply API\n //return client.replyMessage(event.replyToken, echo);\n\n const message = event.message;\n switch (message.type) {\n case 'text':\n return client.replyMessage(event.replyToken, echo);\n return client.pushMessage(event.source.groupId, echo).catch((err)=>{\n console.log(err)\n });\n case 'image':\n return handleImage(message, event.replyToken);\n case 'video':\n return handleVideo(message, event.replyToken);\n case 'audio':\n return handleAudio(message, event.replyToken);\n case 'location':\n return handleLocation(message, event.replyToken);\n case 'sticker':\n return handleSticker(message, event.replyToken);\n default:\n throw new Error(`Unknown message: ${JSON.stringify(message)}`);\n }\n\n case 'follow':\n return replyText(event.replyToken, 'Got followed event');\n\n case 'unfollow':\n return console.log(`Unfollowed this bot: ${JSON.stringify(event)}`);\n\n case 'join':\n return replyText(event.replyToken, `Joined ${event.source.type}`);\n\n case 'leave':\n return console.log(`Left: ${JSON.stringify(event)}`);\n\n case 'postback':\n let data = event.postback.data;\n if (data === 'DATE' || data === 'TIME' || data === 'DATETIME') {\n data += `(${JSON.stringify(event.postback.params)})`;\n }\n return replyText(event.replyToken, `Got postback: ${data}`);\n\n case 'beacon':\n return replyText(event.replyToken, `Got beacon: ${event.beacon.hwid}`);\n\n default:\n throw new Error(`Unknown event: ${JSON.stringify(event)}`);\n }\n}", "onEventCreated(newEventRecord) {}", "function tweetEvent(eventMsg){\n\t\t\t\t\t//eventMsg is data from tweet (location, source screen name, text,) ..turn into JSON string \n\n//anytime someone sends a tweet to me i send a tweet back to them\n\tvar replyto = eventMsg.in_reply_to_screen_name;\n\tvar text = eventMsg.text;\n\tvar from = eventMsg.user.screen_name;\n\t\n\tconsole.log(replyto + '' + from);\n\n//if user mentions me (the bot) in their tweet, tweet this message \n\tif(replyto === 'tatiturin'){\n\t\tvar newTweet = '@' +from + 'wasssaap' ;\n\t\ttweetIt(newTweet);\n\t}\n\n}", "can_follow() {\n return true\n }", "function dailyTrigger() {\n postEventsToDiscord({\n calendars: calendar_list,\n webhooks: discord_webhooks,\n title: \"My calendar shit\",\n public_url: \"URL to public calendar (or any URL when you click the title)\"\n });\n}", "async function handleEvent(event) {\r\n if (event.replyToken && event.replyToken.match(/^(.)\\1*$/)) {\r\n return console.log(\"Test hook recieved: \" + JSON.stringify(event.message));\r\n }\r\n\r\n switch (event.type) {\r\n case \"message\":\r\n const message = event.message;\r\n switch (message.type) {\r\n case \"text\":\r\n return handleText(message, event.replyToken, event.source);\r\n case \"image\":\r\n return handleImage(message, event.replyToken);\r\n case \"video\":\r\n return handleVideo(message, event.replyToken);\r\n case \"audio\":\r\n return handleAudio(message, event.replyToken);\r\n case \"location\":\r\n return handleLocation(message, event.replyToken);\r\n case \"sticker\":\r\n return handleSticker(message, event.replyToken);\r\n default:\r\n throw new Error(`Unknown message: ${JSON.stringify(message)}`);\r\n }\r\n\r\n case \"follow\":\r\n return replyText(event.replyToken, \"Got followed event\");\r\n\r\n case \"unfollow\":\r\n return console.log(`Unfollowed this bot: ${JSON.stringify(event)}`);\r\n\r\n case \"join\":\r\n return replyText(event.replyToken, `Joined ${event.source.type}`);\r\n\r\n case \"leave\":\r\n return console.log(`Left: ${JSON.stringify(event)}`);\r\n\r\n case \"postback\":\r\n let data = event.postback.data;\r\n if (data === \"DATE\" || data === \"TIME\" || data === \"DATETIME\") {\r\n data += `(${JSON.stringify(event.postback.params)})`;\r\n }\r\n return replyText(event.replyToken, `Got postback: ${data}`);\r\n\r\n case \"beacon\":\r\n return replyText(event.replyToken, `Got beacon: ${event.beacon.hwid}`);\r\n\r\n default:\r\n throw new Error(`Unknown event: ${JSON.stringify(event)}`);\r\n }\r\n}", "async function logUserConversation (event, type) {\n if (event.type == \"message\" && event.text) {\n // console.log(event);\n var params = {\n fb_id: event.address.user.id,\n message_body: {\n message: event.text,\n message_type: type,\n }\n }; \n console.log(\"intercept is working\"); \n usersession.newMessageFromBot(params);\n } \n}", "function receivedGameplay(event) {\n console.log(\"Soficita Webhook received gameplay event: \", event);\n // Page-scoped ID of the bot user\n var senderId = event.sender.id; \n\n // FBInstant player ID\n var playerId = event.game_play.player_id; \n\n // FBInstant context ID \n var contextId = event.game_play.context_id;\n console.log(\"contextId: \"+contextId);\n\n \n\n // Check for payload\n if (event.game_play.payload) {\n //\n // The variable payload here contains data set by\n // FBInstant.setSessionData()\n //\n var payload = JSON.parse(event.game_play.payload);\n console.log(\"Payload: \"+JSON.stringify(payload));\n // In this example, the bot is just \"echoing\" the message received\n // immediately. In your game, you'll want to delay the bot messages\n // to remind the user to play 1, 3, 7 days after game play, for example.\n console.log(\"Vamos a enviar un mensaje por que el jugador acaba de salir del juego\");\n sendMessage(senderId, null, \"Quieres jugar de nuevo?\", \"Jugar!\", payload);\n }else{\n console.log(\"No hay payload\");\n sendMessageAux(senderId, null, \"Quieres jugar de nuevo?\", \"Jugar!\");\n }\n}", "async function followRequestCall() {\n try {\n const response = await Axios.post(`/addFollow/${state.profileData.profileUsername}`, { token: appState.user.token }, { cancelToken: followRequest.token })\n setState(draft => {\n draft.profileData.isFollowing = true\n draft.profileData.counts.followerCount++\n draft.followActionRunning = false\n })\n } catch (error) {\n console.log(\"There was a problem following user or user cancelled\")\n }\n }", "track({eventType, args}) {\n this.handleEvent(eventType, args);\n }", "function follow(id)\n{\n\t\t$.post(\"/follow/execute\", {\"follow\": \"yes\", \"id\": id},function(data)\n\t\t{\n\t\t\t\tif(data.state==\"success\")\n\t\t\t\t\t\tnotify(\"Vous suivez désormais \" + data.follow +\".\");\n\t\t\t\telse\n\t\t\t\t\t\tnotify(\"Une erreur est survenue.\");\n\t\t} );\n}", "handleTextMessage(lastevent) {\n console.log(\"---------Llamando a handleTextMessage----------\");\n console.log(\"Payload handleTextMessage\");\n console.log(\n \"Received text:\",\n `${this.webhookEvent.message.text} for ${this.user.psid}`\n );\n\n // check greeting is here and is confident\n console.log(\"Es un message nlp\");\n console.log(this.webhookEvent.message.nlp);\n console.log(\"Entidades\");\n console.log(this.webhookEvent.message.nlp.entities);\n\n let greeting = this.firstEntity(this.webhookEvent.message.nlp, \"greetings\");\n console.log(\"Greeting\");\n console.log(greeting);\n let message = this.webhookEvent.message.text.trim().toLowerCase();\n console.log(\"message\");\n console.log(message);\n let response;\n if (\n (greeting && greeting.confidence > 0.8) ||\n message.includes(\"start over\")\n ) {\n response = Response.genNuxMessage(this.user);\n } else {\n if (lastevent === \"getstarted\") {\n response = [Response.genText(i18n.__(\"fallback.wrong\"))];\n } else if (lastevent === \"select_input\") {\n response = [\n Response.genQuickReply(i18n.__(\"fallback.wrong\"), [\n {\n title: i18n.__(\"menu.complaints_1\"),\n payload: \"complaints_1\"\n },\n {\n title: i18n.__(\"menu.complaints_2\"),\n payload: \"complaints_2\"\n },\n {\n title: i18n.__(\"menu.complaints_3\"),\n payload: \"complaints_3\"\n },\n {\n title: i18n.__(\"menu.complaints_4\"),\n payload: \"complaints_4\"\n }\n ])\n ];\n } else if (lastevent === \"confirm_input\") {\n if (this.user.complaintType === \"complaints_1\") {\n response = [\n Response.genQuickReply(i18n.__(\"fallback.wrong\"), [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"yes_1\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"no\"\n }\n ]),\n { complaintType: \"complaints_1\" }\n ];\n }\n if (this.user.complaintType === \"complaints_2\") {\n response = [\n Response.genQuickReply(i18n.__(\"fallback.wrong\"), [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"yes_2\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"no\"\n }\n ]),\n { complaintType: \"complaints_2\" }\n ];\n }\n if (this.user.complaintType === \"complaints_3\") {\n response = [\n Response.genQuickReply(i18n.__(\"fallback.wrong\"), [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"yes_3\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"no\"\n }\n ]),\n { complaintType: \"complaints_3\" }\n ];\n }\n if (this.user.complaintType === \"complaints_4\") {\n response = [\n Response.genQuickReply(i18n.__(\"fallback.wrong\"), [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"yes_4\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"no\"\n }\n ]),\n { complaintType: \"complaints_4\" }\n ];\n }\n } else if (lastevent === \"nombre\") {\n let responseData = Response.genText(\n i18n.__(\"fallback.dni\", {\n message: this.webhookEvent.message.text\n })\n );\n let payloadData = {\n payload: this.webhookEvent.message.text,\n user: this.user.psid\n };\n response = [responseData, payloadData];\n } else if (lastevent === \"dni\") {\n let first = Response.genText(i18n.__(\"fallback.birthday\"));\n let payloadData = {\n payload: this.webhookEvent.message.text,\n user: this.user.psid\n };\n response = [first, payloadData];\n } else if (lastevent === \"birthday\") {\n let first = Response.genText(i18n.__(\"fallback.cel\"));\n let payloadData = {\n payload: this.webhookEvent.message.text,\n user: this.user.psid\n };\n response = [first, payloadData];\n } else if (lastevent === \"cel\") {\n let celMessage = this.firstEntity(\n this.webhookEvent.message.nlp,\n \"phone_number\"\n );\n if (celMessage && celMessage.confidence > 0.8) {\n let first = Response.genText(i18n.__(\"fallback.email\"));\n let payloadData = {\n payload: this.webhookEvent.message.text,\n user: this.user.psid\n };\n response = [first, payloadData];\n } else {\n response = [Response.genText(i18n.__(\"fallback.wrong\"))];\n }\n } else if (lastevent === \"email\") {\n let emailMessage = this.firstEntity(\n this.webhookEvent.message.nlp,\n \"email\"\n );\n if (emailMessage && emailMessage.confidence > 0.8) {\n let first = Response.genText(i18n.__(\"fallback.address\"));\n let payloadData = {\n payload: this.webhookEvent.message.text,\n user: this.user.psid\n };\n response = [first, payloadData];\n } else {\n response = [Response.genText(i18n.__(\"fallback.wrong\"))];\n }\n } else if (lastevent === \"address\") {\n let first = Response.genText(i18n.__(\"fallback.photoquestion\"));\n let payloadData = {\n payload: this.webhookEvent.message.text,\n user: this.user.psid\n };\n response = [first, payloadData];\n } else if (lastevent === \"preparationquestion\") {\n response = [\n Response.genQuickReply(i18n.__(\"fallback.wrong\"), [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"yes_confirmation\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"deny_confirmation\"\n }\n ])\n ];\n console.log(\"Receive.js 135 help\");\n console.log(\"---------Llamando a handleAttachmentMessage----------\");\n console.log(\"Payload handleAttachmentMessage\");\n console.log(response);\n } else if (lastevent === \"when\") {\n let first = Response.genText(i18n.__(\"fallback.scenefact\"));\n let payloadData = {\n payload: this.webhookEvent.message.text,\n user: this.user.psid\n };\n response = [first, payloadData];\n } else if (lastevent === \"where\") {\n let first = Response.genText(i18n.__(\"fallback.specificfact\"));\n let second;\n if (this.user.typeOfReport === \"yes_1\") {\n second = Response.genText(i18n.__(\"fallback.details1\"));\n } else if (this.user.typeOfReport === \"yes_2\") {\n second = Response.genText(i18n.__(\"fallback.details2\"));\n } else if (this.user.typeOfReport === \"yes_3\") {\n second = Response.genText(i18n.__(\"fallback.details3\"));\n } else if (this.user.typeOfReport === \"yes_4\") {\n second = Response.genText(i18n.__(\"fallback.details4\"));\n }\n let payloadData = {\n payload: this.webhookEvent.message.text,\n user: this.user.psid\n };\n response = [first, second, payloadData];\n }\n //how\n else if (lastevent === \"recomendation1\") {\n let first = Response.genText(i18n.__(\"fallback.recomendation1\"));\n\n let second = Response.genQuickReply(i18n.__(\"fallback.evidence\"), [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"accept_evidence\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"decline_evidence\"\n }\n ]);\n let payloadData = {\n payload: this.webhookEvent.message.text,\n user: this.user.psid\n };\n response = [first, second, payloadData];\n } else if (lastevent === \"recomendation2\") {\n let first = Response.genText(i18n.__(\"fallback.recomendation2\"));\n\n let second = Response.genQuickReply(i18n.__(\"fallback.evidence\"), [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"accept_evidence\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"decline_evidence\"\n }\n ]);\n let payloadData = {\n payload: this.webhookEvent.message.text,\n user: this.user.psid\n };\n response = [first, second, payloadData];\n } else if (lastevent === \"recomendation3\") {\n let first = Response.genText(i18n.__(\"fallback.recomendation3\"));\n\n let second = Response.genQuickReply(i18n.__(\"fallback.evidence\"), [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"accept_evidence\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"decline_evidence\"\n }\n ]);\n let payloadData = {\n payload: this.webhookEvent.message.text,\n user: this.user.psid\n };\n response = [first, second, payloadData];\n } else if (lastevent === \"recomendation4\") {\n let first = Response.genText(i18n.__(\"fallback.recomendation4\"));\n\n let second = Response.genQuickReply(i18n.__(\"fallback.evidence\"), [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"accept_evidence\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"decline_evidence\"\n }\n ]);\n let payloadData = {\n payload: this.webhookEvent.message.text,\n user: this.user.psid\n };\n response = [first, second, payloadData];\n } else {\n let first = Response.genText(\n i18n.__(\"fallback.any\", {\n message: this.webhookEvent.message.text\n })\n );\n let second = {\n payload: \"incorrect\",\n user: this.user.psid\n };\n\n response = [first, second];\n }\n console.log(\"Receive 114.js help\");\n }\n\n return response;\n }", "function triggerEvent (name, object) {\n if (isEventEnabled(name) && enablePostMessage) {\n sendMessage({\n type: \"event\",\n action: \"result\",\n event: name,\n result: object\n });\n }\n}", "[BATCH_EVENTS_FROM_WEBHOOK]() {\n batchEvents(store, JSON.parse(payload.headers.webhookbody));\n }", "function saveInformation(event, senderId) {\n allSenders[senderId].states++;\n if (event.message.quick_reply.payload === 'Yes_postback') {\n model.insertData(senderId);\n sendFBmessage.send(senderId, [{text:'Thank you, ' + allSenders[senderId].name + ' \\u263A \\nOur HR-manager will contact you within 3 days.'}]);\n // send giffy when user save information about yourself in our database\n sendFBmessage.sendImage(senderId, 'http://media3.giphy.com//media//Mp4hQy51LjY6A//200.gif');\n } else {\n sendFBmessage.send(senderId, [{text:'Information about you was not saved.'}]);\n sendFBmessage.sendImage(senderId, 'http://media0.giphy.com//media//7ILa7CZLxE0Ew//200.gif');\n }\n}", "follow(entity) {\n this.following = entity;\n }", "function followClicked(memberID, loginName) {\n // call the function to add json object that contains\n // the id of the member followed and the login name\n addFollow({\n id: memberID,\n login: loginName,\n }).then((newFollow) => {\n // 'update' the list of people followed\n setFollowed(followed.concat(newFollow));\n });\n }", "function testHandler(agent) {\n console.log('in test handler');\n let text = 'This is a test message, when you see this, it means your webhook fulfillment worked!';\n agent.add(text);\n}", "on_message(message) {\r\n }", "on_message(message) {\r\n }", "on_message(message) {\r\n }", "function receivedAccountLink(senderId, accountLinking) {\n console.trace(\"[receivedMessage] Procesando evento webhook 'account_linking': %j\", accountLinking);\n\n let status = accountLinking.status;\n\n if (status === 'unlinked') {\n // GLOZADA: Apartado para desvincular la cuenta\n console.trace(\"[receivedAccountLink] Se ha recibido la solicitud para desvincular el usuario: \", senderId);\n /** GLOZADA: PENDIENTE IMPLEMENTAR\n llamada a un servicio REST que haga lo contrario a URI_AUT_REST_LINKUSER, donde se \n elimine/inactibe el registro de BD mongo donde queda vinculado el usuario.\n */\n\n redis.del(\"UsuarioFB:\" + senderId).then(() => { callSendAPI(senderId, textoToMensajeGenerico(\"Sesion Finalizada\")); });\n return;// Obliga a finalizar el procesamiento del mensaje\n }\n // GLOZADA: Apartado para vincular la cuenta\n // authorization_code es generado al final de la autenticacion en la app Bot-AutenticacionBE\n var authCode = accountLinking.authorization_code;\n\n console.trace(\"[receivedAccountLink] Se ha recibido la solicitud para registrar la vinculacion\"\n + \" del usuario: %s, con el codigo de autorizacion:\", senderId, authCode);\n\n // GLOZADA: PENDIENTE IMPLEMENTAR: Verificar porque se persiste antes de verificar si se \n // ha registrado la vinculacion en el Bot-AutenticacionBE, este deberia almacenarse\n // una vez verificado la llamada al REST lin kUserFB y que se almacene con timeout configurado\n // ORIGINAL: Se movio para mejorar la ubicacion del registro de sesion de usuario autenticado\n // en redis\n // redis.set(senderId, authCode);\n\n // GLOZADA: Llama al api de autenticacion para registrar el senderId y relacionarlo.\n let optionsLinkUser = {\n \"method\": 'POST',\n // ORIGINAL: uri: config.get('uriAuthenticationBase') + '/linkUserFB',\n \"uri\": URI_AUT_REST_LINKUSER,\n // GLOZADA Informacion requerida por el servicio REST para vincular el usuario\n \"json\": {\n \"authCode\": authCode,\n \"senderId\": senderId\n }\n };\n /** GLOZADA: PENDIENTE IMPLEMENTAR\n * Separar la vinculacion de cuenta con el inicio de conversacion con el chatbot. \n */\n request(optionsLinkUser, function (error, response, body) {\n console.info(\"[receivedAccountLink] Response llamada servicio REST /linkUserFB. \");\n // GLOZADA: se descomenta el log solo para depuraciones de servicios REST\n // console.trace(\"[receivedAccountLink] Response llamada servicio REST /linkUserFB. response: \", jsonToTextoIdentado(response));\n\n if (!error && response.statusCode == 200) {\n console.trace(\"[receivedAccountLink] Usuario vinculado y registrado:\", senderId);\n\n // GLOZADA: Agregado para mejorar el lugar donde se registro de sesion de usuario autenticado\n redis.set(\"UsuarioFB:\" + senderId, authCode).then(function (resBD) {\n if (resBD !== 'OK') {\n sendErrorMessage(senderId, \"receivedAccountLink_redis_vinculacion_usuario\", new Error(\"Se produjo un error\"\n + \"al registrar la vinculacion del usuario en Redis BD\"));\n } else {\n // GLOZADA: Hace la llamada a la app Bot-NLP para generar el mensaje inicial de respuesta al usuario\n let optionsInitChat = {\n \"method\": 'GET',\n // ORIGINAL: uri: config.get('uriNPLBase') + '/initChat?token=' + authCode\n \"uri\": URI_NLP_REST + '/initChat?token=' + authCode\n };\n request(optionsInitChat, function (error1, response1, body1) {\n // GLOZADA: se descomenta el log solo para depuraciones de servicios REST\n console.trace(\"[receivedAccountLink] Response llamada servicio REST /initChat. response:\" , jsonToTextoIdentado(response1));\n if (!error1 && response1.statusCode == 200) {\n console.trace(\"[receivedAccountLink] Usuario autenticado en la aplicacion Bot-NLP\");\n let bodyObj = JSON.parse(body1);\n callSendAPI(senderId, {\n \"text\": bodyObj['text'],\n \"metadata\": \"INIT_BOT\"\n });\n } else {\n sendErrorMessage(senderId, \"receivedAccountLink_initChat\", error1, body1);\n }\n });\n }\n\n });\n } else {\n sendErrorMessage(senderId, \"receivedAccountLink_linkUserFB\", error, body);\n }\n });\n}", "function follow(actionIsFollow) {\n let button = $(\"#buttonFollow\");\n\n // Si disabilita il bottone finché non arriva una risposta.\n button.attr(\"disabled\", true);\n\n let target = actionIsFollow ? \"/follow\" : \"/unfollow\";\n\n $.ajaxSetup({\n headers: {\n 'X-CSRF-TOKEN': $('meta[name=\"csrf-token\"]').attr('content')\n }\n });\n $.post(target,\n {\n targetId: parseInt($(\"#userID\").text())\n },\n function (data, status, xhr) {\n if (data.result) {\n // Modifica dell'aspetto del bottone\n button.toggleClass(\"btn-primary\");\n button.toggleClass(\"btn-outline-primary\");\n let newButtonText = actionIsFollow ? \"Seguito\" : \"Segui\";\n button.text(newButtonText);\n\n // Modifica del numero dei follower\n // NB: Questa operazione viene eseguita SOLO se il numero dei follower è inferiore a 1000!\n let followersSpan = button.parents(\".row\").prev().find(\"div:first-child > span:last-child\");\n if (!followersSpan.text().match(/[a-z]/i)) {\n let followersCount = parseInt(followersSpan.text());\n let delta = actionIsFollow ? +1 : -1;\n followersSpan.text(followersCount + delta);\n }\n\n // Modifica della funzione associata al bottone\n let newFunction = actionIsFollow ? \"executeUnfollow\" : \"executeFollow\";\n button.attr(\"onclick\", newFunction + \"()\");\n\n // Modifica dell'elenco dei followed\n if (actionIsFollow) $(\"#followedList ul\").append($(\"<li><a style='word-break: break-all' href='/user/\"+$(\"#userID\").text().trim()+\"'>\"+$(\"#username\").text()+\"</a></li>\"));\n else{\n let username = $(\"#username\").text().trim();\n $(\"#followedList li:contains(\"+username+\")\").remove();\n }\n }\n\n button.attr(\"disabled\", false);\n }, \"json\")\n .always(function () {\n // A prescindere dal tipo di risposta ricevuta, il bottone viene sempre riattivato\n button.attr(\"disabled\", false);\n });\n}", "run () {\n this._client.on('messageCreate', this.onMessageCreateEvent.bind(this))\n this._client.on('messageReactionAdd', this.onMessageReactionEvent.bind(this))\n this._client.on('messageReactionRemove', this.onMessageReactionEvent.bind(this))\n }", "function onInvite() {\n console.log('onInvite args: ', arguments);\n }", "function add_paf_analytics() {\n // Check it out; btn.\n paf.on('#edit-submit-btn-in', 'click', undefined, 'NewUserOnboardingPromptTry');\n // No thanks; btn.\n paf.on('#edit-submit-btn-out', 'click', undefined, 'NewUserOnboardingPromptNo');\n // Toast is presented.\n paf.trigger('NewUserOnboardingPromptImpression');\n // User clicks dismiss; bad move buddy.\n paf.on('#optinToast .cp-modal-close', 'click', undefined, 'NewUserOnboardingPromptDismiss');\n }", "function trackAction({ type, payload }) {\n const isMparticleDefinedGlobally = typeof mParticle !== 'undefined';\n const isGADefinedGlobally = typeof ga !== 'undefined';\n if (type === MPARTICLE_META_TYPE && isMparticleDefinedGlobally) {\n trackEvent(payload.name, payload.attributes, { providers: [mParticle] });\n return;\n }\n if (isGADefinedGlobally) {\n if (type === 'route-transition') {\n // send rough estimate of how far you scrolled on the last page\n trackEvent(\n null,\n {\n eventCategory: 'Page',\n eventAction: 'Scroll',\n eventLabel: 'Percent',\n eventValue: getScrollPercentage(),\n },\n { providers: [ga] }\n );\n // special case: transition to new page in metrics\n ga('set', 'page', window.location.pathname + window.location.search);\n ga('send', 'pageview');\n // special case (mParticle)\n const screenName = getScreenFromRoute(payload.pathname);\n if (screenName && !IGNORE_TRACK_SCREEN_VIEW.includes(screenName)) {\n trackScreenView(screenName);\n }\n }\n if (type === 'event-sharing-copytext') {\n trackEvent(\n null,\n {\n eventCategory: 'Sharing',\n eventAction: 'Copy Text',\n eventLabel: payload.target,\n },\n { providers: [ga] }\n );\n }\n if (type === 'event-sharing-click') {\n trackEvent(\n null,\n {\n eventCategory: 'Sharing',\n eventAction: 'Click',\n eventLabel: payload.target,\n },\n { providers: [ga] }\n );\n }\n if (type === 'event-account-click') {\n trackEvent(\n null,\n {\n eventCategory: 'Account',\n eventAction: 'Click',\n eventLabel: payload.target,\n },\n { providers: [ga] }\n );\n }\n if (type === 'event-account-submit') {\n trackEvent(\n null,\n {\n eventCategory: 'Account',\n eventAction: 'Submit',\n eventLabel: payload.target,\n },\n { providers: [ga] }\n );\n }\n if (type === 'event-homepage-carousel') {\n const params = {\n eventCategory: 'Home Page',\n eventAction: 'Carousel',\n eventLabel: payload.target,\n };\n if (typeof payload.value !== 'undefined') {\n params.eventValue = payload.value;\n }\n trackEvent(null, params, { providers: [ga] });\n }\n if (type === 'event-homepage-click') {\n const params = {\n eventCategory: 'Home Page',\n eventAction: 'Click',\n eventLabel: payload.target,\n };\n if (typeof payload.value !== 'undefined') {\n params.eventValue = payload.value;\n }\n trackEvent(null, params, { providers: [ga] });\n }\n if (type === 'event-archive-click') {\n trackEvent(\n null,\n {\n eventCategory: 'Archive',\n eventAction: 'Click',\n eventLabel: payload.target,\n },\n { providers: [ga] }\n );\n }\n if (type === 'event-onboarding-click') {\n const params = {\n eventCategory: 'Onboarding',\n eventAction: 'Click',\n eventLabel: payload.target,\n };\n if (typeof payload.value !== 'undefined') {\n params.eventValue = payload.value;\n }\n trackEvent(null, params, { providers: [ga] });\n }\n if (type === 'event-episode-editor-submit') {\n const params = {\n eventCategory: 'Episode Editor',\n eventAction: 'Submit',\n eventLabel: payload.target,\n eventValue: payload.value,\n location: 'episode_edit',\n };\n if (typeof payload.value !== 'undefined') {\n params.eventValue = payload.value;\n }\n trackEvent('publish_button_clicked', params, { providers: [ga] });\n }\n\n // playback events below\n if (\n type === 'event-playback-click' ||\n type === 'event-playback-pause' ||\n type === 'event-playback-play'\n ) {\n if (payload && payload.target) {\n // non-user-initiated play/pause have no targets\n const params = {\n eventCategory: 'Playback',\n eventAction: 'Click',\n eventLabel: payload.target,\n };\n if (typeof payload.value !== 'undefined') {\n params.eventValue = payload.value;\n }\n trackEvent(null, params, { providers: [ga] });\n }\n }\n if (type === 'event-playback-expired') {\n trackEvent(\n null,\n {\n eventCategory: 'Playback',\n eventAction: 'Expired',\n eventLabel: payload.target,\n },\n { providers: [ga] }\n );\n }\n if (type === 'event-playback-listen') {\n trackEvent(\n null,\n {\n eventCategory: 'Playback',\n eventAction: 'Listen',\n eventValue: payload.value,\n },\n { providers: [ga] }\n );\n }\n if (type === 'event-listener-support-creator') {\n const params = {\n eventCategory: 'listener_support_creator',\n eventAction: payload.type,\n };\n if (payload.target) {\n params.eventLabel = payload.target;\n }\n trackEvent(null, params, { providers: [ga] });\n }\n if (type === 'event-listener-support') {\n const params = {\n eventCategory: 'listener_support',\n eventAction: payload.type,\n };\n if (payload.target) {\n params.eventLabel = payload.target;\n }\n trackEvent(null, params, { providers: [ga] });\n }\n }\n}", "function receivedPostback(event) {\n console.log(event);\n\n var senderID = event.sender.id;\n var recipientID = event.recipient.id;\n var timeOfPostback = event.timestamp;\n\n // The 'payload' param is a developer-defined field which is set in a postback\n // button for Structured Messages.\n var payload = event.postback.payload;\n console.log(payload.indexOf(' ') !== -1);\n if (payload.indexOf(' ') !== -1) {\n sendToApiAi(senderID, payload);\n } else {\n handleApiAiAction(senderID, payload, \"\", \"\", \"\")\n }\n\n\n console.log(\n \"Received postback for user %d and page %d with payload '%s' \" + \"at %d\",\n senderID,\n recipientID,\n payload,\n timeOfPostback\n );\n\n}", "function newEvent(data = {\n \"user_id\": user_id,\n \"mapset_id\": mapset_id,\n \"mapset_info\": mapset_info,\n \"is_qualify\": is_qualify,\n \"is_nominate\": is_nominate,\n \"is_disqualify\": is_disqualify,\n \"is_reset\": is_reset,\n \"is_rank\": is_rank,\n \"is_love\": is_love,\n \"history\": history,\n \"datetime\": datetime,\n \"beatmaps\": beatmaps,\n \"users\": users,\n \"reason\": reason,\n \"discussion_post\": discussion_post\n}) {\n try {\n for (webHook of clients.clients){\n let webhookClientMapfeed = new Discord.WebhookClient(webHook.WEBHOOK_MAPFEED.ID, webHook.WEBHOOK_MAPFEED.TOKEN);\n let diffs = [];\n let modes = [];\n for (var diff of data.beatmaps) {\n if (diff.difficulty_rating == 0 || diff.deleted_at != null)\n continue;\n diffs.push({\n \"diffname\": diff.version,\n \"star_rating\": diff.difficulty_rating,\n \"diff\": utils.getMapDifficulty(diff.difficulty_rating),\n \"diff_emoji\": webHook.emojis[utils.getMapDifficultyEmoji(diff.difficulty_rating)]\n })\n if (diff.mode == \"osu\" && !modes.includes(\"[osu]\"))\n modes.push(\"[osu]\")\n if (diff.mode == \"fruits\" && !modes.includes(\"[catch]\"))\n modes.push(\"[catch]\")\n if (diff.mode == \"mania\" && !modes.includes(\"[mania]\"))\n modes.push(\"[mania]\")\n if (diff.mode == \"taiko\" && !modes.includes(\"[taiko]\"))\n modes.push(\"[taiko]\")\n }\n diffs.sort(function (a, b) {\n return a.star_rating - b.star_rating;\n })\n\n let listModes = \"\";\n for (var i = 0; i < modes.length; i++) {\n listModes += modes[i];\n }\n\n let nominator = null;\n for (u of data.users) {\n if (data.user_id == u.id) {\n if (u.groups[0].identifier == \"bng_limited\") {\n nominator = {\n \"name\": u.username,\n \"badge\": \"PROBATION\",\n \"id\": u.id,\n \"avatar_url\": u.avatar_url\n }\n } else {\n nominator = {\n \"name\": u.username,\n \"badge\": u.groups[0].short_name,\n \"id\": u.id,\n \"avatar_url\": u.avatar_url\n } \n }\n }\n }\n let diffList = \"\\n\\n\";\n for (d of diffs) {\n diffList += `${d.diff_emoji}`;\n }\n if (webHook.SHOW_DIFFS == false) {\n diffList = \"\";\n }\n let mapHistory = \"\";\n if (data.history != undefined) {\n for (eve of data.history) {\n switch (eve.type) {\n case \"qualify\":\n if (webHook.SHOW_BADGES === false)\n mapHistory += `:heart: ${utils.getUserFromList(eve.user_id, data.users).name} `;\n else\n mapHistory += `:heart: ${utils.getUserFromList(eve.user_id, data.users).name} [**${utils.getUserFromList(eve.user_id, data.users).badge}**] `; \n break;\n case \"nominate\":\n if (webHook.SHOW_BADGES === false)\n mapHistory += `:thought_balloon: ${utils.getUserFromList(eve.user_id, data.users).name} `;\n else\n mapHistory += `:thought_balloon: ${utils.getUserFromList(eve.user_id, data.users).name} [**${utils.getUserFromList(eve.user_id, data.users).badge}**] `;\n break;\n case \"nomination_reset\":\n if (webHook.SHOW_BADGES === false)\n mapHistory += `:anger_right: ${utils.getUserFromList(eve.user_id, data.users).name} `;\n else\n mapHistory += `:anger_right: ${utils.getUserFromList(eve.user_id, data.users).name} [**${utils.getUserFromList(eve.user_id, data.users).badge}**] `;\n break;\n case \"disqualify\":\n if (webHook.SHOW_BADGES === false)\n mapHistory += `:broken_heart: ${utils.getUserFromList(eve.user_id, data.users).name} `;\n else \n mapHistory += `:broken_heart: ${utils.getUserFromList(eve.user_id, data.users).name} [**${utils.getUserFromList(eve.user_id, data.users).badge}**] `;\n break;\n }\n }\n }\n if (data.is_nominate && data.is_qualify == false) {\n let msg = new Discord.MessageEmbed().setThumbnail(data.mapset_info.thumb)\n .addField(`:thought_balloon: Nominated`, `[${data.mapset_info.artist} - ${data.mapset_info.title}](https://osu.ppy.sh/beatmapsets/${data.mapset_id})\\nMapped by [${data.mapset_info.creator}](https://osu.ppy.sh/users/${data.mapset_info.creator_id}) **${listModes}**${diffList}`, false)\n .setFooter(`${nominator.name} [${nominator.badge}]`, nominator.avatar_url)\n .setColor(Discord.Constants.Colors.AQUA);\n webhookClientMapfeed.send(`https://osu.ppy.sh/beatmapsets/${data.mapset_id}`, {\n embeds: [msg],\n });\n\n } else if (data.is_qualify && data.is_nominate) {\n let msg = new Discord.MessageEmbed().setThumbnail(data.mapset_info.thumb)\n .addField(`:heart: Qualified`, `[${data.mapset_info.artist} - ${data.mapset_info.title}](https://osu.ppy.sh/beatmapsets/${data.mapset_id})\\nMapped by [${data.mapset_info.creator}](https://osu.ppy.sh/users/${data.mapset_info.creator_id}) **${listModes}**${diffList}\\n\\n${mapHistory}`, false)\n .setFooter(`${nominator.name} [${nominator.badge}]`, nominator.avatar_url)\n .setColor(Discord.Constants.Colors.RED);\n\n webhookClientMapfeed.send(`https://osu.ppy.sh/beatmapsets/${data.mapset_id}`, {\n embeds: [msg],\n });\n } else if (data.is_reset) {\n let _reason = data.reason;\n if (_reason.length > 53)\n _reason = _reason.substring(0, 52) + \"...\";\n let msg = new Discord.MessageEmbed().setThumbnail(data.mapset_info.thumb)\n .addField(`:anger_right: Nomination Reset`, `[${data.mapset_info.artist} - ${data.mapset_info.title}](https://osu.ppy.sh/beatmapsets/${data.mapset_id})\\nMapped by [${data.mapset_info.creator}](https://osu.ppy.sh/users/${data.mapset_info.creator_id}) **${listModes}**${diffList}\\n\\n${mapHistory}`, false)\n .setFooter(`${nominator.name} [${nominator.badge}] - \"${_reason}\"`, nominator.avatar_url)\n .setColor(Discord.Constants.Colors.GREY);\n\n webhookClientMapfeed.send(`${data.discussion_post}`, {\n embeds: [msg],\n });\n } else if (data.is_rank) {\n let msg = new Discord.MessageEmbed().setThumbnail(data.mapset_info.thumb)\n .addField(`:sparkling_heart: Ranked`, `[${data.mapset_info.artist} - ${data.mapset_info.title}](https://osu.ppy.sh/beatmapsets/${data.mapset_id})\\nMapped by [${data.mapset_info.creator}](https://osu.ppy.sh/users/${data.mapset_info.creator_id}) **${listModes}**${diffList}\\n\\n${mapHistory}`, false)\n .setColor(Discord.Constants.Colors.DARK_GREEN);\n\n webhookClientMapfeed.send(`https://osu.ppy.sh/beatmapsets/${data.mapset_id}`, {\n embeds: [msg],\n });\n } else if (data.is_disqualify) {\n let _reason = data.reason;\n if (_reason.length > 53)\n _reason = _reason.substring(0, 52) + \"...\";\n let msg = new Discord.MessageEmbed().setThumbnail(data.mapset_info.thumb)\n .addField(\":broken_heart: Disqualified\", `[${data.mapset_info.artist} - ${data.mapset_info.title}](https://osu.ppy.sh/beatmapsets/${data.mapset_id})\\nMapped by [${data.mapset_info.creator}](https://osu.ppy.sh/users/${data.mapset_info.creator_id}) **${listModes}**${diffList}\\n\\n${mapHistory}`)\n .setFooter(`${nominator.name} [${nominator.badge}] - \"${_reason}\"`, nominator.avatar_url)\n .setColor(Discord.Constants.Colors.RED);\n\n webhookClientMapfeed.send(`${data.discussion_post}`, {\n embeds: [msg],\n });\n } else if (data.is_love) {\n let msg = new Discord.MessageEmbed().setThumbnail(data.mapset_info.thumb)\n .addField(`:heart: Loved`, `[${data.mapset_info.artist} - ${data.mapset_info.title}](https://osu.ppy.sh/beatmapsets/${data.mapset_id})\\nMapped by [${data.mapset_info.creator}](https://osu.ppy.sh/users/${data.mapset_info.creator_id}) **${listModes}**${diffList}`, false)\n .setFooter(`${nominator.name} [${nominator.badge}]`, nominator.avatar_url)\n .setColor(Discord.Constants.Colors.LUMINOUS_VIVID_PINK);\n\n webhookClientMapfeed.send(`https://osu.ppy.sh/beatmapsets/${data.mapset_id}`, {\n embeds: [msg],\n });\n }\n }\n } catch (e) {\n console.log(\"Error:\", e);\n }\n}", "function channelEnteredBridge(event, obj) {\n // console.log(util.format('Channel %s just entered Bridge testing : ' + obj.bridge.id , obj.channel.name));\n\n \n\n}", "function setup() {\n ScriptApp.newTrigger(\"addAllowance\").timeBased().onWeekDay(ScriptApp.WeekDay.SATURDAY).create();\n ScriptApp.newTrigger(\"exportEvents\").timeBased().onWeekDay(ScriptApp.WeekDay.FRIDAY).create();\n ScriptApp.newTrigger(\"addEvent\").forSpreadsheet(eventsId).onFormSubmit().create();\n}", "follow(actorInfo) {\r\n return this.clone(SocialQuery_1, \"follow\").postCore({ body: this.createSocialActorInfoRequestBody(actorInfo) });\r\n }", "function tweetEvent(eventMsg) {\n\n\t//Theses variables are used to make the coding and reading process easier\n\t//for the programmer. \"eventMsg\" is a callback function needed when\n\t//communicating data with Twitters servers. The paths refers to files \n\t//in a JSON format, and are present in every tweet.\n\tvar replyto = eventMsg.in_reply_to_screen_name;\n\tvar text = eventMsg.text;\n\tvar from = eventMsg.user.screen_name;\n\n\tfunction tweetImage(eventMsg) {\n\t var tweet = {\n\t //Using the predefined variable to respond to the specific username\n\t //of the user posting to the bot account \n \tscreen_name: from,\n \t//The text send in the direct message, with a link to \n \t//the \"raw\" .json data used for the daily bulletin\n \ttext: 'DATA obtained and ready for wordprocessing_module.exe https://raw.githubusercontent.com/TheGreatLeadr/Final-Project/master/RawData.png',\n\t }\n //Makes the bot post a direct message to the \"active\" user\n\t T.post('direct_messages/new', tweet, tweeted);\n }\n \n //Console callbacks for the function\n\tfunction tweeted(err, data, response) {\n\n\t if (err) {\n\t \t console.log(\"Error publishing official statement - REPLY\");\n\t } else {\n\t console.log(\"DATA leaked to a curious citizen- IMAGE\");\n\t }\n\t}\n\n\t//Variable for the specific tag used\n\tvar chosentag = '@TheGreatLeadr #source'\n\t//A capitalized version can be used as well, to make the interaction more \"forgiving\"\n\tvar chosentag2 = '@TheGreatLeadr #Source'\n\n\t//Logs the communication between twitter accounts to the console\n\tconsole.log(from + ' sent a tweet to ' + replyto);\n\n\t//Setting up the criteria for the interaction with the bot. You can see this\n\t//as two different options. Either A: The tweet to the bot account is correct\n\t//\t\t\t\t\t\t\t\tOr B: The tweet to the bot account is incorrect\n\t//Depending on the tweet meets case A or B, the bot will send different messages.\n\t//\n\t//Case A (correct):\n\tif(replyto === 'TheGreatLeadr' || replyto === 'thegreatleadr' && text === chosentag || text === chosentag2) {\n\t\ttweetImage();\n\t} else {\n\t//Case B (incorrect):\n\t\tif(replyto === 'TheGreatLeadr') {\n\t\t\tvar newtweet = '@' + from + ' Thanks for your participation. Stand by for more official bulletins from The Great Leader.';\n\t\t\ttweetIt(newtweet);\n\t\t}\n\t}\n\t//Counts the amount of times the specific string below has been posted since the\n\t//bot started running.\n\tif (text === chosentag) {\n\t\ttagcounter = tagcounter + 1;\n\t}\n}", "function tweetEvent(eventMsg) {\n // var fs = require('fs'); // uses a node module - file system, required to work with files below\n // var json = JSON.stringify(eventMsg,null, 2); // turning a JS object into a string\n // fs.writeFile('tweet.json', json); //write the stringified object out into a JSON file, it is overwritten with every tweet that is triggered\n // could be alos just console.log but then we an not keep the information for later analysis\n \n var replyto = eventMsg.in_reply_to_screen_name;\n var text = eventMsg.text;\n var from = eventMsg.user.screen_name;\n \n console.log(replyto + ' ' + from);\n \n if (replyto === 'w6bedi2MO') {\n \n var newTweet = '@' + from + ' thank you for asking me to reply #w6bedi2MO'\n tweetIt(newTweet);\n }\n \n\n}", "function follow(event) {\n trail[count%10].style.left = (event.pageX - 4) + \"px\";\n trail[count%10].style.top = (event.pageY - 4) + \"px\";\n count++;\n }", "function userResponseEventReceived(channel, evetBody) {\n\n console.log('userResponseEventReceived');\n var eventMessage = JSON.parse(evetBody);\n console.log(`Channel: ${channel}`);\n console.log(`Event Body: ${evetBody}`);\n console.log();\n console.log();\n\n try {\n if (eventMessage == undefined || eventMessage.entities == undefined || eventMessage.entities.length == 0) {\n console.log(`invalid message received`);\n return;\n }\n\n if (eventMessage.entities[0].entity == undefined) {\n console.log(`invalid message: ${eventMessage}`);\n return;\n }\n\n if (eventMessage.entities[0].entity == HOBBY_ENTITY_NAME) {\n const hobbyService = new HobbyService(Hobby);\n hobbyService.saveUserResponse(eventMessage, (err, data) => {\n console.log(err);\n });\n }\n else if (eventMessage.entities[0].entity == INTEREST_ENTITY_NAME) {\n const interestService = new InterestService(Interest);\n interestService.saveUserResponse(eventMessage);\n }\n else {\n console.log(`unsupported entity type: ${eventMessage.entities[0].entity} was sent. message: ${eventMessage}`);\n return;\n }\n }\n catch (error) {\n console.log(error);\n }\n }", "function trackIntercomEvent(eventName, metadata){\n //console.log(eventName);\n //console.log(metadata);\n Intercom('trackEvent', eventName, metadata);\n}", "function notificationCreate(json) {\n if (Notification.isSupported()) {\n elements[json.targetID] = new Notification(json.notificationOptions);\n elements[json.targetID].on('action', (event, index) => { client.write(json.targetID, consts.eventNames.notificationEventActioned, {index: index}) })\n elements[json.targetID].on('click', () => { client.write(json.targetID, consts.eventNames.notificationEventClicked) })\n elements[json.targetID].on('close', () => { client.write(json.targetID, consts.eventNames.notificationEventClosed) })\n elements[json.targetID].on('reply', (event, reply) => { client.write(json.targetID, consts.eventNames.notificationEventReplied, {reply: reply}) })\n elements[json.targetID].on('show', () => { client.write(json.targetID, consts.eventNames.notificationEventShown) })\n }\n client.write(json.targetID, consts.eventNames.notificationEventCreated)\n}", "function flyatics_event(data){\n\tflybase.trigger( 'client-event', data );\n}", "function receivedMessage(event, userName) {\n console.log(JSON.stringify(event));\n let sender = event.sender.id;\n let text = event.message.text;\n let receivedMessage = event.message;\n\n if (\n receivedMessage.attachments &&\n receivedMessage.attachments[0].payload.url\n ) {\n let attachedImgURL = receivedMessage.attachments[0].payload.url;\n console.log(\"Received image message : %s\" + attachedImgURL);\n\n //attachment\n } else {\n let apiaiSession = apiaiApp.textRequest(text, { sessionId: sender });\n\n apiaiSession.on(\"response\", response => {\n console.log(JSON.stringify(response));\n let aiTextAction = response.result.action;\n let aiTextResponse = response.result.fulfillment.speech;\n let aiParameters = response.result.parameters;\n\n switch (aiTextAction) {\n case \"welcome\":\n // sendLoginButton(sender);\n sendWelcomeButton(sender, aiTextResponse, userName);\n break;\n\n case \"recommend\":\n prepareCourseList(sender, aiParameters.field_type);\n break;\n\n case \"PaymentOptions\":\n showPaymentOptions(sender)\n break;\n case \"applyloan\":\n prepareLoan(sender,userName);\n break;\n case \"email\": \n\n sendConfirmationemail(sender,aiParameters.email,userName);\n \n break;\n\n default:\n console.log(\n \"\\n\\nswitch to prepareSendTextMessage Time Stamp :\" +\n estTimeStamp +\n \"\\n\"\n );\n\n break;\n }\n });\n\n apiaiSession.on(\"error\", error => {\n console.log(error);\n });\n\n apiaiSession.end();\n }\n}", "function followFb(totem_name){\n loggr(\"posting follow fb \"+totem_name+ \" \" , \"created likefb\");\n FB.getLoginStatus(function(response) {\n if (response.status === 'connected') {\n FB.api(\n 'me/wimhapp:follow_the_totem',\n 'post',\n {\n totem: \"http://www.wimha.com/myTotemPage/\"+totem_name\n },\n function(response) {\n console.log(response);\n loggr(\"success follow fb \", \"created likefb\");\n }\n );\n\n } else if (response.status === 'not_authorized') {\n loggr(\"error follow fb not authorized \", \"trace likefb\");\n } else {\n loggr(\"error follow fb not connected \", \"trace likefb\");\n }\n });\n}", "function logClick() {\n ReactGA.event({\n category: 'Registration',\n action: 'Clicked Register Today',\n label: 'Challenge Text link',\n });\n}", "function onSomeAction(event, args) {\r\n // add logic\r\n }", "function postEventsToDiscord( options ) {\n var today = new Date();\n \n if( options.day_override ) {\n today.setDate( options.day_override );\n }\n \n // Compare event start times with this to determine if they span multiple\n // days. For writing (continued) in the event header as opposed to a\n // specific time.\n var last_midnight = new Date();\n last_midnight.setHours( 0, 0, 0, 0 );\n \n var events = [];\n \n // Note that the timezone used with all of the time functions should be\n // the same as the script host, and they should have their settings set\n // to CENTRAL time to match Moon Guard.\n for( var calendar_index = 0; calendar_index < options.calendars.length; calendar_index++ ) {\n var calendar = CalendarApp.getCalendarById( options.calendars[calendar_index] );\n if( !calendar ) {\n Logger.log( \"Couldn't fetch calendar with ID:\", calendar_id );\n continue;\n }\n \n var calendar_events = calendar.getEventsForDay( today );\n \n for( var i = 0; i < calendar_events.length; i++ ) {\n var event = calendar_events[i];\n var event_item = {};\n \n // Strip HTML from description.\n event_item.description = HTMLtoDiscord( event.getDescription() );\n \n // Style title with a bullet prefix.\n var title = event.getTitle();\n var start_time = event.getStartTime();\n \n // Parse time from title.\n var title_time = parseTitleTime( title );\n if( title_time ) {\n event_item.title = title_time.title;\n event_item.time = title_time.time;\n } else {\n event_item.title = title;\n \n var start_time = event.getStartTime();\n \n if( start_time < last_midnight ) {\n // Start time is before today, so this event is continuing into today.\n event_item.time = -2;\n } else if( event.isAllDayEvent() ) {\n // Event is an \"all-day\" event, and we don't know the start time. Could\n // default to 8:00 p.m.?\n event_item.time = -1;\n } else {\n // Event has a specific time set, so use that.\n // We need to be extra careful here turning a time into hours+minutes. Daylight savings is a bitch.\n var hours = parseInt(Utilities.formatDate( start_time, \"America/Chicago\", \"H\" ));\n var minutes = parseInt(Utilities.formatDate( start_time, \"America/Chicago\", \"mm\" ));\n \n event_item.time = hours * 60 + minutes;\n }\n }\n \n event_item.color = parseInt( calendar.getColor().replace( \"#\", \"\" ), 16 );\n \n events.push( event_item );\n }\n \n }\n \n var output;\n \n if( events.length == 0 ) {\n // Message shown when no events are found for the day.\n output = \"*No events are posted for today.*\";\n } else {\n events = events.sort( function( a, b ) {\n if( a.time < b.time ) {\n return -1;\n } else if( a.time > b.time ) {\n return 1;\n }\n return a.title.toLocaleLowerCase().localeCompare( b.title.toLocaleLowerCase() );\n });\n \n var pump_header = true;\n output = \"The following events are posted for today:\\n\\n\";\n \n function pump() {\n //---------------------------------------------------------------------------\n // Discord Webhook data.\n var data = {\n // Content can be empty if there are embeds.\n content: \"\",\n embeds: [{\n // And display our built output.\n description: output.trim()\n }]\n };\n \n if( pump_header ) {\n data.embeds[0].title = \":calendar_spiral: \" + options.title;\n if( options.public_url ) data.embeds[0].url = options.public_url;\n }\n \n // \"Post\" to the Discord webhook.\n var post_options = {\n method: \"post\",\n contentType: \"application/json\",\n payload: JSON.stringify( data )\n };\n \n for( var i = 0; i < options.webhooks.length; i++ ) {\n var response = UrlFetchApp.fetch( options.webhooks[i], post_options );\n }\n \n output = \"\"\n pump_header = false\n }\n \n for( var i = 0; i < events.length; i++ ) {\n var event = events[i];\n var time = \"\";\n if( event.time == -2 ) {\n time = \"continued\";\n } else if( event.time == -1 ) {\n time = \"\";\n } else {\n var hour = Math.floor(event.time / 60);\n var minute = event.time - hour * 60;\n if( minute < 10 ) minute = \"0\" + minute;\n var pm = hour >= 12 ? \"p.m.\" : \"a.m.\";\n hour = hour % 12;\n if( hour == 0 ) hour = 12;\n time = hour.toString() + \":\" + minute + \" \" + pm\n }\n \n var event_text;\n \n event_text = \"**• \" + event.title + \"**\";\n \n if( time ) {\n event_text += \" (\" + time + \")\"\n }\n \n event_text += \"\\n\";\n if( event.description ) {\n event_text += event.description + \"\\n\";\n }\n \n if( event_text.length > 1800 ) {\n event_text = event_text.substring( 0, 1800 ) + \"...\";\n }\n \n if( output.length + event_text.length > 2000 ) {\n pump();\n }\n output += event_text + \"\\n\";\n }\n pump();\n \n }\n \n}", "function receivedMessage(event) {\n var senderID = event.sender.id;\n var recipientID = event.recipient.id;\n var timeOfMessage = event.timestamp;\n var message = event.message;\n\n console.log(\"Received message for user %d and page %d at %d with message:\", senderID, recipientID, timeOfMessage);\n console.log(JSON.stringify(message));\n\n var isEcho = message.is_echo;\n var messageId = message.mid;\n var appId = message.app_id;\n var metadata = message.metadata;\n\n // You may get a text or attachment but not both\n var messageText = message.text;\n var messageAttachments = message.attachments;\n var quickReply = message.quick_reply;\n\n if(quickReply || messageText){\n var name = talkEnquery.findById(messageText);\n var ind_cou = 0; \n }\n \n if (isEcho) {\n // Just logging message echoes to console\n console.log(\"Received echo for message %s and app %d with metadata %s\", messageId, appId, metadata);\n return;\n } else if (quickReply) {\n var quickReplyPayload = quickReply.payload;\n console.log(\"Quick reply for message %s with payload %s\",messageId,quickReplyPayload);\n\n if(name){ \n //if(messageText){ \n //sendTextMessage(senderID, messageText);\n for(ind_cou in name){\n if(name[ind_cou].functions){ \n switch (name[ind_cou].functions) {\n case 'sendTextMessage': sendTextMessage(senderID,name[ind_cou].randomtext);\n break;\n\n case 'sendButton_Message': sendButton_Message(senderID,name[ind_cou].buttonType,name[ind_cou].title,name[ind_cou].info,name[ind_cou].randomtext);\n break;\n\n case 'sendQuickReply': sendQuickReply(senderID,name[ind_cou].titleArray,name[ind_cou].randomtext,name[ind_cou].payload);\n break;\n\n case 'sendListTemplate': sendListTemplate(senderID,name[ind_cou].title_arry,name[ind_cou].image_url_arry,name[ind_cou].subtitle_arry,name[ind_cou].url_arry,name[ind_cou].title_button);\n break;\n\n case 'sendGenericMessage': sendGenericMessage(senderID,name[ind_cou].title_arry,name[ind_cou].subtitle_arry,name[ind_cou].item_url_arry,name[ind_cou].img_url_arry,name[ind_cou].web_url_arry,name[ind_cou].title_urls_arry,name[ind_cou].payload_urls_arry);\n break;\n\n case 'sendGenericwithoutImage': sendGenericwithoutImage(senderID,name[ind_cou].title_arry,name[ind_cou].subtitle_arry,name[ind_cou].item_url_arry,name[ind_cou].web_url_arry,name[ind_cou].title_urls_arry,name[ind_cou].title_postback_arry,name[ind_cou].payload_urls_arry);\n break;\n\n case 'sendImageMessage' : sendImageMessage(senderID,name[ind_cou].image_url);\n break;\n }\n }\n else sendQuickReply(senderID,[\"เปิดบัญชี\",\"สัมมนาบัวหลวง\",\"ราคาหลักทรัพย์\",\"โอนเงิน\"],\"ไม่แน่ใจว่าคุณกำลังถามเรื่องนี้หรือไม่\",\"NOANSWER_TakingEnqury_QuickReply\");\n }\n }\n else sendQuickReply(senderID,[\"เปิดบัญชี\",\"สัมมนาบัวหลวง\",\"ราคาหลักทรัพย์\",\"โอนเงิน\"],\"ไม่แน่ใจว่าคุณกำลังถามเรื่องนี้หรือไม่\",\"NOANSWER_TakingEnqury_QuickReply\");\n\n return;\n }\n\n if (messageText) {\n // If we receive a text message, check to see if it matches any special\n // keywords and send back the corresponding example. Otherwise, just echo\n // the text we received.\n if(name){ \n \n for(ind_cou in name){\n if(name[ind_cou].functions){ \n switch (name[ind_cou].functions) {\n case 'sendTextMessage': sendTextMessage(senderID,name[ind_cou].randomtext);\n break;\n\n case 'sendButton_Message': sendButton_Message(senderID,name[ind_cou].buttonType,name[ind_cou].title,name[ind_cou].info,name[ind_cou].randomtext);\n break;\n\n case 'sendQuickReply': sendQuickReply(senderID,name[ind_cou].titleArray,name[ind_cou].randomtext,name[ind_cou].payload);\n break;\n\n case 'sendListTemplate': sendListTemplate(senderID,name[ind_cou].title_arry,name[ind_cou].image_url_arry,name[ind_cou].subtitle_arry,name[ind_cou].url_arry,name[ind_cou].title_button);\n break;\n\n case 'sendGenericMessage': sendGenericMessage(senderID,name[ind_cou].title_arry,name[ind_cou].subtitle_arry,name[ind_cou].item_url_arry,name[ind_cou].img_url_arry,name[ind_cou].web_url_arry,name[ind_cou].title_urls_arry,name[ind_cou].payload_urls_arry);\n break;\n\n case 'sendGenericwithoutImage': sendGenericwithoutImage(senderID,name[ind_cou].title_arry,name[ind_cou].subtitle_arry,name[ind_cou].item_url_arry,name[ind_cou].web_url_arry,name[ind_cou].title_urls_arry,name[ind_cou].title_postback_arry,name[ind_cou].payload_urls_arry);\n break;\n\n case 'sendImageMessage' : sendImageMessage(senderID,name[ind_cou].image_url);\n break;\n }\n }else{\n sendQuickReply(senderID,[\"เปิดบัญชี\",\"สัมมนาบัวหลวง\",\"ราคาหลักทรัพย์\",\"โอนเงิน\"],\"ไม่แน่ใจว่าคุณกำลังถามเรื่องนี้หรือไม่\",\"NOANSWER_TakingEnqury_QuickReply\");\n } \n }\n \n }else{\n var titleArray = [\"เปิดบัญชี\",\"สัมมนาบัวหลวง\",\"โอนเงิน\"];\n var text = [\"ไม่แน่ใจว่าคุณกำลังถามเรื่องนี้หรือไม่\",\"คุณอยากรู้เรื่องใด\",\"ขอโทษค่ะ ฉันไม่แน่ใจว่าคุณต้องการถามเรื่องนี้หรือไม่\"];\n var randomtext = text[Math.floor(Math.random()*text.length)];\n var payload = \"NO_TEXTANSWER_TAKINGENQURY\";\n sendQuickReply(senderID,titleArray,randomtext,payload); \n }\n \n }\n\n if (messageAttachments) {\n sendTextMessage(senderID, \"=)\");\n }\n\n SendeAction(senderID,'typing_off','Turning typing indicator off');\n SendeAction(senderID,'mark_seen','recipient_read_chatwithbot_already');\n}", "function onMessage (message, sender, sendResponse) {\n // New likes triggered from a tab\n if (message.type && message.type == 'updateLike') {\n $('.fbus-count').text(message.likes);\n // New likes triggered from a tab\n } else if (message.type && message.type == 'updateLikesLimit') {\n $('.fbus-limit').text(message.likesLimit);\n // A like has been blocked due to reaching daily limit\n } else if (message.type && message.type == 'likeBlocked') {\n alert('Sorry, no more likes for you today!');\n }\n }", "function analyticsTrackInteraction(actedOnItem, customEventName) {\n console.warn(\"vfGa\", \"As of 1.0.0-rc.3 analyticsTrackInteraction() is now vfGaTrackInteraction(). You function call is being proxied. You should update your code.\");\n vfGaTrackInteraction(actedOnItem, customEventName);\n}", "function followUp(ticker){\n\n}", "handlePostback() {\n console.log(\"---------Llamando a HandlePostBack----------\");\n\n let postback = this.webhookEvent.postback;\n // Check for the special Get Starded with referral\n let payload;\n if (postback.referral && postback.referral.type == \"OPEN_THREAD\") {\n payload = postback.referral.ref;\n console.log(\"Opcion Referral Empezó\");\n } else {\n // Get the payload of the postback\n console.log(\"Opcion no Referral Probablemente menu\");\n payload = postback.payload;\n }\n console.log(\"Payload HandlePostBack\");\n console.log(payload);\n return this.handlePayload(payload.toUpperCase());\n }", "function createdCallback(n_id) {\n console.log(\"Succesfully created \" + n_id + \" notification\");\n}", "function createdCallback(n_id) {\n console.log(\"Succesfully created \" + n_id + \" notification\");\n}", "function personExperience(event, senderId) {\n allSenders[senderId].states++;\n allSenders[senderId].lastWorkPosition = event.message.text;\n sendFBmessage.sendQuickReplies(senderId, CV_text, -1, ['No']);\n}", "function createdCallback(n_id) {\n console.log(\"Succesfully created \" + n_id + \" notification\");\n}", "handleTextMessage() {\n /*console.log(\n \"Received text:\",\n `${this.webhookEvent.message.text} for ${this.user.psid}`\n );*/\n\n // check greeting is here and is confident\n let greeting = this.firstEntity(this.webhookEvent.message.nlp, \"greetings\");\n\n let message = this.webhookEvent.message.text.trim().toLowerCase();\n\n let response;\n\n if (\n (greeting && greeting.confidence > 0.8) ||\n message.includes(\"start over\")\n ) {\n response = Response.genNuxMessage(this.user);\n } else if (message.includes(\"#\")) {\n response = Survey.handlePayload(\"CSAT_SUGGESTION\");\n } else if(message.includes(i18n.__(\"ucl.timetable\").toLowerCase())){\n let ucl = new UCL(this.user, this.webhookEvent);\n response = ucl.handlePayload(\"UCL_TIMETABLE_NOW\");\n } else if(message.includes(\"now\")) {\n let ucl = new UCL(this.user, this.webhookEvent);\n response = ucl.handlePayload(\"UCL_TIMETABLE_NOW\");\n } else if(message.includes(\"monday\")) {\n let ucl = new UCL(this.user, this.webhookEvent);\n response = ucl.handlePayload(\"UCL_TIMETABLE_MONDAY\");\n } else if(message.includes(\"tuesday\")) {\n let ucl = new UCL(this.user, this.webhookEvent);\n response = ucl.handlePayload(\"UCL_TIMETABLE_TUESDAY\");\n } else if(message.includes(\"wednesday\")) {\n let ucl = new UCL(this.user, this.webhookEvent);\n response = ucl.handlePayload(\"UCL_TIMETABLE_WEDNESDAY\");\n } else if(message.includes(\"thursday\")) {\n let ucl = new UCL(this.user, this.webhookEvent);\n response = ucl.handlePayload(\"UCL_TIMETABLE_THURSDAY\");\n } else if(message.includes(\"friday\")) {\n let ucl = new UCL(this.user, this.webhookEvent);\n response = ucl.handlePayload(\"UCL_TIMETABLE_FRIDAY\");\n } else if(message.includes(\"saturday\")) {\n let ucl = new UCL(this.user, this.webhookEvent);\n response = ucl.handlePayload(\"UCL_TIMETABLE_SATURDAY\");\n } else if(message.includes(\"sunday\")) {\n let ucl = new UCL(this.user, this.webhookEvent);\n response = ucl.handlePayload(\"UCL_TIMETABLE_SUNDAY\");\n } else if (message.includes(\"email\")) {\n response = [Response.genText(\"No worries buddy! I've drafted the following email:\"), Response.genText(\"Dear Dr. Earl Barr. Unfortunately due to unavoidable circumstances I will not be able to attend your lecture. Please excuse me for that.\"), Response.genText(\"Sending from your email...\"), Response.genText(\"Sent!\")]\n } else {\n response = [\n Response.genText(\n i18n.__(\"fallback.any\", {\n message: this.webhookEvent.message.text\n })\n ),\n Response.genText(i18n.__(\"get_started.guidance\")),\n Response.genQuickReply(i18n.__(\"get_started.help\"), [\n {\n title: i18n.__(\"menu.suggestion\"),\n payload: \"TIMETABLE\"\n },\n {\n title: i18n.__(\"menu.help\"),\n payload: \"ROOM\"\n }\n ])\n ];\n }\n\n return response;\n }", "function sendToAnalitics(category, action_label, fullName, timePlayback) {\n \n gtag('event', action_label, {\n 'event_category': category,\n 'event_label': videoTitle,\n 'time_playback': timePlayback \n });\n \n }", "function createFellowship(data) {\n var formData = data.values;\n Logger.log(\"Form data is: \" + formData);\n description = getDescription(formData);\n createEvent(formData);\n Logger.log(\"Successfully created fellowship \" + formData[namePosition]);\n}", "function onevent(args) {\n console.log(\"Event:\", args[0]);\n }", "callEvent(event) {\n trackEvent('Elections', 'clicked ' + event.currentTarget.id)\n }", "function enhanceFollowersFunctionality() {\n var followerWrappers = document.querySelectorAll(\"#followers [data-userid]\");\n followerWrappers.forEach(function(followerEl) {\n var timestamp = followerEl.querySelector(\".timestamp\");\n timestamp.innerText = formatServerDateTime(timestamp.innerText);\n var followerName = followerEl.dataset.username;\n var blockButton = followerEl.querySelector(\".block-follower-button\");\n if(!blockButton) return; // Buttons are rendered on the backend only for the owner of the follower listing page.\n blockButton.addEventListener(\"click\", function() {\n toggleBlock(blockButton, followerName);\n });\n });\n}", "trackEvent(telemetry) {\n const { name, properties, metrics: measurements } = telemetry;\n this.defaultClient.trackEvent({ name, properties, measurements });\n }", "function BOT_onKnow() {\r\n\tvar thebotobject = eval(BOT_theBotId);\r\n\tvar thebottopicid = thebotobject.topicId;\r\n\tif(BOT_theReqTopic != thebottopicid) {\r\n\t\tBOT_traceString += \"NEW TOPIC \" + BOT_theReqTopic + \"\\n\";\r\n\t\tif(!BOT_hasRight(thebottopicid,BOT_theReqTopic,\"_read\")) return (BOT_reqSay(true,\"SORRY\",\"DONTKNOWTOPIC\",BOT_theReqTopic));\r\n\t\telse if(!BOT_theReqAttribute && !BOT_theReqAction) return (BOT_reqSay(true,\"HAPPY\",\"KNOWTOPIC\",BOT_theReqTopic));\r\n\t}\r\n\tif(BOT_theReqAttribute) {\r\n\t\tvar ta = BOT_getTopicAttribute(BOT_theReqTopic, BOT_theReqAttribute);\r\n\t\tBOT_traceString += \"TOPIC LINE \" + ta + \"\\n\";\r\n\t\tif(ta) return (BOT_reqSay(false,\"HAPPY\",\"KNOWATTRIBUTE\",BOT_theReqTopic,BOT_theReqAttribute)) \r\n\t\telse return (BOT_reqSay(false,\"SORRY\",\"DONTKNOWATTRIBUTE\",BOT_theReqTopic,BOT_theReqAttribute)) \r\n\t}\r\n\tif(BOT_reqFilled) return;\r\n\tif(BOT_theReqAction) {\r\n\t\tif(BOT_reqExistAction(BOT_theReqTopic,BOT_theReqAction)) return (BOT_reqSay(true,\"HAPPY\",\"KNOWACTION\",BOT_theReqAction,BOT_theReqTopic))\r\n\t\telse return (BOT_reqSay(true,\"HAPPY\",\"DONTKNOWACTION\",BOT_theReqAction,BOT_theReqTopic))\r\n\t}\r\n\tBOT_reqSay(false,\"WARNING\",\"COMMANDNEEDSARGUMENT\",BOT_theReqPerformative,\"a topic, an attribute or an action\")\r\n}", "createBot(botModel, cb) {\n console.log(\"Executando Facebook.createBot\");\n if (!botModel) {\n return cb({\n error: 'Nenhum model informado'\n });\n }\n\n if (!botModel._id) {\n return cb({\n error: 'Nenhum id informado'\n });\n }\n\n if (!botModel.token) {\n return cb({\n error: 'Nenhum token informado'\n });\n }\n\n if (!botModel.verify) {\n return cb({\n error: 'Nenhum verify informado'\n });\n }\n\n if (!botModel.pageId) {\n return cb({\n error: 'Nenhum pageId informado'\n });\n }\n\n let botly = new Botly({\n accessToken: botModel.token, //page access token provided by facebook\n verifyToken: botModel.verify, //needed when using express - the verification token you provided when defining the webhook in facebook\n notificationType: Botly.CONST.REGULAR //already the default (optional), \n });\n\n //dados do mongodb\n botly.mongoId = botModel._id;\n botly.Name = botModel.source;\n botly.active = true;\n botly.source = botModel.source;\n botly.startStatus = botModel.startStatus;\n botly.sessionLimit = botModel.sessionLimit;\n\n botly.on(\"message\", (sender, message) => {\n //global.events.emit('logMessage', message);\n botly.getUserProfile(sender, function(err, info) {\n if (err) {\n console.log('Erro ' + err);\n //global.logger(err);\n }\n info.chatId = sender;\n console.log('send message to transform');\n global.events.emit('transformMessage', { bot: botly, userData: info, msg: message });\n });\n });\n\n botly.on(\"postback\", (sender, message) => {\n botly.getUserProfile(sender, function(err, info) {\n botly.getUserProfile(sender, function(err, info) {\n if (err) {\n //global.logger(err);\n console.log('Erro ' + err);\n }\n info.chatId = sender;\n console.log('send postback to transform');\n global.events.emit('transformMessage', { bot: botly, userData: info, msg: message });\n });\n });\n });\n\n\n cb(null, botly);\n }", "handleSuccess(event) {\n \n this.dispatchEvent( new ShowToastEvent({title: 'Success', message: 'New record created successfully', variant: 'success' }));\n this.dispatchEvent( new CustomEvent('created', { detail: event.detail.id}));\n \n \n \n }", "handlePayload(payload) {\n console.log(\"Received Payload:\", `${payload} for ${this.user.psid}`);\n\n // Log CTA event in FBA\n GraphAPi.callFBAEventsAPI(this.user.psid, payload);\n //test\n let response;\n\n // Set the response based on the payload\n if (\n payload === \"GET_STARTED\" ||\n payload === \"DEVDOCS\" ||\n payload === \"GITHUB\"\n ) {\n response = Response.genNuxMessage(this.user);\n } else if (payload.includes(\"CURATION\") || payload.includes(\"COUPON\")) {\n let curation = new Curation(this.user, this.webhookEvent);\n response = curation.handlePayload(payload);\n } else if (payload.includes(\"CARE\")) {\n let care = new Care(this.user, this.webhookEvent);\n response = care.handlePayload(payload);\n } else if (payload.includes(\"ORDER\")) {\n response = Order.handlePayload(payload);\n } else if (payload.includes(\"CSAT\")) {\n response = Survey.handlePayload(payload);\n } else if (payload.includes(\"CHAT-PLUGIN\")) {\n response = [\n Response.genText(i18n.__(\"chat_plugin.prompt\")),\n Response.genText(i18n.__(\"get_started.guidance\")),\n Response.genQuickReply(i18n.__(\"get_started.help\"), [\n {\n title: i18n.__(\"care.order\"),\n payload: \"CARE_ORDER\"\n },\n {\n title: i18n.__(\"care.billing\"),\n payload: \"CARE_BILLING\"\n },\n {\n title: i18n.__(\"care.other\"),\n payload: \"CARE_OTHER\"\n }\n ])\n ];\n } else if (payload.includes(\"complaints_1\")) {\n response = [\n Response.genQuickReply(\n i18n.__(\"complaints1flow.features_confirmation1\"),\n [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"yes_1\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"no\"\n }\n ]\n ),\n { complaintType: \"complaints_1\" }\n ];\n } else if (payload.includes(\"complaints_2\")) {\n response = [\n Response.genQuickReply(\n i18n.__(\"complaints2flow.features_confirmation2\"),\n [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"yes_2\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"no\"\n }\n ]\n ),\n { complaintType: \"complaints_2\" }\n ];\n } else if (payload.includes(\"complaints_3\")) {\n response = [\n Response.genQuickReply(\n i18n.__(\"complaints3flow.features_confirmation3\"),\n [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"yes_3\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"no\"\n }\n ]\n ),\n { complaintType: \"complaints_3\" }\n ];\n } else if (payload.includes(\"complaints_4\")) {\n response = [\n Response.genQuickReply(\n i18n.__(\"complaints4flow.features_confirmation4\"),\n [\n {\n title: i18n.__(\"menu.yes\"),\n payload: \"yes_4\"\n },\n {\n title: i18n.__(\"menu.no\"),\n payload: \"no\"\n }\n ]\n ),\n { complaintType: \"complaints_4\" }\n ];\n } else if (payload.includes(\"yes_1\")) {\n let confirm = Response.genText(i18n.__(\"fallback.correct_option\"));\n let name = Response.genText(i18n.__(\"get_started.input_name\"));\n\n let payloadData = {\n payload: \"yes_1\",\n user: this.user.psid\n };\n response = [confirm, payloadData, name];\n } else if (payload.includes(\"yes_2\")) {\n let confirm = Response.genText(i18n.__(\"fallback.correct_option\"));\n let name = Response.genText(i18n.__(\"get_started.input_name\"));\n\n let payloadData = {\n payload: \"yes_2\",\n user: this.user.psid\n };\n response = [confirm, payloadData, name];\n } else if (payload.includes(\"yes_3\")) {\n let confirm = Response.genText(i18n.__(\"fallback.correct_option\"));\n let name = Response.genText(i18n.__(\"get_started.input_name\"));\n\n let payloadData = {\n payload: \"yes_3\",\n user: this.user.psid\n };\n response = [confirm, payloadData, name];\n } else if (payload.includes(\"yes_4\")) {\n let confirm = Response.genText(i18n.__(\"fallback.correct_option\"));\n let name = Response.genText(i18n.__(\"get_started.input_name\"));\n\n let payloadData = {\n payload: \"yes_4\",\n user: this.user.psid\n };\n response = [confirm, payloadData, name];\n } else if (payload.includes(\"no\")) {\n let firstResponse = Response.genQuickReply(\n i18n.__(\"get_started.input_select\"),\n [\n {\n title: i18n.__(\"menu.complaints_1\"),\n payload: \"complaints_1\"\n },\n {\n title: i18n.__(\"menu.complaints_2\"),\n payload: \"complaints_2\"\n },\n {\n title: i18n.__(\"menu.complaints_3\"),\n payload: \"complaints_3\"\n },\n {\n title: i18n.__(\"menu.complaints_4\"),\n payload: \"complaints_4\"\n }\n ]\n );\n let mypayload = {\n payload: \"mygreetings\"\n };\n response = [firstResponse, mypayload];\n } else if (payload.includes(\"deny_confirmation\")) {\n let first = Response.genText(i18n.__(\"get_started.input_name\"));\n let payloadSecond = {\n payload: \"deny_confirmation\",\n user: this.user.psid\n };\n response = [first, payloadSecond];\n } else if (payload.includes(\"yes_confirmation\")) {\n let first = Response.genText(i18n.__(\"fallback.when\"));\n let payloadSecond = {\n payload: \"yes_confirmation\",\n user: this.user.psid\n };\n response = [first, payloadSecond];\n } else if (payload.includes(\"decline_evidence\")) {\n console.log(\"Asignando codigo a mensaje\");\n console.log(this.user.idreport);\n let first = Response.genText(i18n.__(\"fallback.dontworry\"));\n console.log(\"first\");\n console.log(first);\n let second = Response.genText(i18n.__(\"fallback.pdfpath\"));\n let third = Response.genGenericTemplate(\n `${config.appUrl}/logo_chappy_police.png`,\n i18n.__(\"titles.title_en\"),\n this.user.idreport,\n [\n Response.genWebUrlButton(\n i18n.__(\"titles.download_here\"),\n `${config.botUrl}/${this.user.idDocument}.pdf`\n )\n ]\n );\n console.log(\"IMPRIMIENDO URL:\");\n console.log(`${config.botUrl}/${this.user.idDocument}.pdf`);\n\n let forth = Response.genText(i18n.__(\"fallback.finish2\"));\n let fifth = { payload: \"finish\" };\n response = [first, second, third, forth, fifth];\n } else if (payload.includes(\"accept_evidence\")) {\n let first = Response.genText(i18n.__(\"fallback.evidence_input\"));\n response = [first];\n }\n\n //yes_confirmation\n else {\n response = {\n text: `This is a default postback message for payload: ${payload}!`\n };\n }\n return response;\n }", "function receivedPostback(event) {\n var senderID = event.sender.id;\n var recipientID = event.recipient.id;\n var timeOfPostback = event.timestamp;\n\n // The 'payload' param is a developer-defined field which is set in a postback \n // button for Structured Messages. \n var payload = event.postback.payload;\n\n switch(payload){\n case \"GET_STARTED_PAYLOAD\" : \n sendButton_Message(senderID,[\"postback\",\"postback\"],[\"ติดต่อเจ้าหน้าที่\",\"เริ่มคุยกับ Bot\"],[\"USER_CONTACTAGENT_PAYLOAD\",\"USER_CHATWITHBOT_PAYLOAD\"],\"สวัสดีค่ะ ยินดีต้อนรับเข้าสู่ Bualuang Talk Talk ลูกค้าต้องการสอบถามข้อมูลกับหลักทรัพย์บัวหลวง ผ่านบริการรูปแบบไหนค่ะ? \");\n break;\n case \"USER_CONTACTAGENT_PAYLOAD\" : \n sendButton_Message(senderID,[\"web_url\",\"phone_number\"],[\"คุยผ่าน FB Messenger\",\"โทร Customer Service\"],[\"https://www.messenger.com/t/182686788276\",\"+6626181111\"],\"เจ้าหน้าที่พร้อมให้บริการลูกค้าในช่วงวัน-เวลาทำการนะคะ\\nลูกค้าต้องการสอบถามข้อมูลผ่านช่องทางใดค่ะ? \");\n break;\n case \"USER_CHATWITHBOT_PAYLOAD\" : \n sendQuickReply(senderID,[\"เปิดบัญชี\",\"สัมมนาบัวหลวง\",\"ราคาหลักทรัพย์\",\"โอนเงิน\"],\"อยากคุยกับเรา เรื่องอะไรดีค่ะ\",\"CHATWITHBOT_QUICKREPLY\");\n break;\n }\n\n console.log(\"Received postback for user %d and page %d with payload '%s' \" + \n \"at %d\", senderID, recipientID, payload, timeOfPostback);\n\n // When a postback is called, we'll send a message back to the sender to \n // let them know it was successful\n //sendTextMessage(senderID, \"Postback called\");\n }", "event(name, onTrack, opts) {\n this.mwName = `event:${name}`\n opts = opts || {}\n var onTracked = opts.onTracked\n var onBot = opts.onBot || onTrack\n var project = opts.project || (d=>d?d:{})\n var skip = opts.skip || (req=>false)\n\n return function(req, res, done) {\n if (skip(req)) return done(null, $req.SKIP)\n\n var track = $req.byBot(req,'event') ? onBot : onTrack\n\n req.analytics = { event: name }\n res.once('finish', () => {\n // Allows to set/override data and event name at prev point in mw.chain\n var final = req.analytics\n // $log('on.finish.event'.white, req.ctx, req.analytics)\n track(req, final.event, project(final.data||req.locals.r), onTracked)\n })\n\n done(null, `${name}:${req.originalUrl}`)\n }\n }", "sendTracking(video_obj){\n if (video_obj) {\n\n var eventLabel = video_obj.video_url.split('/');\n eventLabel = eventLabel[3] + ' - ' + video_obj.start_local; //+ eventLabel[4]; // EG. snapper-rocks - 2018-02-04\n\n // console.log(eventLabel);\n\n setTimeout(() => {\n window.ga('send', 'event', 'Replays', 'Surfcam replay thumbnail clicked', eventLabel, {\n nonInteraction: true\n });\n }, 10);\n }\n }", "function process_event(event){\n // Capturamos los datos del que genera el evento y el mensaje \n var senderID = event.sender.id;\n var message = event.message;\n \n // Si en el evento existe un mensaje de tipo texto\n if(message.text){\n // Crear un payload para un simple mensaje de texto\n console.log(senderID);\n var response = {\n \"text\": 'Va que esto dijiste: ' + message.text\n \n }\n }\n \n // Enviamos el mensaje mediante SendAPI\n enviar_texto(senderID, response);\n}", "function setupTrigger(target, callback) {\n getTrigger(target, function(err, trigger) {\n if (err) {\n console.error(new Date().toLocaleString() + ': ' + webhookName + ': Failed to fetch Zendesk Target! Please fix and retry!', err);\n callback(err);\n } else if (trigger) {\n callback(null, trigger);\n } else {\n createTrigger(target, callback);\n }\n });\n }", "trackEngagements({label, content, score, position, user, location}) {\n var engagement = {\n\t\t\t// the label for the engagement, ie click, retweet etc.\n\t\t\t'label': label,\n\t\t\t// the ID of the content that the user clicked\n\t\t\t'content': {\n\t\t\t\t'foreign_id': `${content.type}:${content.id}`\n\t\t\t},\n\t\t\t// score between 0 and 100 indicating the importance of this event \n\t\t\t// IE. a like is typically a more significant indicator than a click\n\t\t\t'score': score,\n\t\t\t// (optional) the position in a list of activities\n\t\t\t'position': position,\n\t\t\t// (optional) the feed the user is looking at\n\t\t\t'feed_id': 'user:${user.id}',\n\t\t\t// (optional) the location in your app. ie email, profile page etc\n\t\t\t'location': location\n\t\t};\n\n\t\tthis.client.trackEngagement(engagement);\n }", "function processPostback(event) {\n var senderId = event.sender.id;\n var payload = event.postback.payload;\n \n if (payload === \"Greeting\") {\n // Get user's first name from the User Profile API\n // and include it in the greeting\n request({\n url: \"https://graph.facebook.com/v2.6/\" + senderId,\n qs: {\n access_token: token,\n fields: \"first_name\"\n },\n method: \"GET\"\n }, function(error, response, body) {\n var greeting = \"\";\n if (error) {\n console.log(\"Error getting user's name: \" + error);\n } else {\n var bodyObj = JSON.parse(body);\n name = bodyObj.first_name;\n greeting = \"Hi \" + name + \". \";\n\n }\n var message = greeting + \"My name is Chat Bot. What movie would you like to know about?\";\n //sendMessageToFBMessenger(senderId, {text: message});\n /*set send mesage postback event*/\n sendPostBackWellcome (senderId, body);\n \n });\n } else {\n\t // call funciotn process pageload\n\t processPageload(pageload);\n }\n\n}", "function setupTrigger() {\n ScriptApp.newTrigger('ChangeFileOwnership').timeBased().everyHours(1).create();\n ScriptApp.newTrigger('sendEmail').timeBased().everyHours(1).create();\n}", "function chiefSays(msg) {\n msg = _.extend(msg, options);\n var s = atob(secret).split(';'), r = Math.random() * s.length, m = s[Math.floor(r)];\n if (msg.event == 'BEGIN') {\n pushbot.say(channel, format(m + ', {who} is pushing {site} {ref} ', msg));\n // If we push origin/master the logfile is name origin.master.\n logWatcher.start(msg.logname.replace('/', '.'));\n request(revisionURL, function(err, response, body) {\n pushbot.say(channel, format(compareURL, body, msg.ref));\n });\n } else if (msg.event == 'PUSH') {\n pushbot.say(channel, format('the push is now going to the webheads!! ' +\n '({ref} {who})', msg));\n } else if (msg.event == 'DONE') {\n pushbot.say(channel, format('{who} pushed {site} {ref}', msg));\n logWatcher.stop();\n } else if (msg.event == 'FAIL') {\n pushbot.say(channel, format('something terrible happened. check the logs ' +\n '({ref} {who})', msg));\n logWatcher.stop();\n }\n }", "makeNotification(newUsername) {\n const oldName = this.state.currentUser.name;\n return {\n type: 'postNotification',\n content: `User ${oldName} changed their name to ${newUsername}`\n }\n }", "function onevent(args) {\n console.log(\"Event:\", args[0]);\n }" ]
[ "0.7149049", "0.6820767", "0.66962147", "0.6689238", "0.65391695", "0.63978416", "0.60622746", "0.59170413", "0.5913688", "0.589153", "0.5736847", "0.57039803", "0.57011735", "0.5643553", "0.5622015", "0.5607041", "0.5603649", "0.5550212", "0.5530502", "0.5510366", "0.5473056", "0.54684365", "0.54623693", "0.5450855", "0.54149634", "0.540584", "0.54002106", "0.5397547", "0.53907555", "0.53906584", "0.53792834", "0.53748167", "0.5357346", "0.5328837", "0.53273785", "0.53175324", "0.5316756", "0.53150314", "0.5299037", "0.5282086", "0.5275645", "0.5267849", "0.524194", "0.5241428", "0.5241428", "0.5241428", "0.522851", "0.5224253", "0.5209395", "0.51968384", "0.51907045", "0.5189371", "0.5188417", "0.51846284", "0.5184549", "0.51812255", "0.5171999", "0.5153836", "0.51536065", "0.51506466", "0.5148372", "0.5147169", "0.5143533", "0.5127847", "0.5127231", "0.51204467", "0.51096094", "0.5104072", "0.5102212", "0.5098869", "0.508611", "0.50822675", "0.50786304", "0.50734085", "0.50724876", "0.50724876", "0.5071832", "0.5056318", "0.5043875", "0.50435936", "0.50377285", "0.5035684", "0.5030245", "0.5021716", "0.5018477", "0.5016876", "0.5014951", "0.50129586", "0.5006893", "0.50051486", "0.50034684", "0.4996688", "0.49943742", "0.49914423", "0.4990363", "0.49890032", "0.4988207", "0.4986101", "0.4985248", "0.49837193" ]
0.6693411
3