query
stringlengths 9
14.6k
| document
stringlengths 8
5.39M
| metadata
dict | negatives
listlengths 0
30
| negative_scores
listlengths 0
30
| document_score
stringlengths 5
10
| document_rank
stringclasses 2
values |
---|---|---|---|---|---|---|
Clear WebGL (depth) after 1min of run | function clearDepth() {
renderer.clearDepth(1);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"cleanupWebGL() {}",
"function setupWebGL() {\n\n // Get the canvas and context\n var canvas = document.getElementById(\"myWebGLCanvas\"); // create a js canvas\n gl = canvas.getContext(\"webgl2\"); // get a webgl object from it\n \n try {\n if (gl == null) {\n throw \"unable to create gl context -- is your browser gl ready?\";\n } else {\n gl.clearColor(0.0, 0.0, 0.0, 1.0); // use black when we clear the frame buffer\n gl.clearDepth(1.0); // use max when we clear the depth buffer\n gl.enable(gl.DEPTH_TEST); // use hidden surface removal (with zbuffering)\n }\n } // end try\n \n catch(e) {\n console.log(e);\n } // end catch\n \n} // end setupWebGL",
"function setupWebGL() {\r\n\r\n // Get the canvas and context\r\n var canvas = document.getElementById(\"myWebGLCanvas\"); // create a js canvas\r\n gl = canvas.getContext(\"webgl\"); // get a webgl object from it\r\n \r\n try {\r\n if (gl == null) {\r\n throw \"unable to create gl context -- is your browser gl ready?\";\r\n } else {\r\n gl.clearColor(0.0, 0.0, 0.0, 1.0); // use black when we clear the frame buffer\r\n gl.clearDepth(1.0); // use max when we clear the depth buffer\r\n gl.enable(gl.DEPTH_TEST); // use hidden surface removal (with zbuffering)\r\n }\r\n } // end try\r\n \r\n catch(e) {\r\n console.log(e);\r\n } // end catch\r\n \r\n} // end setupWebGL",
"function setupWebGL() {\n\n // Get the canvas and context\n var canvas = document.getElementById(\"myWebGLCanvas\"); // create a js canvas\n gl = canvas.getContext(\"webgl\"); // get a webgl object from it\n \n try {\n if (gl == null) {\n throw \"unable to create gl context -- is your browser gl ready?\";\n } else {\n gl.clearColor(0.0, 0.0, 0.0, 1.0); // use black when we clear the frame buffer\n gl.clearDepth(1.0); // use max when we clear the depth buffer\n gl.enable(gl.DEPTH_TEST); // use hidden surface removal (with zbuffering)\n }\n } // end try\n \n catch(e) {\n console.log(e);\n } // end catch\n \n} // end setupWebGL",
"function setupWebGL() {\n\n // Get the canvas and context\n var canvas = document.getElementById(\"myWebGLCanvas\"); // create a js canvas\n gl = canvas.getContext(\"webgl\"); // get a webgl object from it\n \n try {\n if (gl == null) {\n throw \"unable to create gl context -- is your browser gl ready?\";\n } else {\n gl.clearColor(0.0, 0.0, 0.0, 1.0); // use black when we clear the frame buffer\n gl.clearDepth(1.0); // use max when we clear the depth buffer\n gl.enable(gl.DEPTH_TEST); // use hidden surface removal (with zbuffering)\n }\n } // end try\n \n catch(e) {\n console.log(e);\n } // end catch\n \n} // end setupWebGL",
"destroyWebGL() {\n // if you want to totally remove the WebGL context uncomment next line\n // and remove what's after\n //this.curtains.dispose();\n\n // if you want to only remove planes and shader pass and keep the context available\n // that way you could re init the WebGL later to display the slider again\n if(this.shaderPass) {\n this.curtains.removeShaderPass(this.shaderPass);\n }\n\n for(var i = 0; i < this.planes.length; i++) {\n this.curtains.removePlane(this.planes[i]);\n }\n }",
"clearBuffers()\n {\n this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT);\n }",
"reset() {\n this._renderer.reset();\n this._config = new WebGLConfiguration(this._renderer.state);\n }",
"function startup() {\r\n canvas = document.getElementById(\"myGLCanvas\");\r\n gl = createGLContext(canvas);\r\n setupShaders();\r\n setupBuffers();\r\n gl.clearColor(0.0, 0.0, 0.0, 1.0);\r\n gl.enable(gl.DEPTH_TEST);\r\n tick();\r\n}",
"async function initGL() {\n ctx.shaderProgram = loadAndCompileShaders(gl, \"VertexShader.glsl\", \"FragmentShader.glsl\");\n setUpBuffers();\n await setUpTextures();\n\n // set the clear color here\n gl.clearColor(0.5, 0.5, 0.5, 1);\n}",
"function startup() {\r\n canvas = document.getElementById(\"myGLCanvas\");\r\n gl = createGLContext(canvas);\r\n setupShaders(); \r\n setupBuffers();\r\n gl.clearColor(0.0, 0.0, 0.0, 0.0);\r\n gl.enable(gl.DEPTH_TEST);\r\n tick();\r\n}",
"function startup() {\n canvas = document.getElementById(\"myGLCanvas\");\n gl = createGLContext(canvas);\n setupShaders(); \n setupBuffers();\n gl.clearColor(1.0, 1.0, 1.0, 1.0);\n gl.enable(gl.DEPTH_TEST);\n tick();\n}",
"reset() {\n // WebGL context\n this.gl = this.renderer.gl;\n\n // clear the vertex data buffer\n this.vertexData.clear();\n }",
"function main() {\n const canvas = document.getElementById('main');\n\n const windowHeight = window.innerHeight;\n const windowWidth = window.innerWidth;\n\n canvas.height = windowHeight;\n canvas.width = windowWidth;\n\n const gl = canvas.getContext('webgl');\n\n gl.clear(gl.COLOR_BUFFER_BIT);\n gl.clearColor(0, 0, 0, 1);\n }",
"function webGLStart() {\n var canvas = document.getElementById(\"webglcanvas\");\n initGL(canvas);\n initShaders();\n initBuffers();\n \n // Prior to drawing the scene , clear color\n gl.clearColor(0.0, 0.0, 0.0, 1.0);\n gl.enable(gl.DEPTH_TEST);\n \n drawScene();\n }",
"function setupWebGL() {\n \n // Set up keys\n document.onkeydown = handleKeyDown; // call this when key pressed\n \n // Get the canvas and context\n var canvas = document.getElementById(\"myWebGLCanvas\"); // create a js canvas\n gl = canvas.getContext(\"webgl\"); // get a webgl object from it\n \n try {\n if (gl == null) {\n throw \"unable to create gl context -- is your browser gl ready?\";\n } else {\n gl.clearColor(0.0, 0.0, 0.0, 1.0); // use black when we clear the frame buffer\n gl.clearDepth(1.0); // use max when we clear the depth buffer\n gl.enable(gl.DEPTH_TEST); // use hidden surface removal (with zbuffering)\n }\n } // end try\n \n catch(e) {\n console.log(e);\n } // end catch\n \n} // end setupWebGL",
"function startup() {\n canvas = document.getElementById(\"myGLCanvas\");\n gl = createGLContext(canvas);\n setupShaders();\n setupBuffers_aff();\n gl.clearColor(1.0, 1.0, 1.0, 1.0);\n gl.enable(gl.DEPTH_TEST);\n tick()\n}",
"function clear_screen(){\r\n if (tracing) return;\r\n ctx.clearRect(0, 0, cnvs.width, cnvs.height);\r\n}",
"function initWebGL() {\r\n c = document.getElementById(\"c\");\r\n gl = c.getContext(\"webgl2\") || c.getContext(\"experimental-webgl2\");\r\n gl.enable(gl.DEPTH_TEST);\r\n //spector.displayUI();\r\n}",
"function startup() {\n canvas = document.getElementById(\"myGLCanvas\");\n gl = createGLContext(canvas);\n //setupShaders(\"shader-vs\",\"shader-fs\");\n //setPhongShader();\n setGouraudShader();\n setupBuffers();\n gl.clearColor(0.0, 0.0, 0.0, 1.0);\n gl.enable(gl.DEPTH_TEST);\n document.onkeydown = handleKeyDown;\n document.onkeyup = handleKeyUp;\n tick();\n}",
"function initGL() {\n \"use strict\";\n ctx.shaderProgram = loadAndCompileShaders(gl, 'VertexShader.glsl', 'FragmentShader.glsl');\n\n gl.clear(gl.DEPTH_BUFFER_BIT | gl.COLOR_BUFFER_BIT);\n gl.enable(gl.DEPTH_TEST);\n gl.enable(gl.CULL_FACE);\n gl.frontFace(gl.CCW);\n gl.cullFace(gl.BACK);\n\n setUpAttributesAndUniforms();\n setUpBuffers();\n\n // set the clear color here\n // NOTE(TF) Aufgabe 1 / Frage:\n // clearColor() only sets the color for the buffer, but doesn't actually do anything else.\n // clear() has to be called in order for the color to be painted.\n gl.clearColor(0.8, 0.8, 0.8, 1.0);\n\n // add more necessary commands here\n}",
"function initWebGL() {\n try { \n gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); \n } catch(e) {\n }\n \n if (gl) {\n WIDTH = canvas.clientWidth.toFixed(1);\n HEIGHT = canvas.clientHeight.toFixed(1);\n ui = new UI();\n ui.setObjects(generateScene());\n\t\tresult.ui = ui;\n var start = new Date();\n setInterval(function(){ tick((new Date() - start) * 0.001); }, 1000 / 60);\n } else {\n alert('Your browser does not support WebGL.');\n }\n}",
"function startup() {\n canvas = document.getElementById(\"glCanvas\");\n gl = createGLContext(canvas);\n gl.clearColor(0.0, 0.0, 0.0, 1.0);\n gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n}",
"function startup() {\n canvas = document.getElementById(\"myGLCanvas\");\n gl = createGLContext(canvas);\n setupShaders(\"shader-blinn-phong-vs\",\"shader-blinn-phong-fs\");\n setupBuffers();\n gl.clearColor(0.0, 0.0, 0.0, 1.0);\n gl.enable(gl.DEPTH_TEST);\n previousT = Date.now();\n tick();\n}",
"function cleanScene() {\n gl.clearColor(0.3, 0.3, 0.3, 1.0); // Clear to black, fully opaque\n gl.clearDepth(1.0); // Clear everything\n gl.enable(gl.DEPTH_TEST); // Enable depth testing\n gl.depthFunc(gl.LEQUAL); // Near things obscure far things\n\n // Clear the canvas before we start drawing on it.\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n clearBuffers();\n}",
"function main() {\n webgl.checkAspectRatio();\n webgl.lightingToggle(config.modes.lightingMode.currstate);\n webgl.viewModeToggle(config.modes.viewMode.currstate);\n webgl.zooming(config.core.positions.zoomRatio);\n webgl.rotation(config.core.positions.angleX, config.core.positions.angleY, config.modes.rotateMode.currstate);\n let currentTime = new Date().getTime();\n document.getElementsByClassName(\"FPS\")[0].innerText = parseInt(fpsCount / (currentTime - startTime) * 1000);\n fpsCount++;\n requestAnimationFrame(main);\n }",
"function initGL() {\r\n \"use strict\";\r\n ctx.shaderProgram = loadAndCompileShaders(gl, 'VertexShader.glsl', 'FragmentShader.glsl');\r\n setUpAttributesAndUniforms();\r\n setUpBuffers();\r\n gl.clearColor(1,0,0,0.5);\r\n}",
"function startup() {\r\n \tcanvas = document.getElementById(\"myGLCanvas\");\r\n \tgl = createGLContext(canvas);\r\n \tsetupShaders(); \r\n \tsetupBuffers();\r\n \tgl.clearColor(1.0, 1.0, 1.0, 1.0);\t//white background\r\n \tgl.enable(gl.DEPTH_TEST);\r\n \ttick();\r\n}",
"function initGL() {\n \"use strict\";\n ctx.shaderProgram = loadAndCompileShaders(gl, 'VertexShader.glsl', 'FragmentShader.glsl');\n setUpAttributesAndUniforms();\n setUpBuffers();\n \n gl.clearColor(0.1, 0.1, 0.1, 1);\n}",
"initGL() {\n \"use strict\";\n this.ctx.shaderProgram = loadAndCompileShaders(\n this.gl,\n \"VertexShader.glsl\",\n \"FragmentShader.glsl\"\n );\n this.setUpAttributesAndUniforms();\n this.setUpShapes();\n\n // set the clear color here\n this.gl.clearColor(0.2, 0.2, 0.2, 1); //-> damit wird alles übermalen (erst wenn clear)\n\n // add more necessary commands here\n }"
]
| [
"0.75271577",
"0.71244013",
"0.71184266",
"0.70930094",
"0.70930094",
"0.7053501",
"0.70499206",
"0.6935659",
"0.6922435",
"0.69011056",
"0.68858784",
"0.67867905",
"0.6778077",
"0.6760073",
"0.67220414",
"0.6694737",
"0.6636735",
"0.6630691",
"0.6625205",
"0.6611403",
"0.65857583",
"0.6549794",
"0.6531165",
"0.6523242",
"0.6520585",
"0.651656",
"0.65094763",
"0.65029615",
"0.6502684",
"0.647906"
]
| 0.7261925 | 1 |
Functions that handle ListBox selection and button actions / onListBoxAction: Called from ListBox event handlers | function onListBoxAction (data) {
if (data.index < 0) return;
switch (data.action) {
case 'navigate':
if (debug) console.log(`navigate: ${data.index}`);
updateButton(false);
break;
case 'activate':
if (debug) console.log(`activate: ${data.index}`)
sendButtonActivationMessage({
id: 'find',
index: data.index
});
break;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function listBoxSelectionCallBack(eventObj)\n{\n\tkony.print(\"\\n\\nin list box selection\\n\\n\");\n\tif(btnId==\"btnOrigin\"){\n\t\tfrmAnimation.lblSelectedOrigin.text=\"Origin: \"+(eventObj.selectedKeyValue)[1];\n\t\tkony.print(\"\\n--->\"+frmAnimation.lblSelectedOrigin.text);\n\t\t\t\t\n\t}else{\n\t\t\n\t\tfrmAnimation.lblSelectedDestination.text=\"Destination: \"+(eventObj.selectedKeyValue)[1];\n\t}\n\tfrmAnimation.hboxResultLocation.setVisibility(true, null);\n\tfrmAnimation.hboxContainer.setVisibility(true, animationConfigEnable);\n\t\n\tfrmAnimation.removeAt(1, animationConfigDisable);\n}",
"_listBoxChangeHandler(event) {\n const that = this;\n\n if ((that.dropDownAppendTo && that.dropDownAppendTo.length > 0) || that.enableShadowDOM) {\n that.$.fireEvent('change', event.detail);\n }\n\n if (that.autoComplete === 'list' && event.detail) {\n const lastSelectedItem = that.$.listBox._items[event.detail.index];\n\n that._lastSelectedItem = lastSelectedItem && lastSelectedItem.selected ? lastSelectedItem : undefined;\n }\n\n that._applySelection(that.selectionMode, event.detail);\n }",
"function ListBox_ProcessOnKeyDown(strDecodedEvent)\n{\n\t//our return value\n\tvar result = new Event_EventResult();\n\t//by default: no action\n\tvar nAction = __SELECTION_IGNORE;\n\t//switch on the event\n\tswitch (strDecodedEvent)\n\t{\n\t\tcase \"Up\":\n\t\t\t//pressing the up moves selection up\n\t\t\tnAction = __SELECTION_UP;\n\t\t\tbreak;\n\t\tcase \"Down\":\n\t\t\t//pressing the down moves the selection down\n\t\t\tnAction = __SELECTION_DOWN;\n\t\t\tbreak;\n\n\t}\n\t//want to do something?\n\tif (nAction != __SELECTION_IGNORE)\n\t{\n\t\t//get the object\n\t\tvar theObject = this.InterpreterObject;\n\t\t//since we are handling this: block its handling\n\t\tresult.Block = true;\n\t\t//we have nothing selected yet\n\t\tvar currentlySelected = -1;\n\t\t//loop through all the content\n\t\tfor (var items = theObject.Items, i = 0, c = items.length; i < c; i++)\n\t\t{\n\t\t\t//found the selected item?\n\t\t\tif (items[i].Selected)\n\t\t\t{\n\t\t\t\t//memorise it\n\t\t\t\tcurrentlySelected = i;\n\t\t\t\t//end loop\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t//want to scroll up?\n\t\tif (nAction == __SELECTION_UP)\n\t\t{\n\t\t\t//move selection up\n\t\t\tcurrentlySelected = Math.max(0, currentlySelected - 1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//move selection down\n\t\t\tcurrentlySelected = Math.min(currentlySelected + 1, theObject.Items.length - 1);\n\t\t}\n\t\t//get the data\n\t\tvar data = \"\" + (theObject.Items[currentlySelected].Index + 1);\n\t\t//create a result for unselecting it\n\t\tvar actionResult = theObject.MultiSelection ? {} : __SIMULATOR.ProcessEvent(new Event_Event(theObject, __NEMESIS_EVENT_SELECT, data));\n\t\t//not blocking it? always block in designer\n\t\tif (!actionResult.Block && !__DESIGNER_CONTROLLER)\n\t\t{\n\t\t\t//not an action?\n\t\t\tif (!actionResult.AdvanceToStateId)\n\t\t\t{\n\t\t\t\t//mark as we have a user data\n\t\t\t\ttheObject.HasUserInput = true;\n\t\t\t\t//notify that we have changed data\n\t\t\t\t__SIMULATOR.NotifyLogEvent({ Type: __LOG_USER_DATA, Name: theObject.GetDesignerName(), Data: data });\n\t\t\t}\n\t\t\t//fake the selection\n\t\t\tListBox_UpdateSelection(this, theObject, \"\" + currentlySelected);\n\t\t\t//refresh the listbox\n\t\t\tListBox_Paint(theObject);\n\t\t}\n\t}\n\t//return the result\n\treturn result;\n}",
"_listBoxChangeHandler(event) {\n const that = this;\n\n //Stop listBox's change event. TextBox will throw it's own 'change' event\n event.stopPropagation();\n\n if (event.detail.selected) {\n const label = that.$.listBox._items[event.detail.index][that.inputMember];\n\n that.$.listBox.$.filterInput.value = label;\n\n that.$.input.value = that.displayMode === 'escaped' ?\n that._toEscapedDisplayMode(label) : that._toDefaultDisplayMode(label);\n that.set('value', that._toDefaultDisplayMode(that.$.input.value));\n }\n\n if (that.autoComplete !== 'none' && typeof that.dataSource !== 'function') {\n that._autoComplete(true);\n }\n }",
"_handleListboxClick(e) {\n this._toggleListbox(!this.expanded);\n }",
"function listSelector(event) {\n // highlight selected cat's name in dropdown list\n highlightList(event);\n // set selected cat's name in header\n setName(event);\n // hide drop-down list after selection\n hideList();\n}",
"function evtHandler() {\n // console.log(\"event handler initialized\");\n //jQuery('#editbox').dialog({'autoOpen': false});\n\n jQuery('#list-usePref li').click(function () {\n\n resetClass(jQuery(this), 'active');\n jQuery(this).addClass('active');\n // console.log(\"colorSelector: \",colorSelector);\n triggerViz(styleVal);\n\n });\n\n }",
"handleListUpdate() {\n\n // Add listeners for when the user makes a selection.\n this._$el.find('input.aims-layer-input')\n .click(this.handleChange.bind(this));\n }",
"function clickList(ev) {\n\t\n\tvar sel = elList.selection.file_object;\n\tif(sel instanceof File) {\n\t\tpreview.image = thumbPath(sel);\n\t} else if(sel instanceof Folder) {\n\t\tsearch.text = \"\";\n\t\tcurrentFolder = sel;\n\t\tloadSubElements(sel);\n\t}\n\n}",
"function onListchange ( event ) {\n alert(\"list changed!\");\n }",
"_applySelection() {\n const that = this;\n\n if (that.selectionDisplayMode === 'placeholder' || that.selectedIndexes.length === 0) {\n that.$.actionButton.innerHTML = that.placeholder;\n return;\n }\n\n if (!that.$.listBox._items || that.$.listBox._items.length === 0) {\n return;\n }\n\n that.$.actionButton.innerHTML = '';\n that.$.actionButton.appendChild(that._createToken());\n }",
"function editor_tools_handle_list()\n{\n // Create the list picker on first access.\n if (!editor_tools_list_picker_obj)\n {\n // Create a new popup.\n var popup = editor_tools_construct_popup('editor-tools-list-picker', 'l');\n editor_tools_list_picker_obj = popup[0];\n var content_obj = popup[1];\n\n // Populate the new popup.\n var wrapper = document.createElement('div');\n wrapper.style.marginLeft = '1em';\n for (var i = 0; i < editor_tools_list_picker_types.length; i++)\n {\n var type = editor_tools_list_picker_types[i];\n\n var list;\n if (type == 'b') {\n list = document.createElement('ul');\n } else {\n list = document.createElement('ol');\n list.type = type;\n }\n list.style.padding = 0;\n list.style.margin = 0;\n var item = document.createElement('li');\n\n var a_obj = document.createElement('a');\n a_obj.href = 'javascript:editor_tools_handle_list_select(\"' + type + '\")';\n a_obj.innerHTML = editor_tools_translate('list type ' + type);\n\n item.appendChild(a_obj);\n list.appendChild(item);\n wrapper.appendChild(list);\n }\n content_obj.appendChild(wrapper);\n\n // Register the popup with the editor tools.\n editor_tools_register_popup_object(editor_tools_list_picker_obj);\n }\n\n // Display the popup.\n var button_obj = document.getElementById('editor-tools-img-list');\n editor_tools_toggle_popup(editor_tools_list_picker_obj, button_obj);\n}",
"_menubuttonTap(e) {\n this.shadowRoot.querySelector(\"#listbox\").style.display = \"inherit\";\n if (this.resetOnSelect) {\n this.selected = \"\";\n }\n }",
"function ListBox_Line_Mousedown(event)\n{\n\t//get event type\n\tvar evtType = Browser_GetMouseDownEventType(event);\n\t//valid?\n\tif (evtType)\n\t{\n\t\t//in touch browser? event was touch start?\n\t\tif (__BROWSER_IS_TOUCH_ENABLED && evtType == __BROWSER_EVENT_MOUSEDOWN)\n\t\t{\n\t\t\t//convert touchstarts to double clicks\n\t\t\tevtType = __BROWSER_EVENT_DOUBLECLICK;\n\t\t}\n\t\t//block the event\n\t\tBrowser_BlockEvent(event);\n\t\t//destroy menus\n\t\tPopups_TriggerCloseAll();\n\t\t//get the line we clicked on\n\t\tvar theLine = Browser_GetEventSourceElement(event);\n\t\t//search for the correct item\n\t\twhile (theLine && !theLine.Item)\n\t\t{\n\t\t\t//iterate\n\t\t\ttheLine = theLine.parentNode;\n\t\t}\n\t\t//valid?\n\t\tif (theLine && theLine.Item)\n\t\t{\n\t\t\t//retrieve our item\n\t\t\tvar item = theLine.Item;\n\t\t\t//retrieve our object\n\t\t\tvar theObject = item.InterpreterObject;\n\t\t\t//indicate to the simulator that we detected something on us\n\t\t\t__SIMULATOR.NotifyFocusEvent(null, false, theObject);\n\t\t\t//the selection state of the line\n\t\t\tvar bSelected = item.Selected;\n\t\t\t//want to reset?\n\t\t\tvar bReset = false;\n\t\t\t//event to trigger\n\t\t\tvar eEvent = false;\n\t\t\t//switch on the event\n\t\t\tswitch (evtType)\n\t\t\t{\n\t\t\t\tcase __BROWSER_EVENT_CLICK:\n\t\t\t\t\t//we in multi selection? or not selected or in designer\n\t\t\t\t\tif (theObject.MultiSelection || !bSelected || __DESIGNER_CONTROLLER)\n\t\t\t\t\t{\n\t\t\t\t\t\t//set event as click\n\t\t\t\t\t\teEvent = __NEMESIS_EVENT_SELECT;\n\t\t\t\t\t\t//toggle selection\n\t\t\t\t\t\tbSelected = !bSelected;\n\t\t\t\t\t\t//reset if we are arent multiselection\n\t\t\t\t\t\tbReset = !theObject.MultiSelection;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase __BROWSER_EVENT_MOUSERIGHT:\n\t\t\t\t\t//set event as right click\n\t\t\t\t\teEvent = __NEMESIS_EVENT_RIGHTCLICK;\n\t\t\t\t\tbreak;\n\t\t\t\tcase __BROWSER_EVENT_DOUBLECLICK:\n\t\t\t\t\t//set event as double click\n\t\t\t\t\teEvent = __NEMESIS_EVENT_DBLCLICK;\n\t\t\t\t\t//ensure it will be selected\n\t\t\t\t\tbSelected = true;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t//valid event?\n\t\t\tif (eEvent)\n\t\t\t{\n\t\t\t\t//update creation point\n\t\t\t\tPopupMenu_UpdateCreationPoint(event);\n\t\t\t\t//get the data\n\t\t\t\tvar data = \"\" + (item.Index + 1);\n\t\t\t\t//create a result for unselecting it\n\t\t\t\tvar result = (theObject.MultiSelection && eEvent == __NEMESIS_EVENT_SELECT) ? {} : __SIMULATOR.ProcessEvent(new Event_Event(theObject, eEvent, data));\n\t\t\t\t//not blocking it? always block in designer\n\t\t\t\tif (!result.Block && !__DESIGNER_CONTROLLER)\n\t\t\t\t{\n\t\t\t\t\t//not an action?\n\t\t\t\t\tif (!result.AdvanceToStateId)\n\t\t\t\t\t{\n\t\t\t\t\t\t//mark as we have a user data\n\t\t\t\t\t\ttheObject.HasUserInput = true;\n\t\t\t\t\t\t//notify that we have changed data\n\t\t\t\t\t\t__SIMULATOR.NotifyLogEvent({ Type: __LOG_USER_DATA, Name: theObject.GetDesignerName(), Data: data });\n\t\t\t\t\t}\n\t\t\t\t\t//need reset?\n\t\t\t\t\tif (bReset)\n\t\t\t\t\t{\n\t\t\t\t\t\t//loop through all the items\n\t\t\t\t\t\tfor (var i = 0, c = theObject.Items.length; i < c; i++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//unselect it\n\t\t\t\t\t\t\ttheObject.Items[i].Selected = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t//update the state of our line\n\t\t\t\t\titem.Selected = bSelected;\n\t\t\t\t\t//refresh the listbox\n\t\t\t\t\tListBox_Paint(theObject);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}",
"function ListBox(parent, name, x, y, w, h, min = 1, max = 0, show = true)\n{\n\t/* --------------------------------------------------------------------------------------\n\tvalidate parameters \n\t-------------------------------------------------------------------------------------- */\n\tvar select = -1;\t\t// content index that is selected\n\tvar mouseover = -1;\t\t// content index where mouse cursor hovers\n\tvar as = true; \t\t\t// auto-scroll feature state\n\tvar ats = true; \t\t// auto-thumbsize feature state\n\tvar res = 1;\t\t\t// scroll resolution\n\tvar showFullSel = true;\t// when enabled, ensure selected items are fully visible\n\tvar t = 24;\t\t\t\t// scrollbar thickness\n\tvar ts = 32;\t\t\t// thumbsize (ignored if ats = true)\n\n\t/* --------------------------------------------------------------------------------------\n\tbuild ui components \n\t-------------------------------------------------------------------------------------- */\n\tvar body = new Frame(parent, name + \"_body\", x, y, w, h, false, false, !show);\n\tvar scrollbar = new Slider(body, name + \"_scrollbar\", true, body.width - t, 0, t, h, ts, min*res, max*res, false);\n\n\t/*--------------------------------------------------------------------------------------\n\tassign event handlers\n\t--------------------------------------------------------------------------------------*/\n\tvar drawbeginEvents = [];\n\tvar drawendEvents = [];\n\tvar resizeEvents = [];\n\tvar mousedragEvents = [];\n\tvar drawcontentEvents = [];\n\tvar selectEvents = [];\n\tthis.addEventListener = function(e, f)\n\t{\n\t\tif (e === \"drawbegin\"){ drawbeginEvents.push(f); }\n\t\tif (e === \"drawend\"){ drawendEvents.push(f); }\n\t\tif (e === \"drawcontent\"){ drawcontentEvents.push(f); }\n\t\tif (e === \"drawthumb\"){ scrollbar.addEventListener(e, f); }\n\t\tif (e === \"drawslider\"){ scrollbar.addEventListener(\"draw\", f); }\n\t\tif (e === \"resize\"){ resizeEvents.push(f); }\t\t\n\t\tif (e === \"mousedrag\"){ mousedragEvents.push(f); }\n\t\tif (e === \"select\"){ selectEvents.push(f); }\n\t}\n\t\n\tthis.removeEventListener = function(e, f)\n\t{\n\t\tif (e === \"drawbegin\"){ for (var i = 0; i < drawbeginEvents.length; i++){ if (drawbeginEvents[i] == f){ drawbeginEvents.splice(i,1); return; }}}\t\t\t\n\t\tif (e === \"drawend\"){ for (var i = 0; i < drawendEvents.length; i++){ if (drawendEvents[i] == f){ drawendEvents.splice(i,1); return; }}}\t\t\t\n\t\tif (e === \"drawcontent\"){ for (var i = 0; i < drawcontentEvents.length; i++){ if (drawcontentEvents[i] == f){ drawcontentEvents.splice(i,1); return; }}}\t\t\t\n\t\tif (e === \"drawthumb\"){ scrollbar.removeEventListener(e, f); }\t\t\n\t\tif (e === \"drawslider\"){ scrollbar.removeEventListener(\"draw\", f); }\t\t\t\n\t\tif (e === \"resize\"){ for (var i = 0; i < resizeEvents.length; i++){ if (resizeEvents[i] == f){ resizeEvents.splice(i,1); return; }}}\t\t\t\n\t\tif (e === \"mousedrag\"){ for (var i = 0; i < mousedragEvents.length; i++){ if (mousedragEvents[i] == f){ mousedragEvents.splice(i,1); return; }}}\t\t\t\n\t\tif (e === \"select\"){ for (var i = 0; i < selectEvents.length; i++){ if (selectEvents[i] == f){ selectEvents.splice(i,1); return; }}}\t\t\t\n\t}\t\t\n\n\t/*--------------------------------------------------------------------------------------\n handle draw event here \n --------------------------------------------------------------------------------------*/\n\n\t// body is the defacto container. what you draw here is the background of the container itself\n\tbody.addEventListener(\"draw\", function(e)\n\t{\t\n\t\t// begin draw event. draw background, start clipping, etc...\n\t\tfor (var i = 0; i < drawbeginEvents.length; i++) drawbeginEvents[i]({elem: this, name: name, x: e.x, y: e.y, w: e.w, h: e.h });\n\n\t\t// draw each content. this loop will set coordinates and extent value for each item.\n\t\tvar start = Math.floor((scrollbar.value - scrollbar.min) / res);\n\t\tvar end = Math.ceil((scrollbar.value > scrollbar.max? scrollbar.max: scrollbar.value) / res);\n\t\tfor (var i = start; i < end; i++)\n\t\t{\n\t\t\t// for each content, execute all event handlers for it\n\t\t\tfor (var j = 0; j < drawcontentEvents.length; j++) \n\t\t\t{\n\t\t\t\t// contents are drawn in column\n\t\t\t\tdrawcontentEvents[j]({elem: this, name: name, i: i, \n\t\t\t\t\tx: e.x, \n\t\t\t\t\ty: e.y + h/(scrollbar.min/res) * (i - (scrollbar.value - scrollbar.min)/res ), \n\t\t\t\t\tw: e.w - (scrollbar.hide? 0 : t), \n\t\t\t\t\th: h/(scrollbar.min/res),\n\t\t\t\t\ts: (i == select? true: false), // is this content selected?\n\t\t\t\t\tm: (i == mouseover? true: false), // is mouse cursor hovering this content?\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\t// end draw event\n\t\tfor (var i = 0; i < drawendEvents.length; i++) drawendEvents[i]({elem: this, name: name, x: e.x, y: e.y, w: e.w, h: e.h });\n\t}.bind(this));\n\n\n\t/*--------------------------------------------------------------------------------------\n\twhen mouse drags over listbox, it actually drags over body so we handle it here\n\t--------------------------------------------------------------------------------------*/\n\tbody.addEventListener(\"mousedrag\", function(e)\n\t{\n\t\t// calculate the index of the list where mouse cursor intersects\n\t\tvar s = Math.floor((e.y - e.elem.getAbsPos().y) / (h/(scrollbar.min)));\n\n\t\t// assume visible.size (scrollbar.min) = content.size and calculate which content.index intersects with mouse cursor\n\t\t// this means index s can only be between 0 to visible.size - 1. let's make sure that's the case\n\t\tif (s < 0) \n\t\t{\n\t\t\tscrollbar.value -= res; // if cursor is dragged outside and above, let's scroll up\n\t\t\ts = 0;\n\t\t}\n\t\tif (s >= scrollbar.min)\n\t\t{\n\t\t\tscrollbar.value += res; // if cursor is dragged outside and below, let's scroll down\t\t\t\n\t\t\ts = scrollbar.min - 1;\n\t\t}\n\n\t\t// but what if content.size is actually smaller than visible.size? since contents are located starting at the top\n\t\t// of display, some area in display below the last content are unoccupied, and mouse cursor maybe intersecting it.\n\t\t// let's ensure the index s stays at max value then\n\t\tif (s >= scrollbar.max) s = scrollbar.max - 1;\n\t\t\n\t\t// finally, visible.size can be different from content.size, so we shift value based on scrollbar's current value.\n\t\ts += (scrollbar.value - scrollbar.min);\n\n\t\t// at this point, s is based on min/max resolution of scrollbar. let's convert it to list item resolution\n\t\ts /= res;\n\t\ts = Math.floor(s);\n\n\t\t// it's possible that selected items during mouse drag are partially visible. if this is enabled, it will update\n\t\t// scrollbar to ensure selected item is fully visible\n\t\tif (showFullSel)\n\t\t{\n\t\t\t// if select.top < value - min, value = top + min; select.top = select * res\n\t\t\tif (select*res < scrollbar.value - scrollbar.min) scrollbar.value = (select*res) + scrollbar.min;\n\n\t\t\t// if select.btm >= value, value = select.btm + min; select.btm = select * res + res - 1\n\t\t\tif (select*res + res - 1 >= scrollbar.value) scrollbar.value = (select*res + res - 1) + 1;\n\t\t}\n\n\t\t// update variables with new select values\n\t\tselect = s;\n\t\tmouseover = s;\n\n\t\t// execute event handlers for select change\n\t\tfor (var i = 0; i < selectEvents.length; i++){ selectEvents[i]({elem: this, name: name, s: select}); }\n\t}.bind(this));\n\n\t/*--------------------------------------------------------------------------------------\n\tfind the item index where mouse cursor hovers\n\t--------------------------------------------------------------------------------------*/\n\tbody.addEventListener(\"mousemove\", function(e)\n\t{\n\t\tmouseover = (e.y - e.elem.getAbsPos().y) / (h/scrollbar.min) + (scrollbar.value - scrollbar.min);\n\t\tmouseover /= res;\n\t\tmouseover = Math.floor(mouseover);\n\n\t}.bind(this));\n\n\t/*--------------------------------------------------------------------------------------\n\tno more mouseover on any item if mouse leaves listbox extent or enter \n\tits child (scrollbar)\n\t--------------------------------------------------------------------------------------*/\n\tbody.addEventListener(\"mouseleave\", function(e){ mouseover = -1;}.bind(this));\t\n\tbody.addEventListener(\"mouseout\", function(e){ mouseover = -1; }.bind(this)); \n\t\n\t/*--------------------------------------------------------------------------------------\n\tfind the item where mouse cursor click and set it as select\n\t--------------------------------------------------------------------------------------*/\n\tbody.addEventListener(\"mousedown\", function(e)\n\t{\n\t\t// calculate the index of the list where mouse cursor intersects\n\t\tselect = (e.y - e.elem.getAbsPos().y) / (h/scrollbar.min) + (scrollbar.value - scrollbar.min);\n\t\tselect /= res;\n\t\tselect = Math.floor(select);\n\n\t\t// it's possible that selected items during mouse down are partially visible. if this is enabled, it will update\n\t\t// scrollbar to ensure selected item is fully visible\n\t\tif (showFullSel)\n\t\t{\n\t\t\t// if select.top < value - min, value = top + min; select.top = select * res\n\t\t\tif (select*res < scrollbar.value - scrollbar.min) scrollbar.value = (select*res) + scrollbar.min;\n\n\t\t\t// if select.btm >= value, value = select.btm + min; select.btm = select * res + res - 1\n\t\t\tif (select*res + res - 1 >= scrollbar.value) scrollbar.value = (select*res + res - 1) + 1;\n\t\t}\n\t\t\n\t\t// execute event handlers for select change\n\t\tfor (var i = 0; i < selectEvents.length; i++){ selectEvents[i]({elem: this, name: name, s: select}); }\n\t}.bind(this));\t\t\n\n\t/*--------------------------------------------------------------------------------------\n\tupdate thumbsize based on min/max values IF auto-thumbsize feature is ON\n\totherwise, set it to fixed value ts\n\t--------------------------------------------------------------------------------------*/\n\tfunction onUpdateThumbSize()\n\t{\n\t\tif (ats)\n\t\t{\n\t\t\t// update thumbsize. make sure it's not too small or it will be too small to click\n\t\t\tscrollbar.thumbsize = scrollbar.min / scrollbar.max * h;\n\t\t\tif (scrollbar.thumbsize < ts) scrollbar.thumbsize = ts;\n\t\t}\n\t\telse scrollbar.thumbsize = ts;\n\t}\n\n\t/*--------------------------------------------------------------------------------------\n\tmin property\n\t--------------------------------------------------------------------------------------*/\n Object.defineProperty(this, \"min\", \n { \n get: function(){ return scrollbar.min/res; },\n\t\tset: function(e)\n\t\t{ \n\t\t\tscrollbar.min = e *res; \n\t\t\tscrollbar.hide = as? (scrollbar.min >= scrollbar.max? true: false): false;\t\t\n\t\t\tonUpdateThumbSize();\n\t\t} \n\t }); \n\n\t/*--------------------------------------------------------------------------------------\n\tmax property\n\t--------------------------------------------------------------------------------------*/\n\tObject.defineProperty(this, \"max\", \n\t{ \n\t\tget: function(){ return scrollbar.max/res; },\n\t\tset: function(e)\n\t\t{ \n\t\t\tscrollbar.max = e * res; \n\t\t\tscrollbar.hide = as? (scrollbar.min >= scrollbar.max? true: false): false;\t\t\n\t\t\tonUpdateThumbSize();\n\n\t\t\t// if our content size is now smaller than currently selected, let's reset select\n\t\t\tif (scrollbar.max <= select)\n\t\t\t{\n\t\t\t\tselect = -1;\n\t\t\t\t\n\t\t\t\t// execute event handlers for select change\n\t\t\t\tfor (var i = 0; i < selectEvents.length; i++){ selectEvents[i]({elem: this, name: name, s: select}); }\n\t\t\t}\n\t\t} \n\t}); \n\n\t/*--------------------------------------------------------------------------------------\n\tthumb property\n\t--------------------------------------------------------------------------------------*/\n\tObject.defineProperty(this, \"thumbsize\", \n\t{ \n\t\tget: function(){ return scrollbar.thumbsize; },\n\t\tset: function(e)\n\t\t{ \n\t\t\tts = e;\n\t\t\tonUpdateThumbSize();\n\t\t} \n\t}); \n\n\t/*--------------------------------------------------------------------------------------\n\tfixed/dynamic thumb size property\n\t--------------------------------------------------------------------------------------*/\n\tObject.defineProperty(this, \"autothumbsize\", \n\t{ \n\t\tget: function(){ return ats; },\n\t\tset: function(e)\n\t\t{ \n\t\t\tats = e;\n\t\t\tonUpdateThumbSize();\n\t\t} \n\t}); \n\n\t/*--------------------------------------------------------------------------------------\n\twidth property\n\t--------------------------------------------------------------------------------------*/\n\tObject.defineProperty(this, \"width\", \n\t{ \n\t\tget: function(){ return w; },\n\t\tset: function(e)\n\t\t{ \n\t\t\tw = e;\n\t\t\tbody.width = w;\n\t\t\tscrollbar.x = w - t;\n\t\t} \n\t}); \t\n\n\t/*--------------------------------------------------------------------------------------\n\theight property\n\t--------------------------------------------------------------------------------------*/\n\tObject.defineProperty(this, \"height\", \n\t{ \n\t\tget: function(){ return h; },\n\t\tset: function(e)\n\t\t{ \n\t\t\th = e;\n\t\t\tbody.height = h;\n\t\t\tscrollbar.height = h;\n\t\t\tonUpdateThumbSize();\n\t\t} \n\t}); \t\n\n\t/*--------------------------------------------------------------------------------------\n\tscroll resolution property\n\t--------------------------------------------------------------------------------------*/\n\tObject.defineProperty(this, \"scrollres\", \n\t{ \n\t\tget: function(){ return res; },\n\t\tset: function(e)\n\t\t{\n\t\t\tprev = res;\n\t\t\tres = e;\n\t\t\t// do this to fire up min/max property function and update stuff based on new \n\t\t\t// scroll resolution value\t\t\t\n\t\t\tthis.min = scrollbar.min / prev;\n\t\t\tthis.max = scrollbar.max / prev;\n\t\t} \n\t}); \n\n\t/*--------------------------------------------------------------------------------------\n\tselect property\n\t--------------------------------------------------------------------------------------*/\n\tObject.defineProperty(this, \"select\", {\tget: function(){ return select; } }); \t\n\n\t/*--------------------------------------------------------------------------------------\n\tscrollbar thickness (width) property\n\t--------------------------------------------------------------------------------------*/\n\tObject.defineProperty(this, \"scrollthickness\", \n\t{\t\n\t\tget: function(){ return scrollbar.width; },\n\t\tset: function(e)\n\t\t{\n\t\t\tt = e;\n\t\t\tscrollbar.width = t;\t\t\n\t\t\tscrollbar.x = body.width - t;\n\t\t}\n\t}); \t\n\n\t/*--------------------------------------------------------------------------------------\n\tautoscroll property\n\t--------------------------------------------------------------------------------------*/\n\tObject.defineProperty(this, \"autoscroll\", \n\t{ \n\t\tget: function(){ return as; },\n\t\tset: function(e)\n\t\t{ \n\t\t\tas = e; \n\t\t\tscrollbar.hide = as? (scrollbar.min >= scrollbar.max? true: false): false;\t\t\n\t\t} \n\t}); \n\n\t/*--------------------------------------------------------------------------------------\n\tvarious properties\n\t--------------------------------------------------------------------------------------*/\n\tObject.defineProperty(this, \"x\", { get: function(){ return x; }, set: function(e){ x = e; }});\n Object.defineProperty(this, \"y\", { get: function(){ return y; }, set: function(e){ y = e; }});\n Object.defineProperty(this, \"hide\", { get: function(){ return !show; }, set: function(e){ show = !e; }}); \n Object.defineProperty(this, \"name\", { get: function(){ return name; } });\n Object.defineProperty(this, \"parent\", { get: function(){ return parent; } });\n\n\t/*--------------------------------------------------------------------------------------\n\tinitialize certain properties so to update all properties before launching\n\t--------------------------------------------------------------------------------------*/\n//\tthis.min = this.min;\n}",
"function clickedItem(e) {\n\t\tvar $li = $(e.target);\n\t\tvar label = $li.attr('data-label');\n\t\tvar value = $li.attr('data-value');\n\n\t\t// Forward to update function\n\t\tselectUpdateValue(e.data,$li);\n\n\t\tselectClose(e.data);\n\t}",
"function onListWidgetClick(id) {\r\n\r\n /// get the clicked asset\r\n let selectedAsset = getAssetFromClick(id);\r\n onPickedAsset(selectedAsset);\r\n\r\n /// close the slide list if is open\r\n onListButtonClick();\r\n }",
"function useListBoxExample() {\n const [isEditing, setIsEditing] = React.useState(false);\n const [value, setValue] = React.useState(subscriptionTypes[1]);\n const [valueOnChange, setValueOnChange] = React.useState(\"\");\n\n function handleOnStart() {\n setIsEditing(true);\n }\n\n function handleClose() {\n setIsEditing(false);\n }\n\n function handleSubmit(index, options) {\n setValue(options[index].value);\n }\n\n function handleChange(index, options) {\n setValueOnChange(options[index].value);\n }\n\n return {\n onChange: handleChange,\n onSubmit: handleSubmit,\n onClose: handleClose,\n onStart: handleOnStart,\n isEditing,\n value,\n valueOnChange,\n };\n}",
"function eventListSelection(requestParams, isPersistentFromAPI) {\n\t\tconst overlayContent = $(overlay.iframe);\n\n\t\t$(document).off('mouseover touchend', 'div#listSummaryContainer > div')\n\t\t\t.on('mouseover touchend', 'div#listSummaryContainer > div', function (event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\toverlayContent.find('div#listSummaryContainer > div').removeClass('selected');\n\t\t\t\t$(this).addClass('selected');\n\t\t\t});\n\n\t\t$(document).off('click touchend', 'div#listSummaryContainer > div > button')\n\t\t\t.on('click touchend', 'div#listSummaryContainer > div > button', function (event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tvar $parent = $(this).parent(),\n\t\t\t\t\tlistName = $.trim($parent.data('name')),\n\t\t\t\t\tlistId = $.trim($parent.data('id'));\n\t\t\t\tif ($parent.hasClass('selected')) {\n\t\t\t\t\tif (listId !== '') {\n\t\t\t\t\t\taddItemToList(OP_CODE_UPDATE, {\n\t\t\t\t\t\t\tlistName: listName,\n\t\t\t\t\t\t\tlistId: listId\n\t\t\t\t\t\t}, requestParams);\n\t\t\t\t\t} else {\n\t\t\t\t\t\taddItemToList(OP_CODE_CREATE, {\n\t\t\t\t\t\t\tlistName: listName\n\t\t\t\t\t\t}, requestParams);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t});\n\n\t\t$(document).off('click', 'div#twoClickCreateList')\n\t\t\t.on('click', 'div#twoClickCreateList', function (event) {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\t// Modifying the overlay title\n\t\t\t\toverlay.setTitle('Create a List');\n\t\t\t\toverlayContent.find('div#listSaveExternal div#listContent').html($(createListTemplate));\n\n\t\t\t\toverlayContent.find('div#listSaveExternal div#listContent')\n\t\t\t\t\t.find('input#twoClickListName').focus();\n\n\t\t\t\t//Analytics\n\t\t\t\tanalytics.trackCreateListOverlay();\n\t\t\t});\n\n\t\t//Handling the enter in the create list field\n\t\t$(document).off('keypress', 'input#twoClickListName')\n\t\t\t.on('keypress', 'input#twoClickListName', function (event) {\n\t\t\t\tif (event.keyCode === 13) {\n\t\t\t\t\toverlayContent.find('button#twoClickSave').trigger('click');\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t});\n\n\t\t$(document).off('click', 'button#twoClickSave')\n\t\t\t.on('click', 'button#twoClickSave', function (event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\toverlayContent.find('span#twoClickCreateListForm').removeClass('form-input--error');\n\t\t\t\tvar listName = $('#twoClickListName').val();\n\t\t\t\tif (validateListName(listName)) {\n\t\t\t\t\taddItemToList(OP_CODE_CREATE, {\n\t\t\t\t\t\tlistName: listName\n\t\t\t\t\t}, requestParams);\n\t\t\t\t}\n\t\t\t});\n\n\t\t$('div#listSummaryContainer').scroll(function (event) {\n\t\t\tif (Math.floor($(this)[0].scrollHeight - $(this).scrollTop()) <= ($(this).outerHeight() + 5)) {\n\t\t\t\t$(this).removeClass('list--save__scroll');\n\t\t\t} else if (!$(this).hasClass('list--save__scroll')) {\n\t\t\t\t$(this).addClass('list--save__scroll');\n\t\t\t}\n\t\t});\n\n\t\t$(document).off('click', 'div#listSaveFooter a')\n\t\t\t.on('click', 'div#listSaveFooter a', function (event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tvar isRegisterTab = ($(this).data('action') === 'register') ? true : false;\n\t\t\t\tauthenticateUser(isMobile, parameters, isRegisterTab);\n\t\t\t});\n\t}",
"function populateListItems(listData, listItemTitle, selectionHandler) {\n\n //set default handler\n if (selectionHandler == null) {\n selectionHandler = defaultListSelectionHandler;\n }\n\n //set default title generator\n if (listItemTitle == null) {\n listItemTitle = defaultTitleGenerator;\n }\n\n //init list menu\n $(\"#listMenu\").popup();\n $(\"#listItems\").find(\".lovItem\").remove();\n\n $(\"#listMenu\").off(\"click\", \"li\")\n\n\n //add list items to lov\n if (listData != null && isArray(listData)) {\n for (var j = 0; j < listData.length; j++) { //row in table\n\n var liElement = $(\"<li/>\");\n liElement.addClass(\"lovItem\");\n\n for (var k in listData[j]) {\n var cellName = k;\n var cellValue = listData[j][k];\n liElement.data(cellName, cellValue);\n\n }\n\n var aElem = $(\"<a/>\");\n aElem.attr(\"href\", \"#\");\n aElem.addClass(\"ui-btn\");\n aElem.addClass(\"ui-btn-icon-right\");\n aElem.addClass(\"ui-icon-carat-r\");\n\n\n if (isFunction(listItemTitle)) {\n var text = listItemTitle.call(this, liElement.data(), j);\n aElem.text(text);\n }\n else {\n //populate list-item text\n aElem.text(liElement.data(String(listItemTitle)));\n }\n\n liElement.append(aElem);\n\n $(\"#listItems\").append(liElement);\n\n }\n }\n\n //handle item clicked\n $(\"#listMenu\").on(\"click\", \"li\",\n function () {\n $(\"#listMenu\").popup(\"close\");\n selectionHandler.call(this, $(this).data());\n }\n );\n\n $(\"#listMenu\").popup();\n\n $(\"#listMenu\").popup(\"open\");\n\n}",
"function addItemToListHandler (e) {\n\t\tvar curElement = this;\n\t\tshowOverlay(curElement,addItemToList);\n\t\te.preventDefault();\n\t}",
"addListViewItemHandlers(listItem) {\n var item = listItem.tag;\n listItem.selectedChanged.add(() => {\n if (listItem.selected) {\n this._listSelectedItem = item;\n this.detailViewOf(item);\n }\n });\n }",
"_initEvents () {\n this.el.addEventListener('click', (e) => {\n if (e.target.dataset.action in this.actions) {\n this.actions[e.target.dataset.action](e.target);\n } else this._checkForLi(e.target);\n });\n }",
"function initSelectionHandler(){\n $('button#select').on('click', function(e){\n var $filelist = $('#filelist');\n // clear the list and add the new selections\n $filelist.find('tr[data-source=\"config-browser\"]').each(function(idx, tr){\n var selection = getSelectionFromTR(tr);\n $filelist.trigger({type: 'config:removed', source: 'config-browser', selection: selection});\n });\n $(selections).each(function(idx, selection){\n $filelist.trigger({type: 'config:added', source: 'config-browser', selection: selection});\n });\n selections = [];\n });\n }",
"function SelectionChange() {}",
"function SelectionChange() {}",
"function SelectionChange() {}",
"function SelectionChange() {}",
"'click .list-selected' (event) {\n\t\tevent.preventDefault();\n\n\t\tvar list = $(event.currentTarget).attr('list-id');\n\t\tSession.set('listId', list);\n\t\tSession.set('active', list);\n\t\tFlowRouter.go('/list/'+ list);\n\t}",
"function SelectionChange() { }"
]
| [
"0.7392048",
"0.7068184",
"0.6567267",
"0.64783067",
"0.6200226",
"0.6195994",
"0.6120593",
"0.611731",
"0.6082135",
"0.602773",
"0.6025057",
"0.59951574",
"0.5970093",
"0.5878831",
"0.58513296",
"0.5822986",
"0.5816855",
"0.5792404",
"0.57719886",
"0.5727343",
"0.5692175",
"0.5691228",
"0.5642542",
"0.5638349",
"0.56356484",
"0.56356484",
"0.56356484",
"0.56356484",
"0.562441",
"0.56219274"
]
| 0.7394105 | 0 |
Handle window focus change events: If the sidebar is open in the newly focused window, save the new window ID and update the sidebar content. | function handleWindowFocusChanged (windowId) {
if (windowId !== myWindowId) {
let checkingOpenStatus = browser.sidebarAction.isOpen({ windowId });
checkingOpenStatus.then(onGotStatus, onInvalidId);
}
function onGotStatus (result) {
if (result) {
myWindowId = windowId;
runContentScripts('onFocusChanged');
if (debug) console.log(`Focus changed to window: ${myWindowId}`);
}
}
function onInvalidId (error) {
if (debug) console.log(`onInvalidId: ${error}`);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function focusHandler(){\n isWindowFocused = true;\n }",
"function focusHandler(){\n isWindowFocused = true;\n }",
"function focusHandler(){\r\n isWindowFocused = true;\r\n }",
"function updateSidebar() {\n $('.sidebar-menu li').removeClass('active');\n $('li[db-page=' + current_parent_page + ']').addClass('active');\n }",
"function closeSidebar (windowId) {\r\n//console.log(\"Background received closeSidebar notification from \"+windowId);\r\n delete isSidebarOpen[windowId];\r\n}",
"function panelShowBookmark (wId, tabId, bnId) {\r\n//console.log(\"Showing \"+bnId+\" in BSP2 sidebar \"+wId+\" for tab \"+tabId);\r\n if (isSidebarOpen[wId] == true) { // If open and ready, send message to show bnId\r\n\tsendAddonMsgShowBkmk(wId, tabId, bnId);\r\n }\r\n else { // Else, wait it is fully open, in newSidebar() callback above, to send it\r\n\tshowInSidebarWId = wId;\r\n\tshowInSidebarTabId = tabId;\r\n\tshowInSidebarBnId = bnId;\r\n }\r\n}",
"function _updateWindowState() {\n\n window.history.replaceState({},\n 'MainWindow',\n window.location.pathname + \"?\" + UrlParams.toString());\n }",
"static set_focus( wnd ) {\n let oldwnd = WINDOW.#wnd_with_focus; \n if (!wnd instanceof WINDOW) {\n return;\n }\n if (wnd === oldwnd) {\n return;\n }\n WINDOW.window_set_index(wnd, WINDOW.count);\n WINDOW.#wnd_with_focus = wnd;\n wnd.header.style.backgroundColor = wnd.titlecolor_active;\n wnd.gained_focus();\n if (oldwnd) {\n oldwnd.lost_focus();\n }\n }",
"function openSidebarWhenClicked() {\n\t\tbrowser.browserAction.onClicked.removeListener(openSidebarWhenClicked)\n\t\tbrowser.sidebarAction.open()\n\t\tbrowser.browserAction.onClicked.addListener(closeSidebarWhenClicked)\n\t}",
"function scanSidebars () {\r\n let a_winId = Object.keys(privateSidebarsList);\r\n let len = a_winId.length;\r\n for (let i=0 ; i<len ; i++) {\r\n\tlet winId = a_winId[i]; // A String\r\n\tlet windowId = privateSidebarsList[winId]; // An integer\r\n//console.log(\"Scanning \"+windowId);\r\n\tbrowser.sidebarAction.isOpen(\r\n\t {windowId: windowId}\r\n\t).then(\r\n\t function (open) {\r\n//console.log(windowId+\" is \"+open);\r\n\t\tif (!open) { // Remove from lists of open sidebars\r\n//console.log(\"Deleting \"+windowId);\r\n\t\t delete privateSidebarsList[windowId];\r\n\t\t delete isSidebarOpen[windowId];\r\n\t\t // Do not delete entry in sidebarCurId to keep it across sidebar sessions\r\n\t\t if (--len <= 0) {\r\n\t\t\tclearInterval(sidebarScanIntervalId);\r\n\t\t\tsidebarScanIntervalId = undefined;\r\n\t\t }\r\n\t\t}\r\n\t }\r\n\t).catch( // Asynchronous also, like .then\r\n\t function (err) {\r\n\t\t// window doesn't exist anymore\r\n//console.log(\"Error name: \"+err.name+\" Error message: \"+err.message);\r\n\t\tif (err.message.includes(\"Invalid window ID\")) {\r\n//console.log(\"Window doesn't exist anymore, deleting it: \"+windowId);\r\n\t\t delete privateSidebarsList[windowId];\r\n\t\t delete isSidebarOpen[windowId];\r\n\t\t // Do not delete entry in sidebarCurId to keep it across sidebar sessions\r\n\t\t let len = Object.keys(privateSidebarsList).length;\r\n\t\t if (len == 0) {\r\n\t\t\tclearInterval(sidebarScanIntervalId);\r\n\t\t\tsidebarScanIntervalId = undefined;\r\n\t\t }\r\n\t\t}\r\n\t }\r\n\t);\r\n }\r\n}",
"function focusChange(windowId) {\n\t\tgetIntentionData().then(intentionData => {\n\t\tif (intentionData.focus && windowId !== intentionData.windowId) {\n\t\t\tintentionData.focus = false\n\t\t\tintentionData.focusLost.push({\n\t\t\t\tstart: Date.now(),\n\t\t\t\tend: undefined\n\t\t\t})\n\t\t} else if (!intentionData.focus && windowId === intentionData.windowId) {\n\t\t\tlet focusIndex = intentionData.focusLost.length - 1\n\t\t\tintentionData.focus = true\n\t\t\tintentionData.focusLost[focusIndex].end = Date.now()\n\t\t}\n\n\t\tupdateIntentionData('focusChange', intentionData)\n\t})\n}",
"function handleFocus(event) {\n scope.$apply(attributes.bnWindowFocus);\n $log.warn(\"Window focused.\");\n }",
"function handleFocus() {\n scope.$apply(attributes.trWindowFocus);\n }",
"function win_focusChange(evt) {\n\t if (evt && evt.target !== window) return;\n\n\t if (document.hasFocus()) {\n\t if (iosIsPageFocused) return;\n\t iosIsPageFocused = true;\n\t pageStateCheck();\n\t } else {\n\t if (!iosIsPageFocused) return;\n\t iosIsPageFocused = false;\n\t pageStateCheck();\n\t }\n\t }",
"function createWindow() {\n\n //Initialize sql database when window is created\n const server = require('./javascript/dbService')\n \n // Create Main window with custom size\n win = new BrowserWindow({\n width: 900,\n height: 680,\n webPreferences: {\n nodeIntegration: true\n }\n })\n\n bookmarkWindow = new BrowserWindow({\n width: 400,\n height: 380,\n parent: win,\n show: false,\n webPreferences: {\n nodeIntegration: true\n }\n })\n\n newBookmarkWindow = new BrowserWindow({\n width: 400,\n height: 380,\n parent: win,\n show: false,\n webPreferences: {\n nodeIntegration: true\n }\n })\n\n // load selected html file on the main window\n win.loadFile('./src/index.html')\n bookmarkWindow.loadFile('./src/bm.html')\n newBookmarkWindow.loadFile('./src/newbookmark.html')\n // Open the DevTools.\n win.webContents.openDevTools()\n\n //disable webconsole\n //win.webContents.on(\"devtools-opened\", () => { win.webContents.closeDevTools()})\n\n/*\n bookmarkWindow.webContents.on('did-finish-load', () => {\n bookmarkWindow.webContents.send('ping', 'pong')\n })*/\n\n \n // Clear variable when application window is closed\n win.on('closed', () => {\n win = null\n })\n\n bookmarkWindow.on('close', (e) => {\n e.preventDefault()\n bookmarkWindow.hide()\n })\n\n newBookmarkWindow.on('close', (e) => {\n e.preventDefault()\n newBookmarkWindow.hide()\n })\n\n\n}",
"function handleWindowResize () {\n ctrl.lastSelectedIndex = ctrl.selectedIndex;\n ctrl.offsetLeft = fixOffset(ctrl.offsetLeft);\n\n $mdUtil.nextTick(function () {\n ctrl.updateInkBarStyles();\n updatePagination();\n });\n }",
"function handleWindowResize () {\n ctrl.lastSelectedIndex = ctrl.selectedIndex;\n ctrl.offsetLeft = fixOffset(ctrl.offsetLeft);\n $mdUtil.nextTick(function () {\n ctrl.updateInkBarStyles();\n updatePagination();\n });\n }",
"function handleWindowResize () {\n ctrl.lastSelectedIndex = ctrl.selectedIndex;\n ctrl.offsetLeft = fixOffset(ctrl.offsetLeft);\n $mdUtil.nextTick(function () {\n ctrl.updateInkBarStyles();\n updatePagination();\n });\n }",
"function handleWindowResize () {\n ctrl.lastSelectedIndex = ctrl.selectedIndex;\n ctrl.offsetLeft = fixOffset(ctrl.offsetLeft);\n $mdUtil.nextTick(function () {\n ctrl.updateInkBarStyles();\n updatePagination();\n });\n }",
"function onClickedContextMenuHandler (info, tab) {\r\n let menuItemId = info.menuItemId;\r\n//console.log(\"menuItemId = \"+menuItemId);\r\n if (menuItemId == SubMenuPathId) {\r\n//console.log(\"SubMenuPathId clicked\");\r\n\tlet bnId = info.bookmarkId;\r\n\tlet BN = curBNList[bnId];\r\n\topenPropPopup(\"prop\", bnId, BN_path(BN.parentId), BN.type, BN.title, BN.url);\r\n }\r\n else\r\n if (menuItemId == BAOpenTabId) {\r\n//console.log(\"BAOpenTabId clicked, tab id = \"+tab.id);\r\n\t// Open BSP2 in new tab, referred by this tab to come back to it when closing\r\n\topenBsp2NewTab(tab);\r\n }\r\n else if (menuItemId == BAShowInSidebar) {\r\n//console.log(\"Show \"+lastMenuBnId+\" in BSP2 sidebar\");\r\n\tif (lastMenuBnId != undefined) {\r\n\t let windowId = tab.windowId;\r\n\t // Can't use browser.sidebarAction.isOpen() here, as this is waiting for a Promise,\r\n\t // and so when it arrives we are not anymore in the code flow of a user action, so\r\n\t // the browser.sidebarAction.close() and browser.sidebarAction.open() are not working :-(\r\n\t // => Have to track state through other mechanisms to not rely on Promises ...\r\n\t if (isSidebarOpen[windowId] == true) { // Already open\r\n\t\tpanelShowBookmark(windowId, tab.id, lastMenuBnId);\r\n\t }\r\n\t else {\r\n\t\tbrowser.sidebarAction.open()\r\n\t\t.then(panelShowBookmark(windowId, tab.id, lastMenuBnId));\r\n\t }\r\n\t}\r\n }\r\n else if (menuItemId == BAHistory) {\r\n\t// Open Bookmark history window\r\n\topenBsp2History();\r\n }\r\n else if (menuItemId == BAOptionsId) {\r\n\t// Open BSP2 options\r\n\tbrowser.runtime.openOptionsPage();\r\n }\r\n}",
"function buttonClicked (tab) {\r\n//console.log(\"Background received button click\");\r\n let windowId = tab.windowId;\r\n // Can't use browser.sidebarAction.isOpen() here, as this is waiting for a Promise,\r\n // and so when it arrives we are not anymore in the code flow of a user action, so\r\n // the browser.sidebarAction.close() and browser.sidebarAction.open() are not working :-(\r\n // => Have to track state through other mechanisms to not rely on Promises ...\r\n if (isSidebarOpen[windowId] == true) {\r\n//console.log(\"Sidebar is open. Closing.\");\r\n\tbrowser.sidebarAction.close();\r\n }\r\n else {\r\n//console.log(\"Sidebar is closed. Opening.\");\r\n\tbrowser.sidebarAction.open();\r\n }\r\n}",
"function onMain() {\n //get a reference to the current Application.\n const app = fin.desktop.Application.getCurrent();\n const win = fin.desktop.Window.getCurrent();\n\n //we get the current OpenFin version\n fin.desktop.System.getVersion(version => {\n const ofVersion = document.querySelector('#of-version');\n ofVersion.innerText = version;\n });\n\n let counter = 0;\n\n const counterP = document.querySelector('#counter');\n\n setInterval(() => {\n counterP.innerText = counter++;\n }, 500);\n\n const childWinBtn = document.querySelector('#child-win');\n\n childWinBtn.addEventListener('click', () => {\n new fin.desktop.Window({\n name: `${Math.random() * 99999}`,\n url: 'http://localhost:5555/index.html',\n autoShow: true\n });\n });\n\n const contextMenu = new fin.desktop.Window({\n name: 'context-menu: ' + Math.random() * 9999999,\n url: 'http://localhost:5555/context-menu.html',\n frame: false,\n defaultHeight: 140,\n defaultWidth: 200,\n saveWindowState: false,\n alwaysOnTop: true,\n customData: win.name,\n shadow: true\n });\n\n window.addEventListener('contextmenu', (e) => {\n e.preventDefault();\n contextMenu.setBounds(e.screenX, e.screenY, null, null, () => {\n contextMenu.show(() => {\n contextMenu.focus();\n });\n });\n });\n}",
"function handleFocusIndexChange(newIndex,oldIndex){if(newIndex===oldIndex)return;if(!getElements().tabs[newIndex])return;adjustOffset();redirectFocus();}",
"function changefocus()\n{\n\tfocusedBar=document.activeElement;\n}",
"function save_sidebar_opened_status()\r\n{\r\n\tTitanium.App.Properties.setString('sidebar_opened_status', sidebar_opened_status.toString());\r\n}",
"function sidebar_handle(clicked_id, state){\n\t \n\t var NavigationBar_ID = \"navigation_sidebar\";\n\t var AlarmingBar_ID = \"alarm_sidebar\";\n\t \n\t if(clicked_id.indexOf(NavigationBar_ID) >= 0 ){\n\t \n\t\t switch(state){\n\t\t\t case 0: {\n\t\t\t\t document.getElementById(\"id_navigation_sidebar\").style.width = \"20px\";\n\t\t\t\t document.getElementById(\"id_main_content\").style.marginLeft = \"20px\";\n \t\t\t\t break;\n\t \t\t }\n\t\t \t case 1: {\n\t\t\t \t document.getElementById(\"id_navigation_sidebar\").style.width = \"200px\";\n\t\t\t\t document.getElementById(\"id_main_content\").style.marginLeft = \"200px\";\n\t\t\t\t break;\n \t\t\t }\n\t \t\t case 2:{\n\t\t \t\t if(document.getElementById(\"id_navigation_sidebar\").clientWidth > 20){\n\t\t\t \t\t document.getElementById(\"id_navigation_sidebar\").style.width = \"20px\";\n\t\t\t\t document.getElementById(\"id_main_content\").style.marginLeft = \"20px\";\n\t\t\t\t }\n\t\t\t\t else{\n\t\t\t\t\t document.getElementById(\"id_navigation_sidebar\").style.width = \"200px\";\n\t\t\t\t document.getElementById(\"id_main_content\").style.marginLeft = \"200px\";\n\t\t\t\t }\n\t\t\t\t break;\n \t\t\t }\n\t \t\t default: {\n\t\t \t break;\n\t\t\t }\n\t\t }\t\t\n\t }\n \n //handle Alarm clicks\n \n if(clicked_id.indexOf(AlarmingBar_ID) >= 0 ){\n\t \n\t\t switch(state){\n\t\t\t case 0: {\n\t\t\t\t //document.getElementById(\"id_alarm_sidebar\").style.width = \"20px\";\n\n \t\t\t\t break;\n\t \t\t }\n\t\t \t case 1: {\n\t\t\t \t //document.getElementById(\"id_alarm_sidebar\").style.width = \"200px\";\n\n\t\t\t\t break;\n\t\t\t }\n \t\t\t case 2:{\n\t \t\t\t /*if(document.getElementById(\"id_alarm_sidebar\").clientWidth > 20){\n\t\t \t\t\t document.getElementById(\"id_alarm_sidebar\").style.width = \"20px\";\n\t\t\t \t }\n\t\t\t\t else{\n\t\t\t\t\t document.getElementById(\"id_alarm_sidebar\").style.width = \"200px\";\n\t\t\t\t }\n \t\t\t\t break;*/\n\t \t\t }\n\t\t \t default: {\n\t\t\t break;\n\t\t\t }\n\t\t }\t\n\t }\n}",
"function handleWindowResize(){ctrl.lastSelectedIndex=ctrl.selectedIndex;ctrl.offsetLeft=fixOffset(ctrl.offsetLeft);$mdUtil.nextTick(function(){ctrl.updateInkBarStyles();updatePagination();});}",
"preferencesFocused() {\n\t\tfinsembleWindow.removeEventListener('focused', this.preferencesFocused);\n\t\tthis.changePreferencesAlwaysOnTop(true);\n\t}",
"function handleWindowWidthChange() {\n setWidth(window.innerWidth)\n }",
"function handleWindowWidthChange() {\n setWidth(window.innerWidth)\n }"
]
| [
"0.57622784",
"0.57622784",
"0.5707427",
"0.5674421",
"0.5631589",
"0.5615489",
"0.5607207",
"0.5587777",
"0.5506651",
"0.5482559",
"0.54382694",
"0.5414452",
"0.5411722",
"0.54102224",
"0.53714263",
"0.53623503",
"0.5355416",
"0.5355416",
"0.5355416",
"0.53215647",
"0.5285492",
"0.5260288",
"0.52292013",
"0.5214958",
"0.5213049",
"0.5205055",
"0.51876616",
"0.51866364",
"0.51599276",
"0.51599276"
]
| 0.70908797 | 0 |
getActiveTabFor: expected argument is ID of window with focus. The module variable myWindowId is updated by handleWindowFocusChanged event handler. | function getActiveTabFor (windowId) {
return new Promise (function (resolve, reject) {
let promise = browser.tabs.query({ windowId: windowId, active: true });
promise.then(
tabs => { resolve(tabs[0]) },
msg => { reject(new Error(`getActiveTabInWindow: ${msg}`)); }
)
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getTabWindowByChromeTabId (tabId) {\n const tw = this.windowIdMap.find(w => w.findChromeTabId(tabId))\n return tw\n }",
"getTabWindowByChromeId (windowId) {\n return this.windowIdMap.get(windowId)\n }",
"function getActiveTabId(e) {\n\t\tvar query = { active: true, currentWindow: true };\n\t\tfunction callback(tabs) {\n\t\t\tvar tab = tabs[0];\n\t\t\te(tab);\n\t\t\treturn tabs[0];\n\t\t}\n\t\tchrome.tabs.query(query, callback);\n\t}",
"function getActiveTab() {\n return browser.tabs.query({active: true, currentWindow: true});\n }",
"function focusWindow(tabId, windowId, callback) {\n /**\n * Updating already focused window produces bug in Edge browser\n * https://github.com/AdguardTeam/AdguardBrowserExtension/issues/675\n */\n getActive(function (activeTabId) {\n if (tabId !== activeTabId) {\n // Focus window\n browser.windows.update(windowId, { focused: true }, function () {\n if (checkLastError(\"Update window \" + windowId)) {\n return;\n }\n callback();\n });\n }\n callback();\n });\n }",
"function getActiveTab() {\n return browser.tabs.query({currentWindow: true, active: true});\n}",
"function getActiveTab() {\n return browser.tabs.query({ currentWindow: true, active: true })\n}",
"function onGetWindow(win)\n{\n chrome.tabs.getSelected(win.id, onGetTab); \n}",
"function GetModuleTabHostTab(tabId) {\n\t\tvar _result = null;\n\t\t\n\t\tif(typeof(_ActiveModules) !== \"undefined\" && _ActiveModules != null) {\n\t\t\tfor (var key in _ActiveModules) {\n\t\t\t\tif(typeof(_ActiveModules[key]) !== \"undefined\" && _ActiveModules[key] != null && _ActiveModules[key].ActiveTabs && _ActiveModules[key].ActiveTabs != null && _ActiveModules[key].HostTabId) {\n\t\t\t\t\tfor(var i = 0; i < _ActiveModules[key].ActiveTabs.length; i++) {\n\t\t\t\t\t\tif(_ActiveModules[key].ActiveTabs[i] == tabId) {\n\t\t\t\t\t\t\t_result = _ActiveModules[key];\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}\n\t\t\t\tif(_result != null)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn _result;\n\t}",
"function activateTab(window_id, tab_id) {\n chrome.tabs.update(tab_id, {active: true});\n chrome.windows.update(window_id, {focused: true});\n\n}",
"function getCurrentTab(cb) {\n chrome.tabs.query({\n 'active': true,\n 'windowId': chrome.windows.WINDOW_ID_CURRENT\n }, function (tabs) {\n cb(tabs[0]);\n });\n}",
"function getActiveTab() {\n return lt.objs.tabs.active_tab();\n }",
"function getFocusedTabId() {\n var focusedTab = ctrl.tabs[ctrl.focusIndex];\n if (!focusedTab || !focusedTab.id) {\n return null;\n }\n return 'tab-item-' + focusedTab.id;\n }",
"function handleWindowFocusChanged (windowId) {\n if (windowId !== myWindowId) {\n let checkingOpenStatus = browser.sidebarAction.isOpen({ windowId });\n checkingOpenStatus.then(onGotStatus, onInvalidId);\n }\n\n function onGotStatus (result) {\n if (result) {\n myWindowId = windowId;\n runContentScripts('onFocusChanged');\n if (debug) console.log(`Focus changed to window: ${myWindowId}`);\n }\n }\n\n function onInvalidId (error) {\n if (debug) console.log(`onInvalidId: ${error}`);\n }\n}",
"function findActiveTab() {\n\n //get information about this tab\n chrome.tabs.query({ active: true, status: \"complete\", lastFocusedWindow: true }, function (tabs) {\n\n //we may have more than one result if the tab has dev tools open\n tabs.forEach(function (tab) {\n\n setActiveTabIfValidUrl(tab);\n\n });\n\n });\n\n}",
"async function getActiveTab() {\n\tlet tabs = await browser.tabs.query({currentWindow: true, active: true});\n\tfor (let tab of tabs) {\n\t\tif (tab.active) {\n\t\t\treturn tab;\n\t\t}\n\t}\n}",
"function CurrentTab(func) {\n chrome.tabs.query({\n 'active': true,\n 'windowId': chrome.windows.WINDOW_ID_CURRENT\n },\n function (tabs) {\n if (tabs[0]) {\n func(tabs[0]);\n }\n });\n}",
"function getCurrentTab () {\n return new Promise((resolve, reject) => {\n chrome.tabs.query({active: true, currentWindow: true}, tabs => {\n let tab = tabs[0];\n if (!tab || typeof tab.id === 'undefined' || (tab.url || '').startsWith('chrome://')) {\n reject('notAllowed');\n }\n resolve(tab);\n });\n });\n}",
"static queryActiveTab() {\r\n return Utils.queryTab({\r\n active: true,\r\n currentWindow: true,\r\n })\r\n }",
"function GetModuleHostTab(moduleId) {\n\t\tvar _result = null;\n\t\t\n\t\tif(typeof(_ActiveModules) !== \"undefined\" && _ActiveModules != null) {\n\t\t\tfor (var key in _ActiveModules) {\n\t\t\t\tif(key == moduleId && typeof(_ActiveModules[key]) !== \"undefined\" && _ActiveModules[key] != null && _ActiveModules[key].HostTabId) {\n\t\t\t\t\t_result = _ActiveModules[key].HostTabId;\n\t\t\t\t}\n\t\t\t\tif(_result != null)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn _result;\n\t}",
"function getTabId(tabId) {\n let id = tabId.id;\n if (!id) {\n id = tabId;\n }\n return id;\n}",
"function getCurrentTab(callback)\n\t\t{\n\t\t\tif (window.chrome && chrome.tabs)\n\t\t\t{\n\t\t\t\tchrome.tabs.query({ active: true, lastFocusedWindow: true}, function(tabs) { callback(tabs[0]); });\n\t\t\t}\n\t\t}",
"function doInCurrentTab(tabCallback) {\n browser.tabs.query(\n { currentWindow: true, active: true },\n function (tabArray) {tabCallback(tabArray[0]);}\n );\n}",
"function doInCurrentTab(tabCallback) {\n chrome.tabs.query(\n { currentWindow: true, active: true },\n function (tabArray) { tabCallback(tabArray[0]);}\n );\n}",
"getTabIndex(id) {\n for (let i = 0; i < this._tabs.length; i++) {\n if (this._tabs[i].sessionId === id) {\n return i\n }\n }\n return -1\n }",
"function activeTabChanged(activeInfo) {\n if (activeInfo) {\n var tabId = activeInfo.tabId;\n if (tabId) {\n getCurrentTabUrl();\n }\n }\n}",
"function getSelectedTab(tabs) {\n const childId = window.location.hash.split(\"=\")[1];\n return tabs.find((tab) => tab.actor.includes(childId));\n}",
"function updateActiveTab () {\n let gettingActiveTab = browser.tabs.query({active: true, currentWindow: true})\n gettingActiveTab.then(updateTab, onError)\n}",
"syncChromeWindow (chromeWindow) {\n const prevTabWindow = this.windowIdMap.get(chromeWindow.id)\n /*\n if (!prevTabWindow) {\n log.log(\"syncChromeWindow: detected new chromeWindow: \", chromeWindow)\n }\n */\n const tabWindow = prevTabWindow ? TabWindow.updateWindow(prevTabWindow, chromeWindow) : TabWindow.makeChromeTabWindow(chromeWindow)\n const stReg = this.registerTabWindow(tabWindow)\n\n // if window has focus and is a 'normal' window, update current window id:\n const updCurrent = chromeWindow.focused && validChromeWindow(chromeWindow, true)\n const st = updCurrent ? stReg.set('currentWindowId', chromeWindow.id) : stReg\n\n if (updCurrent) {\n log.log('syncChromeWindow: updated current window to: ', chromeWindow.id)\n }\n\n return st\n }",
"getCurrentTab() {\n return window.location.pathname.split('/')[2];\n }"
]
| [
"0.74438876",
"0.74290186",
"0.6755566",
"0.66839886",
"0.6648591",
"0.655822",
"0.64862543",
"0.64339864",
"0.6389305",
"0.6357002",
"0.6334173",
"0.6326636",
"0.62317747",
"0.6226168",
"0.6186943",
"0.6168544",
"0.61467344",
"0.61053",
"0.60988045",
"0.6039023",
"0.60050756",
"0.59295344",
"0.5871654",
"0.585558",
"0.5854682",
"0.58291847",
"0.5815294",
"0.57867986",
"0.57650536",
"0.57532537"
]
| 0.7634702 | 0 |
Restoring the checkbox statuses | function restoreChkbxStatus(len, increment) {
const testArray = JSON.parse(localStorage.getItem('checkboxStatuses'));
const anotherArray = JSON.parse(localStorage.getItem('displayStatuses'));
for (var k = 0; k < len; k++) {
entryList[k + increment].checked = testArray[k];
entryList[k + increment].parentNode.style.display = anotherArray[k];
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function syncronizeCheckboxes(clicked, pri, pub) {\n pri.checked = false;\n pub.checked = false;\n clicked.checked = true;\n }",
"function restore() {\n var i = 0;\n var list;\n while (that.data.lists[i] !== undefined) {\n list = that.data.lists[i];\n if (list.tChecked) {\n that.data.lists.splice(i, 1);\n removeListOnStorage(list.id, that.config.listKey);\n // make sure the list won't be checked if it ends in trash can again\n resetTchecked(list);\n gevent.fire(\"updateList\", list);\n } else {\n i++;\n }\n }\n }",
"function checkState() {\n for (var j = 0; j < entryList.length; j++) {\n checkedAttribs[j] = entryList[j].checked;\n // Verify the checked values with a console statement\n // console.log(entryList[j].checked + \"\" + j);\n classHidden[j] = entryList[j].parentNode.style.display;\n }\n console.log(classHidden);\n localStorage.setItem('checkboxStatuses', JSON.stringify(checkedAttribs));\n localStorage.setItem('displayStatuses', JSON.stringify(classHidden));\n}",
"function updateQuestions() {\n for (var i = 0; i < sortingCheckboxes.length; i++) {\n sortingCheckboxes[i].checked = false;\n }\n}",
"function setCheckBoxStatus(index, id) {\r\n\tvar checked = true;\r\n document.getElementById('' + id + index).checked = checked;\r\n nlapiSetLineItemValue('custpage_list', id + 'val', index, (checked ? 'T'\r\n : 'F'));\r\n var val = nlapiGetLineItemValue('custpage_list', id + 'val', index);\r\n if(val == 'T'){\r\n unload_flag++;\r\n }\r\n else{\r\n unload_flag--;\r\n }\r\n\t/*\r\n if(unload_flag != 0){\r\n window.onbeforeunload = function () {\r\n return \"You have some unsubmitted data.\";\r\n };\r\n }\r\n else{\r\n window.onbeforeunload = null;\r\n }\r\n\t*/\r\n\r\n}",
"toggleCheckedOutStatus() {\n this._isCheckedOut = !this._isCheckedOut;\n }",
"function resetTchecked(list) {\n list.tChecked = undefined;\n }",
"function clearPendingValueStatus(){\n _.each(pendingValueStatus, function(value){\n value.save({\"status\": \"ok\"}, {wait: true});\n });\n}",
"function applyCheckbox(box)\n{\n\tif (box.checked)\n\t{\n\t\tuncheckedCount--\n\t\tupdateUnchecked()\n\t}\n\telse\n\t{\t\n\t\tuncheckedCount++\n\t\tupdateUnchecked()\n\t}\n}",
"function unit_chkboxchange(status) {\r\n\tfor (i in trackerunitchk) {\r\n\t\t$(trackerunitchk[i]).checked = status;\r\n\t}\r\n}",
"function deselectCBs() {\n d3.selectAll('.type-checkbox')\n .property('checked', false)\n update();\n d3.select('.kasiosCheckbox')\n .property('checked', false)\n kasios_update();\n}",
"function deSelectAnswers(){\r\n answer1.forEach((e) =>{\r\n e.checked=false;\r\n });\r\n}",
"function mouveLeaveCheckBoxes() {\n highlight.bubble = -1;\n highlight.inHist = null;\n refreshDisplay();\n}",
"function updateCheckboxes(){\n\t$(\"table.benchmarks input\").each(function(i,obj){\n\t\t$(obj).attr('checked',(checked_benchmarks.indexOf(obj.value)!=-1));\n\t});\n}",
"function updateCheckUncheck() {\n checkedState = !checkedState;\n if (checkedState) {\n browser.menus.update(\"check-uncheck\", {\n title: browser.i18n.getMessage(\"menuItemUncheckMe\"),\n });\n } else {\n browser.menus.update(\"check-uncheck\", {\n title: browser.i18n.getMessage(\"menuItemCheckMe\"),\n });\n }\n}",
"updateCheckboxes() {\n for (const id of this.compareList.keys()) {\n this._checkCheckbox(id);\n }\n }",
"toggleCheckOutStatus() {\n this._isCheckedOut ? this._isCheckedOut = false : this._isCheckedOut = true;\n }",
"clearStates() {\n // applications should extend this to actually do something, assuming they can save locally\n }",
"unCheckAll() {\n this.$selectAllCheckbox.prop('checked', false);\n this.$checkboxes.prop('checked', false);\n }",
"function saveIndividualCheckbox() {\n if (saveIndividualID.checked == false) {\n saveLocalCheckboxID.disabled = true;\n saveLocalID.classList.add(\"greyOut\");\n saveLocalCheckboxID.checked = false;\n } else {\n saveLocalCheckboxID.checked = userSettings.saveLocal;\n saveLocalCheckboxID.disabled = false;\n saveLocalID.classList.remove(\"greyOut\");\n }\n}",
"function setCheckButtonToInactive() {\n\t\t_myDispatcher.dispatch(\"iteration.checkbutton\", {\"state\":\"inactive\"});\n\t}",
"clearEventLogRecordingsCheckbox() {\n this.packetRoot_.getElementsByTagName('input')[0].checked = false;\n }",
"function uncheck(e) {\n // console.log(e);\n e.forEach((x) => x.checked = false)\n}",
"function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n panel: true,\n remove: true,\n notify: true,\n restyle: true,\n console: false,\n console_deep: false,\n }, (items) => {\n for (let item in items) {\n document.getElementById(item).checked = items[item];\n }\n });\n}",
"function cbChange(obj) {\nvar instate=(obj.checked);\n var cbs = document.getElementsByClassName(\"cb\");\n for (var i = 0; i < cbs.length; i++) {\n cbs[i].checked = false;\n }\n if(instate)obj.checked = true;\n}",
"function update_status(context){\n let group = $(context).attr('data-check-selector-group');\n let checked = 0;\n let unchecked = 0;\n\n console.log('Checkbox Changed!');\n\n // check state of all checkboxes in the group\n $(`input[type=\"checkbox\"][data-check-selector-group=\"${group}\"]`).each(function(index){\n if($(this).prop('checked')) {\n checked += 1;\n } else {\n unchecked += 1;\n }\n });\n\n if( checked <= unchecked ) {\n select(group);\n } else {\n unselect(group);\n }\n }",
"function clearAllCheckbox() {\n\t\tvar checkbox \t= 'input:checkbox';\n\t\tvar tr \t\t\t= 'tr';\n\t\t\n\t\t$(checkbox).removeAttr('checked');\n\t\t$(tr).removeClass(\"highlight\");\n\t\t$(checkbox).removeAttr('indeterminate');\n\t\t$(checkbox).prop(\"indeterminate\", false); \n\t\treset_check = true;\n\t\tkeepDirectionCheckboxes();\n\t}",
"function restore_options() {\n document.getElementById(\"no_count\").checked = localStorage[\"tweet_nocount\"] == 1;\n document.getElementById(\"no_via\").checked = localStorage[\"tweet_novia\"] == 1;\n}",
"function resetCheckbox(event) {\n event.target.checked = event.target.hasAttribute('checked');\n}",
"function restore_options() {\n $('input:checkbox').click(function() {\n localStorage[this.id] = this.checked;\n chrome.tabs.sendRequest(parseInt(localStorage[\"tabID\"]), {'action' : 'restore_settings'}, function(response) {\n\n });\n show_success();\n if (this.id == 'notifications') {\n $('#mini_player').attr('disabled', !this.checked);\n $('#mini_player').parents('blockquote').toggleClass('disabled');\n }\n });\n $('input:checkbox').each(function(index) {\n if (localStorage[this.id] === undefined && this.id != 'support' && this.id != 'mini_player') {\n // console.log('first run, setting to true');\n localStorage[this.id] = 'false';\n }\n if (localStorage[this.id] == 'true') {\n this.checked = true;\n\n }\n else {\n this.checked = false;\n }\n });\n\n }"
]
| [
"0.6916666",
"0.6393776",
"0.6352745",
"0.63186836",
"0.6316324",
"0.62939316",
"0.6279714",
"0.62796664",
"0.62531996",
"0.62198687",
"0.6215878",
"0.6199987",
"0.6190296",
"0.61751896",
"0.6167841",
"0.6148121",
"0.6143057",
"0.61397487",
"0.6138587",
"0.6122321",
"0.61201364",
"0.6098491",
"0.6092392",
"0.60754985",
"0.605519",
"0.6037653",
"0.6027816",
"0.60247815",
"0.60190904",
"0.6009829"
]
| 0.70359266 | 0 |
Show the Remove All button if there are more than one entries. | function showRemoveBtn() {
if (document.getElementById('entries').childElementCount > 1) {
document.getElementById('removeBtn').style.display = 'initial';
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"displayDeleteAll() {\n const deleteAllBtn = document.querySelector('.deleteAll');\n // add button if guest array bigger than zero and no deleteAllButton\n if (party.guests.length && !deleteAllBtn) {\n const tableContainer = document.querySelector('#tableContainer');\n tableContainer.appendChild(this.createDeleteButton());\n // remove button if guest array zero and deleteAllButton exists\n } else if (!party.guests.length && deleteAllBtn) {\n deleteAllBtn.remove();\n }\n }",
"function handleRemoveButtons() {\n var removeButtons = $('.remove_search');\n if (removeButtons.length <= 1) {\n removeButtons.attr('disabled', 'disabled').hide();\n } else {\n removeButtons.removeAttr('disabled').show();\n }\n }",
"function addClear() {\n\t\tif (toDoList.length >= 1) {\n\t\t\t$(\"button#add\").addClass(\"add\");\n\t\t\t$(\"button#clear\").show().addClass(\"clear\");\n\t\t}\n\t\tif (toDoList.length < 1){\n\t\t\t$(\"button#add\").removeClass(\"add\");\n\t\t\t$(\"button#clear\").hide().removeClass(\"clear\");\n\t\t}\n\t}",
"onStoreRemoveAll() {\n // GridSelection mixin does its job on records removing\n super.onStoreRemoveAll && super.onStoreRemoveAll(...arguments);\n\n if (this.rendered) {\n this.renderRows();\n this.showEmptyText();\n }\n }",
"checkToShowAddButton() {\n const hasResult = this.hasQuery && (! this.hasUsers && ! this.hasDepartment);\n\n this.setShowAddButton( hasResult );\n }",
"function btnExcludeAll() {\n const eraseAll = document.querySelectorAll('.li-options');\n for (let erase of eraseAll) {\n if (confirm('Tem certeza de que deseja excluir TODAS as atividades?')) {\n erase.remove();\n }\n } \n archiveSet();\n }",
"function clearAllHandler() {\n trash = toDoList.filter((task) => task.isDone == true);\n toDoList = toDoList.filter((task) => task.isDone == false);\n commitToLocalStorage(toDoList);\n reRender();\n}",
"function editAllTags(){\n var counter = 0\n $('#all-tags-button').on('click', function(e){\n if(counter == 0){\n $('.tags').show();\n $('.del').show()\n counter = 1\n }else{\n $('.tags').hide();\n $('.del').hide();\n counter = 0\n };\n })\n}",
"function removeButton(){\n $(\"#car-view\").empty();\n var topic = $(this).attr('data-name');\n var itemindex = topics.indexOf(topic);\n if (itemindex > -1) {\n topics.splice(itemindex, 1);\n renderButtons();\n }\n }",
"function toggleRemoveButtonsVisibility() {\n if ($('.load-cars-editing-item').length > 1) {\n $('.remove-load-car-model').removeClass('hidden');\n } else {\n $('.remove-load-car-model').addClass('hidden');\n }\n}",
"function delete_all() {\n\n $(document).on('click', '.del_all', function() {\n $('#form_data').submit();\n });\n \n\n $(document).on('click', '.delBtn', function() {\n var item_checked = $('input[class=\"item_checkbox\"]:checkbox').filter(':checked').length;\n if ( item_checked > 0 ) {\n\n $('.notEmptyRecord').removeClass('hidden') ;\n $('.record_count').text(item_checked);\n $('.emptyRecord').addClass('hidden') ;\n } else {\n $('.emptyRecord').removeClass('hidden') ;\n $('.notEmptyRecord').addClass('hidden') ;\n }\n $('#multipleDelete').modal('show');\n //alert('done');\n });\n}",
"function handleRemoveButtons(buttonParentTr) {\n var removeButtons = $('.remove_search');\n if (buttonParentTr.find(removeButtons).length <= 1) {\n buttonParentTr.find(removeButtons).hide();\n } else {\n buttonParentTr.find(removeButtons).show();\n }\n }",
"function removeShowAllLink() {\n\t$('.show-all').remove();\n}",
"function showAddNewIfNeeded(allSessions) {\n if (allSessions.length == 0) {\n showAddNewButton();\n }\n}",
"function m_removeall()\n{\n\twhile(c_alldata.length>0)\n\t{\n\t\tc_alldata[c_alldata.length-1].c_disp.innerHTML=\"\";\n\t\tc_alldata.pop();\n\t}\n\t ref_thumb();\n}",
"function removeAll() {\n var deleteAll = confirm(\"Do you really want to remove all the tasks?\");\n //if user clicks okay returns true. Gives and empty strings for both lists\n if (deleteAll == true) {\n document.getElementById(\"tasksTodo\").innerHTML =\"\"\n document.getElementById(\"tasksDone\").innerHTML=\"\"\n //Saved in local storage and updating taskCount\n updateLocalStorage()\n taskCount();\n }\n}",
"function hideDeleteButtons(){\n $('li').find('.delmark').hide();\n }",
"function removeEntries() {\n // Find all entries\n var $entries = $schedule.find('.entry');\n\n // Delete them\n $entries.fadeOut(function () {\n $entries.remove();\n });\n\n return false;\n }",
"function processCollections() {\n var collections = $('.collection');\n if (collections.length > 1) {\n $('.showHideButton').show();\n }\n}",
"function showDelete(listItems, deleteAll){\n if (listItems.length > 0) {\n deleteAll.classList.remove('task_close-js');\n }else{\n deleteAll.classList.add('task_close-js');\n }\n}",
"function showDialogForDeleteAll(amountOfSaves) {\n\t\tvar dialog = new Dialog({\n\t\t\ttitle: 'Remove all ' + amountOfSaves + ' save(s)?',\n\t\t\ttype: 'confirm',\t\t\t\t\n\t\t\tmessage: 'Are you sure you want to remove all ' + amountOfSaves + ' save(s) from your My List?',\t\t\t\n\t\t\tbuttonsCssClass: 'my-list',\n\t\t\tshowCloseIcon: false,\n\t\t\tcloseButtonCssClass: 'btn-default',\n\t\t\tkeyboard: false,\n\t\t\tmoveable: true,\n\t\t\tbuttons: {\n\t\t\t\t'Remove': function() {\n\t\t\t\t\t// Remove all saves from the session.\n\t\t\t\t\t$.ajax({\n\t\t\t\t\t\turl: contextPath + '/myList/all/remove',\n\t\t\t\t\t\tsuccess: function() {\n\t\t\t\t\t\t\tdialog.hide();\t\n\t\t\t\t\t\t\twindow.location.href = context + '/myList';\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror: function() {\n\t\t\t\t\t\t\tMessages.addMessage({\n\t\t\t\t\t\t\t\tmessage: \"Error removing all your items from your My List.\",\n\t\t\t\t\t\t\t\tseverity: 'ERROR'\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},\n\t\t});\n\t\t\n\t\tdialog.show();\n\t}",
"function clickOnRemoveAll(event)\n {\n event.stopPropagation();\n event.preventDefault();\n\n if (options.removeAllConfirmation) {\n if ( confirm(options.removeAllConfirmationMsg) ) {\n removeAllForms();\n }\n } else {\n removeAllForms();\n }\n }",
"function clearAll(e) {\n e.preventDefault();\n while (table.rows.length > 1) {\n table.deleteRow(1);\n }\n}",
"function removeAll() {\n $('tbody').empty();\n $('.strike-all').prop('checked', false);\n $(this).parent().hide();\n}",
"function trashOption() {\n let posts = document.getElementsByClassName(\"trash\");\n let delButton = document.getElementById(\"delete\");\n let change = \"none\";\n if (delButton.textContent == \"Delete one of your Posts\") {\n delButton.textContent = \"Go back to Posting Mode\";\n change = \"block\";\n document.getElementById(\"add\").disabled = true;\n document.getElementById(\"upload\").disabled = true;\n }\n else {\n delButton.textContent = \"Delete one of your Posts\";\n document.getElementById(\"add\").disabled = false;\n document.getElementById(\"upload\").disabled = false;\n }\n for (let i = 0; i < posts.length; i++) {\n posts.item(i).style.display = change;\n }\n}",
"function changeDeleteButtonVisibility() {\n if (checkedCheckboxes.length > 0) {\n showDeleteButton();\n } else {\n hideDeleteButton();\n }\n}",
"function SupprimerDuPanier(button) {\n\tdocument.getElementById(\"searchbar\").value = \"\";\n\tvar name = $(button).parent().find(\".title\").html();\n\tfor (var i = 0; i < panier.length; i++) {\n\t\tif(panier[i].name == name) {\n\t\t\tpanier.splice(i, 1);\n\t\t\tRefreshPanier();\n\t\t\treturn;\n\t\t}\n\t}\n}",
"function removeall() {\r\n //remove all entities\r\n\t viewer.entities.removeAll();\r\n\t //reset RankMark\r\n\t FlagandNames = new Array();\r\n\t RankMark = new Array();\r\n\t\t//Redraw floatLabel\r\n floatlabel = viewer.entities.add({\r\n\t\t\tlabel : {\r\n\t\t\t\tshow : true,\r\n\t\t\t\tstyle: Cesium.LabelStyle.FILL_AND_OUTLINE,\r\n\t\t\t\tscale : 0.4,\r\n\t\t\t\thorizontalOrigin: Cesium.HorizontalOrigin.CENTER,\r\n\t\t\t\tverticalOrigin : Cesium.VerticalOrigin.CENTER,\r\n\t\t\t\tfillColor : Cesium.Color.WHITE,\r\n\t\t\t\toutlineColor : Cesium.Color.GRAY,\r\n\t\t\t\teyeOffset : new Cesium.ConstantProperty(new Cesium.Cartesian3(0,0, -1200000)),\r\n\t\t\t\t//translucencyByDistance : new Cesium.NearFarScalar(1e7,1.0,12e6,0.0)\r\n\t\t\t},\r\n\t\t\tbillboard :{\r\n\t\t\t\tshow : true,\r\n\t\t\t\twidth : 150,\r\n\t\t\t\theight: 50,\r\n\t\t\t\thorizontalOrigin: Cesium.HorizontalOrigin.CENTER,\r\n\t\t\t\tverticalOrigin : Cesium.VerticalOrigin.CENTER,\r\n\t\t\t\tcolor : 'images/black.png',\r\n\t\t\t\teyeOffset : new Cesium.ConstantProperty(new Cesium.Cartesian3(0,0, -1100000)),\r\n\t\t\t}\r\n\t\t});\r\n\t}",
"function delAll(){\n document.getElementById(\"taskList\").innerHTML = '';\n}",
"resetDeleteButtons() {\n const buttonsDelete = this.elements.content.getElementsByClassName('button-delete');\n\n buttonsDelete.forEach((e) => {\n e.style.display = 'block';\n });\n\n const buttonsReallyDelete = this.elements.content.getElementsByClassName('button-really-delete');\n\n buttonsReallyDelete.forEach((e) => {\n e.style.display = 'none';\n });\n }"
]
| [
"0.72400993",
"0.66364855",
"0.6522446",
"0.62390465",
"0.6174773",
"0.61586815",
"0.61159176",
"0.60888386",
"0.6069556",
"0.6066277",
"0.6054565",
"0.590161",
"0.5832153",
"0.5826949",
"0.5823255",
"0.58211416",
"0.58107257",
"0.58070296",
"0.5759274",
"0.5747089",
"0.5741348",
"0.5739693",
"0.57284415",
"0.5723943",
"0.5714319",
"0.5703777",
"0.56979555",
"0.5697865",
"0.56941664",
"0.5692441"
]
| 0.71412474 | 1 |
takes wavelength in nm and returns an rgba value adapted from | function wavelengthToColor(wavelength) {
var r, g, b, alpha, colorSpace,
wl = wavelength,
gamma = 1;
// UV to indigo:
if (wl >= 380 && wl < 440) {
R = -1 * (wl - 440) / (440 - 380);
G = 0;
B = 1;
// indigo to blue:
} else if (wl >= 440 && wl < 490) {
R = 0;
G = (wl - 440) / (490 - 440);
B = 1;
// blue to green:
} else if (wl >= 490 && wl < 510) {
R = 0;
G = 1;
B = -1 * (wl - 510) / (510 - 490);
// green to yellow:
} else if (wl >= 510 && wl < 580) {
R = (wl - 510) / (580 - 510);
G = 1;
B = 0;
// yellow to orange:
} else if (wl >= 580 && wl < 645) {
R = 1;
G = -1 * (wl - 645) / (645 - 580);
B = 0.0;
// orange to red:
} else if (wl >= 645 && wl <= 780) {
R = 1;
G = 0;
B = 0;
// IR:
} else {
R = 0;
G = 0;
B = 0;
}
// intensity is lower at the edges of the visible spectrum.
if (wl > 780 || wl < 380) {
alpha = 0;
} else if (wl > 700) {
alpha = (780 - wl) / (780 - 700);
} else if (wl < 420) {
alpha = (wl - 380) / (420 - 380);
} else {
alpha = 1;
}
// combine it all:
colorSpace = "rgba(" + (R * 100) + "%," + (G * 100) + "%," + (B * 100) + "%, " + alpha + ")";
return colorSpace;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function wavelengthToColor(wavelength) {\n var r,g,b,alpha,\n colorSpace,\n wl = wavelength,\n gamma = 1;\n \n if (wl >= 380 && wl < 440) {\n R = -1 * (wl - 440) / (440 - 380);\n G = 0;\n B = 1;\n } else if (wl >= 440 && wl < 490) {\n R = 0;\n G = (wl - 440) / (490 - 440);\n B = 1; \n } else if (wl >= 490 && wl < 510) {\n R = 0;\n G = 1;\n B = -1 * (wl - 510) / (510 - 490);\n } else if (wl >= 510 && wl < 580) {\n R = (wl - 510) / (580 - 510);\n G = 1;\n B = 0;\n } else if (wl >= 580 && wl < 645) {\n R = 1;\n G = -1 * (wl - 645) / (645 - 580);\n B = 0.0;\n } else if (wl >= 645) { //if (wl >= 645 && wl <= 780)\n R = 1;\n G = 0;\n B = 0;\n } else {\n R = 1;\n G = 1;\n B = 1;\n }\n \n // intensty is lower at the edges of the visible spectrum.\n if (wl > 780 || wl < 380) {\n alpha = 0;\n } else if (wl > 700) {\n alpha = (780 - wl) / (780 - 700);\n } else if (wl < 420) {\n alpha = (wl - 380) / (420 - 380);\n } else {\n alpha = 1;\n }\n \n // colorSpace = [\"rgba(\" + (R * 100) + \",\" + (G * 100) + \",\" + (B * 100) + \", \" + alpha + \")\", R, G, B, alpha]\n colorSpace = [\"rgb(\" + Math.floor(R * 255) + \",\" + Math.floor(G * 255) + \",\" + Math.floor(B * 255) + \")\", R, G, B, alpha];\n\n return colorSpace;\n}",
"function waveLengthToRGB(Wavelength) {\r\n\t\tvar factor;\r\n\t\tvar Red,Green,Blue;\r\n\t\tvar Gamma = 0.80;\r\n\t\tvar IntensityMax = 255;\r\n\t\t/*if((Wavelength >= 380) && (Wavelength<440)){\r\n\t\t\tRed = -(Wavelength - 440) / (440 - 380);\r\n\t\t\tGreen = 0.0;\r\n\t\t\tBlue = 1.0;\r\n\t\t}else*/ \r\n\t\tif((Wavelength >= 380) && (Wavelength<440)){\r\n\t\t\tRed = 0.0;\r\n\t\t\tGreen = 0.0;\r\n\t\t\tBlue = (Wavelength - 380) / (440 - 380);;\r\n\t\t}else if((Wavelength >= 440) && (Wavelength<490)){\r\n\t\t\tRed = 0.0;\r\n\t\t\tGreen = (Wavelength - 440) / (490 - 440);\r\n\t\t\tBlue = 1.0;\r\n\t\t}else if((Wavelength >= 490) && (Wavelength<510)){\r\n\t\t\tRed = 0.0;\r\n\t\t\tGreen = 1.0;\r\n\t\t\tBlue = -(Wavelength - 510) / (510 - 490);\r\n\t\t}else if((Wavelength >= 510) && (Wavelength<580)){\r\n\t\t\tRed = (Wavelength - 510) / (580 - 510);\r\n\t\t\tGreen = 1.0;\r\n\t\t\tBlue = 0.0;\r\n\t\t}else if((Wavelength >= 580) && (Wavelength<645)){\r\n\t\t\tRed = 1.0;\r\n\t\t\tGreen = -(Wavelength - 645) / (645 - 580);\r\n\t\t\tBlue = 0.0;\r\n\t\t}else if((Wavelength >= 645) && (Wavelength<781)){\r\n\t\t\tRed = 1.0;\r\n\t\t\tGreen = 0.0;\r\n\t\t\tBlue = 0.0;\r\n\t\t}else{\r\n\t\t\tRed = 0.0;\r\n\t\t\tGreen = 0.0;\r\n\t\t\tBlue = 0.0;\r\n\t\t}\r\n\r\n\t\t// Let the intensity fall off near the vision limits\r\n\t\tif((Wavelength >= 380) && (Wavelength<420)){\r\n\t\t\tfactor = 0.3 + 0.7*(Wavelength - 380) / (420 - 380);\r\n\t\t}else if((Wavelength >= 420) && (Wavelength<701)){\r\n\t\t\tfactor = 1.0;\r\n\t\t}else if((Wavelength >= 701) && (Wavelength<781)){\r\n\t\t\tfactor = 0.3 + 0.7*(780 - Wavelength) / (780 - 700);\r\n\t\t}else{\r\n\t\t\tfactor = 0.0;\r\n\t\t}\r\n\r\n\r\n\t\tvar rgb =[];\r\n\r\n\t\t// Don't want 0^x = 1 for x <> 0\r\n\t\trgb[0] = (Red==0.0) ? 0 : (Math.round(IntensityMax * Math.pow(Red * factor, Gamma)));\r\n\t\trgb[1] = (Green==0.0) ? 0 : (Math.round(IntensityMax * Math.pow(Green * factor, Gamma)));\r\n\t\trgb[2] = (Blue==0.0) ? 0 : (Math.round(IntensityMax * Math.pow(Blue * factor, Gamma)));\r\n\t\t\r\n\t\t/*if((Wavelength >= 300) && (Wavelength<380)){\r\n\t\t\trgb[0] = 0;\r\n\t\t\trgb[1] = 0;\r\n\t\t\trgb[2] = Math.round((Wavelength - 300) / 80) * 255;\r\n\t\t}*/\r\n\t\t\r\n\t\treturn rgb;\r\n}",
"function rgb(wavelength) {\n let k = intensityFactor(wavelength);\n let red;\n let green;\n let blue;\n if (wavelength >= purpleLimit && wavelength < darkblueLimit) {\n red = blendFactor(wavelength, darkblueLimit, purpleLimit);\n green = 0.0;\n blue = 1.0;\n } else if (wavelength >= darkblueLimit && wavelength < blueLimit) {\n red = 0.0;\n green = blendFactorInverted(wavelength, blueLimit, darkblueLimit);\n blue = 1.0;\n } else if (wavelength >= blueLimit && wavelength < greenLimit) {\n red = 0.0;\n green = 1.0;\n blue = blendFactor(wavelength, greenLimit, blueLimit);\n } else if (wavelength >= greenLimit && wavelength < yellowLimit) {\n red = blendFactorInverted(wavelength, yellowLimit, greenLimit);\n green = 1.0;\n blue = 0.0;\n } else if (wavelength >= yellowLimit && wavelength < redLimit) {\n red = 1.0;\n green = blendFactor(wavelength, redLimit, yellowLimit);\n blue = 0.0;\n } else if (wavelength >= redLimit && wavelength <= upperLimit) {\n red = 1.0;\n green = 0.0;\n blue = 0.0;\n } else {\n red = 0.0;\n green = 0.0;\n blue = 0.0;\n }\n\n return {\n red: red > 0 ? 255 * red * k : 0,\n green: green > 0 ? 255 * green * k : 0,\n blue: blue > 0 ? 255 * blue * k : 0\n }\n}",
"getColor() {\n var i = (this.speed * 255) / 255;\n var r = Math.round(Math.sin(0.024 * i + 0) * 127 + 128);\n var g = Math.round(Math.sin(0.024 * i + 2) * 127 + 128);\n var b = Math.round(Math.sin(0.024 * i + 4) * 127 + 128);\n var rgb = \"rgb(\" + r + \",\" + g + \",\" + b + \")\";\n\n return rgb;\n }",
"function gam_sRGB(v) {\n if (v <= 0.0031308) {\n v *= 12.92;\n } else {\n v = 1.055 * Math.pow(v, 1.0/2.4) - 0.055;\n }\n return Math.round(v*255);\n}",
"function getColour(mag) {\n if (mag > 5) {\n return \"#FF4500\"\n } else if (mag > 4) {\n return \"#FF6347\"\n } else if (mag > 3) {\n return \"#FF8C00\"\n } else if (mag > 2) {\n return \"#FF7F50\"\n } else if (mag > 1) {\n return \"#FF6347\"\n } else {\n return \"#FFA500\"\n }\n }",
"function getColorFromSpectrum(value) {\n const clampedValue = clamp(value);\n if (.4 <= clampedValue && clampedValue <= 1) {\n const normalizedValue = (clampedValue - 0.4) / 0.6;\n return lerpRGB([248/255, 177/255, 149/255, 1], [240/255, 248/255, 255/255, 1], normalizedValue);\n } else if (.2 <= clampedValue && clampedValue < .4) {\n const normalizedValue = (clampedValue - 0.2) / 0.2;\n return lerpRGB([246/255, 114/255, 128/255, 1], [248/255, 177/255, 149/255, 1], normalizedValue);\n } else if (.1 <= clampedValue && clampedValue < .2) {\n const normalizedValue = (clampedValue - 0.1) / 0.1;\n return lerpRGB([192/255, 108/255, 132/255, 1], [246/255, 114/255, 128/255, 1], normalizedValue);\n } else if (-.1 <= clampedValue && clampedValue < .1) {\n const normalizedValue = (clampedValue + 0.1) / 0.2;\n return lerpRGB([108/255, 91/255, 123/255, 1], [192/255, 108/255, 132/255, 1], normalizedValue);\n } else if (-.2 <= clampedValue && clampedValue < -.1) {\n const normalizedValue = (clampedValue + .2) / 0.1;\n return lerpRGB([53/255, 92/255, 125/255, 1], [108/255, 91/255, 123/255, 1], normalizedValue);\n } else if (-1 <= clampedValue && clampedValue < -0.2) {\n const normalizedValue = (clampedValue + 1) / .8;\n return lerpRGB([25/255, 25/255, 50/255, 1], [53/255, 92/255, 125/255, 1], normalizedValue);\n }\n return [0, 0, 0, 1];\n}",
"function get_wave_color(input_color) {\n var c = d3.color(input_color)\n c.opacity = 0.5;\n return c + '';\n}",
"get luminance() { return this.hsl[2]; }",
"function getColor(magnitude) {\n if (magnitude > 5) {\n return \"#ea2c2c\";\n }\n if (magnitude > 4) {\n return \"#ea822c\";\n }\n if (magnitude > 3) {\n return \"#ee9c00\";\n }\n if (magnitude > 2) {\n return \"#eecc00\";\n }\n if (magnitude > 1) {\n return \"#d4ee00\";\n }\n return \"#98ee00\";\n}",
"function getColor(magnitude) {\r\n if (magnitude > 5) {\r\n return \"#ea2c2c\";\r\n }\r\n if (magnitude > 4) {\r\n return \"#ea822c\";\r\n }\r\n if (magnitude > 3) {\r\n return \"#ee9c00\";\r\n }\r\n if (magnitude > 2) {\r\n return \"#eecc00\";\r\n }\r\n if (magnitude > 1) {\r\n return \"#d4ee00\";\r\n }\r\n return \"#98ee00\";\r\n}",
"function luminanace (r, g, b) {\n var a = [r, g, b].map(function (v) {\n v /= 255;\n return v <= 0.03928\n ? v / 12.92\n : Math.pow((v + 0.055) / 1.055, 2.4)\n })\n return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;\n}",
"function Qcolor(magnitude) {\n if (magnitude >= 5) {\n return \"#990000\";} \n else if (magnitude >= 4 && magnitude <5) {\n return \"#D60000\";} \n else if (magnitude >= 3 && magnitude <4) {\n return \"#FF4848\";} \n else if (magnitude >= 2 && magnitude <3){\n return \"#FFB0B0\";} \n else if (magnitude >= 1 && magnitude <2){\n return \"#FFCACA\"; } \n else if (magnitude < 1){\n return \"#FFE4E4\";} \n }",
"function getColor(magnitude) {\n if (magnitude > 5) {\n return \"#ea2c2c\";\n }\n if (magnitude > 4) {\n return \"#ea822c\";\n }\n if (magnitude > 3) {\n return \"#ee9c00\";\n }\n if (magnitude > 2) {\n return \"#eecc00\";\n }\n if (magnitude > 1) {\n return \"#d4ee00\";\n }\n return \"#98ee00\";\n}",
"function luminanace(r, g, b) {\n var a = [r, g, b].map(function (v) {\n v /= 255;\n return v <= 0.03928\n ? v / 12.92\n : Math.pow( (v + 0.055) / 1.055, 2.4 );\n });\n return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;\n}",
"function chooseColor(magnitude) {\n if (magnitude > 7.9) {\n return '#3f0000';\n }else if (magnitude > 6.9) {\n return '#580000';\n }else if (magnitude > 5.9) {\n return '#720000';\n }else if (magnitude > 4.9) { \n return '#8b0000';\n }else if (magnitude > 3.9) {\n return '#a50000';\n }else if (magnitude > 2.9) {\n return '#be0000';\n }else if (magnitude > 1.9) {\n return '#d80000';\n }else{\n return '#e34c4c';\n }\n}",
"function intensityFactor(wavelength) {\n if (wavelength >= purpleLimit && wavelength < 420)\n return 0.3 + 0.7 * (wavelength - purpleLimit) / (420 - purpleLimit);\n else if (wavelength >= 420 && wavelength < 701)\n return 1;\n else if (wavelength >= 701 && wavelength <= redLimit)\n return 0.3 + 0.7 * (redLimit - wavelength) / (redLimit - 700);\n else {\n return 0;\n }\n}",
"function rgba(color){\n return [color[0]/255, color[1]/255, color[2]/255, color[3]/100];\n}",
"function getColor(magnitude) {\r\n return magnitude >= 5 ? '#e80909' :\r\n magnitude >= 4 ? '#e87909' :\r\n magnitude >= 3 ? '#ffe208' :\r\n magnitude >= 2 ? '#f0ff19' :\r\n magnitude >= 1 ? '#5ce330' :\r\n '#03ff3d';\r\n}",
"function getColor(magnitude) {\n if (magnitude > 7) {\n return 'red'\n } else if (magnitude > 6) {\n return 'orange'\n } else if (magnitude > 5) {\n return 'yellow'\n } else if (magnitude > 4) {\n return 'lightgreen'\n } else if (magnitude > 2) {\n return 'green'\n } else {\n return 'blue'\n }\n}",
"get rgba() { return [this.r, this.g, this.b, this.a]; }",
"function getColor (magnitude){\r\n switch (true){\r\n case magnitude >6:\r\n return \"#581845\"\r\n case magnitude >5:\r\n return \"#900C3F\"\r\n case magnitude >4:\r\n return \"#C70039\"\r\n case magnitude >3:\r\n return \"#FF5733\"\r\n case magnitude >2:\r\n return \"#FFC300\"\r\n case magnitude >1:\r\n return \"#DAF7A6\"\r\n \r\n }\r\n }",
"function setColour(pix,r,g,b,a) {\r\n var data = pix.data;\r\n for (var i = 0; i < data.length;i += 4) {\r\n\tif(data[i+3] != 0){\r\n\r\n center = 128;\r\n \t width = 127;\r\n \t frequency = Math.PI*2/120;\r\n\r\n \t r = Math.sin(frequency*time+2) * width + center;\r\n \t g = Math.sin(frequency*time+0) * width + center;\r\n \t b = Math.sin(frequency*time+4) * width + center;\r\n \r\n data[i]= r;\r\n data[i+1] = g;\r\n data[i+2] = b;\r\n data[i+3] = a;\r\n }\r\n }\r\n pix.data = data;\r\n return pix; \r\n}",
"get rgba_1() {\n let c = new Color(this.r, this.g, this.b, this.a);\n return [c.r / 255, c.g / 255, c.b / 255, c.a / 255];\n }",
"function getColor(magnitude) {\r\n //Condtionals for magnitude \r\n if (magnitude >= 5) {\r\n return \"red\";\r\n }\r\n else if (magnitude >= 4){\r\n return \"peru\";\r\n }\r\n else if (magnitude >= 3) {\r\n return \"darkorange\";\r\n }\r\n else if (magnitude >= 2) {\r\n return \"yellow\";\r\n }\r\n else if (magnitude >= 1) {\r\n return \"yellowgreen\";\r\n }\r\n else {\r\n return \"green\";\r\n }\r\n}",
"function color(magnitude){\n\n if (magnitude > 5){\n return 'red'\n } else if (magnitude > 4){\n return 'orange'\n } else if (magnitude > 3){\n return 'yellow'\n } else if (magnitude > 2){\n return 'green'\n } else if (magnitude > 1){\n return 'lightblue'\n } else {\n return 'purple'\n }\n }",
"vaxiColor(n) {\n return n >= 100 ? 'hsl(139, 100%, 17%)':\n n > 75 ? 'hsl(139, 100%, 27%)':\n n > 60 ? 'hsl(139, 100%, 32%)':\n n > 50 ? 'hsl(139, 100%, 37%)':\n n > 45 ? 'hsl(139, 100%, 42%)':\n n > 40 ? 'hsl(139, 100%, 47%)':\n n > 35 ? 'hsl(139, 100%, 52%)':\n n > 30 ? 'hsl(139, 100%, 57%)':\n n > 25 ? 'hsl(139, 100%, 62%)':\n n > 20 ? 'hsl(139, 100%, 67%)':\n n > 15 ? 'hsl(139, 100%, 72%)':\n n > 10 ? 'hsl(139, 100%, 77%)':\n n > 5 ? 'hsl(139, 100%, 87%)':\n n > 3 ? 'hsl(139, 100%, 92%)':\n n > 2 ? 'hsl(139, 100%, 95%)':\n n > 1 ? 'hsl(139, 100%, 97%)':\n 'hsl(139, 100%, 99%)';\n }",
"function convert255(tone) {\n var curve = [];\n for (var i=0; i < tone.length; i++) {\n curve[i]=128 + Math.round(127 * tone[i]);\n }\n return curve;\n}",
"function getColor(magnitude) {\n switch (true) {\n case magnitude > 5:\n return \"#ea2c2c\";\n case magnitude > 4:\n return \"#ea822c\";\n case magnitude > 3:\n return \"#ee9c00\";\n case magnitude > 2:\n return \"#eecc00\";\n case magnitude > 1:\n return \"#d4ee00\";\n default:\n return \"#98ee00\";\n } \n }",
"function chooseColor(magnitude) {\n mag = parseFloat(magnitude);\n if (mag >= 5.0 ) {\n return '#922B21';\n } else if (mag >= 4.0 ) {\n return '#D35400';\n } else if (mag >= 3.0 ) {\n return '#EB984E';\n } else if (mag >= 2.0 ) {\n return '#F8C471';\n } else {\n return '#F9E79F';\n }\n}"
]
| [
"0.7833795",
"0.7622385",
"0.6670089",
"0.6535967",
"0.64636475",
"0.6079295",
"0.60789424",
"0.6070874",
"0.6065623",
"0.5981613",
"0.5977258",
"0.5961137",
"0.59331894",
"0.5919916",
"0.5916034",
"0.5853928",
"0.58256084",
"0.5820887",
"0.58110523",
"0.57610303",
"0.57149327",
"0.5702279",
"0.57015556",
"0.56922734",
"0.56921774",
"0.5685101",
"0.56797624",
"0.5668727",
"0.5663298",
"0.5655424"
]
| 0.7809527 | 1 |
ProgressButton: component that represents each number underneath the sudoku board. It has a progress bar on the outside showing how many of that number have been put onto the board. props: value: the number that is stored in the button. onClick: a function that executes after the component is clicked. percent: the percentage full of the progress bar | function ProgressButton(props) {
return (
<Progress
theme={
{
error: {
symbol: props.value,
trailColor: 'rgb(240, 240, 240)',
color: 'rgb(7, 76, 188)',
},
default: {
symbol: props.value,
trailColor: 'rgb(245, 245, 240)',
color: 'rgb(7, 76, 188)',
},
active: {
symbol: props.value,
trailColor: 'rgb(245, 245, 240)',
color: 'rgb(7, 76, 188)',
},
success: {
symbol: props.value,
trailColor: 'rgb(245, 245, 240)',
color: 'rgb(0, 215, 0)',
},
}
}
type="circle"
percent={props.percent}
width={60}
strokeWidth={12}
/>
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"animateProgressBar() {\n const\n cardLen = this.props.cards.length, // get cardsLength\n current = this.state.current, // get current\n calcPer = (lg, sm) => lg && sm ? (sm / lg) * 100 : 0, // create func that return precentage\n currPer = calcPer(cardLen, current), // current percentage\n nextPer = calcPer(cardLen, current + 1), // percentage of the next step\n progres = document.getElementById(\"run-test__progress\"), // the progress bar element\n oneStep = (nextPer - currPer) / 10; // the amount progress bar goes in one step (10 step anim)\n\n let counter = 0,\n currWidth = currPer;\n\n // create a timer for progressbar width grow\n const progressTimer = setInterval(() => {\n currWidth += oneStep; // increase width by 1 unit\n\n progres.style.width = currWidth + \"%\"; // set width\n\n if (++counter === 9) clearInterval(progressTimer); // increment and clear \n }, 150); // end of progressTimer\n }",
"render() {\n return (\n <div>\n <Progress percent={this.state.percent} color={this.state.color} value={this.state.points} total='6' progress=\"ratio\"/>\n </div>\n )\n }",
"function onProgress(value) {\n document.getElementById('counter').innerHTML = Math.round(value);\n}",
"function Progress(props) {\n return (\n <div className=\"progress\" style={{ width: `${props.percentage}%`, backgroundColor: `${props.color}`}} />\n )\n}",
"updateProgressBar(percentage) {\n let $progressBar = document.getElementById(\"progress-bar\");\n this.progressBarObj.value = Math.min(\n 100,\n this.progressBarObj.value + percentage\n );\n $progressBar.style.width = this.progressBarObj.value + \"%\";\n $progressBar.valuenow = this.progressBarObj.value;\n $progressBar.innerText = this.progressBarObj.value + \"%\";\n }",
"function Uploading({percent}) {\n return <progress value={percent} max={100}>{percent} %</progress>\n}",
"setProgress (value) {\n\n this.progressBar.style.width\n = (value || 0) +'%';\n }",
"clickHandler(key, stateContext) {\n let state = stateContext;\n let percent = state[key].percent;\n\n if (percent < 100) {\n //Increment by 10, Highest value = 100.\n percent = (percent + 10) <= 100 ? (percent + 10) : 100\n } else {\n //If percent = 100, reset component percentage.\n percent = 0;\n }\n //Updating percentage of targeted component\n state[key].percent = percent;\n //Updating stateContext\n this.setState(state);\n //Updating completed items prop\n this.updateCompletedItems();\n }",
"_progress() {\n\tconst currentProgress = this.state.current * ( 100 / this.state.questionsCount );\n this.progress.style.width = currentProgress + '%';\n\n\t// update the progressbar's aria-valuenow attribute\n this.progress.setAttribute('aria-valuenow', currentProgress);\n }",
"function updateEditProgress (progress) {\n var total = progress.total\n var quorum = 0\n var missing = 0\n document.getElementById('prog').title = progress.collected +\n ' updated out of ' + total + ' members.'\n document.getElementById('prog-collected').style.width = quorum + '%'\n // document.getElementById('prog-collected').class = \"progress-bar-success\"\n document.getElementById('prog-collected').classList.remove('progress-bar-warning')\n document.getElementById('prog-collected').classList.add('progress-bar-success')\n // prog-missing now means \"extra votes after quorum has been reached.\"\n document.getElementById('prog-missing').style.width = -missing + '%'\n document.getElementById('prog-missing').class = 'progress-bar'\n document.getElementById('prog-missing').classList.add('progress-bar')\n document.getElementById('prog-missing').classList.remove('progress-bar-warning')\n // document.getElementById('prog-missing').classList.add('progress-bar-success')\n document.getElementById('prog-missing').classList.remove('progress-bar-striped')\n}",
"progressBarClicked(stageNum) {\n this.setState({\n stage: stageNum\n });\n this.renderSwitch(stageNum);\n }",
"function ProgressBar({ progress }) {\n console.log(progress);\n return (\n <div className=\"col\">\n <div className=\"progress progress-sm mr-2\">\n <div\n className=\"progress-bar bg-info\"\n role=\"progressbar\"\n style={{ width: `${progress}%` }}\n aria-valuenow={progress}\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n ></div>\n </div>\n </div>\n );\n}",
"updateProgress() {\n var completed = 0;\n var total = this.state.subtasks.length;\n for (let i = 0; i < total; i++) {\n if (this.state.subtasks[i].completed) completed++;\n }\n var totalProgress =\n total === 0 ? 0 : Math.round((completed * 100) / total);\n this.setState(\n {\n completion: totalProgress,\n },\n () => {\n this.props.updateParent(this.state);\n }\n );\n }",
"_setProgress(v) {\n\t\tconst w = PROGRESSBAR_WIDTH * v;\n\t\tthis._fg.tilePositionX = w;\n\t\tthis._fg.width = PROGRESSBAR_WIDTH- w;\n\t}",
"function updateProgress (){\n\tprogress.value += 30;\n}",
"function ProgressBar(props) {\n return (\n <React.Fragment>\n <LinearProgress variant=\"determinate\" value={normalise(props.value)} />\n </React.Fragment>\n )\n}",
"percentAnimation(num, ele) {\n this.state.percentBoxs.forEach((tab) => {\n tab.style.color = \"#8BAEC2\";\n });\n if (num === 0) {\n this.setState({ percent: 0 });\n document.getElementById(\"percent_animation_box\").style.left = \"0px\";\n } else if (num === 25) {\n this.setState({ percent: 25 });\n document.getElementById(\"percent_animation_box\").style.left = \"80px\";\n } else if (num === 50) {\n this.setState({ percent: 50 });\n document.getElementById(\"percent_animation_box\").style.left = \"163px\";\n } else if (num === 75) {\n this.setState({ percent: 75 });\n document.getElementById(\"percent_animation_box\").style.left = \"245px\";\n } else if (num === 100) {\n this.setState({ percent: 100 });\n document.getElementById(\"percent_animation_box\").style.left = \"328px\";\n }\n this.allocToSubTokenSize();\n ele.style.color = \"#fff\";\n }",
"function UpdateTheProgressBar(gameStats){\n var pr = document.getElementById('progressBar').getContext('2d');\n pr.fillStyle = \"royalblue\";\n var progress = (gameStats.score/gameStats.neededScore)*100;\n progress = Math.round((progress/100) * 390);\n pr.fillRect(0,0,progress,50);\n console.log(gameStats);\n}",
"_updateProgress() {\n super._updateProgress();\n\n const that = this;\n\n //Label for Percentages\n if (that.showProgressValue) {\n const percentage = parseInt(that._percentageValue * 100);\n\n that.$.label.innerHTML = that.formatFunction ? that.formatFunction(percentage) : percentage + '%';\n }\n else {\n that.$.label.innerHTML = '';\n }\n\n if (that.value === null || that.indeterminate) {\n that.$value.addClass('jqx-value-animation');\n }\n else {\n that.$value.removeClass('jqx-value-animation');\n }\n\n that.$.value.style.transform = that.orientation === 'horizontal' ? 'scaleX(' + that._percentageValue + ')' : 'scaleY(' + that._percentageValue + ')';\n }",
"function updateProgress(value) {\n var progressBarStep = value*stepSize;\n $(\"#progress\").css(\"width\", progressBarStep + \"%\");\n $(\"#progress\").attr(\"aria-valuenow\", progressBarStep);\n $(\"#progress-current\").html(value);\n}",
"function countToPercent(percent) {\n var interval = setInterval(counter,25);\n var n = 0;\n function counter() {\n if (n >= percent) {\n clearInterval(interval);\n valueProgressBarAnimated = true;\n }\n else {\n n += 1;\n // console.log(n);\n $(thisDiv).text(n + \"%\");\n }\n }\n }",
"function renderProgress(val, perc, message) {\n\t\tbar.style.width = perc + \"%\";\n\n renderMessage(message);\n\t}",
"function onUpdateProgressSong(e){\n let progressValue = e.detail.value;\n progressIndicator.textContent = ((progressValue <= 100) ? progressValue : 100) + \" %\";\n}",
"function PopulatePercentage(value) {\n loadProgressBar(value);\n}",
"function updateProgressBar() {\n pbValue+=10;\n $('.progress-bar').css('width', pbValue+'%').attr('aria-valuenow', pbValue);\n $('.progress-bar').text(pbValue + \"%\");\n }",
"updateProgress() {\n const { inputLength, outputLength } = this.state.data;\n const progress = this.querySelector('.progress');\n progress.innerText = `${outputLength} out of ${inputLength} sequences processed`;\n }",
"onProgress(percentage, count) {}",
"render () {\n return (\n <div>\n <Button incrementValue={1} onClickFunction={this.incrementCounter}/>\n <Button incrementValue={5} onClickFunction={this.incrementCounter}/>\n <Button incrementValue={10} onClickFunction={this.incrementCounter}/>\n <Button incrementValue={100} onClickFunction={this.incrementCounter}/>\n <Result counter={this.state.counter}/>\n </div>\n )\n }",
"function progress(piece, nbPieces, page, nbPages, doc, nbDocs) {\n var percent = (piece/nbPieces)*100;\n $(\"#progress .progress-bar\").attr('aria-valuenow', percent).attr('style','width:'+percent.toFixed(2)+'%').find(\"span\").html(percent.toFixed(0) + \"%)\");\n $(\"#progressPiece\").html(\"Piece \" + piece + \"/\" + nbPieces);\n $(\"#progressPage\").html((page && nbPages) ? \"Page \" + page + \"/\" + nbPages : \"\");\n $(\"#progressDoc\").html((doc && nbDocs) ? \"Document \" + doc + \"/\" + nbDocs : \"\");\n}",
"function ProgressIndicator(props) { // I'm intentionally not destructuring here because most of the props are used by buildBackground. Might as well pass the existing object in.\n\n\tfunction buildBackground({current, max, backgroundColor = '#FFF', fillColor = '#369'}){\n\t\tconst fraction = Math.round(1000 * current / max) / 10;\n\t\tif (fraction < .2) {\n\t\t\treturn backgroundColor;\n\t\t}\n\t\tif (fraction > 99.8) {\n\t\t\treturn fillColor;\n\t\t}\n\t\treturn `linear-gradient(to right, ${fillColor} ${fraction - 0.1}%, ${backgroundColor} ${fraction + 0.1}%)`;\n\t}\n\n\tconst { width = 'calc(100% - 1rem)' } = props;\n\n\tconst style = {\n\t\twidth,\n\t\tbackground: buildBackground(props)\n\t};\n\n\treturn (\n\t\t<div className={styles['progress-indicator']} style={style}></div>\n\t);\n}"
]
| [
"0.65872",
"0.65730345",
"0.6360369",
"0.63334435",
"0.63189983",
"0.6311207",
"0.6309521",
"0.63063455",
"0.6296162",
"0.619475",
"0.61631364",
"0.6151493",
"0.6149023",
"0.6141332",
"0.6125544",
"0.61229694",
"0.6116238",
"0.61112714",
"0.60833883",
"0.60608685",
"0.6043936",
"0.60368186",
"0.60039073",
"0.59998053",
"0.5991408",
"0.59872025",
"0.59851676",
"0.5981227",
"0.59348667",
"0.59283346"
]
| 0.69918656 | 0 |
handle the device information | function handle_device(topic, payload) {
var deviceID = topic[2];
if (topic[4] == "flx") flx = JSON.parse(payload);
if (topic[4] == "sensor") {
var config = JSON.parse(payload);
for (var obj in config) {
var cfg = config[obj];
if (cfg.enable == "1") {
if (sensors[cfg.id] == null) {
sensors[cfg.id] = new Object();
sensors[cfg.id].id = cfg.id;
if (cfg.function != undefined) {
sensors[cfg.id].name = cfg.function;
} else {
sensors[cfg.id].name = cfg.id;
}
if (cfg.subtype != undefined) sensors[cfg.id].subtype = cfg.subtype;
if (cfg.port != undefined) sensors[cfg.id].port = cfg.port[0];
} else {
if (cfg.function != undefined) sensors[cfg.id].name = cfg.function;
}
}
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _collectDeviceInfo() {\n _device.deviceClass = \"Handset\";\n _device.id = DeviceInfo.getUniqueID(); // Installation ID\n _device.model = DeviceInfo.getModel();\n }",
"function Device(listen_port) {\n //a basic device. Many functions are stubs and or return dummy values\n //listen_port: listen for http requests on this port\n //\n HEL.call(this,'cmd',listen_port);\n \n //init device info\n this.port = listen_port;\n this.status = \"ready\"; //other options are \"logging\"\n this.state = \"none\"; //no other state for such a simple device\n this.uuid = this.computeUUID();\n \n //some device state\n this.logging_timer = null;\n this.manager_port = null;\n this.manager_IP = null;\n\n //standard events\n this.addEventHandler('getCode',this.getCodeEvent); \n this.addEventHandler('getHTML',this.getHTMLEvent); \n this.addEventHandler('info',this.info);\n this.addEventHandler('ping',this.info);\n this.addEventHandler('acquire',this.acquire);\n \n //implementation specific events\n //TODO: REPLACE THESE TWO EVENTS WITH YOUR OWN\n this.addEventHandler('startLog',this.startLogging);\n this.addEventHandler('stopLog',this.stopLogging);\n this.addEventHandler('heatOn',this.heaton);\n this.addEventHandler('heatOff',this.heatoff);\n this.addEventHandler('heatAutomatic',this.heatpwm);\n this.addEventHandler('heatAutomaticEnd', this.heatAutomaticEnd);\n this.addEventHandler('desiredTemp',this.desiredTemp);\n this.addEventHandler('cellphoneNumber',this.cellphoneNumber);\n //manually attach to manager.\n this.manager_IP = 'bioturk.ee.washington.edu';\n this.manager_port = 9090;\n this.my_IP = OS.networkInterfaces().eth0[0].address;\n this.sendAction('addDevice',\n {port: listen_port, addr: this.my_IP},\n function(){});\n \n //advertise that i'm here every 10 seconds until i'm aquired\n /*var this_device = this;\n this.advert_timer = setInterval(function(){\n this_device.advertise('224.250.67.238',17768);\n },10000);*/\n}",
"function printDeviceInfo(err, deviceInfo, res) {\n if (deviceInfo) {\n console.log('Device ID: ' + deviceInfo.deviceId);\n console.log('Device key: ' + deviceInfo.authentication.symmetricKey.primaryKey);\n }\n}",
"deviceUpdate () {\n this.channel && this.deviceSN && this.channel.publish(`device/${this.deviceSN}/info`, JSON.stringify({\n lanIp: Device.NetworkAddr('lanip'),\n llIp: Device.NetworkAddr('linklocal'),\n version: Device.SoftwareVersion(),\n name: Device.deviceName()\n }))\n }",
"function DeviceInfo(deviceParams) {\n\t this.viewer = Viewers.CardboardV2;\n\t this.updateDeviceParams(deviceParams);\n\t this.distortion = new Distortion(this.viewer.distortionCoefficients);\n\t}",
"function collectDeviceInfo() {\n\tvar deviceDetails = getDeviceInfo();\n var authnData = {\n \"authId\": AUTH_ID,\n \"deviceDetails\": deviceDetails,\n \"hint\": \"MATCH_DEVICE_INFO\" //dont change this value.\n };\n\tconsole.log(\"Collecting device information : \"+authnData)\n authenticate(authnData);\n}",
"deviceUpdate () {\n this.channel && this.deviceSN && this.channel.publish(`device/${ this.deviceSN }/info`, JSON.stringify({ \n lanIp: Device.networkInterface().address,\n name: Device.deviceName()\n }))\n }",
"function handle_device(topicArray, payload) {\n switch (topicArray[4]) {\n case \"flx\":\n flx = payload;\n break;\n\n case \"sensor\":\n for (var obj in payload) {\n var cfg = payload[obj];\n if (cfg.enable == \"1\") {\n if (sensors[cfg.id] === undefined) sensors[cfg.id] = new Object();\n sensors[cfg.id].id = cfg.id;\n if (cfg.function !== undefined) {\n sensors[cfg.id].name = cfg.function;\n } else if (flx !== undefined && flx[cfg.port] !== undefined) {\n sensors[cfg.id].name = flx[cfg.port].name + \" \" + cfg.subtype;\n }\n if (cfg.subtype !== undefined) sensors[cfg.id].subtype = cfg.subtype;\n if (cfg.port !== undefined) sensors[cfg.id].port = cfg.port[0];\n console.log(\"Detected sensor \" + sensors[cfg.id].id + \" (\" + sensors[cfg.id].name + \")\");\n mqttclient.subscribe(\"/sensor/\" + cfg.id + \"/gauge\");\n mqttclient.subscribe(\"/sensor/\" + cfg.id + \"/counter\");\n }\n }\n break;\n\n default:\n break;\n }\n }",
"function DeviceInfo(deviceParams) {\n this.viewer = Viewers.CardboardV2;\n this.updateDeviceParams(deviceParams);\n this.distortion = new Distortion(this.viewer.distortionCoefficients);\n}",
"function DeviceInfo(deviceParams) {\n this.viewer = Viewers.CardboardV2;\n this.updateDeviceParams(deviceParams);\n this.distortion = new Distortion(this.viewer.distortionCoefficients);\n}",
"function DeviceInfo(deviceParams) {\n this.viewer = Viewers.CardboardV2;\n this.updateDeviceParams(deviceParams);\n this.distortion = new Distortion(this.viewer.distortionCoefficients);\n}",
"function DeviceInfo(deviceParams) {\n this.viewer = Viewers.CardboardV2;\n this.updateDeviceParams(deviceParams);\n this.distortion = new Distortion(this.viewer.distortionCoefficients);\n}",
"function DeviceInfo(deviceParams) {\n this.viewer = Viewers.CardboardV2;\n this.updateDeviceParams(deviceParams);\n this.distortion = new Distortion(this.viewer.distortionCoefficients);\n}",
"function DeviceInfo(deviceParams) {\n this.viewer = Viewers.CardboardV2;\n this.updateDeviceParams(deviceParams);\n this.distortion = new Distortion(this.viewer.distortionCoefficients);\n}",
"async logDeviceInfo() {\n try {\n let sysinfo = await this.iologik.getSysInfo();\n for (let key in sysinfo) {\n this.log(key + ': ' + sysinfo[key]);\n }\n } catch (e) {\n this.emit('error', e);\n }\n }",
"device(req, res) {\n\n }",
"get deviceNumber() { return this._deviceNumber; }",
"get device () {\n\t\treturn this._device;\n\t}",
"function getDeviceInformation(){\n\tvar XmlString = \"\";\n\tvar devicesArr = getDevicesNodeJSON();\n\tif(devicesArr.length){\n\t\tfor(var t=0; t<devicesArr.length; t++){\n\t\t\tvar device = devicesArr[t];\t\n\t\t\tXmlString += \"<DEVICES DeviceName='\"+device.DeviceName+\"' DeviceType='\"+device.DeviceType+\"' ObjectPath='\"+device.ObjectPath+\"'\";\n\t\t\tXmlString += \" Model='\"+device.Model+\"' DNDModelType='\"+device.DNDModelType+\"' SoftwareVersion='\"+device.SoftwareVersion+\"'\";\n\t\t\tXmlString += \" OSVersion='\"+device.OSVersion+\"' OSType='\"+device.OSType+\"' SoftwarePackage='\"+device.SoftwarePackage+\"'\";\n\t\t\tXmlString += \" ReEvaluate='\"+device.ReEvaluate+\"' IpAddress='\"+device.IpAddress+\"' DeviceId='\"+device.DeviceId+\"'\";\n\t\t\tXmlString += \" HostName='\"+device.DeviceName+\"' UpdateFlag='new' MediaType='\"+device.MediaType+\"'\";\n\t\t\tXmlString += \" Portname='\"+device.Portname+\"' ManagementIp='\"+device.ManagementIp+\"' ManagementIp2='\"+device.ManagementIp2+\"'\";\n\t\t\tXmlString += \" Auxiliary='\"+device.Auxiliary+\"' DiscoveryFlag='\"+device.DiscoveryFlag+\"' Exclusivity='\"+device.Exclusivity+\"'\";\n\t\t\tXmlString += \" XLocation='\"+device.XLocation+\"' YLocation='\"+device.YLocation+\"' PowerStatus='\"+device.PowerStatus+\"'\";\n\t\t\tXmlString += \" Power='\"+device.Power+\"' TftpIpAddress='\"+device.TftpIpAddress+\"' TftpHostname='\"+device.TftpHostname+\"'\";\n\t\t\tXmlString += \" TftpImagePath='\"+device.TftpImagePath+\"' TftpImageName='\"+device.TftpImageName+\"' TftpUser='\"+device.TftpUser+\"'\";\n\t\t\tXmlString += \" TftpPassword='\"+device.TftpPassword+\"' TftpAddress='\"+device.TftpAddress+\"' TacacsIpAddress='\"+device.TacacsIpAddress+\"'\";\n\t\t\tXmlString += \" TacacsHostname='\"+device.TacacsHostname+\"' RadiusHostname='\"+device.RadiusHostname+\"'\";\n\t\t\tXmlString += \" RadiusIpAddress='\"+device.RadiusIpAddress+\"' RadiusUsername='\"+device.RadiusUsername+\"'\";\n\t\t\tXmlString += \" RadiusPassword='\"+device.RadiusPassword+\"' Description='\"+device.Description+\"' Processor='\"+device.Processor+\"'\";\n\t\t\tXmlString += \" ProcessorBoardId='\"+device.ProcessorBoardId+\"' Manufacturer='\"+device.Manufacturer+\"' SerialNumber='\"+device.SerialNumber+\"'\";\n\t\t\tXmlString += \" IOS='\"+device.IOS+\"' CPUSpeed='\"+device.CPUSpeed+\"' SystemMemory='\"+device.SystemMemory+\"' NVRAMCF='\"+device.NVRAMCF+\"'\";\n\t\t\tXmlString += \" ProcessorMemory='\"+device.ProcessorMemory+\"' ConnectivityDone='\"+device.ConnectivityDone+\"'\";\n\t\t\tXmlString += \" ReachabilityDone='\"+device.ReachabilityDone+\"' ConvergenceDone='\"+device.ConvergenceDone+\"'\";\n\t\t\tXmlString += \" TFTPUser='\"+device.TFTPUser+\"' TFTPPassword='\"+device.TFTPPassword+\"' FTPServer='\"+device.FTPServer+\"'\";\n\t\t\tXmlString += \" TFTPServer='\"+device.TFTPServer+\"' FTPUser='\"+device.FTPUser+\"' FTPPassword='\"+device.FTPPassword+\"'\";\n\t\t\tXmlString += \" ConfigDetail='\"+device.ConfigDetail+\"' ConfigFilePath='\"+device.ConfigFilePath+\"' ConfigFileName='\"+device.ConfigFileName+\"'\";\n\t\t\tXmlString += \" ConfigUrl='\"+device.ConfigUrl+\"' SaveConfigUrl='\"+device.SaveConfigUrl+\"' ConfigServer='\"+device.ConfigServer+\"'\";\n\t\t\tXmlString += \" ConfigDestination='\"+device.ConfigDestination+\"' ImageFilePath='\"+device.ImageFilePath+\"'\";\n\t\t\tXmlString += \" ImageDetail='\"+device.ImageDetail+\"' ImageFileName='\"+device.ImageFileName+\"' ImageUrl='\"+device.ImageUrl+\"'\";\n\t\t\tXmlString += \" SaveImageUrl='\"+device.SaveImageUrl+\"' ImageServer='\"+device.ImageServer+\"' ImageDestination='\"+device.ImageDestination+\"'\";\n\t\t\tXmlString += \" SaveImageEnable='\"+device.SaveImageEnable+\"' SaveConfigEnable='\"+device.SaveConfigEnable+\"'\";\n\t\t\tXmlString += \" LoadConfigEnable='\"+device.LoadConfigEnable+\"' LoadImageEnable='\"+device.LoadImageEnable+\"'\";\n\t\t\tXmlString += \" SaveImageDetail='\"+device.SaveImageDetail+\"' SaveImageServer='\"+device.SaveImageServer+\"'\";\n\t\t\tXmlString += \" SaveImageDestination='\"+device.SaveImageDestination+\"' SaveImageUser='\"+device.SaveImageUser+\"'\";\n\t\t\tXmlString += \" SaveImagePassword='\"+device.SaveImagePassword+\"' SaveImageType='\"+device.SaveImageType+\"'\";\n\t\t\tXmlString += \" SaveConfigDetail='\"+device.SaveConfigDetail+\"' SaveConfigServer='\"+device.SaveConfigServer+\"'\";\n\t\t\tXmlString += \" SaveConfigDestination='\"+device.SaveConfigDestination+\"' SaveConfigUser='\"+device.SaveConfigUser+\"'\";\n\t\t\tXmlString += \" SaveConfigPassword='\"+device.SaveConfigPassword+\"' SaveConfigType='\"+device.SaveConfigType+\"'\";\n\t\t\tXmlString += \" SaveConfigFileName='\"+device.SaveConfigFileName+\"' SaveImageFileName='\"+device.SaveImageFileName+\"'\";\n\t\t\tXmlString += \" SystemImageName='\"+device.SystemImageName+\"' SystemConfigName='\"+device.SystemConfigName+\"'\";\n\t\t\tXmlString += \" SaveTypeImage='\"+device.SaveTypeImage+\"' TypeImage='\"+device.TypeImage+\"' SaveTypeConfig='\"+device.SaveTypeConfig+\"'\";\n\t\t\tXmlString += \" TypeConfig='\"+device.TypeConfig+\"' ChassisPid='\"+device.ChassisPid+\"' ChassisVid='\"+device.ChassisVid+\"'\";\n\t\t\tXmlString += \" ManagementInterface='\"+device.ManagementInterface+\"' ManagementInterface2='\"+device.ManagementInterface2+\"'\";\n\t\t\tXmlString += \" CheckConnectivity='' ConnectivityFlag='\"+device.ConnectivityFlag+\"' Reachability='' ReachabilityFlag='' ConvergenceFlag='' MainPortOnSwitch=''\";\n\t\t\tXmlString += \" FabricPort='' OrangeFlag='' PortType='' DeviceRole='' FabricPortOnSwitch='' PortOnSlot='' Slot=''\";\n\t\t\tXmlString += getFilterAttribute(device);\n\t\t\tXmlString += getTitanInformation(device);\n\t\t\tXmlString += \">\";\n\t\t\tXmlString += getDeviceInformation2(device);\n\t\t\tXmlString += getDeviceChild(device);\n\t\t\tXmlString +=\"</DEVICES>\";\n\t\t}\n\t}\n\treturn XmlString;\n}",
"async readData(index, device_id) {\n\t\t// Read WLED API, trow warning in case of issues\n\t\t// const objArray = await this.getAPI('http://' + index + '/json');\n\t\tconst deviceInfo = await this.getAPI('http://' + index + '/json/info');\n\t\tif (!deviceInfo) {\n\t\t\tthis.log.debug('Info API call error, will retry in scheduled interval !');\n\t\t\treturn 'failed';\n\t\t} else {\n\t\t\tthis.log.debug('Info Data received from WLED device ' + JSON.stringify(deviceInfo));\n\t\t}\n\n\t\ttry {\n\t\t\tconst device_id = deviceInfo.mac;\n\n\t\t\t// Create Device, channel id by MAC-Adress and ensure relevant information for polling and instance configuration is part of device object\n\t\t\tawait this.extendObjectAsync(device_id, {\n\t\t\t\ttype: 'device',\n\t\t\t\tcommon: {\n\t\t\t\t\tname: deviceInfo.name\n\t\t\t\t},\n\t\t\t\tnative: {\n\t\t\t\t\tip: index,\n\t\t\t\t\tmac: deviceInfo.mac,\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// Update device working state\n\t\t\tawait this.create_state(device_id + '._info' + '._online', 'online', true);\n\n\t\t\t// Read info Channel\n\t\t\tfor (const i in deviceInfo) {\n\n\t\t\t\tthis.log.debug('Datatype : ' + typeof (deviceInfo[i]));\n\n\t\t\t\t// Create Info channel\n\t\t\t\tawait this.setObjectNotExistsAsync(device_id + '._info', {\n\t\t\t\t\ttype: 'channel',\n\t\t\t\t\tcommon: {\n\t\t\t\t\t\tname: 'Basic information',\n\t\t\t\t\t},\n\t\t\t\t\tnative: {},\n\t\t\t\t});\n\n\t\t\t\t// Create Channels for led and wifi configuration\n\t\t\t\tswitch (i) {\n\t\t\t\t\tcase ('leds'):\n\t\t\t\t\t\tawait this.setObjectNotExistsAsync(device_id + '._info.leds', {\n\t\t\t\t\t\t\ttype: 'channel',\n\t\t\t\t\t\t\tcommon: {\n\t\t\t\t\t\t\t\tname: 'LED stripe configuration\t',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tnative: {},\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase ('wifi'):\n\t\t\t\t\t\tawait this.setObjectNotExistsAsync(device_id + '._info.wifi', {\n\t\t\t\t\t\t\ttype: 'channel',\n\t\t\t\t\t\t\tcommon: {\n\t\t\t\t\t\t\t\tname: 'Wifi configuration\t',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tnative: {},\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t}\n\n\t\t\t\t// Create states, ensure object structures are reflected in tree\n\t\t\t\tif (typeof (deviceInfo[i]) !== 'object') {\n\n\t\t\t\t\t// Default channel creation\n\t\t\t\t\tthis.log.debug('State created : ' + i + ' : ' + JSON.stringify(deviceInfo[i]));\n\t\t\t\t\tawait this.create_state(device_id + '._info.' + i, i, deviceInfo[i]);\n\n\t\t\t\t} else {\n\t\t\t\t\tfor (const y in deviceInfo[i]) {\n\t\t\t\t\t\tthis.log.debug('State created : ' + y + ' : ' + JSON.stringify(deviceInfo[i][y]));\n\t\t\t\t\t\tawait this.create_state(device_id + '._info.' + i + '.' + y, y, deviceInfo[i][y]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Get effects (if not already in memory\n\t\t\tif (!this.effects[device_id]){\n\t\t\t\tinitialise[device_id] = true;\n\t\t\t\tconst effects = await this.getAPI('http://' + index + '/json/eff');\n if (this.IsJsonString(effects)) { // arteck\n \t\t\t\tif (!effects) {\n \t\t\t\t\tthis.log.debug('Effects API call error, will retry in scheduled interval !');\n \t\t\t\t} else {\n \t\t\t\t\tthis.log.debug('Effects Data received from WLED device ' + JSON.stringify(effects));\n \t\t\t\t\t// Store effects array\n \t\t\t\t\tthis.effects[device_id] = {};\n \t\t\t\t\tfor (const i in effects) {\n \t\t\t\t\t\tthis.effects[device_id][i] = effects[i];\n \t\t\t\t\t}\n \t\t\t\t}\n }\n\t\t\t}\n\n\t\t\t// Get pallets (if not already in memory\n\t\t\tif (!this.palettes[device_id]) {\n\t\t\t\tinitialise[device_id] = true;\n\t\t\t\tconst pallets = await this.getAPI('http://' + index + '/json/pal');\n\t\t\t\tif (!pallets) {\n\t\t\t\t\tthis.log.debug('Effects API call error, will retry in scheduled interval !');\n\t\t\t\t} else {\n\t\t\t\t\tthis.log.debug('Effects Data received from WLED device ' + JSON.stringify(pallets));\n\t\t\t\t\t// Store effects array\n\t\t\t\t\tthis.palettes[device_id] = {};\n\t\t\t\t\t// Store pallet array\n\t\t\t\t\tfor (const i in pallets) {\n\t\t\t\t\t\tthis.palettes[device_id][i] = pallets[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Read state Channel\n\t\t\tconst deviceStates = await this.getAPI('http://' + index + '/json/state');\n\t\t\tfor (const i in deviceStates) {\n\n\t\t\t\tthis.log.debug('Datatype : ' + typeof (deviceStates[i]));\n\n\t\t\t\t// Create Channels for nested states\n\t\t\t\tswitch (i) {\n\t\t\t\t\tcase ('ccnf'):\n\t\t\t\t\t\tawait this.setObjectNotExistsAsync(device_id + '.ccnf', {\n\t\t\t\t\t\t\ttype: 'channel',\n\t\t\t\t\t\t\tcommon: {\n\t\t\t\t\t\t\t\tname: 'ccnf',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tnative: {},\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase ('nl'):\n\t\t\t\t\t\tawait this.setObjectNotExistsAsync(device_id + '.nl', {\n\t\t\t\t\t\t\ttype: 'channel',\n\t\t\t\t\t\t\tcommon: {\n\t\t\t\t\t\t\t\tname: 'Nightlight',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tnative: {},\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase ('udpn'):\n\t\t\t\t\t\tawait this.setObjectNotExistsAsync(device_id + '.udpn', {\n\t\t\t\t\t\t\ttype: 'channel',\n\t\t\t\t\t\t\tcommon: {\n\t\t\t\t\t\t\t\tname: 'Broadcast (UDP sync)',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tnative: {},\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase ('seg'):\n\n\t\t\t\t\t\tthis.log.debug('Segment Array : ' + JSON.stringify(deviceStates[i]));\n\n\t\t\t\t\t\tawait this.setObjectNotExistsAsync(device_id + '.seg', {\n\t\t\t\t\t\t\ttype: 'channel',\n\t\t\t\t\t\t\tcommon: {\n\t\t\t\t\t\t\t\tname: 'Segmentation',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tnative: {},\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tfor (const y in deviceStates[i]) {\n\n\t\t\t\t\t\t\tawait this.setObjectNotExistsAsync(device_id + '.seg.' + y, {\n\t\t\t\t\t\t\t\ttype: 'channel',\n\t\t\t\t\t\t\t\tcommon: {\n\t\t\t\t\t\t\t\t\tname: 'Segment ' + y,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tnative: {},\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tfor (const x in deviceStates[i][y]) {\n\t\t\t\t\t\t\t\tthis.log.debug('Object states created for channel ' + i + ' with parameter : ' + y + ' : ' + JSON.stringify(deviceStates[i][y]));\n\n\t\t\t\t\t\t\t\tif (x !== 'col') {\n\n\t\t\t\t\t\t\t\t\tawait this.create_state(device_id + '.' + i + '.' + y + '.' + x, x, deviceStates[i][y][x]);\n\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tthis.log.debug('Naming : ' + x + ' with content : ' + JSON.stringify(deviceStates[i][y][x][0]));\n\n\t\t\t\t\t\t\t\t\t// Translate RGB values to HEX\n\t\t\t\t\t\t\t\t\tconst primaryRGB = deviceStates[i][y][x][0].toString().split(',');\n\t\t\t\t\t\t\t\t\tconst primaryHex = rgbHex(parseInt(primaryRGB[0]), parseInt(primaryRGB[1]), parseInt(primaryRGB[2]));\n\t\t\t\t\t\t\t\t\tconst secondaryRGB = deviceStates[i][y][x][1].toString().split(',');\n\t\t\t\t\t\t\t\t\tconst secondaryHex = rgbHex(parseInt(secondaryRGB[0]), parseInt(secondaryRGB[1]), parseInt(secondaryRGB[2]));\n\t\t\t\t\t\t\t\t\tconst tertiaryRGB = deviceStates[i][y][x][2].toString().split(',');\n\t\t\t\t\t\t\t\t\tconst tertiaryHex = rgbHex(parseInt(tertiaryRGB[0]), parseInt(tertiaryRGB[1]), parseInt(tertiaryRGB[2]));\n\n\t\t\t\t\t\t\t\t\t// Write RGB and HEX information to states\n\t\t\t\t\t\t\t\t\tawait this.create_state(device_id + '.' + i + '.' + y + '.' + x + '.0', 'Primary Color RGB', deviceStates[i][y][x][0]);\n\t\t\t\t\t\t\t\t\tawait this.create_state(device_id + '.' + i + '.' + y + '.' + x + '.0_HEX', 'Primary Color HEX', '#' + primaryHex);\n\t\t\t\t\t\t\t\t\tawait this.create_state(device_id + '.' + i + '.' + y + '.' + x + '.1', 'Secondary Color RGB (background)', deviceStates[i][y][x][1]);\n\t\t\t\t\t\t\t\t\tawait this.create_state(device_id + '.' + i + '.' + y + '.' + x + '.1_HEX', 'Secondary Color HEX (background)', '#' + secondaryHex);\n\t\t\t\t\t\t\t\t\tawait this.create_state(device_id + '.' + i + '.' + y + '.' + x + '.2', 'Tertiary Color RGB', deviceStates[i][y][x][2]);\n\t\t\t\t\t\t\t\t\tawait this.create_state(device_id + '.' + i + '.' + y + '.' + x + '.2_HEX', 'Tertiary Color HEX', '#' + tertiaryHex);\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\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t}\n\n\t\t\t\t// Create states, ensure object structures are reflected in tree\n\t\t\t\tif (typeof (deviceStates[i]) !== 'object') {\n\n\t\t\t\t\t// Default channel creation\n\t\t\t\t\tthis.log.debug('Default state created : ' + i + ' : ' + JSON.stringify(deviceStates[i]));\n\t\t\t\t\tawait this.create_state(device_id + '.' + i, i, deviceStates[i]);\n\n\t\t\t\t} else {\n\n\t\t\t\t\tfor (const y in deviceStates[i]) {\n\t\t\t\t\t\tif (typeof (deviceStates[i][y]) !== 'object') {\n\t\t\t\t\t\t\tthis.log.debug('Object states created for channel ' + i + ' with parameter : ' + y + ' : ' + JSON.stringify(deviceStates[i][y]));\n\t\t\t\t\t\t\tawait this.create_state(device_id + '.' + i + '.' + y, y, deviceStates[i][y]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Create additional states not included in JSON-API of WLED but available as SET command\n\t\t\tawait this.create_state(device_id + '.tt', 'tt', null);\n\t\t\tawait this.create_state(device_id + '.psave', 'psave', null);\n\t\t\tawait this.create_state(device_id + '.udpn.nn', 'nn', null);\n\t\t\tawait this.create_state(device_id + '.time', 'time', null);\n\n\t\t\treturn 'success';\n\n\t\t} catch (error) {\n\n\t\t\t// Set alive state to false if data read fails\n\t\t\tawait this.setStateAsync(this.devices[index] + '._info' + '._online', {\n\t\t\t\tval: false,\n\t\t\t\tack: true\n\t\t\t});\n\t\t\tthis.log.error('Read Data error : ' + error);\n\t\t\treturn 'failed';\n\t\t}\n\t}",
"function showDeviceInfo() {\n\tvar devInfo = document.getElementById(\"deviceDisplay\");\n\n devInfo.innerHTML = \"Device Name: \" + device.name + \"<br/>\" + \n \"Device Model: \" + device.model + \"<br/>\" + \n \"Device Platform: \" + device.platform + \"<br/>\" + \n \"Platform Version: \" + device.version + \"<br/>\" + \n \"Device UUID: \" + device.uuid + \"<br/>\" +\n \"Cordova Version: \" + device.cordova + \"<br/>\";\n}",
"async getRequestDeviceInfo() {\n const outputReportID = 0x01;\n const subcommand = [0x02];\n const data = [\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n ...subcommand,\n ];\n await this.device.sendReport(outputReportID, new Uint8Array(data));\n\n return new Promise((resolve) => {\n const onDeviceInfo = ({ detail: deviceInfo }) => {\n this.removeEventListener('deviceinfo', onDeviceInfo);\n delete deviceInfo._raw;\n delete deviceInfo._hex;\n resolve(deviceInfo);\n };\n this.addEventListener('deviceinfo', onDeviceInfo);\n });\n }",
"function onDeviceReady() {\n log.innerHTML += \"Device ready <br />\";\n\n var element = document.getElementById('device_details');\n\n element.innerHTML = 'Device Name: ' + device.name + '<br />' +'<br/>' +\n 'Device Cordova: ' + device.cordova + '<br />' + '<br/>' +\n 'Device Platform: ' + device.platform + '<br />' + '<br/>' +\n 'Device UUID: ' + device.uuid + '<br />' + '<br/>' +\n 'Device Version: ' + device.version + '<br />' + '<br/>';\n\n log.innerHTML += \"Device details updated <br />\";\n}",
"retrieveDevice(req, res) {\n res.json({ message: \"Device\", data: req.device });\n }",
"_processDeviceSCPD(callback)\r\n {\r\n\t\tLogger.log(\"Specialisation for WemoMaker Deviceevent\", LogType.INFO);\r\n //Création des infos spécifiques au Maker decodable dans le attributeList\r\n\t\tvar xmlTemplate = fs.readFileSync(__dirname+'/../../resources/ServicesTemplate.xml', 'utf8');\r\n\t\txml2js.parseString(xmlTemplate, (err, templatesData) => {\r\n templatesData.servicesTemplate.serviceTemplate.forEach((serviceTemplate) => {\r\n if ((serviceTemplate['$']['serviceType'] == this._type || !serviceTemplate['$']['serviceType']) &&\r\n (serviceTemplate['$']['deviceType'] == this.Device.Type || !serviceTemplate['$']['deviceType']))\r\n {\r\n Logger.log(\"Processing scpd template\", LogType.DEBUG);\r\n this.processSCPD(serviceTemplate.scpd[0],false);\r\n\r\n //On s'abonne au evenement de la variable attributeList pour en faire le decodage\r\n var attributeList = this.getVariableByName('attributeList');\r\n if (!attributeList)\r\n {\r\n Logger.log(\"Unable to find attributeList variable of the Wemo Maker \" + this.Device.BaseAddress, LogType.ERROR);\r\n return;\r\n }\r\n attributeList.on('updated', (varObj, newVal) =>\t{\r\n xml2js.parseString(\"<AttributeList>\"+XmlEntities.decode(newVal)+\"</AttributeList>\", (err, parsed) => {\r\n if (err)\r\n {\r\n Logger.log(\"Unable to parse xml (bad format? : \" + err, LogType.DEBUG);\r\n }\r\n else\r\n {\r\n parsed.AttributeList.attribute.forEach((attr) => {\r\n var variable = this.getVariableByName(attr.name[0]);\r\n if (variable)\r\n {\r\n variable.Value = attr.value[0];\r\n if (attr.name[0] == 'SwitchMode')\r\n {\r\n var humanVariable = this.getVariableByName('Human'+attr.name[0]);\r\n if (attr.value[0] == '0') humanVariable.Value = 'OnOff';\r\n else humanVariable.Value = 'Momentary';\r\n }\r\n }\r\n else\r\n {\r\n Logger.log(\"Unable to find \" + attr.name[0] + \" variable of the Wemo Maker \" + this.Device.BaseAddress, LogType.ERROR);\r\n }\r\n\r\n });\r\n }\r\n });\r\n\t\t\t\t\t});\r\n }\r\n });\r\n if (this._eventSubURL != '/') this.subscribe();\r\n\t\t});\r\n }",
"async getDeviceDetails() {\n return this.digestClient\n .fetch(\n `http://${this.dahua_host}/cgi-bin/magicBox.cgi?action=getSystemInfo`\n )\n .then((r) => r.text())\n .then((text) => {\n const deviceDetails = text\n .trim()\n .split('\\n')\n .reduce((obj, str) => {\n const [key, val] = str.split('=');\n obj[key] = val.trim();\n return obj;\n }, {});\n return deviceDetails;\n });\n }",
"function getDeviceInfo(response) {\n var clients = response.data[0].result.client;\n if (clients.length === 0) {\n return [];\n } else {\n var attrs = { description: true, key: true, tags: true, basic: true, subscribers: true, shares: true, aliases: true};\n var calls = _.map(clients, (client) => {\n return { procedure: 'info', arguments: [client, attrs] };\n });\n return rpc(calls).then(\n (response) => {\n var zipped = _.zip(response.data, clients);\n response.data = _.map(zipped, (tuple) => {\n var device = tuple[0].result;\n device['client_id'] = tuple[1];\n if (device.description.meta) {\n device.description.meta = JSON.parse(device.description.meta);\n } else {\n device.description.meta = {};\n }\n return device;\n });\n return response;\n },\n (response) => {\n console.log('error', response);\n }\n );\n }\n }",
"function getDeviceInfo(){\n devicePlatform = device.platform;\n deviceVersion = device.version;\n deviceIsIOS = (devicePlatform == \"iOS\");\n deviceIsAndroid = (devicePlatform == \"android\") || (devicePlatform == \"Android\") || (devicePlatform == \"amazon-fireos\")\n if (deviceIsIOS) {\n if (deviceVersion.indexOf(\"8\") == 0) {\n deviceIOSVersion = 8\n } else if (deviceVersion.indexOf(\"7\") == 0) {\n deviceIOSVersion = 7\n } else if (deviceVersion.indexOf(\"6\") == 0) {\n deviceIOSVersion = 6\n } else if (deviceVersion.indexOf(\"5\") == 0) {\n deviceIOSVersion = 5\n } else {\n deviceIOSVersion = 4 // iOS version <= 4\n }\n }\n}",
"function getDeviceInfo(devname) {\r\n\t\tvar driverentry = null;\r\n\t\tvar device = null;\r\n\t\tif (devname) {\r\n\t\t device = g.devicemap[devname];\r\n\t\t if (device && device.driver) {\r\n\t\t \t// now lookup driver\r\n\t\t \tdriverentry = g.drivermap[device.driver];\r\n\t\t\t}\r\n\t if (!device) {\r\n\t g.log(g.LOG_ERROR,\"no device: \" + devname);\r\n\t }\r\n\t\t}\r\n\t\tif (!driverentry) {\r\n\t\t\tg.log(g.LOG_ERROR,\"driver for \" + devname + \" not found: \");\r\n\t\t}\r\n\r\n\t \treturn {driver: driverentry, 'device': device};\r\n\t}",
"function getDeviceInformation2(device){\n\tvar XmlString = \"\";\n\tif(device.DEVICE != null && device.DEVICE != undefined){\n\t\tvar devObject = device.DEVICE[0];\n\t\tXmlString += \"<DEVICE ChassisAddress='\"+devObject.ChassisAddress+\"' LoopBackAddress='' ObjectPath='\"+devObject.ObjectPath+\"' Username='\"+devObject.Username+\"'\";\n\t\tXmlString += \" ESXIUsername='\"+devObject.ESXIUsername+\"' Password='\"+devObject.Password+\"' ESXIPassword='\"+devObject.ESXIPassword+\"'\";\n\t\tXmlString += \" Status='\"+devObject.Status+\"' DeviceName='\"+devObject.DeviceName+\"' DevName='\"+devObject.DevName+\"'\";\n\t\tXmlString += \" DeviceId='\"+devObject.DeviceId+\"' RedFlag='\"+devObject.RedFlag+\"' ModelType='\"+devObject.ModelType+\"'\";\n\t\tXmlString += \" DNDModelType='\"+devObject.DNDModelType+\"' DeviceResId='\"+devObject.DeviceResId+\"' MacAddress='\"+devObject.MacAddress+\"'\";\n\t\tXmlString += \" DeviceFlag='\"+devObject.DeviceFlag+\"' HostName='\"+devObject.HostName+\"'\";\n\t\tXmlString += \" MediaType='\"+devObject.MediaType+\"' Portname='\"+devObject.Portname+\"' DBResId='\"+devObject.DBResId+\"'\";\n\t\tXmlString += \" ConnectivityType='\"+devObject.ConnectivityType+\"' PortSpeed='\"+devObject.PortSpeed+\"'\";\n\t\tXmlString += \" PortBandWidth='\"+devObject.PortBandWidth+\"' ExactHostName='\"+devObject.ExactHostName+\"'\";\n\t\tXmlString += \" LoadFlag='\"+devObject.LoadFlag+\"' PortView='\"+devObject.PortView+\"' Discovery='\"+devObject.Discovery+\"'\";\n\t\tXmlString += \" RouteProcessor='\"+devObject.RouteProcessor+\"' EmbeddedProcessor='\"+devObject.EmbeddedProcessor+\"'\";\n\t\tXmlString += \" LineCard='\"+devObject.LineCard+\"' ExactIpAdd='\"+devObject.ExactIpAdd+\"' PowerStatus='\"+devObject.PowerStatus+\"'\";\n\t\tXmlString += \" Application='\"+devObject.Application+\"' ProtoTypeFlag='\"+devObject.ProtoTypeFlag+\"'\";\n\t\tXmlString += \" SwitchPort='\"+devObject.SwitchPort+\"' MapName='\"+devObject.MapName+\"' ControllerInfo='\"+devObject.ControllerInfo+\"'\";\n\t\tXmlString += \" DeviceType='\"+devObject.DeviceType+\"'\";\n\t\tXmlString += \" />\";\n\t}\n\treturn XmlString;\n}"
]
| [
"0.6881749",
"0.6316864",
"0.6182602",
"0.6162377",
"0.6117553",
"0.6077262",
"0.60668993",
"0.6066492",
"0.60541606",
"0.60541606",
"0.60541606",
"0.60541606",
"0.60541606",
"0.60541606",
"0.6032404",
"0.60089266",
"0.5942555",
"0.5935273",
"0.59175646",
"0.5915749",
"0.5854172",
"0.584413",
"0.5843589",
"0.58354247",
"0.5815665",
"0.57962126",
"0.57860106",
"0.5755415",
"0.57511306",
"0.5738528"
]
| 0.64631146 | 1 |
handle the sensor information | function handle_sensor(topic, payload) {
var sensor = {};
var msgType = topic[3];
var sensorId = topic[2];
if (sensors[sensorId] == null) {
sensors[sensorId] = new Object();
sensor.id = sensorId;
sensor.name = sensorId;
} else sensor = sensors[sensorId];
// reset the name, if possible
if (sensor.name == sensorId && flx != undefined && sensor.port != undefined) {
sensor.name = flx[sensor.port].name + " " + sensor.subtype;
}
var value = JSON.parse(payload);
// now compute the gauge
switch (msgType) {
case "gauge":
// process currently only the FLM delivered values with timestamp
if (value.length == 3) {
// check time difference of received value to current time
// this is due to pulses being send on occurance, so potentially outdated
var now = new Date().getTime();
var diff = now / 1e3 - value[0];
// drop values that are older than 10 sec - as this is a realtime view
if (diff > 100) break;
// check if current sensor was already registered
var obj = series.filter(function(o) {
return o.label == sensor.name;
});
// flot.time requires UTC-like timestamps;
// see https://github.com/flot/flot/blob/master/API.md#time-series-data
var timestamp = value[0] * 1e3;
// ...if current sensor does not exist yet, register it
if (obj[0] == null) {
obj = {};
obj.label = sensor.name;
obj.data = [ timestamp, value[1] ];
obj.color = color;
color++;
series.push(obj);
// add graph select option
$("#choices").append("<div class='checkbox'>" + "<small><label>" + "<input type='checkbox' id='" + sensor.name + "' checked='checked'></input>" + sensor.name + "</label></small>" + "</div>");
} else {
obj[0].data.push([ timestamp, value[1] ]);
// move out values older than 5 minutes
var limit = parseInt(obj[0].data[0]);
diff = (timestamp - limit) / 1e3;
if (diff > 300) {
var selGraph = new Array();
for (var i in series) {
var selObj = {};
selObj.label = series[i].label;
selObj.data = series[i].data.filter(function(v) {
return v[0] > limit;
});
selObj.color = series[i].color;
selGraph.push(selObj);
}
series = selGraph;
}
}
}
// if length
break;
default:
break;
}
// check the selected checkboxes
selSeries = [];
$("#choices").find("input:checked").each(function() {
var key = $(this).attr("id");
var s = series.filter(function(o) {
return o.label == key;
});
selSeries.push(s[0]);
});
// plot the selection
var width = $("#graphpanel").width();
var height = width * 3 / 4;
height = height > 600 ? 600 : height;
$("#graph").width(width).height(height);
$.plot("#graph", selSeries, options);
// and store the sensor configuration
sensors[sensorId] = sensor;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sensorFunc() {\n\t// calls the success callback if the sesnor is there otherwise calls error\n\t// callback\n\ttizen.humanactivitymonitor.getHumanActivityData(\"HRM\",\n\t\t\tsuccessCallbackHeart, errorCallback); // HeartRate API\n}",
"function handle_sensor(topicArray, payload) {\n // the retrieved sensor information\n var sensor = {};\n // the message type is the third value\n var msgType = topicArray[3];\n // the sensor ID\n var sensorId = topicArray[2];\n if (sensors[sensorId] === undefined) {\n sensors[sensorId] = new Object();\n sensor.id = sensorId;\n sensor.name = sensorId;\n } else sensor = sensors[sensorId];\n sensors[sensorId] = sensor;\n switch (msgType) {\n case \"gauge\":\n switch (payload.length) {\n case 2:\n var now = parseInt(new Date().getTime() / 1e3);\n payload.unshift(now);\n break;\n\n case 3:\n // FLM gauges consist of timestamp, value, and unit\n if (payload[2] === \"W\") {\n var insertStr = \"INSERT INTO flmdata\" + \" (sensor, timestamp, value, unit)\" + ' VALUES (\"' + topicArray[2] + '\",' + ' \"' + payload[0] + '\",' + ' \"' + payload[1] + '\",' + ' \"' + payload[2] + '\");';\n db.run(insertStr, function(err, res) {\n if (err) {\n db.close();\n throw err;\n }\n });\n }\n break;\n\n default:\n break;\n }\n break;\n\n default:\n break;\n }\n}",
"function readSensorData() {\n \t bme280.readSensorData()\n .then((data) => {\n // temperature_C, pressure_hPa, and humidity are returned by default.\n temperature = data.temperature_C + 273.15;\n pressure = data.pressure_hPa * 100;\n humidity = data.humidity / 100;\n dewPoint = calculateDewpoint(data.temperature_C, humidity);\n\n //console.log(`data = ${JSON.stringify(data, null, 2)}`);\n\n // create message\n var delta = createDeltaMessage(temperature, humidity, pressure, dewPoint)\n\n // send temperature\n app.handleMessage(plugin.id, delta)\n\n })\n .catch((err) => {\n console.log(`BME280 read error: ${err}`);\n });\n }",
"function processReading(data) {\n var timenow = new Date(); // current time\n var trimmed = data.trim().replace(/>/g,''); // remove unwanted chars\n console.log(\"RH-USB: %s\", trimmed);\n var fields = trimmed.split(',');\n var temp = fields[1];\n var humid = fields[0];\n setTimeout(readRHUSB, period); // schedule next reading\n publish({ // publish sensor reading\n time: timenow.toISOString(),\n temperature: temp,\n humidity: humid\n });\n}",
"function readSensor(){\n sensor.read(SENSORTYPE, GPIOPIN, function(err, temperature, humidity) {\n if (!err) {\n console.log('temp: ' + temperature.toFixed(1) + 'C, ' + 'humidity: ' + humidity.toFixed(1) + '%');\n } else {\n console.log(err);\n }\n });\n}",
"function onMessageArrived(message) {\n ss = message.payloadString;\n var obj = JSON.parse(ss)\n console.log(obj);\n \n if ('CENTRALDEVICE_SENSOR' in obj) {\n var wind = obj.CENTRALDEVICE_SENSOR.WD;\n var time = obj.CENTRALDEVICE_SENSOR.TS;\n var date = obj.CENTRALDEVICE_SENSOR.DS;\n var AH = obj.CENTRALDEVICE_SENSOR.AH;\n var LX = obj.CENTRALDEVICE_SENSOR.LX;\n var RG = obj.CENTRALDEVICE_SENSOR.RG;\n var AT = obj.CENTRALDEVICE_SENSOR.AT;\n \n\n winddata.addData([wind], time);\n winddata.removeData();\n\n lxdata.addData([LX], time);\n lxdata.removeData();\n\n ahdata.addData([AH], time);\n ahdata.removeData();\n\n atdata.addData([AT], time);\n atdata.removeData();\n \n\n $(\".windspeeddata\").text(wind);\n $(\".ahdata\").text(AH);\n $(\".lxdata\").text(LX);\n $(\".rgdata\").text(RG);\n $(\".atdata\").text(AT);\n } // End if\n\n } // End message arrive",
"update(signal) {\n\t\tlet result;\n\t\twhile ((result = signal.getResult()) != null) {\n\t\t\tif (this.Sensors !== undefined && typeof result !== 'string' && result != null && result.valid) {\n\t\t\t\tlet tz = this.driver.homey.clock.getTimezone();\n\t\t\t\tlet when = result.lastupdate.toLocaleString(this.driver.homey.i18n.getLanguage(), { timeZone: tz });\n\t\t\t\tlet whenUTC = result.lastupdate; // UTC\n\t\t\t\tlet pid = result.pid || result.protocol;\n\t\t\t\tlet did = pid + ':' + result.id + ':' + (result.channel || 0);\n\t\t\t\tif (this.Sensors.get(did) === undefined) {\n\t\t\t\t\tthis.Sensors.set(did, { raw: { data: {} } });\n\t\t\t\t\tsignal.debug('Found a new sensor. Total found is now', this.Sensors.size);\n\t\t\t\t}\n\t\t\t\tlet current = this.Sensors.get(did).raw;\n\t\t\t\t// Check if a value has changed\n\t\t\t\tlet newdata = false;\n\t\t\t\tlet newvalue = {\n\t\t\t\t\t...result,\n\t\t\t\t\tdata: current.data\n\t\t\t\t};\n\t\t\t\tfor (let c in result.data) {\n\t\t\t\t\tif (result.data[c] !== newvalue.data[c]) {\n\t\t\t\t\t\tnewdata = true;\n\t\t\t\t\t\tnewvalue.data[c] = result.data[c];\n\t\t\t\t\t\tlet cap = capability[c];\n\t\t\t\t\t\tif (cap !== undefined) {\n\t\t\t\t\t\t\tlet val = this._mapValue(c, newvalue.data[c]);\n\t\t\t\t\t\t\tthis.emit('value:' + did, cap, val)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.emit('update:' + did, when, whenUTC);\n\n\t\t\t\t// Determine the sensor type based on its values\n\t\t\t\tnewvalue.type = this._determineType(newvalue.data);\n\t\t\t\tif (newvalue.type !== undefined) {\n\t\t\t\t\tsignal.debug('Sensor value has changed:', newdata);\n\n\t\t\t\t\t// Add additional data\n\t\t\t\t\tnewvalue.count = (current.count || 0) + 1;\n\t\t\t\t\tnewvalue.newdata = newdata;\n\n\t\t\t\t\tlet device = this.Devices.get(did)\n\t\t\t\t\tlet name = newvalue.name\n\t\t\t\t\tif (device) {\n\t\t\t\t\t\tname = device.getName()\n\t\t\t\t\t}\n\n\t\t\t\t\t// Update the sensor log\n\t\t\t\t\tlet display = {\n\t\t\t\t\t\tprotocol: signal.getName(),\n\t\t\t\t\t\ttype: genericType[newvalue.type].txt[this.locale] || genericType[newvalue.type].txt.en,\n\t\t\t\t\t\ticon: genericType[newvalue.type].icon,\n\t\t\t\t\t\tname: name,\n\t\t\t\t\t\tchannel: (newvalue.channel ? newvalue.channel.toString() : '-'),\n\t\t\t\t\t\tid: newvalue.id,\n\t\t\t\t\t\tupdate: when,\n\t\t\t\t\t\tdata: newvalue.data,\n\t\t\t\t\t\tpaired: this.Devices.has(did)\n\t\t\t\t\t}\n\t\t\t\t\tthis.Sensors.set(did, { raw: newvalue, display: display });\n\t\t\t\t\t//signal.debug(this.Sensors);\n\t\t\t\t\t// Send an event to the front-end as well for the app settings page\n\t\t\t\t\tthis.driver.homey.api.realtime('sensor_update', Array.from(this.Sensors.values()).map(x => x.display));\n\t\t\t\t} else {\n\t\t\t\t\tsignal.debug('ERROR: cannot determine sensor type for data', newvalue);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"function updateSensorData(data) {\n // Save the reading then update the UI.\n // labels = [\"ACC_X\", \"ACC_Y\", \"ACC_Z\", \"GYRO_X\", \"GYRO_Y\", \"GYRO_Z\", \"MAG_X\", \"MAG_Y\", \"MAG_Z\",\n // \"TEMP\", \"IO\", \"A1\", \"A2\", \"C\", \"Q1\", \"Q2\", \"Q3\", \"Q4\", \"PITCH\", \"YAW\", \"ROLL\", \"HEAD\"]\n \n if (launchWS){\n imuData = [data.ACC_X, data.ACC_Y];\n }\n }",
"function handle_device(topic, payload) {\n var deviceID = topic[2];\n if (topic[4] == \"flx\") flx = JSON.parse(payload);\n if (topic[4] == \"sensor\") {\n var config = JSON.parse(payload);\n for (var obj in config) {\n var cfg = config[obj];\n if (cfg.enable == \"1\") {\n if (sensors[cfg.id] == null) {\n sensors[cfg.id] = new Object();\n sensors[cfg.id].id = cfg.id;\n if (cfg.function != undefined) {\n sensors[cfg.id].name = cfg.function;\n } else {\n sensors[cfg.id].name = cfg.id;\n }\n if (cfg.subtype != undefined) sensors[cfg.id].subtype = cfg.subtype;\n if (cfg.port != undefined) sensors[cfg.id].port = cfg.port[0];\n } else {\n if (cfg.function != undefined) sensors[cfg.id].name = cfg.function;\n }\n }\n }\n }\n }",
"function handle_device(topicArray, payload) {\n switch (topicArray[4]) {\n case \"flx\":\n flx = payload;\n break;\n\n case \"sensor\":\n for (var obj in payload) {\n var cfg = payload[obj];\n if (cfg.enable == \"1\") {\n if (sensors[cfg.id] === undefined) sensors[cfg.id] = new Object();\n sensors[cfg.id].id = cfg.id;\n if (cfg.function !== undefined) {\n sensors[cfg.id].name = cfg.function;\n } else if (flx !== undefined && flx[cfg.port] !== undefined) {\n sensors[cfg.id].name = flx[cfg.port].name + \" \" + cfg.subtype;\n }\n if (cfg.subtype !== undefined) sensors[cfg.id].subtype = cfg.subtype;\n if (cfg.port !== undefined) sensors[cfg.id].port = cfg.port[0];\n console.log(\"Detected sensor \" + sensors[cfg.id].id + \" (\" + sensors[cfg.id].name + \")\");\n mqttclient.subscribe(\"/sensor/\" + cfg.id + \"/gauge\");\n mqttclient.subscribe(\"/sensor/\" + cfg.id + \"/counter\");\n }\n }\n break;\n\n default:\n break;\n }\n }",
"function processDataCallback(data) {\n\t\t\t\n\t\t\tvar event = {};\n\t\t\t\n\t\t\tevent.deviceId = data.deviceId;\n\t\t\tevent.riderId = data.riderInformation.riderId != undefined ? data.riderInformation.riderId : 0;\n\t\t\tevent.distance = data.geographicLocation.distance != undefined ? Math.round(data.geographicLocation.distance) : 0;\n\t\t\tevent.lat = data.geographicLocation.snappedCoordinates.latitude != undefined ? data.geographicLocation.snappedCoordinates.latitude : 0;\n\t\t\tevent.long = data.geographicLocation.snappedCoordinates.longitude != undefined ? data.geographicLocation.snappedCoordinates.longitude : 0;\n\t\t\tevent.acceleration = data.riderStatistics.acceleration != undefined ? parseFloat(data.riderStatistics.acceleration.toFixed(2)) : 0;\n\t\t\tevent.time = data.time != undefined ? data.time : 0;\n\t\t\tevent.altitude = data.gps.altitude != undefined ? data.gps.altitude: 0;\n\t\t\tevent.gradient = data.geographicLocation.gradient != undefined ? data.geographicLocation.gradient: 0;\n\t\t\t\n\t\t\t//Add speed object\n\t\t\tvar speed = data.riderInformation.speedInd ? (data.gps.speedGps != undefined ? data.gps.speedGps : 0) : 0 ;\n\t\t\tevent.speed = {\n\t\t\t\t\t\"current\" : speed,\n\t\t\t\t\t\"avg10km\" : 0.0,\n\t\t\t\t\t\"avg30km\" : 0.0\n\t\t\t}\n\t\t\t\n\t\t\t//Add power object\n\t\t\tvar power = data.riderInformation.powerInd ? (data.sensorInformation.power != undefined ? data.sensorInformation.power : 0) : 0;\n\t\t\tevent.power = {\n\t\t\t\t\t\"current\" : getFeedValue(\"power\", power),\n\t\t\t\t\t\"avg10km\" : 0,\n\t\t\t\t\t\"avg30km\" : 0\n\t\t\t}\n\t\t\t\n\t\t\tevent.heartRate = data.riderInformation.HRInd ? (data.sensorInformation.heartRate != undefined ? getFeedValue(\"HR\", data.sensorInformation.heartRate) : 0) : 0;\n\t\t\tevent.cadence = data.riderInformation.cadenceInd ? (data.sensorInformation.cadence != undefined ? data.sensorInformation.cadence : 0) : 0;\n\t\t\tevent.bibNumber = data.riderInformation.bibNumber != undefined ? data.riderInformation.bibNumber: 0;\n\t\t\tevent.teamId = data.riderInformation.teamId != undefined ? data.riderInformation.teamId: 0;\n\t\t\t\n\t\t\tvar eventStageId = data.riderInformation.eventId + \"-\" + data.riderInformation.stageId;\t\t\n\t\t\tdataCallback(event, eventStageId + \"-rider\");\n\t\t}",
"function eventListener(device, transducer) {\n var today = getToday();\n\n // (EDIT) check if the DEVICE name is the one you want\n if(device==\"しらすの入荷情報湘南\") {\n /*\n * (EDIT) change below statements depending on\n * which TRANSDUCER & what VALUE you want to use\n */\n if (typeof transducer.sensorData === \"undefined\") {\n status(\"Data undefined\");\n return;\n }\n\n if (transducer.id == \"入荷情報\") {\n EnoshimaSensorInfo.shirasu = transducer.sensorData.rawValue;\n\n if (transducer.sensorData.rawValue.indexOf(today) < 0) {\n // 未入荷\n EnoshimaSensorInfo.amount = 1;\n\n return;\n }\n\n if (transducer.sensorData.rawValue.indexOf(\"未入荷\") >= 0) {\n // 未入荷\n EnoshimaSensorInfo.amount = 1;\n }\n else if (transducer.sensorData.rawValue.indexOf(\"入荷\") >= 0) {\n if (transducer.sensorData.rawValue.indexOf(\"僅か\") >= 0) {\n // 入荷僅か\n EnoshimaSensorInfo.amount = 1;\n }\n else {\n // 入荷\n EnoshimaSensorInfo.amount = 0;\n }\n }\n else {\n // 未入荷\n EnoshimaSensorInfo.amount = 1;\n }\n }\n }\n}",
"function process(telemetry, executionContext) {\n\n try {\n // Log SensorId and Message\n log(`Sensor ID: ${telemetry.SensorId}. `);\n log(`Sensor value: ${JSON.stringify(telemetry.Message)}.`);\n\n // Get sensor metadata\n var sensor = getSensorMetadata(telemetry.SensorId);\n\n // Retrieve the sensor reading\n var parseReading = JSON.parse(telemetry.Message);\n\n // Set the sensor reading as the current value for the sensor.\n setSensorValue(telemetry.SensorId, sensor.DataType, parseReading.SensorValue);\n\n // Get parent space\n var parentSpace = sensor.Space();\n\n // Get children sensors from the same space\n //var otherSensors = parentSpace.ChildSensors();\n\n // Retrieve carbonDioxide, and motion sensors\n //var positionSensor = otherSensors.find(function(element) {\n // return element.DataType === positionType;\n //});\n\n //var levelSensor = otherSensors.find(function(element) {\n // log(`levelSensor found `);\n //return element.DataType === levelType;\n //});\n log(`Reached here-Abh`);\n // Add your sensor variable here\n\n // get latest values for above sensors\n var levelValue = getFloatValue(parseReading.SensorValue);\n var presence = !!levelValue && levelValue.toLowerCase() === \"true\";\n var positionValue = getFloatValue(positionSensor.Value().Value);\n\n // Add your sensor latest value here\n \n // Return if no motion or carbonDioxide found return\n // Modify this line to monitor your sensor value\n if(positionValue === null || levelValue === null) {\n sendNotification(telemetry.SensorId, \"Sensor\", \"Error: Position or Level are null, returning\");\n return;\n }\n\n // Modify these lines as per your sensor\n var levelLowerThan = \"Room is available and air is fresh\";\n var noAvailableOrFresh = \"Room is not available or air quality is poor\";\n\n // Modify this code block for your sensor\n // If carbonDioxide less than threshold and no presence in the room => log, notify and set parent space computed value\n if(parseFloat(levelValue) > parseFloat(levelThresholdHigh) ) {\n\n log(`${spaceLevelHigh}. Level : ${levelValue}. `);\n setSpaceValue(parentSpace.Id, spaceAvailFresh, \"High\");\n parentSpace.Notify(JSON.stringify(spaceLevelHigh));\n }\n else \n {\n if (parseFloat(levelValue) > parseFloat( levelThresholdMedium))\n {\n log(`${spaceLevelMedium}. Level : ${levelValue}.`);\n setSpaceValue(parentSpace.Id, spaceAvailFresh, \"Medium\");\n }\n else {\n log(`${spaceLevelLow}. Level: ${levelValue}. `);\n setSpaceValue(parentSpace.Id, spaceAvailFresh, \"Low\");\n // Set up custom notification for poor air quality\n parentSpace.Notify(JSON.stringify(spaceLevelLow));\n }\n }\n }\n catch (error)\n {\n log(`An error has occurred processing the UDF Error: ${error.name} Message ${error.message}.`);\n }\n}",
"function Sensingmethod(sensortype)\n{\n\tif(sensortype=\"temperature\")\n\t{\n\t\tvar temperatureSensor = new mraa.Aio(0);\n\t\tvar tempValraw=temperatureSensor.read();\n\t\tvar resistance=(1023-tempValraw)*10000/tempValraw; \n\t\tvar temperature=1/(Math.log(resistance/10000)/3975+1/298.15)-273.15; \n\t\tvar tempRound=Math.round(temperature*1e2)/1e2;\n\t\treturn tempRound;\n\t\t\n\t}\n\t\n\tif(sensortype=\"light\")\n\t{\n\tvar light = new groveSensor.GroveLight(1);\n\tvar lightrealtimedata=light.value();\n \treturn lightrealtimedata;\n\t\t\n\t}\n\t\n\tif(sensortype=\"sound\")\n\t{\n\t\tvar soundval=soundValraw;\n\t\treturn soundValraw;\n\t\t\n\t}\n\t\n}",
"function sensor(num,sense)\n{\t\n\tvar i;\n\tbase = Number(num);\n\tbase_h = 40\n\tsensorNum = Number(sense)\n\talarm = 0\n\terror = 0\n\trownumber=0\n\twhile(true)\n\t{\tvar r1 = getRandomInt(1,101) // Random event generator for temperature\n\t\tif(r1>=91 && r1<=95)\t\t// 5% chance for -3 to -8\n\t\t{\n\t\t\tt = base + getRandomInt(-8,-2)\n\t\t}\n\t\telse if(r1>=95 && r1<=100)\t\t// 5% chance for 3 to 8\n\t\t{\t\n\t\t\tt = base + getRandomInt(3,9)\n\t\t}\n\t\telse if(r1>=81 && r1<=90)\t\t// 10% chance for error number\n\t\t{\t\n\t\t\tt = 999\n\t\t\terror+=1\n\t\t}\n\t\telse\n\t\t{\t\n\t\t\tt = base + getRandomInt(-2,2)\n\t\t}\n\t\tvar r1 = getRandomInt(1,101) // Random event generator for temperature\n\t\tif(r1>=91 && r1<=95)\t\t// 5% chance for -3 to -8\n\t\t{\n\t\t\th = base_h + getRandomInt(-40,-9)\n\t\t}\n\t\telse if(r1>=95 && r1<=100)\t\t// 5% chance for 3 to 8\n\t\t{\t\n\t\t\th = base_h + getRandomInt(10,41)\n\t\t}\n\t\telse if(r1>=81 && r1<=90)\t\t// 10% chance for error number\n\t\t{\t\n\t\t\th = 999\n\t\t\terror+=1\n\t\t}\n\t\telse\n\t\t{\t\n\t\t\th = base_h + getRandomInt(-2,2)\n\t\t}\n\t\tvar d= new Date()\n\t\tvar timestamp=d.toLocaleString();\n\t\t\n\t\tvar data = {\n\t\t\t\"id\" : ++rownumber,\n\t\t\t\"Timestamp\" : timestamp,\n\t\t\t\"sensorid\" : sensorNum,\n\t\t\t\"Temperature\" : t,\n\t\t\t\"Humidity\" : h,\n\t\t\t\"Alarm_Count_Temp\" : alarm,\n\t\t\t\"Alarm_Count_Hum\" : alarm,\n\t\t\t\"ErrorCount\" : error\n\t\t}\n\n\t\tprocess.send(data);\t// sends data to mysql\n\t\tsleep(10000);\n\t};\n}",
"readHydrawiseStatus(){\n const cmd = hydrawise_url_status + \"api_key=\" + this.config.hydrawise_apikey;\n\n // execute only if apikey is defined in config page\n if (this.config.hydrawise_apikey!=undefined){\n this.log.info(\"send: \"+cmd);\n //request(cmd, function (error, response, body){\n request(cmd, (error, response, body) => {\n\n if (!error && response.statusCode == 200) {\n // parse JSON response from Hydrawise controller\n var obj = JSON.parse(body);\n // read device config\n hc6.nextpoll = parseInt(obj.nextpoll);\n hc6.time = parseInt(obj.time);\n hc6.message = obj.message;\n this.log.info(\"nextpoll=\"+hc6.nextpoll+\" time=\"+hc6.time+\" message=\"+hc6.message);\n \n // read all configured sensors\n for (let i=0; i<=1; i++){\n // if sensor is configured\n if (obj.sensors[i]!=null){\n hc6.sensors[i].input = parseInt(obj.sensors[i].input);\n hc6.sensors[i].type = parseInt(obj.sensors[i].type);\n hc6.sensors[i].mode = parseInt(obj.sensors[i].mode);\n hc6.sensors[i].timer = parseInt(obj.sensors[i].timer);\n hc6.sensors[i].offtimer = parseInt(obj.sensors[i].offtimer);\n // read all related relays\n for (let j=0; j<=5; j++){\n // if relay is configured\n if (obj.sensors[i].relays[j]!=null){\n hc6.sensors[i].relays[j]=obj.sensors[i].relays[j].id\n }\n };\n }\n this.log.info(\"sensor\"+i+\": input=\"+hc6.sensors[i].input+\" type=\"+hc6.sensors[i].type+\n \" mode=\"+hc6.sensors[i].mode+ \" timer=\"+hc6.sensors[i].timer+\" offtimer=\"+hc6.sensors[i].offtimer+\n \" relay0=\"+hc6.sensors[i].relays[0]+\" relay1=\"+hc6.sensors[i].relays[1]+\" relay2=\"+hc6.sensors[i].relays[2]+\n \" relay3=\"+hc6.sensors[i].relays[3]+\" relay4=\"+hc6.sensors[i].relays[4]+\" relay5=\"+hc6.sensors[i].relays[5]);\n }\n\n // read all configured relays\n for (let i=0; i<=5; i++){\n if (obj.relays[i]!=null){\n hc6.relays[i].relay_id = parseInt(obj.relays[i].relay_id);\n hc6.relays[i].name = obj.relays[i].name;\n hc6.relays[i].relay = parseInt(obj.relays[i].relay);\n hc6.relays[i].type = parseInt(obj.relays[i].type);\n hc6.relays[i].time = parseInt(obj.relays[i].time);\n hc6.relays[i].run = parseInt(obj.relays[i].run);\n hc6.relays[i].period = parseInt(obj.relays[i].period);\n hc6.relays[i].timestr = obj.relays[i].timestr;\n }\n else{\n hc6.relays[i].relay_id = 0;\n hc6.relays[i].name = \"\";\n hc6.relays[i].relay = 0;\n hc6.relays[i].type = 0;\n hc6.relays[i].time = 0;\n hc6.relays[i].run = 0;\n hc6.relays[i].period = 0;\n hc6.relays[i].timestr = \"\";\n }\n this.log.info(\"relay\"+i+\": relay_id=\"+hc6.relays[i].relay_id+\" name=\"+hc6.relays[i].name+\n \" relay=\"+hc6.relays[i].relay+\" type=\"+hc6.relays[i].type+\" time=\"+hc6.relays[i].time+\n \" run=\"+hc6.relays[i].run+\" period=\"+hc6.relays[i].period+\" timestr=\"+hc6.relays[i].timestr);\n }\n }\n })\n }\n }",
"function handle_msg(msg, clock_time)\r\n{\r\n // add to recorded_data if recording is on\r\n\r\n if (recording_on)\r\n {\r\n recorded_records.push(JSON.stringify(msg));\r\n }\r\n\r\n var sensor_id = msg[RECORD_INDEX];\r\n\r\n console.log(\"Got message: \"+JSON.stringify(msg));\r\n\r\n // If an existing entry in 'sensors' has this key, then update\r\n // otherwise create new entry.\r\n if (sensors.hasOwnProperty(sensor_id))\r\n {\r\n update_sensor(msg, clock_time);\r\n }\r\n else\r\n {\r\n init_sensor(msg, clock_time);\r\n }\r\n\r\n}",
"function updateSensors(msg) {\n\tstate[msg.sensor] = msg.voltage;\n}",
"function readSHT1x(sensorName) {\n\t// Select sensor to be used\n\tSensor.select(sensorName);\n\tasync.series(\n\t\t[\n\t\t\tSensor.init,\n\t\t\tSensor.reset,\n\t\t\tSensor.longWait,\n\t\t\tfunction(callback) {\n\t\t\t\tSensor.getSensorValues(function(error, values) {\n\t\t\t\t\tif (error) {\n\t\t\t\t\t\tcallback(error);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t//Add timestamp to values\n\t\t\t\t\tvalues.timestamp = moment().format();\n\n\t\t\t\t\t// Correct humidity in 100% if more than 99%\n\t\t\t\t\tif ('humidity' in values) {\n\t\t\t\t\t\tif (values.humidity > 99) {\n\t\t\t\t\t\t\tvalues.humidity = 100;\n\t\t\t\t\t\t}\n\t\t\t\t\t} \n\n\t\t\t\t\tif (!sensorName in lastData) {\n\t\t\t\t\t\tlastData[sensorName] = {};\n\t\t\t\t\t}\n\n\t\t\t\t\tlastData[sensorName] = values;\n\n\t\t\t\t\tfirebase.addItem(sensorName, values);\n\t\t\t\t\tconsole.log(TITLE.INFO + Sensor.getSelected().name + ':');\n\t\t\t\t\tconsole.log(values);\n\t\t\t\t\tcallback();\n\t\t\t\t});\n\t\t\t},\n\t\t\tfunction(callback) {\n\t\t\t\tconfig.sensors[sensorName].previousReading = moment().format();\n\t\t\t\tcallback();\n\t\t\t},\n\t\t\twriteConfig\n\t\t], \n\t\tfunction(error) {\n\t\t\tSensor.shutdown();\n\t\t\tif (error) {\n\t\t\t\tconsole.error(TITLE.ERROR + error);\n\t\t\t}\n\t\t\treadSensors();\n\t\t}\n\t);\n}",
"function readSensors(done) {\n async.series([\n updateTempIndoor,\n updateTempExternal\n ], done);\n }",
"function temp_sensor() {\r\n var celsius = temp.value();\r\n var fahrenheit = celsius * 9.0/5.0 + 32.0;\r\n console.log(celsius + \" degrees Celsius, or \" +\r\n Math.round(fahrenheit) + \" degrees Fahrenheit\");\r\n\r\n deviceClient.publish(\"status\",\"json\",'{\"d\" : { \"temperature\" : '+ celsius +'}}');\r\n setTimeout(temp_sensor,1000);\r\n\r\n}",
"function readSensor(sensorObj, callback) {\n let statPacket = [];\n\n PythonShell.run(pythonScript, {args: [sensorObj.address, sensorObj.shunt_ohms] }, function (err, data) {\n // Check if script returned an error\n if (err) callback(err);\n\n // Put together the packet of data\n statPacket = data[0];\n statPacket.rpm = sensorObj.rpmSensor.getRPM();\n statPacket.name = sensorObj.name;\n\n // Emit the data to all clients\n // socketObj.emit('stats', statPacket);\n callback(null, statPacket);\n });\n}",
"function outputData()\n{\n sensor.update();\n\n var floatData = sensor.getEulerAngles();\n console.log(\"Euler: Heading: \" + floatData.get(0)\n + \" Roll: \" + floatData.get(1)\n + \" Pitch: \" + floatData.get(2)\n + \" degrees\");\n\n floatData = sensor.getQuaternions();\n console.log(\"Quaternion: W: \" + floatData.get(0)\n + \" X:\" + floatData.get(1)\n + \" Y: \" + floatData.get(2)\n + \" Z: \" + floatData.get(3));\n\n floatData = sensor.getLinearAcceleration();\n console.log(\"Linear Acceleration: X: \" + floatData.get(0)\n + \" Y: \" + floatData.get(1)\n + \" Z: \" + floatData.get(2)\n + \" m/s^2\");\n\n floatData = sensor.getGravityVectors();\n console.log(\"Gravity Vector: X: \" + floatData.get(0)\n + \" Y: \" + floatData.get(1)\n + \" Z: \" + floatData.get(2)\n + \" m/s^2\");\n\n console.log(\"\");\n}",
"function handleData(data) {\n if (data.Status == \"parked\") {\n getPlate(data.Spot);\n } else {\n handleTimer(data);\n }\n}",
"function showSensorInfo(sensor) {\n // Draw canvas with selected room highlighted.\n currentSensor = sensor;\n drawCanvas();\n var html;\n\n if (sensor && sensor.data) {\n // Display info.\n html =\n '<input id=\"close\" type=\"image\" src=\"close.png\">'\n + '<h1>Sensor Data</h1>'\n + '<br /><div id=\"time\">Time</div> ' + fixTimeData(sensor.data.timestamp) + '<br />'\n + '<button id=\"lum\" class=\"dataButton\">Luminosity</button> ' + sensor.data.l + ' lum<br />'\n + '<button id=\"hum\" class=\"dataButton\">Humidity</button> ' + sensor.data.h + ' %<br />'\n + '<button id=\"temp\" class=\"dataButton\">Temperature</button> ' + sensor.data.t + ' celcius<br />'\n + '<button id=\"press\" class=\"dataButton\">Pressure</button> ' + sensor.data.p + ' Pascal<br />'\n + '<button id=\"co2\" class=\"dataButton\">CO2</button> ' + sensor.data.c + ' ppm<br />'\n + '<img src=\"' + sensor.image + '\" />'\n } else {\n html =\n '<input id=\"close\" type=\"image\" src=\"close.png\">'\n + '<h1>Sensor Data</h1>'\n + '<br />Sorry, sensor data not available right now :(</br>'\n + '<img src=\"' + sensor.image + '\" />'\n }\n\n showInfo(html);\n }",
"function initSensorData() {\r\n // let dbRes = getAllRoomInfo();\r\n // dbRes.promise.then(res => {\r\n // if (res.rowCount > 0) {\r\n // let roomList = res.rows;\r\n // roomList.forEach(item => {\r\n var room_no = 1;\r\n sensorDataMap[room_no] = {\r\n roomNo: +room_no,\r\n pm2p5CC: '未测出',\r\n temperature: '未测出',\r\n humidity: '未测出',\r\n pm10CC: '未测出'\r\n };\r\n // });\r\n // }\r\n module.exports.startUpdateSensorData();\r\n // dbRes.client.end();\r\n // });\r\n console.log(\"function\");\r\n}",
"function serialEvent(){\n //THIS READS BINARY - serial.read reads from the serial port, Number() sets the data type to a number\n\t// inData = Number(serial.read()); //reads data as a number not a string\n\n //THIS READS ASCII\n inData = serial.readLine(); //read until a carriage return\n\n //best practice is to make sure you're not reading null data\n if(inData.length > 0){\n //split the values apart at the comma\n var numbers = split(inData, ',');\n\n //set variables as numbers\n sensor1 = Number(numbers[0]);\n sensor2 = Number(numbers[1]);\n }\n\n console.log(sensor1 + \", \" + sensor2);\n}",
"function pollSensorSerial() {\n let intervalPoll = setInterval(function () {\n that.stateMachine.sensorPiso.Get_state(function (err, dta) { });\n if(that.stateMachine.isDispense===false){\n clearInterval(intervalPoll);\n intervalPoll = null\n }\n }, 500);\n }",
"updateTelemetry() {\n // check that subspace radio works\n if (this.subspaceRadio.isDamaged()) {\n return;\n }\n // go through our sensors\n this.hasSensors.forEach((s, qy) => {\n s.forEach(qx => {\n // get corresponding info\n let info = this.info[qy][qx];\n // get sector from galaxy\n let sector = this.galaxy._getQuadrant(qx, qy);\n this._updateInfo(sector, info);\n });\n });\n }",
"handleSensorValue(value, id) {\n if (!this.sensors[id])\n return;\n this.log.debug(`got value ${value} from sensor ${this.sensors[id].address}`);\n this.setStateAsync(id, {\n ack: true,\n val: value\n });\n }"
]
| [
"0.6966615",
"0.6716126",
"0.66259146",
"0.64087725",
"0.63992155",
"0.62982756",
"0.6296216",
"0.6273894",
"0.62679636",
"0.62663",
"0.6263095",
"0.6262468",
"0.61906576",
"0.6142741",
"0.6094484",
"0.6092796",
"0.60718995",
"0.60653365",
"0.60595727",
"0.6053847",
"0.60520566",
"0.6030024",
"0.602411",
"0.60142756",
"0.6007119",
"0.6003588",
"0.5975758",
"0.5971523",
"0.5969934",
"0.59443706"
]
| 0.68387544 | 1 |
Het gaat hier om een gepubliceerd trackModel die door de eigenaar is geprivatiseerd of defintief verwijderd heeft. De volger hoeft alleen maar de dit trackModel/trackSupModel en trackTagModellen (incl updaten van de lables in SideMenu) uit zijn stores te verwijderen. Dit trackModel is dan niet meer zichtbaar in zijn TRINL. Hij laat zijn TrackSup TrackReactieModel TrackReactieSupModel en TrackTagModellen in de database. Als de eigenaar deze Track opnieuw publiceerd worden de Sup en Reactie bestanden weer toegevoegd. Deze POI blijft bij de volger weg als deze Track geprivatiseerd blijft. De Als de Track niet gesyncd wordt dan worden ook de andere Modellen niet gesynced. !!!Attentie. De updates van dit trackModel, trackSupModel, Reacties en trackTags gaan gewoon door. Nagaan of de volger hierdoor niet lastig gevallen wordt!!! LoadAll gaat goed. Dit trackModel wordt niet meer geload. SyncDownAll !!!!!!!!!!!!!! SyncDown haalt ook nieuwe modellen op. Alles moet gewoon door de FrontEndAPI in stores worden bijgewerkt. De gelinkte bestanden zijn jammer genoeg overbodig als er geen itemModel is. De volgende loadAll laadt deze overbodige modellen toch niet meer. | function verwijderTrack(trackModel, mode, watch) {
var q = $q.defer();
//console.warn('dataFactoryTrack verwijderTrack: ', trackModel.get('naam'));
var trackId = trackModel.get('Id');
initxData(trackModel);
//
// Clean up stores
//
loDash.remove(dataFactoryTrack.star, function (trackModel) {
return trackModel.get('Id') === trackId;
});
loDash.remove(dataFactoryTrack.nieuw, function (trackModel) {
return trackModel.get('Id') === trackId;
});
loDash.remove(dataFactoryTrack.selected, function (trackModel) {
return trackModel.get('Id') === trackId;
});
//
// Verwijderen labels in sidemenu
//
loDash.each(trackModel.xData.tags, function (trackTagModel) {
//console.log('dataFactoryTrack updateLabels loop Tags: ', trackTagModel, trackTagModel.xData);
tagsRemove(trackModel, trackTagModel.xData);
});
trackModel.xData.tags = [];
//
$rootScope.$emit('trackSideMenuUpdate');
//
loDash.remove(dataFactoryTrackTag.store, function (trackTagModel) {
return trackTagModel.get('trackId') === trackId && trackTagModel.get('gebruikerId') === dataFactoryCeo.currentModel.get('Id');
});
loDash.remove(dataFactoryTrackTag.data, function (dataItem) {
return dataItem.record.get('trackId') === trackId && dataItem.record.get('gebruikerId') === dataFactoryCeo.currentModel.get('Id');
});
//console.warn('dataFactoryTrack verwijderTrack trackTags VERWIJDERD form trackTagStore/data');
loDash.remove(dataFactoryTrackReactie.store, function (trackReactieModel) {
return trackReactieModel.get('trackId') === trackId;
});
loDash.remove(dataFactoryTrackReactie.data, function (dataItem) {
return dataItem.record.get('trackId') === trackId;
});
//console.warn('dataFactoryTrack verwijderTrack trackReactie VERWIJDERD form trackReactieStore/data');
loDash.remove(dataFactoryTrackReactieSup.store, function (trackReactieSupModel) {
return trackReactieSupModel.get('trackId') === trackId && trackReactieSupModel.get('gebruikerId') === dataFactoryCeo.currentModel.get('Id');
});
loDash.remove(dataFactoryTrackReactieSup.data, function (dataItem) {
return dataItem.record.get('trackId') === trackId && dataItem.record.get('gebruikerId') === dataFactoryCeo.currentModel.get('Id');
});
//console.log('dataFactoryTrack verwijderTrack trackReactieSups VERWIJDERD from store');
loDash.remove(dataFactoryTrackSup.store, function (trackSupModel) {
return trackSupModel.get('trackId') === trackId && trackSupModel.get('gebruikerId') === dataFactoryCeo.currentModel.get('Id');
});
loDash.remove(dataFactoryTrackSup.data, function (dataItem) {
return dataItem.record.get('trackId') === trackId && dataItem.record.get('gebruikerId') === dataFactoryCeo.currentModel.get('Id');
});
//console.warn('dataFactoryTrack verwijderTrack trackSup VERWIJDERD from trackSupStore/data');
//updateLabels(trackModel).then(function () {
loDash.remove(dataFactoryTrack.store, function (trackModel) {
//console.log('dataFactoryTrack verwijderTrack trackverijderen loDash remove: ', trackModel, trackId, trackModel.get('Id'), trackModel.get('xprive'), trackModel.get('gebruikerId'), trackModel.get('naam'));
return trackModel.get('Id') === trackId;
});
loDash.remove(dataFactoryTrack.data, function (dataItem) {
return dataItem.record.get('Id') === trackId;
});
//console.warn('dataFactoryTrack verwijderTrack track VERWIJDERD from trackStore/data');
//console.log('dataFactoryTrack verwijderTrack aantal dataFactoryTrack.store STORE: ', dataFactoryTrack.store, dataFactoryTrack.store.length);
//
// Waarschuwing als de gebruiker in deze Card zit
//
$rootScope.$emit('trackVerwijderd', {
trackModel: trackModel
});
if (watch) {
watchUpdate(mode, trackModel);
}
$timeout(function () {
$rootScope.$emit('tracksFilter');
$rootScope.$emit('tracksNieuweAantallen');
}, 500);
q.resolve();
//});
return q.promise;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateReacties(trackModel) {\n\n //console.warn('dataFactoryTrack updateReacties naam: ', trackModel.get('naam'));\n\n var q = $q.defer();\n\n var trackId = trackModel.get('Id');\n\n var trackReacties = loDash.filter(dataFactoryTrackReactie.store, function (trackReactieModel) {\n return trackReactieModel.get('trackId') === trackId;\n });\n //console.log('dataFactoryTrack updateReacties trackReacties: ', trackReacties);\n if (trackReacties.length > 0) {\n //console.log('dataFactoryTrack updateReacties syncDown naam, trackId, trackReacties: ', trackModel.get('naam'), trackId, trackReacties);\n loDash.each(trackReacties, function (trackReactieModel) {\n //console.log('dataFactoryTrack updateReacties trackId, naam, reactie: ', trackId, trackModel.get('naam'), trackReactieModel.get('reactie'));\n var trackReactieId = trackReactieModel.get('Id');\n\n var trackReactieSupModel = loDash.find(dataFactoryTrackReactieSup.store, function (trackReactieSupModel) {\n return trackReactieSupModel.get('reactieId') === trackReactieId;\n });\n\n if (trackReactieSupModel) {\n\n trackReactieModel.xData = {};\n trackReactieModel.xData.tags = [];\n\n trackReactieModel.xData.sup = trackReactieSupModel;\n\n var xnew = trackReactieSupModel.get('xnew');\n\n if (xnew) {\n if (!virgin) {\n notificationsTrackReactie += 1;\n }\n var trackNieuwModel = loDash.find(dataFactoryTrack.nieuw, function (trackNieuwModel) {\n return trackNieuwModel.get('Id') === trackId;\n });\n if (!trackNieuwModel) {\n dataFactoryTrack.nieuw.push(trackModel);\n //console.log('dataFactoryTrack updateTrackxnew toegevoegd aan nieuw: ', dataFactoryTrack.nieuw);\n }\n } else {\n loDash.remove(dataFactoryTrack.nieuw, function (trackNieuwModel) {\n return trackNieuwModel.get('Id') === trackId;\n });\n //console.log('dataFactoryTrack updateTrack xnew verwijderd: ', dataFactoryTrack.nieuw);\n }\n } else {\n //console.log('dataFactoryTrack updateTrackreacties heeft nog geen trackReactieSupModel. Dus nieuw trackReactieSupModel aanmaken!!');\n\n trackReactieSupModel = new dataFactoryTrackReactieSup.Model();\n trackReactieSupModel.set('reactieId', trackReactieId);\n trackReactieSupModel.set('trackId', trackId);\n trackReactieSupModel.set('gebruikerId', dataFactoryCeo.currentModel.get('Id'));\n trackReactieSupModel.set('star', false);\n trackReactieSupModel.set('xnew', true);\n if (virgin) {\n trackReactieSupModel.set('xnew', false);\n }\n trackReactieSupModel.save().then(function () {\n\n //console.log('dataFactoryTrack updateReacties trackReactieSupModel CREATED.');\n\n trackReactieModel.xData = {};\n trackReactieModel.xData.tags = [];\n trackReactieModel.xData.sup = trackReactieSupModel;\n\n //console.log('dataFactoryTrack updateReacties trackReactieSupModel toegevoegd aan Reactie.');\n\n var trackSupModel = loDash.find(dataFactoryTrackSup.store, function (trackSupModel) {\n return trackSupModel.get('trackId') === trackId && trackSupModel.get('gebruikerId') === dataFactoryCeo.currentModel.get('Id');\n });\n\n if (trackSupModel) {\n //console.log('dataFactoryTrack updateReacties trackSupModel gevonden: ', trackId, trackModel.get('naam'));\n trackModel.xData.sup = trackSupModel;\n\n var xnew = trackSupModel.get('xnew');\n var star = trackSupModel.get('star');\n //console.log('dataFactoryTrack updateTrack trackModel, trackModel.xData.sup UPDATE trackId: ', trackModel, trackModel.xData.sup, trackModel.xData.sup.get('trackId'));\n\n if (star) {\n var trackStarModel = loDash.find(dataFactoryTrack.star, function (trackStarModel) {\n return trackStarModel.get('Id') === trackId;\n });\n if (!trackStarModel) {\n dataFactoryTrack.star.push(trackModel);\n //console.log('dataFactoryTrack updateTrack star toegevoegd: ', dataFactoryTrack.star);\n }\n } else {\n loDash.remove(dataFactoryTrack.star, function (trackStarModel) {\n return trackStarModel.get('Id') === trackId;\n });\n //console.log('dataFactoryTrack updateTrack star verwijderd: ', dataFactoryTrack.star);\n }\n\n //console.log('dataFactoryTrack updateTrack xnew: ', xnew);\n\n\n if (xnew) {\n if (!virgin) {\n notificationsTrack += 1;\n }\n var trackNieuwModel = loDash.find(dataFactoryTrack.nieuw, function (trackNieuwModel) {\n return trackNieuwModel.get('Id') === trackId;\n });\n if (!trackNieuwModel) {\n dataFactoryTrack.nieuw.push(trackModel);\n //console.log('dataFactoryTrack updateTrackxnew toegevoegd aan nieuw: ', dataFactoryTrack.nieuw);\n }\n } else {\n loDash.remove(dataFactoryTrack.nieuw, function (trackNieuwModel) {\n return trackNieuwModel.get('Id') === trackId;\n });\n //console.log('dataFactoryTrack updateTrack xnew verwijderd: ', dataFactoryTrack.nieuw);\n }\n\n\n //console.log('dataFactoryTrack reload updateSupModel SUCCESS');\n q.resolve();\n\n //console.log('dataFactoryTrack updateTrackList heeft nog geen supModel. Dus nieuw!! Id, naam: ', trackModel.get('Id'), trackModel.get('naam'));\n\n trackSupModel = new dataFactoryTrackSup.Model();\n trackSupModel.set('trackId', trackId);\n trackSupModel.set('gebruikerId', dataFactoryCeo.currentModel.get('Id'));\n trackSupModel.set('star', false);\n trackSupModel.set('xnew', true);\n if (virgin) {\n trackSupModel.set('xnew', false);\n //console.log('dataFactoryTrack updateTrack nieuwe trackenup niet als nieuw beschouwen. Gebruiker is maagd');\n }\n //console.log('dataFactoryTrack updateTrack nieuw trackSupModel: ', trackSupModel.get('trackId'));\n\n trackSupModel.save().then(function () {\n\n //console.log('dataFactoryTrack updateTrack nieuw trackSupModel: ', trackSupModel);\n\n trackModel.xData.sup = trackSupModel;\n\n if (!virgin) {\n notificationsTrack += 1;\n var nieuwModel = loDash.find(dataFactoryTrack.nieuw, function (nieuwModel) {\n return nieuwModel.get('Id') === trackId;\n });\n if (!nieuwModel) {\n dataFactoryTrack.nieuw.push(trackModel);\n }\n } else {\n //console.error('dataFactoryTrack updateTrack nieuwe trackenup notifications skipped. Gebruiker is maagd');\n }\n //console.log('dataFactoryTrack updateTrack nieuwe trackenup voor trackId NOT FOUND in TrackStore.nieuw: ', trackId, dataFactoryTrack.nieuw);\n\n //console.log('dataFactoryTrack reload updateSupModel nieuwe track SUCCESS');\n q.resolve();\n\n });\n }\n });\n }\n });\n //console.log('dataFactoryTrack reload updateReacties SUCCESS');\n q.resolve();\n } else {\n //console.log('dataFactoryTrack reload updateReacties SUCCESS');\n q.resolve();\n }\n\n return q.promise;\n }",
"_update() {\n return this.store.findAll(this.modelName, { reload: true });\n }",
"async loadTracks() {\n if (!Is.empty(this.user.tracks)) {\n this.tracks = this.user.tracks;\n } else {\n this.isLoading = true;\n }\n\n let response = await this.meService.tracks();\n\n this.tracks = response.records;\n\n this.isLoading = false;\n\n this.user.update('tracks', this.tracks);\n }",
"onRestore() {\n this._updateModels();\n }",
"componentWillUnmount(){\n ModelStore.removeListener(\"change\", this.getModel );\n }",
"function fetchDailyTracks() {\n fetch(`${process.env.REACT_APP_BACKEND_URL}/daily_tracks`)\n // Authorization: `Bearer ${localStorage.getItem(\"token\")}`,\n // },\n .then((res) => res.json())\n .then((tracks) => {\n const thisDriverTracks = tracks.filter(\n (track) => track.user_id === count\n );\n if (thisDriverTracks.length > 0) {\n const last = thisDriverTracks[thisDriverTracks.length - 1];\n setDriverTrack(last);\n // console.log(last.user_id)\n setDriverId(last.user_id);\n // console.log(last.vehicle_id)\n setVehicleId(last.vehicle_id);\n // setTrackId(last.id)\n setTrackId(last.id)\n\n console.log(last);\n }\n });\n }",
"function model (model) {\n _store.model(model)\n }",
"function App() {\n\n const getTracks = () => {\n return fetch('http://35.232.86.10:1337/tracks').then(response => response.json());\n }\n\n const [tracks, setTracks] = useState([])\n\n useEffect(() => {\n getTracks().then(tracks => setTracks(tracks));\n\n }, []);\n \n // Automatially creates id for new tracks\n const addTrack = track => {\n track.id = tracks.length + 1\n setTracks([...tracks, track])\n\n \n }\n\n // Deletes track\n const deleteTrack = id => {\n setTracks(tracks.filter(track => track.id !== id))\n }\n\n //Tracks whether to display edit from\n const [editing, setEditing] = useState(false)\n\n // Initial Edit form Values\n const initialFormState = {id: null, title: \"\", artist: \"\", album: \"\", recommender: \"\", comments: \"\"}//listened_to: false, rating: 0, genre: \"\",\n\n const [currentTrack, setCurrentTrack] = useState(initialFormState)\n\n const editTrack = track => {\n setEditing(true)\n \n setCurrentTrack({id: track.id, title: track.title, artist: track.artist, album: track.album, listened_to: track.listened_to, rating: track.rating, genre: track.genre, recommender: track.recommender, comments: track.comments})\n }\n\n const updateTrack = (id, updatedTrack) => {\n setEditing(false)\n\n setTracks(tracks.map(track => (track.id === id ? updatedTrack: track)));\n }\n\n const pickTrack = track =>{\n setCurrentTrack({id: track.id, title: track.title, artist: track.artist, album: track.album, listened_to: track.listened_to, rating: track.rating, genre: track.genre, recommender: track.recommender, comments: track.comments})\n }\n\n\n return (\n <section className=\"section has-background-light\">\n <Router>\n <div className=\"container\">\n <hr/>\n <div className=\"box\">\n <div><h1 className=\"title is-1 has-text-info\">Song Recommendations</h1>\n <h2 className=\"subtitle\">Beau Curnow</h2></div>\n </div>\n <div className=\"columns\">\n <div className=\"column is-narrow\"> \n {editing ? (\n <UpdateTrackForm editing={editing} setEditing={setEditing} currentTrack={currentTrack} updateTrack={updateTrack}/>\n ):(\n <AddTrackForm addTrack={addTrack}/>)}\n </div> \n <div className=\"column\">\n <Switch>\n <Route path=\"/:id\">\n <Track currentTrack={currentTrack} key={currentTrack.id}/> \n </Route>\n <Route path=\"/\">\n <TrackTable tracks={tracks} deleteTrack={deleteTrack} editTrack={editTrack} pickTrack={pickTrack}/>\n </Route>\n </Switch>\n </div>\n </div>\n <div><br/></div>\n\n </div>\n </Router>\n </section>\n );\n}",
"afterModel(model) {\n const store = this.get('store');\n const courses = [model.get('id')];\n const course = model.get('id');\n const sessions = model.hasMany('sessions').ids();\n const existingSessionsInStore = store.peekAll('session');\n const existingSessionIds = existingSessionsInStore.mapBy('id');\n const unloadedSessions = sessions.filter(id => !existingSessionIds.includes(id));\n\n //if we have already loaded all of these sessions we can just proceed normally\n if (unloadedSessions.length === 0) {\n return;\n }\n\n return all([\n store.query('session', {filters: {course}, limit: 1000}),\n store.query('offering', {filters: {courses}, limit: 1000}),\n store.query('ilm-session', {filters: {courses}, limit: 1000}),\n //temporarily disabled to fix #3173\n // store.query('objective', {filters: {courses}, limit: 1000}),\n // store.query('objective', {filters: {sessions}, limit: 1000}),\n store.query('session-type', {filters: {sessions}, limit: 1000}),\n ]);\n }",
"function TrackModel(CONST) {\n\n\t\tvar TrackModel = function(attrs) {\n\n\t\t\tangular.extend(this, {\n\n\t\t\t\t// backend properties (set by the server)\n\t\t\t\t_id\t\t\t: null,\t\t// id of the track in the database\n\t\t\t\tuserId\t\t: null, \t// id of the user\n\n\t\t\t\t// youtube tracks don't have this set\n\t\t\t\tduration\t: '',\n\n\t\t\t\trating\t\t: null,\n\t\t\t\tghost\t\t: false, \n\n\t\t\t\t// required backend attributes\n\t\t\t\tsrc \t\t: null,\n\t\t\t\tsrcId\t\t: null,\n\t\t\t\tname\t\t: null,\n\t\t\t\tgenre\t\t: null,\n\t\t\t\tuploader\t: null,\n\t\t\t\tsrc_url \t: null,\n\t\t\t\tstream_url\t: null,\n\t\t\t\timg_url\t\t: null,\n\t\t\t\tnote\t\t: '',\n\n\t\t\t\t// ui-attributes: front end only\n\t\t\t\tui : {\n\t\t\t\t\timportStatus : 'none',\t// 'success', 'failed', or 'none'\n\t\t\t\t\tisSelected\t : false,\n\t\t\t\t\tactive\t\t : false\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// apply incoming attrs to properties, then apply all to this track\n\t\t\tangular.extend(this, attrs);\n\t\t}\n\n\t\tTrackModel.prototype.getId = function() {\n\t\t\treturn this._id; \n\t\t}\n\n\t\tTrackModel.prototype.getSrcUrl = function() {\n\t\t\tif (this.src === CONST.ORIGIN.YT) {\n\t\t\t\treturn \"https://www.youtube.com/watch?v=\" + this.srcId;\n\t\t\t}\n\t\t\tif (this.src === CONST.ORIGIN.SC) {\n\t\t\t\treturn this.src_url;\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t* Bad! set this as an attribute in TrackFactory\n\t\t*/\n\t\tTrackModel.prototype.getSrcIconUrl = function() {\n\t\t\tif (this.src === CONST.ORIGIN.YT) {\n\t\t\t\treturn \"/assets/images/icons/youtube-player-icon-24px.png\";\n\t\t\t}\n\t\t\tif (this.src === CONST.ORIGIN.SC) {\n\t\t\t\treturn \"/assets/images/icons/soundcloud-icon-24px.png\";\n\t\t\t}\n\t\t}\n\n\t\tTrackModel.prototype.setImportStatus = function(status) {\n\t\t\tthis.ui.importStatus = status;\n\t\t}\n\n\t\tTrackModel.prototype.getImportStatus = function() {\n\t\t\treturn this.ui.importStatus;\n\t\t}\n\n\t\treturn TrackModel;\n\n\t}",
"async load(model) {\n setGlobal({ model });\n await model.load();\n }",
"function load_model(index){\n if(index >= self.models.length){\n loaded.resolve();\n }else{\n var model = self.models[index];\n self.pos_widget.loading_message(_t('Loading')+' '+(model.label || model.model || ''), progress);\n var fields = typeof model.fields === 'function' ? model.fields(self,tmp) : model.fields;\n var domain = typeof model.domain === 'function' ? model.domain(self,tmp) : model.domain;\n var context = typeof model.context === 'function' ? model.context(self,tmp) : model.context;\n var ids = typeof model.ids === 'function' ? model.ids(self,tmp) : model.ids;\n progress += progress_step;\n\n if( model.model ){\n if (model.ids) {\n var records = new instance.web.Model(model.model).call('read',[ids,fields],context);\n } else {\n var records = new instance.web.Model(model.model).query(fields).filter(domain).context(context).all()\n }\n records.then(function(result){\n try{ // catching exceptions in model.loaded(...)\n\n result_filtered = []\n if(model.model == \"product.product\")\n {\n for(var i = 0; i < result.length; i++)\n {\n //Filtrando los productos que tengan stock >0, que no tengan una compañia\n //o que tengan una compañia asignada y coincida con la que tiene configurada el\n //punto de venta\n if(result[i].stock_qty > 0 && (result[i].company_id == false || (result[i].company_id != false && result[i].company_id[0] == self.config.company_id[0])))\n {\n result_filtered.push(result[i]);\n }\n }\n result = result_filtered;\n }\n\n $.when(model.loaded(self,result,tmp))\n .then(function(){ load_model(index + 1); },\n function(err){ loaded.reject(err); });\n }catch(err){\n loaded.reject(err);\n }\n },function(err){\n loaded.reject(err);\n });\n }else if( model.loaded ){\n try{ // catching exceptions in model.loaded(...)\n $.when(model.loaded(self,tmp))\n .then( function(){ load_model(index +1); },\n function(err){ loaded.reject(err); });\n }catch(err){\n loaded.reject(err);\n }\n }else{\n load_model(index + 1);\n }\n }\n }",
"onSave() {\n log('saved');\n // Resolve the promise\n this.fulfillPromise('resolve', {model: this.view.model});\n\n // Destroy the view\n this.view.destroy();\n }",
"save () { this.store.saveSync() }",
"handleBeforeUnload() {\n StoryStore.saveSession()\n UpdatesStore.saveSession()\n }",
"function newModel() {\r\n\tclearModel();\r\n}",
"beforeModel() {\n \tthis._super(...arguments);\n this.replaceWith('trip');\n }",
"componentWillMount() {\n let modelId = this.props.params.model;\n if (modelId.indexOf(MODEL_URL) != 0)\n return;\n \n modelId = modelId.slice(MODEL_URL.length);\n \n const {setCurrentModel} = this.props.modelsActions;\n const {models} = this.props;\n \n let model = models.currentModel;\n if (!model || modelId != model.nameId) {\n const newModel = getModelByNameId(modelId);\n if (newModel)\n setCurrentModel(newModel);\n }\n }",
"model() {\n\t\tlet temp = [];\n\t\t\n\t\ttemp.addObject(this.get('store').createRecord('symptom', {\n\t\t\tname: 'Pain',\n\t\t\ttype: 2\n\t\t}));\n\t\t\n\t\ttemp.addObject(this.get('store').createRecord('symptom', {\n\t\t\tname: 'Dizziness',\n\t\t\ttype: 2\n\t\t}));\n\n\t\ttemp.addObject(this.get('store').createRecord('symptom', {\n\t\t\tname: 'Nausea',\n\t\t\ttype: 2\n\t\t}));\n\n\t\ttemp.addObject(this.get('store').createRecord('symptom', {\n\t\t\tname: 'Vomiting',\n\t\t\ttype: 1\n\t\t}));\n\n\t\ttemp.addObject(this.get('store').createRecord('symptom', {\n\t\t\tname: 'Loss of Appetite',\n\t\t\ttype: 1\n\t\t}));\n\n\t\ttemp.addObject(this.get('store').createRecord('symptom', {\n\t\t\tname: 'Hours of Sleep',\n\t\t\ttype: 3\n\t\t}));\n\n\t\ttemp.addObject(this.get('store').createRecord('symptom', {\n\t\t\tname: 'Muscle Cramps',\n\t\t\ttype: 1 //Florencio wanted something like a sliding scale after wards but\n\t\t}));\n\n\t\ttemp.addObject(this.get('store').createRecord('symptom', {\n\t\t\tname: 'Swollen Feet or Ankles',\n\t\t\ttype: 1\n\t\t}));\n\n\t\ttemp.addObject(this.get('store').createRecord('symptom', {\n\t\t\tname: 'Persisting Itching',\n\t\t\ttype: 1\n\t\t}));\n\n\t\ttemp.addObject(this.get('store').createRecord('symptom', {\n\t\t\tname: 'Chest Pain',\n\t\t\ttype: 1\n\t\t}));\n\n\t\ttemp.addObject(this.get('store').createRecord('symptom', {\n\t\t\tname: 'Shortness of Breath',\n\t\t\ttype: 1\n\t\t}));\n\n\t\ttemp.addObject(this.get('store').createRecord('symptom', {\n\t\t\tname: 'Temperature',\n\t\t\ttype: 3\n\t\t}));\n\n\t\ttemp.addObject(this.get('store').createRecord('symptom', {\n\t\t\tname: 'Pain over Insion region',\n\t\t\ttype: 1\n\t\t}));\n\n\t\ttemp.addObject(this.get('store').createRecord('symptom', {\n\t\t\tname: 'Blood Pressure',\n\t\t\ttype: 3\n\t\t}));\n\t\t\n\t\treturn temp;\n\t}",
"loadForce () {\n // this.instance.sync({force: true})\n return this\n }",
"addTrack(track){\r\n this.tracks.push(track);\r\n \r\n }",
"function TrackService($log, $http, $q, userService, TrackModel) {\n\n\t\tvar TrackService = {};\n\t\tvar log = $log.getInstance('TrackService');\n\n\t\tvar API_TRACK_URL \t\t= '/api/track/',\n\t\t\tAPI_TRACKS_URL \t\t= '/api/tracks/',\n\t\t\tAPI_TAGS_URL\t\t= '/api/tags/';\n\n\t\t// POSTs the given TrackModel to the server\n\t\tTrackService.save = function(trackModel) {\n\t\t\tif (!trackModel) {\n\t\t\t\tlog.warn('save failed, trackModel=' + typeof trackModel);\n\t\t\t\treturn $q.reject('no data to save');\n\t\t\t}\n\n\t\t\tvar postData = extendWithUserData(trackModel);\n\t\t\tvar postUrl = API_TRACK_URL + userService.getCurrentUser().getUserId();\n\n\t\t\treturn $http.post(postUrl, postData)\n\t\t\t\t.then(function(response) {\t// response: data, status, headers, config\n\t\t\t\t\tlog.debug('saved track: ' + trackModel);\n\t\t\t\t\treturn new TrackModel(response.data);\n\t\t\t\t},\n\t\t\t\tfunction(response){\n\t\t\t\t\tlog.debug('error saving track: ' , response);\n\t\t\t\t\treturn response.data;\n\t\t\t\t});\n\t\t}\n\n\t\t// POSTs all the given TrackModels to the database. Expects an array of TrackModels.\n\t\t// Note: this is a batch operation\n\t\tTrackService.saveAll = function(trackModels) {\n\t\t\tif (!trackModels) {\n\t\t\t\tlog.warn('saveAll failed, trackModels=' + typeof trackModels);\n\t\t\t\treturn $q.reject('no data to save');\n\t\t\t}\n\n\t\t\tvar postData = trackModels.map(extendWithUserData)\n\t\t\tvar postUrl = API_TRACKS_URL + userService.getCurrentUser().getUserId();\n\n\t\t\tconsole.log('sending data ' + JSON.stringify(postData, null, 4));\n\n\t\t\treturn $http.post(postUrl, postData)\n\t\t\t\t.then(function(response) {\n\t\t\t\t\tlog.debug('imported ' + response.data.length + ' tracks' );\n\n\t\t\t\t\t// var trackModels = [];\n\t\t\t\t\t// angular.forEach(response.data, function(trackData, idx) {\n\t\t\t\t\t// \ttrackModels.push(new TrackModel(trackData));\n\t\t\t\t\t// })\n\n\t\t\t\t\t// return trackModels;\n\n\t\t\t\t\treturn response.data; // just return JSON for now, TrackModels not needed\n\t\t\t\t},\n\t\t \t\tfunction(response) {\n\t\t\t\t\tlog.error('could not import tracks: ' , response);\n\t\t\t\t\treturn response.data;\n\t\t \t\t});\n\t\t}\n\n\t\t// Get all the tracks of the current user\n\t\tTrackService.getAllTracks = function() {\n\t\t\tvar userId = userService.getCurrentUser().getUserId();\n\t\t\tlog.debug('getting library for user with id ' + userId);\n\n\t\t\treturn $http.get(API_TRACKS_URL).then(function(response) {\n\t\t\t\t\tlog.debug('got libary, tracks: ' + response.data.length);\n\n\t\t\t\t\tvar trackModels = [];\n\t\t\t\t\tangular.forEach(response.data, function(trackData, idx) {\n\t\t\t\t\t\ttrackModels.push(new TrackModel(trackData));\n\t\t\t\t\t})\n\t\t\t\t\treturn trackModels;\n\t\t\t\t},\n\t\t \t\tfunction(response) {\n\t\t\t\t\tlog.error('error getting library for user ' + userId);\n\t\t\t\t\treturn response.data;\n\t\t \t\t});\n\t\t}\n\n\t\tTrackService.update = function(trackModel, params) {\n\t\t\tvar url = API_TRACK_URL + trackModel.getId();\n\t\t\tvar data = JSON.stringify(params);\n\n\t\t\tlog.debug('updating track with ', params);\n\n\t\t\treturn $http.post(url, data).then(function(response) {\n\t\t\t\tlog.debug('got updated track: ', response.data);\n\t\t\t\treturn response.data;\n\t\t\t},\n\t \t\tfunction(response) {\n\t\t\t\tlog.error('error updating track', response);\n\t\t\t\treturn false;\n\t \t\t});\n\t\t}\n\n\t\t// Removes all the TrackModels from the database. Expects an array of TrackModels.\n\t\t// Note: unlike saveAll, this is not a batch operation\n\t\tTrackService.deleteAll = function(trackModels) {\n\t\t\tif (!trackModels) {\n\t\t\t\tlog.warn('deleteAll failed, trackModels=' + trackModels);\n\t\t\t\treturn $q.reject('no data to delete');\n\t\t\t}\n\n\t\t\tlog.debug('deleting ' + trackModels.length + ' tracks');\n\n\t\t\tfor (var i=0; i<trackModels.length; i++) {\n\t\t\t\tvar trackId = trackModels[i].getId();\n\n\t\t\t\tif (trackId != null) {\n\t\t\t\t\t$http.get(API_TRACK_URL + trackId)\n\t\t\t\t\t\t.then(function(response) {\n\t\t\t\t\t\t\tlog.debug(response.data);\n\t\t\t\t\t\t},\n\t\t\t\t \t\tfunction(response) {\n\t\t\t\t\t\t\tlog.error('error deleting track ' + trackId);\n\t\t\t\t \t\t});\n\n\t\t\t\t} else {\n\t\t\t\t\tlog.warn('could not delete track ' + trackModels[i].name + ': no _id found');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tTrackService.getTags = function() {\n\t\t\treturn $http.get(API_TAGS_URL).then(function(response) {\n\t\t\t\tlog.debug('got tags: ', response.data);\n\t\t\t\treturn response.data;\n\t\t\t}, function(response) {\n\t\t\t\tlog.error('error getting tags', response);\n\t\t\t});\n\t\t}\n\n\t\t// TODO: would be better as a server-side interceptor\n\t\tfunction extendWithUserData(data) {\n\t\t\tvar id = userService.getCurrentUser().getUserId();\n\t\t\tvar newData = angular.extend(data, { userId : id } );\n\n\t\t\treturn newData;\n\t\t}\n\n\t\treturn TrackService;\n\t}",
"clear() {\n var models = this._models;\n this._models = [];\n\n for (var i = 0; i < models.length; i++) {\n var model = models[i];\n model.unloadRecord();\n }\n\n this._metadata = null;\n }",
"unsyncUpdates(modelName) {\n socket.removeAllListeners(modelName + ':save');\n socket.removeAllListeners(modelName + ':remove');\n }",
"unsyncUpdates(modelName) {\n socket.removeAllListeners(modelName + ':save');\n socket.removeAllListeners(modelName + ':remove');\n }",
"function Model() {\n window.onhashchange = this.selectListItem.bind(this);\n this.currentTrackIndex = -1;\n this.trackList = null;\n\n this.listItemSelected = new Event(this);\n this.uriIncludesTrack = new Event(this);\n this.trackSelected = new Event(this);\n this.trackChanged = new Event(this);\n\n this.selectListItem();\n}",
"function loadTrackData (Id) {\n var Modal = $('#modalEditTrack');\n var oMeta = F.requestAjax('/' + Id + '/meta');\n\n $.when(oMeta)\n .then(function (lo) {\n\n Modal.find('.panel-title').text('Edit Track [' + Id + ']');\n Modal.find('#id').val(lo.id);\n Modal.find('#filename').val(lo.filename);\n Modal.find('#path').val(lo.path);\n Modal.find('#title').val(lo.title);\n Modal.find('#album').val(lo.album);\n Modal.find('#track').val(lo.track);\n Modal.find('#year').val(lo.year);\n\n var elGenres = Modal.find('#track-genre');\n var elTags = Modal.find('#track-tags');\n var listGenres = lo.genre;\n var listTags = lo.tags;\n // console.log('listGenres = [', listGenres, ']');\n\n elGenres.tagsinput('removeAll');\n elGenres.tagsinput({\n maxTags: 5\n , maxChars: 15\n , trimValue: true\n , allowDuplicates: false\n });\n\n elTags.tagsinput('removeAll');\n elTags.tagsinput({\n maxTags: 5\n , maxChars: 15\n , trimValue: true\n , allowDuplicates: false\n });\n\n _.each(listGenres, function (tagGenre) {\n // console.info('tagGenre = ', tagGenre);\n elGenres.tagsinput('add', tagGenre);\n });\n\n _.each(listTags, function (tag) {\n elTags.tagsinput('add', tag);\n });\n\n // Modal.find('#track-tags')\n // .val(lo.tags)\n // .prop({'data-role': 'tagsinput'});\n\n Modal.find('#meta').text( JSON.stringify(lo) );\n });\n }",
"addTrack(albumId, trackData) \n {\n /* Crea un track y lo agrega al album con id albumId.\n El objeto track creado debe tener (al menos):\n - una propiedad name (string),\n - una propiedad duration (number),\n - una propiedad genres (lista de strings)\n */\n const album = this.getAlbumById(albumId);\n if (album!= undefined && !(this.trackExists(trackData.name)) )\n {\n const track = new Track(trackData);\n track.id = this.idManager.getIdCancion();\n album.addTrack(track);\n this.tracks.push(track);\n console.log('Se agregó el track ', track.name);\n this.save('data.json')\n notificador.notificarElementoAgregado(track);\n return track\n }\n else\n {\n notificador.notificarError(ElementAlreadyExistsError)\n console.log(\"No se completó la operación, controle que la canción no haya sido ingresada anteriormente\");\n throw(ElementAlreadyExistsError) \n \n }\n \n }",
"bubbleModelMutation() {\n const keys = this.keys(),\n len = keys.length;\n if (len <= 0) return;\n\n let obj = this;\n keys.forEach((key) => {\n const value = this._data[key];// same to obj._data[key];\n if (!value) return;\n\n const { type, Type } = this.getKeyDefinition(key);\n if (type === 'model') {\n let record = Type.findById(value.getId());\n if (record) {\n // use `$checked` to break circular relational records loop.\n if (record.$checked !== this._store.mutationId) {\n record.$checked = this._store.mutationId;\n const newValue = record.bubbleModelMutation();\n if (newValue) record = newValue;\n }\n }\n if (record !== value) { // record changed(deleted or updated)\n // next lines are equal to but faster than `this.set(key, record)`\n obj = obj.clone();\n obj.writeKeyValue(key, record);\n }\n } else if (type === 'map' || type === 'list') {\n const newValue = value.bubbleModelMutation();\n if (newValue) { // cloned and changed\n // next lines are equal to but faster than `this.set(key, newValue)`\n obj = obj.clone();\n obj.writeKeyValue(key, newValue);\n }\n }\n });\n\n if (obj === this) return null;\n return obj;\n }",
"getTrackList() {\n this.firebaseRef = firebase.database().ref('tracks');\n\n if (this.props.type == 'recent') {\n this.firebaseRef\n .limitToLast(this.state.totalTracks)\n .once('value', (snapshot) => { this.addTracksToList(snapshot) }); \n }\n\n if (this.props.type == 'popular') {\n this.firebaseRef\n .orderByChild(\"likes\")\n .limitToLast(this.state.totalTracks)\n .once('value', (snapshot) => { this.addTracksToList(snapshot) }); \n }\n\n if (this.props.type == 'user') {\n var user = this.props.params.userId.split('-').join(' ');\n\n this.firebaseRef\n .orderByChild(\"user\")\n .equalTo(user)\n .limitToLast(this.state.totalTracks)\n .once('value', (snapshot) => { this.addTracksToList(snapshot) }); \n }\n\n if (this.props.type == 'artist') {\n var artist = this.props.params.artist.split('-').join(' ');\n\n this.firebaseRef\n .orderByChild('artist')\n .equalTo(artist)\n .once('value', (snapshot) => { this.addTracksToList(snapshot) }); \n }\n\n // Get all tracks saved locally\n if (this.props.type == 'saved') {\n this.setState({\n tracks: []\n });\n\n // Lookup all localstorage keys\n for ( var i = 0, len = localStorage.length; i < len; ++i ) {\n var key = localStorage.key(i),\n value = localStorage.getItem(key);\n\n if (value === 'true') {\n // Using the tracks Firebase key stored locally we pull it from\n // Firebase\n var trackRef = this.firebaseRef.child(key);\n\n trackRef.once('value', (snap) => {\n var item = snap.val();\n \n if (typeof item !== 'undefined' && item !== null) {\n item['.key'] = snap.key;\n\n item['localLiked'] = true;\n\n this.setState(function(oldState) {\n return oldState.tracks.push(item);\n });\n }\n });\n }\n }\n }\n }"
]
| [
"0.7294336",
"0.5948411",
"0.566308",
"0.56378025",
"0.551426",
"0.5450242",
"0.5441904",
"0.54346395",
"0.53733796",
"0.53655684",
"0.5345137",
"0.5313684",
"0.5289227",
"0.5282877",
"0.5271635",
"0.5228974",
"0.5216725",
"0.5216628",
"0.521087",
"0.52106005",
"0.5206321",
"0.51977026",
"0.5193684",
"0.5177589",
"0.5177589",
"0.5168758",
"0.51552206",
"0.5121828",
"0.5120658",
"0.5100625"
]
| 0.69560146 | 1 |
build a list of this object from Json object | static createListFromJson(jsonObj)
{
var answer = [];
for (var publicationIndex = 0; publicationIndex < jsonObj.length; publicationIndex++)
{
answer.push(PublicationCard.createFromJson(jsonObj[publicationIndex]));
}
return answer;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static createListFromJson(jsonObj)\n\t{\n\t\tvar answer = [];\n\t\tfor (var projectIndex = 0; projectIndex < jsonObj.length; projectIndex++)\n\t\t{\n\t\t\tanswer.push(ProjectStudent.createFromJson(jsonObj[projectIndex]));\n\t\t}\n\t\treturn answer;\n\t}",
"function createData(json) {\n\tconsole.log(json);\n\tdataList = [];\n\tvar truth = false;\n\tfor (var i = 0; i < json.length; i++) {\n\t\ttype = json[i]['type'];\n\t\ttruth = false;\n\t\tif (type === \"Twitter\") {\n\t\t\tpossibleTweet = new Tweet(json[i]);\n\t\t\tfor (var j=0; j < i; j++){\n\t\t\t\tif(possibleTweet.id === dataList[j].id){\n\t\t\t\t\ttruth = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(truth === false){\n\t\t\t\tdataList.push(possibleTweet);\n\t\t\t}\n\t\t}\n\n\t\tif (type === \"Instagram\") {\n\t\t\tdataList.push(new Gram(json[i]));\n\t\t}\n\t\tif(type === \"Soundcloud\"){\n\t\t\tdataList.push(new Song(json[i]))\n\t\t}\n\t}\n\treturn dataList;\n}",
"static fromJSON(shoppinglists) {\n let result = [];\n\n if (Array.isArray(shoppinglists)) {\n shoppinglists.forEach((sl) => {\n Object.setPrototypeOf(sl, ShoppingListBO.prototype)\n result.push(sl)\n })\n } else {\n\n let sl = shoppinglists\n Object.setPrototypeOf(sl, ShoppingListBO.prototype)\n result.push(sl)\n }\n\n return result;\n }",
"constructor (json) {\n\t\tthis.loadJSON(json);\n\t}",
"addJSONLists() {\n\t\tthis.characterPieces = characterAssetsJsonObject.frames; \n\n\t\tthis.categories = ['none', 'A'];\n\t\tthis.sizes = ['Large_Feminine', 'Medium_Feminine', 'Small_Feminine', 'Large_Masculine', 'Medium_Masculine', 'Small_Masculine'];\n\t\tthis.handed = [\n\t\t\t'none',\n\t\t\t{ hand: 'RightHanded2', category: 'A' },\n\t\t\t{ hand: 'LeftHanded2', category: 'A' }\n\t\t];\n\t}",
"constructor(_json) {\n\t\t//Create timetableDay from JSON\n\t\tthis.usedIds = new Array();\n\t\tthis.subjects = new Array();\n\t\t_json = JSON.parse(_json);\n\t\tif (_json) {\n\t\t\tthis.updateViaJSON(_json);\n\t\t}\n\t}",
"static fromJSON(users) {\n let result = [];\n\n if (Array.isArray(users)) {\n users.forEach((a) => {\n Object.setPrototypeOf(a, UserBO.prototype);\n result.push(a);\n })\n } else {\n // Es handelt sich offenbar um ein singuläres Objekt\n let a = users;\n Object.setPrototypeOf(a, UserBO.prototype);\n result.push(a);\n }\n return result;\n }",
"function treatJsonData(data) {\n data.forEach((stud) => {\n //copy the object prototype as many times as json objects there are\n const student = Object.create(Student);\n //modify the original data according to requirements\n //clean empty space around strings\n let fullName = stud.fullname.trim();\n let house = stud.house.trim();\n //define elements\n student.firstName = getFirstName(fullName);\n student.lastName = getLastName(fullName);\n //if middle name\n student.middleName = getMiddleName(fullName);\n //if nickname\n student.nickName = getNickName(fullName);\n student.image = getImage(fullName);\n student.house = getStudentHouse(house);\n student.prefect = false;\n student.quidditch = false;\n student.inquisitorial = false;\n student.bloodStatus = calculateBloodStatus(student.lastName);\n //push object into empty array\n listOfStudents.push(student);\n });\n return listOfStudents;\n}",
"function convert(jsonResult, Constructor) {\n if (angular.isArray(jsonResult)) {\n // Array: So we need to convert each element and push it into a new array to send back\n var models = [];\n angular.forEach(jsonResult, function (item) {\n models.push(convertItem(item, Constructor));\n });\n return models;\n } else {\n return convertItem(jsonResult, Constructor);\n }\n }",
"storageEventBackToObject(jsonObject){\n let eventObjects = []\n //Need to convert JSON OBJECT to a \n jsonObject.forEach(function(event){\n let eventObject = new Event(event._title, event._eventDate)\n \n console.log(eventObject)\n eventObjects.push(eventObject)\n })\n return eventObjects\n \n }",
"function parseJson(items, listToAppendTo, propertyToDisplay) {\n for (var i = 0; i < items.length; i++) {\n var item = items[i];\n var listElement = document.createElement('li');\n listElement.innerHTML = item[propertyToDisplay];\n listToAppendTo.appendChild(listElement);\n }\n}",
"loadFromJson(data) {\n // TODO: Load this object from the data\n const parsedState = JSON.parse(data);\n parsedState.categories.forEach((category, index) => {\n this.setCategory(category, index);\n });\n parsedState.toDoList.forEach(todo => {\n if (todo.text) {\n this.pushTodo(new Note(todo.text, todo.completed));\n } else if (todo.title) {\n this.pushTodo(new Task(todo.title, todo.categoryIndex, todo.description, todo.completed));\n }\n });\n }",
"static fromJSON(semesters) {\n let result = [];\n\n if (Array.isArray(semesters)) {\n semesters.forEach((s) => {\n Object.setPrototypeOf(s, SemesterBO.prototype);\n result.push(s);\n })\n } else {\n // Es handelt sich offenbar um ein singuläres Objekt\n let s = semesters;\n Object.setPrototypeOf(s, SemesterBO.prototype);\n result.push(s);\n }\n\n return result;\n }",
"function createCards(jsonObj){\n var x = 1\n var jsonCards = jsonObj['cards'];\n for(var i = 0; i < jsonCards.length; i++){\n cards[i] = new Card(jsonCards[i].name, jsonCards[i].value, jsonCards[i].id, jsonCards[i].image);\n console.log(cards[i]);\n }\n}",
"static fromJSON(chatMessages) {\n let result = [];\n\n if (Array.isArray(chatMessages)) {\n chatMessages.forEach((m) => {\n Object.setPrototypeOf(m, ChatMessageBO.prototype);\n result.push(m);\n })\n } else {\n // Es handelt sich offenbar um ein singuläres Objekt\n let m = chatMessages;\n Object.setPrototypeOf(m, ChatMessageBO.prototype);\n result.push(m);\n }\n\n return result;\n }",
"function getUsers(json) { return json.map(function (obj){ return obj.user; } ); }",
"function createNewObject(jsonData) {\n jsonData.forEach(task => {\n const tasks = Object.create(taskPrototype);\n tasks.id = task.id;\n tasks.day = task.day;\n tasks.time = task.time;\n tasks.description = task.desc;\n //push to array\n arrayTasks.push(task);\n });\n // console.log(arrayTasks);\n displayTasks(arrayTasks);\n}",
"static fromJSON(persons) {\n let result = [];\n\n if (Array.isArray(persons)) {\n persons.forEach((n) => {\n Object.setPrototypeOf(n, PersonBO.prototype);\n result.push(n);\n })\n } else {\n let n = persons;\n Object.setPrototypeOf(n, PersonBO.prototype);\n result.push(n);\n }\n\n return result;\n }",
"function createStudentList(jsonData) {\n//console.log(jsonData);\nstudentList = [];\nfor(x=0;x<jsonData.length;x++) {\n\tstudentList.push(jsonData[x]);\t\t\n\t}\nconsole.log(studentList)\n}",
"static fromJSON({id,tarea,completado,creado}){\n const tempTodo = new Todo(tarea);\n tempTodo.id = id;\n tempTodo.completado = completado;\n tempTodo.creado = creado;\n\n return tempTodo; // retornamos la instancia\n }",
"toJSON () {\n return this.list;\n }",
"function sacarUsuarios(json){\n \n for(let usuario of json){ \n var id = usuario.id;\n var email = usuario.email;\n var pass = usuario.password;\n\n var objetoUsers = new constructorUsers(id,email,pass);\n datosUser.push(objetoUsers);\n\n contadorId=usuario.id; //sacar el ultimo valor de ID que esta en el JSON\n }\n return datosUser; \n}",
"function retrieve(jsonArr){\njsonArr = JSON.parse(jsonArr);\n for (j = 0; j < jsonArr.length; j++){\n new listItem(jsonArr[j].name,jsonArr[j].id,jsonArr[j].done).getHtml();\n }\n}",
"function renderJson(json) {\n\t\tlistView.setSections([]);\n\t\tvar data = [];\n\t\tvar sections = [];\n\t\tif (_title === 'Find by Breeder' || _title === 'Find by Owner') {\n\t\t\tfor (var i = 0,\n\t\t\t j = j = json.length; i < j; i++) {\n\t\t\t\tdata.push({\n\t\t\t\t\ttitle : {\n\t\t\t\t\t\ttext : json[i].contact_name + ', ' + json[i].email\n\t\t\t\t\t},\n\t\t\t\t\t// Sets the regular list data properties\n\t\t\t\t\tproperties : {\n\t\t\t\t\t\taccessoryType : Ti.UI.LIST_ACCESSORY_TYPE_NONE\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tfor (var i = 0,\n\t\t\t j = j = json.length; i < j; i++) {\n\t\t\t\tdata.push({\n\t\t\t\t\ttitle : {\n\t\t\t\t\t\ttext : json[i].horse.official_name\n\t\t\t\t\t},\n\t\t\t\t\t// Sets the regular list data properties\n\t\t\t\t\tproperties : {\n\t\t\t\t\t\titemId : json[i].horse.id,\n\t\t\t\t\t\taccessoryType : Ti.UI.LIST_ACCESSORY_TYPE_NONE\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tvar _section = Ti.UI.createListSection({\n\t\t\titems : data\n\t\t});\n\n\t\tsections.push(_section);\n\t\tlistView.setSections(sections);\n\t}",
"loadLists(obj) {\n var listData = [];\n var i;\n console.log(obj)\n for(i = 0; i < obj.length; i++) {\n listData.push({title: obj[i]['name'], activityCount: obj[i]['activity_count'], key: obj[i]['id'].toString()})\n }\n \n this.setState({listData: listData});\n }",
"parse (json) {\n const references = []\n const parsed = [ JSON.parse(json) ]\n function visit (object, index, value) {\n if (typeof value == 'object' && value != null) {\n if (Array.isArray(value)) {\n switch (value[0]) {\n case '_reference':\n references.push({ object, index, path: value[1] })\n break\n case '_undefined':\n object[index] = void 0\n break\n case '_array':\n value.shift()\n default:\n for (let i = 0, I = value.length; i < I; i++) {\n visit(value, i, value[i])\n }\n }\n } else {\n for (const property in value) {\n visit(value, property, value[property])\n }\n }\n }\n }\n visit(parsed, 0, parsed[0])\n for (const { object, index, path } of references) {\n object[index] = get(parsed[0], path)\n }\n return parsed[0]\n }",
"function buildFormFields(json) {\n var formFields = [];\n for (var key in json) {\n var item = json[key];\n switch (item.type) {\n case \"number\":\n var div = document.createElement('div');\n div.setAttribute(\"class\", \"custom-input-field\");\n div.setAttribute(\"id\", key + \"-input-field\");\n var label = buildLabel(key, key);\n var input = buildNumberField(key, item);\n var suffix = buildLabel(key, item.unit);\n div.appendChild(label);\n div.appendChild(input);\n div.appendChild(suffix);\n formFields.push(div);\n break;\n default:\n console.log(\"KEY: \", key, \" not found\");\n }\n }\n return formFields;\n}",
"static fromJson(js) {\n function recursive(jsnode, name, parent) {\n let node = new NodeTree_1.default(name, parent);\n if (jsnode !== null) {\n for (let key in jsnode) {\n node.childs.push(recursive(jsnode[key], key, node));\n }\n }\n return node;\n }\n let tree = new Tree();\n if (js !== null && Object.keys(js).length != 0) {\n let rootName = Object.keys(js)[0];\n tree.root = recursive(js[rootName], rootName, null);\n }\n return tree;\n }",
"function buildList(json) {\n var html = '<table><thead>' + buildHeader(json[0]) + '</thead><tbody>';\n\n for (var i = 0; i < json.length; i++) {\n html += buildRow(json[i], null, (i % 2 == 1));\n }\n html += '</tbody></table>';\n\n return html;\n}",
"function list () {\n return _.cloneDeep(data);\n}"
]
| [
"0.6511763",
"0.6003714",
"0.5967254",
"0.5797491",
"0.5694719",
"0.56515944",
"0.5651211",
"0.5574462",
"0.55693215",
"0.55429196",
"0.55225444",
"0.5520386",
"0.55173886",
"0.54675996",
"0.545905",
"0.544704",
"0.5379877",
"0.5379143",
"0.53785515",
"0.537014",
"0.53679097",
"0.53634995",
"0.53594124",
"0.5356047",
"0.5342227",
"0.5342156",
"0.53413916",
"0.5296446",
"0.52948993",
"0.528939"
]
| 0.6721883 | 0 |
sort according to some property list of this object | static sortByProperty(ObjList, property)
{
return ObjList.sort(function(a, b)
{
var x = a[property + ""];
var y = b[property + ""];
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sortByProperty(property){ \n return function(a,b){ \n if(a[property] < b[property]) \n return 1; \n else if(a[property] > b[property]) \n return -1; \n \n return 0; \n } \n }",
"function sortByProperty(property){ \n return function(a,b){ \n if(a[property] < b[property]) \n return 1; \n else if(a[property] > b[property]) \n return -1; \n \n return 0; \n } \n }",
"function sortByProperty(property){ \n return function(a,b){ \n if(a[property] < b[property]) \n return 1; \n else if(a[property] > b[property]) \n return -1; \n \n return 0; \n } \n }",
"function SortByProperty(a,b)\n\t{\n\t\treturn a[sortType] - b[sortType];\n\t}",
"function sortByProperty(property){ \n return function(a,b){ \n if(a[property] > b[property]) \n return 1; \n else if(a[property] < b[property]) \n return -1; \n \n return 0; \n } \n}",
"function sort(property) {\n let sortedCommercial = Object.create(commercial);\n sortedCommercial = sortedCommercial.sort((a, b) => {\n return a[property].localeCompare(b[property]);\n });\n setCommercial(sortedCommercial);\n }",
"function sortBy(prop){\r\n return function(a,b){\r\n if( a[prop] > b[prop]){\r\n return 1;\r\n }else if( a[prop] < b[prop] ){\r\n return -1;\r\n }\r\n return 0;\r\n }\r\n}",
"function dynamicSort(property) {\n\n var sortOrder = -1;\n\n return function (a,b) {\n // if first of properties to sort is undefined, push it to the end\n if (!a[property]) {\n return 1;\n // if second of properties to sort is undefined, push it to the end\n } else if (!b[property]) {\n return -1; \n } else { \n // compare the selected property of each person\n if (sortOrder == -1) {\n return b[property].localeCompare(a[property]);\n } else {\n return a[property].localeCompare(b[property]);\n } \n }\n }\n}",
"function sortByProp(prop) {\n return (a, b) => {\n if (a[prop] > b[prop]) {\n return 1;\n }\n if (a[prop] < b[prop]) {\n return -1;\n }\n return 0;\n };\n}",
"_dynamicSort(property) {\n let sortOrder = 1;\n\n if (property[0] === \"-\") {\n sortOrder = -1;\n property = property.substr(1);\n }\n return function (a,b) {\n let result = (a['attributes'][property] < b['attributes'][property]) ? -1 :\n (a['attributes'][property] > b['attributes'][property]) ? 1 : 0;\n return result * sortOrder;\n };\n }",
"function dynamicSort(property) {\n var sortOrder = 1;\n if (property[0] === \"-\") {\n sortOrder = -1;\n property = property.substr(1);\n }\n return function (a, b) {\n var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;\n return result * sortOrder;\n }\n }",
"function dynamicSort(property) {\n var sortOrder = 1;\n if (property[0] === \"-\") {\n sortOrder = -1;\n property = property.substr(1);\n }\n return function(a, b) {\n var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;\n return result * sortOrder;\n }\n }",
"function dynamicSort(property) {\r\n var sortOrder = 1;\r\n if (property[0] === \"-\") {\r\n sortOrder = -1;\r\n property = property.substr(1);\r\n }\r\n return function (a, b) {\r\n var result = (a[property] > b[property]) ? -1 : (a[property] < b[property]) ? 1 : 0;\r\n return result * sortOrder;\r\n }\r\n}",
"function dynamicSort(property) {\n var sortOrder = 1;\n if(property[0] === \"-\") {\n sortOrder = -1;\n property = property.substr(1);\n }\n return function (a,b) {\n var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;\n return result * sortOrder;\n }\n}",
"function dynamicSort(property) {\n var sortOrder = 1;\n if (property[0] === \"-\") {\n sortOrder = -1;\n property = property.substr(1);\n }\n return function (a, b) {\n var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;\n return result * sortOrder;\n }\n}",
"function dynamicSort(property) {\n var sortOrder = 1;\n if(property[0] === \"-\") {\n sortOrder = -1;\n property = property.substr(1);\n }\n return function (a,b) {\n var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;\n return result * sortOrder;\n }\n}",
"function dynamicSort(property) {\r\n var sortOrder = 1;\r\n if (property[0] === \"-\") {\r\n sortOrder = -1;\r\n property = property.substr(1);\r\n }\r\n\r\n return function(a, b) {\r\n if (sortOrder == -1) {\r\n return b[property].localeCompare(a[property]);\r\n } else {\r\n return a[property].localeCompare(b[property]);\r\n }\r\n }\r\n}",
"function dynamicSort( property ) {\n var sortOrder = 1;\n if ( property[ 0 ] === \"-\" ) {\n sortOrder = -1;\n property = property.substr( 1 );\n }\n return function ( a, b ) {\n var result = ( a[ property ] < b[ property ] ) ? -1 : ( a[ property ] > b[ property ] ) ? 1 : 0;\n return result * sortOrder;\n };\n }",
"function dynamicSort(property) {\n var sortOrder = 1;\n if(property[0] === \"-\") {\n sortOrder = -1;\n property = property.substr(1);\n }\n return function (a,b) {\n var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;\n return result * sortOrder;\n };\n}",
"function dynamicSort(property) {\n var sortOrder = 1;\n if (property[0] === \"-\") {\n sortOrder = -1;\n property = property.substr(1);\n }\n return function(a, b) {\n var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;\n return result * sortOrder;\n };\n}",
"function dynamicSort(property) {\n\t var sortOrder = 1;\n\t if(property[0] === \"-\") {\n\t sortOrder = -1;\n\t property = property.substr(1);\n\t }\n\t return function (a,b) {\n\t var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;\n\t return result * sortOrder;\n\t }\n\t}",
"function sortByProperty({\n array,\n propertyForSort,\n descending = false,\n withParse = true,\n}) {\n array.sort((item1, item2) => {\n let value1;\n let value2;\n if (withParse) {\n value1 = parseFloat(item1[propertyForSort]);\n value2 = parseFloat(item2[propertyForSort]);\n } else {\n value1 = item1[propertyForSort];\n value2 = item2[propertyForSort];\n }\n\n if (value1 === value2) {\n if (descending) {\n return item1.id - item2.id;\n }\n return item2.id - item1.id;\n }\n\n if (withParse) {\n if (descending) {\n return value2 - value1;\n }\n return value1 - value2;\n }\n if (descending) {\n // convert true into 1 and false into -1\n return 2 * (value2 > value1) - 1;\n }\n // convert true into 1 and false into -1\n return 2 * (value1 > value2) - 1;\n });\n}",
"function dynamicSort(property) {\n var sortOrder = 1;\n if (property[0] === \"-\") {\n sortOrder = -1;\n property = property.substr(1);\n }\n\n return function(a, b) {\n if (sortOrder == -1) {\n return b[property].localeCompare(a[property]);\n } else {\n return a[property].localeCompare(b[property]);\n }\n }\n}",
"function propertySort(itemsKey, sortPropertiesKey) {\n var cp = new _emberMetalComputed.ComputedProperty(function (key) {\n var _this5 = this;\n\n function didChange() {\n this.notifyPropertyChange(key);\n }\n\n var items = itemsKey === '@this' ? this : _emberMetalProperty_get.get(this, itemsKey);\n var sortProperties = _emberMetalProperty_get.get(this, sortPropertiesKey);\n\n if (items === null || typeof items !== 'object') {\n return _emberMetalCore.default.A();\n }\n\n // TODO: Ideally we'd only do this if things have changed\n if (cp._sortPropObservers) {\n cp._sortPropObservers.forEach(function (args) {\n return _emberMetalObserver.removeObserver.apply(null, args);\n });\n }\n\n cp._sortPropObservers = [];\n\n if (!_emberRuntimeUtils.isArray(sortProperties)) {\n return items;\n }\n\n // Normalize properties\n var normalizedSort = sortProperties.map(function (p) {\n var _p$split = p.split(':');\n\n var prop = _p$split[0];\n var direction = _p$split[1];\n\n direction = direction || 'asc';\n\n return [prop, direction];\n });\n\n // TODO: Ideally we'd only do this if things have changed\n // Add observers\n normalizedSort.forEach(function (prop) {\n var args = [_this5, itemsKey + '.@each.' + prop[0], didChange];\n cp._sortPropObservers.push(args);\n _emberMetalObserver.addObserver.apply(null, args);\n });\n\n return _emberMetalCore.default.A(items.slice().sort(function (itemA, itemB) {\n for (var i = 0; i < normalizedSort.length; ++i) {\n var _normalizedSort$i = normalizedSort[i];\n var prop = _normalizedSort$i[0];\n var direction = _normalizedSort$i[1];\n\n var result = _emberRuntimeCompare.default(_emberMetalProperty_get.get(itemA, prop), _emberMetalProperty_get.get(itemB, prop));\n if (result !== 0) {\n return direction === 'desc' ? -1 * result : result;\n }\n }\n\n return 0;\n }));\n });\n\n return cp.property(itemsKey + '.[]', sortPropertiesKey + '.[]').readOnly();\n }",
"function sortProperties(obj){\n // convert object into array\n\tvar sortable=[];\n\tfor(var key in obj)\n\t\tif(obj.hasOwnProperty(key))\n\t\t\tsortable.push([key, obj[key]]); // each item is an array in format [key, value]\n\t\n\t// sort items by value\n\tsortable.sort(function(a, b)\n\t{\n\t return a[1]-b[1]; // compare numbers\n\t});\n\treturn sortable; // array in format [ [ key1, val1 ], [ key2, val2 ], ... ]\n}",
"function sortByProperty(array, property) {\n array.sort((a, b) => {\n if (a[property] < b[property]) {\n return -1;\n }\n if (a[property] > b[property]) {\n return 1;\n }\n return 0;\n });\n}",
"sort (sort = {}) {\n let obj = Helpers.is(sort, 'Object') ? sort : { default: sort };\n Object.keys(obj).forEach((key, idx) => {\n Array.prototype.sort.call(this, (a, b) => {\n let vals = (Helpers.is(a.value, 'Object') && Helpers.is(b.value, 'Object')) ? Helpers.dotNotation(key, [a.value, b.value]) : [a, b];\n return (vals[0] < vals[1]) ? -1 : ((vals[0] > vals[1]) ? 1 : 0);\n })[obj[key] === -1 ? 'reverse' : 'valueOf']().forEach((val, idx2) => {\n return this[idx2] = val;\n });\n });\n return this;\n }",
"function sortProperties(obj)\n{\n // convert object into array\n\tvar sortable=[];\n\tfor(var key in obj)\n\t\tif(obj.hasOwnProperty(key))\n\t\t\tsortable.push([key, obj[key]]); // each item is an array in format [key, value]\n\t\n\t// sort items by value\n\tsortable.sort(function(a, b)\n\t{\n\t return a[1]['sum']>b[1]['sum'] ? -1 : a[1]['sum']<b[1]['sum'] ? 1 : a[1]['last_time']>b[1]['last_time'] ? -1 : a[1]['last_time']<b[1]['last_time'] ? 1 : 0;\n\t});\n\treturn sortable; // array in format [ [ key1, val1 ], [ key2, val2 ], ... ]\n}",
"sort () {\r\n this._data.sort((a, b) => a.sortOrder !== b.sortOrder ? b.sortOrder - a.sortOrder : a.value.localeCompare(b.value))\r\n }",
"function jsSort(list, byProperty) {\n\n // using q and z just to show there's nothing magical about a and b. \n // q and z are just elements in the array and the funcction has to return negative or positive or zero \n // depending on the comparison of q and z.\n // using JS associative array notation (property name char string used inside square brackets \n // as it if was an index value). \n\n list.sort(function (q, z) { // in line (and anonymous) def'n of fn to compare list elements. \n // the function you create is supposed to return positive (if first bigger), 0 if equal, negative otherwise.\n\n // using JS associative array notation, extract the 'byProperty' property from the two\n // list elements so you can compare them.\n var qVal = q[byProperty];\n var zVal = z[byProperty];\n\n var c = 0;\n if (qVal > zVal) {\n c = 1;\n } else if (qVal < zVal) {\n c = -1;\n }\n console.log(\"comparing \" + qVal + \" to \" + zVal + \" is \" + c);\n return c;\n });\n}"
]
| [
"0.73198926",
"0.7296321",
"0.7296321",
"0.72160774",
"0.7187887",
"0.71842307",
"0.7149367",
"0.7125927",
"0.70316625",
"0.69431007",
"0.68770385",
"0.68661344",
"0.6842619",
"0.683528",
"0.6831407",
"0.6830048",
"0.6805293",
"0.6801186",
"0.6793107",
"0.67834175",
"0.6781196",
"0.67732024",
"0.67619777",
"0.6737258",
"0.66989744",
"0.66691124",
"0.66138303",
"0.65936387",
"0.6559909",
"0.6555895"
]
| 0.7727587 | 0 |
filter the list according to some property and value | static filterList(objList, property, filterValue)
{
var answer = [];
for (var objIndex = 0; objIndex < objList.length; objIndex++)
{
if (objList[objIndex][property + ""] == filterValue)
{
answer.push(objList[objIndex]);
}
}
return answer;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"filter(predicate = this._compare) {\n return this._list.getValue().filter((_) => predicate(_));\n }",
"function where(list, properties, k) {\n var names = []\n return reduce(list, function(list, v, k) {\n var names = true\n for (var k in properties) {\n if (properties[k] !== v[k]) {\n names = false\n }\n }\n if (names == true) {\n list.push(v)\n }\n return list\n }, names)\n}",
"function filter(list, predicateFn) {\n\n}",
"function handmadeFilter(list,f) {\n var result = [];\n for (var i in list) {\n if (f(list[i])) { result.push(list[i]) };\n }\n return result;\n}",
"function filterItems(by, value, items){\n\tif(!value || value == ''){\n\t\treturn items;\n\t}\n\t\n\tvar debug = '';\n\tvar filteredItems = [];\n\t$.each(items, function(key, item) {\n\t\tif(by == 'shelf'){\n\t\t\tif(String(value) == String(item.shelf)){\n\t\t\t\tdebug += item.title + \"\\n\";\n\t\t\t\tfilteredItems.push(item);\n\t\t\t}\n\t\t\t\n\t\t} else if(by == 'search'){\n\t\t\tif(\t(String(item.title).toLowerCase().indexOf(String(value).toLowerCase()) >= 0) || \n\t\t\t\t(String(item.creator).toLowerCase().indexOf(String(value).toLowerCase()) >= 0)\n\t\t\t\t){\n\t\t\t\tdebug += item.title + \"\\n\";\n\t\t\t\tfilteredItems.push(item);\n\t\t\t}\n\t\t}\n\t});\n\t\n\t//alert(debug);\n\treturn filteredItems;\n}",
"function where(list, properties) {\n // so for the test below we need a function that operates on a list and returns all of\n // the properties. There are three so loops/conditionals are needed. maybe if I use\n // if if else if else and make if the last property called I can get multiple passes?\n}",
"function filterItems(items, value) {\n var result = [];\n for(var id in items){\n if(items[id].hasOwnProperty(\"completed\") && \n items[id].completed === value){\n result.push(items[id]);\n }\n }\n return result;\n }",
"function filterObject(filter, type, data) { \n filter = _.filter(filter, function(item) {\n return (item !== false) ? item : false;\n }); \n if (filter.length < 1) { return data }\n return _.filter(data, function(item) {\n var boo = false;\n for(var i in filter) { \n if(_.contains(item[type], filter[i])) {\n boo = true;\n } else {\n boo = false;\n break; \n } \n }\n return (boo === true) ? item : false; \n }); \n }",
"_filter(value) {\n //convert text to lower case\n const filterValue = value.toLowerCase();\n //get matching products\n return this.products.filter(option => option.toLowerCase().includes(filterValue));\n }",
"singleFilterCollection(collection, filterBy) {\n let filteredCollection = [];\n if (filterBy) {\n const objectProperty = filterBy.property;\n const operator = filterBy.operator || OperatorType.equal;\n // just check for undefined since the filter value could be null, 0, '', false etc\n const value = typeof filterBy.value === 'undefined' ? '' : filterBy.value;\n switch (operator) {\n case OperatorType.equal:\n if (objectProperty) {\n filteredCollection = collection.filter((item) => item[objectProperty] === value);\n }\n else {\n filteredCollection = collection.filter((item) => item === value);\n }\n break;\n case OperatorType.contains:\n if (objectProperty) {\n filteredCollection = collection.filter((item) => item[objectProperty].toString().indexOf(value.toString()) !== -1);\n }\n else {\n filteredCollection = collection.filter((item) => (item !== null && item !== undefined) && item.toString().indexOf(value.toString()) !== -1);\n }\n break;\n case OperatorType.notContains:\n if (objectProperty) {\n filteredCollection = collection.filter((item) => item[objectProperty].toString().indexOf(value.toString()) === -1);\n }\n else {\n filteredCollection = collection.filter((item) => (item !== null && item !== undefined) && item.toString().indexOf(value.toString()) === -1);\n }\n break;\n case OperatorType.notEqual:\n default:\n if (objectProperty) {\n filteredCollection = collection.filter((item) => item[objectProperty] !== value);\n }\n else {\n filteredCollection = collection.filter((item) => item !== value);\n }\n }\n }\n return filteredCollection;\n }",
"function _.filter(list, predicate){ \n var array = [];\n if (list == null){\n return list;\n };\n _.each(list, function(item) { \n if (predicate(item)) {\n array.push(predicate(item));\n }\n })\n return array;\n}",
"function PropertyFilter(name, operator, value){\n if(name == '__key__'){\n this.propertyFilter = {\n property: { name: name },\n operator: operator,\n value: {keyValue: value}\n };\n }else{\n this.propertyFilter = {\n property: { name: name },\n operator: operator,\n value: convert.createValueObject(value)\n };\n }\n\n\n this.getFilterType = function(){\n return 'propertyFilter';\n };\n\n this.getFilter = function(){\n return this.propertyFilter;\n };\n}",
"function myFilter(list, fn) {\n let filtered = [];\n for (let i = 0; i < list.length; i++) {\n if (fn(list[i])) {\n filtered.push(list[i])\n }\n }\n return filtered;\n}",
"filterSelectedFromList(list) {\n const filteredList = list.filter(\n // eslint-disable-next-line no-undef\n checked = true\n );\n return filteredList\n }",
"function find (properties) {\n return _.cloneDeep(_.filter(data, properties));\n}",
"function filter_list_by_dict(list, dict, key)\n{\n var r = filter_list(list, function (elem) {\n var value = elem[key];\n return (dict[value] !== undefined);\n });\n return r;\n}",
"function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n }",
"function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n }",
"function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n }",
"function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n }",
"function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n }",
"function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n }",
"function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n }",
"function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n }",
"function filter(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n }",
"function filterValues(data) \r\n{\r\n data = data.filter(isEligible);\r\n return data;\r\n}",
"@computed get filteredTodos() {\r\n var matchesFilter = new RegExp(this.filter, \"i\");\r\n //\"i\" means ignore groß und kleinschreibung\r\n return this.todos.filter(\r\n todo => !this.filter || matchesFilter.test(todo.value)\r\n );\r\n // test will test the RegExp, so this.props.store.filter will automtaticly return\r\n // the filtered Value, on the CLient Side\r\n }",
"function filterItem(value) {\n if (value == \"\") {\n // console.log(\"default\")\n setDefaultList();\n } // when nothing has typed\n let filteredItems = Object.assign([], taskTemporaly).filter(\n item => item.nameTaskAdd.toLowerCase().indexOf(value.toLowerCase()) > -1\n )\n setNewList(filteredItems);\n\n}",
"function filter(field, value)\n {\n \n }",
"function filter_by(data, parameter) {\n //Make sure parameter is not empty\n if (eval(parameter) != 0 & eval(parameter) != null) {\n var data = $.grep(data, function (e) {\n return e[parameter] === eval(parameter)\n });\n\n }\n return data;\n }"
]
| [
"0.69004273",
"0.6489177",
"0.63892597",
"0.633543",
"0.6235546",
"0.621389",
"0.610121",
"0.6040775",
"0.60404855",
"0.6020834",
"0.5991925",
"0.59573346",
"0.5935419",
"0.5934845",
"0.5932653",
"0.5930276",
"0.5890107",
"0.5890107",
"0.5890107",
"0.5890107",
"0.5890107",
"0.5890107",
"0.5890107",
"0.5890107",
"0.5890107",
"0.58834994",
"0.5862186",
"0.58596367",
"0.5852908",
"0.58290684"
]
| 0.7527607 | 0 |
split list into list of lists according to some property | static splitByProperty(ObjList, property)
{
var answer = {};
var spliter = ObjList[0][property + ""];
var subGroup = [ObjList[0]];
for (var publicationIndex = 1; publicationIndex < ObjList.length; publicationIndex++)
{
if (ObjList[publicationIndex][property + ""] != spliter)
{
answer[spliter] = [...subGroup];
spliter = ObjList[publicationIndex][property + ""];
subGroup = [ObjList[publicationIndex]];
}
else
{
subGroup.push(ObjList[publicationIndex]);
}
}
answer[spliter] = [...subGroup];
return answer;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function groupBy2(xs, prop) {\n var grouped = {};\n for (var i=0; i<xs.length; i++) {\n var p = xs[i][prop];\n if (!grouped[p]) { grouped[p] = []; }\n grouped[p].push(xs[i]);\n }\n return grouped;\n}",
"function groupItems(list) {\n return list.reduce(function (groupedList, element) {\n var key = element.group.toLowerCase();\n if (!groupedList[key]) {\n groupedList[key] = [];\n }\n if (element.nameOrder == \"reverse\") {\n groupedList[key].push({name: element.last + \" \" + element.first});\n } else {\n groupedList[key].push({name: element.first + \" \" + element.last});\n }\n return groupedList;\n }, {});\n}",
"function groupBy(data_array, property) {\r\n return data_array.reduce(function (accumulator, current_object) {\r\n let key = current_object[property];\r\n if (!accumulator[key]) {\r\n accumulator[key] = [];\r\n }\r\n accumulator[key].push(current_object);\r\n return accumulator;\r\n }, {});\r\n }",
"function splitHands(l) {\n return l.reduce(function(result, value, index) {\n if (index % 2 === 0)\n result.push(l.slice(index, index + 2));\n return result;\n }, []);\n}",
"function groupBy(arr, prop) {\n\treturn arr.reduce((a, v) => {\n\t\tconst key = v[prop];\n\t\tif (!a[key]) a[key] = [];\n\t\ta[key].push(v);\n\t\treturn a;\n\t}, {});\n}",
"function groupPersons(persons, prop) {\n var groupedPersons = {},\n i;\n for (i = 0; i < persons.length; i++) {\n if (groupedPersons[persons[i][prop]]) {\n groupedPersons[persons[i][prop]].push(persons[i]);\n } else {\n groupedPersons[persons[i][prop]] = new Array(persons[i]);\n }\n }\n return groupedPersons;\n}",
"function groupBy2(arr, prop) {\n\t// Create a holder object\n\tconst a = {};\n\t// Map over the array\n\tarr.map(v => {\n\t\t// Create a key equal to the current object's 'prop' property value\n\t\tconst key = v[prop];\n\t\t// Unless there's already a property in 'a' by the name of 'key', create it and set it equal to an empty array.\n\t\tif(!a[key]) a[key] = [];\n\t\t// Push the current object into the array\n\t\ta[key].push(v);\n\t});\n\t// return the holder object\n\treturn a;\n}",
"function split(parsed){\n\tvar ret = [];\n\tvar chunk = [];\n\tfor(var i=0; i<parsed.length; i++){\n\n\t\tvar item = parsed[i];\n\t\tvar flags = item.flags;\n\t\t\n\t\tfor(var f=0; f<flags.length; f++){\n\t\t\tvar flagList = flags[f];\n\t\t\tif(spliton.indexOf(flagList.flag) > -1){\n\t\t\t\tif(chunk.length){\n\t\t\t\t\t//ret.push(chunk.slice());\n\t\t\t\t\tret.push(chunk);\n\t\t\t\t\tchunk = [];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tchunk.push(item);\n\t\t\n\t}\n\n\t//ret.push(chunk.slice());\n\tret.push(chunk);\n\n\treturn ret;\n}",
"list(filterFn = this._list_filter) {\n const list = this.get('list') || [];\n return list.reduce((a, i) => {\n if (filterFn(i)) {\n a.push(i);\n }\n return a;\n }, []);\n }",
"function partition(collection,fn){var result={lhs:[],rhs:[]};_.forEach(collection,function(value){if(fn(value)){result.lhs.push(value)}else{result.rhs.push(value)}});return result}",
"function splitListItem(opts, change) {\n var value = change.value;\n\n var currentItem = (0, _utils.getCurrentItem)(opts, value);\n if (!currentItem) {\n return change;\n }\n\n var splitOffset = value.startOffset;\n\n return change.splitDescendantsByKey(currentItem.key, value.startKey, splitOffset);\n}",
"static GroupBy(list, keyGetter) {\n const map = new Map();\n list.forEach((item) => {\n const key = keyGetter(item);\n const collection = map.get(key);\n if (!collection) {\n map.set(key, [item]);\n }\n else {\n collection.push(item);\n }\n });\n return map;\n }",
"function groupBy(list, key) {\n throw 'not implemented';\n}",
"function splitArray(arr,count){var newArray=[];arr=arr.map(function(el,index){el.position=index+1;return el;});while(arr.length>0){newArray.push(arr.splice(0,count));}return newArray;}",
"groupBy(list, keyGetter) {\n const map = new Map();\n list.forEach((item) => {\n const key = keyGetter(item);\n const collection = map.get(key);\n if (!collection) {\n map.set(key, [item]);\n } else {\n collection.push(item);\n }\n });\n return map;\n }",
"function groupBy(objectArray, property) {\r\n return objectArray.reduce((acc, obj) => {\r\n const key = obj[property];\r\n if (!acc[key]) {\r\n acc[key] = [];\r\n }\r\n // Add object to list for given key's value\r\n acc[key].push(obj);\r\n return acc;\r\n }, {});\r\n }",
"function groupBy(objectArray, property) {\r\n return objectArray.reduce((acc, obj) => {\r\n const key = obj[property];\r\n if (!acc[key]) {\r\n acc[key] = [];\r\n }\r\n // Add object to list for given key's value\r\n acc[key].push(obj);\r\n return acc;\r\n }, {});\r\n }",
"function groupBy(objectArray, property) {\r\n return objectArray.reduce((acc, obj) => {\r\n const key = obj[property];\r\n if (!acc[key]) {\r\n acc[key] = [];\r\n }\r\n // Add object to list for given key's value\r\n acc[key].push(obj);\r\n return acc;\r\n }, {});\r\n }",
"function groupBy(objectArray, property) {\r\n return objectArray.reduce((acc, obj) => {\r\n const key = obj[property];\r\n if (!acc[key]) {\r\n acc[key] = [];\r\n }\r\n // Add object to list for given key's value\r\n acc[key].push(obj);\r\n return acc;\r\n }, {});\r\n }",
"function groupBy(objectArray, property) {\r\n return objectArray.reduce((acc, obj) => {\r\n const key = obj[property];\r\n if (!acc[key]) {\r\n acc[key] = [];\r\n }\r\n // Add object to list for given key's value\r\n acc[key].push(obj);\r\n return acc;\r\n }, {});\r\n }",
"function groupBy(objectArray, property) {\r\n return objectArray.reduce((acc, obj) => {\r\n const key = obj[property];\r\n if (!acc[key]) {\r\n acc[key] = [];\r\n }\r\n // Add object to list for given key's value\r\n acc[key].push(obj);\r\n return acc;\r\n }, {});\r\n }",
"function splitOnVal(list, num) {\n let current = list.head,\n newList = new SinglyList(),\n found = false,\n previous;\n if (!current) {\n // list is empty, return null:\n console.log(null);\n return null;\n }\n // loop through list:\n while (current.next) {\n if (current.val === num) {\n // num found, split list:\n newList.head = current;\n // Set previous node's next to null (since node before this is now an end node):\n if (previous) {\n // set previous to null:\n previous.next = null;\n }\n found = true;\n }\n previous = current;\n current = current.next;\n }\n // now we are on last node, check if val:\n if (current.val === num) {\n // split list at last node:\n newList.head = current;\n previous.next = null; // set previous node's next to null:\n found = true;\n }\n\n if (!found) {\n console.log(\"Value does not exist in list.\");\n return null;\n }\n\n // return latter half of list:\n console.log(newList);\n return newList;\n}",
"function split(numList) {\n let midpoint = numList.length / 2\n let splitList = {}\n splitList.left = numList.slice(0,midpoint)\n splitList.right = numList.splice(midpoint, numList.length)\n console.log(\"Splitting: \" + splitList.left + \",\" + splitList.right + \" into \" + splitList.left + \" and \" + splitList.right)\n return splitList\n}",
"function group(people, property) {\n var result = {};\n\n for (person of people) {\n var groupProperty = person[property];\n\n if (!result.hasOwnProperty(groupProperty)) {\n result[groupProperty] = [];\n }\n result[groupProperty].push(person);\n }\n\n return result;\n}",
"static filterList(objList, property, filterValue)\n\t{\n\t\tvar answer = [];\n\t\tfor (var objIndex = 0; objIndex < objList.length; objIndex++)\n\t\t{\n\t\t\tif (objList[objIndex][property + \"\"] == filterValue)\n\t\t\t{\n\t\t\t\tanswer.push(objList[objIndex]);\n\t\t\t}\n\t\t}\n\t\treturn answer;\n\t}",
"function partitionBy(arr, pred) {\n let ret = arr.length ? [[arr[0]]] : [[]];\n let retidx = 0;\n for (let i = 1; i < arr.length; i++) {\n if (pred(arr[i], i, arr)) {\n ret.push([arr[i]]);\n retidx++;\n }\n else {\n ret[retidx].push(arr[i]);\n }\n }\n return ret;\n}",
"function splitArrayByPrayerGroup(array) {\n var _groups = []\n array.forEach(function(element) {\n if (_groups.indexOf(element.prayergroup) == -1) {\n _groups.push(element.prayergroup)\n }\n });\n return _groups;\n }",
"function partition(collection, fn) {\n var result = { lhs: [], rhs: [] };\n _.each(collection, function(value) {\n if (fn(value)) {\n result.lhs.push(value);\n } else {\n result.rhs.push(value);\n }\n });\n return result;\n}",
"function partition(p, xs) {\n return xs.reduce(function (a, x) {\n return (\n a[p(x) ? 0 : 1].push(x),\n a\n );\n }, [[], []]);\n }",
"function splitListItem(opts, editor) {\n const { value } = editor;\n const currentItem = getCurrentItem(opts, value);\n if (!currentItem) {\n return editor;\n }\n\n const splitOffset = value.startOffset;\n\n return editor.splitDescendantsByKey(\n currentItem.key,\n value.start.key,\n splitOffset\n );\n}"
]
| [
"0.5736494",
"0.55942863",
"0.55851495",
"0.5567104",
"0.5532998",
"0.5500809",
"0.5461137",
"0.5460786",
"0.53871804",
"0.5371475",
"0.535328",
"0.5328581",
"0.53005475",
"0.5291793",
"0.5284913",
"0.5275434",
"0.5275434",
"0.5275434",
"0.5275434",
"0.5275434",
"0.5272965",
"0.5188106",
"0.5181905",
"0.5173742",
"0.5130942",
"0.51245165",
"0.5113945",
"0.51025295",
"0.50978273",
"0.5089894"
]
| 0.7096044 | 0 |
This method is used to set a custom terminal function for the push on the last created Flow in the Flow chain | setTerminalFunction(func){
if( Util.isFunction(func) )
this.terminalFunc = func;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"push(input){\n this.next !== null ? this.next.push(input) : this.terminalFunc(input);\n }",
"Push() {\n\n }",
"function Push() {\n console.debug(\"Push()\");\n}",
"static get PUSH_LEFT() { return \"pushLeft\"; }",
"function setTerminal() {\n \"use strict\";\n addInput(SHELLNEW);\n document.getElementById('terminalInputId').focus();\n}",
"push (value) {\n this.stack.push(value)\n\n this.printStack()\n }",
"function Terminal () {}",
"pushToken(token: Token) {\n this.stack.push(token);\n }",
"function setFunctions() {\r\n var commands = [\r\n { command: \"command1\", description: \"description1\" },\r\n { command: \"command2\", description: \"description2\" },\r\n ];\r\n messagePayload.commands = commands;\r\n\r\n console.log(\r\n JSON.stringify(\r\n sendPayload(\"setMyCommands\", messagePayload).getContentText()\r\n )\r\n );\r\n}",
"push(param) {\n this.stack.push(param)\n //document.dispatchEvent(new Event(\"stack-change\"))\n }",
"addToQueue(f, pushFront = false) {\n if (pushFront) {\n this.commandQueue.unshift(f);\n }\n else {\n this.commandQueue.push(f);\n }\n }",
"get type() {\n return \"terminal\"\n }",
"custom(fn) {\r\n\t\treturn this.push('fn', [...arguments]);\r\n\t}",
"function pushOpFunc(func)\n {\n if (typeof func != 'function') {\n throw 'Passed operation is not a function';\n }\n \n opFuncStack.push(func);\n }",
"addCommand(name, func) {\n return this.commands.push({\n name: name,\n func: func\n });\n }",
"get push() { return this._push; }",
"push(AnsiChar) {\n\t\tlet p = new Node(AnsiChar, this.top);\n\t\tthis.top = p;\n\t}",
"function insertXMakeCommandText(func: string) {\n return func + '(${1})'\n}",
"submit(){\n\t\tvar prompt = this.e.prompt.cloneNode(true);\n\t\tvar cmd = this.e.input.value;\n\t\tDB.terminal.history.push(cmd);\n\t\tthis.history = DB.terminal.history.length;\n\t\tprompt.replaceChild(createElement('span', {innerText:prompt.lastChild.value}), prompt.lastChild);\n\t\tprompt.className = 'prompt';\n\t\tthis.e.stdout.appendChild(prompt);\n\t\tthis.e.stdout.scrollTop = this.e.stdout.scrollHeight;\n\n\t\tthis.e.input.value = '';\n\t\tthis.e.input.setAttribute('disabled', '')\n\t\tAPI(\"terminal\", {id:this.id, stdin:cmd, env:this.env}).then(this.exe.bind(this, prompt)) \n\t}",
"push(value) {\n\n// * create a new node from the value\n let newNode = new Node(value);\n\n// * point the next to the current `top`.\n newNode.next = this.top;\n\n// * set `top` of the stack to be our new `node`.\n this.top = newNode;\n }",
"push(type, char){\n if(this.isempty()){\n if(type==1){ //No use of storing backspace operation for empty stack\n return;\n }\n this.stack.push([type,char]);\n this.size++;\n return;\n }\n let top=this.stack[this.size-1];\n if(type==top[0] && top[1].length<this.buffer){\n top=this.stack.pop();\n top=char+top[1]; //sequence is very imp because char+top[1] means most recent character at beginning\n //so if intially we had \"cba\" and push for 'd' is demanded then top will be \"dcba\" ..stack is \"dcba\" for \n //message typed as \"abcd\". this is required for delete operation.\n this.stack.push([type,top]);\n }\n else{\n this.stack.push([type,char]);\n this.size++;\n }\n return this.stack[this.size-1];\n }",
"function push(stack, item) {\n stack.append(item)\n print(item + \" pushed to stack \")\n}",
"addCommand(commandType, callback) {\n this.commands.push({\n type: commandType,\n callback: callback,\n })\n }",
"unshift(_function, _arguments) {\n if (typeof _arguments !== 'undefined') {\n this.commandQueue.unshift([_function, _arguments]);\n }\n else {\n this.commandQueue.unshift(_function);\n }\n }",
"push (behavior/*, ... params */) {\n let action = this.append(behavior)\n let params = toArray(arguments, 1)\n\n coroutine(action, action.behavior.apply(null, params), this)\n\n return action\n }",
"push(_function, _arguments) {\n if (typeof _arguments !== 'undefined') {\n this.commandQueue.push([_function, _arguments]);\n }\n else {\n this.commandQueue.push(_function);\n }\n }",
"function createCommand(socket) {\n return function(payload) {\n self.sendNotification(socket, payload);\n };\n }",
"addCommand(command) {\n this.buffer.push(command)\n }",
"function addOp(chr)\n\t{\n\t\tvar token;\n\t\tvar newToken = new tree.Token(tree.Token.functionType, chr);\n\n//\t\t//trace('addOp');\n//\t\tnewToken.printToken();\n\n\t\twhile (token = stack.pop())\n\t\t{\n//\t\t\ttoken.printToken();\n\n\t\t\t// DG: This is a bit suspect. I removed a redundant clause. Does it really cover all cases?\n\t\t\tif ((token.tokenType === tree.Token.functionType && token.getPrecedence() >= newToken.getPrecedence())\n\t\t\t\t|| token.tokenType === tree.Token.unaryNeg)\n\t\t\t{\n\t\t\t\tpostFixTokens.push(token);\n\t\t\t}\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// Put back the one we didn't need to pop off\n\t\tif (token != undefined)\n\t\t\tstack.push(token);\n\n\t\tstack.push(newToken);\n\n//\t\tParser.printArray();\n\t}",
"function addByPrecedence()\n\t{\n\t\tvar newToken = new tree.Token(tree.Token.functionType, nextChar);\n\n//\t\t//trace('addByPrecedence');\n//\t\tnewToken.printToken();\n\n\t\twhile (tempToken = stack.pop())\n\t\t{\n\t\t\tif (tempToken.getPrecedence() >= newToken.getPrecedence())\n\t\t\t\tpostFixTokens.push(tempToken);\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// Put back the one we didn't need to pop off\n\t\tif (tempToken !== undefined)\n\t\t\tstack.push(tempToken);\n\n\t\tstack.push(newToken);\n\n//\t\tParser.printArray();\n\t}"
]
| [
"0.5894712",
"0.5687585",
"0.55689806",
"0.55226415",
"0.5410262",
"0.53981024",
"0.53510433",
"0.53049326",
"0.52745247",
"0.5273706",
"0.527057",
"0.525383",
"0.5235407",
"0.520267",
"0.5181505",
"0.51257867",
"0.51084137",
"0.50890785",
"0.5045798",
"0.5039319",
"0.5020774",
"0.5018962",
"0.5006827",
"0.49782187",
"0.4974333",
"0.49734646",
"0.49612144",
"0.49371138",
"0.49270514",
"0.4923747"
]
| 0.6085474 | 0 |
This method create a Flow from several data types. Supported data types are: Array, Flow, Map, Set, Object, FileSystem, JAMLogger | static from(data){
return FlowFactory.getFlow(data);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Flow(nodeList, flows, node, type) {\n this.nodeList = nodeList;\n this.flows = flows;\n this.node = node;\n this.type = type;\n}",
"static of(){\n if( arguments.length == 0 )\n return FlowFactory.getFlow([]);\n\n if( arguments.length > 1 )\n return FlowFactory.getFlow(arguments);\n\n if( arguments.length == 1 && Util.isNumber(arguments[0]) )\n return new IteratorFlow(FlowFactory.createIteratorWithEmptyArraysFromNumber(arguments[0]));\n\n return FlowFactory.getFlow(arguments[0]);\n }",
"function example(arg1: number, arg2: MyObject): Array<Object> {\n// ^ variable\n// ^ punctuation.type.flowtype\n// ^ support.type.builtin.primitive.flowtype\n// ^ variable\n// ^ support.type.class.flowtype\n// ^ punctuation.type.flowtype\n// ^ support.type.builtin.class.flowtype\n// ^ punctuation.flowtype\n// ^ support.type.builtin.class.flowtype\n// ^ punctuation.flowtype\n}",
"function astFromValue(value, type) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type)) {\n var astValue = astFromValue(value, type.ofType);\n\n if (astValue && astValue.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].NULL) {\n return null;\n }\n\n return astValue;\n } // only explicit null, not undefined, NaN\n\n\n if (value === null) {\n return {\n kind: _language_kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].NULL\n };\n } // undefined, NaN\n\n\n if (Object(_jsutils_isInvalid__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(value)) {\n return null;\n } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but\n // the value is not an array, convert the value using the list's item type.\n\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type)) {\n var itemType = type.ofType;\n\n if (Object(iterall__WEBPACK_IMPORTED_MODULE_0__[\"isCollection\"])(value)) {\n var valuesNodes = [];\n Object(iterall__WEBPACK_IMPORTED_MODULE_0__[\"forEach\"])(value, function (item) {\n var itemNode = astFromValue(item, itemType);\n\n if (itemNode) {\n valuesNodes.push(itemNode);\n }\n });\n return {\n kind: _language_kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].LIST,\n values: valuesNodes\n };\n }\n\n return astFromValue(value, itemType);\n } // Populate the fields of the input object by creating ASTs from each value\n // in the JavaScript object according to the fields in the input type.\n\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isInputObjectType\"])(type)) {\n if (value === null || _typeof(value) !== 'object') {\n return null;\n }\n\n var fields = Object(_polyfills_objectValues__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(type.getFields());\n var fieldNodes = [];\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var field = _step.value;\n var fieldValue = astFromValue(value[field.name], field.type);\n\n if (fieldValue) {\n fieldNodes.push({\n kind: _language_kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].OBJECT_FIELD,\n name: {\n kind: _language_kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].NAME,\n value: field.name\n },\n value: fieldValue\n });\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return {\n kind: _language_kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].OBJECT,\n fields: fieldNodes\n };\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type)) {\n // Since value is an internally represented value, it must be serialized\n // to an externally represented value before converting into an AST.\n var serialized = type.serialize(value);\n\n if (Object(_jsutils_isNullish__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(serialized)) {\n return null;\n } // Others serialize based on their corresponding JavaScript scalar types.\n\n\n if (typeof serialized === 'boolean') {\n return {\n kind: _language_kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].BOOLEAN,\n value: serialized\n };\n } // JavaScript numbers can be Int or Float values.\n\n\n if (typeof serialized === 'number') {\n var stringNum = String(serialized);\n return integerStringRegExp.test(stringNum) ? {\n kind: _language_kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].INT,\n value: stringNum\n } : {\n kind: _language_kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].FLOAT,\n value: stringNum\n };\n }\n\n if (typeof serialized === 'string') {\n // Enum types use Enum literals.\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isEnumType\"])(type)) {\n return {\n kind: _language_kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].ENUM,\n value: serialized\n };\n } // ID types can use Int literals.\n\n\n if (type === _type_scalars__WEBPACK_IMPORTED_MODULE_7__[\"GraphQLID\"] && integerStringRegExp.test(serialized)) {\n return {\n kind: _language_kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].INT,\n value: serialized\n };\n }\n\n return {\n kind: _language_kinds__WEBPACK_IMPORTED_MODULE_5__[\"Kind\"].STRING,\n value: serialized\n };\n }\n\n throw new TypeError(\"Cannot convert value to AST: \".concat(Object(_jsutils_inspect__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(serialized)));\n } // Not reachable. All possible input types have been considered.\n\n /* istanbul ignore next */\n\n\n throw new Error(\"Unexpected input type: \\\"\".concat(Object(_jsutils_inspect__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(type), \"\\\".\"));\n}",
"function astFromValue(value, type) {\n if ((0, _definition.isNonNullType)(type)) {\n var astValue = astFromValue(value, type.ofType);\n\n if ((astValue === null || astValue === void 0 ? void 0 : astValue.kind) === _kinds.Kind.NULL) {\n return null;\n }\n\n return astValue;\n } // only explicit null, not undefined, NaN\n\n\n if (value === null) {\n return {\n kind: _kinds.Kind.NULL\n };\n } // undefined\n\n\n if (value === undefined) {\n return null;\n } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but\n // the value is not an array, convert the value using the list's item type.\n\n\n if ((0, _definition.isListType)(type)) {\n var itemType = type.ofType;\n\n if ((0, _isCollection[\"default\"])(value)) {\n var valuesNodes = []; // Since we transpile for-of in loose mode it doesn't support iterators\n // and it's required to first convert iteratable into array\n\n for (var _i2 = 0, _arrayFrom2 = (0, _arrayFrom3[\"default\"])(value); _i2 < _arrayFrom2.length; _i2++) {\n var item = _arrayFrom2[_i2];\n var itemNode = astFromValue(item, itemType);\n\n if (itemNode != null) {\n valuesNodes.push(itemNode);\n }\n }\n\n return {\n kind: _kinds.Kind.LIST,\n values: valuesNodes\n };\n }\n\n return astFromValue(value, itemType);\n } // Populate the fields of the input object by creating ASTs from each value\n // in the JavaScript object according to the fields in the input type.\n\n\n if ((0, _definition.isInputObjectType)(type)) {\n if (!(0, _isObjectLike[\"default\"])(value)) {\n return null;\n }\n\n var fieldNodes = [];\n\n for (var _i4 = 0, _objectValues2 = (0, _objectValues3[\"default\"])(type.getFields()); _i4 < _objectValues2.length; _i4++) {\n var field = _objectValues2[_i4];\n var fieldValue = astFromValue(value[field.name], field.type);\n\n if (fieldValue) {\n fieldNodes.push({\n kind: _kinds.Kind.OBJECT_FIELD,\n name: {\n kind: _kinds.Kind.NAME,\n value: field.name\n },\n value: fieldValue\n });\n }\n }\n\n return {\n kind: _kinds.Kind.OBJECT,\n fields: fieldNodes\n };\n } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')\n\n\n if ((0, _definition.isLeafType)(type)) {\n // Since value is an internally represented value, it must be serialized\n // to an externally represented value before converting into an AST.\n var serialized = type.serialize(value);\n\n if (serialized == null) {\n return null;\n } // Others serialize based on their corresponding JavaScript scalar types.\n\n\n if (typeof serialized === 'boolean') {\n return {\n kind: _kinds.Kind.BOOLEAN,\n value: serialized\n };\n } // JavaScript numbers can be Int or Float values.\n\n\n if (typeof serialized === 'number' && (0, _isFinite[\"default\"])(serialized)) {\n var stringNum = String(serialized);\n return integerStringRegExp.test(stringNum) ? {\n kind: _kinds.Kind.INT,\n value: stringNum\n } : {\n kind: _kinds.Kind.FLOAT,\n value: stringNum\n };\n }\n\n if (typeof serialized === 'string') {\n // Enum types use Enum literals.\n if ((0, _definition.isEnumType)(type)) {\n return {\n kind: _kinds.Kind.ENUM,\n value: serialized\n };\n } // ID types can use Int literals.\n\n\n if (type === _scalars.GraphQLID && integerStringRegExp.test(serialized)) {\n return {\n kind: _kinds.Kind.INT,\n value: serialized\n };\n }\n\n return {\n kind: _kinds.Kind.STRING,\n value: serialized\n };\n }\n\n throw new TypeError(\"Cannot convert value to AST: \".concat((0, _inspect[\"default\"])(serialized), \".\"));\n } // istanbul ignore next (Not reachable. All possible input types have been considered)\n\n\n false || (0, _invariant[\"default\"])(0, 'Unexpected input type: ' + (0, _inspect[\"default\"])(type));\n}",
"function astFromValue(value, type) {\n if ((0, _definition.isNonNullType)(type)) {\n var astValue = astFromValue(value, type.ofType);\n\n if ((astValue === null || astValue === void 0 ? void 0 : astValue.kind) === _kinds.Kind.NULL) {\n return null;\n }\n\n return astValue;\n } // only explicit null, not undefined, NaN\n\n\n if (value === null) {\n return {\n kind: _kinds.Kind.NULL\n };\n } // undefined\n\n\n if (value === undefined) {\n return null;\n } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but\n // the value is not an array, convert the value using the list's item type.\n\n\n if ((0, _definition.isListType)(type)) {\n var itemType = type.ofType;\n var items = (0, _safeArrayFrom.default)(value);\n\n if (items != null) {\n var valuesNodes = [];\n\n for (var _i2 = 0; _i2 < items.length; _i2++) {\n var item = items[_i2];\n var itemNode = astFromValue(item, itemType);\n\n if (itemNode != null) {\n valuesNodes.push(itemNode);\n }\n }\n\n return {\n kind: _kinds.Kind.LIST,\n values: valuesNodes\n };\n }\n\n return astFromValue(value, itemType);\n } // Populate the fields of the input object by creating ASTs from each value\n // in the JavaScript object according to the fields in the input type.\n\n\n if ((0, _definition.isInputObjectType)(type)) {\n if (!(0, _isObjectLike.default)(value)) {\n return null;\n }\n\n var fieldNodes = [];\n\n for (var _i4 = 0, _objectValues2 = (0, _objectValues3.default)(type.getFields()); _i4 < _objectValues2.length; _i4++) {\n var field = _objectValues2[_i4];\n var fieldValue = astFromValue(value[field.name], field.type);\n\n if (fieldValue) {\n fieldNodes.push({\n kind: _kinds.Kind.OBJECT_FIELD,\n name: {\n kind: _kinds.Kind.NAME,\n value: field.name\n },\n value: fieldValue\n });\n }\n }\n\n return {\n kind: _kinds.Kind.OBJECT,\n fields: fieldNodes\n };\n } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')\n\n\n if ((0, _definition.isLeafType)(type)) {\n // Since value is an internally represented value, it must be serialized\n // to an externally represented value before converting into an AST.\n var serialized = type.serialize(value);\n\n if (serialized == null) {\n return null;\n } // Others serialize based on their corresponding JavaScript scalar types.\n\n\n if (typeof serialized === 'boolean') {\n return {\n kind: _kinds.Kind.BOOLEAN,\n value: serialized\n };\n } // JavaScript numbers can be Int or Float values.\n\n\n if (typeof serialized === 'number' && (0, _isFinite.default)(serialized)) {\n var stringNum = String(serialized);\n return integerStringRegExp.test(stringNum) ? {\n kind: _kinds.Kind.INT,\n value: stringNum\n } : {\n kind: _kinds.Kind.FLOAT,\n value: stringNum\n };\n }\n\n if (typeof serialized === 'string') {\n // Enum types use Enum literals.\n if ((0, _definition.isEnumType)(type)) {\n return {\n kind: _kinds.Kind.ENUM,\n value: serialized\n };\n } // ID types can use Int literals.\n\n\n if (type === _scalars.GraphQLID && integerStringRegExp.test(serialized)) {\n return {\n kind: _kinds.Kind.INT,\n value: serialized\n };\n }\n\n return {\n kind: _kinds.Kind.STRING,\n value: serialized\n };\n }\n\n throw new TypeError(\"Cannot convert value to AST: \".concat((0, _inspect.default)(serialized), \".\"));\n } // istanbul ignore next (Not reachable. All possible input types have been considered)\n\n\n false || (0, _invariant.default)(0, 'Unexpected input type: ' + (0, _inspect.default)(type));\n}",
"createFlow() {\n // Very simple random unique ID generator\n this.formattedFlow.flowId = `${new Date().getTime()}`;\n this.formattedFlow.flowName = this.originalFlow.flow;\n this.formattedFlow.comment = this.originalFlow.comment;\n this.formattedFlow.startAt = this.originalFlow.startAt;\n this.formattedFlow.states = Object.assign({}, this.originalFlow.states);\n this.formattedFlow.flowStartTime = new Date().getTime();\n this.formattedFlow.flowExecutionTime = '';\n\n return { isError: false, code: this.code, item: this.formattedFlow };\n }",
"function astFromValue(value, type) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_9__[\"isNonNullType\"])(type)) {\n var astValue = astFromValue(value, type.ofType);\n\n if ((astValue === null || astValue === void 0 ? void 0 : astValue.kind) === _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].NULL) {\n return null;\n }\n\n return astValue;\n } // only explicit null, not undefined, NaN\n\n\n if (value === null) {\n return {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].NULL\n };\n } // undefined\n\n\n if (value === undefined) {\n return null;\n } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but\n // the value is not an array, convert the value using the list's item type.\n\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_9__[\"isListType\"])(type)) {\n var itemType = type.ofType;\n\n if (Object(_jsutils_isCollection_mjs__WEBPACK_IMPORTED_MODULE_6__[\"default\"])(value)) {\n var valuesNodes = []; // Since we transpile for-of in loose mode it doesn't support iterators\n // and it's required to first convert iteratable into array\n\n for (var _i2 = 0, _arrayFrom2 = Object(_polyfills_arrayFrom_mjs__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(value); _i2 < _arrayFrom2.length; _i2++) {\n var item = _arrayFrom2[_i2];\n var itemNode = astFromValue(item, itemType);\n\n if (itemNode != null) {\n valuesNodes.push(itemNode);\n }\n }\n\n return {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].LIST,\n values: valuesNodes\n };\n }\n\n return astFromValue(value, itemType);\n } // Populate the fields of the input object by creating ASTs from each value\n // in the JavaScript object according to the fields in the input type.\n\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_9__[\"isInputObjectType\"])(type)) {\n if (!Object(_jsutils_isObjectLike_mjs__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(value)) {\n return null;\n }\n\n var fieldNodes = [];\n\n for (var _i4 = 0, _objectValues2 = Object(_polyfills_objectValues_mjs__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(type.getFields()); _i4 < _objectValues2.length; _i4++) {\n var field = _objectValues2[_i4];\n var fieldValue = astFromValue(value[field.name], field.type);\n\n if (fieldValue) {\n fieldNodes.push({\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].OBJECT_FIELD,\n name: {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].NAME,\n value: field.name\n },\n value: fieldValue\n });\n }\n }\n\n return {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].OBJECT,\n fields: fieldNodes\n };\n } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')\n\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_9__[\"isLeafType\"])(type)) {\n // Since value is an internally represented value, it must be serialized\n // to an externally represented value before converting into an AST.\n var serialized = type.serialize(value);\n\n if (serialized == null) {\n return null;\n } // Others serialize based on their corresponding JavaScript scalar types.\n\n\n if (typeof serialized === 'boolean') {\n return {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].BOOLEAN,\n value: serialized\n };\n } // JavaScript numbers can be Int or Float values.\n\n\n if (typeof serialized === 'number' && Object(_polyfills_isFinite_mjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(serialized)) {\n var stringNum = String(serialized);\n return integerStringRegExp.test(stringNum) ? {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].INT,\n value: stringNum\n } : {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].FLOAT,\n value: stringNum\n };\n }\n\n if (typeof serialized === 'string') {\n // Enum types use Enum literals.\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_9__[\"isEnumType\"])(type)) {\n return {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].ENUM,\n value: serialized\n };\n } // ID types can use Int literals.\n\n\n if (type === _type_scalars_mjs__WEBPACK_IMPORTED_MODULE_8__[\"GraphQLID\"] && integerStringRegExp.test(serialized)) {\n return {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].INT,\n value: serialized\n };\n }\n\n return {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].STRING,\n value: serialized\n };\n }\n\n throw new TypeError(\"Cannot convert value to AST: \".concat(Object(_jsutils_inspect_mjs__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(serialized), \".\"));\n } // istanbul ignore next (Not reachable. All possible input types have been considered)\n\n\n false || Object(_jsutils_invariant_mjs__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(0, 'Unexpected input type: ' + Object(_jsutils_inspect_mjs__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(type));\n}",
"function astFromValue(value, type) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_9__[\"isNonNullType\"])(type)) {\n var astValue = astFromValue(value, type.ofType);\n\n if ((astValue === null || astValue === void 0 ? void 0 : astValue.kind) === _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].NULL) {\n return null;\n }\n\n return astValue;\n } // only explicit null, not undefined, NaN\n\n\n if (value === null) {\n return {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].NULL\n };\n } // undefined\n\n\n if (value === undefined) {\n return null;\n } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but\n // the value is not an array, convert the value using the list's item type.\n\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_9__[\"isListType\"])(type)) {\n var itemType = type.ofType;\n\n if (Object(_jsutils_isCollection_mjs__WEBPACK_IMPORTED_MODULE_6__[\"default\"])(value)) {\n var valuesNodes = []; // Since we transpile for-of in loose mode it doesn't support iterators\n // and it's required to first convert iteratable into array\n\n for (var _i2 = 0, _arrayFrom2 = Object(_polyfills_arrayFrom_mjs__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(value); _i2 < _arrayFrom2.length; _i2++) {\n var item = _arrayFrom2[_i2];\n var itemNode = astFromValue(item, itemType);\n\n if (itemNode != null) {\n valuesNodes.push(itemNode);\n }\n }\n\n return {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].LIST,\n values: valuesNodes\n };\n }\n\n return astFromValue(value, itemType);\n } // Populate the fields of the input object by creating ASTs from each value\n // in the JavaScript object according to the fields in the input type.\n\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_9__[\"isInputObjectType\"])(type)) {\n if (!Object(_jsutils_isObjectLike_mjs__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(value)) {\n return null;\n }\n\n var fieldNodes = [];\n\n for (var _i4 = 0, _objectValues2 = Object(_polyfills_objectValues_mjs__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(type.getFields()); _i4 < _objectValues2.length; _i4++) {\n var field = _objectValues2[_i4];\n var fieldValue = astFromValue(value[field.name], field.type);\n\n if (fieldValue) {\n fieldNodes.push({\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].OBJECT_FIELD,\n name: {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].NAME,\n value: field.name\n },\n value: fieldValue\n });\n }\n }\n\n return {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].OBJECT,\n fields: fieldNodes\n };\n } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')\n\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_9__[\"isLeafType\"])(type)) {\n // Since value is an internally represented value, it must be serialized\n // to an externally represented value before converting into an AST.\n var serialized = type.serialize(value);\n\n if (serialized == null) {\n return null;\n } // Others serialize based on their corresponding JavaScript scalar types.\n\n\n if (typeof serialized === 'boolean') {\n return {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].BOOLEAN,\n value: serialized\n };\n } // JavaScript numbers can be Int or Float values.\n\n\n if (typeof serialized === 'number' && Object(_polyfills_isFinite_mjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(serialized)) {\n var stringNum = String(serialized);\n return integerStringRegExp.test(stringNum) ? {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].INT,\n value: stringNum\n } : {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].FLOAT,\n value: stringNum\n };\n }\n\n if (typeof serialized === 'string') {\n // Enum types use Enum literals.\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_9__[\"isEnumType\"])(type)) {\n return {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].ENUM,\n value: serialized\n };\n } // ID types can use Int literals.\n\n\n if (type === _type_scalars_mjs__WEBPACK_IMPORTED_MODULE_8__[\"GraphQLID\"] && integerStringRegExp.test(serialized)) {\n return {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].INT,\n value: serialized\n };\n }\n\n return {\n kind: _language_kinds_mjs__WEBPACK_IMPORTED_MODULE_7__[\"Kind\"].STRING,\n value: serialized\n };\n }\n\n throw new TypeError(\"Cannot convert value to AST: \".concat(Object(_jsutils_inspect_mjs__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(serialized), \".\"));\n } // istanbul ignore next (Not reachable. All possible input types have been considered)\n\n\n false || Object(_jsutils_invariant_mjs__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(0, 'Unexpected input type: ' + Object(_jsutils_inspect_mjs__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(type));\n}",
"function astFromValue(value, type) {\n if ((0, _definition.isNonNullType)(type)) {\n var astValue = astFromValue(value, type.ofType);\n\n if ((astValue === null || astValue === void 0 ? void 0 : astValue.kind) === _kinds.Kind.NULL) {\n return null;\n }\n\n return astValue;\n } // only explicit null, not undefined, NaN\n\n\n if (value === null) {\n return {\n kind: _kinds.Kind.NULL\n };\n } // undefined\n\n\n if (value === undefined) {\n return null;\n } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but\n // the value is not an array, convert the value using the list's item type.\n\n\n if ((0, _definition.isListType)(type)) {\n var itemType = type.ofType;\n var items = (0, _safeArrayFrom.default)(value);\n\n if (items != null) {\n var valuesNodes = [];\n\n for (var _i2 = 0; _i2 < items.length; _i2++) {\n var item = items[_i2];\n var itemNode = astFromValue(item, itemType);\n\n if (itemNode != null) {\n valuesNodes.push(itemNode);\n }\n }\n\n return {\n kind: _kinds.Kind.LIST,\n values: valuesNodes\n };\n }\n\n return astFromValue(value, itemType);\n } // Populate the fields of the input object by creating ASTs from each value\n // in the JavaScript object according to the fields in the input type.\n\n\n if ((0, _definition.isInputObjectType)(type)) {\n if (!(0, _isObjectLike.default)(value)) {\n return null;\n }\n\n var fieldNodes = [];\n\n for (var _i4 = 0, _objectValues2 = (0, _objectValues.default)(type.getFields()); _i4 < _objectValues2.length; _i4++) {\n var field = _objectValues2[_i4];\n var fieldValue = astFromValue(value[field.name], field.type);\n\n if (fieldValue) {\n fieldNodes.push({\n kind: _kinds.Kind.OBJECT_FIELD,\n name: {\n kind: _kinds.Kind.NAME,\n value: field.name\n },\n value: fieldValue\n });\n }\n }\n\n return {\n kind: _kinds.Kind.OBJECT,\n fields: fieldNodes\n };\n } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')\n\n\n if ((0, _definition.isLeafType)(type)) {\n // Since value is an internally represented value, it must be serialized\n // to an externally represented value before converting into an AST.\n var serialized = type.serialize(value);\n\n if (serialized == null) {\n return null;\n } // Others serialize based on their corresponding JavaScript scalar types.\n\n\n if (typeof serialized === 'boolean') {\n return {\n kind: _kinds.Kind.BOOLEAN,\n value: serialized\n };\n } // JavaScript numbers can be Int or Float values.\n\n\n if (typeof serialized === 'number' && (0, _isFinite.default)(serialized)) {\n var stringNum = String(serialized);\n return integerStringRegExp.test(stringNum) ? {\n kind: _kinds.Kind.INT,\n value: stringNum\n } : {\n kind: _kinds.Kind.FLOAT,\n value: stringNum\n };\n }\n\n if (typeof serialized === 'string') {\n // Enum types use Enum literals.\n if ((0, _definition.isEnumType)(type)) {\n return {\n kind: _kinds.Kind.ENUM,\n value: serialized\n };\n } // ID types can use Int literals.\n\n\n if (type === _scalars.GraphQLID && integerStringRegExp.test(serialized)) {\n return {\n kind: _kinds.Kind.INT,\n value: serialized\n };\n }\n\n return {\n kind: _kinds.Kind.STRING,\n value: serialized\n };\n }\n\n throw new TypeError(\"Cannot convert value to AST: \".concat((0, _inspect.default)(serialized), \".\"));\n } // istanbul ignore next (Not reachable. All possible input types have been considered)\n\n\n false || (0, _invariant.default)(0, 'Unexpected input type: ' + (0, _inspect.default)(type));\n}",
"async function dataFlowsCreate() {\n const subscriptionId =\n process.env[\"DATAFACTORY_SUBSCRIPTION_ID\"] || \"12345678-1234-1234-1234-12345678abc\";\n const resourceGroupName = process.env[\"DATAFACTORY_RESOURCE_GROUP\"] || \"exampleResourceGroup\";\n const factoryName = \"exampleFactoryName\";\n const dataFlowName = \"exampleDataFlow\";\n const dataFlow = {\n properties: {\n type: \"MappingDataFlow\",\n description:\n \"Sample demo data flow to convert currencies showing usage of union, derive and conditional split transformation.\",\n scriptLines: [\n \"source(output(\",\n \"PreviousConversionRate as double,\",\n \"Country as string,\",\n \"DateTime1 as string,\",\n \"CurrentConversionRate as double\",\n \"),\",\n \"allowSchemaDrift: false,\",\n \"validateSchema: false) ~> USDCurrency\",\n \"source(output(\",\n \"PreviousConversionRate as double,\",\n \"Country as string,\",\n \"DateTime1 as string,\",\n \"CurrentConversionRate as double\",\n \"),\",\n \"allowSchemaDrift: true,\",\n \"validateSchema: false) ~> CADSource\",\n \"USDCurrency, CADSource union(byName: true)~> Union\",\n \"Union derive(NewCurrencyRate = round(CurrentConversionRate*1.25)) ~> NewCurrencyColumn\",\n \"NewCurrencyColumn split(Country == 'USD',\",\n \"Country == 'CAD',disjoint: false) ~> ConditionalSplit1@(USD, CAD)\",\n \"ConditionalSplit1@USD sink(saveMode:'overwrite' ) ~> USDSink\",\n \"ConditionalSplit1@CAD sink(saveMode:'overwrite' ) ~> CADSink\",\n ],\n sinks: [\n {\n name: \"USDSink\",\n dataset: { type: \"DatasetReference\", referenceName: \"USDOutput\" },\n },\n {\n name: \"CADSink\",\n dataset: { type: \"DatasetReference\", referenceName: \"CADOutput\" },\n },\n ],\n sources: [\n {\n name: \"USDCurrency\",\n dataset: {\n type: \"DatasetReference\",\n referenceName: \"CurrencyDatasetUSD\",\n },\n },\n {\n name: \"CADSource\",\n dataset: {\n type: \"DatasetReference\",\n referenceName: \"CurrencyDatasetCAD\",\n },\n },\n ],\n },\n };\n const credential = new DefaultAzureCredential();\n const client = new DataFactoryManagementClient(credential, subscriptionId);\n const result = await client.dataFlows.createOrUpdate(\n resourceGroupName,\n factoryName,\n dataFlowName,\n dataFlow\n );\n console.log(result);\n}",
"function create() {\n /**\n * Get a type test function for a specific data type\n * @param {string} name Name of a data type like 'number' or 'string'\n * @returns {Function(obj: *) : boolean} Returns a type testing function.\n * Throws an error for an unknown type.\n */\n function getTypeTest(name) {\n var test;\n for (var i = 0; i < typed.types.length; i++) {\n var entry = typed.types[i];\n if (entry.name === name) {\n test = entry.test;\n break;\n }\n }\n\n if (!test) {\n var hint;\n for (i = 0; i < typed.types.length; i++) {\n entry = typed.types[i];\n if (entry.name.toLowerCase() == name.toLowerCase()) {\n hint = entry.name;\n break;\n }\n }\n\n throw new Error('Unknown type \"' + name + '\"' +\n (hint ? ('. Did you mean \"' + hint + '\"?') : ''));\n }\n return test;\n }\n\n /**\n * Retrieve the function name from a set of functions, and check\n * whether the name of all functions match (if given)\n * @param {Array.<function>} fns\n */\n function getName (fns) {\n var name = '';\n\n for (var i = 0; i < fns.length; i++) {\n var fn = fns[i];\n\n // merge function name when this is a typed function\n if (fn.signatures && fn.name != '') {\n if (name == '') {\n name = fn.name;\n }\n else if (name != fn.name) {\n var err = new Error('Function names do not match (expected: ' + name + ', actual: ' + fn.name + ')');\n err.data = {\n actual: fn.name,\n expected: name\n };\n throw err;\n }\n }\n }\n\n return name;\n }\n\n /**\n * Create an ArgumentsError. Creates messages like:\n *\n * Unexpected type of argument (expected: ..., actual: ..., index: ...)\n * Too few arguments (expected: ..., index: ...)\n * Too many arguments (expected: ..., actual: ...)\n *\n * @param {String} fn Function name\n * @param {number} argCount Number of arguments\n * @param {Number} index Current argument index\n * @param {*} actual Current argument\n * @param {string} [expected] An optional, comma separated string with\n * expected types on given index\n * @extends Error\n */\n function createError(fn, argCount, index, actual, expected) {\n var actualType = getTypeOf(actual);\n var _expected = expected ? expected.split(',') : null;\n var _fn = (fn || 'unnamed');\n var anyType = _expected && contains(_expected, 'any');\n var message;\n var data = {\n fn: fn,\n index: index,\n actual: actualType,\n expected: _expected\n };\n\n if (_expected) {\n if (argCount > index && !anyType) {\n // unexpected type\n message = 'Unexpected type of argument in function ' + _fn +\n ' (expected: ' + _expected.join(' or ') + ', actual: ' + actualType + ', index: ' + index + ')';\n }\n else {\n // too few arguments\n message = 'Too few arguments in function ' + _fn +\n ' (expected: ' + _expected.join(' or ') + ', index: ' + index + ')';\n }\n }\n else {\n // too many arguments\n message = 'Too many arguments in function ' + _fn +\n ' (expected: ' + index + ', actual: ' + argCount + ')'\n }\n\n var err = new TypeError(message);\n err.data = data;\n return err;\n }\n\n /**\n * Collection with function references (local shortcuts to functions)\n * @constructor\n * @param {string} [name='refs'] Optional name for the refs, used to generate\n * JavaScript code\n */\n function Refs(name) {\n this.name = name || 'refs';\n this.categories = {};\n }\n\n /**\n * Add a function reference.\n * @param {Function} fn\n * @param {string} [category='fn'] A function category, like 'fn' or 'signature'\n * @returns {string} Returns the function name, for example 'fn0' or 'signature2'\n */\n Refs.prototype.add = function (fn, category) {\n var cat = category || 'fn';\n if (!this.categories[cat]) this.categories[cat] = [];\n\n var index = this.categories[cat].indexOf(fn);\n if (index == -1) {\n index = this.categories[cat].length;\n this.categories[cat].push(fn);\n }\n\n return cat + index;\n };\n\n /**\n * Create code lines for all function references\n * @returns {string} Returns the code containing all function references\n */\n Refs.prototype.toCode = function () {\n var code = [];\n var path = this.name + '.categories';\n var categories = this.categories;\n\n for (var cat in categories) {\n if (categories.hasOwnProperty(cat)) {\n var category = categories[cat];\n\n for (var i = 0; i < category.length; i++) {\n code.push('var ' + cat + i + ' = ' + path + '[\\'' + cat + '\\'][' + i + '];');\n }\n }\n }\n\n return code.join('\\n');\n };\n\n /**\n * A function parameter\n * @param {string | string[] | Param} types A parameter type like 'string',\n * 'number | boolean'\n * @param {boolean} [varArgs=false] Variable arguments if true\n * @constructor\n */\n function Param(types, varArgs) {\n // parse the types, can be a string with types separated by pipe characters |\n if (typeof types === 'string') {\n // parse variable arguments operator (ellipses '...number')\n var _types = types.trim();\n var _varArgs = _types.substr(0, 3) === '...';\n if (_varArgs) {\n _types = _types.substr(3);\n }\n if (_types === '') {\n this.types = ['any'];\n }\n else {\n this.types = _types.split('|');\n for (var i = 0; i < this.types.length; i++) {\n this.types[i] = this.types[i].trim();\n }\n }\n }\n else if (Array.isArray(types)) {\n this.types = types;\n }\n else if (types instanceof Param) {\n return types.clone();\n }\n else {\n throw new Error('String or Array expected');\n }\n\n // can hold a type to which to convert when handling this parameter\n this.conversions = [];\n // TODO: implement better API for conversions, be able to add conversions via constructor (support a new type Object?)\n\n // variable arguments\n this.varArgs = _varArgs || varArgs || false;\n\n // check for any type arguments\n this.anyType = this.types.indexOf('any') !== -1;\n }\n\n /**\n * Order Params\n * any type ('any') will be ordered last, and object as second last (as other\n * types may be an object as well, like Array).\n *\n * @param {Param} a\n * @param {Param} b\n * @returns {number} Returns 1 if a > b, -1 if a < b, and else 0.\n */\n Param.compare = function (a, b) {\n // TODO: simplify parameter comparison, it's a mess\n if (a.anyType) return 1;\n if (b.anyType) return -1;\n\n if (contains(a.types, 'Object')) return 1;\n if (contains(b.types, 'Object')) return -1;\n\n if (a.hasConversions()) {\n if (b.hasConversions()) {\n var i, ac, bc;\n\n for (i = 0; i < a.conversions.length; i++) {\n if (a.conversions[i] !== undefined) {\n ac = a.conversions[i];\n break;\n }\n }\n\n for (i = 0; i < b.conversions.length; i++) {\n if (b.conversions[i] !== undefined) {\n bc = b.conversions[i];\n break;\n }\n }\n\n return typed.conversions.indexOf(ac) - typed.conversions.indexOf(bc);\n }\n else {\n return 1;\n }\n }\n else {\n if (b.hasConversions()) {\n return -1;\n }\n else {\n // both params have no conversions\n var ai, bi;\n\n for (i = 0; i < typed.types.length; i++) {\n if (typed.types[i].name === a.types[0]) {\n ai = i;\n break;\n }\n }\n\n for (i = 0; i < typed.types.length; i++) {\n if (typed.types[i].name === b.types[0]) {\n bi = i;\n break;\n }\n }\n\n return ai - bi;\n }\n }\n };\n\n /**\n * Test whether this parameters types overlap an other parameters types.\n * Will not match ['any'] with ['number']\n * @param {Param} other\n * @return {boolean} Returns true when there are overlapping types\n */\n Param.prototype.overlapping = function (other) {\n for (var i = 0; i < this.types.length; i++) {\n if (contains(other.types, this.types[i])) {\n return true;\n }\n }\n return false;\n };\n\n /**\n * Test whether this parameters types matches an other parameters types.\n * When any of the two parameters contains `any`, true is returned\n * @param {Param} other\n * @return {boolean} Returns true when there are matching types\n */\n Param.prototype.matches = function (other) {\n return this.anyType || other.anyType || this.overlapping(other);\n };\n\n /**\n * Create a clone of this param\n * @returns {Param} Returns a cloned version of this param\n */\n Param.prototype.clone = function () {\n var param = new Param(this.types.slice(), this.varArgs);\n param.conversions = this.conversions.slice();\n return param;\n };\n\n /**\n * Test whether this parameter contains conversions\n * @returns {boolean} Returns true if the parameter contains one or\n * multiple conversions.\n */\n Param.prototype.hasConversions = function () {\n return this.conversions.length > 0;\n };\n\n /**\n * Tests whether this parameters contains any of the provided types\n * @param {Object} types A Map with types, like {'number': true}\n * @returns {boolean} Returns true when the parameter contains any\n * of the provided types\n */\n Param.prototype.contains = function (types) {\n for (var i = 0; i < this.types.length; i++) {\n if (types[this.types[i]]) {\n return true;\n }\n }\n return false;\n };\n\n /**\n * Return a string representation of this params types, like 'string' or\n * 'number | boolean' or '...number'\n * @param {boolean} [toConversion] If true, the returned types string\n * contains the types where the parameter\n * will convert to. If false (default)\n * the \"from\" types are returned\n * @returns {string}\n */\n Param.prototype.toString = function (toConversion) {\n var types = [];\n var keys = {};\n\n for (var i = 0; i < this.types.length; i++) {\n var conversion = this.conversions[i];\n var type = toConversion && conversion ? conversion.to : this.types[i];\n if (!(type in keys)) {\n keys[type] = true;\n types.push(type);\n }\n }\n\n return (this.varArgs ? '...' : '') + types.join('|');\n };\n\n /**\n * A function signature\n * @param {string | string[] | Param[]} params\n * Array with the type(s) of each parameter,\n * or a comma separated string with types\n * @param {Function} fn The actual function\n * @constructor\n */\n function Signature(params, fn) {\n var _params;\n if (typeof params === 'string') {\n _params = (params !== '') ? params.split(',') : [];\n }\n else if (Array.isArray(params)) {\n _params = params;\n }\n else {\n throw new Error('string or Array expected');\n }\n\n this.params = new Array(_params.length);\n this.anyType = false;\n this.varArgs = false;\n for (var i = 0; i < _params.length; i++) {\n var param = new Param(_params[i]);\n this.params[i] = param;\n if (param.anyType) {\n this.anyType = true;\n }\n if (i === _params.length - 1) {\n // the last argument\n this.varArgs = param.varArgs;\n }\n else {\n // non-last argument\n if (param.varArgs) {\n throw new SyntaxError('Unexpected variable arguments operator \"...\"');\n }\n }\n }\n\n this.fn = fn;\n }\n\n /**\n * Create a clone of this signature\n * @returns {Signature} Returns a cloned version of this signature\n */\n Signature.prototype.clone = function () {\n return new Signature(this.params.slice(), this.fn);\n };\n\n /**\n * Expand a signature: split params with union types in separate signatures\n * For example split a Signature \"string | number\" into two signatures.\n * @return {Signature[]} Returns an array with signatures (at least one)\n */\n Signature.prototype.expand = function () {\n var signatures = [];\n\n function recurse(signature, path) {\n if (path.length < signature.params.length) {\n var i, newParam, conversion;\n\n var param = signature.params[path.length];\n if (param.varArgs) {\n // a variable argument. do not split the types in the parameter\n newParam = param.clone();\n\n // add conversions to the parameter\n // recurse for all conversions\n for (i = 0; i < typed.conversions.length; i++) {\n conversion = typed.conversions[i];\n if (!contains(param.types, conversion.from) && contains(param.types, conversion.to)) {\n var j = newParam.types.length;\n newParam.types[j] = conversion.from;\n newParam.conversions[j] = conversion;\n }\n }\n\n recurse(signature, path.concat(newParam));\n }\n else {\n // split each type in the parameter\n for (i = 0; i < param.types.length; i++) {\n recurse(signature, path.concat(new Param(param.types[i])));\n }\n\n // recurse for all conversions\n for (i = 0; i < typed.conversions.length; i++) {\n conversion = typed.conversions[i];\n if (!contains(param.types, conversion.from) && contains(param.types, conversion.to)) {\n newParam = new Param(conversion.from);\n newParam.conversions[0] = conversion;\n recurse(signature, path.concat(newParam));\n }\n }\n }\n }\n else {\n signatures.push(new Signature(path, signature.fn));\n }\n }\n\n recurse(this, []);\n\n return signatures;\n };\n\n /**\n * Compare two signatures.\n *\n * When two params are equal and contain conversions, they will be sorted\n * by lowest index of the first conversions.\n *\n * @param {Signature} a\n * @param {Signature} b\n * @returns {number} Returns 1 if a > b, -1 if a < b, and else 0.\n */\n Signature.compare = function (a, b) {\n if (a.params.length > b.params.length) return 1;\n if (a.params.length < b.params.length) return -1;\n\n // count the number of conversions\n var i;\n var len = a.params.length; // a and b have equal amount of params\n var ac = 0;\n var bc = 0;\n for (i = 0; i < len; i++) {\n if (a.params[i].hasConversions()) ac++;\n if (b.params[i].hasConversions()) bc++;\n }\n\n if (ac > bc) return 1;\n if (ac < bc) return -1;\n\n // compare the order per parameter\n for (i = 0; i < a.params.length; i++) {\n var cmp = Param.compare(a.params[i], b.params[i]);\n if (cmp !== 0) {\n return cmp;\n }\n }\n\n return 0;\n };\n\n /**\n * Test whether any of the signatures parameters has conversions\n * @return {boolean} Returns true when any of the parameters contains\n * conversions.\n */\n Signature.prototype.hasConversions = function () {\n for (var i = 0; i < this.params.length; i++) {\n if (this.params[i].hasConversions()) {\n return true;\n }\n }\n return false;\n };\n\n /**\n * Test whether this signature should be ignored.\n * Checks whether any of the parameters contains a type listed in\n * typed.ignore\n * @return {boolean} Returns true when the signature should be ignored\n */\n Signature.prototype.ignore = function () {\n // create a map with ignored types\n var types = {};\n for (var i = 0; i < typed.ignore.length; i++) {\n types[typed.ignore[i]] = true;\n }\n\n // test whether any of the parameters contains this type\n for (i = 0; i < this.params.length; i++) {\n if (this.params[i].contains(types)) {\n return true;\n }\n }\n\n return false;\n };\n\n /**\n * Test whether the path of this signature matches a given path.\n * @param {Param[]} params\n */\n Signature.prototype.paramsStartWith = function (params) {\n if (params.length === 0) {\n return true;\n }\n\n var aLast = last(this.params);\n var bLast = last(params);\n\n for (var i = 0; i < params.length; i++) {\n var a = this.params[i] || (aLast.varArgs ? aLast: null);\n var b = params[i] || (bLast.varArgs ? bLast: null);\n\n if (!a || !b || !a.matches(b)) {\n return false;\n }\n }\n\n return true;\n };\n\n /**\n * Generate the code to invoke this signature\n * @param {Refs} refs\n * @param {string} prefix\n * @returns {string} Returns code\n */\n Signature.prototype.toCode = function (refs, prefix) {\n var code = [];\n\n var args = new Array(this.params.length);\n for (var i = 0; i < this.params.length; i++) {\n var param = this.params[i];\n var conversion = param.conversions[0];\n if (param.varArgs) {\n args[i] = 'varArgs';\n }\n else if (conversion) {\n args[i] = refs.add(conversion.convert, 'convert') + '(arg' + i + ')';\n }\n else {\n args[i] = 'arg' + i;\n }\n }\n\n var ref = this.fn ? refs.add(this.fn, 'signature') : undefined;\n if (ref) {\n return prefix + 'return ' + ref + '(' + args.join(', ') + '); // signature: ' + this.params.join(', ');\n }\n\n return code.join('\\n');\n };\n\n /**\n * Return a string representation of the signature\n * @returns {string}\n */\n Signature.prototype.toString = function () {\n return this.params.join(', ');\n };\n\n /**\n * A group of signatures with the same parameter on given index\n * @param {Param[]} path\n * @param {Signature} [signature]\n * @param {Node[]} childs\n * @param {boolean} [fallThrough=false]\n * @constructor\n */\n function Node(path, signature, childs, fallThrough) {\n this.path = path || [];\n this.param = path[path.length - 1] || null;\n this.signature = signature || null;\n this.childs = childs || [];\n this.fallThrough = fallThrough || false;\n }\n\n /**\n * Generate code for this group of signatures\n * @param {Refs} refs\n * @param {string} prefix\n * @returns {string} Returns the code as string\n */\n Node.prototype.toCode = function (refs, prefix) {\n // TODO: split this function in multiple functions, it's too large\n var code = [];\n\n if (this.param) {\n var index = this.path.length - 1;\n var conversion = this.param.conversions[0];\n var comment = '// type: ' + (conversion ?\n (conversion.from + ' (convert to ' + conversion.to + ')') :\n this.param);\n\n // non-root node (path is non-empty)\n if (this.param.varArgs) {\n if (this.param.anyType) {\n // variable arguments with any type\n code.push(prefix + 'if (arguments.length > ' + index + ') {');\n code.push(prefix + ' var varArgs = [];');\n code.push(prefix + ' for (var i = ' + index + '; i < arguments.length; i++) {');\n code.push(prefix + ' varArgs.push(arguments[i]);');\n code.push(prefix + ' }');\n code.push(this.signature.toCode(refs, prefix + ' '));\n code.push(prefix + '}');\n }\n else {\n // variable arguments with a fixed type\n var getTests = function (types, arg) {\n var tests = [];\n for (var i = 0; i < types.length; i++) {\n tests[i] = refs.add(getTypeTest(types[i]), 'test') + '(' + arg + ')';\n }\n return tests.join(' || ');\n }.bind(this);\n\n var allTypes = this.param.types;\n var exactTypes = [];\n for (var i = 0; i < allTypes.length; i++) {\n if (this.param.conversions[i] === undefined) {\n exactTypes.push(allTypes[i]);\n }\n }\n\n code.push(prefix + 'if (' + getTests(allTypes, 'arg' + index) + ') { ' + comment);\n code.push(prefix + ' var varArgs = [arg' + index + '];');\n code.push(prefix + ' for (var i = ' + (index + 1) + '; i < arguments.length; i++) {');\n code.push(prefix + ' if (' + getTests(exactTypes, 'arguments[i]') + ') {');\n code.push(prefix + ' varArgs.push(arguments[i]);');\n\n for (var i = 0; i < allTypes.length; i++) {\n var conversion_i = this.param.conversions[i];\n if (conversion_i) {\n var test = refs.add(getTypeTest(allTypes[i]), 'test');\n var convert = refs.add(conversion_i.convert, 'convert');\n code.push(prefix + ' }');\n code.push(prefix + ' else if (' + test + '(arguments[i])) {');\n code.push(prefix + ' varArgs.push(' + convert + '(arguments[i]));');\n }\n }\n code.push(prefix + ' } else {');\n code.push(prefix + ' throw createError(name, arguments.length, i, arguments[i], \\'' + exactTypes.join(',') + '\\');');\n code.push(prefix + ' }');\n code.push(prefix + ' }');\n code.push(this.signature.toCode(refs, prefix + ' '));\n code.push(prefix + '}');\n }\n }\n else {\n if (this.param.anyType) {\n // any type\n code.push(prefix + '// type: any');\n code.push(this._innerCode(refs, prefix));\n }\n else {\n // regular type\n var type = this.param.types[0];\n var test = type !== 'any' ? refs.add(getTypeTest(type), 'test') : null;\n\n code.push(prefix + 'if (' + test + '(arg' + index + ')) { ' + comment);\n code.push(this._innerCode(refs, prefix + ' '));\n code.push(prefix + '}');\n }\n }\n }\n else {\n // root node (path is empty)\n code.push(this._innerCode(refs, prefix));\n }\n\n return code.join('\\n');\n };\n\n /**\n * Generate inner code for this group of signatures.\n * This is a helper function of Node.prototype.toCode\n * @param {Refs} refs\n * @param {string} prefix\n * @returns {string} Returns the inner code as string\n * @private\n */\n Node.prototype._innerCode = function (refs, prefix) {\n var code = [];\n var i;\n\n if (this.signature) {\n code.push(prefix + 'if (arguments.length === ' + this.path.length + ') {');\n code.push(this.signature.toCode(refs, prefix + ' '));\n code.push(prefix + '}');\n }\n\n for (i = 0; i < this.childs.length; i++) {\n code.push(this.childs[i].toCode(refs, prefix));\n }\n\n // TODO: shouldn't the this.param.anyType check be redundant\n if (!this.fallThrough || (this.param && this.param.anyType)) {\n var exceptions = this._exceptions(refs, prefix);\n if (exceptions) {\n code.push(exceptions);\n }\n }\n\n return code.join('\\n');\n };\n\n\n /**\n * Generate code to throw exceptions\n * @param {Refs} refs\n * @param {string} prefix\n * @returns {string} Returns the inner code as string\n * @private\n */\n Node.prototype._exceptions = function (refs, prefix) {\n var index = this.path.length;\n\n if (this.childs.length === 0) {\n // TODO: can this condition be simplified? (we have a fall-through here)\n return [\n prefix + 'if (arguments.length > ' + index + ') {',\n prefix + ' throw createError(name, arguments.length, ' + index + ', arguments[' + index + ']);',\n prefix + '}'\n ].join('\\n');\n }\n else {\n var keys = {};\n var types = [];\n\n for (var i = 0; i < this.childs.length; i++) {\n var node = this.childs[i];\n if (node.param) {\n for (var j = 0; j < node.param.types.length; j++) {\n var type = node.param.types[j];\n if (!(type in keys) && !node.param.conversions[j]) {\n keys[type] = true;\n types.push(type);\n }\n }\n }\n }\n\n return prefix + 'throw createError(name, arguments.length, ' + index + ', arguments[' + index + '], \\'' + types.join(',') + '\\');';\n }\n };\n\n /**\n * Split all raw signatures into an array with expanded Signatures\n * @param {Object.<string, Function>} rawSignatures\n * @return {Signature[]} Returns an array with expanded signatures\n */\n function parseSignatures(rawSignatures) {\n // FIXME: need to have deterministic ordering of signatures, do not create via object\n var signature;\n var keys = {};\n var signatures = [];\n var i;\n\n for (var types in rawSignatures) {\n if (rawSignatures.hasOwnProperty(types)) {\n var fn = rawSignatures[types];\n signature = new Signature(types, fn);\n\n if (signature.ignore()) {\n continue;\n }\n\n var expanded = signature.expand();\n\n for (i = 0; i < expanded.length; i++) {\n var signature_i = expanded[i];\n var key = signature_i.toString();\n var existing = keys[key];\n if (!existing) {\n keys[key] = signature_i;\n }\n else {\n var cmp = Signature.compare(signature_i, existing);\n if (cmp < 0) {\n // override if sorted first\n keys[key] = signature_i;\n }\n else if (cmp === 0) {\n throw new Error('Signature \"' + key + '\" is defined twice');\n }\n // else: just ignore\n }\n }\n }\n }\n\n // convert from map to array\n for (key in keys) {\n if (keys.hasOwnProperty(key)) {\n signatures.push(keys[key]);\n }\n }\n\n // order the signatures\n signatures.sort(function (a, b) {\n return Signature.compare(a, b);\n });\n\n // filter redundant conversions from signatures with varArgs\n // TODO: simplify this loop or move it to a separate function\n for (i = 0; i < signatures.length; i++) {\n signature = signatures[i];\n\n if (signature.varArgs) {\n var index = signature.params.length - 1;\n var param = signature.params[index];\n\n var t = 0;\n while (t < param.types.length) {\n if (param.conversions[t]) {\n var type = param.types[t];\n\n for (var j = 0; j < signatures.length; j++) {\n var other = signatures[j];\n var p = other.params[index];\n\n if (other !== signature &&\n p &&\n contains(p.types, type) && !p.conversions[index]) {\n // this (conversion) type already exists, remove it\n param.types.splice(t, 1);\n param.conversions.splice(t, 1);\n t--;\n break;\n }\n }\n }\n t++;\n }\n }\n }\n\n return signatures;\n }\n\n /**\n * Filter all any type signatures\n * @param {Signature[]} signatures\n * @return {Signature[]} Returns only any type signatures\n */\n function filterAnyTypeSignatures (signatures) {\n var filtered = [];\n\n for (var i = 0; i < signatures.length; i++) {\n if (signatures[i].anyType) {\n filtered.push(signatures[i]);\n }\n }\n\n return filtered;\n }\n\n /**\n * create a map with normalized signatures as key and the function as value\n * @param {Signature[]} signatures An array with split signatures\n * @return {Object.<string, Function>} Returns a map with normalized\n * signatures as key, and the function\n * as value.\n */\n function mapSignatures(signatures) {\n var normalized = {};\n\n for (var i = 0; i < signatures.length; i++) {\n var signature = signatures[i];\n if (signature.fn && !signature.hasConversions()) {\n var params = signature.params.join(',');\n normalized[params] = signature.fn;\n }\n }\n\n return normalized;\n }\n\n /**\n * Parse signatures recursively in a node tree.\n * @param {Signature[]} signatures Array with expanded signatures\n * @param {Param[]} path Traversed path of parameter types\n * @param {Signature[]} anys\n * @return {Node} Returns a node tree\n */\n function parseTree(signatures, path, anys) {\n var i, signature;\n var index = path.length;\n var nodeSignature;\n\n var filtered = [];\n for (i = 0; i < signatures.length; i++) {\n signature = signatures[i];\n\n // filter the first signature with the correct number of params\n if (signature.params.length === index && !nodeSignature) {\n nodeSignature = signature;\n }\n\n if (signature.params[index] != undefined) {\n filtered.push(signature);\n }\n }\n\n // sort the filtered signatures by param\n filtered.sort(function (a, b) {\n return Param.compare(a.params[index], b.params[index]);\n });\n\n // recurse over the signatures\n var entries = [];\n for (i = 0; i < filtered.length; i++) {\n signature = filtered[i];\n // group signatures with the same param at current index\n var param = signature.params[index];\n\n // TODO: replace the next filter loop\n var existing = entries.filter(function (entry) {\n return entry.param.overlapping(param);\n })[0];\n\n //var existing;\n //for (var j = 0; j < entries.length; j++) {\n // if (entries[j].param.overlapping(param)) {\n // existing = entries[j];\n // break;\n // }\n //}\n\n if (existing) {\n if (existing.param.varArgs) {\n throw new Error('Conflicting types \"' + existing.param + '\" and \"' + param + '\"');\n }\n existing.signatures.push(signature);\n }\n else {\n entries.push({\n param: param,\n signatures: [signature]\n });\n }\n }\n\n // find all any type signature that can still match our current path\n var matchingAnys = [];\n for (i = 0; i < anys.length; i++) {\n if (anys[i].paramsStartWith(path)) {\n matchingAnys.push(anys[i]);\n }\n }\n\n // see if there are any type signatures that don't match any of the\n // signatures that we have in our tree, i.e. we have alternative\n // matching signature(s) outside of our current tree and we should\n // fall through to them instead of throwing an exception\n var fallThrough = false;\n for (i = 0; i < matchingAnys.length; i++) {\n if (!contains(signatures, matchingAnys[i])) {\n fallThrough = true;\n break;\n }\n }\n\n // parse the childs\n var childs = new Array(entries.length);\n for (i = 0; i < entries.length; i++) {\n var entry = entries[i];\n childs[i] = parseTree(entry.signatures, path.concat(entry.param), matchingAnys)\n }\n\n return new Node(path, nodeSignature, childs, fallThrough);\n }\n\n /**\n * Generate an array like ['arg0', 'arg1', 'arg2']\n * @param {number} count Number of arguments to generate\n * @returns {Array} Returns an array with argument names\n */\n function getArgs(count) {\n // create an array with all argument names\n var args = [];\n for (var i = 0; i < count; i++) {\n args[i] = 'arg' + i;\n }\n\n return args;\n }\n\n /**\n * Compose a function from sub-functions each handling a single type signature.\n * Signatures:\n * typed(signature: string, fn: function)\n * typed(name: string, signature: string, fn: function)\n * typed(signatures: Object.<string, function>)\n * typed(name: string, signatures: Object.<string, function>)\n *\n * @param {string | null} name\n * @param {Object.<string, Function>} signatures\n * @return {Function} Returns the typed function\n * @private\n */\n function _typed(name, signatures) {\n var refs = new Refs();\n\n // parse signatures, expand them\n var _signatures = parseSignatures(signatures);\n if (_signatures.length == 0) {\n throw new Error('No signatures provided');\n }\n\n // filter all any type signatures\n var anys = filterAnyTypeSignatures(_signatures);\n\n // parse signatures into a node tree\n var node = parseTree(_signatures, [], anys);\n\n //var util = require('util');\n //console.log('ROOT');\n //console.log(util.inspect(node, { depth: null }));\n\n // generate code for the typed function\n // safeName is a conservative replacement of characters \n // to prevend being able to inject JS code at the place of the function name \n // the name is useful for stack trackes therefore we want have it there\n var code = [];\n var safeName = (name || '').replace(/[^a-zA-Z0-9_$]/g, '_')\n var args = getArgs(maxParams(_signatures));\n code.push('function ' + safeName + '(' + args.join(', ') + ') {');\n code.push(' \"use strict\";');\n code.push(' var name = ' + JSON.stringify(name || '') + ';');\n code.push(node.toCode(refs, ' ', false));\n code.push('}');\n\n // generate body for the factory function\n var body = [\n refs.toCode(),\n 'return ' + code.join('\\n')\n ].join('\\n');\n\n // evaluate the JavaScript code and attach function references\n var factory = (new Function(refs.name, 'createError', body));\n var fn = factory(refs, createError);\n\n //console.log('FN\\n' + fn.toString()); // TODO: cleanup\n\n // attach the signatures with sub-functions to the constructed function\n fn.signatures = mapSignatures(_signatures);\n\n return fn;\n }\n\n /**\n * Calculate the maximum number of parameters in givens signatures\n * @param {Signature[]} signatures\n * @returns {number} The maximum number of parameters\n */\n function maxParams(signatures) {\n var max = 0;\n\n for (var i = 0; i < signatures.length; i++) {\n var len = signatures[i].params.length;\n if (len > max) {\n max = len;\n }\n }\n\n return max;\n }\n\n /**\n * Get the type of a value\n * @param {*} x\n * @returns {string} Returns a string with the type of value\n */\n function getTypeOf(x) {\n var obj;\n\n for (var i = 0; i < typed.types.length; i++) {\n var entry = typed.types[i];\n\n if (entry.name === 'Object') {\n // Array and Date are also Object, so test for Object afterwards\n obj = entry;\n }\n else {\n if (entry.test(x)) return entry.name;\n }\n }\n\n // at last, test whether an object\n if (obj && obj.test(x)) return obj.name;\n\n return 'unknown';\n }\n\n /**\n * Test whether an array contains some item\n * @param {Array} array\n * @param {*} item\n * @return {boolean} Returns true if array contains item, false if not.\n */\n function contains(array, item) {\n return array.indexOf(item) !== -1;\n }\n\n /**\n * Returns the last item in the array\n * @param {Array} array\n * @return {*} item\n */\n function last (array) {\n return array[array.length - 1];\n }\n\n // data type tests\n var types = [\n { name: 'number', test: function (x) { return typeof x === 'number' } },\n { name: 'string', test: function (x) { return typeof x === 'string' } },\n { name: 'boolean', test: function (x) { return typeof x === 'boolean' } },\n { name: 'Function', test: function (x) { return typeof x === 'function'} },\n { name: 'Array', test: Array.isArray },\n { name: 'Date', test: function (x) { return x instanceof Date } },\n { name: 'RegExp', test: function (x) { return x instanceof RegExp } },\n { name: 'Object', test: function (x) { return typeof x === 'object' } },\n { name: 'null', test: function (x) { return x === null } },\n { name: 'undefined', test: function (x) { return x === undefined } }\n ];\n\n // configuration\n var config = {};\n\n // type conversions. Order is important\n var conversions = [];\n\n // types to be ignored\n var ignore = [];\n\n // temporary object for holding types and conversions, for constructing\n // the `typed` function itself\n // TODO: find a more elegant solution for this\n var typed = {\n config: config,\n types: types,\n conversions: conversions,\n ignore: ignore\n };\n\n /**\n * Construct the typed function itself with various signatures\n *\n * Signatures:\n *\n * typed(signatures: Object.<string, function>)\n * typed(name: string, signatures: Object.<string, function>)\n */\n typed = _typed('typed', {\n 'Object': function (signatures) {\n var fns = [];\n for (var signature in signatures) {\n if (signatures.hasOwnProperty(signature)) {\n fns.push(signatures[signature]);\n }\n }\n var name = getName(fns);\n\n return _typed(name, signatures);\n },\n 'string, Object': _typed,\n // TODO: add a signature 'Array.<function>'\n '...Function': function (fns) {\n var err;\n var name = getName(fns);\n var signatures = {};\n\n for (var i = 0; i < fns.length; i++) {\n var fn = fns[i];\n\n // test whether this is a typed-function\n if (!(typeof fn.signatures === 'object')) {\n err = new TypeError('Function is no typed-function (index: ' + i + ')');\n err.data = {index: i};\n throw err;\n }\n\n // merge the signatures\n for (var signature in fn.signatures) {\n if (fn.signatures.hasOwnProperty(signature)) {\n if (signatures.hasOwnProperty(signature)) {\n if (fn.signatures[signature] !== signatures[signature]) {\n err = new Error('Signature \"' + signature + '\" is defined twice');\n err.data = {signature: signature};\n throw err;\n }\n // else: both signatures point to the same function, that's fine\n }\n else {\n signatures[signature] = fn.signatures[signature];\n }\n }\n }\n }\n\n return _typed(name, signatures);\n }\n });\n\n /**\n * Find a specific signature from a (composed) typed function, for\n * example:\n *\n * typed.find(fn, ['number', 'string'])\n * typed.find(fn, 'number, string')\n *\n * Function find only only works for exact matches.\n *\n * @param {Function} fn A typed-function\n * @param {string | string[]} signature Signature to be found, can be\n * an array or a comma separated string.\n * @return {Function} Returns the matching signature, or\n * throws an errror when no signature\n * is found.\n */\n function find (fn, signature) {\n if (!fn.signatures) {\n throw new TypeError('Function is no typed-function');\n }\n\n // normalize input\n var arr;\n if (typeof signature === 'string') {\n arr = signature.split(',');\n for (var i = 0; i < arr.length; i++) {\n arr[i] = arr[i].trim();\n }\n }\n else if (Array.isArray(signature)) {\n arr = signature;\n }\n else {\n throw new TypeError('String array or a comma separated string expected');\n }\n\n var str = arr.join(',');\n\n // find an exact match\n var match = fn.signatures[str];\n if (match) {\n return match;\n }\n\n // TODO: extend find to match non-exact signatures\n\n throw new TypeError('Signature not found (signature: ' + (fn.name || 'unnamed') + '(' + arr.join(', ') + '))');\n }\n\n /**\n * Convert a given value to another data type.\n * @param {*} value\n * @param {string} type\n */\n function convert (value, type) {\n var from = getTypeOf(value);\n\n // check conversion is needed\n if (type === from) {\n return value;\n }\n\n for (var i = 0; i < typed.conversions.length; i++) {\n var conversion = typed.conversions[i];\n if (conversion.from === from && conversion.to === type) {\n return conversion.convert(value);\n }\n }\n\n throw new Error('Cannot convert from ' + from + ' to ' + type);\n }\n\n // attach types and conversions to the final `typed` function\n typed.config = config;\n typed.types = types;\n typed.conversions = conversions;\n typed.ignore = ignore;\n typed.create = create;\n typed.find = find;\n typed.convert = convert;\n\n // add a type\n typed.addType = function (type) {\n if (!type || typeof type.name !== 'string' || typeof type.test !== 'function') {\n throw new TypeError('Object with properties {name: string, test: function} expected');\n }\n\n typed.types.push(type);\n };\n\n // add a conversion\n typed.addConversion = function (conversion) {\n if (!conversion\n || typeof conversion.from !== 'string'\n || typeof conversion.to !== 'string'\n || typeof conversion.convert !== 'function') {\n throw new TypeError('Object with properties {from: string, to: string, convert: function} expected');\n }\n\n typed.conversions.push(conversion);\n };\n\n return typed;\n }",
"static createItem(typeName, ctx=null) {\n console.debug(\"Types.createItem\", typeName);\n if (typeof typeName !== 'string') {\n throw new Error(\"expected type string\");\n }\n var ret;\n const type= allTypes.get( typeName );\n if (!type ) {\n throw new Error(`unknown type '${typeName}'`);\n }\n const { uses } = type;\n switch (uses) {\n case \"flow\": {\n const data= {};\n const spec= type.with;\n const { params } = spec;\n for ( const token in params ) {\n const param= params[token];\n if (!param.optional || param.repeats) {\n const val= (!param.optional) && Types.createItem( param.type, {\n token: token,\n param: param\n });\n // if the param repeats then we'll wind up with an array (of items)\n data[token]= param.repeats? (val? [val]: []): val;\n }\n }\n ret= allTypes.newItem(type.name, data);\n }\n break;\n case \"slot\":\n case \"swap\": {\n // note: \"initially\", if any, is: object { string type; object value; }\n // FIX: \"initially\" wont work properly for opts.\n // slots dont have a $TOKEN entry, but options do.\n const pair= Types._unpack(ctx);\n if (!pair) {\n ret= allTypes.newItem(type.name, null);\n } else {\n const { type:slatType, value:slatValue } = pair;\n ret= Types.createItem(slatType, slatValue);\n }\n }\n break;\n case \"str\":\n case \"txt\": {\n // ex. Item(\"trait\", \"testing\")\n // determine default value\n let defautValue= \"\";\n const spec= type.with;\n const { tokens, params }= spec;\n if (tokens.length === 1) {\n const t= tokens[0];\n const param= params[t];\n // FIX: no .... this is in the \"flow\"... the container of the str.\n // if (param.filterVals && ('default' in param.filterVals)) {\n // defaultValue= param.filterVals['default'];\n // } else {\n // if there's only one token, and that token isn't the \"floating value\" token....\n if (param.value !== null) {\n defautValue= t; // then we can use the token as our default value.\n }\n // }\n }\n const value= Types._unpack(ctx, defautValue);\n // fix? .value for string elements *can* be null,\n // but if they are things in autoText throw.\n // apparently default String prop validation allows null.\n ret= allTypes.newItem(type.name, value);\n }\n break;\n case \"num\": {\n const value= Types._unpack(ctx, 0);\n ret= allTypes.newItem(type.name, value);\n }\n break;\n default:\n throw new Error(`unknown type ${uses}`);\n break;\n }\n return ret;\n }",
"function DataTypeConverter() {\n this._fields = [];\n this._numOfRows = 0;\n}",
"function astFromValue(value, type) {\n\t // Ensure flow knows that we treat function params as const.\n\t var _value = value;\n\n\t if (type instanceof _definition.GraphQLNonNull) {\n\t // Note: we're not checking that the result is non-null.\n\t // This function is not responsible for validating the input value.\n\t return astFromValue(_value, type.ofType);\n\t }\n\n\t if ((0, _isNullish2.default)(_value)) {\n\t return null;\n\t }\n\n\t // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but\n\t // the value is not an array, convert the value using the list's item type.\n\t if (type instanceof _definition.GraphQLList) {\n\t var _ret = function () {\n\t var itemType = type.ofType;\n\t if ((0, _iterall.isCollection)(_value)) {\n\t var _ret2 = function () {\n\t var valuesASTs = [];\n\t (0, _iterall.forEach)(_value, function (item) {\n\t var itemAST = astFromValue(item, itemType);\n\t if (itemAST) {\n\t valuesASTs.push(itemAST);\n\t }\n\t });\n\t return {\n\t v: {\n\t v: { kind: _kinds.LIST, values: valuesASTs }\n\t }\n\t };\n\t }();\n\n\t if (typeof _ret2 === \"object\") return _ret2.v;\n\t }\n\t return {\n\t v: astFromValue(_value, itemType)\n\t };\n\t }();\n\n\t if (typeof _ret === \"object\") return _ret.v;\n\t }\n\n\t // Populate the fields of the input object by creating ASTs from each value\n\t // in the JavaScript object according to the fields in the input type.\n\t if (type instanceof _definition.GraphQLInputObjectType) {\n\t var _ret3 = function () {\n\t if (_value === null || typeof _value !== 'object') {\n\t return {\n\t v: null\n\t };\n\t }\n\t var fields = type.getFields();\n\t var fieldASTs = [];\n\t Object.keys(fields).forEach(function (fieldName) {\n\t var fieldType = fields[fieldName].type;\n\t var fieldValue = astFromValue(_value[fieldName], fieldType);\n\t if (fieldValue) {\n\t fieldASTs.push({\n\t kind: _kinds.OBJECT_FIELD,\n\t name: { kind: _kinds.NAME, value: fieldName },\n\t value: fieldValue\n\t });\n\t }\n\t });\n\t return {\n\t v: { kind: _kinds.OBJECT, fields: fieldASTs }\n\t };\n\t }();\n\n\t if (typeof _ret3 === \"object\") return _ret3.v;\n\t }\n\n\t (0, _invariant2.default)(type instanceof _definition.GraphQLScalarType || type instanceof _definition.GraphQLEnumType, 'Must provide Input Type, cannot use: ' + String(type));\n\n\t // Since value is an internally represented value, it must be serialized\n\t // to an externally represented value before converting into an AST.\n\t var serialized = type.serialize(_value);\n\t if ((0, _isNullish2.default)(serialized)) {\n\t return null;\n\t }\n\n\t // Others serialize based on their corresponding JavaScript scalar types.\n\t if (typeof serialized === 'boolean') {\n\t return { kind: _kinds.BOOLEAN, value: serialized };\n\t }\n\n\t // JavaScript numbers can be Int or Float values.\n\t if (typeof serialized === 'number') {\n\t var stringNum = String(serialized);\n\t return (/^[0-9]+$/.test(stringNum) ? { kind: _kinds.INT, value: stringNum } : { kind: _kinds.FLOAT, value: stringNum }\n\t );\n\t }\n\n\t if (typeof serialized === 'string') {\n\t // Enum types use Enum literals.\n\t if (type instanceof _definition.GraphQLEnumType) {\n\t return { kind: _kinds.ENUM, value: serialized };\n\t }\n\n\t // ID types can use Int literals.\n\t if (type === _scalars.GraphQLID && /^[0-9]+$/.test(serialized)) {\n\t return { kind: _kinds.INT, value: serialized };\n\t }\n\n\t // Use JSON stringify, which uses the same string encoding as GraphQL,\n\t // then remove the quotes.\n\t return {\n\t kind: _kinds.STRING,\n\t value: JSON.stringify(serialized).slice(1, -1)\n\t };\n\t }\n\n\t throw new TypeError('Cannot convert value to AST: ' + String(serialized));\n\t}",
"function propTypeToFlowTypeTransform(j, node, callback) {\n // instanceOf(), arrayOf(), etc..\n const {\n name\n } = node.callee.property;\n\n switch (name) {\n case _constants.PROPTYPES_IDENTIFIERS.INSTANCE_OF:\n return j.genericTypeAnnotation(node.arguments[0], null);\n\n case _constants.PROPTYPES_IDENTIFIERS.ARRAY_OF:\n return j.genericTypeAnnotation(j.identifier('Array'), j.typeParameterInstantiation([callback(j, null, node.arguments[0] || j.anyTypeAnnotation())]));\n\n case _constants.PROPTYPES_IDENTIFIERS.OBJECT_OF:\n return j.genericTypeAnnotation(j.identifier('Object'), j.typeParameterInstantiation([callback(j, null, node.arguments[0] || j.anyTypeAnnotation())]));\n\n case _constants.PROPTYPES_IDENTIFIERS.SHAPE:\n return j.objectTypeAnnotation(node.arguments[0].properties.map(arg => callback(j, arg.key, arg.value)));\n\n case _constants.PROPTYPES_IDENTIFIERS.ONE_OF:\n case _constants.PROPTYPES_IDENTIFIERS.ONE_OF_TYPE:\n return j.unionTypeAnnotation(node.arguments[0].elements.map(arg => callback(j, null, arg)));\n\n default:\n break;\n }\n}",
"function dataflow() {\n var Flow = window.Flow;\n Flow.Dataflow = function () {\n return {\n slot: createSlot,\n slots: createSlots,\n signal: createSignal,\n signals: createSignals,\n isSignal: _isSignal,\n link: _link,\n unlink: _unlink,\n act: _act,\n react: _react,\n lift: _lift,\n merge: _merge\n };\n }();\n }",
"create(_id, _data, _type) {\n if (!_type) {\n HValue.new(_id, _data);\n }\n else if (_type === 1) {\n HPushValue.new(_id, _data);\n }\n else if (_type === 2) {\n HPullValue.new(_id, _data);\n }\n else {\n console.warn(`Unknown value type: ${_type}`);\n }\n }",
"_newDataSet(...params){\n const Type = this.options.DataSetType || DataSet;\n return new Type(...params); \n }",
"static fromJSON(schema, json) {\n if (!json || !json.stepType)\n throw new RangeError(\"Invalid input for Step.fromJSON\");\n let type = stepsByID[json.stepType];\n if (!type)\n throw new RangeError(`No step type ${json.stepType} defined`);\n return type.fromJSON(schema, json);\n }",
"function astFromValue(value, type) {\n // Ensure flow knows that we treat function params as const.\n var _value = value;\n\n if (type instanceof _definition.GraphQLNonNull) {\n var astValue = astFromValue(_value, type.ofType);\n if (astValue && astValue.kind === _kinds.NULL) {\n return null;\n }\n return astValue;\n }\n\n // only explicit null, not undefined, NaN\n if (_value === null) {\n return { kind: _kinds.NULL };\n }\n\n // undefined, NaN\n if ((0, _isInvalid2.default)(_value)) {\n return null;\n }\n\n // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but\n // the value is not an array, convert the value using the list's item type.\n if (type instanceof _definition.GraphQLList) {\n var itemType = type.ofType;\n if ((0, _iterall.isCollection)(_value)) {\n var valuesNodes = [];\n (0, _iterall.forEach)(_value, function (item) {\n var itemNode = astFromValue(item, itemType);\n if (itemNode) {\n valuesNodes.push(itemNode);\n }\n });\n return { kind: _kinds.LIST, values: valuesNodes };\n }\n return astFromValue(_value, itemType);\n }\n\n // Populate the fields of the input object by creating ASTs from each value\n // in the JavaScript object according to the fields in the input type.\n if (type instanceof _definition.GraphQLInputObjectType) {\n if (_value === null || typeof _value !== 'object') {\n return null;\n }\n var fields = type.getFields();\n var fieldNodes = [];\n Object.keys(fields).forEach(function (fieldName) {\n var fieldType = fields[fieldName].type;\n var fieldValue = astFromValue(_value[fieldName], fieldType);\n if (fieldValue) {\n fieldNodes.push({\n kind: _kinds.OBJECT_FIELD,\n name: { kind: _kinds.NAME, value: fieldName },\n value: fieldValue\n });\n }\n });\n return { kind: _kinds.OBJECT, fields: fieldNodes };\n }\n\n (0, _invariant2.default)(type instanceof _definition.GraphQLScalarType || type instanceof _definition.GraphQLEnumType, 'Must provide Input Type, cannot use: ' + String(type));\n\n // Since value is an internally represented value, it must be serialized\n // to an externally represented value before converting into an AST.\n var serialized = type.serialize(_value);\n if ((0, _isNullish2.default)(serialized)) {\n return null;\n }\n\n // Others serialize based on their corresponding JavaScript scalar types.\n if (typeof serialized === 'boolean') {\n return { kind: _kinds.BOOLEAN, value: serialized };\n }\n\n // JavaScript numbers can be Int or Float values.\n if (typeof serialized === 'number') {\n var stringNum = String(serialized);\n return (/^[0-9]+$/.test(stringNum) ? { kind: _kinds.INT, value: stringNum } : { kind: _kinds.FLOAT, value: stringNum }\n );\n }\n\n if (typeof serialized === 'string') {\n // Enum types use Enum literals.\n if (type instanceof _definition.GraphQLEnumType) {\n return { kind: _kinds.ENUM, value: serialized };\n }\n\n // ID types can use Int literals.\n if (type === _scalars.GraphQLID && /^[0-9]+$/.test(serialized)) {\n return { kind: _kinds.INT, value: serialized };\n }\n\n // Use JSON stringify, which uses the same string encoding as GraphQL,\n // then remove the quotes.\n return {\n kind: _kinds.STRING,\n value: JSON.stringify(serialized).slice(1, -1)\n };\n }\n\n throw new TypeError('Cannot convert value to AST: ' + String(serialized));\n}",
"function astFromValue(value, type) {\n // Ensure flow knows that we treat function params as const.\n var _value = value;\n\n if (type instanceof _definition.GraphQLNonNull) {\n var astValue = astFromValue(_value, type.ofType);\n if (astValue && astValue.kind === Kind.NULL) {\n return null;\n }\n return astValue;\n }\n\n // only explicit null, not undefined, NaN\n if (_value === null) {\n return { kind: Kind.NULL };\n }\n\n // undefined, NaN\n if ((0, _isInvalid2.default)(_value)) {\n return null;\n }\n\n // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but\n // the value is not an array, convert the value using the list's item type.\n if (type instanceof _definition.GraphQLList) {\n var itemType = type.ofType;\n if ((0, _iterall.isCollection)(_value)) {\n var valuesNodes = [];\n (0, _iterall.forEach)(_value, function (item) {\n var itemNode = astFromValue(item, itemType);\n if (itemNode) {\n valuesNodes.push(itemNode);\n }\n });\n return { kind: Kind.LIST, values: valuesNodes };\n }\n return astFromValue(_value, itemType);\n }\n\n // Populate the fields of the input object by creating ASTs from each value\n // in the JavaScript object according to the fields in the input type.\n if (type instanceof _definition.GraphQLInputObjectType) {\n if (_value === null || (typeof _value === 'undefined' ? 'undefined' : _typeof(_value)) !== 'object') {\n return null;\n }\n var fields = type.getFields();\n var fieldNodes = [];\n Object.keys(fields).forEach(function (fieldName) {\n var fieldType = fields[fieldName].type;\n var fieldValue = astFromValue(_value[fieldName], fieldType);\n if (fieldValue) {\n fieldNodes.push({\n kind: Kind.OBJECT_FIELD,\n name: { kind: Kind.NAME, value: fieldName },\n value: fieldValue\n });\n }\n });\n return { kind: Kind.OBJECT, fields: fieldNodes };\n }\n\n !(type instanceof _definition.GraphQLScalarType || type instanceof _definition.GraphQLEnumType) ? (0, _invariant2.default)(0, 'Must provide Input Type, cannot use: ' + String(type)) : void 0;\n\n // Since value is an internally represented value, it must be serialized\n // to an externally represented value before converting into an AST.\n var serialized = type.serialize(_value);\n if ((0, _isNullish2.default)(serialized)) {\n return null;\n }\n\n // Others serialize based on their corresponding JavaScript scalar types.\n if (typeof serialized === 'boolean') {\n return { kind: Kind.BOOLEAN, value: serialized };\n }\n\n // JavaScript numbers can be Int or Float values.\n if (typeof serialized === 'number') {\n var stringNum = String(serialized);\n return (/^[0-9]+$/.test(stringNum) ? { kind: Kind.INT, value: stringNum } : { kind: Kind.FLOAT, value: stringNum }\n );\n }\n\n if (typeof serialized === 'string') {\n // Enum types use Enum literals.\n if (type instanceof _definition.GraphQLEnumType) {\n return { kind: Kind.ENUM, value: serialized };\n }\n\n // ID types can use Int literals.\n if (type === _scalars.GraphQLID && /^[0-9]+$/.test(serialized)) {\n return { kind: Kind.INT, value: serialized };\n }\n\n // Use JSON stringify, which uses the same string encoding as GraphQL,\n // then remove the quotes.\n return {\n kind: Kind.STRING,\n value: JSON.stringify(serialized).slice(1, -1)\n };\n }\n\n throw new TypeError('Cannot convert value to AST: ' + String(serialized));\n}",
"function astFromValue(value, type) {\n // Ensure flow knows that we treat function params as const.\n var _value = value;\n\n if (type instanceof _definition.GraphQLNonNull) {\n var astValue = astFromValue(_value, type.ofType);\n if (astValue && astValue.kind === Kind.NULL) {\n return null;\n }\n return astValue;\n }\n\n // only explicit null, not undefined, NaN\n if (_value === null) {\n return { kind: Kind.NULL };\n }\n\n // undefined, NaN\n if ((0, _isInvalid2.default)(_value)) {\n return null;\n }\n\n // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but\n // the value is not an array, convert the value using the list's item type.\n if (type instanceof _definition.GraphQLList) {\n var itemType = type.ofType;\n if ((0, _iterall.isCollection)(_value)) {\n var valuesNodes = [];\n (0, _iterall.forEach)(_value, function (item) {\n var itemNode = astFromValue(item, itemType);\n if (itemNode) {\n valuesNodes.push(itemNode);\n }\n });\n return { kind: Kind.LIST, values: valuesNodes };\n }\n return astFromValue(_value, itemType);\n }\n\n // Populate the fields of the input object by creating ASTs from each value\n // in the JavaScript object according to the fields in the input type.\n if (type instanceof _definition.GraphQLInputObjectType) {\n if (_value === null || (typeof _value === 'undefined' ? 'undefined' : _typeof(_value)) !== 'object') {\n return null;\n }\n var fields = type.getFields();\n var fieldNodes = [];\n Object.keys(fields).forEach(function (fieldName) {\n var fieldType = fields[fieldName].type;\n var fieldValue = astFromValue(_value[fieldName], fieldType);\n if (fieldValue) {\n fieldNodes.push({\n kind: Kind.OBJECT_FIELD,\n name: { kind: Kind.NAME, value: fieldName },\n value: fieldValue\n });\n }\n });\n return { kind: Kind.OBJECT, fields: fieldNodes };\n }\n\n !(type instanceof _definition.GraphQLScalarType || type instanceof _definition.GraphQLEnumType) ? (0, _invariant2.default)(0, 'Must provide Input Type, cannot use: ' + String(type)) : void 0;\n\n // Since value is an internally represented value, it must be serialized\n // to an externally represented value before converting into an AST.\n var serialized = type.serialize(_value);\n if ((0, _isNullish2.default)(serialized)) {\n return null;\n }\n\n // Others serialize based on their corresponding JavaScript scalar types.\n if (typeof serialized === 'boolean') {\n return { kind: Kind.BOOLEAN, value: serialized };\n }\n\n // JavaScript numbers can be Int or Float values.\n if (typeof serialized === 'number') {\n var stringNum = String(serialized);\n return (/^[0-9]+$/.test(stringNum) ? { kind: Kind.INT, value: stringNum } : { kind: Kind.FLOAT, value: stringNum }\n );\n }\n\n if (typeof serialized === 'string') {\n // Enum types use Enum literals.\n if (type instanceof _definition.GraphQLEnumType) {\n return { kind: Kind.ENUM, value: serialized };\n }\n\n // ID types can use Int literals.\n if (type === _scalars.GraphQLID && /^[0-9]+$/.test(serialized)) {\n return { kind: Kind.INT, value: serialized };\n }\n\n // Use JSON stringify, which uses the same string encoding as GraphQL,\n // then remove the quotes.\n return {\n kind: Kind.STRING,\n value: JSON.stringify(serialized).slice(1, -1)\n };\n }\n\n throw new TypeError('Cannot convert value to AST: ' + String(serialized));\n}",
"function Dataflow() {\n this._log = Object(__WEBPACK_IMPORTED_MODULE_12_vega_util__[\"C\" /* logger */])();\n this.logLevel(__WEBPACK_IMPORTED_MODULE_12_vega_util__[\"b\" /* Error */]);\n\n this._clock = 0;\n this._rank = 0;\n this._loader = Object(__WEBPACK_IMPORTED_MODULE_11_vega_loader__[\"a\" /* loader */])();\n\n this._touched = Object(__WEBPACK_IMPORTED_MODULE_10__util_UniqueList__[\"a\" /* default */])(__WEBPACK_IMPORTED_MODULE_12_vega_util__[\"q\" /* id */]);\n this._pulses = {};\n this._pulse = null;\n\n this._heap = new __WEBPACK_IMPORTED_MODULE_9__util_Heap__[\"a\" /* default */](function(a, b) { return a.qrank - b.qrank; });\n this._postrun = [];\n}",
"function Dataflow() {\n this._log = (0,vega_util__WEBPACK_IMPORTED_MODULE_12__.logger)();\n this.logLevel(vega_util__WEBPACK_IMPORTED_MODULE_12__.Error);\n\n this._clock = 0;\n this._rank = 0;\n try {\n this._loader = (0,vega_loader__WEBPACK_IMPORTED_MODULE_11__.loader)();\n } catch (e) {\n // do nothing if loader module is unavailable\n }\n\n this._touched = (0,_util_UniqueList__WEBPACK_IMPORTED_MODULE_10__.default)(vega_util__WEBPACK_IMPORTED_MODULE_12__.id);\n this._pulses = {};\n this._pulse = null;\n\n this._heap = new _util_Heap__WEBPACK_IMPORTED_MODULE_9__.default(function(a, b) { return a.qrank - b.qrank; });\n this._postrun = [];\n}",
"constructor(fields, data = {}) {\n fields.forEach((fieldDefinition) => {\n if (typeof fieldDefinition === \"string\") {\n this[fieldDefinition] = this.convertSimpleField(\n data[fieldDefinition],\n null\n );\n } else {\n // fieldDefinition must be an object\n let fieldName = fieldDefinition.name;\n let fieldType = fieldDefinition.type;\n let fieldIsList =\n typeof fieldDefinition.list !== \"undefined\"\n ? fieldDefinition.list\n : false;\n let fieldDefault =\n typeof fieldDefinition.default !== \"undefined\"\n ? this.getDefaultValue(fieldDefinition.default)\n : null;\n let fieldValue = data[fieldName];\n if (fieldIsList) {\n this[fieldName] = fieldValue\n ? fieldValue.map((item) =>\n this.convertField(fieldType, item, fieldDefault)\n )\n : fieldDefault;\n } else {\n this[fieldName] = this.convertField(\n fieldType,\n fieldValue,\n fieldDefault\n );\n }\n }\n });\n }",
"function adapter(data, name, types = {}) {\n if (data == null) return null;\n const type = types[name] || DEFTYPE;\n const ret = new type();\n if (typeof data == 'string') {\n ret._text = data;\n } else if (Array.isArray(data)) {\n throw new Error('Trying to wrap an array as a single object');\n } else {\n ret._attrs = data.$ || {};\n ret._text = data._;\n if (ret._text === undefined) ret._text = null;\n ret._source = name => wrapList(data[name], name, types);\n }\n return ret;\n}",
"function Dataflow() {\n this._log = logger();\n this.logLevel(Error$1);\n\n this._clock = 0;\n this._rank = 0;\n try {\n this._loader = loader();\n } catch (e) {\n // do nothing if loader module is unavailable\n }\n\n this._touched = UniqueList(id);\n this._pulses = {};\n this._pulse = null;\n\n this._heap = new Heap(function(a, b) { return a.qrank - b.qrank; });\n this._postrun = [];\n }",
"function Flow(id, map, identifier, loader, ioHandler, processManager) {\n\n var self = this;\n\n if (!id) {\n throw Error('xFlow requires an id');\n }\n\n if (!map) {\n throw Error('xFlow requires a map');\n }\n\n // Call the super's constructor\n Actor.apply(this, arguments);\n\n if (loader) {\n this.loader = loader;\n }\n if (ioHandler) {\n this.ioHandler = ioHandler;\n }\n\n if (processManager) {\n this.processManager = processManager;\n }\n\n // External vs Internal links\n this.linkMap = {};\n\n // indicates whether this is an action instance.\n this.actionName = undefined;\n\n // TODO: trying to solve provider issue\n this.provider = map.provider;\n\n this.providers = map.providers;\n\n this.actions = {};\n\n // initialize both input and output ports might\n // one of them be empty.\n if (!map.ports) {\n map.ports = {};\n }\n if (!map.ports.output) {\n map.ports.output = {};\n }\n if (!map.ports.input) {\n map.ports.input = {};\n }\n\n /*\n // make available always.\n node.ports.output['error'] = {\n title: 'Error',\n type: 'object'\n };\n */\n\n this.id = id;\n\n this.name = map.name;\n\n this.type = 'flow';\n\n this.title = map.title;\n\n this.description = map.description;\n\n this.ns = map.ns;\n\n this.active = false;\n\n this.metadata = map.metadata || {};\n\n this.identifier = identifier || [\n map.ns,\n ':',\n map.name\n ].join('');\n\n this.ports = JSON.parse(\n JSON.stringify(map.ports)\n );\n\n // Need to think about how to implement this for flows\n // this.ports.output[':complete'] = { type: 'any' };\n\n this.runCount = 0;\n\n this.inPorts = Object.keys(\n this.ports.input\n );\n\n this.outPorts = Object.keys(\n this.ports.output\n );\n\n //this.filled = 0;\n\n this.chi = undefined;\n\n this._interval = 100;\n\n // this.context = {};\n\n this.nodeTimeout = map.nodeTimeout || 3000;\n\n this.inputTimeout = typeof map.inputTimeout === 'undefined' ?\n 3000 :\n map.inputTimeout;\n\n this._hold = false; // whether this node is on hold.\n\n this._inputTimeout = null;\n\n this._openPorts = [];\n\n this._connections = new Connections();\n\n this._forks = [];\n\n debug('%s: addMap', this.identifier);\n this.addMap(map);\n\n this.fork = function() {\n\n var Fork = function Fork() {\n this.nodes = {};\n //this.context = {};\n\n // same ioHandler, tricky..\n // this.ioHandler = undefined;\n };\n\n // Pre-filled baseActor is our prototype\n Fork.prototype = this.baseActor;\n\n var FActor = new Fork();\n\n // Remember all forks for maintainance\n self._forks.push(FActor);\n\n // Each fork should have their own event handlers.\n self.listenForOutput(FActor);\n\n return FActor;\n\n };\n\n this.listenForOutput();\n\n this.initPortOptions = function() {\n\n // Init port options.\n for (var port in self.ports.input) {\n if (self.ports.input.hasOwnProperty(port)) {\n\n // This flow's port\n var thisPort = self.ports.input[port];\n\n // set port option\n if (thisPort.options) {\n for (var opt in thisPort.options) {\n if (thisPort.options.hasOwnProperty(opt)) {\n self.setPortOption(\n 'input',\n port,\n opt,\n thisPort.options[opt]);\n }\n }\n }\n\n }\n }\n };\n\n // Too late?\n this.setup();\n\n this.setStatus('created');\n\n}",
"function constructParams(types, data) {\n return types.map(function (type, i) {\n if (data && data[i]) {\n return new type(data[i]);\n }\n return new type();\n });\n}"
]
| [
"0.6014337",
"0.5861445",
"0.53727204",
"0.5016639",
"0.49903375",
"0.4984653",
"0.4975973",
"0.49730957",
"0.49730957",
"0.49670136",
"0.4927937",
"0.4919229",
"0.48817575",
"0.4831915",
"0.4805668",
"0.47669953",
"0.47496417",
"0.47432217",
"0.4739487",
"0.4725464",
"0.47015834",
"0.47011447",
"0.47011447",
"0.46587837",
"0.46509346",
"0.46376687",
"0.4621978",
"0.45902854",
"0.45755535",
"0.45523772"
]
| 0.6073683 | 0 |
This method creates a Flow using different modes from supplied arguments | static of(){
if( arguments.length == 0 )
return FlowFactory.getFlow([]);
if( arguments.length > 1 )
return FlowFactory.getFlow(arguments);
if( arguments.length == 1 && Util.isNumber(arguments[0]) )
return new IteratorFlow(FlowFactory.createIteratorWithEmptyArraysFromNumber(arguments[0]));
return FlowFactory.getFlow(arguments[0]);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"createFlow() {\n // Very simple random unique ID generator\n this.formattedFlow.flowId = `${new Date().getTime()}`;\n this.formattedFlow.flowName = this.originalFlow.flow;\n this.formattedFlow.comment = this.originalFlow.comment;\n this.formattedFlow.startAt = this.originalFlow.startAt;\n this.formattedFlow.states = Object.assign({}, this.originalFlow.states);\n this.formattedFlow.flowStartTime = new Date().getTime();\n this.formattedFlow.flowExecutionTime = '';\n\n return { isError: false, code: this.code, item: this.formattedFlow };\n }",
"function Flow(nodeList, flows, node, type) {\n this.nodeList = nodeList;\n this.flows = flows;\n this.node = node;\n this.type = type;\n}",
"static from(data){\n return FlowFactory.getFlow(data);\n }",
"static createEmbed(flowMode, renderInfo) {\n return new this({text: AtomicText, flowMode, renderInfo});\n }",
"[actions.OPEN_CREATE_MODE] () {\n this.commit(mutations.SET_CREATE_MODE, true)\n }",
"function flow(flowName, states, beginArgs) {\n var name = flowName;\n var activePhases = {};\n var flowStatus = \"created\";\n var statesRegister = {};\n var joinsRegister = {};\n var self = this;\n var currentPhase = undefined;\n var states = states;\n\n function attachStatesToFlow(states) {\n\n function registerState(state) {\n function wrapUpdates(stateName) {\n\n var dynamicMotivation = undefined;\n\n function WHYDynamicResolver() {\n function toBeExecutedWithWHY() {\n var parentPhase = currentPhase;\n currentPhase = stateName;\n registerNewFunctionCall(stateName);\n var ret = states[stateName].apply(self, mkArgs(arguments, 0));\n makePhaseUpdatesAfterCall(stateName);\n currentPhase = parentPhase;\n return ret;\n }\n\n toBeExecutedWithWHY.why = dummyWhy;\n return addErrorTreatment(toBeExecutedWithWHY.why(decideMotivation(self, state))).apply(self, mkArgs(arguments, 0))\n }\n\n function decideMotivation(flow, stateName) {\n if (dynamicMotivation === undefined) {\n if (flow.getCurrentPhase()) {\n motivation = flow.getCurrentPhase() + \" to \" + stateName;\n } else {\n motivation = stateName;\n }\n } else {\n motivation = dynamicMotivation;\n }\n dynamicMotivation = undefined;\n return motivation;\n }\n\n WHYDynamicResolver.why = function (motivation) {\n dynamicMotivation = motivation;\n return this;\n }\n return WHYDynamicResolver;\n }\n\n statesRegister[state] = {\n code: states[state],\n joins: []\n }\n\n self[state] = wrapUpdates(state);\n }\n\n function registerJoin(join) {\n joinsRegister[join] = {\n code: states[join].code,\n inputStates: {},\n tryOnNextTick: false\n }\n\n var inStates = states[state].join.split(',');\n inStates.forEach(function (input) {\n input = input.trim();\n joinsRegister[join].inputStates[input] = {\n calls: 0,\n finishedCalls: 0\n };\n })\n\n }\n\n function joinStates() {\n for (var join in joinsRegister) {\n for (var inputState in joinsRegister[join].inputStates) {\n statesRegister[inputState].joins.push(join);\n }\n }\n }\n\n self.error = function (error) {\n if (error) {\n var motivation = currentPhase + \" failed\";\n if (states['error'] !== undefined) {\n states['error'].why = dummyWhy;\n states['error'].why(motivation).apply(self, [error]);\n }\n else {\n function defaultErrorWHY(error) {\n if (error) {\n console.error(self.getCurrentPhase() + \" failed\");\n console.log(error.stack);\n }\n }\n\n defaultErrorWHY.why = dummyWhy;\n\n defaultErrorWHY.why(motivation)(error);\n }\n }\n }\n\n for (var state in states) {\n\n if (state == \"error\") {\n continue;\n }\n\n if (typeof states[state] === \"function\") {\n registerState(state);\n }\n else {\n registerJoin(state);\n }\n }\n joinStates();\n }\n\n this.next = function () {\n process.nextTick(this.continue.apply(this, mkArgs(arguments, 0)));\n }\n\n function registerNewFunctionCall(stateName) {\n\n updateStatusBeforeCall(stateName);\n notifyJoinsOfNewCall(stateName);\n\n function notifyJoinsOfNewCall(stateName) {\n statesRegister[stateName].joins.forEach(function (join) {\n joinsRegister[join].inputStates[stateName]['calls']++\n });\n }\n }\n\n this.getStatus = function () {\n return flowStatus;\n };\n this.getCurrentPhase = function () {\n return currentPhase;\n }\n this.getActivePhases = function () {\n return activePhases;\n };\n this.getName = function () {\n return name;\n }\n\n function updateStatusBeforeCall(stateName) {\n if (activePhases[stateName] == undefined) {\n activePhases[stateName] = 1;\n } else {\n activePhases[stateName]++;\n }\n }\n\n function updateStatusAfterCall(stateName) {\n activePhases[stateName]--;\n\n if (activePhases[stateName] === 0) {\n var done = true;\n for (var phase in activePhases) {\n if (activePhases[phase] > 0) {\n done = false;\n break;\n }\n }\n if (done) {\n flowStatus = \"done\";\n }\n }\n }\n\n function makePhaseUpdatesAfterCall(stateName) {\n updateJoinsAfterCall(stateName);\n updateStatusAfterCall(stateName);\n\n function updateJoinsAfterCall(stateName) {\n statesRegister[stateName].joins.forEach(function (joinName) {\n joinsRegister[joinName].inputStates[stateName]['finishedCalls']++;\n if (joinsRegister[joinName]['tryOnNextTick'] === false) {\n joinsRegister[joinName]['tryOnNextTick'] = true;\n var caller = null;\n try {\n if (global.__global__enable_RUN_WITH_WHYS) {\n caller = whys.getGlobalCurrentContext().currentRunningItem;\n }\n } catch (err) {\n }\n ; //TODO: strange, refactoring\n updateStatusBeforeCall(joinName);\n var parentPhase = self.getCurrentPhase();\n process.nextTick(function () {\n tryRunningJoin(joinName, caller, parentPhase);\n updateStatusAfterCall(joinName);\n })\n }\n });\n\n\n function tryRunningJoin(joinName, caller, parentPhase) {\n\n joinsRegister[joinName]['tryOnNextTick'] = false;\n\n function joinReady(joinName) {\n var join = joinsRegister[joinName];\n var gotAllInputs = true;\n for (var inputState in join.inputStates) {\n if (join.inputStates[inputState]['finishedCalls'] == 0) {\n gotAllInputs = false;\n break;\n }\n if (join.inputStates[inputState]['finishedCalls'] != join.inputStates[inputState]['calls']) {\n gotAllInputs = false;\n break;\n }\n }\n return gotAllInputs;\n }\n\n async function runJoin(joinName) {\n var currentPhase = joinName;\n updateStatusBeforeCall(joinName);\n reinitializeJoin(joinName);\n await joinsRegister[joinName].code.apply(self, []);\n updateStatusAfterCall(joinName);\n currentPhase = parentPhase;\n\n function reinitializeJoin(joinName) {\n for (var inputState in joinsRegister[joinName].inputStates) {\n joinsRegister[joinName].inputStates = {\n calls: 0,\n finishedCalls: 0\n }\n }\n }\n }\n\n runJoin.why = dummyWhy;\n\n if (joinReady(joinName)) {\n var toRun = runJoin.why(decideMotivation(self, joinName, joinName), caller);\n toRun = addErrorTreatment(toRun);\n toRun(joinName);\n }\n\n function decideMotivation(flow, joinName, stateName) {\n return parentPhase + \" to \" + joinName;\n }\n\n }\n }\n }\n\n\n this.continue = function () {\n var stateName = arguments[0];\n var motivation = arguments[1];\n\n if (!motivation) {\n motivation = self.getCurrentPhase() + \" to \" + stateName;\n }\n var args = mkArgs(arguments, 2);\n registerNewFunctionCall(stateName);\n\n var continueFn = async function () {\n currentPhase = stateName;\n\n if (args.length == 0) {\n args = mkArgs(arguments, 0)\n }\n await statesRegister[stateName].code.apply(self, args);\n makePhaseUpdatesAfterCall(stateName);\n };\n continueFn.why = dummyWhy;\n\n return addErrorTreatment(continueFn.why(motivation));\n };\n\n function addErrorTreatment(func) {\n async function flowErrorTreatmentWHY() {\n try {\n return await func.apply(this, mkArgs(arguments, 0));\n }\n catch (error) {\n flowStatus = \"failed\";\n return self.error(error);\n }\n }\n\n return flowErrorTreatmentWHY;\n }\n\n\n attachStatesToFlow(states);\n flowStatus = \"running\";\n\n function startFlow() {\n self.begin.apply(this, beginArgs);\n }\n\n startFlow.why = dummyWhy;\n startFlow.why(flowName)();\n return this;\n}",
"function flow(from, rate, to) {\n\tto = to || universe;\n\treturn { from:from, rate:rate, to:to };\n}",
"function Flow(id, map, identifier, loader, ioHandler, processManager) {\n\n var self = this;\n\n if (!id) {\n throw Error('xFlow requires an id');\n }\n\n if (!map) {\n throw Error('xFlow requires a map');\n }\n\n // Call the super's constructor\n Actor.apply(this, arguments);\n\n if (loader) {\n this.loader = loader;\n }\n if (ioHandler) {\n this.ioHandler = ioHandler;\n }\n\n if (processManager) {\n this.processManager = processManager;\n }\n\n // External vs Internal links\n this.linkMap = {};\n\n // indicates whether this is an action instance.\n this.actionName = undefined;\n\n // TODO: trying to solve provider issue\n this.provider = map.provider;\n\n this.providers = map.providers;\n\n this.actions = {};\n\n // initialize both input and output ports might\n // one of them be empty.\n if (!map.ports) {\n map.ports = {};\n }\n if (!map.ports.output) {\n map.ports.output = {};\n }\n if (!map.ports.input) {\n map.ports.input = {};\n }\n\n /*\n // make available always.\n node.ports.output['error'] = {\n title: 'Error',\n type: 'object'\n };\n */\n\n this.id = id;\n\n this.name = map.name;\n\n this.type = 'flow';\n\n this.title = map.title;\n\n this.description = map.description;\n\n this.ns = map.ns;\n\n this.active = false;\n\n this.metadata = map.metadata || {};\n\n this.identifier = identifier || [\n map.ns,\n ':',\n map.name\n ].join('');\n\n this.ports = JSON.parse(\n JSON.stringify(map.ports)\n );\n\n // Need to think about how to implement this for flows\n // this.ports.output[':complete'] = { type: 'any' };\n\n this.runCount = 0;\n\n this.inPorts = Object.keys(\n this.ports.input\n );\n\n this.outPorts = Object.keys(\n this.ports.output\n );\n\n //this.filled = 0;\n\n this.chi = undefined;\n\n this._interval = 100;\n\n // this.context = {};\n\n this.nodeTimeout = map.nodeTimeout || 3000;\n\n this.inputTimeout = typeof map.inputTimeout === 'undefined' ?\n 3000 :\n map.inputTimeout;\n\n this._hold = false; // whether this node is on hold.\n\n this._inputTimeout = null;\n\n this._openPorts = [];\n\n this._connections = new Connections();\n\n this._forks = [];\n\n debug('%s: addMap', this.identifier);\n this.addMap(map);\n\n this.fork = function() {\n\n var Fork = function Fork() {\n this.nodes = {};\n //this.context = {};\n\n // same ioHandler, tricky..\n // this.ioHandler = undefined;\n };\n\n // Pre-filled baseActor is our prototype\n Fork.prototype = this.baseActor;\n\n var FActor = new Fork();\n\n // Remember all forks for maintainance\n self._forks.push(FActor);\n\n // Each fork should have their own event handlers.\n self.listenForOutput(FActor);\n\n return FActor;\n\n };\n\n this.listenForOutput();\n\n this.initPortOptions = function() {\n\n // Init port options.\n for (var port in self.ports.input) {\n if (self.ports.input.hasOwnProperty(port)) {\n\n // This flow's port\n var thisPort = self.ports.input[port];\n\n // set port option\n if (thisPort.options) {\n for (var opt in thisPort.options) {\n if (thisPort.options.hasOwnProperty(opt)) {\n self.setPortOption(\n 'input',\n port,\n opt,\n thisPort.options[opt]);\n }\n }\n }\n\n }\n }\n };\n\n // Too late?\n this.setup();\n\n this.setStatus('created');\n\n}",
"function FlowCalculator(step) {\n this.step = step || 8;\n}",
"function Flow(opt) {\n\topt = typeof opt === \"undefined\" ? {} : opt;\n\tvar sopt = {};\n\tif (typeof opt.surface === \"undefined\") {\n\t\tsopt = {\n\t\t\tcolor:\"#000\",\n\t\t\ttool:\"pen\",\n\t\t\tstrokeWidth:3\n\t\t};\n\t}\n\tsopt.color = typeof opt.color === \"undefined\" ? sopt.color : opt.color;\n\tsopt.tool = typeof opt.tool === \"undefined\" ? sopt.tool : opt.tool;\n\tsopt.strokeWidth = typeof opt.strokeWidth === \"undefined\" ? sopt.strokeWidth : opt.strokeWidth;\n\t\n\tthis.p = [];\n\t//If points have been supplied\n\tif(typeof opt.points !== \"undefined\") {\n\t\tthis.s = hiddensurface;\n\t\tthis.start(opt.points[0]);\n\t\tthis.p = opt.points;\n\t\tthis.redraw();\n\t\t//If no surface has been supplied\n\t\tif (typeof opt.surface === \"undefined\") {\n\t\t\t$.extend(sopt, {\n\t\t\t\tx:this.minx - (2*sopt.strokeWidth),\n\t\t\t\ty:this.miny - (2*sopt.strokeWidth),\n\t\t\t\toffsetx:this.minx - (2*sopt.strokeWidth),\n\t\t\t\toffsety:this.miny - (2*sopt.strokeWidth),\n\t\t\t\tw:this.maxx - this.minx + (4*sopt.strokeWidth),\n\t\t\t\th:this.maxy - this.miny + (4*sopt.strokeWidth)\n\t\t\t});\n\t\t}\n\t}\n\tif (typeof opt.surface === \"undefined\") {\n\t\topt.surface = new Surface(sopt);\n\t}\n\t\n\tif(typeof opt.color != \"undefined\") {opt.surface.color(opt.color);}\n\tif(typeof opt.tool != \"undefined\") {opt.surface.tool(opt.tool);}\n\tif(typeof opt.strokeWidth != \"undefined\") {opt.surface.strokeWidth(opt.strokeWidth);}\n\t\n\tthis.s = opt.surface;\n\tthis.c = this.s.color();\n\tthis.t = this.s.tool();\n\tthis.sw = this.s.strokeWidth();\n\tthis.redraw();\n this.lasttime = new Date().getTime();\n}",
"function L() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (Factory.DEBUG) _vex__WEBPACK_IMPORTED_MODULE_0__[\"Vex\"].L('Vex.Flow.Factory', args);\n}",
"create(context) {\n freezeDeeply(context.options);\n freezeDeeply(context.settings);\n freezeDeeply(context.parserOptions);\n\n // freezeDeeply(context.languageOptions);\n\n return (typeof rule === \"function\" ? rule : rule.create)(context);\n }",
"select(func){\n var flow = new Flow();\n if( Util.isFunction(func) )\n flow.pipeFunc = func;\n else{\n flow.pipeFunc = function(input){\n return input[func];\n };\n }\n\n setRefs(this, flow);\n\n return flow;\n }",
"initFlow() {\n if (this.validateFlow() == SUCCESS.VALIDATED) {\n this.code = SUCCESS.VALIDATED;\n return this.createFlow();\n }\n return { isError: true, code: this.code, item: this.originalFlow };\n }",
"startWorkflow(flow) {\n // custom id management\n let customId = null;\n if (typeof flow.id === \"function\") {\n // customId can be a value or a function\n customId = flow.id();\n // customId should be a string or a number\n if (typeof customId !== \"string\" && typeof customId !== \"number\") {\n throw new InvalidArgumentError(\n `Provided id must be a string or a number - current type: ${typeof customId}`,\n );\n }\n // at the end, it's a string\n customId = customId.toString();\n // should be not more than 256 bytes;\n if (customId.length >= MAX_ID_SIZE) {\n throw new ExternalZenatonError(\n `Provided id must not exceed ${MAX_ID_SIZE} bytes`,\n );\n }\n }\n\n const url = this.getInstanceWorkerUrl();\n\n // start workflow\n const body = {\n [ATTR_PROG]: PROG,\n [ATTR_CANONICAL]: flow._getCanonical(),\n [ATTR_NAME]: flow.name,\n [ATTR_DATA]: serializer.encode(flow.data),\n [ATTR_ID]: customId,\n };\n\n const params = this.getAppEnv();\n\n return http.post(url, body, { params });\n }",
"function limitFlow(period) {\n return function limitFlow(stream) {\n var source = new RateLimitSource(stream.source, period);\n return new stream.constructor(source);\n };\n}",
"function dataflow() {\n var Flow = window.Flow;\n Flow.Dataflow = function () {\n return {\n slot: createSlot,\n slots: createSlots,\n signal: createSignal,\n signals: createSignals,\n isSignal: _isSignal,\n link: _link,\n unlink: _unlink,\n act: _act,\n react: _react,\n lift: _lift,\n merge: _merge\n };\n }();\n }",
"function setupFlowplayer() {\t\t\n\t\t\tflowplayer(\"a.flow-player-rtmp\", {src: \"/swf/flowplayer-3.1.0.swf\", wmode: \"transparent\"}, {\n\t\t\t\tkey: '#@0c6f31cd2fcf37df4b1',\n\t\t\t\tclip: { \n\t\t\t\t\turl: $('a .flow-player-rtmp').attr('href'),\n\t\t\t\t\tprovider: 'influxis',\n\t\t\t\t\tautoPlay: true,\n\t\t\t\t\tautoBuffering: true \n\t\t\t\t},\n\t\n\t\t\t\tplugins: {\n\t\t\t\t\tinfluxis: {\n\t\t\t\t\t\turl: \t\t\t\t'/swf/flowplayer.rtmp-3.1.0.swf', \n\t\t\t\t\t\tnetConnectionUrl:\trtmpServer\n\t\t\t\t\t},\n\t\t\t\t\tcontrols: {\n\t\t\t\t\t\turl: '/swf/flowplayer.controls-3.1.0.swf', \n\t\t\t\t\t\tfullscreen: true,\n\t\t\t\t\t\tautoHide: 'always',\n\t\t\t\t\t\thideDelay: 1000\n\t\t\t\t }\n\t\t\t\t},\n\n\t\t\t\tmenu: false,\n\t\t\t\tloop: false\n\t\t\t});\n\t\t\t\n\t\t\tflowplayer(\"a.flow-player-local\", {src: \"/swf/flowplayer-3.1.0.swf\", wmode: \"transparent\"}, {\n\t\t\t\tkey: '#@0c6f31cd2fcf37df4b1',\n\t\t\t\tclip: { \n\t\t\t\t\turl: $('a .flow-player-local').attr('href'),\n\t\t\t\t\tautoplay: false\n\t\t\t \n\t\t\t\t},\n\t\n\t\t\t\tplugins: {\n\t\t\t\t\tcontrols: {\n\t\t\t\t\t\turl: '/swf/flowplayer.controls-3.1.0.swf', \n\t\t\t\t\t\tfullscreen: true,\n\t\t\t\t\t\tautoHide: 'always',\n\t\t\t\t\t\thideDelay: 1000\n\t\t\t\t }\n\t\t\t\t},\n\n\t\t\t\tmenu: false,\n\t\t\t\tloop: false\n\t\t\t});\n\t\t}",
"constructor(options,opts){\n super(options) //Passing options to native constructor (REQUIRED)\n\n this.id = opts.id;\n\n this.name = 'Environment tx access port for radio ' + this.id;\n this.pipeType = {in:{type:'IFloat',chunk:'any'},out:{type:'any',chunk:'any'}}; // out doesn't matter here\n this.on('pipe', this.pipeTypeCheck.bind(this));\n }",
"getFlow() {\n return new NgFlowchart.Flow(this.canvas);\n }",
"function FlowRecognizer(settings) {\n _classCallCheck(this, FlowRecognizer);\n\n this.settings = settings || {};\n this.initializeModels();\n }",
"function sourceFactory(srcType) {\n switch (srcType) {\n case sourceTypes.rest:\n return (data) => undefined; // No data should be sent during this source anyway.\n case sourceTypes.tap:\n return (data) => 100;\n case sourceTypes.taprate:\n return (data) => (data[0] > 300 ? 300 : data[0]) / 3;\n case sourceTypes.text:\n return (data) => data[0].length === 1 ? undefined : data[0].length > 100 ? 100 : data[0].length;\n case sourceTypes.orient:\n return (data) => ((data[0] / 3.6) + ((data[1] + 180) / 3.6) + ((data[2] + 90) / 1.8)) / 3;\n case sourceTypes.orienta:\n return (data) => data[0] / 3.6;\n case sourceTypes.orientb:\n return (data) => (data[0] + 180) / 3.6;\n case sourceTypes.orientg:\n return (data) => (data[0] + 90) / 1.8;\n case sourceTypes.accel: // TODO Because this is acceleration, every time the direction changes or reaches a constant speed it goes back to 0 briefly. Come up with a way to work around this.\n return (data) => {\n let x = Math.abs(data[0]) * 10;\n x = x > 100 ? 100 : x; // TODO Abstract this kind of logic to a function, this is messy.\n let y = Math.abs(data[1]) * 10;\n y = y > 100 ? 100 : y;\n let z = Math.abs(data[2]) * 10;\n z = z > 100 ? 100 : z;\n return (x + y + z) / 3; // TODO This average isn't quite the best way of representing the vector of direction as a scalar, revisit at a later time.\n }\n case sourceTypes.accelx:\n case sourceTypes.accely:\n case sourceTypes.accelz:\n return (data) => {\n let num = Math.abs(data[0]) * 10;\n return num > 100 ? 100 : num;\n }\n case sourceTypes.xypad:\n return (data) => (data[0] + data[1]) / 2;\n case sourceTypes.swipe:\n return (data) => data[0] ? 100 : 0;\n }\n}",
"async function dataFlowsCreate() {\n const subscriptionId =\n process.env[\"DATAFACTORY_SUBSCRIPTION_ID\"] || \"12345678-1234-1234-1234-12345678abc\";\n const resourceGroupName = process.env[\"DATAFACTORY_RESOURCE_GROUP\"] || \"exampleResourceGroup\";\n const factoryName = \"exampleFactoryName\";\n const dataFlowName = \"exampleDataFlow\";\n const dataFlow = {\n properties: {\n type: \"MappingDataFlow\",\n description:\n \"Sample demo data flow to convert currencies showing usage of union, derive and conditional split transformation.\",\n scriptLines: [\n \"source(output(\",\n \"PreviousConversionRate as double,\",\n \"Country as string,\",\n \"DateTime1 as string,\",\n \"CurrentConversionRate as double\",\n \"),\",\n \"allowSchemaDrift: false,\",\n \"validateSchema: false) ~> USDCurrency\",\n \"source(output(\",\n \"PreviousConversionRate as double,\",\n \"Country as string,\",\n \"DateTime1 as string,\",\n \"CurrentConversionRate as double\",\n \"),\",\n \"allowSchemaDrift: true,\",\n \"validateSchema: false) ~> CADSource\",\n \"USDCurrency, CADSource union(byName: true)~> Union\",\n \"Union derive(NewCurrencyRate = round(CurrentConversionRate*1.25)) ~> NewCurrencyColumn\",\n \"NewCurrencyColumn split(Country == 'USD',\",\n \"Country == 'CAD',disjoint: false) ~> ConditionalSplit1@(USD, CAD)\",\n \"ConditionalSplit1@USD sink(saveMode:'overwrite' ) ~> USDSink\",\n \"ConditionalSplit1@CAD sink(saveMode:'overwrite' ) ~> CADSink\",\n ],\n sinks: [\n {\n name: \"USDSink\",\n dataset: { type: \"DatasetReference\", referenceName: \"USDOutput\" },\n },\n {\n name: \"CADSink\",\n dataset: { type: \"DatasetReference\", referenceName: \"CADOutput\" },\n },\n ],\n sources: [\n {\n name: \"USDCurrency\",\n dataset: {\n type: \"DatasetReference\",\n referenceName: \"CurrencyDatasetUSD\",\n },\n },\n {\n name: \"CADSource\",\n dataset: {\n type: \"DatasetReference\",\n referenceName: \"CurrencyDatasetCAD\",\n },\n },\n ],\n },\n };\n const credential = new DefaultAzureCredential();\n const client = new DataFactoryManagementClient(credential, subscriptionId);\n const result = await client.dataFlows.createOrUpdate(\n resourceGroupName,\n factoryName,\n dataFlowName,\n dataFlow\n );\n console.log(result);\n}",
"setToPedCreate(){\n\t\tButtonModes.__switchMode(arguments.callee.name)\n\t}",
"switchMode(newMode: Mode) {\n this.mode = newMode;\n }",
"constructor({id=this.generateId(), text='', renderInfo=Empty, flowMode, isAtomic=false}) {\n this.id = id;\n this.text = text;\n this.flowMode = flowMode;\n this.isAtomic = isAtomic;\n this.renderInfo = renderInfo;\n if (isAtomic && !text) {\n this.text = AtomicText;\n }\n this.count = this.text.length;\n }",
"function showFlow (flows) {\n \n var position = window.camera.getFocus().position;\n var indice = 0;\n\n window.camera.enable();\n window.camera.move(position.x, position.y, position.z + window.TILE_DIMENSION.width * 5);\n \n setTimeout(function() {\n \n actualFlow = [];\n \n for(var i = 0; i < flows.length; i++) {\n actualFlow.push(flows[i]);\n flows[i].draw(position.x, position.y, 0, indice, i);\n \n //Dummy, set distance between flows\n position.x += window.TILE_DIMENSION.width * 10;\n }\n \n }, 1500);\n }",
"function startNewMode(mode) {\n var node\n\n if (mode.className) {\n node = build(mode.className, [])\n }\n\n // Enter a new mode.\n if (node) {\n currentChildren.push(node)\n stack.push(currentChildren)\n currentChildren = node.children\n }\n\n top = Object.create(mode, {parent: {value: top}})\n }",
"function TransitionFactory(type, totalImages) {\n\n if(type == TRANSITIONS.fade){\n return new FadeTransition(totalImages);\n }else if (type == TRANSITIONS.slide) {\n return new SlideTransition(totalImages);\n }else{\n console.error(\"This transition is not yet supported\");\n }\n}",
"setMode(mode) {\n this._mode = mode;\n }"
]
| [
"0.5705125",
"0.56897783",
"0.5656588",
"0.5529257",
"0.5344734",
"0.51809794",
"0.5176161",
"0.5161175",
"0.5136103",
"0.5111144",
"0.50556713",
"0.5043777",
"0.5017146",
"0.49989784",
"0.49793434",
"0.49251306",
"0.48796272",
"0.48600587",
"0.48528117",
"0.48454717",
"0.48364922",
"0.4795983",
"0.47899118",
"0.47851983",
"0.47334087",
"0.47237733",
"0.46963555",
"0.46962637",
"0.46747825",
"0.46612567"
]
| 0.5701238 | 1 |
This creates a Flow from a range of numbers. It is assumed that end > start | static fromRange(start, end){
return FlowFactory.getFlow([...new Array(end - start + 1).keys()].map((elem) => elem + start));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createRange(start, end, step) {\n return new Range(\n type.isBigNumber(start) ? start.toNumber() : start,\n type.isBigNumber(end) ? end.toNumber() : end,\n type.isBigNumber(step) ? step.toNumber() : step\n );\n }",
"function createRange(start, end, step) {\n return new Range(type.isBigNumber(start) ? start.toNumber() : start, type.isBigNumber(end) ? end.toNumber() : end, type.isBigNumber(step) ? step.toNumber() : step);\n }",
"function createRange(start, end, step) {\n return new Range((0, _is.isBigNumber)(start) ? start.toNumber() : start, (0, _is.isBigNumber)(end) ? end.toNumber() : end, (0, _is.isBigNumber)(step) ? step.toNumber() : step);\n }",
"range(startIndex, endIndex){\n if( startIndex < 0 )\n throw new Error(\"Start Index cannot be negative\");\n if( endIndex <= 0 )\n throw new Error(\"End Index must be greater than 0\");\n if( startIndex > endIndex )\n throw new Error(\"End Index cannot be less than Start Index\");\n\n var flow = new RangeMethodFlow(startIndex, endIndex);\n setRefs(this, flow);\n\n return flow;\n }",
"function genRange(start, end) {\n var range = [];\n while (start <= end) {\n range.push(start);\n start += 1;\n }\n return range;\n }",
"function createRange(start, end) {\n const range = Array.from({ length: end - start + 1 }, function(item, index) {\n return index + start;\n });\n return range;\n}",
"function range(start, end) {\n //Input sanitization\n if (!start && !end) return \"Please provide both start and end points\";\n if (!end) return \"Please provide an endpoint\";\n if (isNaN(start) || isNaN(end))\n return \"Both start and end points must be numbers\";\n\n let arr = [];\n while (start <= end) {\n arr.push(start);\n start++;\n }\n return arr;\n}",
"function NumberRangeGenerator(lb, ub){\n\tthis.lb = lb\n\tthis.ub = ub\n}",
"function generateRange(min, max, step){\n var ar = [];\n var n = min;\n while (n <= max) {\n ar.push(n);\n n = n + step;\n }\n return ar;\n \n}",
"function Range(from,to) {\n this.from=from;\n this.to=to;\n}",
"function createRange(end) {\n if (end === 0) {\n return [];\n }\n var results = [];\n var current = 1;\n var step = 0 <= end ? 1 : -1;\n\n results.push(current);\n\n while (current !== end) {\n current += step;\n results.push(current);\n }\n\n return results;\n}",
"function range(start, end, step=1) {\n // Your code here\n var list = [];\n var counter = 0;\n if(typeof step === \"undefined\"){\n step = 1;\n }\n for(var i = start; i!=end+step; i= i+step){\n list[counter] = i;\n counter++;\n }\n return list;\n}",
"function range(a) {\n let start = arguments.length > 1 ? a : 0;\n let end = arguments.length > 1 ? arguments[1] : a;\n let step = arguments.length > 2 ? arguments[2] : 1;\n let sgn = Math.sign(step);\n if (!sgn) return [];\n let list = [];\n for (let i = start; i*sgn < end*sgn; i += step) {\n list.push(i);\n }\n return list;\n}",
"function generateRange(start,end,step) {\n return Array.from(Array(Math.floor((end-start)/step)+1).keys()).map((i)=>i*step+start);\n}",
"function range(start, end, step) {\n const len = Math.floor((end - start) / step) + 1\n return Array(len).fill().map((_, idx) => start + (idx * step))\n}",
"__range(start, end) {\n\n let value = tf.linspace(start, end, (end - start) + 1).arraySync();\n return value;\n }",
"function numberRange (start, end) {\n return new Array(end - start).fill().map((d, i) => i + start);\n}",
"function range(start, end) {\r\n\tif (end === undefined) {\r\n\t\tend = start;\r\n\t\tstart = 0;\r\n\t}\r\n\tlet res = []; //newArray(end-start,0);\r\n\tstart = start | 0;\r\n\tfor (let i = start; i < end; i++) res.push(i);\r\n\treturn res;\r\n}",
"constructor(start: number, stop: number) {\n this.start = start;\n this.stop = stop;\n }",
"function generateRange(min, max, step) {\n\t// create an array container to put elements into\n\tconst container = [];\n\t// iterate start at min and end at max incrementing step\n\tfor (let i = min; i <= max; i += step) {\n\t\t// push into container i\n\t\tcontainer.push(i);\n\t}\n\t// return container\n\treturn container;\n}",
"function RangeSeq( from, to ) {\n this.value = from - 1; // .next() is called before logging & .next() will increment this.value\n this.to = to;\n}",
"function makeNumberSequence(start, end) {\n var arr = [];\n\n for (var i = start; i <= end; i++) {\n arr.push(i);\n }\n\n return arr;\n}",
"function createArrayFromAtoB(start, end){\n var range = [];\n while (start <= end){\n range.push(start);\n start ++;\n }\n return range;\n}",
"function range(start, end) {\n return Array(end - start + 1).fill().map((_, idx) => start + idx)\n}",
"function range(start, end) {\n // YOUR CODE GOES BELOW HERE //\n // declaring and assigning the variable range to an empty array\n let range = [];\n \n // conditional statement that runs if start is less than end parameter\n if(start < end) {\n \n /** for loop that initialzies i as the starting number and will iterate\n * by 1 each time i is less than or equal to end */\n for(var i = start; i <= end; i++) {\n // using push method to push i to range array each time loop runs\n range.push(i);\n }\n // conditional else that runs if start is greater than end\n } else {\n /** for loop that initialzies i as the start number and will iterate\n * by 1 each time i is greater than or equal to end */\n for(var i = start; i >= end; i--) {\n // using push method to push i to range array each time loop runs\n range.push(i)\n }\n // returning range array\n } return range\n \n // YOUR CODE GOES ABOVE HERE //\n}",
"function range (start, end) {\n var step = 1;\n if (arguments.length == 3) {\n\tstep = arguments[2];\n }\n\n var result = [];\n \n if (step < 0) {\n\tfor(var i = start; i >= end; i += step) {\n\t result.push(i);\n\t}\n } else {\n\tfor(var i = start; i <= end; i += step) {\n\t result.push(i);\n\t}\n }\n\n return result;\n}",
"function generateRange(min, max, step) {\n let arr = []\n for (let i = min; i <= max; i += step) {\n arr.push(i)\n }\n return arr\n}",
"function range(start, count) {\n if (!utils_1.isNumber(start))\n throw new Error(\"Expect 'start' parameter to 'dataForge.range' function to be a number.\");\n if (!utils_1.isNumber(count))\n throw new Error(\"Expect 'count' parameter to 'dataForge.range' function to be a number.\");\n var values = [];\n for (var valueIndex = 0; valueIndex < count; ++valueIndex) {\n values.push(start + valueIndex);\n }\n return new _1.Series(values);\n}",
"function range(end, start=1) {\n return Array(end - start + 1).fill().map((_, idx) => start + idx)\n}",
"function range(start, end) {\n\t if (end === undefined) {\n\t end = start;\n\t start = 0;\n\t }\n\t let res = []; //newArray(end-start,0);\n\t start = start | 0;\n\t for (let i = start; i < end; i++) res.push(i);\n\t return res;\n\t}"
]
| [
"0.6557774",
"0.6553659",
"0.65510285",
"0.65236956",
"0.65049326",
"0.64819974",
"0.6318393",
"0.62468153",
"0.6182466",
"0.61631614",
"0.61609024",
"0.6149031",
"0.6106702",
"0.6085905",
"0.6048761",
"0.60284626",
"0.6016698",
"0.6012064",
"0.5992934",
"0.59705955",
"0.59591883",
"0.59485924",
"0.59230596",
"0.59111845",
"0.590238",
"0.58834267",
"0.58718765",
"0.58649576",
"0.5861336",
"0.58611774"
]
| 0.7746055 | 0 |
This is a direct method to create a Flow from file. | static fromFile(file){
return new IteratorFlow(FlowFactory.createIteratorFromFileSystem(file));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static from(data){\n return FlowFactory.getFlow(data);\n }",
"createFlow() {\n // Very simple random unique ID generator\n this.formattedFlow.flowId = `${new Date().getTime()}`;\n this.formattedFlow.flowName = this.originalFlow.flow;\n this.formattedFlow.comment = this.originalFlow.comment;\n this.formattedFlow.startAt = this.originalFlow.startAt;\n this.formattedFlow.states = Object.assign({}, this.originalFlow.states);\n this.formattedFlow.flowStartTime = new Date().getTime();\n this.formattedFlow.flowExecutionTime = '';\n\n return { isError: false, code: this.code, item: this.formattedFlow };\n }",
"open(file) {\n this.file = file;\n this.input = this.file.input;\n this.state = new State();\n this.state.init(this.options, this.file);\n }",
"function FileSource(file) {\n _classCallCheck(this, FileSource);\n\n this._file = file;\n this.size = file.size;\n }",
"function Flow(nodeList, flows, node, type) {\n this.nodeList = nodeList;\n this.flows = flows;\n this.node = node;\n this.type = type;\n}",
"function FileSource(file) {\n _classCallCheck$3(this, FileSource);\n this._file = file;\n this.size = file.size;\n }",
"constructor(file) {\n this._file = file\n this.size = file.size\n }",
"constructor (filename) {\n \n // Obtém conteúdo da template.\n this.template = fs.readFileSync(filename).toString(); \n }",
"async load (filePath) {\n console.log(`Deserializing from ${filePath}`)\n this.data = this.formatStrategy.deserialize(\n await fs.readFile(filePath, 'utf-8')\n )\n }",
"constructor (path) {\n const f = new IO(path, 'r');\n this.is_base = true;\n\n // copy as tempfile\n this.file = IO.temp('w+');\n let d = f.read(BUFFER_SIZE);\n while (d.length > 0) {\n this.file.write(d);\n d = f.read(BUFFER_SIZE);\n }\n\n f.close();\n if (!Base.surely_formatted(this.file)) {\n throw new Error('Unsupported file passed.');\n }\n\n // TODO: close and remove the Tempfile.\n this.frames = new Frames(this.file);\n }",
"static createSource(filename) {\n const data = fs__default[\"default\"].readFileSync(filename, \"utf-8\");\n return [\n {\n column: 1,\n data,\n filename,\n line: 1,\n offset: 0,\n },\n ];\n }",
"load(file) {\n this._loading = file;\n\n // Read file and split into lines\n const map = {};\n\n const content = fs.readFileSync(file, 'ascii');\n const lines = content.split(/[\\r\\n]+/);\n\n lines.forEach(line => {\n // Clean up whitespace/comments, and split into fields\n const fields = line.replace(/\\s*#.*|^\\s*|\\s*$/g, '').split(/\\s+/);\n map[fields.shift()] = fields;\n });\n\n this.define(map);\n\n this._loading = null;\n }",
"constructor (filename) {\n super()\n this.filename = filename\n }",
"constructor(source) {\n const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0);\n this.source = source;\n this.lastToken = startOfFileToken;\n this.token = startOfFileToken;\n this.line = 1;\n this.lineStart = 0;\n }",
"function Flow(id, map, identifier, loader, ioHandler, processManager) {\n\n var self = this;\n\n if (!id) {\n throw Error('xFlow requires an id');\n }\n\n if (!map) {\n throw Error('xFlow requires a map');\n }\n\n // Call the super's constructor\n Actor.apply(this, arguments);\n\n if (loader) {\n this.loader = loader;\n }\n if (ioHandler) {\n this.ioHandler = ioHandler;\n }\n\n if (processManager) {\n this.processManager = processManager;\n }\n\n // External vs Internal links\n this.linkMap = {};\n\n // indicates whether this is an action instance.\n this.actionName = undefined;\n\n // TODO: trying to solve provider issue\n this.provider = map.provider;\n\n this.providers = map.providers;\n\n this.actions = {};\n\n // initialize both input and output ports might\n // one of them be empty.\n if (!map.ports) {\n map.ports = {};\n }\n if (!map.ports.output) {\n map.ports.output = {};\n }\n if (!map.ports.input) {\n map.ports.input = {};\n }\n\n /*\n // make available always.\n node.ports.output['error'] = {\n title: 'Error',\n type: 'object'\n };\n */\n\n this.id = id;\n\n this.name = map.name;\n\n this.type = 'flow';\n\n this.title = map.title;\n\n this.description = map.description;\n\n this.ns = map.ns;\n\n this.active = false;\n\n this.metadata = map.metadata || {};\n\n this.identifier = identifier || [\n map.ns,\n ':',\n map.name\n ].join('');\n\n this.ports = JSON.parse(\n JSON.stringify(map.ports)\n );\n\n // Need to think about how to implement this for flows\n // this.ports.output[':complete'] = { type: 'any' };\n\n this.runCount = 0;\n\n this.inPorts = Object.keys(\n this.ports.input\n );\n\n this.outPorts = Object.keys(\n this.ports.output\n );\n\n //this.filled = 0;\n\n this.chi = undefined;\n\n this._interval = 100;\n\n // this.context = {};\n\n this.nodeTimeout = map.nodeTimeout || 3000;\n\n this.inputTimeout = typeof map.inputTimeout === 'undefined' ?\n 3000 :\n map.inputTimeout;\n\n this._hold = false; // whether this node is on hold.\n\n this._inputTimeout = null;\n\n this._openPorts = [];\n\n this._connections = new Connections();\n\n this._forks = [];\n\n debug('%s: addMap', this.identifier);\n this.addMap(map);\n\n this.fork = function() {\n\n var Fork = function Fork() {\n this.nodes = {};\n //this.context = {};\n\n // same ioHandler, tricky..\n // this.ioHandler = undefined;\n };\n\n // Pre-filled baseActor is our prototype\n Fork.prototype = this.baseActor;\n\n var FActor = new Fork();\n\n // Remember all forks for maintainance\n self._forks.push(FActor);\n\n // Each fork should have their own event handlers.\n self.listenForOutput(FActor);\n\n return FActor;\n\n };\n\n this.listenForOutput();\n\n this.initPortOptions = function() {\n\n // Init port options.\n for (var port in self.ports.input) {\n if (self.ports.input.hasOwnProperty(port)) {\n\n // This flow's port\n var thisPort = self.ports.input[port];\n\n // set port option\n if (thisPort.options) {\n for (var opt in thisPort.options) {\n if (thisPort.options.hasOwnProperty(opt)) {\n self.setPortOption(\n 'input',\n port,\n opt,\n thisPort.options[opt]);\n }\n }\n }\n\n }\n }\n };\n\n // Too late?\n this.setup();\n\n this.setStatus('created');\n\n}",
"function FlowRecognizer(settings) {\n _classCallCheck(this, FlowRecognizer);\n\n this.settings = settings || {};\n this.initializeModels();\n }",
"constructor(source = {}) {\n super(source, schema_1.ServiceTypes.File);\n }",
"async function recreateFileFromStream(fileId) {\n\t// This is CQRS - our model in this \"view\" is different from original data model. \n\t// Data model is b64 encoded, this won't be. \n\tvar file = {};\n\n\t// Recreate file from stream\n\tconst createEvents = await readStream(FILE_CREATE);\n\tcreateEvents.forEach((event) => {\n\t\tif (event.id == fileId) {\n\t\t\tfile.content = Buffer.from(event.b64_file, 'base64').toString();\n\t\t\tfile.project = event.project;\n\t\t\tfile.id = event.id;\n\t\t\tfile.name = event.name;\n\t\t\tfile.deleted = false;\n\t\t}\n\t});\n\n\t// Apply all the updates from the stream\n\tconst updateEvents = await readStream(FILE_UPDATE);\n\tif (updateEvents) {\n\t\tupdateEvents.forEach((update) => {\n\t\t\tif (update.id == fileId) {\n\t\t\t\tvar updated = dmp.patch_apply(update.diff, file.content)[0];\n\t\t\t\tfile.content = updated;\n\t\t\t}\n\t\t});\n\t}\n\n\t// See if file was ever deleted\n\tconst deleteEvents = await readStream(FILE_DELETE);\n\tif (deleteEvents) {\n\t\tdeleteEvents.forEach((event) => {\n\t\t\tif (event.id == fileId) {\n\t\t\t\tfile.deleted = true;\n\t\t\t}\n\t\t});\n\t}\n\t\n\treturn file;\n}",
"static pFileRead(fileprops){\n\t\tvar file = fileprops.file,\n\t\t\ttask = fileprops.task,\n\t\t\ttype = fileprops.type,\n\t\t\tfed_data = fileprops.fed_data || false;\n\n\t\treturn new Promise((resolve, reject) => {\n\n\t\t\tif (fed_data){\n\t\t\t\t//console.log(\"\")\n\t\t\t\ttry {\n\t\t\t\t\ttask(fed_data)\n\t\t\t\t\tresolve();\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconsole.log(\"error\", e);\n\t\t\t\t\treject(\"Generated data failed to process\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\telse {\n\t\t\t\tvar fr = new FileReader();\n\n\t\t\t\tfr.onload = function(e){\n\t\t\t\t\ttry {\n\t\t\t \t\ttask(e.target.result);\n\t\t \t\t\tresolve();\n\n\t\t \t\t} catch(e){\n\t\t \t\t\treject(file.name + \" is not a \" + type + \", and \" + e);\n\t\t \t\t}\n\t\t \t}\n\t\t\t\tfr.readAsText(file);\n\t\t\t}\n\t\t});\n\t}",
"function decodeFile(input) {\n let ondata = (evt, cb) => {\n if (evt.data[0] == 0) {\n cb({raw: evt.data.subarray(1), links: [], data: evt.data.subarray(1)})\n } else if (evt.data[0] == 1) {\n try {\n let node = dagPB.util.deserialize(evt.data.subarray(1))\n\n let file = Unixfs.unmarshal(node.Data)\n if (file.type != \"raw\" && file.type != \"file\") {\n throw new Error(\"got unexpected file type, wanted raw or file\")\n }\n if (file.data == null) {\n file.data = Buffer.alloc(0)\n }\n\n cb({raw: evt.data.subarray(1), links: node.Links, data: file.data})\n } catch (err) {\n cb(null, err)\n }\n } else {\n cb(null, new Error(\"failed to decode a chunk of file data\"))\n }\n }\n\n return asynchronous(input, ondata)\n}",
"function gotFile(file) {\n createDiv(\"<h1>\"+file.name+\"</h1>\").class(tabNumber).parent(\"left\");\n\n // Handle image and text differently\n if (file.type === 'image') {\n createImg(file.data);\n } \n else if (file.type === 'text') {\n tabs[file.name] = new Tab(file.name, tabNumber);\n switchTab(file.name, tabNumber);\n analyzeText(file, tabNumber);\n }\n}",
"static fromFile(file) {\r\n return file.getItem().then(i => {\r\n const page = new ClientSidePage(extractWebUrl(file.toUrl()), \"\", { Id: i.Id }, true);\r\n return page.configureFrom(file).load();\r\n });\r\n }",
"function Stream(filename, id) {\n this.filename = filename;\n this.frames_FRN_ordered = tl.readJSON(filename).slice(0);\n this.frames_Tarr_ordered = this.frames_FRN_ordered.slice(0);\n bubbleSortArrayByProperty(this.frames_Tarr_ordered, 'T_arrival');\n this.ID = id;\n this.frame_duration = this.frames_FRN_ordered[1].T_display - this.frames_FRN_ordered[0].T_display;\n this.nextFrameIndex = 0; //holds index of next frame to arrive on frames_Tarr_ordered - reset on new simulation\n}",
"constructor(filePath) {\n \n this.graphList = new Map();\n this.graphObject = JSON.parse(fs.readFileSync(filePath,{encoding : 'utf8'}));\n this.visitedArray = new Array(); \n \n }",
"function File() {\n _classCallCheck(this, File);\n\n File.initialize(this);\n }",
"function createFileDecoder(path, opts) {\n return fs.createReadStream(path)\n .pipe(new containers.streams.BlockDecoder(opts));\n}",
"function createFileDecoder(path, opts) {\n return fs.createReadStream(path)\n .pipe(new containers.streams.BlockDecoder(opts));\n}",
"startWorkflow(flow) {\n // custom id management\n let customId = null;\n if (typeof flow.id === \"function\") {\n // customId can be a value or a function\n customId = flow.id();\n // customId should be a string or a number\n if (typeof customId !== \"string\" && typeof customId !== \"number\") {\n throw new InvalidArgumentError(\n `Provided id must be a string or a number - current type: ${typeof customId}`,\n );\n }\n // at the end, it's a string\n customId = customId.toString();\n // should be not more than 256 bytes;\n if (customId.length >= MAX_ID_SIZE) {\n throw new ExternalZenatonError(\n `Provided id must not exceed ${MAX_ID_SIZE} bytes`,\n );\n }\n }\n\n const url = this.getInstanceWorkerUrl();\n\n // start workflow\n const body = {\n [ATTR_PROG]: PROG,\n [ATTR_CANONICAL]: flow._getCanonical(),\n [ATTR_NAME]: flow.name,\n [ATTR_DATA]: serializer.encode(flow.data),\n [ATTR_ID]: customId,\n };\n\n const params = this.getAppEnv();\n\n return http.post(url, body, { params });\n }",
"constructor(filename) {\n this.file = loadTable(filename,'csv','header');\n this.state = [];\n this.group = [];\n }",
"getFlow() {\n return new NgFlowchart.Flow(this.canvas);\n }"
]
| [
"0.6166627",
"0.57145196",
"0.56857115",
"0.562967",
"0.5604891",
"0.5471463",
"0.5301391",
"0.5241441",
"0.5224979",
"0.51904845",
"0.5137636",
"0.50957966",
"0.5093447",
"0.50872844",
"0.50281215",
"0.50156933",
"0.49810165",
"0.4952644",
"0.49317124",
"0.48863092",
"0.48591173",
"0.48585242",
"0.48485574",
"0.48285538",
"0.48257622",
"0.48236334",
"0.48236334",
"0.48152694",
"0.47974706",
"0.47893018"
]
| 0.70620036 | 0 |
FLOW METHODS This method restricts data operation to a certain number, starting from the first item it can see. | limit(num){
if( num <= 0 )
throw new Error("Limit value must be greater than 0");
var flow = new RangeMethodFlow(0, num);
setRefs(this, flow);
return flow;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"skip(num){\n if( num <= 0 )\n throw new Error(\"Skip value must be greater than 0\");\n\n var flow = new RangeMethodFlow(num, Number.MAX_VALUE);\n setRefs(this, flow);\n\n return flow;\n }",
"function EnsureLimit() {\n\t\t\t\tif (_itemId > 10 && (_itemId % 5) == 0) {\n\t\t\t\t\t_cmdDiv.find(\"div:lt(5)\").remove();\n\t\t\t\t\t_resDiv.find(\"div:lt(5)\").remove();\n\t\t\t\t}\n\t\t\t}",
"_validateItemsIndex(index, method) {\n const that = this;\n\n if (isNaN(parseInt(index)) || index < 0 || index > that._items.length - 1) {\n that.log(that.localize('indexOutOfBound', { elementType: that.nodeName.toLowerCase(), method: method }));\n return;\n }\n\n return parseInt(index);\n }",
"gotoCheckLimit(current_line, n_item, line_limit) {\n if (n_item > 0 && current_line < line_limit) {\n return true;\n }\n else if (n_item < 0 && current_line > line_limit) {\n return true;\n }\n else {\n return false;\n }\n }",
"onTriggerAction(data, triggerCount) {\n super.onTriggerAction(data);\n\n if(triggerCount === 0) {\n this.transportControl(\"previous\");\n } else {\n if(this.roonActiveOutput && this.roonActiveOutput.isSeekAllowed) {\n\n let amount = triggerCount;\n if(triggerCount < 3) {\n amount = 5;\n } else {\n amount = Math.pow(2, triggerCount);\n }\n\n // Guardrails\n amount = Math.min(amount, 45);\n this.transportSeek(\"relative\", -amount);\n }\n }\n }",
"manageShoppingIndex(){\n const firstUnsavedIndex = this.firstUnsavedIndex()\n\n if (firstUnsavedIndex == null) { //everything is saved, person should be allowed into the picking of this order\n this.loadGroupSelectionPage();\n }\n else if(this.requestedPickingStep > firstUnsavedIndex + 1){ //0 indexed vs 1 indexed\n console.log('manageShoppingIndex m0', 'this.shopList.length', this.shopList.length, 'requestedPickingStep', this.requestedPickingStep, 'firstUnsavedIndex', firstUnsavedIndex);\n this.requestedPickingStep = firstUnsavedIndex + 1; //0 indexed vs 1 indexed\n this.setShoppingIndex(firstUnsavedIndex);\n alert('Please complete step ' + this.requestedPickingStep + ' first');\n }\n else if(this.requestedPickingStep <= this.shopList.length && this.requestedPickingStep > 0){\n console.log('manageShoppingIndex m1', 'this.shopList.length', this.shopList.length, 'requestedPickingStep', this.requestedPickingStep, 'firstUnsavedIndex', firstUnsavedIndex);\n this.setShoppingIndex(this.requestedPickingStep - 1); //0 indexed vs 1 indexed\n }\n else if(this.requestedPickingStep === 'basket'){\n console.log('manageShoppingIndex m2', 'this.shopList.length', this.shopList.length, 'requestedPickingStep', this.requestedPickingStep, 'firstUnsavedIndex', firstUnsavedIndex);\n this.basketSaved = false;\n this.initializeShopper();\n }\n else if(this.groupLoaded === true){\n console.log('manageShoppingIndex m3', 'this.shopList.length', this.shopList.length, 'requestedPickingStep', this.requestedPickingStep, 'firstUnsavedIndex', firstUnsavedIndex);\n this.setShoppingIndex(0);\n }\n }",
"@action getManyDataItems() { // go ask for a bunch of random numbers\n this.numberList.replace(); // empty the list\n for (var ctr = 0; ctr < this.listSize; ctr++){ // count to goal \n this.numberList.push(-1); // make the array the right size\n setTimeout( this.getRandomForIndex.bind(this,ctr) , // call a service\n 200+Math.random()*3000 ); // after a random wait\n } \n }",
"function add(item) {\n if (typeof item != \"number\") {\n return false;\n }\n\n if (item < 100) {\n pipe.unshift(item);\n } else {\n pipe.push(item)\n }\n\n}",
"run() {\n\n let end = this.settings.show + this.settings.offset;\n\n let start = this.settings.offset;\n\n let nextDataSetIndex = end;\n let previousDataSetIndex = start - 1;\n\n let currentEntryEnd = start + this.settings.show;\n\n if (this.data) {\n const filteredData = this\n .data\n .slice(start, end);\n\n //set default has more to true\n this.hasNext = true;\n this.hasPrevious = true;\n\n //if start is less than 0 set it to 0\n if (start < 0) {\n start = 0;\n }\n\n if (end < 2) {\n end = 1;\n }\n\n //tell if we have more data\n if (!this.data[nextDataSetIndex]) {\n this.hasNext = false;\n }\n\n //tell if we have previous data\n if (!this.data[previousDataSetIndex]) {\n this.hasPrevious = false;\n }\n\n if (currentEntryEnd > this.data.length) {\n currentEntryEnd = this.data.length\n }\n\n this.currentEntry = start + 1;\n this.currentEntryEnd = currentEntryEnd;\n this.dataCount = this.data.length;\n\n this.dataToShow = filteredData\n\n return {data: filteredData}\n } else {\n this.dataToShow = [{}]\n return {data: ''}\n }\n\n }",
"next() {\n const that = this,\n availableItems = that.dataSource.length;\n \n if (that.disabled || availableItems === 0) {\n return;\n }\n\n let nextItem = that._currentIndex;\n\n if(that.loop){\n nextItem = nextItem >= availableItems-1 ? 0 : nextItem + 1;\n }\n else {\n nextItem = nextItem >= availableItems-1 ? nextItem : nextItem + 1;\n }\n\n that._goToItem(nextItem);\n }",
"function checkLimit()\n\t\t\t{\n\t\t\t\tif(p.maxLimit == undefined)\n\t\t\t\t\treturn;\n\t\t\t\twhile(dataArray.length > p.maxLimit)\n\t\t\t\t{\n\t\t\t\t\tdataArray.splice(0,1);\n\t\t\t\t}\n\t\t\t}",
"handleAllInputs() {\r\n this.limitInputTo(this.inputBill, 99999);\r\n this.limitInputTo(this.inputCustom, 100);\r\n this.limitInputTo(this.inputPeople, 100);\r\n }",
"filterSpace(state, payload) {\n let filtered = [];\n if (payload == 0) {\n state.warehouses = state.data;\n } else if (payload > 0 && state.warehouses === null) {\n filtered = state.data.filter((item) => {\n return item.space_available <= payload;\n });\n state.warehouses = filtered;\n } else if (payload > 0 && state.warehouses !== null) {\n filtered = state.warehouses.filter((item) => {\n return item.space_available <= payload;\n });\n state.warehouses = filtered;\n } else {\n alert(\"Cannot Filter for negative values\");\n }\n }",
"limit (num = false) {\n return Helpers.is(num, 'Number') ? this.slice(0, num) : this;\n }",
"getNextChange() {\n const filterCriteria = [{\n attributeName: 'hasError',\n attributeValue: 0,\n attributeType: 'NUMBER',\n filterCondition: 'EQUALS'\n }];\n return this.getStore().then(s => s.filter(filterCriteria, 'id', {\n offset: 0,\n limit: 1\n })).then((changes) => {\n return changes && changes[0];\n });\n }",
"set _physicalStart(val){val=val%this._physicalCount;if(0>val){val=this._physicalCount+val}if(this.grid){val=val-val%this._itemsPerRow}this._physicalStartVal=val}",
"function shownoofRecord()\r\n\t{\r\n\t\t$scope.pageSize=$scope.shownoofrec;\r\n\t\tself.Filterreceipts=self.receipts.slice($scope.currentPage*$scope.pageSize);\r\n\t\tif(self.Filterreceipts.length<=$scope.pageSize)\r\n\t\t{\r\n\t\t\t$scope.previousDisabled=true;\r\n\t\t\t$scope.nextDisabled=true;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$scope.nextDisabled=false;\r\n\t\t}\r\n\t}",
"function handleDataForm(){\n\tvar data_table = tabsFrame.datagrpRestriction;\n\tif ((data_table != '') && data_table != undefined) {\n\t\tvar tgrpPanel = 'tgrp' + tgrp_position + 'Panel';\t\n\t\tvar grid = Ab.view.View.getControl('', tgrpPanel);\n\t\tvar action = grid.actions.get('goNext' + tgrp_position);\n\t\taction.enable(true);\t\t\t\t\n\t\thideButtons(grid); \t\n\t}\n}",
"set _physicalStart(val){val=val%this._physicalCount;if(val<0){val=this._physicalCount+val;}if(this.grid){val=val-val%this._itemsPerRow;}this._physicalStartVal=val;}",
"onClickBtnNext() {\n if (Number(this.state.data.item1) > (this.state.pageNo + 1) * 10) { \n this.setState({ pageNo: this.state.pageNo + 1 }, () => this.sendPageRequest())\n console.log(\"Sonraki:\" + this.state.searchText + \"-\" + this.state.pageNo)\n }\n }",
"function checkLimit() {\n return global.maxItems && global.detailsEnqueued >= global.maxItems;\n}",
"async select() {\n const options = this.ctx.request.body.options;\n options.page = this.ctx.bean.util.page(options.page);\n const items = await this.ctx.service.flow.select({\n options,\n user: this.ctx.state.user.op,\n });\n this.ctx.successMore(items, options.page.index, options.page.size);\n }",
"updateFlow() {\n this.flow += 1;\n }",
"traverse(func, idx = 0) {\n\t\tlet abort = false\n\t\tif(this.canRead) {\n\t\t\tlet payload = this._loadPayloadAt(idx)\n\t\t\tif(payload) {\n\t\t\t\tabort = this.traverse(func, 2 * idx + 1)\n\t\t\t\tif(!abort) {\n\t\t\t\t\tabort = func(payload)\n\t\t\t\t}\n\t\t\t\tif(!abort) {\n\t\t\t\t\tabort = this.traverse(func, 2 * idx + 2)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tabort = true\n\t\t}\n\t\treturn abort\n\t}",
"prev() {\n const that = this,\n availableItems = that.dataSource.length;\n \n if (that.disabled || availableItems === 0) {\n return;\n }\n\n let previousItem = that._currentIndex;\n\n if(that.loop){\n previousItem = previousItem <= 0 ? availableItems - 1 : previousItem - 1;\n }\n else {\n previousItem = previousItem <= 0 ? 0 : previousItem - 1;\n }\n\n that._goToItem(previousItem);\n }",
"read(existing = [], { field, args, readField, cache }) {\n console.log(\"\\n\\nREAD existing = \", existing);\n const { skip, first } = args;\n\n // Read the number of items, so we can make pagination. For some reason when deleting an item, this is null the first time adn then runs two more times with the correct data?? ??!?!? ? ?? ? ? ? ? ?!?!?\n const data = cache.readQuery({\n query: gql`\n query PAGINATION_QUERY_CACHE {\n itemsConnection {\n aggregate {\n count\n }\n }\n }\n `,\n });\n\n const count = data?.itemsConnection?.aggregate?.count;\n console.log(\"count = \", count);\n\n const page = skip / first + 1;\n const pages = Math.ceil(count / first);\n // 3. See if we have the items we want in the existing cache\n const items = existing\n .slice(skip, skip + first)\n // we filter for empty spots because its likely we have padded spots with nothing in them. IE Someone visits page 3 directly, spots 1-8 will be empty\n .filter(x => x);\n // 4. Account for the last page, where there is incomplete data but we dont have any more so we just send it\n if (items.length && items.length !== args.first && page === pages) {\n console.log(\n `We don't have ${first} items, but it's the last page so we're just gonna send it!`\n );\n return items;\n }\n // 5. If there are enough items, return them.\n // It's possible that we only have 3 of the 4 items because we deleted something on the previous page, so if that is the case we need to go to the network\n if (items.length !== args.first) {\n // TODO: This breaks the last page where we might only have a few items....\n console.log(\n `We only have ${items.length} and we want ${args.first} so we're going to the network to fetch them`\n );\n return; // return undefined so it hits the network\n }\n // 6. If there are items, return them.\n if (items.length) {\n console.log(\n `We have ${items.length} items! Gonna serve them from the cache`\n );\n return items;\n }\n // 7. Otherwise this function returns undefined and it will hit the network for the items, and call merge() for us\n console.log(\"No items! Requesting from network\");\n }",
"function getNextItems(){\n getItems(model.itemOffset + model.items.length);\n }",
"function changePageNum(num)\n {\n ;\n setNum(num); \n let p1=(pageNum - 1) * 6;\n let p2=pageNum * 6 - 1;\n items=items.slice(p1, p2)\n // setItems(list.slice((pageNum - 1) * 6, pageNum * 6 - 1))\n var list= items.slice((pageNum - 1) * 6, pageNum * 6 - 1)\n // setMyItems({\n // ...items,\n // list\n // });\n\n }",
"NextVisible() {}",
"@action lessOne() { this.myNumber--; }"
]
| [
"0.5690883",
"0.5311678",
"0.5290672",
"0.5168561",
"0.5142593",
"0.51268005",
"0.4991036",
"0.49759328",
"0.4947757",
"0.49148992",
"0.4912665",
"0.4898238",
"0.48551947",
"0.4844317",
"0.48417974",
"0.48272336",
"0.48217312",
"0.48174116",
"0.48081303",
"0.4784529",
"0.4756754",
"0.47346625",
"0.4716752",
"0.47137195",
"0.47073466",
"0.46994162",
"0.46993494",
"0.46968254",
"0.46956375",
"0.46587905"
]
| 0.5594103 | 1 |
Skip until the condition in the function argument returns true | skipUntil(func){
if( !Util.isFunction(func) )
throw new Error("skipUntil requires a function");
var flow = new SkipTakeWhileUntilFlow(func, 1);
setRefs(this, flow);
return flow;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"skipWhile(func){\n if( !Util.isFunction(func) )\n throw new Error(\"skipWhile requires a function\");\n\n var flow = new SkipTakeWhileUntilFlow(func, 2);\n setRefs(this, flow);\n\n return flow;\n }",
"takeWhile(func){\n if( !Util.isFunction(func) )\n throw new Error(\"takeWhile requires a function\");\n\n var flow = new SkipTakeWhileUntilFlow(func, 4);\n setRefs(this, flow);\n\n return flow;\n }",
"skip(opSt) { return false; }",
"takeUntil(func){\n if( !Util.isFunction(func) )\n throw new Error(\"takeUntil requires a function\");\n\n var flow = new SkipTakeWhileUntilFlow(func, 3);\n setRefs(this, flow);\n\n return flow;\n }",
"function skipWhile(predicate) {\n return function (source) { return source.lift(new SkipWhileOperator(predicate)); };\n}",
"function skipWhile(predicate) {\n return function (source) { return source.lift(new SkipWhileOperator(predicate)); };\n}",
"function skip(){\n\t\n}",
"async resolveWhile(predicate) {\n let x = await this.next();\n let shouldContinue = predicate(x.value);\n while ((!x.done) && shouldContinue) {\n x = await this.next();\n shouldContinue = predicate(x.value);\n }\n }",
"shouldSkip () {\n const {skema} = this\n\n if (!skema.hasWhen()) {\n return this._shouldSkip()\n }\n\n return skema.when(\n this.args, this.context, this.options)\n .then(hit => {\n if (!hit) {\n // Skip\n return true\n }\n\n return this._shouldSkip()\n })\n }",
"function unless(test, then){\n if(!test) then();\n}",
"doUnless(condition, func) {\n if(typeof condition === 'function') {\n return this.doIf((data) => !condition(data), func)\n } else {\n return this.doIf(!condition, func)\n }\n }",
"function Skip() { return Skip }",
"function unless(test, then){\n if(!test) then();\n}",
"function takeWhile(f, a) {\n for (var i = 0; i < a.length; ++i)\n if (! f(a[i])) break;\n\n return a.slice(0, i);\n}",
"function until(condiiton, block)\n{\n\tvar cond = condition()\n\twhile (!cond)\n\t{\n\t\tblock()\n\t\tcond = condition()\n\t}\n}",
"function unless(test, then) {\r\n\tif(!test) then();\r\n}",
"function unless(test, then) {\n if(!test) then();\n}",
"function unless(test, then) {\n if (!test) then();\n}",
"function unless(test, then) {\n if (!test) then();\n}",
"function untilTrue(array) {\n // While first element of array returns false from args[1] -- remove first element\n while (!args[1](array[0])) {\n array.shift();\n }\n // return array with removed elements array[0] now returns true for args[1]\n return array;\n }",
"function unless(test, then) {\n if (!test)\n then()\n}",
"function eachContinue(array, fn) {\n var length = array.length;\n for (var i = 0; i < length; ++i) {\n if (!fn(array[i], i)) {\n break;\n }\n }\n}",
"function unless(test, then) {\n if (!test) then();\n}",
"function printOddNumbersLessThan( number ) {\n for( let x = 1; x < number; x++ ) {\n //Here we perform another action so we need a second function\n if ( !checkForOddNumber( x ) ) {\n continue;\n }\n \n console.log( x );\n }\n}",
"function returnUntil(ctx, condition) {\n let blocks = ctx.blockStack.stack;\n let blk;\n let rm = null;\n for (let i = -2; i >= -blocks.length; i--) {\n blk = listGet(blocks, i);\n if (condition(blk)) {\n rm = i+1;\n break;\n }\n }\n if (rm === null)\n return null;\n\n\n return {\n pre: blocks.slice(0, rm),\n post: blocks.slice(rm),\n current: blk\n };\n}",
"function takeWhile(arr, f) {\n let n = 0;\n for (; n < arr.length; n++) {\n if (!f(arr[n])) {\n break;\n }\n }\n return arr.slice(0, n);\n}",
"function skipUntil(notifier) {\n return function (source) { return source.lift(new SkipUntilOperator(notifier)); };\n}",
"function unless(b) {\n return unlessM(core.succeedWith(b));\n}",
"takeWhile(predicate) {\n const self = this;\n return new Seq(function* () {\n for (const element of self) {\n if (predicate(element))\n yield element;\n else\n break;\n }\n });\n }",
"function promiseWhile(condition, result, body) {\n return _promiseWhile(condition, result, body, 0);\n}"
]
| [
"0.7029516",
"0.6718507",
"0.67023265",
"0.66092503",
"0.65189856",
"0.65189856",
"0.65139866",
"0.6432234",
"0.6400434",
"0.6175636",
"0.6145253",
"0.6144896",
"0.61159474",
"0.6108472",
"0.6106238",
"0.60610074",
"0.6059095",
"0.6037861",
"0.6037861",
"0.60053694",
"0.59980994",
"0.5982059",
"0.59779215",
"0.59523326",
"0.5941964",
"0.5908532",
"0.5877866",
"0.58053744",
"0.5805103",
"0.58006394"
]
| 0.6817808 | 1 |
Skip while the condition in the function argument returns true | skipWhile(func){
if( !Util.isFunction(func) )
throw new Error("skipWhile requires a function");
var flow = new SkipTakeWhileUntilFlow(func, 2);
setRefs(this, flow);
return flow;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"skip(opSt) { return false; }",
"takeWhile(func){\n if( !Util.isFunction(func) )\n throw new Error(\"takeWhile requires a function\");\n\n var flow = new SkipTakeWhileUntilFlow(func, 4);\n setRefs(this, flow);\n\n return flow;\n }",
"async resolveWhile(predicate) {\n let x = await this.next();\n let shouldContinue = predicate(x.value);\n while ((!x.done) && shouldContinue) {\n x = await this.next();\n shouldContinue = predicate(x.value);\n }\n }",
"function skip(){\n\t\n}",
"skipUntil(func){\n if( !Util.isFunction(func) )\n throw new Error(\"skipUntil requires a function\");\n\n var flow = new SkipTakeWhileUntilFlow(func, 1);\n setRefs(this, flow);\n\n return flow;\n }",
"function skipWhile(predicate) {\n return function (source) { return source.lift(new SkipWhileOperator(predicate)); };\n}",
"function skipWhile(predicate) {\n return function (source) { return source.lift(new SkipWhileOperator(predicate)); };\n}",
"shouldSkip () {\n const {skema} = this\n\n if (!skema.hasWhen()) {\n return this._shouldSkip()\n }\n\n return skema.when(\n this.args, this.context, this.options)\n .then(hit => {\n if (!hit) {\n // Skip\n return true\n }\n\n return this._shouldSkip()\n })\n }",
"takeUntil(func){\n if( !Util.isFunction(func) )\n throw new Error(\"takeUntil requires a function\");\n\n var flow = new SkipTakeWhileUntilFlow(func, 3);\n setRefs(this, flow);\n\n return flow;\n }",
"function takeWhile(f, a) {\n for (var i = 0; i < a.length; ++i)\n if (! f(a[i])) break;\n\n return a.slice(0, i);\n}",
"function Skip() { return Skip }",
"function doWhileLoop(Y)\n{\n do {\n Y.shift()\n return Y\n } while (Y.length > 0 && maybeTrue());\n\n}",
"function untilTrue(array) {\n // While first element of array returns false from args[1] -- remove first element\n while (!args[1](array[0])) {\n array.shift();\n }\n // return array with removed elements array[0] now returns true for args[1]\n return array;\n }",
"function printOddNumbersLessThan( number ) {\n for( let x = 1; x < number; x++ ) {\n //Here we perform another action so we need a second function\n if ( !checkForOddNumber( x ) ) {\n continue;\n }\n \n console.log( x );\n }\n}",
"function unless(test, then){\n if(!test) then();\n}",
"function unless(test, then){\n if(!test) then();\n}",
"function eachContinue(array, fn) {\n var length = array.length;\n for (var i = 0; i < length; ++i) {\n if (!fn(array[i], i)) {\n break;\n }\n }\n}",
"function takeWhile(arr, f) {\n let n = 0;\n for (; n < arr.length; n++) {\n if (!f(arr[n])) {\n break;\n }\n }\n return arr.slice(0, n);\n}",
"function neverReturns(a) {\n while (true) {\n }\n}",
"function unless(test, then) {\r\n\tif(!test) then();\r\n}",
"function unless(test, then) {\n if (!test)\n then()\n}",
"function unless(test, then) {\n if(!test) then();\n}",
"function dropWhile(pred, foldable) {\n var take = false;\n return filter(function(x) { return take = take || !pred(x); }, foldable);\n }",
"__skipStep() {\n this.skipStep();\n }",
"function unless(test, then) {\n if (!test) then();\n}",
"function unless(test, then) {\n if (!test) then();\n}",
"function unless(test, then) {\n if (!test) then();\n}",
"doUnless(condition, func) {\n if(typeof condition === 'function') {\n return this.doIf((data) => !condition(data), func)\n } else {\n return this.doIf(!condition, func)\n }\n }",
"function canSkip (strictMode, postpone, passedPercent, postponePercent) {\n return !((postpone && passedPercent <= postponePercent) || strictMode)\n}",
"function dropToLoop(condExpr)\r\n{\r\n assertRunning();\r\n if (condExpr && !evalWithVars(condExpr))\r\n return;\r\n var activeCmdStack = callStack.top().cmdStack;\r\n var loopState = activeCmdStack.unwindTo(Stack.isLoopBlock);\r\n return loopState;\r\n}"
]
| [
"0.6879535",
"0.6777159",
"0.66293716",
"0.65964663",
"0.6511093",
"0.6500644",
"0.6500644",
"0.64705396",
"0.62586856",
"0.62370336",
"0.62226963",
"0.6222539",
"0.61811286",
"0.61511815",
"0.6101928",
"0.6062624",
"0.60604185",
"0.6048583",
"0.5979251",
"0.5973103",
"0.5966916",
"0.59639263",
"0.59426916",
"0.5941719",
"0.5931518",
"0.5931518",
"0.588823",
"0.58778036",
"0.58469224",
"0.58232415"
]
| 0.7103854 | 0 |
Alias of foreach for those familiar with the JS forEach | forEach(func){
this.foreach(func);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function ForEach() {}",
"function forEach(arr, fun) { return HTMLCollection.prototype.each.call(arr, fun); }",
"function foreach(a, f) {\n for (var i = 0; i < a.length; i++) {\n f(a[i]);\n }\n}",
"forEach(callback, thisArg = undefined) {\n let i = 0;\n for (let p in this)\n callback.call(thisArg, this[p], i++, this);\n }",
"function for_each(x, f) {\n Array.prototype.forEach.call(x, f);\n}",
"function _forEach(collection, iteratee) {\n const func = Array.isArray(collection) ? _arrayEach : baseEach\n return func(collection, iteratee)\n}",
"forEach(f) {\n for (var i=0,l=this.count; i<l; i++) {\n f(this.get(i));\n }\n }",
"function testForEach(arr) {\n return arr.forEach( element => { console.log(element)});\n}",
"function foreach(what, cb) {\r\n\tfunction isArray(what) {\r\n\t\treturn Object.prototype.toString.call(what) === '[object Array]';\r\n\t}\r\n\r\n\tif (isArray(what)) {\r\n\t\tfor (var i = 0, arr = what; i < what.length; i++) {\r\n\t\t\tcb(arr[i]);\r\n\t\t}\r\n\t}\r\n\telse {\r\n\t\tcb(what);\r\n\t}\r\n}",
"function myForEach(array, callback) {\n\n}",
"function forEach(seq,fn) { for (var i=0,n=seq&&seq.length;i<n;i++) fn(seq[i]); }",
"function forEach(obj, iterator, context) {\n if (obj === null) {\n return;\n }\n if (nativeForEach && obj.forEach === nativeForEach) {\n obj.forEach(iterator, context);\n } else if (obj.length === +obj.length) {\n for (var i = 0, l = obj.length; i < l; i += 1) {\n iterator.call(context, obj[i], i, obj);\n }\n } else {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n }\n}",
"function forEach(array, callback) {\n\n}",
"function $each(iterable, fn, bind){\n\treturn Array.prototype.forEach.call(iterable, fn, bind);\n}",
"function forEach(arr, fn, ctx) {\n var k;\n\n if ('length' in arr) {\n for (k = 0; k < arr.length; k++) fn.call(ctx || this, arr[k], k);\n } else {\n for (k in arr) fn.call(ctx || this, arr[k], k);\n }\n }",
"function each(iterator) {\n for (var i = 0, length = this.length; i < length; i++)\n iterator(this[i]);\n }",
"function foreach(iterable, fn) {\n const iter = iterable[Symbol.iterator]();\n let result;\n while (!(result = iter.next()).done) {\n const elem = result.value;\n fn(elem);\n }\n}",
"function ForEach(nodeList, callback, scope) {\r\n for (var i = 0; i < nodeList.length; i++) {\r\n\t callback(nodeList[i]); // passes back stuff we need\r\n }\r\n}",
"function each(iterator) {\n for (var i = 0, length = this.length; i < length; i++)\n iterator(this[i]);\n }",
"function each(iterator) {\r\n for (var i = 0, length = this.length; i < length; i++)\r\n iterator(this[i]);\r\n }",
"forEach(fn) {\n let node = this.head;\n while (node) {\n fn(node.value);\n node = node.next;\n }\n }",
"function forEach(cb, obj) {\r\n if (obj) {\r\n for (var i = 0; i < this.length; i++) {\r\n cb.call(obj, this[i], i);\r\n }\r\n } else {\r\n for (var i = 0; i < this.length; i++) {\r\n cb(this[i], i);\r\n }\r\n }\r\n}",
"function ForEach() {\n }",
"function myForEach(arr, cb){\n for (var i = 0; i < arr.length; i++) {\n var el = arr[i];\n cb(el, i, arr);\n }\n}",
"function forEach(array, callback){\r\n array.forEach(callback);\r\n}",
"function forEach(values, callback, thisArg) {\r\n if (values.forEach) {\r\n values.forEach(callback, thisArg);\r\n } else {\r\n for (var i = 0; i < values.length; i++) {\r\n callback.call(thisArg, values[i], i, values);\r\n }\r\n }\r\n }",
"function _forEach(obj, cb, _this) {\n\t if (predicates_1.isArray(obj))\n\t return obj.forEach(cb, _this);\n\t Object.keys(obj).forEach(function (key) { return cb(obj[key], key); });\n\t}",
"function _forEach(obj, cb, _this) {\n\t if (predicates_1.isArray(obj))\n\t return obj.forEach(cb, _this);\n\t Object.keys(obj).forEach(function (key) { return cb(obj[key], key); });\n\t}",
"function __for_each(arr, Fn) {\n\t\tArray.prototype.slice.call((typeof arr === 'string' ? document.querySelectorAll(arr) : arr), 0).forEach(Fn);\n\t}",
"function forEachNodeList(els, fn) {\n Array.prototype.forEach.call(els, fn);\n}"
]
| [
"0.7932546",
"0.7412556",
"0.73404443",
"0.7309132",
"0.7269947",
"0.7161315",
"0.7154374",
"0.7056756",
"0.7028455",
"0.69966483",
"0.6978964",
"0.69717395",
"0.6971216",
"0.69622266",
"0.69577485",
"0.6856901",
"0.6834711",
"0.6832951",
"0.6823172",
"0.6802958",
"0.67939556",
"0.67927885",
"0.67869544",
"0.67740643",
"0.6772761",
"0.67540497",
"0.6750619",
"0.6750619",
"0.674977",
"0.6746005"
]
| 0.7717121 | 1 |
This function is used to set the linked references for Flows (like LinkedLists) | function setRefs(primary, secondary){
secondary.prev = primary;
primary.next = secondary;
secondary.rootFlow = primary.rootFlow;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"setReferences(currentId) {\n if (!(this.referencedVariables[currentId].originalIds.length === 1\n && this.referencedVariables[currentId].originalIds[0] === currentId)) {\n this.referencedVariables[currentId].originalIds.forEach((d) => {\n this.setReferences(d);\n });\n }\n this.referencedVariables[currentId].referenced += 1;\n }",
"function setNode(next) {\n var _node = node,\n __anchor = _node.__anchor,\n __focus = _node.__focus;\n\n if (__anchor != null) next.__anchor = __anchor;\n if (__focus != null) next.__focus = __focus;\n node = next;\n }",
"function computeNodeLinks() {\n nodes.forEach(function (node) {\n node.sourceLinks = [];\n node.targetLinks = [];\n });\n links.forEach(function (link) {\n var source = link.source, target = link.target;\n link.source_index = source;\n link.target_index = target;\n if (typeof source === \"number\") source = link.source = nodes[link.source];\n if (typeof target === \"number\") target = link.target = nodes[link.target];\n source.sourceLinks.push(link);/////the link in which node as souce/link\n target.targetLinks.push(link);\n });\n }",
"function set_links(link_set) {\n\n\tfor(var id in link_set) {\n\n\t\tvar a = document.getElementById(id);\n\t\tif(a)\n\t\t\ta.setAttribute('href', link_set[id]);\n\t}\n}",
"function computeNodeLinks() {\n nodes.forEach(function(node) {\n node.sourceLinks = [];\n node.targetLinks = [];\n });\n links.forEach(function(link) {\n var source = link.source,\n target = link.target;\n if (typeof source === \"number\") source = link.source = nodes[link.source];\n if (typeof target === \"number\") target = link.target = nodes[link.target];\n source.sourceLinks.push(link);\n target.targetLinks.push(link);\n });\n }",
"function computeNodeLinks() {\n nodes.forEach(function(node) {\n node.sourceLinks = [];\n node.targetLinks = [];\n });\n links.forEach(function(link) {\n var source = link.source,\n target = link.target;\n if (typeof source === \"number\") source = link.source = nodes[link.source];\n if (typeof target === \"number\") target = link.target = nodes[link.target];\n source.sourceLinks.push(link);\n target.targetLinks.push(link);\n });\n }",
"function LinkedLists(){\n\tthis.head=null;\n}",
"_setupLinks() {\n\t\tthis.$links = this.$control.find( '.link' );\n\n\t\tthis._bindLinked();\n\t}",
"function computeNodeLinks() {\n\t nodes.forEach(function (node) {\n\t node.sourceLinks = [];\n\t node.targetLinks = [];\n\t });\n\t links.forEach(function (link) {\n\t var source = link.source,\n\t target = link.target;\n\t if (typeof source === \"number\") source = link.source = nodes[link.source];\n\t if (typeof target === \"number\") target = link.target = nodes[link.target];\n\t source.sourceLinks.push(link);\n\t target.targetLinks.push(link);\n\t });\n\t }",
"function computeNodeLinks() {\n nodes.forEach(function(node) {\n node.sourceLinks = [];\n node.targetLinks = [];\n });\n links.forEach(function(link, i) {\n var source = link.source,\n target = link.target;\n if (typeof source === \"number\") source = link.source = nodes[link.source];\n if (typeof target === \"number\") target = link.target = nodes[link.target];\n link.originalIndex = i;\n source.sourceLinks.push(link);\n target.targetLinks.push(link);\n });\n }",
"setReferences(references) {\n this._logger.setReferences(references);\n this._connectionResolver.setReferences(references);\n let contextInfo = references.getOneOptional(new pip_services3_commons_node_1.Descriptor(\"pip-services\", \"context-info\", \"default\", \"*\", \"1.0\"));\n if (contextInfo != null && this._source == null)\n this._source = contextInfo.name;\n if (contextInfo != null && this._instance == null)\n this._instance = contextInfo.contextId;\n }",
"function computeNodeLinks() {\n nodes.forEach(function(node) {\n node.sourceLinks = []\n node.targetLinks = []\n })\n links.forEach(function(link) {\n let source = link.source\n let target = link.target\n if (typeof source === 'number') source = link.source = nodes[link.source]\n if (typeof target === 'number') target = link.target = nodes[link.target]\n source.sourceLinks.push(link)\n target.targetLinks.push(link)\n })\n }",
"set referenceObject(obj) {\n this._referenceObject = obj;\n }",
"function setLinkIndexAndNum()\n { \n for (var i = 0; i < data.links.length; i++) \n {\n if (i != 0 &&\n data.links[i].source == data.links[i-1].source &&\n data.links[i].target == data.links[i-1].target) \n {\n data.links[i].linkindex = data.links[i-1].linkindex + 1;\n }\n else \n {\n data.links[i].linkindex = 1;\n }\n // save the total number of links between two nodes\n if(mLinkNum[data.links[i].target + \",\" + data.links[i].source] !== undefined)\n {\n mLinkNum[data.links[i].target + \",\" + data.links[i].source] = data.links[i].linkindex;\n }\n else\n {\n mLinkNum[data.links[i].source + \",\" + data.links[i].target] = data.links[i].linkindex;\n }\n }\n }",
"function setLinkIndexAndNum(){\n for (var i = 0; i < g.links.length; i++){\n if (i != 0 &&\n g.links[i].source == g.links[i-1].source &&\n g.links[i].target == g.links[i-1].target)\n {\n g.links[i].linkindex = g.links[i-1].linkindex + 1;\n }else{\n g.links[i].linkindex = 1;\n }\n // save the total number of links between two nodes\n\t\t\t//console.log(g.links[i])\n if(mLinkNum[g.links[i].target + \",\" + g.links[i].source] !== undefined){\n mLinkNum[g.links[i].target + \",\" + g.links[i].source] = g.links[i].linkindex;\n }else{\n mLinkNum[g.links[i].source + \",\" + g.links[i].target] = g.links[i].linkindex;\n }\n }\n }",
"function linkNodes(node1, node2) {\n\tnode1.next = node2;\n\tnode2.prev = node1; \n}",
"function setRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n }",
"function addLinks(links) {\r\n\t\tgraph.edges =graph.edges || [];\r\n\t\tif (links!==undefined && links.length) {\r\n\t\t\tlinks.forEach(function(link, index) {\r\n\t\t\t\tvar indexOfSourceAndTarget= getIndexOfSourceAndTarget(link);\r\n\t\t\t\tif (indexOfSourceAndTarget!==undefined && indexOfSourceAndTarget.sourceIndex!==undefined && indexOfSourceAndTarget.targetIndex!==undefined) {\r\n\t\t\t\t\tlink.source =indexOfSourceAndTarget.sourceIndex;\r\n\t\t\t\t\tlink.target = indexOfSourceAndTarget.targetIndex;\r\n\t\t\t\t\tgraph.edges.push(link);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t}",
"function computeNodeLinks() {\n _(nodes).each(function(node) {\n node.sourceLinks = [];\n node.targetLinks = [];\n });\n _(links).each(function(link) {\n var source = link.source,\n target = link.target;\n if (typeof source === \"number\") source = link.source = nodes[link.source];\n if (typeof target === \"number\") target = link.target = nodes[link.target];\n source.sourceLinks.push(link);\n target.targetLinks.push(link);\n });\n }",
"setReferences(references) {\n let contextInfo = references.getOneOptional(new pip_services3_commons_node_1.Descriptor(\"pip-services\", \"context-info\", \"*\", \"*\", \"1.0\"));\n if (contextInfo != null && this._source == null) {\n this._source = contextInfo.name;\n }\n }",
"resetFlow() {\n let current = this.edgesList.head;\n\n while (current != null) {\n current.data.resetFlow();\n current = current.next;\n }\n }",
"function setRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n}",
"function setRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n}",
"function setRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n}",
"function setRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n}",
"function setRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n}",
"function setRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n}",
"function setRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n}",
"function setRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n}",
"function setRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n}"
]
| [
"0.6091946",
"0.6017897",
"0.59291023",
"0.5927652",
"0.5911776",
"0.59032995",
"0.58989304",
"0.58872604",
"0.58802027",
"0.5861781",
"0.58299994",
"0.5828967",
"0.57657737",
"0.5746016",
"0.5735655",
"0.5723207",
"0.57144654",
"0.56937146",
"0.56832844",
"0.56626827",
"0.5659648",
"0.5638631",
"0.5638631",
"0.5638631",
"0.5638631",
"0.5638631",
"0.5638631",
"0.5638631",
"0.5638631",
"0.5638631"
]
| 0.6770335 | 0 |
This method is used to determine if data is pushed on this IteratorFlow as a stream | isStream(){
return this.iterators.length > 0 && this.iterators[0].streamer && Util.isStreamer(this.iterators[0].streamer);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function hasPipeDataListeners(stream){var listeners=stream.listeners('data');for(var i=0;i<listeners.length;i++){if(listeners[i].name==='ondata'){return true;}}return false;}",
"_doPush(){//This works best for streaming from filesystem (since it is static/finite) and JS generators too...\n var obj;\n\n if( !this.isDiscretized ) {\n while(true) {\n if (!this.isListening || this.pos >= this.iterators.length)\n break;\n //get the data from the current iterator\n obj = this.iterators[this.pos].next();\n\n //check for the next iterator that has data\n while (obj.done && this.pos < this.iterators.length) {\n this.pos++;\n if (this.pos >= this.iterators.length)\n break;\n\n obj = this.iterators[this.pos].next();\n }\n\n if (obj.done)\n break;\n\n this.push(obj.value);\n }\n }\n else{//for discretized flows\n //ensure that our discrete stream length is not more than the number of iterators we have\n this.discreteStreamLength = Math.min(this.discreteStreamLength, this.iterators.length);\n\n if( this.discreteStreamLength == 1 ){//operate on one stream first and then move to the next\n do{\n obj = this.iterators[this.pos].next();\n while( !obj.done ){\n this.streamElements.push(obj.value);\n\n if( this.isDataEndObject.isDataEnd(obj.value, this.streamElements.length) ){\n this.push(this.streamElements.slice());\n this.streamElements = [];\n }\n\n obj = this.iterators[this.pos].next();\n }\n\n //At this point, if we have elements in the stream, we fill it will nulls since we are instructed to\n //discretize with one iterator\n if( this.streamElements.length > 0 ){\n while(true) {\n this.streamElements.push(null);\n if( this.isDataEndObject.isDataEnd(obj.value, this.streamElements.length) ){\n this.push(this.streamElements.slice());\n this.streamElements = [];\n break;\n }\n }\n }\n\n this.pos++;\n }while( this.pos < this.iterators.length );\n }\n else{\n var ended = []; //we need this since the iterators reset...we need to know the ones that have ended\n //a flag that states if the last check was data end. Because we cannot peek into the iterator, we have to\n //waste one round of iteration to discover that they have all ended which will create null data.\n var justEnded = false;\n\n for(let i = 0; i < this.discreteStreamLength; i++){\n ended.push(false);\n }\n\n do{\n var pack = [];\n\n for(let i = 0; i < this.discreteStreamLength; i++){\n if( ended[i] )\n pack[i] = null;\n else {\n obj = this.iterators[i].next();\n if( obj.done ) {\n ended[i] = true;\n pack[i] = null;\n }\n else\n pack[i] = obj.value;\n }\n }\n\n //check if we just ended on the last iteration and this current sets of data are just nulls\n if( justEnded && Flow.from(pack).allMatch((input) => input == null) )\n break;\n\n this.streamElements.push(pack);\n\n if( this.isDataEndObject.isDataEnd(pack, this.streamElements.length) ){\n justEnded = true;\n this.push(this.streamElements.slice());\n this.streamElements = [];\n\n //check if all items have ended\n if( Flow.from(ended).allMatch((input) => input) )\n break;\n }\n else\n justEnded = false;\n }while(true);\n }\n }\n\n this.isListening = false; //we done processing so stop listening\n this.pos = 0; //reset the pos for other operations\n }",
"get hasStream() {\n return this._outStream !== null && this._outStream !== undefined;\n }",
"isStream() {\n return this.streamRoute != null;\n }",
"hasNext() {\n return this.state.offset > 0 && this.state.history.length > 1;\n }",
"function $oLVR$var$hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data');\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true;\n }\n }\n\n return false;\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data');\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true;\n }\n }\n\n return false;\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"function hasPipeDataListeners(stream) {\n var listeners = stream.listeners('data')\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].name === 'ondata') {\n return true\n }\n }\n\n return false\n}",
"_is_readable_stream(obj) {\n if (!obj || typeof obj !== 'object') return false;\n return typeof obj.pipe === 'function' && typeof obj._readableState === 'object';\n }",
"function is_stream(xs) {\n return (array_test(xs) && xs.length === 0)\n\t|| (is_pair(xs) && typeof tail(xs) === \"function\" &&\n is_stream(stream_tail(xs)));\n}",
"function isStreamOperation(operationSpec) {\n var result = false;\n for (var statusCode in operationSpec.responses) {\n var operationResponse = operationSpec.responses[statusCode];\n if (operationResponse.bodyMapper &&\n operationResponse.bodyMapper.type.name === MapperType.Stream) {\n result = true;\n break;\n }\n }\n return result;\n }",
"function isStream (val) {\n return val && typeof val.pipe === 'function' && val.readable\n}",
"function needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n }",
"function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0)}"
]
| [
"0.65608674",
"0.6411723",
"0.6329973",
"0.6166335",
"0.61634654",
"0.6122687",
"0.6122133",
"0.6107537",
"0.6107537",
"0.6107537",
"0.6107537",
"0.6107537",
"0.6107537",
"0.6107537",
"0.6107537",
"0.6107537",
"0.6107537",
"0.6107537",
"0.6107537",
"0.6107537",
"0.6107537",
"0.6107537",
"0.6107537",
"0.6107537",
"0.59534353",
"0.5935901",
"0.57682997",
"0.57508093",
"0.5728113",
"0.57259804"
]
| 0.7266703 | 0 |
This methods merges another data input on the current stream. It is only available to IteratorFlow We can not merge Streamers with other data types | merge(data){
var isStream = this.isStream();
var iterator = FlowFactory.getIterator(data);
//ensure that we cannot mix streams and static data structures
if( (!isStream && iterator.streamer)
|| (isStream && !iterator.streamer) )
throw new Error("Streamer cannot be merged with other data types");
this.iterators.push(iterator);
return this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function merge$() {\n\tfor (var _len = arguments.length, streams = Array(_len), _key = 0; _key < _len; _key++) {\n\t\tstreams[_key] = arguments[_key];\n\t}\n\n\tvar values = streams.map(function (parent$) {\n\t\treturn parent$.value;\n\t});\n\tvar newStream = stream(values);\n\tstreams.forEach(function triggerMergedStreamUpdate(parent$, index) {\n\t\tparent$.listeners.push(function updateMergedStream(value) {\n\t\t\tnewStream(streams.map(function (parent$) {\n\t\t\t\treturn parent$.value;\n\t\t\t}));\n\t\t});\n\t});\n\treturn newStream;\n}",
"function mergeData(currentData) {\n for (var _len = arguments.length, inputs = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n inputs[_key - 1] = arguments[_key];\n }\n\n if ('merge' in currentData) {\n return currentData.merge(inputs);\n }\n return _assign2.default.apply(undefined, [{}, currentData].concat(inputs));\n}",
"merge(params) {\n let streams = utils.flatten(this, [].slice.call(arguments));\n\n return new MergeSequence(null, streams.reverse(), params);\n }",
"function stream$merge(that) {\n return Stream(observer => {\n let completeThis = false\n let completeThat = false;\n const completeBoth = () => completeThis && completeThat && observer.complete()\n const unsuscribeThis = this.subscribe({\n next: x => observer.next(x),\n complete: ()=> {\n completeThis = true\n completeBoth()\n },\n error: observer.error,\n })\n const unsubscribeThat = that.subscribe({\n next: x => observer.next(x),\n complete: ()=> {\n completeThat = true\n completeBoth()\n },\n error: observer.error\n })\n return ()=> {\n unsubscribeThat()\n unsuscribeThis()\n }\n })\n}",
"function merge$(potentialStreamsArr) {\n var values = potentialStreamsArr.map(function (parent$) {\n return parent$ && parent$.IS_STREAM ? parent$.value : parent$;\n });\n var newStream = stream(values.indexOf(undefined) === -1 ? values : undefined);\n potentialStreamsArr.forEach(function (potentialStream, index) {\n if (potentialStream.IS_STREAM) {\n potentialStream.listeners.push(function updateMergedStream(value) {\n values[index] = value;\n newStream(values.indexOf(undefined) === -1 ? values : undefined);\n });\n }\n });\n return newStream;\n}",
"function merge$(potentialStreamsArr) {\n var values = potentialStreamsArr.map(function (parent$) {\n return parent$ && parent$.IS_STREAM ? parent$.value : parent$;\n });\n var newStream = stream(values.indexOf(undefined) === -1 ? values : undefined);\n\n potentialStreamsArr.forEach(function (potentialStream, index) {\n if (potentialStream.IS_STREAM) {\n potentialStream.listeners.push(function updateMergedStream(value) {\n values[index] = value;\n newStream(values.indexOf(undefined) === -1 ? values : undefined);\n });\n }\n });\n return newStream;\n}",
"function testMergeDataStreams(stream1, stream2) {\n var expected = stream1.map(function(item) {\n return _.assign(\n _.clone(item), stream2.find(function(item2) {return item.id === item2.id;}));\n });\n\n var actual = mergeDataStreams(stream1, stream2);\n\n var passing = actual && expected.map(function(item) {\n return _.isEqual(\n item,\n actual.find(function(_item) {return _item.id === item.id; })\n );\n }).every(function(result) {return result;} );\n\n if (passing) {\n console.log('SUCCESS! mergeDataStreams works');\n }\n\n else {\n console.log('FAILURE! mergeDataStreams not working');\n }\n}",
"function merge(streams) {\r\n var mergedStream = merge2(streams);\r\n streams.forEach(function (stream) {\r\n stream.on('error', function (err) { return mergedStream.emit('error', err); });\r\n });\r\n return mergedStream;\r\n}",
"merge(other) {\n return null;\n }",
"merge() {\r\n }",
"function mergeData() {\n const mergeTarget = {};\n let i = arguments.length;\n let prop;\n let event; // Allow for variadic argument length.\n\n while (i--) {\n // Iterate through the data properties and execute merge strategies\n // Object.keys eliminates need for hasOwnProperty call\n for (prop of Object.keys(arguments[i])) {\n switch (prop) {\n // Array merge strategy (array concatenation)\n case 'class':\n case 'style':\n case 'directives':\n if (!Array.isArray(mergeTarget[prop])) {\n mergeTarget[prop] = [];\n } // Repackaging in an array allows Vue runtime\n // to merge class/style bindings regardless of type.\n\n\n mergeTarget[prop] = mergeTarget[prop].concat(arguments[i][prop]);\n break;\n // Space delimited string concatenation strategy\n\n case 'staticClass':\n if (!arguments[i][prop]) {\n break;\n }\n\n if (mergeTarget[prop] === undefined) {\n mergeTarget[prop] = '';\n }\n\n if (mergeTarget[prop]) {\n // Not an empty string, so concatenate\n mergeTarget[prop] += ' ';\n }\n\n mergeTarget[prop] += arguments[i][prop].trim();\n break;\n // Object, the properties of which to merge via array merge strategy (array concatenation).\n // Callback merge strategy merges callbacks to the beginning of the array,\n // so that the last defined callback will be invoked first.\n // This is done since to mimic how Object.assign merging\n // uses the last given value to assign.\n\n case 'on':\n case 'nativeOn':\n if (!mergeTarget[prop]) {\n mergeTarget[prop] = {};\n }\n\n const listeners = mergeTarget[prop];\n\n for (event of Object.keys(arguments[i][prop] || {})) {\n // Concat function to array of functions if callback present.\n if (listeners[event]) {\n // Insert current iteration data in beginning of merged array.\n listeners[event] = Array().concat( // eslint-disable-line\n listeners[event], arguments[i][prop][event]);\n } else {\n // Straight assign.\n listeners[event] = arguments[i][prop][event];\n }\n }\n\n break;\n // Object merge strategy\n\n case 'attrs':\n case 'props':\n case 'domProps':\n case 'scopedSlots':\n case 'staticStyle':\n case 'hook':\n case 'transition':\n if (!mergeTarget[prop]) {\n mergeTarget[prop] = {};\n }\n\n mergeTarget[prop] = { ...arguments[i][prop],\n ...mergeTarget[prop]\n };\n break;\n // Reassignment strategy (no merge)\n\n case 'slot':\n case 'key':\n case 'ref':\n case 'tag':\n case 'show':\n case 'keepAlive':\n default:\n if (!mergeTarget[prop]) {\n mergeTarget[prop] = arguments[i][prop];\n }\n\n }\n }\n }\n\n return mergeTarget;\n}",
"merge(existing, incoming) {\n const edges = [\n ...(existing ? existing.edges : []),\n ...incoming.edges\n ];\n\n return {...incoming, ...{edges}};\n }",
"function mergeData(to, from) {\r\n if (!from)\r\n return to;\r\n var key;\r\n var toVal;\r\n var fromVal;\r\n var keys = hasSymbol ? Reflect.ownKeys(from) : Object.keys(from);\r\n for (var i = 0; i < keys.length; i++) {\r\n key = keys[i];\r\n // in case the object is already observed...\r\n if (key === '__ob__')\r\n continue;\r\n toVal = to[key];\r\n fromVal = from[key];\r\n if (!hasOwn(to, key)) {\r\n to[key] = fromVal;\r\n }\r\n else if (toVal !== fromVal &&\r\n (isPlainObject(toVal) && !isWrapper(toVal)) &&\r\n (isPlainObject(fromVal) && !isWrapper(toVal))) {\r\n mergeData(toVal, fromVal);\r\n }\r\n }\r\n return to;\r\n }",
"merge(existing, incoming, { args: { offset = 0 } }) {\n // Slicing is necessary because the existing data is\n // immutable, and frozen in development.\n const merged = existing ? existing.slice(0) : [];\n for (let i = 0; i < incoming.length; ++i) {\n merged[offset + i] = incoming[i];\n }\n return merged;\n }",
"merge(data) {\n this.data = { text: this.data.text + data.text }\n }",
"function mergeData(to, from) {\n if (!from) {\n return to;\n }\n\n var key, toVal, fromVal;\n var keys = hasSymbol ? Reflect.ownKeys(from) : Object.keys(from);\n\n for (var i = 0; i < keys.length; i++) {\n key = keys[i]; // in case the object is already observed...\n\n if (key === '__ob__') {\n continue;\n }\n\n toVal = to[key];\n fromVal = from[key];\n\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (toVal !== fromVal && isPlainObject(toVal) && isPlainObject(fromVal)) {\n mergeData(toVal, fromVal);\n }\n }\n\n return to;\n }",
"function mergeData (to, from) {\n if (!from) { return to }\n var key, toVal, fromVal;\n \n var keys = hasSymbol\n ? Reflect.ownKeys(from)\n : Object.keys(from);\n \n for (var i = 0; i < keys.length; i++) {\n key = keys[i];\n // in case the object is already observed...\n if (key === '__ob__') { continue }\n toVal = to[key];\n fromVal = from[key];\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (\n toVal !== fromVal &&\n isPlainObject(toVal) &&\n isPlainObject(fromVal)\n ) {\n mergeData(toVal, fromVal);\n }\n }\n return to\n }",
"function mergeData(to, from) {\n if (!from) return to;\n var key, toVal, fromVal;\n\n var keys = hasSymbol ? Reflect.ownKeys(from) : Object.keys(from);\n\n for (var i = 0; i < keys.length; i++) {\n key = keys[i];\n // in case the object is already observed...\n if (key === \"__ob__\") continue;\n toVal = to[key];\n fromVal = from[key];\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (\n toVal !== fromVal &&\n isPlainObject(toVal) &&\n isPlainObject(fromVal)\n ) {\n mergeData(toVal, fromVal);\n }\n }\n return to;\n }",
"function mergeData (to, from) {\n\t\t var key, toVal, fromVal\n\t\t for (key in from) {\n\t\t toVal = to[key]\n\t\t fromVal = from[key]\n\t\t if (!to.hasOwnProperty(key)) {\n\t\t _.set(to, key, fromVal)\n\t\t } else if (_.isObject(toVal) && _.isObject(fromVal)) {\n\t\t mergeData(toVal, fromVal)\n\t\t }\n\t\t }\n\t\t return to\n\t\t}",
"function mergeData(to, from) {\n if (!from) {\n return to;\n }\n\n var key, toVal, fromVal;\n var keys = hasSymbol ? Reflect.ownKeys(from) : Object.keys(from);\n\n for (var i = 0; i < keys.length; i++) {\n key = keys[i]; // in case the object is already observed...\n\n if (key === '__ob__') {\n continue;\n }\n\n toVal = to[key];\n fromVal = from[key];\n\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (toVal !== fromVal && isPlainObject(toVal) && isPlainObject(fromVal)) {\n mergeData(toVal, fromVal);\n }\n }\n\n return to;\n}",
"function mergeData(to, from) {\n if (!from) {\n return to;\n }\n\n var key, toVal, fromVal;\n var keys = hasSymbol ? Reflect.ownKeys(from) : Object.keys(from);\n\n for (var i = 0; i < keys.length; i++) {\n key = keys[i]; // in case the object is already observed...\n\n if (key === '__ob__') {\n continue;\n }\n\n toVal = to[key];\n fromVal = from[key];\n\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (toVal !== fromVal && isPlainObject(toVal) && isPlainObject(fromVal)) {\n mergeData(toVal, fromVal);\n }\n }\n\n return to;\n}",
"function mergeData(to, from) {\n if (!from) {\n return to;\n }\n\n var key, toVal, fromVal;\n var keys = hasSymbol ? Reflect.ownKeys(from) : Object.keys(from);\n\n for (var i = 0; i < keys.length; i++) {\n key = keys[i]; // in case the object is already observed...\n\n if (key === '__ob__') {\n continue;\n }\n\n toVal = to[key];\n fromVal = from[key];\n\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (toVal !== fromVal && isPlainObject(toVal) && isPlainObject(fromVal)) {\n mergeData(toVal, fromVal);\n }\n }\n\n return to;\n}",
"function mergeData(to, from) {\n if (!from) {\n return to;\n }\n\n var key, toVal, fromVal;\n var keys = hasSymbol ? Reflect.ownKeys(from) : Object.keys(from);\n\n for (var i = 0; i < keys.length; i++) {\n key = keys[i]; // in case the object is already observed...\n\n if (key === '__ob__') {\n continue;\n }\n\n toVal = to[key];\n fromVal = from[key];\n\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (toVal !== fromVal && isPlainObject(toVal) && isPlainObject(fromVal)) {\n mergeData(toVal, fromVal);\n }\n }\n\n return to;\n}",
"function mergeData(to,from){if(!from){return to;}var key,toVal,fromVal;var keys=Object.keys(from);for(var i=0;i<keys.length;i++){key=keys[i];toVal=to[key];fromVal=from[key];if(!hasOwn(to,key)){set(to,key,fromVal);}else if(isPlainObject(toVal)&&isPlainObject(fromVal)){mergeData(toVal,fromVal);}}return to;}",
"function mergeData(to,from){if(!from){return to;}var key,toVal,fromVal;var keys=Object.keys(from);for(var i=0;i<keys.length;i++){key=keys[i];toVal=to[key];fromVal=from[key];if(!hasOwn(to,key)){set(to,key,fromVal);}else if(isPlainObject(toVal)&&isPlainObject(fromVal)){mergeData(toVal,fromVal);}}return to;}",
"function mergeData (to, from) {\n if (!from) { return to }\n var key, toVal, fromVal;\n\n var keys = hasSymbol\n ? Reflect.ownKeys(from)\n : Object.keys(from);\n\n for (var i = 0; i < keys.length; i++) {\n key = keys[i];\n // in case the object is already observed...\n if (key === '__ob__') { continue }\n toVal = to[key];\n fromVal = from[key];\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (\n toVal !== fromVal &&\n isPlainObject(toVal) &&\n isPlainObject(fromVal)\n ) {\n mergeData(toVal, fromVal);\n }\n }\n return to\n }",
"function mergeData (to, from) {\n if (!from) { return to }\n var key, toVal, fromVal;\n\n var keys = hasSymbol\n ? Reflect.ownKeys(from)\n : Object.keys(from);\n\n for (var i = 0; i < keys.length; i++) {\n key = keys[i];\n // in case the object is already observed...\n if (key === '__ob__') { continue }\n toVal = to[key];\n fromVal = from[key];\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (\n toVal !== fromVal &&\n isPlainObject(toVal) &&\n isPlainObject(fromVal)\n ) {\n mergeData(toVal, fromVal);\n }\n }\n return to\n }",
"function mergeData (to, from) {\n if (!from) { return to }\n var key, toVal, fromVal;\n\n var keys = hasSymbol\n ? Reflect.ownKeys(from)\n : Object.keys(from);\n\n for (var i = 0; i < keys.length; i++) {\n key = keys[i];\n // in case the object is already observed...\n if (key === '__ob__') { continue }\n toVal = to[key];\n fromVal = from[key];\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (\n toVal !== fromVal &&\n isPlainObject(toVal) &&\n isPlainObject(fromVal)\n ) {\n mergeData(toVal, fromVal);\n }\n }\n return to\n }",
"function mergeData(to, from) {\n if (!from) {\n return to\n }\n var key, toVal, fromVal;\n\n var keys = hasSymbol\n ? Reflect.ownKeys(from)\n : Object.keys(from);\n\n for (var i = 0; i < keys.length; i++) {\n key = keys[i];\n // in case the object is already observed...\n if (key === '__ob__') {\n continue\n }\n toVal = to[key];\n fromVal = from[key];\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (\n toVal !== fromVal &&\n isPlainObject(toVal) &&\n isPlainObject(fromVal)\n ) {\n mergeData(toVal, fromVal);\n }\n }\n return to\n }",
"function mergeData(to, from) {\n if (!from) return to;\n var key, toVal, fromVal;\n var keys = hasSymbol ? Reflect.ownKeys(from) : Object.keys(from);\n\n for (var i = 0; i < keys.length; i++) {\n key = keys[i]; // in case the object is already observed...\n\n if (key === '__ob__') continue;\n toVal = to[key];\n fromVal = from[key];\n\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (toVal !== fromVal && isPlainObject(toVal) && isPlainObject(fromVal)) {\n mergeData(toVal, fromVal);\n }\n }\n\n return to;\n}"
]
| [
"0.6134648",
"0.6035722",
"0.58465743",
"0.5826035",
"0.5820796",
"0.5814241",
"0.56638765",
"0.56244284",
"0.5609664",
"0.55938804",
"0.5549562",
"0.5514483",
"0.5475858",
"0.5460846",
"0.5442579",
"0.5441733",
"0.54165757",
"0.5394357",
"0.5347644",
"0.53381926",
"0.53381926",
"0.53381926",
"0.53381926",
"0.53297454",
"0.53297454",
"0.5320037",
"0.5320037",
"0.5320037",
"0.5316501",
"0.53025645"
]
| 0.7981541 | 0 |
This method is used by OutFlow to trigger the start of a push flow for finite data and for JS generators | _doPush(){//This works best for streaming from filesystem (since it is static/finite) and JS generators too...
var obj;
if( !this.isDiscretized ) {
while(true) {
if (!this.isListening || this.pos >= this.iterators.length)
break;
//get the data from the current iterator
obj = this.iterators[this.pos].next();
//check for the next iterator that has data
while (obj.done && this.pos < this.iterators.length) {
this.pos++;
if (this.pos >= this.iterators.length)
break;
obj = this.iterators[this.pos].next();
}
if (obj.done)
break;
this.push(obj.value);
}
}
else{//for discretized flows
//ensure that our discrete stream length is not more than the number of iterators we have
this.discreteStreamLength = Math.min(this.discreteStreamLength, this.iterators.length);
if( this.discreteStreamLength == 1 ){//operate on one stream first and then move to the next
do{
obj = this.iterators[this.pos].next();
while( !obj.done ){
this.streamElements.push(obj.value);
if( this.isDataEndObject.isDataEnd(obj.value, this.streamElements.length) ){
this.push(this.streamElements.slice());
this.streamElements = [];
}
obj = this.iterators[this.pos].next();
}
//At this point, if we have elements in the stream, we fill it will nulls since we are instructed to
//discretize with one iterator
if( this.streamElements.length > 0 ){
while(true) {
this.streamElements.push(null);
if( this.isDataEndObject.isDataEnd(obj.value, this.streamElements.length) ){
this.push(this.streamElements.slice());
this.streamElements = [];
break;
}
}
}
this.pos++;
}while( this.pos < this.iterators.length );
}
else{
var ended = []; //we need this since the iterators reset...we need to know the ones that have ended
//a flag that states if the last check was data end. Because we cannot peek into the iterator, we have to
//waste one round of iteration to discover that they have all ended which will create null data.
var justEnded = false;
for(let i = 0; i < this.discreteStreamLength; i++){
ended.push(false);
}
do{
var pack = [];
for(let i = 0; i < this.discreteStreamLength; i++){
if( ended[i] )
pack[i] = null;
else {
obj = this.iterators[i].next();
if( obj.done ) {
ended[i] = true;
pack[i] = null;
}
else
pack[i] = obj.value;
}
}
//check if we just ended on the last iteration and this current sets of data are just nulls
if( justEnded && Flow.from(pack).allMatch((input) => input == null) )
break;
this.streamElements.push(pack);
if( this.isDataEndObject.isDataEnd(pack, this.streamElements.length) ){
justEnded = true;
this.push(this.streamElements.slice());
this.streamElements = [];
//check if all items have ended
if( Flow.from(ended).allMatch((input) => input) )
break;
}
else
justEnded = false;
}while(true);
}
}
this.isListening = false; //we done processing so stop listening
this.pos = 0; //reset the pos for other operations
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"begin() {\n //for (let [, arr] of this.arrangements.filter(a => a.at === this.iterations && a.when === \"start\")) arr.exe();\n this.engine.phases.current = this;\n this.engine.events.emit(this.name, this);\n }",
"_definitelyPush() {\n\t\t// create copy of collected chunks to be pushed as single output chunk\n\t\tconst chunks = this.chunks.slice();\n\n\t\tthis.push( {\n\t\t\tfinished: this.finished,\n\t\t\tchunks\n\t\t} );\n\n\t\t// reset internal list of collected chunks\n\t\tthis.chunks.splice( 0, chunks.length );\n\t}",
"onStreamStart() {\n if (this.onStartTrigger.length > 0) {\n this.onStartTrigger.forEach(trigger => {\n controller.handleData(trigger);\n })\n }\n }",
"step() { }",
"enqueue(value) {\r\n this.inStack.push(value);\r\n }",
"signal(executionId, inputData) {\n return __awaiter(this, void 0, void 0, function* () {\n this.log('Action:signal ' + executionId + ' startedAt ');\n let token = null;\n this.appDelegate.executionStarted(this.executionContext);\n this.doExecutionEvent(__1.EXECUTION_EVENT.execution_invoke);\n this.tokens.forEach(t => {\n if (t.currentItem && t.currentItem.id == executionId)\n token = t;\n });\n if (!token) {\n this.tokens.forEach(t => {\n if (t.currentNode && t.currentNode.id == executionId)\n token = t;\n });\n }\n if (token) {\n this.log('..launching a token signal');\n let result = yield token.signal(inputData);\n this.log('..signal token is done');\n }\n else { // check for startEvent of a secondary process\n let node = null;\n const startedNodeId = this.tokens.get(0).path[0].elementId;\n this.definition.processes.forEach(proc => {\n let startNodeId = proc.getStartNode().id;\n if (startNodeId !== startedNodeId) {\n this.log(`checking for valid other start node: ${startNodeId} is possible`);\n if (startNodeId == executionId) {\n // ok we will start new token for this\n node = this.getNodeById(executionId);\n this.log('..starting at :' + executionId);\n }\n }\n });\n if (node) {\n let token = yield Token_1.Token.startNewToken(Token_1.TOKEN_TYPE.Primary, this, node, null, null, null, inputData);\n }\n else {\n this.getItems().forEach(i => {\n this.logger.log(`Item: ${i.id} - ${i.elementId} - ${i.status} - ${i.timeDue}`);\n });\n this.logger.error(\"*** ERROR *** task id not valid\");\n }\n }\n this.log('.signal returning .. waiting for promises status:' + this.status + \" id: \" + executionId);\n yield Promise.all(this.promises);\n this.doExecutionEvent(__1.EXECUTION_EVENT.execution_invoked);\n this.log('.signal returned process status:' + this.status + \" id: \" + executionId);\n this.report();\n });\n }",
"step() {\n }",
"function genStart() {\n if (!generate) {\n setGenerate(true)\n } else {\n setGenerate(false)\n }\n }",
"request(howManyArg) {\n if (howManyArg === 0) {\n return;\n }\n else {\n for (let i = 0; i !== howManyArg; i++) {\n if (this.payloadBuffer.length > 0) {\n this.internalPush(this.payloadBuffer.shift());\n }\n else {\n const nextPayload = this.generator();\n this.internalPush(nextPayload);\n }\n }\n }\n }",
"emitPush(data) {\n switch (typeof data) {\n case \"boolean\":\n return this.emit(data ? OpCode.PUSHT : OpCode.PUSHF);\n case \"string\":\n return this._emitString(data);\n case \"number\":\n return this._emitNum(data);\n case \"undefined\":\n return this.emitPush(false);\n case \"object\":\n if (Array.isArray(data)) {\n return this._emitArray(data);\n }\n else if (likeContractParam(data)) {\n return this._emitParam(new ContractParam(data));\n }\n else if (data === null) {\n return this.emitPush(false);\n }\n throw new Error(`Unidentified object: ${data}`);\n default:\n throw new Error();\n }\n }",
"async start() {\n const { config, emitter, states } = this;\n\n let curr;\n\n if(config.initial) {\n curr = config.initial;\n } else {\n curr = Object.keys(config.states)[0];\n }\n\n const details = {\n curr : states.get(curr),\n };\n\n await emitter.emit(`enter`, details);\n await emitter.emitSerial(`enter:${curr}`, details);\n\n this.state = curr;\n }",
"function startPipeline() {\n // In this way we read one block while we decode and play another.\n if (state.state == STATE.PLAYING) {\n processState();\n }\n processState();\n }",
"function start(){\n if( !PFlow.isReady() ) {\n setTimeout(start, 500);\n }\n else{\n PFlow.from([1,2,3,4,5]).count(value => console.log(\"Count is: \" + value))\n }\n}",
"_listen(){\n if( this.isDiscretized ) {//for discretized flows...maintain the subscription state for consistency\n var streamers = []; //the order with which we should arrange data in discretized flows\n\n for (let iterator of this.iterators) {\n if (iterator.streamer) {\n streamers.push(iterator.streamer);\n subscribeToStream(iterator.streamer, this);\n }\n }\n\n //set up the basics for a discretized push\n //this.recall.streamers = streamers; //save the order in recall\n this.recall.streamKeys = Flow.from(streamers).select((streamer) => streamer.key).collect(Flow.toArray);\n this.recall.queues = Flow.from(streamers).select((streamer) => new Queue()).collect(Flow.toArray);\n this.discreteStreamLength = Math.min(streamers.length, this.discreteStreamLength); //ensure minimum\n this.recall.ready = true; //a flag that ensures we do not have more than one setTimeout function in queue\n this.recall.called = false; //if we have called the setTimeout function at least once\n this.streamElements = [];\n }\n else{//subscribe to Streamers\n for (let iterator of this.iterators) {\n if( iterator.streamer )\n subscribeToStream(iterator.streamer, this);\n }\n }\n }",
"function push(){if(pushes>PUSHCOUNT)return;if(pushes++===PUSHCOUNT){console.error(\" push(EOF)\");return r.push(null)}console.error(\" push #%d\",pushes);r.push(new Buffer(PUSHSIZE))&&setTimeout(push)}",
"function backendLiveValueStart( aTriggerObject ) {\n console.log(\"backendLiveValueStart:\"); \n console.log(aTriggerObject);\n\n liveValue.source = new Object();\n liveValue.source.type = aTriggerObject.source.type;\n liveValue.startTime = new Date();\n\n backendLiveValueStop();\n backendLiveValue();\n }",
"async start() {\n\t\tawait this.#preprocessor.execQueue();\n\t\tawait this.#pageGen.generatePages();\n\n\t\tthis.#emitter.emit('end');\n\t}",
"function start (payload) {\n for (var id in this.callbacks) {\n this.isPending[id] = false\n this.isHandled[id] = false\n }\n this.isDispatching = true\n this.pendingPayload = payload\n}",
"function startFlow() {\n\tyCo = 8;\n \n\tfor (xCo = 0; xCo < 6; xCo++) {\n\t\tif (map.getTile(layer1.getTileX(xCo * 64), layer1.getTileY(yCo * 64), 'Tile Layer 1') != null && map.getTile(layer1.getTileX(xCo * 64), layer1.getTileY(yCo * 64), 'Tile Layer 1').index == 10) {\n\t\t\tmap.getTile(layer1.getTileX(xCo * 64), layer1.getTileY((yCo - 1) * 64), 'Tile Layer 1').properties.inFlow = \"down\";\n\t\t\tcurPipe = map.getTile(layer1.getTileX(xCo * 64), layer1.getTileY((yCo - 1) * 64), 'Tile Layer 1');\n\t\t\tanimateFlow(curPipe);\n\t\t\tcheckIfFlowable(curPipe);\n\t\t\ttimerBar.destroy();\n\t\t\tflowTimer = game.time.events.loop(Phaser.Timer.SECOND * flowSpeed, runFlow, this);\n\t\t}\n\t}\n flowStarted = true;\n}",
"preIngestData() {}",
"function push() {\n // \"done\" is a Boolean and value a \"Uint8Array\"\n reader.read().then(({ done, value }) => {\n // Is there no more data to read?\n if (done) {\n // Tell the browser that we have finished sending data\n controller.close();\n return;\n }\n \n // Get the data and send it to the browser via the controller\n controller.enqueue(value);\n push();\n });\n }",
"__nextStep() {\n this.openNextStep();\n }",
"async build() {\n // on ready\n await new Promise(resolve => this.eden.once('eden.ready', resolve));\n\n // flow setup\n await this.eden.hook('flow.build', FlowHelper);\n }",
"updateFlow() {\n this.flow += 1;\n }",
"onHookStart(payload) {\n // There is always a scenario, take the last one\n const currentSteps = this.getCurrentScenario().steps;\n payload.state = _constants.PENDING;\n payload.keyword = _utils.default.containsSteps(currentSteps) ? _constants.AFTER : _constants.BEFORE;\n return this.addStepData(payload);\n }",
"produce() {}",
"function bubbleStart(){\n bubbleLimit = numNodes; \n bubbleIndex = 0;\n bubbleStarted = true;\n bubbleIsSorted = true;\n addStep(\"Set node 1 as current and node 2 as \\\"next\\\"\");\n}",
"function newGeneration(){\n firstTime = 1;\n newGen === true ? step() : null\n}",
"function start(state) { \n service.goNext(state);\n }",
"routine(generator) {\n\t\tthis._stack.add(generator())\n\t}"
]
| [
"0.57655185",
"0.5632301",
"0.5508445",
"0.54772514",
"0.5462174",
"0.5454371",
"0.53902304",
"0.538924",
"0.5375783",
"0.53715616",
"0.5368803",
"0.53670794",
"0.5361112",
"0.532122",
"0.52992535",
"0.528071",
"0.5265861",
"0.525854",
"0.5254401",
"0.52314043",
"0.52100694",
"0.52017915",
"0.5181998",
"0.51715916",
"0.51430976",
"0.5139304",
"0.5119512",
"0.5118244",
"0.51036674",
"0.5083495"
]
| 0.6006543 | 0 |
This method subscribes a Flow (IteratorFlow) to a Streamer to listen for data changes This method is placed outside the class to prevent external access | function subscribeToStream(streamer, flow){
var func = function(data){
setTimeout(() => flow._prePush(data, streamer), 0);
};
streamer.subscribe(func);
flow.subscribers[streamer.key] = func;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_listen(){\n if( this.isDiscretized ) {//for discretized flows...maintain the subscription state for consistency\n var streamers = []; //the order with which we should arrange data in discretized flows\n\n for (let iterator of this.iterators) {\n if (iterator.streamer) {\n streamers.push(iterator.streamer);\n subscribeToStream(iterator.streamer, this);\n }\n }\n\n //set up the basics for a discretized push\n //this.recall.streamers = streamers; //save the order in recall\n this.recall.streamKeys = Flow.from(streamers).select((streamer) => streamer.key).collect(Flow.toArray);\n this.recall.queues = Flow.from(streamers).select((streamer) => new Queue()).collect(Flow.toArray);\n this.discreteStreamLength = Math.min(streamers.length, this.discreteStreamLength); //ensure minimum\n this.recall.ready = true; //a flag that ensures we do not have more than one setTimeout function in queue\n this.recall.called = false; //if we have called the setTimeout function at least once\n this.streamElements = [];\n }\n else{//subscribe to Streamers\n for (let iterator of this.iterators) {\n if( iterator.streamer )\n subscribeToStream(iterator.streamer, this);\n }\n }\n }",
"_emitChange() {\n // Must create array copy so React may detect changes\n const payload = this.queue.map(info => {\n const { stream, ...metaInfo } = info;\n return { ...metaInfo }\n });\n this.onQueueChange(payload);\n }",
"_doPush(){//This works best for streaming from filesystem (since it is static/finite) and JS generators too...\n var obj;\n\n if( !this.isDiscretized ) {\n while(true) {\n if (!this.isListening || this.pos >= this.iterators.length)\n break;\n //get the data from the current iterator\n obj = this.iterators[this.pos].next();\n\n //check for the next iterator that has data\n while (obj.done && this.pos < this.iterators.length) {\n this.pos++;\n if (this.pos >= this.iterators.length)\n break;\n\n obj = this.iterators[this.pos].next();\n }\n\n if (obj.done)\n break;\n\n this.push(obj.value);\n }\n }\n else{//for discretized flows\n //ensure that our discrete stream length is not more than the number of iterators we have\n this.discreteStreamLength = Math.min(this.discreteStreamLength, this.iterators.length);\n\n if( this.discreteStreamLength == 1 ){//operate on one stream first and then move to the next\n do{\n obj = this.iterators[this.pos].next();\n while( !obj.done ){\n this.streamElements.push(obj.value);\n\n if( this.isDataEndObject.isDataEnd(obj.value, this.streamElements.length) ){\n this.push(this.streamElements.slice());\n this.streamElements = [];\n }\n\n obj = this.iterators[this.pos].next();\n }\n\n //At this point, if we have elements in the stream, we fill it will nulls since we are instructed to\n //discretize with one iterator\n if( this.streamElements.length > 0 ){\n while(true) {\n this.streamElements.push(null);\n if( this.isDataEndObject.isDataEnd(obj.value, this.streamElements.length) ){\n this.push(this.streamElements.slice());\n this.streamElements = [];\n break;\n }\n }\n }\n\n this.pos++;\n }while( this.pos < this.iterators.length );\n }\n else{\n var ended = []; //we need this since the iterators reset...we need to know the ones that have ended\n //a flag that states if the last check was data end. Because we cannot peek into the iterator, we have to\n //waste one round of iteration to discover that they have all ended which will create null data.\n var justEnded = false;\n\n for(let i = 0; i < this.discreteStreamLength; i++){\n ended.push(false);\n }\n\n do{\n var pack = [];\n\n for(let i = 0; i < this.discreteStreamLength; i++){\n if( ended[i] )\n pack[i] = null;\n else {\n obj = this.iterators[i].next();\n if( obj.done ) {\n ended[i] = true;\n pack[i] = null;\n }\n else\n pack[i] = obj.value;\n }\n }\n\n //check if we just ended on the last iteration and this current sets of data are just nulls\n if( justEnded && Flow.from(pack).allMatch((input) => input == null) )\n break;\n\n this.streamElements.push(pack);\n\n if( this.isDataEndObject.isDataEnd(pack, this.streamElements.length) ){\n justEnded = true;\n this.push(this.streamElements.slice());\n this.streamElements = [];\n\n //check if all items have ended\n if( Flow.from(ended).allMatch((input) => input) )\n break;\n }\n else\n justEnded = false;\n }while(true);\n }\n }\n\n this.isListening = false; //we done processing so stop listening\n this.pos = 0; //reset the pos for other operations\n }",
"_setData(d) {\n if (!(d instanceof SplitStreamInputData || d instanceof SplitStreamFilter))\n console.error(\n 'Added data is not an instance of SplitStreamData or SplitStreamFilter'\n );\n\n this._datasetsLoaded++;\n this._data = d.data;\n this._update();\n }",
"_updateChangeSubscription() {\n // Sorting and/or pagination should be watched if MatSort and/or MatPaginator are provided.\n // The events should emit whenever the component emits a change or initializes, or if no\n // component is provided, a stream with just a null event should be provided.\n // The `sortChange` and `pageChange` acts as a signal to the combineLatests below so that the\n // pipeline can progress to the next step. Note that the value from these streams are not used,\n // they purely act as a signal to progress in the pipeline.\n const sortChange = this._sort ?\n Object(rxjs__WEBPACK_IMPORTED_MODULE_5__[\"merge\"])(this._sort.sortChange, this._sort.initialized) :\n Object(rxjs__WEBPACK_IMPORTED_MODULE_5__[\"of\"])(null);\n const pageChange = this._paginator ?\n Object(rxjs__WEBPACK_IMPORTED_MODULE_5__[\"merge\"])(this._paginator.page, this._internalPageChanges, this._paginator.initialized) :\n Object(rxjs__WEBPACK_IMPORTED_MODULE_5__[\"of\"])(null);\n const dataStream = this._data;\n // Watch for base data or filter changes to provide a filtered set of data.\n const filteredData = Object(rxjs__WEBPACK_IMPORTED_MODULE_5__[\"combineLatest\"])([dataStream, this._filter])\n .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_6__[\"map\"])(([data]) => this._filterData(data)));\n // Watch for filtered data or sort changes to provide an ordered set of data.\n const orderedData = Object(rxjs__WEBPACK_IMPORTED_MODULE_5__[\"combineLatest\"])([filteredData, sortChange])\n .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_6__[\"map\"])(([data]) => this._orderData(data)));\n // Watch for ordered data or page changes to provide a paged set of data.\n const paginatedData = Object(rxjs__WEBPACK_IMPORTED_MODULE_5__[\"combineLatest\"])([orderedData, pageChange])\n .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_6__[\"map\"])(([data]) => this._pageData(data)));\n // Watched for paged data changes and send the result to the table to render.\n this._renderChangesSubscription.unsubscribe();\n this._renderChangesSubscription = paginatedData.subscribe(data => this._renderData.next(data));\n }",
"process(){\n if (this.pos >= this.iterators.length) {\n this.pos = 0;\n return null;\n }\n\n if( !this.isDiscretized ) {\n //##go through the iterators one after the other##\n\n //get the data from the current iterator\n var obj = this.iterators[this.pos].next();\n\n //check for the next iterator that has data\n while (obj.done && this.pos < this.iterators.length) {\n this.pos++;\n if (this.pos >= this.iterators.length)\n break;\n\n obj = this.iterators[this.pos].next();\n }\n\n if (obj.done) {\n this.pos = 0;\n return null;\n }\n\n if (this.next !== null)\n return this.next.pipe(obj.value);\n return obj.value;\n }\n else{//for discretized flows\n //we use this instead of the streamElements cause we don't need to save state.\n //Also, clearing streamElements could affect implementations storing the output\n var streamData = [];\n\n //ensure that our discrete stream length is not more than the number of iterators we have\n this.discreteStreamLength = Math.min(this.discreteStreamLength, this.iterators.length);\n\n if( this.discreteStreamLength == 1 ){//operate on one stream first and then move to the next\n obj = this.iterators[this.pos].next();\n\n //check for the next iterator that has data\n while (obj.done && this.pos < this.iterators.length) {\n this.pos++;\n if (this.pos >= this.iterators.length)\n break;\n\n obj = this.iterators[this.pos].next();\n }\n\n if (obj.done) {\n this.pos = 0;\n return null;\n }\n\n while( !obj.done ){\n streamData.push(obj.value);\n\n if( this.isDataEndObject.isDataEnd(obj.value, streamData.length) ){\n if (this.next !== null)\n return this.next.pipe(streamData);\n return streamData;\n }\n\n obj = this.iterators[this.pos].next();\n }\n\n //At this point, if we have elements in the stream, we fill it will nulls since we are instructed to\n //discretize with one iterator\n if( streamData.length > 0 ){\n while(true) {\n streamData.push(null);\n if( this.isDataEndObject.isDataEnd(obj.value, streamData.length) ){\n if (this.next !== null)\n return this.next.pipe(streamData);\n return streamData;\n }\n }\n }\n }\n else{\n if( !this.recall.ended ) {\n this.recall.ended = []; //we need this since the iterators reset...we need to know the ones that have ended\n //a flag that states if the last check was data end. Because we cannot peek into the iterator, we have to\n //waste one round of iteration to discover that they have all ended which will create null data.\n this.recall.justEnded = false;\n\n for (let i = 0; i < this.discreteStreamLength; i++) {\n this.recall.ended.push(false);\n }\n }\n\n do{\n //check if all items have ended\n if( this.recall.justEnded && Flow.from(this.recall.ended).allMatch((input) => input) )\n break;\n\n var pack = [];\n\n for(let i = 0; i < this.discreteStreamLength; i++){\n if( this.recall.ended[i] )\n pack[i] = null;\n else {\n obj = this.iterators[i].next();\n if( obj.done ) {\n this.recall.ended[i] = true;\n pack[i] = null;\n }\n else\n pack[i] = obj.value;\n }\n }\n\n //check if we just ended on the last iteration and this current sets of data are just nulls\n if( this.recall.justEnded && Flow.from(pack).allMatch((input) => input == null) )\n break;\n\n this.streamElements.push(pack);\n\n if( this.isDataEndObject.isDataEnd(pack, this.streamElements.length) ){\n this.recall.justEnded = true;\n\n try {\n if (this.next !== null)\n return this.next.pipe(this.streamElements.slice());\n return this.streamElements.slice();\n }\n finally{\n this.streamElements = [];\n }\n }\n else\n this.recall.justEnded = false;\n }while(true);\n\n this.pos = 0; //reset the pos variable to allow for reuse\n\n //clear temp fields\n delete this.recall.ended;\n delete this.recall.justEnded;\n //reset temp stream storage variable\n this.streamElements = [];\n\n return null;\n }\n }\n }",
"_observeRenderChanges() {\n // If no data source has been set, there is nothing to observe for changes.\n if (!this.dataSource) {\n return;\n }\n let dataStream;\n if (Object(_angular_cdk_collections__WEBPACK_IMPORTED_MODULE_2__[\"isDataSource\"])(this.dataSource)) {\n dataStream = this.dataSource.connect(this);\n }\n else if (Object(rxjs__WEBPACK_IMPORTED_MODULE_6__[\"isObservable\"])(this.dataSource)) {\n dataStream = this.dataSource;\n }\n else if (Array.isArray(this.dataSource)) {\n dataStream = Object(rxjs__WEBPACK_IMPORTED_MODULE_6__[\"of\"])(this.dataSource);\n }\n if (dataStream === undefined && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw getTableUnknownDataSourceError();\n }\n this._renderChangeSubscription = dataStream.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_7__[\"takeUntil\"])(this._onDestroy))\n .subscribe(data => {\n this._data = data || [];\n this.renderRows();\n });\n }",
"observeRenderChanges() {\n let dataStream;\n // Cannot use `instanceof DataSource` since the data source could be a literal with\n // `connect` function and may not extends DataSource.\n // tslint:disable-next-line:no-unbound-method\n if (typeof this._dataSource.connect === 'function') {\n dataStream = this._dataSource.connect(this);\n }\n else if (this._dataSource instanceof Observable) {\n dataStream = this._dataSource;\n }\n else if (Array.isArray(this._dataSource)) {\n dataStream = of(this._dataSource);\n }\n if (dataStream) {\n this.dataSubscription = dataStream\n .pipe(takeUntil(this.onDestroy))\n .subscribe((data) => this.renderNodeChanges(data));\n }\n else {\n throw getTreeNoValidDataSourceError();\n }\n }",
"function emitData() {\n // While there are `data` listeners and items, emit them\n var item;\n while (this._hasListeners('data') && (item = this.read()) !== null)\n this.emit('data', item);\n // Stop draining the source if there are no more `data` listeners\n if (!this._hasListeners('data') && !this.done) {\n this.removeListener('readable', emitData);\n this._addSingleListener('newListener', waitForDataListener);\n }\n}",
"function DataEmitter() {\n}",
"updatedRecipeEmitter() {\n this.recipesChanged.next([...this.recipes]);\n this.recipeCount.next(this.recipes.length);\n }",
"async _listenToUpdates() {\n this._dbUpdatesIterator = this._changes({\n feed: 'continuous',\n heartbeat: true,\n since: this._lastSeq ? this._lastSeq : undefined\n\n // Note: we no longer use the sieve view as views on the _global_changes database appear to be\n // flaky when there is a significant amount of activity. Specifically, changes will never be\n // reported by the _changes feed and this will result in replicators and change-listeners\n // never being dirted. This becomes clear when running the stress tests with 1,000\n // replicators.\n //\n // TODO: remove the sieve view?\n //\n // filter: '_view',\n // view: this._spiegel._namespace + 'sieve/sieve'\n })\n\n this._listenToIteratorErrors(this._dbUpdatesIterator)\n\n await this._dbUpdatesIteratorEach()\n }",
"function Stream() {\n EventEmitter.call(this);\n }",
"function streaming(src) {\n\t var view = this,\n\t ds = this._model.data(src);\n\t if (!ds) return log.error('Data source \"'+src+'\" is not defined.');\n\n\t var listener = ds.pipeline()[0],\n\t streamer = this._streamer,\n\t api = {};\n\n\t // If we have it stashed, don't create a new closure.\n\t if (this._api[src]) return this._api[src];\n\n\t api.insert = function(vals) {\n\t ds.insert(dl.duplicate(vals)); // Don't pollute the environment\n\t streamer.addListener(listener);\n\t view._changeset.data[src] = 1;\n\t return api;\n\t };\n\n\t api.update = function() {\n\t streamer.addListener(listener);\n\t view._changeset.data[src] = 1;\n\t return (ds.update.apply(ds, arguments), api);\n\t };\n\n\t api.remove = function() {\n\t streamer.addListener(listener);\n\t view._changeset.data[src] = 1;\n\t return (ds.remove.apply(ds, arguments), api);\n\t };\n\n\t api.values = function() { return ds.values(); };\n\n\t return (this._api[src] = api);\n\t}",
"constructor (initialState = {}) {\n this.emitter = new EventEmitter()\n this.updates = new Map()\n this.observers = new Map()\n this.applicators = new Map()\n this.current = initialState\n\n /**\n * Creates a held source stream that holds application state.\n * Held streams output the last value on subscription.\n */\n this.source = hold(\n fromEvent(eventKey, this.emitter)\n .scan((state, event) => {\n /**\n * Actions that request state changes are passed in to the stream with\n * side effects happening within the execution of update functions\n */\n return fold(this.updates.values(), (state, update) => {\n // Apply applicators to each update\n let up = update\n if (this.applicators.size > 0) {\n for (const apply of this.applicators.values()) {\n up = apply(update)\n }\n }\n\n // Execute the update and return the result to the fold\n return up(state, event)\n }, state)\n }, initialState)\n .tap(state => {\n this.current = state\n })\n )\n\n // @TODO investigate why unsubscribing this sole subscriber\n // causes double events when the next observer comes in.\n // @TODO how to utilise these internally\n this.source.subscribe({\n next: function debug () {},\n error: function debug () {}\n })\n // subscription.unsubscribe()\n }",
"subscribe(_parent, _args, _context, _info) {\n const monitor = this.getMonitor({\n liveAbort: e => {\n if (iterator) iterator.throw(e);\n }\n });\n const iterator = makeAsyncIteratorFromMonitor(monitor);\n return iterator;\n }",
"function DataStream() {\n\tvar _this = this;\n\t\n\t_this._data = [];\n}",
"function DataStream() {\n\tvar _this = this;\n\t\n\t_this._data = [];\n}",
"function Stream(){EE.call(this);}",
"function Stream(){EE.call(this);}",
"function Stream(){EE.call(this);}",
"function Stream(){EE.call(this);}",
"function Stream() {\n EventEmitter.call(this);\n}",
"function Stream() {\n EventEmitter.call(this);\n}",
"function SimpleStream(){\n EventHandler.call(this);\n }",
"function Stream() {\n EventEmitter.call(this);\n }",
"makeStreamData (callback) {\n\t\t// find one of the other users in the team, and add them to the stream\n\t\tsuper.makeStreamData(() => {\n\t\t\tthis.addedUsers = this.getAddedUsers();\n\t\t\tthis.expectedData.stream.$addToSet = this.expectedData.stream.$addToSet || {};\n\t\t\tif (this.addedUsers.length === 1) {\n\t\t\t\t// this tests conversion of single element to an array\n\t\t\t\tconst addedUser = this.addedUsers[0];\n\t\t\t\tthis.data.$addToSet = { memberIds: addedUser.id };\n\t\t\t\tthis.expectedData.stream.$addToSet.memberIds = [addedUser.id];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst addedUserIds = this.addedUsers.map(user => user.id);\n\t\t\t\tthis.data.$addToSet = { memberIds: addedUserIds };\n\t\t\t\tthis.expectedData.stream.$addToSet.memberIds = [...addedUserIds];\n\t\t\t}\n\t\t\tthis.expectedData.stream.$addToSet.memberIds.sort();\n\t\t\tcallback();\n\t\t});\n\t}",
"static get observers() {\n return [\n 'handle_input_data_changed(inputData)'\n ]\n }",
"function IterableChanges() {}",
"function IterableChanges() {}"
]
| [
"0.65513027",
"0.5845343",
"0.5828928",
"0.58125",
"0.5673418",
"0.56472117",
"0.5590598",
"0.5556058",
"0.5555709",
"0.55441004",
"0.5483723",
"0.5482346",
"0.5442747",
"0.54296744",
"0.5423778",
"0.5405285",
"0.53719753",
"0.53719753",
"0.5355241",
"0.5355241",
"0.5355241",
"0.5355241",
"0.5354725",
"0.5354725",
"0.5351682",
"0.53435034",
"0.5338057",
"0.5334628",
"0.53325385",
"0.53325385"
]
| 0.5941531 | 1 |
This method should be called by your internal implementation to send data to listeners like the InFlow and/or IteratorFlow | send(data){
Flow.from(this.listeners).where(listener => listener.notify && Util.isFunction(listener.notify)).foreach(listener => listener.notify(data));
Flow.from(this.listeners).where(listener => !(listener.notify && Util.isFunction(listener.notify)) && Util.isFunction(listener)).foreach(listener => listener(data));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"dispatch(data) {\n this._receiveListener(data);\n }",
"onData(data) {\n this.emit(\"data\", data);\n this.onSuccess();\n }",
"onData(data) {\n this.emit(\"data\", data);\n this.onSuccess();\n }",
"onData(data) {\n this.emit(\"data\", data);\n this.onSuccess();\n }",
"onData(data) {\n this.emit(\"data\", data);\n this.onSuccess();\n }",
"onData(data) {\n this.emit(\"data\", data);\n this.onSuccess();\n }",
"function onData(data) {\n\n // Attach or extend receive buffer\n _receiveBuffer = (null === _receiveBuffer) ? data : Buffer.concat([_receiveBuffer, data]);\n\n // Pop all messages until the buffer is exhausted\n while(null !== _receiveBuffer && _receiveBuffer.length > 3) {\n var size = _receiveBuffer.readInt32BE(0);\n\n // Early exit processing if we don't have enough data yet\n if((size + 4) > _receiveBuffer.length) {\n break;\n }\n\n // Pull out the message\n var json = _receiveBuffer.toString('utf8', 4, (size + 4));\n\n // Resize the receive buffer\n _receiveBuffer = ((size + 4) === _receiveBuffer.length) ? null : _receiveBuffer.slice((size + 4));\n\n // Parse the message as a JSON object\n try {\n var msgObj = JSON.parse(json);\n\n // emit the generic message received event\n _self.emit('message', msgObj);\n\n // emit an object-type specific event\n if((typeof msgObj.messageName) === 'undefined') {\n _self.emit('unknown', msgObj);\n } else {\n _self.emit(msgObj.messageName, msgObj);\n }\n }\n catch(ex) {\n _self.emit('exception', ex);\n }\n }\n }",
"function ondata(data) {\n\tswitch (data.type) {\n\t\tcase 'publish':\n\t\t\tsaveMsg.call(this, data.channel, data.msg);\n\t\t\tonNewData.call(this, data.channel, data.msg);\n\t\t\tbreak;\n\t\tcase 'subscribe':\n\t\t\tchsSub.call(this, data.id, data.channels);\n\t\t\tonNewSubscr.call(this, data.id, data.channels);\n\t\t\tbreak;\n\t\tcase 'notify':\n\t\t\tonNewNotifications.call(this, data.notifications);\n\t\t\tbreak;\n\t}\n}",
"listenForData() {\n this.socket.on(EVENT_DATA, data => this.handleData(data))\n }",
"_sendData() {\n\n }",
"function emitData() {\n // While there are `data` listeners and items, emit them\n var item;\n while (this._hasListeners('data') && (item = this.read()) !== null)\n this.emit('data', item);\n // Stop draining the source if there are no more `data` listeners\n if (!this._hasListeners('data') && !this.done) {\n this.removeListener('readable', emitData);\n this._addSingleListener('newListener', waitForDataListener);\n }\n}",
"onData(data) {\n const callback = packet => {\n // if its the first message we consider the transport open\n if (\"opening\" === this.readyState && packet.type === \"open\") {\n this.onOpen();\n }\n // if its a close packet, we close the ongoing requests\n if (\"close\" === packet.type) {\n this.onClose({ description: \"transport closed by the server\" });\n return false;\n }\n // otherwise bypass onData and handle the message\n this.onPacket(packet);\n };\n // decode payload\n decodePayload(data, this.socket.binaryType).forEach(callback);\n // if an event did not trigger closing\n if (\"closed\" !== this.readyState) {\n // if we got data we're not polling\n this.polling = false;\n this.emitReserved(\"pollComplete\");\n if (\"open\" === this.readyState) {\n this.poll();\n }\n }\n }",
"onDataReceived(data) {\n /*\n All received data is appended to a ReceiveBuffer.\n This makes sure that all the data we need is received before we attempt to process it.\n */\n this._receiveBuffer.append(data);\n // Process data that we have.\n this.processData();\n }",
"function realHandler(data) {\n self.bytesReceived += data.length;\n self._receiver.add(data);\n }",
"function realHandler(data) {\n self.bytesReceived += data.length;\n self._receiver.add(data);\n }",
"function realHandler(data) {\n self.bytesReceived += data.length;\n self._receiver.add(data);\n }",
"onData(data) {\n const self = this;\n debug(\"polling got data %s\", data);\n const callback = function(packet, index, total) {\n // if its the first message we consider the transport open\n if (\"opening\" === self.readyState && packet.type === \"open\") {\n self.onOpen();\n }\n\n // if its a close packet, we close the ongoing requests\n if (\"close\" === packet.type) {\n self.onClose();\n return false;\n }\n\n // otherwise bypass onData and handle the message\n self.onPacket(packet);\n };\n\n // decode payload\n parser.decodePayload(data, this.socket.binaryType).forEach(callback);\n\n // if an event did not trigger closing\n if (\"closed\" !== this.readyState) {\n // if we got data we're not polling\n this.polling = false;\n this.emit(\"pollComplete\");\n\n if (\"open\" === this.readyState) {\n this.poll();\n } else {\n debug('ignoring poll - transport state \"%s\"', this.readyState);\n }\n }\n }",
"onData(data) {\n const self = this;\n debug(\"polling got data %s\", data);\n const callback = function(packet, index, total) {\n // if its the first message we consider the transport open\n if (\"opening\" === self.readyState && packet.type === \"open\") {\n self.onOpen();\n }\n\n // if its a close packet, we close the ongoing requests\n if (\"close\" === packet.type) {\n self.onClose();\n return false;\n }\n\n // otherwise bypass onData and handle the message\n self.onPacket(packet);\n };\n\n // decode payload\n parser.decodePayload(data, this.socket.binaryType).forEach(callback);\n\n // if an event did not trigger closing\n if (\"closed\" !== this.readyState) {\n // if we got data we're not polling\n this.polling = false;\n this.emit(\"pollComplete\");\n\n if (\"open\" === this.readyState) {\n this.poll();\n } else {\n debug('ignoring poll - transport state \"%s\"', this.readyState);\n }\n }\n }",
"onData(data) {\n debug(\"polling got data %s\", data);\n const callback = packet => {\n // if its the first message we consider the transport open\n if (\"opening\" === this.readyState && packet.type === \"open\") {\n this.onOpen();\n }\n // if its a close packet, we close the ongoing requests\n if (\"close\" === packet.type) {\n this.onClose();\n return false;\n }\n // otherwise bypass onData and handle the message\n this.onPacket(packet);\n };\n // decode payload\n (0, engine_io_parser_1.decodePayload)(data, this.socket.binaryType).forEach(callback);\n // if an event did not trigger closing\n if (\"closed\" !== this.readyState) {\n // if we got data we're not polling\n this.polling = false;\n this.emit(\"pollComplete\");\n if (\"open\" === this.readyState) {\n this.poll();\n }\n else {\n debug('ignoring poll - transport state \"%s\"', this.readyState);\n }\n }\n }",
"static listen(data){\n\t\t\tswitch (data.event) {\n\t\t\t\tcase \"createPlaceableObjects\":\n\t\t\t\t\t{\n\t\t\t\t\t\tlet [parent, createdObjs, options, userId] = data.eventdata;\n\t\t\t\t\t\tparent = game.scenes.get(parent._id);\n\t\t\t\t\t\tHooks.callAll(\"createPlaceableObjects\", parent, createdObjs, options, userId);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"AttachToToken\":\n\t\t\t\t\tif(TokenAttacher.isFirstActiveGM())\tTokenAttacher._AttachToToken(...data.eventdata);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"DetachFromToken\":\n\t\t\t\t\tif(TokenAttacher.isFirstActiveGM())\tTokenAttacher._DetachFromToken(...data.eventdata);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"attachElementsToToken\":\n\t\t\t\t\tif(TokenAttacher.isFirstActiveGM())\tTokenAttacher._attachElementsToToken(...data.eventdata);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"detachElementsFromToken\":\n\t\t\t\t\tif(TokenAttacher.isFirstActiveGM())\tTokenAttacher._detachElementsFromToken(...data.eventdata);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"ReattachAfterUndo\":\n\t\t\t\t\tif(TokenAttacher.isFirstActiveGM())\tTokenAttacher._ReattachAfterUndo(...data.eventdata);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"UpdateAttachedOfBase\":\n\t\t\t\t\tif(TokenAttacher.isFirstActiveGM())\tTokenAttacher._UpdateAttachedOfBase(...data.eventdata);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"setElementsLockStatus\":\n\t\t\t\t\tif(TokenAttacher.isFirstActiveGM())\tTokenAttacher._setElementsLockStatus(...data.eventdata);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tconsole.log(\"Token Attacher| wtf did I just read?\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"on(data) {\n switch (data.type) {\n case ACTION_TYPES.CHANGE_GRAMMAR:\n this.onGrammar(data.grammar);\n break;\n case ACTION_TYPES.MOVE_CURSOR:\n this.onCursorMoved(data.cursor, data.user);\n break;\n case ACTION_TYPES.HIGHLIGHT:\n this.onHighlight(data.newRange, data.userId);\n break;\n case ACTION_TYPES.CHANGE_FILE:\n this.onChange(data.path, data.buffer);\n break;\n default:\n }\n }",
"function DataEmitter() {\n}",
"processData(socket, data) {\n\n rideProcess.listen(socket, data);\n\n\n }",
"function sendEvent(data, localHandler = function (data) {\n }) {\n /*now we serve the queue as well*/\n localHandler(data);\n eventQueue.forEach(fn => fn(data));\n }",
"onData(data) {\n const self = this;\n debug(\"polling got data %s\", data);\n const callback = function(packet, index, total) {\n // if its the first message we consider the transport open\n if (\"opening\" === self.readyState && packet.type === \"open\") {\n self.onOpen();\n }\n\n // if its a close packet, we close the ongoing requests\n if (\"close\" === packet.type) {\n self.onClose();\n return false;\n }\n\n // otherwise bypass onData and handle the message\n self.onPacket(packet);\n };\n\n // decode payload\n lib$1.decodePayload(data, this.socket.binaryType).forEach(callback);\n\n // if an event did not trigger closing\n if (\"closed\" !== this.readyState) {\n // if we got data we're not polling\n this.polling = false;\n this.emit(\"pollComplete\");\n\n if (\"open\" === this.readyState) {\n this.poll();\n } else {\n debug('ignoring poll - transport state \"%s\"', this.readyState);\n }\n }\n }",
"function onrecieveData(data)\n{\n\t for (myConnection in connections) \n\t { // iterate over the array of connections\n\t\tconnections[myConnection].send(data); // send the data to each connection\n\t }\n\tconsole.log(\"Received data: \" + data);\n}",
"constructor() {\n super();\n\n this._Add_event(\"offer\");\n this._Add_event(\"data_in\");\n this._Add_event(\"file_end\");\n }",
"on() {\n socket.emit('OUTPUT', { index: this.index, method: 'on' });\n }",
"function onEvent(type, data) {\n eventsBuffer.push({type: type, data: data});\n }",
"recieveData(data) {\n switch (data.event) {\n\n //Start game event.\n case \"begin-game\":\n if (this.gameState === 0) {\n this.handleStartGame();\n this.handleStartTurn();\n }\n break;\n //Event for joining a team\n case \"join-team\":\n this.handleJoinTeam(data);\n break;\n\n //This just forwards team chat.\n case \"team-chat\":\n this.handleTeamChat(data);\n break;\n\n //This happens when the client submits the red hint data.\n case \"red-hints\":\n this.handleRedHints(data);\n break;\n //This happens when the client submits the blue hint data.\n case \"blue-hints\":\n this.handleBlueHints(data);\n break;\n\n //When guesses are being made, update selections across all clients\n case \"red-selections\":\n this.handleRedSelections(data);\n break;\n case \"blue-selections\":\n this.handleBlueSelections(data);\n break;\n\n //This event contains guess data for each team.\n case \"submit-guess\":\n this.handleGuess(data);\n break;\n\n //Round is over, clients are ready for the next round to begin.\n case \"next-round\":\n if (this.gameState === 5) {\n this.advanceTurnOrder();\n this.currentRound += 1;\n this.handleStartTurn();\n }\n break;\n\n //Reset the game for a new one.\n case \"new-game\":\n if (this.gameState === 6) {\n this.handleNewGame();\n }\n break;\n default:\n break;\n }\n }"
]
| [
"0.64082885",
"0.62990487",
"0.62565744",
"0.6215769",
"0.6215769",
"0.6215769",
"0.61426413",
"0.60756236",
"0.60725445",
"0.6047418",
"0.6030183",
"0.6023809",
"0.5988507",
"0.59221447",
"0.59221447",
"0.59221447",
"0.59020776",
"0.59020776",
"0.5895517",
"0.588165",
"0.58688277",
"0.58588547",
"0.5847683",
"0.58475935",
"0.58347017",
"0.580714",
"0.57848203",
"0.57804734",
"0.5761901",
"0.5728413"
]
| 0.73781633 | 0 |
Generate HTML and JSON reports | async report() {
const { logger, db } = this[OPTIONS];
const testedPages = await db.read('tested_pages');
logger.info('Saving JSON report');
const json = new JSONReporter(this[OPTIONS]);
await json.open();
await json.write(testedPages);
await json.close();
logger.info('Saving HTML Report');
const html = new HTMLReporter(this[OPTIONS]);
await html.open();
await html.write(testedPages);
await html.close();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static generateHTMLReport(capabilities) {\n const os = require(\"os\");\n\n report.generate({\n jsonDir: path.resolve('./test/'),\n reportPath: path.resolve('./test/'),\n metadata: {\n browser: {\n name: capabilities.get('browserName'),\n version: capabilities.get('version')\n },\n device: \"PC\",\n platform: {\n name: os.platform() === \"win32\" ? \"windows\" : os.platform(),\n version: os.release()\n }\n }\n });\n }",
"static generateReport() {\n let data = [];\n console.info(\"Processing Json Report Files\");\n let files = fs.readdirSync(intermediateJsonFilesDirectory);\n for (let i in files) {\n let f = `${intermediateJsonFilesDirectory}/${files[i]}`;\n console.log(`Processing file ${f}`);\n try {\n let fileContent = fs.readFileSync(f, 'utf-8');\n data.push(JSON.parse(fileContent)[0]);\n }catch (err) {\n if (err) {\n console.error(`Failed to process file ${f}`);\n console.error(err);\n }\n }\n }\n\n console.info(\"Writing consolidated json file\");\n try {\n fs.writeFileSync('./e2e/reports/combinedJSON/cucumber_report.json', JSON.stringify(data));\n } catch (err) {\n if (err) {\n console.error(\"Failed to generate the consolidated json file.\");\n console.error(err);\n throw err;\n }\n }\n\n console.info(\"Generating Final HTML Report\");\n try {\n reporter.generate(cucumberReporterOptions);\n } catch (err) {\n if (err) {\n console.error(\"Failed to generate the final html report\");\n console.error(err);\n throw err;\n }\n }\n }",
"generateFinalReport() {\n const obj = {\n environment: \"Dev\",\n numberOfTestSuites: this._numberOfTestSuites,\n totalTests: this._numberOfTests,\n browsers: this.browsers,\n testsState: [{\n state: this.standardTestState('Passed'),\n total: this._numberOfPassedTests\n }, {\n state: this.standardTestState('Failed'),\n total: this._numberOfFailedTests\n }, {\n state: this.standardTestState('Skipped'),\n total: this._numberOfSkippedTests\n\n }],\n testsPerBrowserPerState: this._testsCountPerBrowserPerState,\n testsPerSuitePerState: this._testsCountPerSuitePerState,\n testsWeatherState: this.weatherState,\n totalDuration: this._totalDuration,\n testsPerBrowser: this._testsPerBrowser\n };\n\n jsonfile.writeFile(this._finalReport, obj, {\n spaces: 2\n }, function(err) {\n if (err !== null) {\n console.error('Error saving JSON to file:', err)\n }\n console.info('Report generated successfully.');\n });\n }",
"function sendBack(html) {\n\n const tmpl = jsr.templates('./public/views/report.html');\n\n // Build the template with jsrender and send to client.\n res.type('text/html').send(tmpl.render({\n dir: env.path,\n title: env.workspace.title || 'GEOLYTIX | XYZ',\n nanoid: nanoid(6),\n token: req.query.token || token.signed || '\"\"',\n template: html || null,\n script_js: 'views/report.js'\n }));\n }",
"function renderHTML()\n {\n \n\n fs.writeFile('result/index.html', getTemplate(renderScript()), (err) => {\n \n if (err) throw err;\n \n console.log('HTML generated!');\n });\n \n\n }",
"function generateReport(options, successCallback) {\n Database.getFullPlan(options.plan, function success(plan) {\n // Initialise data objects\n var resultsMatrix = {};\n var calc = {total: 0, pass: 0, fail: 0, pending: 0};\n Database.getAllWhere(\"results\", \"plan\", options.plan, function(results) {\n // Organise results so they can be accessed by page and criterion ID\n results.forEach(function(result) {\n resultsMatrix[result.page] = resultsMatrix[result.page] || {};\n resultsMatrix[result.page][result.criterion] = result;\n });\n // Generate the report and pass it back as a string\n successCallback(\"<h1>Web Accessibility Report (\" + plan.details.name + \")</h1>\" +\n \"<h4>Generated: \" + Date() + \"</h4>\" +\n \"<hr>\" +\n // Go through each pages group\n plan.pages.map(function(pages_group) {\n return \"<h2>Web page group: \" + pages_group.name + \"</h2>\" +\n \"<ul>\" +\n (pages_group.items.length ?\n // List all pages in this group\n pages_group.items.map(function(page) {\n return \"<li>\" + page.title + \" (\" + page.url + \")</li>\";\n }).join(\"\") +\n \"</ul>\" +\n // Go through each criteria group\n plan.criteria.map(function(criteria_group) {\n return \"<h3>Criteria set: \" + criteria_group.name + \"</h3>\" +\n \"<ul>\" +\n (criteria_group.items.length ?\n // Go through each criterion in this group\n criteria_group.items.map(function(criterion) {\n return \"<li>\" +\n // Include criterion details (where they exist and are requested in the options)\n \"<h4>\" + criterion.name + \"</h4>\" +\n \"<p>\" + criterion.description.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\\n/g, \"<br>\") + \"</p>\" +\n (options.criteria_details ?\n \"<h5>Why is it important?</h5>\" +\n \"<p>\" + criterion.reasoning.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\\n/g, \"<br>\") + \"</p>\" +\n \"<h5>Guidance</h5>\" +\n \"<p>\" + criterion.guidance.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\\n/g, \"<br>\") + \"</p>\" +\n \"<h5>Documentation</h5>\" +\n \"<p>\" + criterion.links.map(function(link) { return \"<a href='\" + link + \"' target='_blank'>\" + link + \"</a>\"; }).join(\"<br>\") + \"</p>\"\n : \"\") +\n \"<h4>Results</h4>\" +\n // Work out result totals for all pages in this group\n pages_group.items.map(function(page, index) {\n if (index == 0) calc.total = calc.pass = calc.fail = calc.pending = 0;\n var result = (resultsMatrix[page.id] && resultsMatrix[page.id][criterion.id]) || {status: \"pending\"};\n if (options.statuses.indexOf(result.status) != -1) {\n calc.total++;\n calc[result.status]++;\n }\n return \"\";\n }).join(\"\") +\n // Calculate percentages from result totals (for status requested in the options)\n options.statuses.map(function(status) {\n return status.charAt(0).toUpperCase() + status.slice(1) + \": \" + calc[status] + \"/\" + calc.total + \" (\" + (calc.total > 0 ? (Math.round(calc[status] / calc.total * 100) + \"%\") : \"n/a\") + \")<br>\";\n }).join(\"\") +\n (options.level == \"individual\" ?\n // Include information about each individual test on each page (if requested in the options)\n \"<br><ul>\" +\n pages_group.items.map(function(page) {\n var result = (resultsMatrix[page.id] && resultsMatrix[page.id][criterion.id]) || {status: \"pending\"};\n // Only include this test result is it has one of the statuses requested\n return (options.statuses.indexOf(result.status) != -1) ?\n \"<li>\" +\n page.title + \" (\" + page.url + \") - \" + result.status +\n (options.results_annotations && result.annotation ?\n \"<p>\" + result.annotation.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\\n/g, \"<br>\") + \"</p>\"\n : \"\") +\n (options.results_images && result.image ?\n \"<p><img src='\" + result.image + \"'></p>\"\n : \"\") +\n \"</li>\"\n : \"\";\n }).join(\"\") +\n \"</ul>\"\n : \"\") +\n \"</li>\";\n }).join(\"\")\n : \"<li><em>No criteria</em></li>\") +\n \"</ul>\" +\n \"\";\n }).join(\"\") +\n (options.tables ?\n // Create a table overview of tests on all the pages in this group\n \"<table border='1' cellspacing='2' cellpadding='2'>\" +\n \"<tr>\" +\n \"<th></th>\" +\n // List all pages on the x-axis\n pages_group.items.map(function(page) {\n return \"<th>\" + page.title + \"</th>\";\n }).join(\"\") +\n \"</tr>\" +\n plan.criteria.map(function(criteria_group) {\n // Include criteria group names\n return \"<tr><td><strong>\" + criteria_group.name + \"</strong></td></tr>\" +\n (criteria_group.items.length ?\n // Go through each criterion in the group\n criteria_group.items.map(function(criterion) {\n return \"<tr>\" +\n \"<td>\" + criterion.name + \"</td>\" +\n pages_group.items.map(function(page) {\n var result = (resultsMatrix[page.id] && resultsMatrix[page.id][criterion.id]) || {status: \"pending\"};\n return \"<td>\" +\n (options.statuses.indexOf(result.status) != -1 ?\n // Include tick icon for passing results\n (result.status == \"pass\" ? \"<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMZJREFUOE/FjjEKwkAQRWezdiFJZ29toWfwEoJ6Bw/hRYR4Jru0whYO2AU06B+Z1Y1F1gTEB0N2d/77hP5CwYWV0Ws/REw4KWV6l+ScW8OmJKa7DEr2uoqTcdaSMTfLdqPrbiCKfPiQ17omco2T0FivLczZWAgtGb/+lqumEnmHhcNM9flJVBZU9oFXyVeygIItlk0QdHib4RuXPRCWCNWBcA3O3bIHJQuEL4Ho5ZVG4iA8h3QaJHsgTSAfB8melNORHn8N0QMwhI66An4NAgAAAABJRU5ErkJggg=='> \" : \"\") +\n // Include cross icon for failing results\n (result.status == \"fail\" ? \"<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAKpJREFUOE+lU0EKgCAQ3CD7pPSK+kDQrd7qJehgkO2sJFHqoR0YCHdmWlclIBwHubYdXNctm7WNLGaAGjTQwiMI3kcz0ckMzph1n+dPCNZQEw20CGEvzGMy30TINKUQfD/MNxEyErf0LkSyYev7BsyYI9lLVYExizBfkx/UWiyTtc8tCl5DKhPmzJAFckyllkGu1Y5ZF6DagmqI6mNUXyT1VVY/JuD/cya6APHAd2wGj7MPAAAAAElFTkSuQmCC'> \" : \"\") +\n result.status.charAt(0).toUpperCase() + result.status.slice(1)\n : \"\") +\n \"</td>\";\n }).join(\"\") +\n \"</tr>\";\n }).join(\"\")\n : \"<tr><td colspan='\" + (pages_group.items.length + 1) + \"'><em>No criteria</em></td></tr>\")\n }).join(\"\") +\n \"</table>\"\n : \"\")\n : \"<li><em>No pages</em></li></ul>\");\n }).join(\"\") +\n \"\" +\n \"\");\n });\n });\n}",
"function createHtml (){\n fs.writeFileSync(outputPath, render(teamTotal), \"utf-8\");\n console.log(\"Your Team html has been created. Go to the output folder to see your creation.\")\n}",
"function writeHTML() {\n\n const html = generateHTML(employees);\n\n writeFileAsync(\"./output/team.html\", html);\n\n console.log(\"team page built!\")\n\n}",
"function produceReport(){\n // this is were most functions are called\n\n userURL = getuserURL();\n\n // add this into the website\n vertifyHttps(userURL); // check if the url is http/s\n googleSafeBrowsingAPI(userURL);\n virusTotalAPI(userURL);\n apilityCheck(userURL);\n}",
"function printHTML() {\n const html = render(employeeArr);\n fs.writeFile(outputPath, html, (err) => {\n if (err) throw err;\n console.log(\"HTML successfully generated and saved to ./output.\");\n return;\n });\n}",
"function generateHTML() {\n\n \n fs.writeFile(outputPath, render(members), \"UTF-8\", (err) => {\n \n\n \n if (err) throw err;\n \n });\n \n console.log(members);\n\n }",
"function generate_all_reports()\n{\n report_ToAnswer_emails();\n report_FollowUp_emails();\n report_Work_FollowUp_emails();\n}",
"function generateReport (data, outputPdfPath) {\n return webServer.start(webServerPortNo, data)\n .then(server => {\n const urlToCapture = \"http://localhost:\" + webServerPortNo;\n return captureReport(urlToCapture, \"svg\", outputPdfPath)\n .then(() => server.close());\n });\n}",
"function buildHtmlPage(fileName, data) {\n fs.writeFileSync(fileName, data, function (err) {\n if (err) {\n console.log(err);\n } else {\n console.log(\"Success. Your team log was created.\");\n }\n });\n console.log(teamMembers);\n}",
"function generaReportErm(){\n\t\n\twindow.location.href= \"/CruscottoAuditAtpoWebWeb/jsonATPO/getReportErmPDF\";\n\t\n}",
"function buildHTMLTable(reports) {\n // Get a reference to the table body\n var tbody = d3.select(\"tbody\");\n // Clear table body\n tbody.html(\"\")\n\n // loop through ech report and add to HTML table body\n reports.forEach((report) => {\n console.log(report)\n var row = tbody.append(\"tr\");\n Object.entries(report).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}",
"function generateTestReport() {\n var fileName = 'FileSystem - Report.pdf';\n FileMapper.clearAllMappingsInConfig();\n Workbook.setActiveWorkbookPath('c:\\\\user\\\\desktop');\n QUnit.load(testFunctions);\n // Run tests and generate html output\n var htmlOutput = QUnit.getHtml();\n htmlOutput.setWidth(1200);\n htmlOutput.setHeight(800);\n // Display test results\n SpreadsheetApp.getUi().showModalDialog(htmlOutput, fileName);\n // Save test results in Google Drive\n var blob = htmlOutput.getBlob();\n var pdf = blob.getAs('application/pdf');\n DriveApp.createFile(pdf).setName(fileName);\n}",
"function main() {\n const allResults = [];\n fs.readdirSync(constants.OUT_PATH).forEach(siteDir => {\n const sitePath = path.resolve(constants.OUT_PATH, siteDir);\n if (!utils.isDir(sitePath)) {\n return;\n }\n allResults.push({site: siteDir, results: analyzeSite(sitePath)});\n });\n const generatedResults = groupByMetrics(allResults);\n fs.writeFileSync(\n GENERATED_RESULTS_PATH,\n `var generatedResults = ${JSON.stringify(generatedResults)}`\n );\n console.log('Opening the charts web page...'); // eslint-disable-line no-console\n opn(path.resolve(__dirname, 'index.html'));\n}",
"function _generateHeaderReport() {\n\n\tthis.htmlFile.writeln( \"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Transitional//EN\\\" \\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\\">\");\n this.htmlFile.writeln( \"<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\" >\");\n\tthis.htmlFile.writeln( \"<head>\");\n\tthis.htmlFile.writeln( \" <title>KPI Report</title>\");\n\tthis.htmlFile.writeln( \"</head>\");\n\tthis.htmlFile.writeln( \"<style type=\\\"text/css\\\"></style>\");\n\tthis.htmlFile.writeln( \"<body>\");\n\t\n\tthis.htmlFile.writeln( \"<p>KPI report</p>\" );\n\n\t\n}",
"function DrawReport(oJsonResult) {\n\n if (oJsonResult.ERROR != null) {\n window.alert(options.PluginName + \": Server error getting report:\\n\" + oJsonResult.ERROR);\n return;\n }\n\n try {\n\n //Get result table\n var oResultTable = oJsonResult.resultTable;\n\n //Get the DOM object displaying the result table\n var oPrintedTable = getReportTables(oResultTable, true/*Draw column names*/);\n\n //Add export to Excel link \n var oDivReportName = $(\".ReportDataExcel\", oContainer);\n applyExcelLinkWithPrintableColumns(oDivReportName, options);\n\n\n //Get template element to be populated by report \n var oDivReportData = $(\".ReportData\", oContainer);\n\n oDivReportData.html(oPrintedTable);\n\n }\n catch (errorMsg) {\n window.alert(options.PluginName + \": Error displaying report:\\n\" + errorMsg);\n }\n }",
"function reports(req,res){\n res.render('admin/general/views/reports');\n}",
"function renderReport(doc) {\n\n // ----------------------------------------------\n let br = document.createElement('br');\n let hr = document.createElement('hr');\n let page = document.createElement('span');\n\n let caption = document.createElement('h4'); //append caption\n let innerCaption = document.createElement('small');\n var t1 = document.createTextNode(\"PREVIOUS POSTS\");\n innerCaption.appendChild(t1);\n caption.appendChild(innerCaption)\n\n // append hr\n\n let title = document.createElement('h3'); //append title\n title.textContent = doc.data().studentUserName;\n\n let date = document.createElement('h5')//append date\n let icons = document.createElement('span')\n icons.classList.add('glyphicon');\n icons.classList.add('glyphicon-time');\n let time = document.createElement('span');\n time.textContent = doc.data().time;\n var t2 = document.createTextNode(' Posted on ');\n date.appendChild(icons);\n date.appendChild(t2);\n date.appendChild(time);\n\n\n let mainIcons = document.createElement('h5')//mainIcons\n let glyph1 = document.createElement('span');\n glyph1.classList.add('label');\n glyph1.classList.add('label-success');\n var t3 = document.createTextNode('created');\n var t5 = document.createTextNode(' ');\n glyph1.appendChild(t3);\n let glyph2 = document.createElement('span');\n glyph2.classList.add('label');\n glyph2.classList.add('label-primary');\n var t4 = document.createTextNode('read');\n glyph2.appendChild(t4);\n mainIcons.appendChild(glyph1);\n mainIcons.appendChild(t5);\n mainIcons.appendChild(glyph2);\n\n // append break (br)\n // append break (br)\n\n let comment = document.createElement('p')//append comment\n comment.textContent = doc.data().report;\n\n page.appendChild\n\n page.appendChild(caption);\n page.appendChild(hr);\n page.appendChild(title);\n page.appendChild(date);\n page.appendChild(mainIcons);\n page.appendChild(comment);\n page.appendChild(br);\n page.appendChild(br);\n page.appendChild(br);\n\n reportList.appendChild(page);\n\n}",
"function _buildHTMLBody(model) {\n\n\t//load the template source\n\tvar source = dc.readFileSync(__dirname + '/../assets/templates/employee_sales_report_text.htm')\n\t\n\t//compile the template source into an HB template\n\tvar template = hb.compile(source);\n\t\n\t//register the helpers\n\t//average hourly sales\n\thb.registerHelper(\"dollar_converter\", function(number) {\n\t\treturn (number / 100).toFixed(2); \n\t});\n\n\thb.registerHelper(\"to_fixed\", function(number) {\n\t\treturn number.toFixed(2); \n\t});\n\n\t//add the data to the template\n\tvar data = model;\n\t\n\t//render the results\n\tvar result = template(data);\n\n\t//return the text body\n\treturn result;\n}",
"function create_report() {\n // send ajax request to server\n var callback = function(responseText) {\n // tmp\n //myT = responseText;\n // end tmp\n // process response from server\n var tests = JSON.parse(responseText);\n google.charts.setOnLoadCallback( function () {\n drawAnnotations(tests);\n });\n }\n httpAsync(\"GET\", window.location.origin + '/star_tests.json' + window.location.search, callback);\n\n}",
"function generateReport(){\n\t//create reports folder (if it doesn't already exist)\n\tif(!fs.existsSync(\"reports\")){\n\t\tfs.mkdirSync(\"reports\");\n\t}\n\t\n\t//create a file called by timestamp\n\tvar date = new Date();\n\treportfile = \"reports/\"+date.getDate()+\"-\"+date.getMonth()+\"-\"+date.getFullYear()+\"--\"+date.getHours()+\"h\"+date.getMinutes()+\"m.tex\";\n\t\n\twriteReport();\n\tvar err = createPDF();\n\tif(err){\n\t\tconsole.log(\"ERR : Error during creation of PDF report\");\n\t}\n}",
"function pushAnswersToRender(employees) {\ntry {\n fs.writeFileSync('index.html', generateFile(employees));\n console.log('Success! Your team profiles page has been created!');\n //console.log(employees);\n } catch (error) {\n console.log(error);\n };\n}",
"display() {\n fs.writeFile(outputFile, makeHtml(this.team), function (err){\n if (err) {\n console.log(err)\n } else {\n console.log(\"Made file!\");\n }\n });\n }",
"function _generateFooterReport() {\n\t\n\n\tthis.htmlFile.writeln( \"</body>\");\n\tthis.htmlFile.writeln( \"</html>\");\n}",
"static generateXMLReport(pathToJson, pathToXml) {\n const builder = new xml2js.Builder();\n const jsonReport = require(path.resolve(pathToJson));\n\n const xml = builder.buildObject(new JunitReport(jsonReport).build());\n\n fs.writeFile(path.resolve(pathToXml), xml, (err) => {\n if (err) {\n throw err\n }\n })\n }",
"function generate_json(page){\n\tvar csv = \"used in,name,title,type,description,format,bareNumber\\n\\\nviews,Date,Date,date,the date in which the views occurred - in ISO8601 format YYYY-MM-DD,%y/%m/%d,\\n\\\nuser-contributions,Date,Date,date,the date in which the views occurred - in ISO8601 format YYYY-MM-DD,%y/%m/%d,\\n\\\nviews,Views,Total of visualizations received,integer,Total of visualizations the items in the GLAM have had within the specified time period. The loading of a page which contains the image is considered as a visualization of said image.,default,TRUE\\n\\\nuser-contributions,User,Username,string,The Wikimedia username of a user who has made contributions to the GLAM in question.,default,\\n\\\nuser-contributions,Count,Count of contributions,integer,Total count of contributions (creations, edits and deletions) made by the User to the items of the GLAM.,default,TRUE\\n\\\ncount,Count,Count of contributions,integer,Total count of contributions (creations, edits and deletions) made by the User to the items of the GLAM.,default,TRUE\\n\\\nusage,File,File name,string,Name of a Wikimedia Commons file.,default,\\n\\\nusage,Project,Wikimedia project,string,Wikimedia project in which the file has been used.,default,\\n\\\nusage,Page,Page title,string,Title of the page in the Project which uses the File.,default,\\n\";\n\tvar lines = csv.split(\"\\n\");\n\tvar headers = lines[0].split(\",\");\n\tvar json = \"\";\n\tjson += '{\\n\\t\"schema\":{\\n';\n\tjson += '\\t\\t\"fields\": [\\n';\n\n\tfor (var i = 1; i < lines.length; i++) {\n\t\tvar current = lines[i].split(\",\");\n\t\tif (page == current[0]) {\n\t\tjson += '\\t\\t\\t{\\n';\n\t\t\tfor (var j = 1; j < headers.length; j++) { // won't add empty information to the JSON\n\t\t\t\tif (current[j] != \"\") json += '\\t\\t\\t\\t\"' + headers[j] + '\": \"' +current[j] + '\",\\n';\n\t\t\t}\n\t\tjson = json.substring(0, json.length - 2) + \"\\n\"; // removes trailing comma\n\t\tjson += '\\t\\t\\t},\\n';\n\t\t}\n\t}\n\tjson = json.substring(0, json.length - 2) + \"\\n\"; // removes trailing comma\n\tjson += \"\\t\\t]\\n\\t}\\n}\";\n\n\treturn (json);\n}"
]
| [
"0.6794463",
"0.66173285",
"0.6382862",
"0.6302422",
"0.6292933",
"0.62754923",
"0.62583613",
"0.62321824",
"0.6148897",
"0.6145369",
"0.60203487",
"0.6013818",
"0.5989477",
"0.59849805",
"0.59810555",
"0.59620833",
"0.5927691",
"0.5901185",
"0.58981466",
"0.58895123",
"0.58887446",
"0.58863384",
"0.5863658",
"0.5856929",
"0.58292437",
"0.57893604",
"0.5788662",
"0.57847244",
"0.5783711",
"0.5756215"
]
| 0.74107265 | 0 |
///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// Function: settingDialog Usage: create the main dialog Input: settings to initialize the dialog with , ExportInfo object Return: true if ok, false if cancel | function settingDialog(exportInfo) {
dlgMain = new Window("dialog", strTitle);
dlgMain.orientation = 'column';
dlgMain.alignChildren = 'left';
// -- top of the dialog, first line
dlgMain.add("statictext", undefined, strLabelDestination);
// -- two groups, one for left and one for right ok, cancel
dlgMain.grpTop = dlgMain.add("group");
dlgMain.grpTop.orientation = 'row';
dlgMain.grpTop.alignChildren = 'top';
dlgMain.grpTop.alignment = 'fill';
// -- group contains four lines
dlgMain.grpTopLeft = dlgMain.grpTop.add("group");
dlgMain.grpTopLeft.orientation = 'column';
dlgMain.grpTopLeft.alignChildren = 'left';
dlgMain.grpTopLeft.alignment = 'fill';
// -- the second line in the dialog
dlgMain.grpSecondLine = dlgMain.grpTopLeft.add("group");
dlgMain.grpSecondLine.orientation = 'row';
dlgMain.grpSecondLine.alignChildren = 'center';
dlgMain.etDestination = dlgMain.grpSecondLine.add("edittext", undefined, exportInfo.destination.toString());
dlgMain.etDestination.preferredSize.width = StrToIntWithDefault( stretDestination, 160 );
dlgMain.btnBrowse= dlgMain.grpSecondLine.add("button", undefined, strButtonBrowse);
dlgMain.btnBrowse.onClick = btnBrowseOnClick;
// -- the third line in the dialog
dlgMain.grpThirdLine = dlgMain.grpTopLeft.add("statictext", undefined, strLabelStyle);
// -- the fourth line in the dialog
dlgMain.etStyle = dlgMain.grpTopLeft.add("edittext", undefined, exportInfo.style.toString());
dlgMain.etStyle.alignment = 'fill';
dlgMain.etStyle.preferredSize.width = StrToIntWithDefault( stretDestination, 160 );
// -- the fifth line in the dialog
dlgMain.cbSelection = dlgMain.grpTopLeft.add("checkbox", undefined, strCheckboxSelectionOnly);
dlgMain.cbSelection.value = exportInfo.selectionOnly;
// the right side of the dialog, the ok and cancel buttons
dlgMain.grpTopRight = dlgMain.grpTop.add("group");
dlgMain.grpTopRight.orientation = 'column';
dlgMain.grpTopRight.alignChildren = 'fill';
dlgMain.btnRun = dlgMain.grpTopRight.add("button", undefined, strButtonRun );
dlgMain.btnRun.onClick = btnRunOnClick;
dlgMain.btnCancel = dlgMain.grpTopRight.add("button", undefined, strButtonCancel );
dlgMain.btnCancel.onClick = function() {
var d = this;
while (d.type != 'dialog') {
d = d.parent;
}
d.close(cancelButtonID);
}
dlgMain.defaultElement = dlgMain.btnRun;
dlgMain.cancelElement = dlgMain.btnCancel;
dlgMain.grpBottom = dlgMain.add("group");
dlgMain.grpBottom.orientation = 'column';
dlgMain.grpBottom.alignChildren = 'left';
dlgMain.grpBottom.alignment = 'fill';
dlgMain.pnlHelp = dlgMain.grpBottom.add("panel");
dlgMain.pnlHelp.alignment = 'fill';
dlgMain.etHelp = dlgMain.pnlHelp.add("statictext", undefined, strHelpText, {multiline:true});
dlgMain.etHelp.alignment = 'fill';
// in case we double clicked the file
app.bringToFront();
dlgMain.center();
var result = dlgMain.show();
if (cancelButtonID == result) {
return result;
}
// get setting from dialog
exportInfo.destination = dlgMain.etDestination.text;
exportInfo.style = dlgMain.etStyle.text;
exportInfo.selectionOnly = dlgMain.cbSelection.value;
return result;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function settingDialog(exportInfo) { //设置对话框\n\n\tvar brush,\n\t\tdestination,\n\t\tresult,\n\t\ttestFolder;\n\n\tdlgMain = new Window('dialog', strTitle);\n\n\t// match our dialog background color to the host application\n\tbrush = dlgMain.graphics.newBrush(dlgMain.graphics.BrushType.THEME_COLOR, 'appDialogBackground');\n\tdlgMain.graphics.backgroundColor = brush;\n\tdlgMain.graphics.disabledBackgroundColor = dlgMain.graphics.backgroundColor;\n\n\tdlgMain.orientation = 'column';\n\tdlgMain.alignChildren = 'left';\n\n\t// -- top of the dialog, first line\n\tdlgMain.add('statictext', undefined, strLabelDestination);\n\n\t// -- two groups, one for left and one for right ok, cancel\n\tdlgMain.grpTop = dlgMain.add('group');\n\tdlgMain.grpTop.orientation = 'row';\n\tdlgMain.grpTop.alignChildren = 'top';\n\tdlgMain.grpTop.alignment = 'fill';\n\n\t// -- group top left\n\tdlgMain.grpTopLeft = dlgMain.grpTop.add('group');\n\tdlgMain.grpTopLeft.orientation = 'column';\n\tdlgMain.grpTopLeft.alignChildren = 'left';\n\tdlgMain.grpTopLeft.alignment = 'fill';\n\n\t// -- the second line in the dialog\n\tdlgMain.grpSecondLine = dlgMain.grpTopLeft.add('group');\n\tdlgMain.grpSecondLine.orientation = 'row';\n\n\tdlgMain.etDestination = dlgMain.grpSecondLine.add('edittext', undefined, exportInfo.destination.toString());\n\n\tdlgMain.etDestination.alignment = 'fill';\n\tdlgMain.etDestination.preferredSize.width = strToIntWithDefault(stretDestination, 160);\n\n\tdlgMain.btnBrowse = dlgMain.grpSecondLine.add('button', undefined, strButtonBrowse);\n\n\tdlgMain.btnBrowse.alignment = 'right';\n\n\tdlgMain.btnBrowse.onClick = function() {\n\t\tvar defaultFolder = dlgMain.etDestination.text;\n\t\ttestFolder = new Folder(dlgMain.etDestination.text);\n\t\tif (!testFolder.exists) {\n\t\t\tdefaultFolder = '~';\n\t\t}\n\t\tvar selFolder = Folder.selectDialog(strTitleSelectDestination, defaultFolder);\n\t\tif (selFolder != null) {\n\t\t\tdlgMain.etDestination.text = selFolder.fsName;\n\t\t}\n\t\tdlgMain.defaultElement.active = true;\n\t};\n\n\t// -- the third line in the dialog\n\tdlgMain.grpTopLeft.add('statictext', undefined, strLabelFileNamePrefix);\n\n\n\n\t// -- the fourth line in the dialog\n\tdlgMain.etFileNamePrefix = dlgMain.grpTopLeft.add('edittext', undefined, exportInfo.fileNamePrefix.toString());\n\tdlgMain.etFileNamePrefix.alignment = 'fill';\n\tdlgMain.etFileNamePrefix.preferredSize.width = strToIntWithDefault(stretDestination, 160);\n\n\t// start\n\t// dlgMain.grpTopLeft.add('statictext', undefined, strLabelCssUnit);\n\n\tdlgMain.cssUnitPanel = dlgMain.grpTopLeft.add('panel', undefined, strLabelCssUnit);\n\tdlgMain.cssUnitPanel.group = dlgMain.cssUnitPanel.add('group');\n\tdlgMain.cssUnitPanel.group.orientation = 'row';\n\tdlgMain.cssUnitPanel.group.alignChildren = 'left';\n\tdlgMain.cssUnitPanel.group.alignment = 'fill';\n\n\tdlgMain.cssUnitPanel.alignment = 'fill';\n\n\tdlgMain.cssUnitPx = dlgMain.cssUnitPanel.group.add('RadioButton', undefined, '');\n\tdlgMain.cssUnitPx.text = '相对单位(rem)';\n\tdlgMain.cssUnitPx.data = 'rem';\n\tdlgMain.cssUnitPx.value = true;\n\n\tdlgMain.cssUnitPx = dlgMain.cssUnitPanel.group.add('RadioButton', undefined, '');\n\tdlgMain.cssUnitPx.text = '像素(px)';\n\tdlgMain.cssUnitPx.data = 'px';\n\n\tdlgMain.cssUnitPer = dlgMain.cssUnitPanel.group.add('RadioButton', undefined, '');\n\tdlgMain.cssUnitPer.text = '百分比(%)';\n\tdlgMain.cssUnitPer.data = '%';\n\n\t// option has been removed, force export visible only\n\n\n\t// -- the fifth line in the dialog\n\tdlgMain.grpTopLeft.add('statictext', undefined, strCheckboxVisibleOnly);\n\n\n\t// -- the sixth line is the panel\n\tdlgMain.pnlFileType = dlgMain.grpTopLeft.add('panel', undefined, strLabelFileType);\n\tdlgMain.pnlFileType.alignment = 'fill';\n\n\t// -- now a dropdown list\n\tdlgMain.ddFileType = dlgMain.pnlFileType.add('dropdownlist');\n\tdlgMain.ddFileType.preferredSize.width = strToIntWithDefault(strddFileType, 100);\n\tdlgMain.ddFileType.alignment = 'left';\n\n\t// file types in the dropdown\n\tdlgMain.ddFileType.add('item', 'PNG-24');\n\tdlgMain.ddFileType.add('item', 'PNG-8');\n\tdlgMain.ddFileType.add('item', 'JPEG');\n\n\tdlgMain.ddFileType.onChange = function() {\n\t\thideAllFileTypePanel();\n\t\tswitch (this.selection.index) {\n\n\t\t\tcase png24Index:\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.text = strPNG24Options;\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.show();\n\t\t\t\tbreak;\n\n\t\t\tcase png8Index:\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.text = strPNG8Options;\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.show();\n\t\t\t\tbreak;\n\n\t\t\tcase jpegIndex:\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.text = strJPEGOptions;\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions.show();\n\t\t\t\tbreak;\n\t\t}\n\t};\n\n\tdlgMain.ddFileType.items[exportInfo.fileType].selected = true;\n\n\t// -- now after all the radio buttons\n\tdlgMain.cbIcc = dlgMain.pnlFileType.add('checkbox', undefined, strCheckboxIncludeICCProfile);\n\tdlgMain.cbIcc.value = exportInfo.icc;\n\tdlgMain.cbIcc.alignment = 'left';\n\n\t// -- now the options panel that changes\n\tdlgMain.pnlFileType.pnlOptions = dlgMain.pnlFileType.add('panel', undefined, 'Options');\n\tdlgMain.pnlFileType.pnlOptions.alignment = 'fill';\n\tdlgMain.pnlFileType.pnlOptions.orientation = 'stack';\n\tdlgMain.pnlFileType.pnlOptions.preferredSize.height = strToIntWithDefault(strpnlOptions, 100);\n\n\t// PNG8 options\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options = dlgMain.pnlFileType.pnlOptions.add('group');\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trans = dlgMain.pnlFileType.pnlOptions.grpPNG8Options.add('checkbox', undefined, strCheckboxPNGTransparency.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Inter = dlgMain.pnlFileType.pnlOptions.grpPNG8Options.add('checkbox', undefined, strCheckboxPNGInterlaced.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trm = dlgMain.pnlFileType.pnlOptions.grpPNG8Options.add('checkbox', undefined, strCheckboxPNGTrm.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trans.value = exportInfo.png8Transparency;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Inter.value = exportInfo.png8Interlaced;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trm.value = exportInfo.png8Trim;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.visible = (exportInfo.fileType == png8Index);\n\n\t// PNG24 options\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options = dlgMain.pnlFileType.pnlOptions.add('group');\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trans = dlgMain.pnlFileType.pnlOptions.grpPNG24Options.add('checkbox', undefined, strCheckboxPNGTransparency.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Inter = dlgMain.pnlFileType.pnlOptions.grpPNG24Options.add('checkbox', undefined, strCheckboxPNGInterlaced.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trm = dlgMain.pnlFileType.pnlOptions.grpPNG24Options.add('checkbox', undefined, strCheckboxPNGTrm.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trans.value = exportInfo.png24Transparency;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Inter.value = exportInfo.png24Interlaced;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trm.value = exportInfo.png24Trim;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.visible = (exportInfo.fileType == png24Index);\n\n\t// JPEG options\n\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions = dlgMain.pnlFileType.pnlOptions.add('group');\n\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions.add('statictext', undefined, strLabelQuality);\n\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions.etQuality = dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.add('edittext', undefined, exportInfo.jpegQuality.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions.etQuality.preferredSize.width = strToIntWithDefault(stretQuality, 30);\n\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions.visible = (exportInfo.fileType == jpegIndex);\n\n\t// the right side of the dialog, the ok and cancel buttons\n\tdlgMain.grpTopRight = dlgMain.grpTop.add('group');\n\tdlgMain.grpTopRight.orientation = 'column';\n\tdlgMain.grpTopRight.alignChildren = 'fill';\n\n\tdlgMain.btnRun = dlgMain.grpTopRight.add('button', undefined, strButtonRun);\n\n\tdlgMain.btnRun.onClick = function() {\n\t\t// add by ray\n\t\tcreateCssImgFolder();\n\t\t// get css unit\n\t\tgetCssUnit();\n\t\tdestination = dlgMain.etDestination.text;\n\t\tif (destination.length == 0) {\n\t\t\talert(strAlertSpecifyDestination);\n\t\t\treturn;\n\t\t}\n\t\ttestFolder = new Folder(destination);\n\t\tif (!testFolder.exists) {\n\t\t\talert(strAlertDestinationNotExist);\n\t\t\treturn;\n\t\t}\n\n\t\tdlgMain.close(runButtonID);\n\t};\n\n\tdlgMain.btnCancel = dlgMain.grpTopRight.add('button', undefined, strButtonCancel);\n\n\tdlgMain.btnCancel.onClick = function() {\n\t\tdlgMain.close(cancelButtonID);\n\t};\n\n\tdlgMain.defaultElement = dlgMain.btnRun;\n\tdlgMain.cancelElement = dlgMain.btnCancel;\n\n\t// the bottom of the dialog\n\tdlgMain.grpBottom = dlgMain.add('group');\n\tdlgMain.grpBottom.orientation = 'column';\n\tdlgMain.grpBottom.alignChildren = 'left';\n\tdlgMain.grpBottom.alignment = 'fill';\n\n\tdlgMain.pnlHelp = dlgMain.grpBottom.add('panel');\n\tdlgMain.pnlHelp.alignment = 'fill';\n\n\tdlgMain.etHelp = dlgMain.pnlHelp.add('statictext', undefined, strHelpText, {\n\t\tmultiline: true\n\t});\n\tdlgMain.etHelp.alignment = 'fill';\n\n\tdlgMain.onShow = function() {\n\t\tdlgMain.ddFileType.onChange();\n\t};\n\n\t// give the hosting app the focus before showing the dialog\n\tapp.bringToFront();\n\n\tdlgMain.center();\n\n\tresult = dlgMain.show();\n\n\tif (cancelButtonID == result) {\n\t\treturn result; // close to quit\n\t}\n\n\t// get setting from dialog\n\texportInfo.destination = dlgMain.etDestination.text;\n\t// kpedt force valid prefix for html\n\tif (!dlgMain.etFileNamePrefix.text.length) {\n\t\texportInfo.fileNamePrefix = 'x';\n\t} else {\n\t\texportInfo.fileNamePrefix = webStr(dlgMain.etFileNamePrefix.text);\n\t}\n\t// kpedt force visible only\n\texportInfo.visibleOnly = true;\n\texportInfo.fileType = dlgMain.ddFileType.selection.index;\n\texportInfo.icc = dlgMain.cbIcc.value;\n\texportInfo.jpegQuality = dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.etQuality.text;\n\n\treturn result;\n}",
"function ui_settingsDialog(exportInfo) {\n\n\t// Configure the dialog\n\tvar res = String(\" \\\n\t\tdialog { \\\n\t\t\ttext: '\"+strTitle+\"', \\\n\t\t\torientation: 'column', \\\n\t\t\talignChildren: 'left', \\\n\t\t\tgrpDestination: Group { \\\n\t\t\t\tlabel: StaticText { text: '\"+ escapeString(strLabelDestination) +\"', preferredSize: [ 140, 15 ] }, \\\n\t\t\t\tfield: EditText { text: '\"+ escapeString(exportInfo.destination) +\"', preferredSize: [ 300, 21 ] }, \\\n\t\t\t\tbtnBrowse: Button { text: '\"+ escapeString(strButtonBrowse) +\"', preferredSize: [ 80, 23 ] } \\\n\t\t\t}, \\\n\t\t\tgrpFilenameTemplate: Group { \\\n\t\t\t\tlabel: StaticText { text: '\"+ strLabelFilenameTemplate +\"', preferredSize: [ 140, 15 ] }, \\\n\t\t\t\tfield: EditText { text: '\"+ escapeString(exportInfo.filenameTemplate) +\"', preferredSize: [ 300, 21 ] }, \\\n\t\t\t\tbtnHelp: Button { text: '\"+ escapeString(strButtonHelp) +\"', preferredSize: [ 80, 23 ] } \\\n\t\t\t}, \\\n\t\t\tgrpFilenamePreview: Group { \\\n\t\t\t\tlabel: StaticText { text: '\"+ strLabelFilenamePreview +\"', preferredSize: [ 140, 15 ] }, \\\n\t\t\t\tfield: StaticText { text: 'qwe asdf asdf asdf asd', preferredSize: [ 390, 15 ] }, \\\n\t\t\t}, \\\n\t\t\tgrpOperationMode: Group { \\\n\t\t\t\tlabel: StaticText { text: '\"+ strLabelMode +\"', preferredSize: [ 140, 15 ] }, \\\n\t\t\t\tfield: DropDownList { preferredSize: [ 390, 25 ] }, \\\n\t\t\t}, \\\n\t\t\tgrpOptions: Group { \\\n\t\t\t\tlabel: StaticText { text: '', preferredSize: [ 140, 15 ] }, \\\n\t\t\t\tfieldExportSelected: Checkbox { text: '\"+ strLabelExportSelected +\"', value: \"+ exportInfo.exportSelected +\" }, \\\n\t\t\t\tfieldTrim: Checkbox { text: '\"+ strLabelTrim +\"', value: \"+ exportInfo.trim +\" }, \\\n\t\t\t}, \\\n\t\t\tpnlWrapper: Panel { \\\n\t\t\t\ttext: '\"+ escapeString(strLabelWrapper) +\"', \\\n\t\t\t\talignment: 'fill', \\\n\t\t\t\talignChildren: 'left', \\\n\t\t\t\tmargins: [ 20, 20, 20, 20], \\\n\t\t\t\tgrpWrapperMode: Group { \\\n\t\t\t\t\tlabel: StaticText { text: '\"+ escapeString(strLabelWrapperMode) +\"', preferredSize: [ 120, 15 ] }, \\\n\t\t\t\t\tfield: DropDownList { preferredSize: [ 370, 25 ] }, \\\n\t\t\t\t}, \\\n\t\t\t\tgrpWindowTitle: Group { \\\n\t\t\t\t\tlabel: StaticText { text: '\"+ escapeString(strWindowTitle) +\"', preferredSize: [ 120, 15 ] }, \\\n\t\t\t\t\tfield: EditText { text: '\"+ escapeString(exportInfo.Wrapper.windowTitle) +\"', preferredSize: [ 370, 21 ] }, \\\n\t\t\t\t}, \\\n\t\t\t\tgrpWindowURL: Group { \\\n\t\t\t\t\tlabel: StaticText { text: '\"+ escapeString(strWindowURL) +\"', preferredSize: [ 120, 15 ] }, \\\n\t\t\t\t\tfield: EditText { text: '\"+ escapeString(exportInfo.Wrapper.windowURL) +\"', preferredSize: [ 370, 21 ] }, \\\n\t\t\t\t}, \\\n\t\t\t\tgrpBackgroundColor: Group { \\\n\t\t\t\t\tlabel: StaticText { text: '\"+ escapeString(strBackgroundColor) +\"', preferredSize: [ 120, 15 ] }, \\\n\t\t\t\t\tfield: EditText { text: '\"+ escapeString(exportInfo.Wrapper.backgroundColor) +\"', preferredSize: [ 370, 21 ] }, \\\n\t\t\t\t}, \\\n\t\t\t}, \\\n\t\t\tpnlExportSettings: Panel { \\\n\t\t\t\ttext: '\"+ escapeString(strExportSettings) +\"', \\\n\t\t\t\talignment: 'fill', \\\n\t\t\t\talignChildren: 'left', \\\n\t\t\t\tmargins: [ 20, 20, 20, 10], \\\n\t\t\t\tgrpFileType: Group { \\\n\t\t\t\t\tlabel: StaticText { text: '\"+ escapeString(strFileType) +\"', preferredSize: [ 120, 15 ] }, \\\n\t\t\t\t\tfield: DropDownList { preferredSize: [ 100, 25 ] }, \\\n\t\t\t\t}, \\\n\t\t\t\tgrpIncludeICCProfile: Group { \\\n\t\t\t\t\tlabel: StaticText { text: '\"+ escapeString(strIncludeICCProfile) +\"', preferredSize: [ 120, 15 ] }, \\\n\t\t\t\t\tfield: Checkbox { text: '', value: \"+ exportInfo.icc +\" }, \\\n\t\t\t\t}, \\\n\t\t\t\tgrpOptions: Group { \\\n\t\t\t\t\tvisible: false, \\\n\t\t\t\t\torientation: 'stack', \\\n\t\t\t\t\tgrpJPGOptions: Group { \\\n\t\t\t\t\t\tvisible: false, \\\n\t\t\t\t\t}, \\\n\t\t\t\t\tgrpPNGOptions: Group { \\\n\t\t\t\t\t\tvisible: false, \\\n\t\t\t\t\t}, \\\n\t\t\t\t\tgrpPSDOptions: Group { \\\n\t\t\t\t\t\tvisible: false, \\\n\t\t\t\t\t}, \\\n\t\t\t\t\tgrpTIFFOptions: Group { \\\n\t\t\t\t\t\tvisible: false, \\\n\t\t\t\t\t}, \\\n\t\t\t\t}, \\\n\t\t\t}, \\\n\t\t\tgrpButtons: Group { \\\n\t\t\t\torientation: 'stack', \\\n\t\t\t\talignment: 'fill', \\\n\t\t\t\tgrpLeft: Group { \\\n\t\t\t\t\talignment: 'left', \\\n\t\t\t\t\tbtnDocumentation: Button { text: '\"+ escapeString(strButtonDocumentation) +\"', alignment: 'left' }, \\\n\t\t\t\t}, \\\n\t\t\t\tgrpRight: Group { \\\n\t\t\t\t\talignment: 'right', \\\n\t\t\t\t\tbtnRun: Button { text: '\"+ escapeString(strButtonRun) +\"', alignment: 'right', properties: { name:'ok' } }, \\\n\t\t\t\t\tbtnSave: Button { text: '\"+ escapeString(strButtonSave) +\"', alignment: 'right' }, \\\n\t\t\t\t\tbtnCancel: Button { text: '\"+ escapeString(strButtonCancel) +\"', alignment: 'right', properties: { name:'cancel' } }, \\\n\t\t\t\t}, \\\n\t\t\t}, \\\n\t\t} \\\n\t\").replace(/^\\s+/, '');\n\n\tdlgMain = new Window(res);\n\n\t// Adding operation modes\n\tvar operationModeDropdown = dlgMain.grpOperationMode.field;\n\tfor (var i = 0; i < operationModesOrder.length; i++ ) {\n\t\tvar num = operationModesOrder[i];\n\t\tvar item = operationModeDropdown.add( \"item\", operationModes[num] );\n\t\tif ( exportInfo.operationMode == num ) item.selected = true;\n\t}\n\n\t// Adding Wrapper Modes\n\tvar dropdown = dlgMain.pnlWrapper.grpWrapperMode.field;\n\tfor (var i = 0; i < wrapperModes.length; i++ ) {\n\t\tvar item = dropdown.add( \"item\", wrapperModes[i] );\n\t\tif ( exportInfo.Wrapper.mode == i ) item.selected = true;\n\t}\n\n\t// File types selector\n\tvar selectedIndex;\n\tvar selectedFileType;\n\tvar FileTypeDropDown = dlgMain.pnlExportSettings.grpFileType.field;\n\tfor (var i = 0; i < fileTypes.length; i++ ) {\n\t\tvar item = FileTypeDropDown.add( \"item\", fileTypes[i] );\n\t\tif ( exportInfo.fileType == i ) item.selected = true;\n\t}\n\tFileTypeDropDown.onChange = onFileTypeChange;\n\tonFileTypeChange();\n\n\t// Update filename template preview\n\tdlgMain.grpFilenameTemplate.field.onChanging = onFilenameTemplateChange;\n\tonFilenameTemplateChange();\n\n\t// Buttuns Events\n\tdlgMain.grpFilenameTemplate.btnHelp.onClick = onHelpButtonPress;\n\tdlgMain.grpDestination.btnBrowse.onClick = onBrowseButtonPress;\n\tdlgMain.grpButtons.grpRight.btnRun.onClick = onRunButtonPress;\n\tdlgMain.grpButtons.grpRight.btnSave.onClick = onSaveButtonPress;\n\tdlgMain.grpButtons.grpRight.btnCancel.onClick = onCancelButtonPress;\n\tdlgMain.grpButtons.grpLeft.btnDocumentation.onClick = onDocumentationButtonPress;\n\n\t// Open Window\n\tapp.bringToFront();\n\n\tdlgMain.center();\n\n\tvar result = dlgMain.show();\n\tif (cancelButtonID == result) {\n\t\treturn result;\n\t}\n\n\tLog.notice(\"Sending positive response from the dialog\");\n\n\t// Get settings from dialog\n exportInfo.destination = dlgMain.grpDestination.field.text;\n exportInfo.filenameTemplate = dlgMain.grpFilenameTemplate.field.text;\n exportInfo.operationMode = operationModesOrder[dlgMain.grpOperationMode.field.selection.index];\n exportInfo.exportSelected = dlgMain.grpOptions.fieldExportSelected.value;\n exportInfo.trim = dlgMain.grpOptions.fieldTrim.value;\n\n exportInfo.Wrapper.mode = dlgMain.pnlWrapper.grpWrapperMode.field.selection.index;\n exportInfo.Wrapper.windowTitle = dlgMain.pnlWrapper.grpWindowTitle.field.text;\n exportInfo.Wrapper.windowURL = dlgMain.pnlWrapper.grpWindowURL.field.text;\n exportInfo.Wrapper.backgroundColor = dlgMain.pnlWrapper.grpBackgroundColor.field.text;\n\n // Backwards comptibility\n // exportInfo.safariWrap = dlgMain.pnlWrapper.grpEnable.field.value;\n // exportInfo.safariWrap_windowTitle = dlgMain.pnlWrapper.grpWindowTitle.field.text;\n // exportInfo.safariWrap_windowURL = dlgMain.pnlWrapper.grpWindowURL.field.text;\n // exportInfo.safariWrap_backgroundColor = dlgMain.pnlWrapper.grpBackgroundColor.field.text;\n\n exportInfo.fileType = dlgMain.pnlExportSettings.grpFileType.field.selection.index;\n exportInfo.icc = dlgMain.pnlExportSettings.grpIncludeICCProfile.field.value;\n\n\treturn result;\n\n}",
"function showSettingsDialog() {\n var html = getSettings();\n\n html.setWidth(400);\n html.setHeight(300);\n\n SpreadsheetApp.getUi()\n .showModalDialog(html, 'Fuzzy.ai Settings');\n}",
"function openSettingsDialog() {\n\n\tif(settingsDialog == undefined || $(settingsDialog).dialog('isOpen') == false)\n\t{\n\t\tsettingsDialog = dialogs.generateDialog(language.data.settings, html.generateSettingsHTML());\n\t}\n\n\tdialogs.openDialog(settingsDialog);\n\n\t$('input#cancel-settings').die();\n\t$('input#confirm-settings').die();\n\n\tvar task_delete = Titanium.App.Properties.getString('task_delete', '1');\n\t$('div.radios#task-delete-radios input#task_delete_' + task_delete).attr('checked', 'checked');\n\n\t$('input#cancel-settings').live('click', function() {\n\t\t$(settingsDialog).dialog('close')\n\t});\n\n\t$('input#confirm-settings').live('click', function() {\n\t\tvar new_task_delete = $('div.radios#task-delete-radios input:checked').val();\n\t\tTitanium.App.Properties.setString('task_delete', new_task_delete.toString());\n\t\t$(settingsDialog).dialog('close')\n\t});\n}",
"function showDialog() {\r\ttry {\r\t\tvar win = new Window('dialog', localize(text.title));\r\r\t\t// description\r\t\twin.desc = win.add('panel');\r\t\twin.desc.orientation = 'row';\r\t\twin.desc.alignment = 'fill';\r\t\twin.desc.alignChildren = 'left';\r\r\t\twin.desc.coords = win.desc.add('group');\r\t\twin.desc.coords.orientation = 'row';\r\t\twin.desc.coords.add('statictext', undefined, localize(text.desc));\r\r\t\t// vertical guide settings\r\t\twin.vSettings = win.add('panel', undefined, localize(text.vSettings));\r\t\twin.vSettings.orientation = 'row';\r\t\twin.vSettings.alignment = 'fill';\r\t\twin.vSettings.alignChildren = 'center';\r\r\t\twin.vSettings.coords = win.vSettings.add('group');\r\t\twin.vSettings.coords.orientation = 'row';\r\t\twin.vSettings.coords.add('statictext', undefined, \"x:\");\r\t\twin.vSettings.coords.input = win.vSettings.coords.add('edittext', undefined, \"\");\r\t\twin.vSettings.coords.input.preferredSize = [ 125, 20 ];\r\r\t\twin.vSettings.repeat = win.vSettings.add('group');\r\t\twin.vSettings.repeat.orientation = 'row';\r\t\twin.vSettings.repeat.checkBox = win.vSettings.repeat.add('checkbox', undefined, localize(text.repeat));\r\t\twin.vSettings.repeat.checkBox.value = true;\r\r\t\t// horizontal guide settings\r\t\twin.hSettings = win.add('panel', undefined, localize(text.hSettings));\r\t\twin.hSettings.orientation = 'row';\r\t\twin.hSettings.alignment = 'fill';\r\t\twin.hSettings.alignChildren = 'center';\r\r\t\twin.hSettings.coords = win.hSettings.add('group');\r\t\twin.hSettings.coords.orientation = 'row';\r\t\twin.hSettings.coords.add('statictext', undefined, \"y:\");\r\t\twin.hSettings.coords.input = win.hSettings.coords.add('edittext', undefined, \"\");\r\t\twin.hSettings.coords.input.preferredSize = [ 125, 20 ];\r\r\t\twin.hSettings.repeat = win.hSettings.add('group');\r\t\twin.hSettings.repeat.orientation = 'row';\r\t\twin.hSettings.repeat.checkBox = win.hSettings.repeat.add('checkbox', undefined, localize(text.repeat));\r\t\twin.hSettings.repeat.checkBox.value = true;\r\r\t\t// buttons\r\t\twin.buttons = win.add('group');\r\t\twin.buttons.orientation = 'row';\r\t\twin.buttons.alignment = 'center';\r\r\t\t// ok button\r\t\twin.okBtn = win.buttons.add('button', undefined, localize(text.ok));\r\t\twin.okBtn.onClick = function() {\r\t\t\tmakeGuides(win.hSettings.coords.input.text, 'Hrzn', win.hSettings.repeat.checkBox.value);\r\t\t\tmakeGuides(win.vSettings.coords.input.text, 'Vrtc', win.vSettings.repeat.checkBox.value);\r\t\t\twin.close();\r\t\t};\r\r\t\t// cancel button\r\t\twin.cancelBtn = win.buttons.add('button', undefined, localize(text.cancel));\r\t\twin.cancelBtn.onClick = function() {\r\t\t\twin.close();\r\t\t};\r\r\t\twin.show();\r\r\t} catch (error) {}\r}",
"function dialogBox() {\n // init, and early sanity checking\n if (documents.length == 0) {\n alert(LANG_ERR_DOC);\n return;\n }\n var doc = app.activeDocument;\n var sel = doc.selection;\n if(sel.length <= 1) {\n alert('Please select more than one object!');\n return;\n }\n\n // create dialog\n var dialog = new Window('dialog', SCRIPT_NAME + ' ' + SCRIPT_VERSION);\n dialog.preferredSize.width = 174;\n dialog.orientation = 'column';\n dialog.alignChildren = ['fill', 'fill'];\n dialog.opacity = DLG_OPACITY;\n\n // Value fields\n var checkbox = dialog.add(\"checkbox\", undefined, 'Align by X (else by Y)?');\n checkbox.value = true;\n\n // Buttons\n var btns = dialog.add('group');\n btns.alignChildren = ['fill', 'fill'];\n btns.orientation = 'column';\n \n var ok = btns.add('button', undefined, 'OK', { name: 'ok' });\n ok.helpTip = 'Press Enter to Run';\n var cancel = btns.add('button', undefined, 'Cancel', { name: 'cancel' });\n cancel.helpTip = 'Press Esc to Close';\n\n // button handles\n ok.onClick = function () { main(checkbox.value); dialog.close(); }\n cancel.onClick = function () { dialog.close(); }\n\n dialog.center();\n dialog.show();\n}",
"function initExportDialog(provider) {\r\n\r\n // Reset fields\r\n utils.resetModalInputs();\r\n\r\n // Load preferences\r\n var exportPreferences = utils.retrieveIgnoreError(provider.providerId + \".exportPreferences\");\r\n if(exportPreferences) {\r\n _.each(provider.exportPreferencesInputIds, function(inputId) {\r\n var exportPreferenceValue = exportPreferences[inputId];\r\n if(_.isBoolean(exportPreferenceValue)) {\r\n utils.setInputChecked(\"#input-sync-export-\" + inputId, exportPreferenceValue);\r\n }\r\n else {\r\n utils.setInputValue(\"#input-sync-export-\" + inputId, exportPreferenceValue);\r\n }\r\n });\r\n }\r\n\r\n // Open dialog\r\n $(\".modal-upload-\" + provider.providerId).modal();\r\n }",
"function btnRunOnClick() {\r\n // check if the setting is properly\r\n var destination = dlgMain.etDestination.text;\r\n if (destination.length == 0) {\r\n alert(strAlertSpecifyDestination);\r\n return;\r\n }\r\n var testFolder = new Folder(destination);\r\n if (!testFolder.exists) {\r\n alert(strAlertDestinationNotExist);\r\n return;\r\n }\r\n \r\n\t// find the dialog in this auto layout mess\r\n\tvar d = this;\r\n\twhile (d.type != 'dialog') {\r\n\t\td = d.parent;\r\n\t}\r\n\td.close(runButtonID); \r\n}",
"function open_settings() {\n var dialog = new wkof.Settings({\n script_id: 'doublecheck',\n title: 'Double-Check Settings',\n on_save: init_ui,\n pre_open: settings_preopen,\n content: {\n tabAnswers: {type:'page',label:'Answers',content:{\n grpChangeAnswers: {type:'group',label:'Change Answer',content:{\n allow_retyping: {type:'checkbox',label:'Allow retyping answer',default:true,hover_tip:'When enabled, you can retype your answer by pressing Escape or Backspace.'},\n allow_change_incorrect: {type:'checkbox',label:'Allow changing to \"incorrect\"',default:true,hover_tip:'When enabled, you can change your answer\\nto \"incorrect\" by pressing the \"-\" key.'},\n allow_change_correct: {type:'checkbox',label:'Allow changing to \"correct\"',default:true,hover_tip:'When enabled, you can change your answer\\nto \"correct\" by pressing the \"+\" key.'},\n show_corrected_answer: {type:'checkbox',label:'Show corrected answer',default:false,hover_tip:'When enabled, pressing \\'+\\' to correct your answer puts the\\ncorrected answer in the input field. Pressing \\'+\\' multiple\\ntimes cycles through all acceptable answers.'},\n }},\n grpCarelessMistakes: {type:'group',label:'Careless Mistakes',content:{\n typo_action: {type:'dropdown',label:'Typos in meaning',default:'ignore',content:{ignore:'Ignore',warn:'Warn/shake',wrong:'Mark wrong'},hover_tip:'Choose an action to take when meaning contains typos.'},\n wrong_answer_type_action: {type:'dropdown',label:'Wrong answer type',default:'warn',content:{warn:'Warn/shake',wrong:'Mark wrong'},hover_tip:'Choose an action to take when reading was entered instead of meaning, or vice versa.'},\n wrong_number_n_action: {type:'dropdown',label:'Wrong number of n\\'s',default:'warn',content:{warn:'Warn/shake',wrong:'Mark wrong'},hover_tip:'Choose an action to take when you type the wrong number of n\\'s in certain reading questions.'},\n small_kana_action: {type:'dropdown',label:'Big kana instead of small',default:'warn',content:{warn:'Warn/shake',wrong:'Mark wrong'},hover_tip:'Choose an action to take when you type a big kana instead of small (e.g. ゆ instead of ゅ).'},\n kanji_reading_for_vocab_action: {type:'dropdown',label:'Kanji reading instead of vocab',default:'warn',content:{warn:'Warn/shake',wrong:'Mark wrong'},hover_tip:'Choose an action to take when the reading of a kanji is entered for a single character vocab word instead of the correct vocab reading.'},\n kanji_meaning_for_vocab_action: {type:'dropdown',label:'Kanji meaning instead of vocab',default:'warn',content:{warn:'Warn/shake',wrong:'Mark wrong'},hover_tip:'Choose an action to take when the meaning of a kanji is entered for a single character vocab word instead of the correct vocab meaning.'},\n }},\n }},\n tabMistakeDelay: {type:'page',label:'Mistake Delay',content:{\n grpDelay: {type:'group',label:'Delay Next Question',content:{\n delay_wrong: {type:'checkbox',label:'Delay when wrong',default:true,refresh_on_change:true,hover_tip:'If your answer is wrong, you cannot advance\\nto the next question for at least N seconds.'},\n delay_multi_meaning: {type:'checkbox',label:'Delay when multiple meanings',default:false,hover_tip:'If the item has multiple meanings, you cannot advance\\nto the next question for at least N seconds.'},\n delay_slightly_off: {type:'checkbox',label:'Delay when answer has typos',default:false,hover_tip:'If your answer contains typos, you cannot advance\\nto the next question for at least N seconds.'},\n delay_period: {type:'number',label:'Delay period (in seconds)',default:1.5,hover_tip:'Number of seconds to delay before allowing\\nyou to advance to the next question.'},\n }},\n }},\n tabBurnReviews: {type:'page',label:'Burn Reviews',content:{\n grpBurnReviews: {type:'group',label:'Burn Reviews',content:{\n warn_burn: {type:'dropdown',label:'Warn before burning',default:'never',content:{never:'Never',cheated:'If you changed answer',always:'Always'},hover_tip:'Choose when to warn before burning an item.'},\n burn_delay_period: {type:'number',label:'Delay after warning (in seconds)',default:1.5,hover_tip:'Number of seconds to delay before allowing\\nyou to advance to the next question after seeing a burn warning.'},\n }},\n }},\n tabLightning: {type:'page',label:'Lightning',content:{\n grpLightning: {type:'group',label:'Lightning Mode',content:{\n show_lightning_button: {type:'checkbox',label:'Show \"Lightning Mode\" button',default:true,hover_tip:'Show the \"Lightning Mode\" toggle\\nbutton on the review screen.'},\n lightning_enabled: {type:'checkbox',label:'Enable \"Lightning Mode\"',default:true,refresh_on_change:true,hover_tip:'Enable \"Lightning Mode\", which automatically advances to\\nthe next question if you answer correctly.'},\n srs_msg_period: {type:'number',label:'SRS popup time (in seconds)',default:1.2,min:0,hover_tip:'How long to show SRS up/down popup when in lightning mode. (0 = don\\'t show)'},\n }},\n }},\n tabAutoInfo: {type:'page',label:'Item Info',content:{\n grpAutoInfo: {type:'group',label:'Show Item Info',content:{\n autoinfo_correct: {type:'checkbox',label:'After correct answer',default:false,hover_tip:'Automatically show the Item Info after correct answers.', validate:validate_autoinfo_correct},\n autoinfo_incorrect: {type:'checkbox',label:'After incorrect answer',default:false,hover_tip:'Automatically show the Item Info after incorrect answers.', validate:validate_autoinfo_incorrect},\n autoinfo_multi_meaning: {type:'checkbox',label:'When multiple meanings',default:false,hover_tip:'Automatically show the Item Info when an item has multiple meanings.', validate:validate_autoinfo_correct},\n autoinfo_slightly_off: {type:'checkbox',label:'When answer has typos',default:false,hover_tip:'Automatically show the Item Info when your answer has typos.', validate:validate_autoinfo_correct},\n }},\n }},\n }\n });\n dialog.open();\n }",
"function showUserSettingsDialog() {\n\tvar dispatcher = tp.dialogs.showDialog(\"userSettingsDialog\", \"#user-settings\");\n\taddEventHandlerUserSettingsDialog();\n\tvar languageElement = d3.select(\"input[name=language]\");\n\tvar currentLanguage = languageElement.property(\"value\");\n\tdispatcher\n\t\t.on(\"ok\", function() {\n\t\t\tvar newLanguage = languageElement.property(\"value\");\n\t\t\ttp.session.storeSettings('user.settings', { lang: newLanguage }, function(error, data) {\n\t\t\t\tif(error) {\n\t\t\t\t\tconsole.error(error, data);\n\t\t\t\t\ttp.dialogs.closeDialogWithMessage(dispatcher.target, \"errorDialog\", \"#store-settings-failed\");\n\t\t\t\t} else {\n\t\t\t\t\ttp.lang.setDefault(newLanguage);\t// Use chosen language for following dialogs\n\t\t\t\t\ttp.dialogs.closeDialog(dispatcher.target);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn false;\n\t\t})\n\t\t.on(\"cancel\", function() {\n\t\t\ttp.lang.setDefault(currentLanguage);\n\t\t})\n\t;\n}",
"function dlgAccept()\n{\n\tsaveIni();\n\tg_form.accept();\n}",
"settings() {\n const bgdiv = $(`<div class=\"full-window-div\" style=\"background-color:#aaaa;\"></div>`)\n const dlg = $(`<div style=\"padding:8px; z-index: 2000; border-radius:8px; border: 1px solid black; background-color:white; min-width:200px; min-height:200px; position: fixed; left:50%; top:50%; transform: translate(-50%,-50%);\n display:grid; grid-template-rows: auto 1fr auto; grid-template-areas: 'header' 'content' 'footer';\">\n <div style=\"grid-area: header;\">\n <span style=\"font-size:18px; font-weight:bold;\">Widget Settings</span>\n <hr/>\n <!--<div style=\"position:absolute; top:10px; right:8px; cursor: pointer;\" class=\"plato-close-button ui-icon ui-icon-closethick\" title=\"close these settings\"></div>-->\n </div>\n <div class=\"content\" style=\"grid-area: content; height:100%;\"></div>\n <div style=\"grid-area: footer; text-align: center;\">\n <hr/>\n <a href=\"javasript:void(0);\" class=\"apply\">ok</a>\n </div>\n </div>`)\n\n const container = dlg.find('.content')\n\n dlg.on('keyup', (e) => {\n if (e.key == \"Enter\") {\n try {\n if (this.on_settings_applied(container)) {\n cleanup()\n }\n } catch (exception) {\n cleanup()\n throw exception\n }\n } else if (e.key == \"Escape\") {\n cleanup()\n }\n })\n\n const apply = dlg.find('.apply')\n apply.on('click', () => {\n try {\n if (this.on_settings_applied(container))\n cleanup()\n } catch (exception) {\n cleanup()\n throw exception\n }\n })\n\n // Opting not to use close button for nows\n //const close = dlg.find('.plato-close-button')\n //close.on('click', () => { cleanup() })\n\n function cleanup() {\n bgdiv.remove()\n dlg.remove()\n }\n\n // Create the dialog\n try {\n $('body').append(bgdiv)\n $('body').append(dlg)\n\n // Allow the subclass to fill in the settings\n this.on_settings(container)\n } catch (exception) {\n cleanup()\n throw exception\n }\n }",
"static show_dialog(){\n show_window({title: \"Update Dexter Firmware\",\n width: 450,\n height: 435,\n x: 400,\n y: 50,\n callback: \"FileTransfer.show_window_callback\",\n content:\n`<ol> <li>Verify that your computer is connected to the Internet.</li>\n <li>Choose the Dexter to update from the Dexter.default menu<br/>\n in the Misc pane header.</li>\n <li>Verify that your computer is connected to that Dexter<br/>\n by running a small Job that moves that Dexter.</li>\n <li>Enter the Dexter user name. (default is \"root\")<br/>\n <input name=\"dexter_user_name\" value=\"root\"/></li>\n <li>Enter the Dexter password.<br/> \n <input name=\"dexter_pwd\"/></li>\n <li>Enter the update password to decrypt the software.<br/>\n (Contact Haddington if you need the passwords.)<br/>\n <input name=\"update_pwd\"/></li>\n <li> <span title=\"If checked, files will be transfered to Dexter. If unchecked, folder names to be transfered will only be printed in the Output pane. This is now disabled for testing purposes.\">\n <input type=\"checkbox\" name=\"enable_file_transfer_to_dexter\" disabled />\n Enable transfering files to Dexter.</span>\n </li> \n <li> Click: <input type=\"submit\" name=\"update\"/></li>\n <li> Be patient.<br/>\n There's many megabytes of code to move.<br/>\n <i>Do not use your computer until you see<br/>\n <b>Dexter firmware update completed</b><br/>\n (or an error message) in the Output pane.</i><br/>\n <span style=\"color:red;\">Doing so may damage Dexter's file system.</span></li>\n </ol>`\n })\n }",
"function inputWindow(){\n\tvar imagePaths = {\n\t\tfrontCoverPath:\"\",\n\t\tendsheetPath:\"\",\n\t\tbackCoverPath:\"\"\n\t}\n\n\tvar myInputWindow = new Window(\"dialog\", \"Add cover file\");\n\t//.....................................\n\t//......Add front cover controls.......\n\t//.....................................\n\tmyInputWindow[\"addCoverButton\"] = myInputWindow.add(\"button\",[0,0,200,30], \"Add cover image\");\n\tmyInputWindow.addCoverButton.onClick = function(){\n\t\timagePaths.frontCoverPath = File.openDialog(\"Choose cover image\");\n\t\tif (imagePaths.frontCoverPath){\n\t\t\tif (imagePaths.backCoverPath){myButtonGroup.okButton.enabled = true;}\n\t\t\tmyInputWindow.frontCoverImagePath.text = imagePaths.frontCoverPath.fullName;\n\t\t}\t\t\n\t};\n\tmyInputWindow[\"frontCoverImagePath\"] = myInputWindow.add(\"statictext\",[0,0,600,50],\"\",{multiline:true});\n\t//.....................................\n\t//......Add endsheet controls.........\n\t//.....................................\n\tmyInputWindow[\"addEndsheetButton\"] = myInputWindow.add(\"button\",[0,0,200,30], \"Add endsheet image\");\n\tmyInputWindow.addEndsheetButton.onClick = function(){\n\t\timagePaths.endsheetPath = File.openDialog(\"Choose endsheet image\");\n\t\tif (imagePaths.endsheetPath){\n\t\t\tmyInputWindow.endsheetImagePath.text = imagePaths.endsheetPath.fullName;\n\t\t}\t\t\n\t};\n\tmyInputWindow[\"endsheetImagePath\"] = myInputWindow.add(\"statictext\",[0,0,600,50],\"\",{multiline:true});\n\t//.....................................\n\t//......Add back cover controls........\n\t//.....................................\n\tmyInputWindow[\"addBackCoverButton\"] = myInputWindow.add(\"button\",[0,0,200,30], \"Add back cover image\");\n\tmyInputWindow.addBackCoverButton.onClick = function(){\n\t\timagePaths.backCoverPath = File.openDialog(\"Choose endsheet image\");\n\t\tif (imagePaths.backCoverPath){\n\t\t\tif (imagePaths.frontCoverPath){myButtonGroup.okButton.enabled = true;}\n\t\t\tmyInputWindow.backCoverImagePath.text = imagePaths.backCoverPath.fullName;\n\t\t}\t\t\n\t};\n\tmyInputWindow[\"backCoverImagePath\"] = myInputWindow.add(\"statictext\",[0,0,600,50],\"\",{multiline:true});\n\t//.....................................\n\t//......OK and Cancel button controls..\n\t//.....................................\n\tvar myButtonGroup = myInputWindow.add(\"group\");\n\tmyButtonGroup.alignment = \"right\";\n\tmyButtonGroup[\"okButton\"] = myButtonGroup.add(\"button\",undefined,\"OK\");\n\tmyButtonGroup.okButton.enabled = false;\n\tmyButtonGroup.add(\"button\",undefined,\"Cancel\");\n\tif(myInputWindow.show()===1){\n\t\treturn imagePaths;\n\t} else {\n\t\texit();\n\t}\n}",
"function dialogExec() {\n\n // Read saved script settings\n initParam();\n\n // Read script settings and use them for the dialog\n if (Banana.document) {\n var data = Banana.document.scriptReadSettings();\n if (data.length > 0) {\n param = JSON.parse(data);\n \n // Load saved settings\n dialog.PaidToLineEdit.text = param[\"paidTo\"];\n // dialog.DescriptionLineEdit.text = param[\"description\"];\n dialog.PaymentReceivedByLineEdit.text = param[\"paymentReceivedBy\"];\n dialog.PaidByLineEdit.text = param[\"paidBy\"];\n dialog.PreparedByLineEdit.text = param[\"preparedBy\"];\n dialog.VerifiedByLineEdit.text = param[\"verifiedBy\"];\n dialog.RecommendedByLineEdit.text = param[\"recommendedBy\"];\n dialog.ApprovedByLineEdit.text = param[\"approvedBy\"];\n // dialog.ProjectNameLineEdit.text = param[\"projectName\"];\n // dialog.ProjectNumberLineEdit.text = param[\"projectNumber\"];\n }\n }\n\n // Pause and resume are used to change the cursor aspect\n Banana.application.progressBar.pause();\n var dlgResult = dialog.exec();\n Banana.application.progressBar.resume();\n\n if (dlgResult !== 1) {\n return false;\n }\n\n // Read all the fields of the dialog and save the values as parameters \n param[\"voucherNumber\"] = dialog.VoucherNumberLineEdit.text;\n param[\"paidTo\"] = dialog.PaidToLineEdit.text;\n // param[\"description\"] = dialog.DescriptionLineEdit.text;\n \n // Read combobox and assign to each index a value\n var resPaidInComboBox = dialog.PaidInComboBox.currentIndex;\n if (resPaidInComboBox == 0) {\n param[\"paidIn\"] = \"Cash\";\n } else if (resPaidInComboBox == 1) {\n param[\"paidIn\"] = \"Bank\";\n } else if (resPaidInComboBox == 2) {\n param[\"paidIn\"] = \"Cheque\";\n } else if (resPaidInComboBox == 3) {\n param[\"paidIn\"] = \"Non Cash or Bank\";\n }\n\n param[\"chequeNumber\"] = dialog.ChequeNumberLineEdit.text;\n param[\"paymentReceivedBy\"] = dialog.PaymentReceivedByLineEdit.text;\n param[\"paidBy\"] = dialog.PaidByLineEdit.text;\n param[\"preparedBy\"] = dialog.PreparedByLineEdit.text;\n param[\"verifiedBy\"] = dialog.VerifiedByLineEdit.text;\n param[\"recommendedBy\"] = dialog.RecommendedByLineEdit.text;\n param[\"approvedBy\"] = dialog.ApprovedByLineEdit.text;\n // param[\"projectName\"] = dialog.ProjectNameLineEdit.text;\n // param[\"projectNumber\"] = dialog.ProjectNumberLineEdit.text;\n\n // Save script settings\n var paramToString = JSON.stringify(param);\n var value = Banana.document.scriptSaveSettings(paramToString);\n\n return true;\n}",
"function setupSaveasDialog(){\n //Append to DOM\n $('div#dialogs').append('<div id=\"saveas_vm_dialog\" title=\"VM Save As\"></div>');\n\n //Put HTML in place\n $('#saveas_vm_dialog').html('\\\n <form action=\"javascript:alert(\\'js error!\\');\">\\\n <div id=\"saveas_tabs\">\\\n </div>\\\n\t\t\t<div class=\"form_buttons\">\\\n\t\t\t <button id=\"vm_saveas_proceed\" value=\"\">OK</button>\\\n\t\t\t <button id=\"vm_saveas_cancel\" value=\"\">Cancel</button>\\\n\t\t\t</div>\\\n </fieldset>\\\n </form>');\n \n $('#saveas_vm_dialog').dialog({\n autoOpen:false,\n width:600,\n modal:true,\n height:350,\n resizable:true,\n });\n \n $('#saveas_vm_dialog #vm_saveas_proceed').click(function(){\n var elems = $('#saveas_vm_dialog #saveas_tabs div.saveas_tab');\n var args = [];\n $.each(elems,function(){\n var id = $('#vm_id',this).text();\n var disk_id = $('#vm_disk_id',this).val();\n var image_name = $('#image_name',this).val();\n var type = $('#image_type',this).val();\n \n if (!id.length || !disk_id.length || !image_name.length) {\n notifyError(\"Skipping VM \"+id+\n \". No disk id or image name specified\");\n }\n else {\n var obj = {\n vm_id: id,\n disk_id : disk_id,\n image_name : image_name,\n type: type\n };\n args.push(id);\n Sunstone.runAction(\"VM.saveas\",obj);\n }\n });\n if (args.length > 0){\n notifySubmit(\"VM.saveas\",args);\n }\n \n $('#saveas_vm_dialog').dialog('close'); \n return false;\n });\n \n $('#saveas_vm_dialog #vm_saveas_cancel').click(function(){\n $('#saveas_vm_dialog').dialog('close'); \n return false;\n });\n \n}",
"function showDialog() {\r\n \r\n // create dialog\r\n var dialogWindow = new Window('dialog', 'Auf PRINT-Artboard kopieren'); \r\n\r\n\r\n // choose number of columns for print\r\n dialogWindow.add('statictext', undefined, \"Spaltenanzahl\");\r\n dialogWindow.columnSelect = dialogWindow.add('dropdownlist', undefined, [1,2,3,4]);\r\n dialogWindow.columnSelect.selection = 0;\r\n\r\n\r\n // choose title, source, author \r\n dialogWindow.headerFooterBar = dialogWindow.add(\"panel\", undefined, \"Kopf- und Fusszeile\");\r\n dialogWindow.headerFooterBar.add('statictext', undefined, \"Titel\");\r\n dialogWindow.headerFooterBar.title = dialogWindow.headerFooterBar.add(\"edittext\", { x: 0, y: 0, width: 200, height: 20 }, titleTextFrame.contents);\r\n dialogWindow.headerFooterBar.add('statictext', undefined, \"Quellen\");\r\n dialogWindow.headerFooterBar.sources = dialogWindow.headerFooterBar.add(\"edittext\", { x: 0, y: 0, width: 200, height: 20 }, sourcesTextFrame.contents);\r\n dialogWindow.headerFooterBar.add('statictext', undefined, \"Kürzel\");\r\n dialogWindow.headerFooterBar.author = dialogWindow.headerFooterBar.add(\"edittext\", { x: 0, y: 0, width: 200, height: 20 }, authorTextFrame.contents);\r\n\r\n // choose font conversion\r\n dialogWindow.convertFonts = dialogWindow.add('checkbox', undefined, \"Alle enthaltenen Schriftelemente zu Univers Condensed/8pt konvertieren\");\r\n dialogWindow.convertFontsToBlack = dialogWindow.add('checkbox', undefined, \"Schriftelemente zusätzlich schwarz einfärben\");\r\n\r\n // add okay button and add listener\r\n dialogWindow.button = dialogWindow.add('button', undefined, \"Import for Print\");\r\n dialogWindow.button.onClick = importForPrint;\r\n dialogWindow.show(); \r\n function importForPrint() {\r\n var numColumns = dialogWindow.columnSelect.selection + 1;\r\n var title = dialogWindow.headerFooterBar.title.text;\r\n var sources = dialogWindow.headerFooterBar.sources.text;\r\n var author = dialogWindow.headerFooterBar.author.text;\r\n var convertFonts = dialogWindow.convertFonts.value;\r\n var convertFontsToBlack = dialogWindow.convertFontsToBlack.value;\r\n dialogWindow.close();\r\n\r\n updatePrintTextFrames(title, sources, author);\r\n duplicateToPrintArtboard(numColumns);\r\n if (convertFonts === true) {\r\n convertCount = convertPrintTextFramesToUnivers(printGraphicGroup, convertFontsToBlack, 0);\r\n alert(convertCount + \" Schriftelemente wurden in der Grafik gefunden und zu Univers Condensed/8pt konvertiert.\")\r\n }\r\n alert(\"Grafik wurde erfolgreich auf dem PRINT-Artboard eingefügt\")\r\n }\r\n\r\n}",
"function openSettingsWindow() { //Create settings window\r\n\t\r\n //Define html for settings window\r\n var settingsHTML=\"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Transitional//EN\\\" \\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\\">\\n\\n<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\" lang=\\\"en-gb\\\" xml:lang=\\\"en-gb\\\">\\n<head>\\n <meta content=\\\"text/html; charset=ISO-8859-1\\\" http-equiv=\\\"content-type\\\" />\\n <title>wTorrent Options</title>\\n <style type=\\\"text/css\\\">\\n body {\\n\t\tbackground-color: rgb(212, 208, 200);\\n }\\n body,input,select {\\n font-size: 10pt;\\n font-family: Arial;\\n }\\n input.text {\\n\t\twidth: 100%;\\n\t\tmargin-bottom: 4px;\\n\t}\\n\tinput.checkbox {\\n\t\tmargin-bottom: 4px;\\n\t}\\n\tp.small {\\n\t\tfont-size: 6pt;\\n\t\tmargin: 0; padding: 0; margin-bottom: 4px;\\n\t}\\n </style>\\n</head>\\n\\n<body>\\n\\n\t<div style=\\\"width: 275px;\\\">\\n\\n\t\t<div style=\\\"text-align: center;\\\">\\n\t\t\t<h1>wTorrent Options</h1>\\n\t\t</div>\\n\\n\t\t<hr />\\n\t \\n\t\t<label>wTorrent Host Name or IP</label><br />\\n\t\t<input class=\\\"text\\\" type=\\\"text\\\" name=\\\"wtorrent_host\\\" id=\\\"wtorrent_host\\\" value=\\\"\\\" /><br />\\n\\n\t\t<label>wTorrent Port</label><br />\\n\t\t<input class=\\\"text\\\" type=\\\"text\\\" name=\\\"wtorrent_port\\\" id=\\\"wtorrent_port\\\" value=\\\"\\\" /><br />\\n\t\t\\n\t\t<input class=\\\"checkbox\\\" type=\\\"checkbox\\\" value=\\\"true\\\" name=\\\"wtorrent_ssl\\\" id=\\\"wtorrent_ssl\\\" /><label for=\\\"wtorrent_ssl\\\">Use SSL to connect to wTorrent?</label>\\n\t\t<p class=\\\"small\\\">Checking this will cause you to use an SSL (https) connection for wTorrent.</p>\\n\\n\t\t<label>wTorrent User Name</label><br />\\n\t\t<input class=\\\"text\\\" type=\\\"text\\\" name=\\\"wtorrent_username\\\" id=\\\"wtorrent_username\\\" value=\\\"\\\" /><br />\\n\t\t\\n\t\t<label>wTorrent Password</label><br />\\n\t\t<input class=\\\"text\\\" type=\\\"password\\\" name=\\\"wtorrent_password\\\" id=\\\"wtorrent_password\\\" value=\\\"\\\" /><br />\\n\t\t\\n\t\t<label>wTorrent Download Directory</label><br />\\n\t\t<input class=\\\"text\\\" type=\\\"text\\\" name=\\\"wtorrent_downloaddirectory\\\" id=\\\"wtorrent_downloaddirectory\\\" value=\\\"\\\" /><br />\\n\t\t<p class=\\\"small\\\">Download directory should be set to \\\"default\\\" to accept the default setting configured in wTorrent, or changed to an absolute path. You must allow files to be saved to a non-standard source when not using \\\"default\\\".</p>\\n\t\t\\n\t\t<input class=\\\"checkbox\\\" type=\\\"checkbox\\\" value=\\\"true\\\" name=\\\"wtorrent_alwaysdownloadprivate\\\" id=\\\"wtorrent_alwaysdownloadprivate\\\" /><label for=\\\"wtorrent_alwaysdownloadprivate\\\">Allways add in private mode?</label>\\n\t\t<p class=\\\"small\\\">This takes precedence over \\\"Show links for private mode add\\\" preference. If this is checked only the wTorrent icon will show and it will always add in private mode</p>\\n\\n\t\t<input class=\\\"checkbox\\\" type=\\\"checkbox\\\" value=\\\"true\\\" name=\\\"wtorrent_showprivatelinks\\\" id=\\\"wtorrent_showprivatelinks\\\" /><label for=\\\"wtorrent_showprivatelinks\\\">Show links for private mode add?</label>\\n\t\t<p class=\\\"small\\\">Checking this will show a \\\"lock\\\" icon for adding torrents in private mode.</p>\\n\\n\t\t<input class=\\\"checkbox\\\" type=\\\"checkbox\\\" value=\\\"true\\\" name=\\\"wtorrent_autostarttorrents\\\" id=\\\"wtorrent_autostarttorrents\\\" /><label for=\\\"wtorrent_autostarttorrents\\\">Auto-Start torrents?</label><br />\\n\\n\t\t<br />\\n\t\t<hr />\\n\t\t<input id=\\\"save\\\" value=\\\"Save Changes\\\" type=\\\"button\\\" />\\n\\n\t\t<input value=\\\"Cancel\\\" onclick=\\\"window.close()\\\" type=\\\"button\\\" />\\n\t</div>\\n</body>\\n</html>\";\r\n\r\n //Add default variable values to settins window html\r\n settingsHTML=settingsHTML.replace(/id=\"wtorrent_host\" value=\"\"/,'id=\"wtorrent_host\" value=\"'+wtorrent_host+'\"')\r\n settingsHTML=settingsHTML.replace(/id=\"wtorrent_port\" value=\"\"/,'id=\"wtorrent_port\" value=\"'+wtorrent_port+'\"')\r\n settingsHTML=settingsHTML.replace(/id=\"wtorrent_username\" value=\"\"/,'id=\"wtorrent_username\" value=\"'+wtorrent_username+'\"')\r\n settingsHTML=settingsHTML.replace(/id=\"wtorrent_password\" value=\"\"/,'id=\"wtorrent_password\" value=\"'+wtorrent_password+'\"')\r\n settingsHTML=settingsHTML.replace(/id=\"wtorrent_downloaddirectory\" value=\"\"/,'id=\"wtorrent_downloaddirectory\" value=\"'+wtorrent_downloaddirectory+'\"')\r\n\t\t\r\n\t\tif (wtorrent_ssl) { settingsHTML=settingsHTML.replace(/id=\"wtorrent_ssl\"/,'id=\"wtorrent_ssl\" checked=\"checked\"'); }\r\n if (wtorrent_alwaysdownloadprivate) { settingsHTML=settingsHTML.replace(/id=\"wtorrent_alwaysdownloadprivate\"/,'id=\"wtorrent_alwaysdownloadprivate\" checked=\"checked\"'); }\r\n if (wtorrent_showprivatelinks) { settingsHTML=settingsHTML.replace(/id=\"wtorrent_showprivatelinks\"/,'id=\"wtorrent_showprivatelinks\" checked=\"checked\"'); }\r\n if (wtorrent_autostarttorrents) { settingsHTML=settingsHTML.replace(/id=\"wtorrent_autostarttorrents\"/,'id=\"wtorrent_autostarttorrents\" checked=\"checked\"'); }\r\n \r\n //Open Settings window\r\n settingsWindow=window.open(\"\",\"settingsWindow\",\"height=520,width=298,left=100,top=100,resizable=yes,scrollbars=no,toolbar=no,status=no\")\r\n settingsWindow.document.write(settingsHTML) //Write html to window\r\n settingsWindow.document.close() //Close document to writing\r\n\r\n //Add Settings Window Listeners\r\n settingsWindow.document.getElementById(\"save\").addEventListener(\"click\", saveSettings, false); //Add click event listener to Save Settings button, calls saveSettings()\r\n settingsWindow.addEventListener(\"unload\", cleanupSettingsListeners, false); //Add unload event listener to window, calls cleanupListeners()\r\n }",
"function createDialog(options) {\n var destroyed = false;\n \n var htmlDialog = System.createDialog({\n onbeforeclose: function() {\n // overwrite the behavior of top right \"x\" button\n if (!destroyed) {\n reject();\n return false;\n }\n }\n });\n \n htmlDialog.visible = false;\n htmlDialog.title = options.title;\n\n // restore position\n if (options.id) {\n DIMENSION_PROPS.forEach(function(prop) {\n htmlDialog[prop] =\n options.id && GlobalSettings.get(\"dialog.\" + options.id + \".\" + prop) ||\n options[prop] ||\n htmlDialog[prop];\n });\n }\n\n // Build interface\n var document = htmlDialog.document;\n\n document.write(options.html);\n document.close();\n\n document.forms[0].onsubmit = function() {\n resolve(document.getElementById(\"entry\").value);\n return false;\n };\n\n document.getElementById(\"cancel\").onclick = function() {\n reject();\n };\n\n document.onkeydown = function(e) {\n e = e || document.parentWindow.event;\n if (e.keyCode == 27) {\n reject();\n }\n };\n \n function show() {\n htmlDialog.visible = true;\n var autofocus = document.querySelector(\"[autofocus]\");\n if (autofocus) {\n autofocus.focus();\n }\n if (options.onshow) {\n options.onshow(htmlDialog);\n }\n }\n \n function hide() {\n if (options.id) {\n DIMENSION_PROPS.forEach(function (prop) {\n GlobalSettings.set(\n \"dialog.\" + options.id + \".\" + prop,\n htmlDialog[prop]\n );\n });\n }\n htmlDialog.visible = false;\n }\n \n function resolve(value) {\n hide();\n if (options.onresolve) {\n options.onresolve(value);\n }\n }\n \n function reject(value) {\n hide();\n if (options.onreject) {\n options.onreject(value);\n }\n }\n \n function destroy() {\n destroyed = true;\n htmlDialog.close();\n }\n \n return {\n show: show,\n hide: hide,\n resolve: resolve,\n reject: reject,\n destroy: destroy,\n isShown: function() {\n return htmlDialog.visible;\n }\n };\n }",
"function CreateOptions() {\n // Create button\n $('body').append('<div class=\"btnOptions\"><span></span></div>');\n\n // Create dialogue (this is where your options should go)\n $('body').append('<div id=\"dialog\" title=\"Options\">'\n + '<p style=\"margin-bottom:10px;\">Select options below:</p>'\n // colorOrderPriceCells\n + '<p><input class=\"myCheckbox\" id=\"colorOrderPriceCells\" type=\"checkbox\" value=\"true\"/>'\n + '<label class=\"myCheckboxLabel\" for=\"colorOrderPriceCells\">Color the prices for order cells?</label> </p>'\n // refreshRate\n + '<p><label class=\"myCheckboxLabel\" for=\"refreshRate\">Refresh rate in ms. (Default: 90000)</label>'\n + '<input class=\"myInputBox\" id=\"refreshRate\" type=\"text\" value=\"90000\"/> </p>'\n + '</div>');\n\n // Initialise and set up on click listener for dialoge box\n $(\"#dialog\").dialog({\n autoOpen: false,\n minWidth: 400,\n show: {\n effect: \"blind\",\n duration: 1000\n },\n hide: {\n effect: \"explode\",\n duration: 1000\n },\n buttons: [\n {\n text: \"Save\",\n click: function () {\n // Save our options\n SaveOptions();\n // Update UI\n UpdateUI();\n // Close the dialog box\n $(this).dialog(\"close\");\n }\n }\n ]\n });\n\n $(\".btnOptions\").click(function () {\n $(\"#dialog\").dialog(\"open\");\n });\n\n\n // Set option values here\n $('#colorOrderPriceCells').attr('checked', GetBoolSetting('op_colorOrderPriceCells'));\n}",
"function openPreferencesDialog() {\r\n $(\"#hypersubs-setting-animate input\").prop('checked', userPreferences.animate);\r\n $(\"#hypersubs-setting-smartfill input\").prop('checked', userPreferences.smartFill);\r\n $(\"#hypersubs-setting-always-require-next input\").prop('checked', userPreferences.alwaysRequireNext);\r\n $(\"#hypersubs-setting-prune-confirmation input\").prop('checked', userPreferences.pruneConfirmation);\r\n $(\"#hypersubs-setting-show-hypersubs-shortcuts input\").prop('checked', userPreferences.showHypersubsShortcuts);\r\n $(\"#hypersubs-setting-show-league-transfers input\").prop('checked', userPreferences.showLeagueTransfers); \r\n $(\"#hypersubs-setting-show-more-info-button input\").prop('checked', userPreferences.showMoreInfoButton);\r\n $(\"#hypersubs-setting-strong-attacks input\").val(userPreferences.strongAttacks);\r\n $(\"#hypersubs-setting-strong-defenses input\").val(userPreferences.strongDefenses);\r\n $(\"#hypersubs-preferences-dialog\").dialog('option', 'position', { my: 'center', at: 'center', of: $('#hypersubs-main-dialog'), offset: \"0 0\", collision: \"fit\" });\r\n $('#hypersubs-preferences-dialog').dialog('open');\r\n $('#hypersubs-preferences-dialog').dialog('widget').find(\".ui-dialog-buttonpane button:contains('Save')\").focus(); \r\n }",
"function showDialog()\r\n{\r\n\t// Create a new dialog box with a single panel\r\n\tvar dialog = new Window(\"dialog\", \"Sprite Sheet Splitter\");\r\n\tvar sizePanel = dialog.add(\"panel\", [0,0,215,180], \"Sprite Sheet Size\");\r\n\r\n\t// Number of columns\r\n\tvar numColsLabel = sizePanel.add(\"statictext\", [25,25,150,35], \"Number of columns:\");\r\n\tvar numColsText = sizePanel.add(\"edittext\", [145,24,185,43], 4);\r\n\r\n\t// Number of rows\r\n\tvar numRowsLabel = sizePanel.add(\"statictext\", [25,55,150,65], \"Number of rows:\");\r\n\tvar numRowsText = sizePanel.add(\"edittext\", [145,54,185,73], 4);\r\n\tnumRowsLabel.enabled = false;\r\n\tnumRowsText.enabled = false;\r\n\r\n\t// Checkbox for making the number of cols/rows the same\r\n\tvar equalRowsLabel = sizePanel.add(\"statictext\", [25,85,150,95], \"Equal cols/rows:\");\r\n\tvar equalRowsBox = sizePanel.add(\"checkbox\", [145,85,175,105]);\r\n\tequalRowsBox.value = true;\r\n\r\n\t// When the checkbox is clicked, enable/disable the second input box\r\n\tequalRowsBox.onClick = function()\r\n\t{\r\n\t\tnumRowsLabel.enabled = !numRowsLabel.enabled; \r\n\t\tnumRowsText.enabled = !numRowsText.enabled; \r\n\t\t\r\n\t\tif(equalRowsBox.value == true)\r\n\t\t\tnumRowsText.text = numColsText.text;\r\n\t}\r\n\r\n\t// Make the number of rows match the number of columns if necessary\r\n\tnumColsText.onChanging = function()\r\n\t{\r\n\t\tif(equalRowsBox.value == true)\r\n\t\t\tnumRowsText.text = numColsText.text; \r\n\t}\r\n\r\n\t// Buttons for OK/Cancel\r\n\tvar okButton = sizePanel.add(\"button\", [25,125,100,150], \"OK\", {name:'ok'});\r\n\tvar cancelButton = sizePanel.add(\"button\", [110,125,185,150], \"Cancel\", {name:'cancel'});\r\n\r\n\t// Event handler for OK button\r\n\tokButton.onClick = function()\r\n\t{\r\n\t\tnumCols = parseInt(numColsText.text);\r\n\t\tnumRows = parseInt(numRowsText.text);\r\n\t\tdialog.close(0);\r\n\t}\r\n\r\n\t// Event handler for Cancel button\r\n\tcancelButton.onClick = function()\r\n\t{\r\n\t\tdialog.close();\r\n\t\tuserCancelled = true;\r\n\t}\r\n\r\n\tdialog.center();\r\n\tdialog.show();\r\n}",
"function optionsDialog(){ \n \n this.getPages = function(){\n var iDialogTemplate1 = Dialogs.createNewDialogTemplate(600, 280, \"Select objects and attributes\") \n \n iDialogTemplate1.CheckBox(20, 30, 300, 15, \"Include objects in assigned models\", \"CHECKBOX_1\"); \n \n iDialogTemplate1.Text(110, 85, 100, 16, \"Attributes\");\n iDialogTemplate1.ListBox(20, 100, 230, 80, [], \"attributes\"); \n \n iDialogTemplate1.Text(410, 85, 100, 16, \"Selected Attribute\"); \n iDialogTemplate1.ListBox(350, 100, 230, 80, [], \"selected_attributes\"); \n \n iDialogTemplate1.PushButton(260, 135, 80, 15, \"Add -->\", \"ADD_BUTTON_ATTR\"); \n iDialogTemplate1.PushButton(260, 160, 80, 15, \"X Remove\", \"REMOVE_BUTTON_ATTR\"); \n \n iDialogTemplate1.Text(110, 185, 100, 16, \"Objects\");\n iDialogTemplate1.ListBox(20, 200, 230, 80, [], \"objects\"); \n \n iDialogTemplate1.Text(410, 185, 100, 16, \"Selected Objects\"); \n iDialogTemplate1.ListBox(350, 200, 230, 80, [], \"selected_objects\"); \n \n iDialogTemplate1.PushButton(260, 235, 80, 15, \"Add -->\", \"ADD_BUTTON\"); \n iDialogTemplate1.PushButton(260, 260, 80, 15, \"X Remove\", \"REMOVE_BUTTON\"); \n \n return [iDialogTemplate1];\n } \n \n this.init = function(aPages){ \n \n //** Attributes\n this.as_Attributes = []; // all attributes from the adidas filter\n this.as_SelectedAttr = []; \n this.an_AttributesToExport = []; \n \n var an_allAtrsOfGroup = g_oAdidasFilter.AttrTypesOfAttrGroup(AT_ADIDAS_ATTRIBUTES_GENERAL, true); \n \n for(var i=0; i<an_allAtrsOfGroup.length; i++){\n var s_AttrNameAndTypeNum = g_oAdidasFilter.AttrTypeName(an_allAtrsOfGroup[i]) + \" ( \" + an_allAtrsOfGroup[i] + \" ) \"; \n this.as_Attributes.push(s_AttrNameAndTypeNum); \n }\n \n //** Objects\n this.ao_SelectedObjects = [];\n this.ao_ObjectsToExport = []; \n \n // Get objects \n this.updateOjects(); \n \n this.dialog.getPage(0).getDialogElement(\"attributes\").setItems(this.as_Attributes.sort()); \n }\n \n // returns true if the page is in a valid state. In this case \"Ok\", \"Finish\", or \"Next\" is enabled.\n // called each time a dialog value is changed by the user (button pressed, list selection, text field value, table entry, radio button,...)\n // pageNumber: the current page number, 0-based \n this.isInValidState = function(pageNumber){\n this.updateValidity(); \n return this.b_Valid; \n }\n \n \n this.b_Valid = false; // OK button grayed out at first \n \n \n this.updateValidity = function() \n { \n if(this.an_AttributesToExport.length > 0 && this.ao_ObjectsToExport.length > 0 ){\n this.b_Valid = true; \n }else{\n this.b_Valid = false; \n } \n }\n \n // called when the page is displayed\n // pageNumber: the current page number, 0-based\n // optional \n this.onActivatePage = function(pageNumber)\n {\n }\n \n // returns true if the \"Finish\" or \"Ok\" button should be visible on this page.\n // pageNumber: the current page number, 0-based\n // optional. if not present: always true\n this.canFinish = function(pageNumber)\n { \n // OK button is grayed out at first \n // if objects and attributes have been chosen it is aktiv again \n this.updateValidity(); \n return this.b_Valid; \n }\n \n // returns true if the user can switch to another page.\n // pageNumber: the current page number, 0-based\n // optional. if not present: always true\n this.canChangePage = function(pageNumber)\n {\n return true;\n }\n \n // returns true if the user can switch to next page.\n // called when the \"Next\" button is pressed and thus not suitable for activation/deactivation of this button\n // can prevent the display of the next page\n // pageNumber: the current page number, 0-based\n // optional. if not present: always true\n this.canGotoNextPage = function(pageNumber)\n {\n return true;\n }\n \n // returns true if the user can switch to previous page.\n // called when the \"Back\" button is pressed and thus not suitable for activation/deactivation of this button\n // can prevent the display of the previous page\n // pageNumber: the current page number, 0-based\n // optional. if not present: always true\n this.canGotoPreviousPage = function(pageNumber)\n {\n return true;\n }\n \n // called after \"Ok\"/\"Finish\" has been pressed and the current state data has been applied\n // can be used to update your data\n // pageNumber: the current page number\n // bOK: true=Ok/finish, false=cancel pressed\n // optional\n this.onClose = function(pageNumber, bOk)\n { \n if(!bOk){\n g_bCanceled = true; \n } \n }\n \n \n // the result of this function is returned as result of Dialogs.showDialog(). Can be any object.\n // optional\n this.getResult = function()\n { \n var s_attrGUID = \"\"; \n var s_attrAPIName = \"\"; \n var n_attrNum = Number(getAttrNum(this.as_SelectedAttr)); \n \n try{\n s_attrGUID = g_oAdidasFilter.UserDefinedAttributeTypeGUID(n_attrNum); \n s_attrAPIName = g_oAdidasFilter.getOriginalAttrTypeName(n_attrNum); \n }catch(e){} \n \n return {objects: this.ao_ObjectsToExport, attr: this.as_SelectedAttr, attrGUID: s_attrGUID, attrAPIName: s_attrAPIName }; \n }\n \n \n this.CHECKBOX_1_selChanged = function (newSelection)\n {\n this.updateOjects();\n }\n \n \n this.updateOjects = function() { \n var b_includeAssignments = this.dialog.getPage(0).getDialogElement(\"CHECKBOX_1\").isChecked(); \n if(b_includeAssignments){\n this.ao_Objects = getObjsInAssignedModels(g_oModel); \n }else{\n this.ao_Objects = g_oModel.ObjDefList(); \n } \n this.dialog.getPage(0).getDialogElement(\"objects\").setItems(showObjNameAndType(this.ao_Objects)); \n }\n \n \n this.ADD_BUTTON_ATTR_pressed = function()\n { \n var a_nValueIndex = this.dialog.getPage(0).getDialogElement(\"attributes\").getSelection();\n \n if(a_nValueIndex != null && a_nValueIndex.length > 0){ \n var attribute = this.as_Attributes[a_nValueIndex];\n if (!itemExists(this.as_SelectedAttr, attribute) && this.as_SelectedAttr.length == 0 ){ \n this.as_SelectedAttr.push(attribute);\n this.an_AttributesToExport.push(attribute); \n this.dialog.getPage(0).getDialogElement(\"selected_attributes\").setItems(this.as_SelectedAttr); \n }\n }\n this.updateValidity(); \n }\n \n \n this.REMOVE_BUTTON_ATTR_pressed = function()\n { \n var a_nValueIndex = this.dialog.getPage(0).getDialogElement(\"selected_attributes\").getSelection(); \n if(a_nValueIndex != null && a_nValueIndex.length > 0){ \n this.as_SelectedAttr.splice(a_nValueIndex[0], 1); \n this.an_AttributesToExport.splice(a_nValueIndex[0], 1); \n this.dialog.getPage(0).getDialogElement(\"selected_attributes\").setItems(this.as_SelectedAttr); \n }\n this.updateValidity(); \n } \n \n \n this.ADD_BUTTON_pressed = function()\n { \n var a_nValueIndex = this.dialog.getPage(0).getDialogElement(\"objects\").getSelection();\n \n if(a_nValueIndex != null && a_nValueIndex.length > 0){ \n var objectObjDef = this.ao_Objects[a_nValueIndex];\n if (!itemExists(this.ao_SelectedObjects, objectObjDef)){ \n this.ao_SelectedObjects.push(objectObjDef);\n this.ao_ObjectsToExport.push(objectObjDef);\n this.dialog.getPage(0).getDialogElement(\"selected_objects\").setItems(showObjNameAndType(this.ao_SelectedObjects));\n }\n }\n this.updateValidity(); \n }\n\n\n this.REMOVE_BUTTON_pressed = function()\n { \n var a_nValueIndex = this.dialog.getPage(0).getDialogElement(\"selected_objects\").getSelection(); \n if(a_nValueIndex != null && a_nValueIndex.length > 0){ \n this.ao_SelectedObjects.splice(a_nValueIndex[0], 1); \n this.ao_ObjectsToExport.splice(a_nValueIndex[0], 1); \n \n this.dialog.getPage(0).getDialogElement(\"selected_objects\").setItems(showObjNameAndType(this.ao_ObjectsToExport)); \n }\n this.updateValidity(); \n } \n \n // other methods (all optional):\n // - [ControlID]_pressed(),\n // - [ControlID]_focusChanged(boolean lost=false, gained=true)\n // - [ControlID]_changed() for TextBox and DropListBox\n // - [ControlID]_selChanged(int newSelection)\n // - [ControlID]_cellEdited(row, column) for editable tables, row and column are 0-based\n // SEARCH_BUTTON\n}",
"function openSettings() {\n //Update the inputs to the current values\n document.getElementById(\"spacingInput\").value = fSpacing;\n document.getElementById(\"smoothingInput\").value = fSmoothing;\n document.getElementById(\"maxSpeedInput\").value = fMaxSpeed;\n document.getElementById(\"minSpeedInput\").value = fMinSpeed;\n document.getElementById(\"maxAccelerationInput\").value = fMaxAcceleration;\n document.getElementById(\"maxDecelerationInput\").value = fMaxDeceleration;\n document.getElementById(\"turnSpeedInput\").value = fTurnSpeed;\n\n //Set the settings menu to be visible\n setVisibility(document.getElementById(\"settingsPopup\"), true);\n}",
"function onSaveButtonPress() {\n\tif (!validateSettings()) return;\n\tdlgMain.close(saveButtonID);\n}",
"function showExport() {\n $(\"#export-dialog\").show();\n buildSelectApiTree(\"#export-dialog\",gdata.apiList,\"collapsed\")\n $(\"#export-dialog .filename\").focus();\n}",
"function helpDialog(helpText , title ,win , meta_wgl){\r var diag = new Window (\"dialog\",title + \"\");\r diag.preferredSize = {\"width\":450,\"height\":450};\rvar pan = diag.add('group',undefined,'');\r pan.orientation ='column';\rvar txt = pan.add('edittext',undefined,helpText,{multiline:true,scrolling: true});\r txt.preferredSize = {\"width\":440,\"height\":430};\rvar btg = pan.add (\"group\");\r\rvar cbg = btg.add (\"group\");\r\r cbg.alignment = \"left\";\r\r// var reset_button = cbg.add (\"button\", undefined, \"Reset Values to default\");\r\r btg.orientation = 'row';\r btg.alignment = \"right\";\r btg.add (\"button\", undefined, \"OK\");\r btg.add (\"button\", undefined, \"cancel\");\r\r\r if (diag.show () == 1){\r\r return true;\r\r }else{ \r\r return false;\r\r };\r}",
"function ExportProjectDialog ( projectList ) {\n\n (function(dlg){\n\n serverRequest ( fe_reqtype.preparePrjExport,projectList,\n 'Prepare Project Export',function(){ // on success\n\n Widget.call ( dlg,'div' );\n dlg.element.setAttribute ( 'title','Export Project' );\n document.body.appendChild ( dlg.element );\n\n var grid = new Grid('');\n dlg.addWidget ( grid );\n\n grid.setLabel ( '<h3>Export Project \"' + projectList.current + '\"</h3>',0,0,1,3 );\n\n var msgLabel = new Label ( 'Project \"' + projectList.current + '\" is being ' +\n 'prepared for download ....' );\n grid.setWidget ( msgLabel, 1,0,1,3 );\n\n var progressBar = new ProgressBar ( 0 );\n grid.setWidget ( progressBar, 2,0,1,3 );\n\n dlg.projectSize = -2;\n\n // w = 3*$(window).width()/5 + 'px';\n\n $(dlg.element).dialog({\n resizable : false,\n height : 'auto',\n maxHeight : 500,\n width : 'auto',\n modal : true,\n open : function(event, ui) {\n $(this).closest('.ui-dialog').find('.ui-dialog-titlebar-close').hide();\n },\n buttons : [\n {\n id : \"download_btn\",\n text : \"Download\",\n click : function() {\n var token;\n var url;\n // if (__login_token) token = __login_token.getValue();\n if (__login_token)\n token = __login_token;\n else token = '404';\n url = '@/' + token + '/' + projectList.current + '/' +\n projectList.current + '.tar.gz';\n downloadFile ( url );\n $( \"#cancel_btn\" ).button ( \"option\",\"label\",\"Close\" );\n //$(dlg).dialog(\"close\");\n }\n },\n {\n id : \"cancel_btn\",\n text : \"Cancel\",\n click : function() {\n $(this).dialog(\"close\");\n }\n }\n ]\n });\n\n window.setTimeout ( function(){ $('#download_btn').hide(); },0 );\n\n function checkReady() {\n serverRequest ( fe_reqtype.checkPrjExport,projectList,\n 'Prepare Project Export',function(data){\n if ((data.size<=0) && (dlg.projectSize<-1))\n window.setTimeout ( checkReady,1000 );\n else {\n dlg.projectSize = data.size;\n progressBar.hide();\n msgLabel.setText ( 'Project \"' + projectList.current + '\" is prepared ' +\n 'for download. The total download<br>size is ' +\n round(data.size/1000000,3) + ' MB. Push the ' +\n '<i>Download</i> button to begin<br>the project ' +\n 'export. ' +\n '<p><b><i>Do not close this dialog until the ' +\n 'download has finished.</i></b>' );\n $('#download_btn').show();\n }\n },null,function(){ // depress error messages in this case!\n window.setTimeout ( checkReady,1000 );\n });\n }\n\n window.setTimeout ( checkReady,2000 );\n\n $(dlg.element).on( \"dialogclose\",function(event,ui){\n //alert ( 'projectSize = ' + dlg.projectSize );\n serverRequest ( fe_reqtype.finishPrjExport,projectList,\n 'Finish Project Export',null,function(){\n window.setTimeout ( function(){\n $(dlg.element).dialog( \"destroy\" );\n dlg.delete();\n },10 );\n },function(){} ); // depress error messages\n });\n\n },null,null );\n\n }(this))\n\n}",
"function scriptConfig() {\r\n\ttrace(\"scriptConfig() configuring the dialog\");\r\n\t\r\n\t// Configure Settings dialog\r\n\tGM_config.init('Emule Linker Settings dialog', {\r\n\t\t'section1' : { section: ['ed2k download mode', 'Please refer to your emule/amule/mldonkey configuration'], label: '', type: 'hidden'},\r\n\t\t/*'ed2kDlMethod': { label: 'Ed2k Download Method', title: 'local: local application that handle ed2k links (default)\\nemule: remote emule (via web frontend)\\namule: remote amule (via web frontend)\\nmldonkey: remote mldonkey (via web frontend)\\ncustom: custom server implementation (experimental)', type:'radio', options:['local','emule','amule','mldonkey','custom'], default: ed2kDlMethod },*/\r\n\t\t'ed2kDlMethod': { label: 'Ed2k Download Method', title: 'local: local application that handle ed2k links (default)\\nemule: remote emule (via web frontend)\\namule: remote amule (via web frontend)\\nmldonkey: remote mldonkey (via web frontend)\\ncustom: custom server implementation (experimental)', type:'select', options:{'local':'your system default','emule':'(remote) emule','amule':'(remote) amule','mldonkey':'(remote) mldonkey','custom':'custom (experimental)'}, default: ed2kDlMethod}, // default value doesn't work with a dropdown menu => see bugfix in the lib\r\n\t\t'emuleUrl': { label: 'Emule Url', title : 'The complete url of your emule web server ending by a / (example: http://127.0.0.1:4711/)', type: 'text', default: emuleUrl },\r\n\t\t'emulePwd': { label: 'Emule Password', title : 'the password you choose to access your emule web server', type: 'text', default: emulePwd },\r\n\t\t'emuleCat': { label: 'Category', title : 'categories available in your emule/amule application. You can add categories using the following template:\\ncategory_name1=corresponding_index_in_emule;category_name2=...\\nAdding a * before the name specify the default choice.\\nIf you don\\'t know what you are doing just specify this: *default=0', type: 'text', default: catToStr(emuleCat) },\r\n\t\t'section2' : { section: ['Popup Configuration', 'modify how the popup is displayed'], label: '', type: 'hidden'},\r\n\t\t'popupPos': { label: 'Popup Position', title : 'choosing \\'absolute\\', the popup will stay at the top. Choosing fixed, the popup will follow as you scroll within the page', type: 'radio', options:['absolute','fixed'], default: popupPos },\r\n\t\t'popupHeight': { label: 'Max Popup Height in px (0=unlimited)', title : 'Max height of the popup in pixels (0=unlimited)', type: 'int', default: popupHeight },\r\n\t\t'popupWidth': { label: 'Max Popup Width in px (0=unlimited)', title : 'Max width of the popup in pixels (0=unlimited)', type: 'int', default: popupWidth },\r\n\t\t'section3' : { section: ['Edit box Configuration', 'modify how the edit box is displayed'], label: '', type: 'hidden'},\r\n\t\t'editCol': { label: 'Number of columns', title : 'number of columns', type: 'radio', type: 'int', default: editCol },\r\n\t\t'editRow': { label: 'Number of rows', title : 'Number of rows', type: 'int', default: editRow },\r\n\t\t'editMaxLength': { label: 'MaxLength', title : 'Max number of char in the text area', type: 'int', 'default': editMaxLength },\r\n\t\t}, \r\n\t\t{\r\n\t\t//open: function() { GM_config.sections2tabs(); }, // not working (not included into the library)\r\n\t\tsave: function() { location.reload(); } // reload the page when configuration was changed\r\n\t\t}\r\n\t);\r\n\t\r\n\t// invoke the dialog\r\n\tif (GM_getValue(\"emule_config\", 0)<1)\r\n\t{\r\n\t\ttrace(\"scriptConfig() invoking the dialog\");\r\n\t\tGM_config.open();\r\n\t\tGM_setValue(\"emule_config\",1);\r\n\t}\r\n\r\n\t// store the settings\r\n\tsaveConfig();\r\n\r\n}",
"function _openDialog( pDialog ) {\n var lWSDlg$, lTitle, lId,\n lButtons = [{\n text : MSG.BUTTON.CANCEL,\n click : function() {\n lWSDlg$.dialog( \"close\" );\n }\n }];\n\n function _displayButton(pAction, pLabel, pHot, pClose ) {\n var lLabel, lStyle;\n\n if ( pLabel ) {\n lLabel = pLabel;\n } else {\n lLabel = MSG.BUTTON.APPLY;\n }\n if ( pHot ) {\n lStyle = 'ui-button--hot';\n }\n lButtons.push({\n text : lLabel,\n class : lStyle,\n click : function() {\n that.actions( pAction );\n if ( pClose ) {\n lWSDlg$.dialog( \"close\" );\n }\n }\n });\n }\n\n if ( pDialog==='WEBSHEET' ) {\n lTitle = MSG.DIALOG_TITLE.PROPERTIES;\n _displayButton( 'websheet_properties_save', null, true, false );\n } else if ( pDialog==='ADD_COLUMN' ) {\n lTitle = MSG.DIALOG_TITLE.ADD_COLUMN;\n _displayButton( 'column_add', null, true, false );\n } else if ( pDialog==='COLUMN_PROPERTIES' ) {\n lTitle = MSG.DIALOG_TITLE.COLUMN_PROPERTIES;\n _displayButton( 'column_properties_save', null, true, false );\n } else if ( pDialog==='LOV' ) {\n lTitle = MSG.DIALOG_TITLE.LOV;\n lId = apex.item( \"apexir_LOV_ID\" ).getValue();\n if ( lId ) {\n _displayButton( 'lov_delete', MSG.BUTTON.DELETE, false, false );\n }\n _displayButton( 'lov_save', null, true, false );\n } else if ( pDialog==='GROUP' || pDialog==='GROUP2' ) {\n lTitle = MSG.DIALOG_TITLE.COLUMN_GROUPS;\n lId = apex.item( \"apexir_GROUP_ID\" ).getValue();\n if ( lId ) {\n _displayButton( 'column_groups_delete', MSG.BUTTON.DELETE, false, false );\n }\n _displayButton( 'column_groups_save', null, true, false );\n } else if ( pDialog==='VALIDATION' ) {\n lTitle = MSG.DIALOG_TITLE.VALIDATION;\n lId = apex.item( \"apexir_VALIDATION_ID\" ).getValue();\n if ( lId ) {\n _displayButton( 'VALIDATION_DELETE', MSG.BUTTON.DELETE, false, false );\n }\n _displayButton( 'VALIDATION_SAVE', null, true, false );\n } else if ( pDialog==='REMOVE_COLUMN' ) {\n lTitle = MSG.DIALOG_TITLE.DELETE_COLUMNS;\n _displayButton( 'column_remove', MSG.BUTTON.DELETE, true, false );\n } else if ( pDialog==='SET_COLUMN_VALUE' ) {\n lTitle = MSG.DIALOG_TITLE.SET_COLUMN_VALUES;\n _displayButton( 'set_column_value', null, true, false );\n } else if ( pDialog==='REPLACE' ) {\n lTitle = MSG.DIALOG_TITLE.REPLACE;\n _displayButton( 'replace_column_value', null, true, false );\n } else if ( pDialog==='FILL' ) {\n lTitle = MSG.DIALOG_TITLE.FILL;\n _displayButton( 'fill_column_value', null, true, false );\n } else if ( pDialog==='DELETE_ROWS' ) {\n lTitle = MSG.DIALOG_TITLE.DELETE_ROWS;\n _displayButton( 'delete_rows', MSG.BUTTON.DELETE, true, false );\n } else if ( pDialog==='COPY' ) {\n lTitle = MSG.DIALOG_TITLE.COPY_DATA_GRID;\n _displayButton( 'copy', MSG.BUTTON.COPY, true, false );\n } else if ( pDialog==='DELETE' ) {\n lTitle = MSG.DIALOG_TITLE.DELETE_DATA_GRID;\n _displayButton( 'delete_websheet', MSG.BUTTON.DELETE, true, false );\n } else if ( pDialog==='ATTACHMENT' ) {\n lTitle = MSG.DIALOG_TITLE.ADD_FILE;\n _displayButton( 'ATTACHMENT_SAVE', null, true, true );\n } else if ( pDialog==='NOTE' ) {\n lTitle = MSG.DIALOG_TITLE.ADD_NOTE;\n _displayButton( 'NOTE_SAVE', null, true, false );\n } else if ( pDialog==='LINK' ) {\n lTitle = MSG.DIALOG_TITLE.ADD_LINK;\n _displayButton( 'LINK_SAVE', null, true, false );\n } else if ( pDialog==='TAGS' ) {\n lTitle = MSG.DIALOG_TITLE.ADD_TAGS;\n _displayButton( 'TAG_SAVE', null, true, false );\n }\n\n lWSDlg$ = $( \"#a-IRR-dialog-js\", apex.gPageContext$ ).dialog({\n modal : true,\n dialogClass: \"a-IRR-dialog\",\n width : \"auto\",\n height : \"auto\",\n minWidth : \"360\",\n title : lTitle,\n buttons : lButtons,\n close : function() {\n lWSDlg$.dialog( \"destroy\");\n }\n });\n }"
]
| [
"0.83063394",
"0.7474406",
"0.6514149",
"0.63470656",
"0.6144442",
"0.6022726",
"0.5980467",
"0.59690773",
"0.5906276",
"0.5866956",
"0.5866837",
"0.58417386",
"0.5814656",
"0.5791883",
"0.5779246",
"0.5757548",
"0.5751364",
"0.57504123",
"0.5745105",
"0.5728416",
"0.57019114",
"0.5660083",
"0.5658274",
"0.56257427",
"0.5621794",
"0.5619566",
"0.5611267",
"0.56052923",
"0.5599225",
"0.55900055"
]
| 0.7999531 | 1 |
Function: btnRunOnClick Usage: routine is assigned to the onClick method of the run button Input: checks the dialog params and closes with the dialog with true Return: , dialog is closed with true on success | function btnRunOnClick() {
// check if the setting is properly
var destination = dlgMain.etDestination.text;
if (destination.length == 0) {
alert(strAlertSpecifyDestination);
return;
}
var testFolder = new Folder(destination);
if (!testFolder.exists) {
alert(strAlertDestinationNotExist);
return;
}
// find the dialog in this auto layout mess
var d = this;
while (d.type != 'dialog') {
d = d.parent;
}
d.close(runButtonID);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onRunButtonPress() {\n\tif (!validateSettings()) return;\n\tdlgMain.close(runButtonID);\n}",
"function runOperation() {\n\tsetConfig();\n\tcreatePrints();\n\trunDialog.close();\n}",
"function ClickOnStartContinue()\n{\n if(Btn_Start_Continue.Exists)\n {\n Btn_Start_Continue.ClickButton()\n Log.Message(\"Clicked on Start Button on Quick CMC\")\n return true\n }\n else\n {\n Log.Message(\"Button Start doesn't exists\")\n return false\n }\n}",
"accept() {\n this.dialog = false;\n this.snackbarOk = true;\n this.runRoutine();\n }",
"function buttonOkClickFunc(){\r\n\t\tself.close(); //关闭对话框\r\n\t\tconsole.log(\"button ok clicked!\");\r\n\t\tif(self.buttonOkCallback!=null){\r\n\t\t\tself.buttonOkCallback();\r\n\t\t}\r\n\t}",
"function triggerStopAction(ob) {\r\n\t$('#stopActionPrompt').dialog({ bgiframe: true, modal: true, width: (isMobileDevice ? $('body').width() : 550), \r\n\t\tclose: function(){\r\n\t\t\tvar obname = ob.prop('name');\r\n\t\t\tvar varname = ''\r\n\t\t\t// Undo last response if closing and returning to survey\r\n\t\t\tif (obname.substring(0,8) == '__chkn__'){\r\n\t\t\t\t// Checkbox\r\n\t\t\t\t$('#form input[name=\"'+obname+'\"]').each(function(){\r\n\t\t\t\t\tif ($(this).attr('code') == ob.attr('code')) {\r\n\t\t\t\t\t\t$(this).prop('checked',false);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\t$('#form input[name=\"'+obname.replace('__chkn__','__chk__')+'_RC_'+ob.attr('code')+'\"]').val('');\r\n\t\t\t\tvarname = obname.substring(8,obname.length);\r\n\t\t\t} else if (obname.substring(obname.length-8,obname.length) == '___radio'){\r\n\t\t\t\t// Radio\r\n\t\t\t\tuncheckRadioGroup(ob);\r\n\t\t\t\t$('#form input[name=\"'+obname.substring(0,obname.length-8)+'\"]').val('');\r\n\t\t\t\tvarname = obname.substring(0,obname.length-8);\r\n\t\t\t} else {\r\n\t\t\t\t// Drop-down\r\n\t\t\t\t$('#form select[name=\"'+obname+'\"]').val('');\r\n\t\t\t\tvarname = obname;\r\n\t\t\t}\r\n\t\t\t// Highlight the row they need to return to \r\n\t\t\tsetTimeout(function(){\r\n\t\t\t\t$('#stopActionReturn').dialog({ bgiframe: true, modal: true, width: 320, buttons: { \r\n\t\t\t\t\t'Continue survey': function() { \r\n\t\t\t\t\t\thighlightTableRow(varname+'-tr',2500); $(this).dialog('close'); \r\n\t\t\t\t\t}\r\n\t\t\t\t} });\r\n\t\t\t},100);\r\n\t\t},\r\n\t\tbuttons: { \r\n\t\t\t'Continue survey and undo last response': function() { \r\n\t\t\t\t// Trigger calculations and branching logic\r\n\t\t\t\tsetTimeout(function(){calculate();doBranching();},50);\r\n\t\t\t\t$(this).dialog('close'); \r\n\t\t\t},\r\n\t\t\t'End the survey now': function() {\r\n\t\t\t\t$('#form').prop('action', $('#form').prop('action')+'&__endsurvey=1' );\r\n\t\t\t\tdataEntrySubmit(document.getElementById('submit-action'));\r\n\t\t\t}\r\n\t\t} \r\n\t});\r\n}",
"function yesButtonClick() {\n\n pdfs(\"wfFrame\" + pdf(\"CurrentDesk\")).Submit_Click();\n psc().gsUIMode = \"Confirm\";\n if (pdfs(\"wfFrame\" + pdf(\"CurrentDesk\")).HasNoError) {\n psc().confirmresult = true;\n eval(psc().clickmethod);\n confirmresult = false;\n //psc().confirmresult = false;\n // psc().hideConfirmMessagePane('YES');\n\n }\n}",
"function ClickStart()\n{\n if(Btn_Start.Exists)\n {\n Btn_Start.ClickButton()\n Log.Message(\"Clicked on Start Button on Quick CMC\")\n return true\n }\n else\n {\n Log.Message(\"Button Start doesn't exists\")\n return false\n }\n}",
"okPressed() {\n this.$uibModalInstance.close(this.processingType.specimenProcessing.input);\n }",
"function testButtonClicked(){\n\n var button = $(this);\n setActiveTest(button);\n\n var buttonID = button.attr(\"id\");\n\n // Get the function that matches the button\n var f = codeValidationFunctions[buttonID]\n\n executeAndMark([f]);\n \n}",
"function btnClick(btnID) {\r\n if (btnID == 'close') {\r\n closeWindow();\r\n }\r\n}",
"function accept_btn_Click(eventObject) {\r\n var callID = \"\";\r\n var makerDecisionFlag = \"\";\r\n var currentRow = caseTbl.getCheckedRows();\r\n /*for(var i=0;i<currentRow.length;i++)\r\n {\r\n callID+=callId[currentRow[i].index].getValue() +\",\";\r\n makerDecisionFlag= makerDecision[currentRow[i].index].getValue();\r\n }*/\r\n if (currentRow.length == 0) {\r\n alert(\"Please select the case to accept the decision\");\r\n return;\r\n }\r\n callID = callId[currentRow[0].index].getValue();\r\n makerDecisionFlag = makerDecision[currentRow[0].index].getValue();\r\n\r\n cordys.setNodeText(HoldReleaseDecisionOnCaseModel.getMethodRequest(), \".//*[local-name()='callId']\", callID);\r\n\r\n cordys.setNodeText(HoldReleaseDecisionOnCaseModel.getMethodRequest(), \".//*[local-name()='action']\", 'ACCEPT');\r\n\r\n //cordys.setNodeText(HoldReleaseDecisionOnCaseModel.getMethodRequest(), \".//*[local-name()='remarks']\", rejectRemarks);\r\n HoldReleaseDecisionOnCaseModel.reset();\r\n if (!HoldReleaseDecisionOnCaseModel.soapFaultOccurred) {\r\n if (callID != \"\") {\r\n xo__xElementbarButton__1_Click();\r\n if (makerDecisionFlag == 'Y')\r\n application.notify(\"The case is held successfully\");\r\n else\r\n application.notify(\"The case is released successfully\");\r\n hold_btn.hide();\r\n } else\r\n application.notify(\"Please select the case\");\r\n } else {\r\n application.notify(\"Holding failed. Please Contact the admin\");\r\n }\r\n}",
"function updateRunButton(event) {\r\n\r\n\tif (!$('isowner') || $('isowner').value != \"1\") {\r\n\t\treturn;\r\n\t}\r\n\tvar btn = $('launch_btn');\r\n\tvar btn_ind = $('launch_btn_ind');\r\n\tif (btn_ind.hasClassName('conIndicator_processing')) {\r\n\t\t//console.info('still processing..');\r\n\t\treturn;\r\n\t}\r\n\r\n\tvar cnt = 0;\r\n\t$$('input.conRadiobox_align').each(function(element) {\r\n\t if (element.checked == true) {\r\n\t\tcnt++;\r\n\t }\r\n\t});\r\n\r\n\tif (cnt) {\r\n\t\tbtn_ind.removeClassName('conIndicator_Rb_disabled');\r\n\t\tbtn_ind.removeClassName('conIndicator_error');\r\n\t\t//btn_ind.removeClassName('conIndicator_processing');\r\n\t\tbtn_ind.addClassName('conIndicator_not-processed');\r\n\t\tbtn.removeClassName('disabled');\r\n\t}\r\n\telse {\r\n\t\tbtn_ind.removeClassName('conIndicator_error');\r\n\t\tbtn_ind.removeClassName('conIndicator_not-processed');\r\n\t\t//btn_ind.removeClassName('conIndicator_processing');\r\n\t\tbtn_ind.addClassName('conIndicator_Rb_disabled');\r\n\t\tbtn.addClassName('disabled');\r\n\t}\r\n}",
"function confirmDialog() {\n let confirmDialogID = document.getElementById(\"confirmCustomDialog\");\n confirmDialogID.close();\n document.getElementById(\"resultTxt\").innerHTML=\"Confirm result: true\";\n}",
"function release_btn_Click(eventObject) {\r\n var callID = \"\";\r\n var currentRow = caseTbl.getCheckedRows();\r\n var userRole = cordys.getNodeText(GetPoUserMasterCompleteObjectModel.getData(), \".//*[local-name()='USER_ROLE']\", \"\", \"\")\r\n callID = callId[currentRow[0].index].getValue();\r\n if (userRole == \"StakeHolderMaker\") {\r\n cordys.setNodeText(HoldReleaseDecisionOnCaseModel.getMethodRequest(), \".//*[local-name()='callId']\", callID);\r\n cordys.setNodeText(HoldReleaseDecisionOnCaseModel.getMethodRequest(), \".//*[local-name()='action']\", 'RELEASE');\r\n HoldReleaseDecisionOnCaseModel.reset();\r\n if (!HoldReleaseDecisionOnCaseModel.soapFaultOccurred) {\r\n if (callID != \"\") {\r\n xo__xElementbarButton__1_Click();\r\n application.notify(\"The case is released successfully\");\r\n release_btn.hide();\r\n } else\r\n application.notify(\"Please select the case\");\r\n } else {\r\n application.notify(\"Releasing failed. Please Contact the admin\");\r\n }\r\n } else if (userRole == \"ADMIN\") {\r\n cordys.setNodeText(HoldReleaseDecisionOnCaseModel.getMethodRequest(), \".//*[local-name()='callId']\", callID);\r\n cordys.setNodeText(HoldReleaseDecisionOnCaseModel.getMethodRequest(), \".//*[local-name()='action']\", 'RELEASE');\r\n HoldReleaseDecisionOnCaseModel.reset();\r\n if (!HoldReleaseDecisionOnCaseModel.soapFaultOccurred) {\r\n if (callID != \"\") {\r\n xo__xElementbarButton__1_Click();\r\n application.notify(\"The case is released successfully\");\r\n release_btn.hide();\r\n } else\r\n application.notify(\"Please select the case\");\r\n } else {\r\n application.notify(\"Releasing failed. Please Contact the admin\");\r\n }\r\n }\r\n}",
"function handleOnButtonClick(asBtn) {\r\n switch (asBtn) {\r\n case 'ADD_UDR_DONE':\r\n var addTeamB = getObjectValue(\"addTeamB\");\r\n var entityId = getObjectValue('entityId');\r\n var effectiveFromDate = getObjectValue('effectiveFromDate');\r\n var effectiveToDate = getObjectValue('effectiveToDate');\r\n var renewalB = getObjectValue('renewalB');\r\n var teamCode = getObjectValue('regionalTeamCode');\r\n if (teamCode.length == 0) {\r\n addTeamB = \"N\";\r\n }\r\n var underwriterArray = new Array();\r\n underwriterArray[0] = entityId;\r\n underwriterArray[1] = addTeamB;\r\n underwriterArray[2] = effectiveFromDate;\r\n underwriterArray[3] = effectiveToDate;\r\n underwriterArray[4] = renewalB;\r\n underwriterArray[5] = teamCode;\r\n closeWindow(function () {\r\n getReturnCtxOfDivPopUp().addUnderwriterTeam(underwriterArray);\r\n });\r\n break;\r\n }\r\n}",
"function cancelClicked()\n{\n dwscripts.setCommandReturnValue(\"\");\n\n window.close();\n}",
"onClickRun_(ev) {\n ev.stopPropagation(); // don't trigger scene click\n this.buttonEl_.blur();\n this.game.dismissTutorial();\n\n if (this.portraitMode_) {\n this.portraitToggleScene(true);\n window.setTimeout(() => this.blockRunner_.execute(), app.Constants.SCENE_TOGGLE_DURATION);\n } else {\n this.blockRunner_.execute();\n Klang.triggerEvent('generic_button_click');\n }\n }",
"function onCancelButtonPress(){\n\tdlgMain.close(cancelButtonID);\n}",
"function clickedCancel()\r\n{\r\n recordsetDialog.onClickCancel(window);\r\n}",
"function onClickExitCallButton(event) {\n exitCall(true);\n}",
"function onExitAlertOkClick() {\n app.exit();\n }",
"function processCancelParcelDelivery(win_id, win_btn) {\n //close dialog box\n let elem = document.getElementById(win_id);\n elem.className = \"theme-color-4 elem-shadow remove-elem\";\n\n //processing input\n if (win_btn == 'ok') {\n //do other processing here\n console.log(\"Cancelling Parcel ID: \" + current_parcel_delivery_id);\n\n } else {\n console.log(\"Cancel parcel comfirm dialog closed\");\n }\n }",
"function isSafeToClose() {\n //console.log(\"issafetoclose\");\n if (projectModified) {\n $(\"#dialog-confirm\").data('recentProjectPath', null).dialog(\"open\");\n $('.ui-dialog :button').blur();\n return false;\n } else {\n return true;\n }\n}",
"click() {\n // construct the select file dialog \n dialog.showOpenDialog({\n properties: ['openFile']\n })\n .then(function(fileObj) {\n // the fileObj has two props \n if (!fileObj.canceled) {\n mainWindow.webContents.send('FILE_OPEN', fileObj.filePaths)\n }\n })\n .catch(function(err) {\n console.error(err)\n })\n }",
"function clickDialogGetOut() {\n $(function () {\n $(\"#dialog-form\").dialog({\n buttons: [\n {\n text: \"Выдать\",\n click: function () {\n $(\"#loaderClaimGive\").show();\n var userSourceId = $(\"#userSource\").val().split(\";\")[0];\n var userTargetId = $(\"#userTarget\").val().split(\";\")[0];\n var employeId = null;\n if (userTargetId) {\n employeId = userTargetId;\n } else {\n employeId = currentUserId;\n }\n\n if ($(\"#getFile\").get(0).files.length === 0) {\n clickAcceptTask(null, moment(new Date()).format(), userSourceId, $(\"#discriptionModal\").val(), $(\"#urgencyModalClaim option:selected\").text(),\n $(\"#categoryModalClaim option:selected\").text(), null, employeId);\n } else {\n sendClaimWithFile(function (itemId) {\n clickAcceptTask(null, moment(new Date()).format(), userSourceId, $(\"#discriptionModal\").val(), $(\"#urgencyModalClaim option:selected\").text(),\n $(\"#categoryModalClaim option:selected\").text(), itemId, employeId);\n });\n }\n }\n }\n ],\n title: 'Выдать Заявку: ',\n width: 600,\n modal: true,\n resizable: false\n });\n });\n}",
"function DeleteRequestTypeSuccess() {\n if ($(\"#updateTargetId\").html() == \"True\") {\n\n //now we can close the dialog\n $('#deleteRequestTypeDailog').dialog('close');\n\n //JQDialogAlert mass, status\n JQDialogAlert(\"Data deleted successfully.\", \"dialogSuccess\");\n\n ResetRequestTypeGrid();\n\n }\n else {\n //show message in popup\n $(\"#updateTargetId\").show();\n\n }\n}",
"function onDone(event){\n\tconsole.log('done button clicked');\n\tif (validateContents() === true){ \n finishTest();\n }\n\telse {\n\t\trepeatTest();\n\t\treset();\n\t}\n}",
"function buttonCancelClickFunc(){\r\n\t\tself.close(); //关闭对话框\r\n\t\tif(self.buttonCancelCallback!=null){\r\n\t\t\tself.buttonCancelCallback();\r\n\t\t}\r\n\t}",
"function ConfirmDialog() {\n\n //MessageLog.trace(\"\\n===================ConfirmDialog\\n\")\n\n if (Find_Unexposed_Substitutions()) {\n\n var d = new Dialog\n\n d.title = \"Delete_unexposed_substitutions\";\n\n rapport = \"The following subsitutions will be deleted : \"\n\n\n for (var c = 0; c < substituions_tab.columns.length; c++) {\n\n var currentColumn = substituions_tab.columns[c];\n\n var drawing = substituions_tab.drawings[c];\n\n for (var u = 0; u < substituions_tab.substitions[c].length; u++) {\n\n var sub_to_delete = substituions_tab.substitions[c][u];\n\n rapport += \"\\n\" + drawing + \" : \" + sub_to_delete;\n }\n\n }\n\n MessageLog.trace(rapport);\n\n if (rapport.length > 500) {\n rapport = \"Sorry too much informations to display please see the MessageLog\"\n\n }\n\n MessageBox.information(rapport)\n\n\n var rc = d.exec();\n\n if (rc) {\n\n Delete_Substitutions();\n\n }\n\n\n } else {\n\n \tMessageLog.trace(rapport);\n\n if (rapport.length > 500) {\n rapport = \"Sorry too much informations to display please see the MessageLog\"\n\n }\n\n MessageBox.information(rapport);\n\n }\n\n }"
]
| [
"0.71719664",
"0.6129805",
"0.6078865",
"0.6034298",
"0.596392",
"0.58390397",
"0.5809481",
"0.5804938",
"0.57655156",
"0.57511175",
"0.57294905",
"0.57183695",
"0.57056075",
"0.567636",
"0.5615213",
"0.5606421",
"0.56009555",
"0.5593158",
"0.55565405",
"0.5554577",
"0.55451995",
"0.5544511",
"0.55358547",
"0.55308884",
"0.5521489",
"0.55094635",
"0.55044293",
"0.5498195",
"0.54895186",
"0.5487528"
]
| 0.6612402 | 1 |
Function: btnBrowseOnClick Usage: routine is assigned to the onClick method of the browse button Input: pop the selectDialog, and get a folder Return: , sets the destination edit text | function btnBrowseOnClick()
{
var defaultFolder = dlgMain.etDestination.text;
var testFolder = new Folder(dlgMain.etDestination.text);
if (!testFolder.exists) defaultFolder = "~";
var selFolder = Folder.selectDialog(strTitleSelectDestination, defaultFolder);
if (selFolder != null) {
dlgMain.etDestination.text = selFolder.fsName;
}
dlgMain.defaultElement.active = true;
return;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onBrowseButtonPress(){\n\tvar defaultFolder = dlgMain.grpDestination.field.text;\n\tvar testFolder = new Folder(defaultFolder);\n\tif (!testFolder.exists) {\n\t\tdefaultFolder = \"~\";\n\t}\n\tvar selFolder = Folder.selectDialog(strTitleSelectDestination, defaultFolder);\n\tif ( selFolder != null ) {\n\t\tdlgMain.grpDestination.field.text = selFolder.fsName;\n\t}\n\tdlgMain.defaultElement.active = true;\n}",
"function btnBrowse_click(e,startDir) {\n\tcServ.fp.init(xWin, 'Select Directory to Compile', Ci.nsIFilePicker.modeGetFolder);\n\tif (startDir) {\n\t\tCu.reportError('startdir = ' + startDir);\n\t\ttry {\n\t\t\tvar startDirNsiFile = FileUtils.File(startDir);\n\t\t} catch (ex) {\n\t\t\tjsWin.addMsg('Invalid Path For Start Directory - ' + startDir);\n\t\t}\n\t\tif (startDirNsiFile) {\n\t\t\tif (!startDirNsiFile.exists()) {\n\t\t\t\tjsWin.addMsg('Start Directory Does Not Exist - ' + startDirNsiFile.path);\n\t\t\t} else {\n\t\t\t\tcServ.fp.displayDirectory = startDirNsiFile;\n\t\t\t}\n\t\t}\n\t}\n\t//cServ.fp.appendFilters(Ci.nsIFilePicker.filterAll | Ci.nsIFilePicker.filterText);\n\t\n\tvar rv = cServ.fp.show();\n\tif (rv != Ci.nsIFilePicker.returnOK) {\n\t\treturn;\n\t}\n\t\n\tvar dir = cServ.fp.file;\n\tfieldBrowse.value = dir.path;\n\t\n\tbtnCompile.focus();\n\tif (dir.parent) {\n\t\tupdateHistory(dir.parent.path, new Date().getTime()); //add parent of selected folder to recent folders list\n\t}\n}",
"function onButtonClick() {\n // show select path dialog\n const { dialog } = window.require(\"electron\").remote;\n dialog\n .showOpenDialog({\n default: defaultPath,\n properties: [\"openDirectory\"],\n })\n .then((result) => {\n if (!result.canceled) {\n let path = result.filePaths[0];\n // callback to parent\n props.onPathSelect(path);\n }\n });\n }",
"function browseAndGo() {\r\n\tnew IrexplorerDialog({\r\n\t\tmode: \"directory\",\r\n\t\trelative: false,\r\n\t\tonValidate: function(path) {\r\n\t\t\tdocument.location.href = \"?admin_path=\" + encodeURI(path);\r\n\t\t}\r\n\t});\r\n}",
"browse() {\n const that = this;\n\n if (that.disabled || (!that.multiple && that._selectedFiles.length > 0)) {\n return;\n }\n\n that.$.browseInput.click();\n }",
"function onBrowseButton()\n{\n /* pass in false to suppress no write access alert */\n\tvar aFolderName = dw.browseForFolderURL(MM.LABEL_GetJSTFolderName,dw.getSiteRoot(),false);\n\n\tif (!aFolderName.length)\n\t{\n\t\treturn;\n\t}\n\n\t//Initialize the type library dom.\n\tLOCOBJ.value = aFolderName;\n}",
"onOk(){\n var view = this.insideFrame().childViewByType('View')\n var path = view.childWidgetByType('Tree').getSelectionPath()\n path.push(this.fileName)\n this.onRenameFile(path)\n }",
"click() {\n // construct the select file dialog \n dialog.showOpenDialog({\n properties: ['openFile']\n })\n .then(function(fileObj) {\n // the fileObj has two props \n if (!fileObj.canceled) {\n mainWindow.webContents.send('FILE_OPEN', fileObj.filePaths)\n }\n })\n .catch(function(err) {\n console.error(err)\n })\n }",
"_browse(){\n \t this._setSendMessage({type:'BROWSE'});\n }",
"function handleBrowseClick() {\n var fileinput = document.getElementById(\"browse\");\n fileinput.click();\n}",
"function browse() {\r\n\r\n}",
"function dirChoose(e) {\n\t\n\tdocument.getElementById(\"uploadDir\").click();\n}",
"function directoryPicker(newfile) {\n var GoogleAuth = gapi.auth2.getAuthInstance();\n if (!GoogleAuth.isSignedIn.get()) {\n // User is not signed in. Start Google auth flow.\n GoogleAuth.signIn();\n }\n var oauthToken = gapi.auth.getToken().access_token;\n gapi.load('picker', {'callback': function(){\n if (oauthToken) {\n var view = new google.picker.DocsView(google.picker.ViewId.FOLDERS)\n .setParent('root') \n .setIncludeFolders(true) \n .setMimeTypes('application/vnd.google-apps.folder')\n .setSelectFolderEnabled(true);\n var picker = new google.picker.PickerBuilder()\n .enableFeature(google.picker.Feature.NAV_HIDDEN)\n .enableFeature(google.picker.Feature.MULTISELECT_DISABLED)\n .setAppId(google_appid)\n .setOAuthToken(oauthToken)\n .addView(view)\n .setTitle(\"Select Destination Folder\")\n .setDeveloperKey(google_apikey)\n .setCallback(function(data) {\n if (data.action == google.picker.Action.PICKED) {\n var dir = data.docs[0];\n if (dir.id) {\n saveGoogleWithName(newfile, dir.id)\n }\n }\n })\n .build();\n picker.setVisible(true);\n }\n }});\n }",
"function show_choose_file_modal(path, filename, file_path_callback) {\n g_file_chooser_mode = 'file.out';\n $(\"#chooser_file_name\").val(filename);\n chooser_show_modal(path, function() { \n // Hidden input #chooser_directory_path's value always includes trailing\n // directory separator\n file_path_callback($(\"#chooser_directory_path\").val() + $(\"#chooser_file_name\").val());\n });\n return false;\n}",
"function settingDialog(exportInfo) { //设置对话框\n\n\tvar brush,\n\t\tdestination,\n\t\tresult,\n\t\ttestFolder;\n\n\tdlgMain = new Window('dialog', strTitle);\n\n\t// match our dialog background color to the host application\n\tbrush = dlgMain.graphics.newBrush(dlgMain.graphics.BrushType.THEME_COLOR, 'appDialogBackground');\n\tdlgMain.graphics.backgroundColor = brush;\n\tdlgMain.graphics.disabledBackgroundColor = dlgMain.graphics.backgroundColor;\n\n\tdlgMain.orientation = 'column';\n\tdlgMain.alignChildren = 'left';\n\n\t// -- top of the dialog, first line\n\tdlgMain.add('statictext', undefined, strLabelDestination);\n\n\t// -- two groups, one for left and one for right ok, cancel\n\tdlgMain.grpTop = dlgMain.add('group');\n\tdlgMain.grpTop.orientation = 'row';\n\tdlgMain.grpTop.alignChildren = 'top';\n\tdlgMain.grpTop.alignment = 'fill';\n\n\t// -- group top left\n\tdlgMain.grpTopLeft = dlgMain.grpTop.add('group');\n\tdlgMain.grpTopLeft.orientation = 'column';\n\tdlgMain.grpTopLeft.alignChildren = 'left';\n\tdlgMain.grpTopLeft.alignment = 'fill';\n\n\t// -- the second line in the dialog\n\tdlgMain.grpSecondLine = dlgMain.grpTopLeft.add('group');\n\tdlgMain.grpSecondLine.orientation = 'row';\n\n\tdlgMain.etDestination = dlgMain.grpSecondLine.add('edittext', undefined, exportInfo.destination.toString());\n\n\tdlgMain.etDestination.alignment = 'fill';\n\tdlgMain.etDestination.preferredSize.width = strToIntWithDefault(stretDestination, 160);\n\n\tdlgMain.btnBrowse = dlgMain.grpSecondLine.add('button', undefined, strButtonBrowse);\n\n\tdlgMain.btnBrowse.alignment = 'right';\n\n\tdlgMain.btnBrowse.onClick = function() {\n\t\tvar defaultFolder = dlgMain.etDestination.text;\n\t\ttestFolder = new Folder(dlgMain.etDestination.text);\n\t\tif (!testFolder.exists) {\n\t\t\tdefaultFolder = '~';\n\t\t}\n\t\tvar selFolder = Folder.selectDialog(strTitleSelectDestination, defaultFolder);\n\t\tif (selFolder != null) {\n\t\t\tdlgMain.etDestination.text = selFolder.fsName;\n\t\t}\n\t\tdlgMain.defaultElement.active = true;\n\t};\n\n\t// -- the third line in the dialog\n\tdlgMain.grpTopLeft.add('statictext', undefined, strLabelFileNamePrefix);\n\n\n\n\t// -- the fourth line in the dialog\n\tdlgMain.etFileNamePrefix = dlgMain.grpTopLeft.add('edittext', undefined, exportInfo.fileNamePrefix.toString());\n\tdlgMain.etFileNamePrefix.alignment = 'fill';\n\tdlgMain.etFileNamePrefix.preferredSize.width = strToIntWithDefault(stretDestination, 160);\n\n\t// start\n\t// dlgMain.grpTopLeft.add('statictext', undefined, strLabelCssUnit);\n\n\tdlgMain.cssUnitPanel = dlgMain.grpTopLeft.add('panel', undefined, strLabelCssUnit);\n\tdlgMain.cssUnitPanel.group = dlgMain.cssUnitPanel.add('group');\n\tdlgMain.cssUnitPanel.group.orientation = 'row';\n\tdlgMain.cssUnitPanel.group.alignChildren = 'left';\n\tdlgMain.cssUnitPanel.group.alignment = 'fill';\n\n\tdlgMain.cssUnitPanel.alignment = 'fill';\n\n\tdlgMain.cssUnitPx = dlgMain.cssUnitPanel.group.add('RadioButton', undefined, '');\n\tdlgMain.cssUnitPx.text = '相对单位(rem)';\n\tdlgMain.cssUnitPx.data = 'rem';\n\tdlgMain.cssUnitPx.value = true;\n\n\tdlgMain.cssUnitPx = dlgMain.cssUnitPanel.group.add('RadioButton', undefined, '');\n\tdlgMain.cssUnitPx.text = '像素(px)';\n\tdlgMain.cssUnitPx.data = 'px';\n\n\tdlgMain.cssUnitPer = dlgMain.cssUnitPanel.group.add('RadioButton', undefined, '');\n\tdlgMain.cssUnitPer.text = '百分比(%)';\n\tdlgMain.cssUnitPer.data = '%';\n\n\t// option has been removed, force export visible only\n\n\n\t// -- the fifth line in the dialog\n\tdlgMain.grpTopLeft.add('statictext', undefined, strCheckboxVisibleOnly);\n\n\n\t// -- the sixth line is the panel\n\tdlgMain.pnlFileType = dlgMain.grpTopLeft.add('panel', undefined, strLabelFileType);\n\tdlgMain.pnlFileType.alignment = 'fill';\n\n\t// -- now a dropdown list\n\tdlgMain.ddFileType = dlgMain.pnlFileType.add('dropdownlist');\n\tdlgMain.ddFileType.preferredSize.width = strToIntWithDefault(strddFileType, 100);\n\tdlgMain.ddFileType.alignment = 'left';\n\n\t// file types in the dropdown\n\tdlgMain.ddFileType.add('item', 'PNG-24');\n\tdlgMain.ddFileType.add('item', 'PNG-8');\n\tdlgMain.ddFileType.add('item', 'JPEG');\n\n\tdlgMain.ddFileType.onChange = function() {\n\t\thideAllFileTypePanel();\n\t\tswitch (this.selection.index) {\n\n\t\t\tcase png24Index:\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.text = strPNG24Options;\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.show();\n\t\t\t\tbreak;\n\n\t\t\tcase png8Index:\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.text = strPNG8Options;\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.show();\n\t\t\t\tbreak;\n\n\t\t\tcase jpegIndex:\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.text = strJPEGOptions;\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions.show();\n\t\t\t\tbreak;\n\t\t}\n\t};\n\n\tdlgMain.ddFileType.items[exportInfo.fileType].selected = true;\n\n\t// -- now after all the radio buttons\n\tdlgMain.cbIcc = dlgMain.pnlFileType.add('checkbox', undefined, strCheckboxIncludeICCProfile);\n\tdlgMain.cbIcc.value = exportInfo.icc;\n\tdlgMain.cbIcc.alignment = 'left';\n\n\t// -- now the options panel that changes\n\tdlgMain.pnlFileType.pnlOptions = dlgMain.pnlFileType.add('panel', undefined, 'Options');\n\tdlgMain.pnlFileType.pnlOptions.alignment = 'fill';\n\tdlgMain.pnlFileType.pnlOptions.orientation = 'stack';\n\tdlgMain.pnlFileType.pnlOptions.preferredSize.height = strToIntWithDefault(strpnlOptions, 100);\n\n\t// PNG8 options\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options = dlgMain.pnlFileType.pnlOptions.add('group');\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trans = dlgMain.pnlFileType.pnlOptions.grpPNG8Options.add('checkbox', undefined, strCheckboxPNGTransparency.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Inter = dlgMain.pnlFileType.pnlOptions.grpPNG8Options.add('checkbox', undefined, strCheckboxPNGInterlaced.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trm = dlgMain.pnlFileType.pnlOptions.grpPNG8Options.add('checkbox', undefined, strCheckboxPNGTrm.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trans.value = exportInfo.png8Transparency;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Inter.value = exportInfo.png8Interlaced;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trm.value = exportInfo.png8Trim;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.visible = (exportInfo.fileType == png8Index);\n\n\t// PNG24 options\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options = dlgMain.pnlFileType.pnlOptions.add('group');\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trans = dlgMain.pnlFileType.pnlOptions.grpPNG24Options.add('checkbox', undefined, strCheckboxPNGTransparency.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Inter = dlgMain.pnlFileType.pnlOptions.grpPNG24Options.add('checkbox', undefined, strCheckboxPNGInterlaced.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trm = dlgMain.pnlFileType.pnlOptions.grpPNG24Options.add('checkbox', undefined, strCheckboxPNGTrm.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trans.value = exportInfo.png24Transparency;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Inter.value = exportInfo.png24Interlaced;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trm.value = exportInfo.png24Trim;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.visible = (exportInfo.fileType == png24Index);\n\n\t// JPEG options\n\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions = dlgMain.pnlFileType.pnlOptions.add('group');\n\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions.add('statictext', undefined, strLabelQuality);\n\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions.etQuality = dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.add('edittext', undefined, exportInfo.jpegQuality.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions.etQuality.preferredSize.width = strToIntWithDefault(stretQuality, 30);\n\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions.visible = (exportInfo.fileType == jpegIndex);\n\n\t// the right side of the dialog, the ok and cancel buttons\n\tdlgMain.grpTopRight = dlgMain.grpTop.add('group');\n\tdlgMain.grpTopRight.orientation = 'column';\n\tdlgMain.grpTopRight.alignChildren = 'fill';\n\n\tdlgMain.btnRun = dlgMain.grpTopRight.add('button', undefined, strButtonRun);\n\n\tdlgMain.btnRun.onClick = function() {\n\t\t// add by ray\n\t\tcreateCssImgFolder();\n\t\t// get css unit\n\t\tgetCssUnit();\n\t\tdestination = dlgMain.etDestination.text;\n\t\tif (destination.length == 0) {\n\t\t\talert(strAlertSpecifyDestination);\n\t\t\treturn;\n\t\t}\n\t\ttestFolder = new Folder(destination);\n\t\tif (!testFolder.exists) {\n\t\t\talert(strAlertDestinationNotExist);\n\t\t\treturn;\n\t\t}\n\n\t\tdlgMain.close(runButtonID);\n\t};\n\n\tdlgMain.btnCancel = dlgMain.grpTopRight.add('button', undefined, strButtonCancel);\n\n\tdlgMain.btnCancel.onClick = function() {\n\t\tdlgMain.close(cancelButtonID);\n\t};\n\n\tdlgMain.defaultElement = dlgMain.btnRun;\n\tdlgMain.cancelElement = dlgMain.btnCancel;\n\n\t// the bottom of the dialog\n\tdlgMain.grpBottom = dlgMain.add('group');\n\tdlgMain.grpBottom.orientation = 'column';\n\tdlgMain.grpBottom.alignChildren = 'left';\n\tdlgMain.grpBottom.alignment = 'fill';\n\n\tdlgMain.pnlHelp = dlgMain.grpBottom.add('panel');\n\tdlgMain.pnlHelp.alignment = 'fill';\n\n\tdlgMain.etHelp = dlgMain.pnlHelp.add('statictext', undefined, strHelpText, {\n\t\tmultiline: true\n\t});\n\tdlgMain.etHelp.alignment = 'fill';\n\n\tdlgMain.onShow = function() {\n\t\tdlgMain.ddFileType.onChange();\n\t};\n\n\t// give the hosting app the focus before showing the dialog\n\tapp.bringToFront();\n\n\tdlgMain.center();\n\n\tresult = dlgMain.show();\n\n\tif (cancelButtonID == result) {\n\t\treturn result; // close to quit\n\t}\n\n\t// get setting from dialog\n\texportInfo.destination = dlgMain.etDestination.text;\n\t// kpedt force valid prefix for html\n\tif (!dlgMain.etFileNamePrefix.text.length) {\n\t\texportInfo.fileNamePrefix = 'x';\n\t} else {\n\t\texportInfo.fileNamePrefix = webStr(dlgMain.etFileNamePrefix.text);\n\t}\n\t// kpedt force visible only\n\texportInfo.visibleOnly = true;\n\texportInfo.fileType = dlgMain.ddFileType.selection.index;\n\texportInfo.icc = dlgMain.cbIcc.value;\n\texportInfo.jpegQuality = dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.etQuality.text;\n\n\treturn result;\n}",
"function tempDownloadFolder_onCommand(e)\n{\n\tdoBrowseForFolder(\"temp-download-folder\", \"Temporary download folder\");\n}",
"function srcClick(o) {\n\tswitch (o.innerText) {\n\t\tcase \"Rename\":\n\t\t\tlet input = prompt(\"Enter a new filename\", \"myprog.mtb\");\n\t\t\tif (input === null) {\n\t\t\t\tinput = \"\";\n\t\t\t} else {\n\t\t\t\tinput = input.trim().substr(0,10);\n\t\t\t}\n\n\t\t\tif (input != \"\") {\n\t\t\t\tif (ItemSelection.classList.contains(\"device\")) {\n\t\t\t\t\tinput = ItemSelection.id.slice(-1) + \"- \" + input;\n\t\t\t\t}\n\t\t\t\tItemSelection.innerText = input;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"Delete\":\n\t\t\tconst name = ItemSelection.innerText\n\t\t\tconst idx = getNodeIndex(SourceNode, ItemSelection);\n\t\t\tlet sel = getNodeIndex(SourceNode, SelectedNode);\n\t\t\tif (SourceFiles.length == 1) break;\n\t\t\tif (confirm(\"Are you sure you want to delete \" + name + \"?\")) {\n\t\t\t\tconst isLast = idx == SourceFiles.length -1;\n\t\t\t\tconst newIdx = (isLast) ? idx - 1 : idx + 1;\n\t\t\t\tif (idx == sel) {\n\t\t\t\t\tswitchFiles(SelectedNode, SourceNode.children[newIdx]);\n\t\t\t\t\tSourceFiles = deleteFile(SourceNode, SourceFiles, idx);\n\t\t\t\t\tif (isLast) sel--;\n\t\t\t\t} else if (idx < sel) {\n\t\t\t\t\tSourceFiles = deleteFile(SourceNode, SourceFiles, idx)\n\t\t\t\t\tsel--;\n\t\t\t\t} else {\n\t\t\t\t\tSourceFiles = deleteFile(SourceNode, SourceFiles, idx);\n\t\t\t\t}\n\t\t\t\t\tSelectedNode = SourceNode.children[sel];\n\t\t\t\t\tSelectedNode.classList.add(\"selected\");\n\t\t\t\t\teditor.setSession(SourceFiles[sel]);\n\t\t\t\t\t\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"Upload\":\n\t\t\tdocument.getElementById(\"fileread\").click();\n\t\t\tbreak;\n\t\tcase \"Open\":\n const modal = document.getElementById(\"myModal\");\n const fileModal = document.getElementById(\"file-content\");\n const infoModal = document.getElementById(\"info-content\");\n const fsList = document.getElementById(\"fs-list\");\n const[index, isSource] = findNode(ItemSelection);\n theList = (isSource) ? SourceFSFiles : DataFSFiles;\n fileModal.style.display = \"block\";\n infoModal.style.display = \"none\";\n modal.style.display = \"flex\";\n fsList.innerHTML = \"<ul>\\n\";\n for (item of theList) {\n fsList.innerHTML += \"<li class='fs-item' onclick='loadFile(this)'>\"+item+\"</li>\\n\";\n } \n fsList.innerHTML += \"</ul>\";\n break;\n default:\n break;\n }\n}",
"function browseFilesTab(callBack) {\n //create dialog\n w2popup.open({\n title: 'Select Directory from Files Tab',\n width: 600,\n height: 320,\n showMax: true,\n modal: true,\n body: '<div id=\"gpDialog\"><div id=\"fileTree\" style=\"height: 300px;\"/></div>',\n buttons: '<button class=\"btn\" onclick=\"w2popup.close();\">Cancel</button> <button class=\"btn\" onclick=\"w2popup.close();\">OK</button>',\n onOpen: function (event) {\n event.onComplete = function () {\n $(\"#fileTree\").gpUploadsTree(\n {\n name: \"Uploads_Tab_Tree\"\n });\n };\n },\n onClose: function (event) {\n var selectGpDir = $(\"#fileTree\").gpUploadsTree(\"selectedDir\");\n event.onComplete = function () {\n $(\"#fileTree\").gpUploadsTree(\"destroy\");\n callBack(selectGpDir);\n }\n }\n });\n }",
"function btnRunOnClick() {\r\n // check if the setting is properly\r\n var destination = dlgMain.etDestination.text;\r\n if (destination.length == 0) {\r\n alert(strAlertSpecifyDestination);\r\n return;\r\n }\r\n var testFolder = new Folder(destination);\r\n if (!testFolder.exists) {\r\n alert(strAlertDestinationNotExist);\r\n return;\r\n }\r\n \r\n\t// find the dialog in this auto layout mess\r\n\tvar d = this;\r\n\twhile (d.type != 'dialog') {\r\n\t\td = d.parent;\r\n\t}\r\n\td.close(runButtonID); \r\n}",
"function saveSubmit() {\n\tvar sPath = '';\n\tsPath += document.getElementById('currentRoot').value;\n\tsPath += document.getElementById('currentFolder').value;\n\tif (selectedType == 'file') {\n\t\twindow.opener.filelibraryAction(sPath + selectedFile);\n\t\twindow.close();\n\t}\t\t\n}",
"function selectFolder(elementId)\n{\n var entryid = dhtml.getElementById(elementId).folderentryid;\n var callBackData = new Object;\n callBackData.elementId = elementId;\n dhtml.getElementById(elementId.replace(\"_folder\",\"\")).checked = true;\n webclient.openModalDialog(module, \"selectfolder\", DIALOG_URL+\"task=selectfolder_modal&entryid=\" + entryid, 300, 300, folderCallBack, callBackData);\n}",
"openFileBrowser() {\n dialog.showOpenDialog(\n { properties: [\"openDirectory\"] },\n this.configureProject\n );\n }",
"_browseInputChangeHandler() {\n const that = this,\n selectedFiles = that._filterNewFiles(Array.from(that.$.browseInput.files));\n let validNewFiles = [];\n\n if (that.disabled || selectedFiles.length === 0) {\n return;\n }\n\n if (that.validateFile && typeof that.validateFile === 'function') {\n validNewFiles = selectedFiles.filter(file => {\n if (that.validateFile(file)) {\n return true;\n }\n\n that.$.fireEvent('validationError', {\n 'filename': file.name,\n 'type': file.type,\n 'size': file.size\n });\n\n return false;\n });\n }\n else {\n validNewFiles = selectedFiles;\n }\n\n that._selectedFiles = that._selectedFiles.concat(validNewFiles);\n\n if (that._selectedFiles.length === 0) {\n return;\n }\n\n that._renderSelectedFiles(validNewFiles);\n that.$.browseButton.disabled = (!that.multiple && that._selectedFiles.length > 0) || that.disabled ? true : false;\n that.$.browseInput.value = '';\n\n if (that.autoUpload) {\n that.uploadAll();\n }\n }",
"function file_dialog_navigate_to(parameter_fqname, current_folder, folder) {\n \"use strict\";\n $.get(\"open-file-dialog/\" + parameter_fqname, {current_folder: current_folder, folder: folder}, function (html) {\n $(\"#cea-file-dialog .modal-content\").html(html);\n });\n}",
"function showSelect(filename, folder){\n\tvar url = TP_APP + '/Resume/show/filename/' + filename + '/folder/' + encodeURIComponent(folder);\n\t$.pdialog.open(url, 'resumeDB', '还原数据库', {minable:true,width:500,height:400,mask:true,resizable:false});\n}",
"function browseFile (tableName, fieldName, directory, extensions, suffix) {\r\n\tif (!extensions)\r\n\t\textensions = \"\";\r\n\tif (!directory)\r\n\t\tdirectory = \"\";\r\n\r\n\tif (!suffix)\r\n\t\tsuffix = \"\";\r\n\r\n\topenInnerWindow(\"file_browse_window\", \"schema/select_file.php\", 800, \"\", \"Select File\", \"table_name=\" + tableName +\"&field_name=\" + fieldName + \"&directory=\" + directory + \"&extensions=\" + extensions + \"&suffix=\" + suffix, \"\", \"\", 1);\r\n}",
"function onClickBtnFileBrowserOnUsernameExists()\n{\n var fileName = browseForFileURL(); //returns a local filename\n if (fileName)\n {\n EDIT_GOTOURLONUSERNAMEEXISTS.value = fileName;\n }\n}",
"newFileButtonClickCallback() {\n if(document.getElementsByClassName('selected')[0] !== undefined) {\n let el = document.getElementById(this.selectionList[this.selectionList.length - 1]);\n fs.lstat(el.id, (err, stat) => {\n if(err) throw err;\n if(stat && stat.isDirectory()) {\n this.nameInputFunc(el.parentElement, `calc(${el.style.paddingLeft} + 0.5cm)`, (nameInput) => {\n fs.writeFile(path.join(el.id, nameInput.value), \"\", (err) => {\n if(err) {\n try {nameInput.remove()} catch(err) {};\n }\n else {\n try {nameInput.remove()} catch(err) {};\n this.refreshDirectory(el.id, el.parentElement);\n }\n });\n });\n }\n else if(stat && stat.isFile()) {\n let elFolder = document.getElementById(path.dirname(el.id));\n let anchorNode = null;\n if(elFolder === null) {\n anchorNode = this.fatherNode;\n }\n else {\n anchorNode = elFolder.parentElement;\n }\n this.nameInputFunc(anchorNode, el.style.paddingLeft, (nameInput) => {\n fs.writeFile(path.join(path.dirname(el.id), nameInput.value), \"\", (err) => {\n if(err) {\n alert(err);\n try {nameInput.remove()} catch(err) {};\n }\n else {\n try {nameInput.remove()} catch(err) {};\n this.refreshDirectory(path.dirname(el.id), anchorNode)\n }\n });\n })\n }\n })\n }\n else {\n this.nameInputFunc(this.fatherNode, '0.5cm', (nameInput) => {\n fs.writeFile(path.join(this.processCWD, nameInput.value), \"\", (err) => {\n if(err) {\n alert(err);\n try {nameInput.remove()} catch(err) {};\n }\n else {\n try {nameInput.remove()} catch(err) {};\n this.refreshDirectory(this.processCWD, this.fatherNode);\n }\n })\n })\n }\n while(this.selectionList.length > 0) {\n document.getElementById(this.selectionList.pop()).classList.remove('selected');\n }\n }",
"function doBrowseFiles()\n{\n var srbundle = srGetStrBundle(\"chrome://pippki/locale/pippki.properties\");\n var fp = Components.classes[nsFilePicker].createInstance(nsIFilePicker);\n fp.init(window,\n srbundle.GetStringFromName(\"loadPK11TokenDialog\"),\n nsIFilePicker.modeOpen);\n fp.appendFilters(nsIFilePicker.filterAll);\n if (fp.show() == nsIFilePicker.returnOK) {\n var pathbox = document.getElementById(\"device_path\");\n pathbox.setAttribute(\"value\", fp.file.path);\n }\n}",
"function saveFileDialog(contents, extension, defaultFileName, callBack)\n {\n if(defaultFileName === undefined || defaultFileName === null)\n {\n defaultFileName = \"\";\n }\n\n //create dialog\n w2popup.open({\n title: 'Save File',\n width: 450,\n height: 380,\n showMax: true,\n modal: true,\n body: '<div id=\"gpDialog\" style=\"margin: 14px 15px 2px 15px;\"><label>File name: <input type=\"text\" value=\"' + defaultFileName + '\"id=\"fileName\" style=\"width: 250px;\"/>' +\n '</label><div style=\"margin: 8px 8px 8px 2px;\"><input name=\"saveMethod\" value=\"gp\" type=\"radio\" checked=\"checked\" style=\"margin-right: 5px\"/>Save To GenePattern' +\n '<input name=\"saveMethod\" type=\"radio\" value=\"download\"/>Download</div>' +\n '<div id=\"gpSave\">Select save location:<br/><div id=\"fileTree\" style=\"height: 200px;border:2px solid white\"/></div> </div>',\n buttons: '<button id=\"cancelSaveToGPBtn\" class=\"btn\" onclick=\"w2popup.close();\">Cancel</button> ' +\n '<button id=\"saveToGPBtn\" class=\"btn\" disabled=\"disabled\">OK</button>',\n onOpen: function (event) {\n event.onComplete = function () {\n $(\"input[name='saveMethod']\").click(function()\n {\n var checkedValue = $(this).filter(':checked').val();\n if(checkedValue == \"gp\")\n {\n $(\"#gpSave\").show();\n $(\"#saveToGPBtn\").prop( \"disabled\", true );\n }\n else\n {\n $(\"#saveToGPBtn\").prop( \"disabled\", false );\n\n $(\"#gpSave\").hide();\n }\n });\n\n $(\"#fileTree\").gpUploadsTree(\n {\n name: \"Uploads_Tab_Tree\",\n onChange: function(directory)\n {\n //enable the OK button if a directory was selected\n if(directory != undefined && directory.url.length > 0)\n {\n $(\"#saveToGPBtn\").prop( \"disabled\", false );\n }\n }\n });\n };\n }\n });\n\n $(\"#saveToGPBtn\").click(function(event)\n {\n var selectedGpDirObj = $(\"#fileTree\").gpUploadsTree(\"selectedDir\");\n var saveMethod = $(\"input[name='saveMethod']:checked\").val();\n var fileName = $(\"#fileName\").val();\n\n if(extension != undefined && !gpUtil.endsWith(fileName, extension))\n {\n fileName += extension;\n }\n var result = \"success\";\n $(\"#fileTree\").gpUploadsTree(\"destroy\");\n\n //save the file either to GenePattern or locally\n if(saveMethod == \"gp\")\n {\n var text = [];\n text.push(contents);\n\n var saveLocation = selectedGpDirObj.url + fileName;\n console.log(\"save location: \" + saveLocation);\n uploadDataToFilesTab(saveLocation, text, function(result)\n {\n if(result !== \"success\")\n {\n w2alert(\"Error saving file. \" + result, 'File Save Error');\n }\n else\n {\n w2alert(\"File \" + fileName + \" saved.\", 'File Save' );\n }\n });\n }\n else\n {\n downloadFile(fileName, contents);\n }\n\n if($.isFunction(callBack))\n {\n callBack(result);\n }\n\n w2popup.close();\n });\n }"
]
| [
"0.80689317",
"0.71014553",
"0.69558316",
"0.6892214",
"0.6866621",
"0.6721307",
"0.6530963",
"0.6507591",
"0.65049386",
"0.64399964",
"0.6425381",
"0.64203185",
"0.64085335",
"0.64076823",
"0.6369404",
"0.63565904",
"0.63387996",
"0.6298164",
"0.6255021",
"0.6253249",
"0.6089607",
"0.59989667",
"0.59867126",
"0.59709203",
"0.59661347",
"0.5952708",
"0.5936889",
"0.5902122",
"0.58841",
"0.5858875"
]
| 0.84480196 | 0 |
Function: ExportInfo Usage: object for holding the dialog parameters Input: Return: object holding the export info | function ExportInfo() {
this.destination = new String("");
this.selectionOnly = false;
this.style = new String(strStyle);
try {
this.destination = Folder(app.activeDocument.fullName.parent).fsName;
}
catch(someError) {
// do nothing, stop error propagation only
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function ui_settingsDialog(exportInfo) {\n\n\t// Configure the dialog\n\tvar res = String(\" \\\n\t\tdialog { \\\n\t\t\ttext: '\"+strTitle+\"', \\\n\t\t\torientation: 'column', \\\n\t\t\talignChildren: 'left', \\\n\t\t\tgrpDestination: Group { \\\n\t\t\t\tlabel: StaticText { text: '\"+ escapeString(strLabelDestination) +\"', preferredSize: [ 140, 15 ] }, \\\n\t\t\t\tfield: EditText { text: '\"+ escapeString(exportInfo.destination) +\"', preferredSize: [ 300, 21 ] }, \\\n\t\t\t\tbtnBrowse: Button { text: '\"+ escapeString(strButtonBrowse) +\"', preferredSize: [ 80, 23 ] } \\\n\t\t\t}, \\\n\t\t\tgrpFilenameTemplate: Group { \\\n\t\t\t\tlabel: StaticText { text: '\"+ strLabelFilenameTemplate +\"', preferredSize: [ 140, 15 ] }, \\\n\t\t\t\tfield: EditText { text: '\"+ escapeString(exportInfo.filenameTemplate) +\"', preferredSize: [ 300, 21 ] }, \\\n\t\t\t\tbtnHelp: Button { text: '\"+ escapeString(strButtonHelp) +\"', preferredSize: [ 80, 23 ] } \\\n\t\t\t}, \\\n\t\t\tgrpFilenamePreview: Group { \\\n\t\t\t\tlabel: StaticText { text: '\"+ strLabelFilenamePreview +\"', preferredSize: [ 140, 15 ] }, \\\n\t\t\t\tfield: StaticText { text: 'qwe asdf asdf asdf asd', preferredSize: [ 390, 15 ] }, \\\n\t\t\t}, \\\n\t\t\tgrpOperationMode: Group { \\\n\t\t\t\tlabel: StaticText { text: '\"+ strLabelMode +\"', preferredSize: [ 140, 15 ] }, \\\n\t\t\t\tfield: DropDownList { preferredSize: [ 390, 25 ] }, \\\n\t\t\t}, \\\n\t\t\tgrpOptions: Group { \\\n\t\t\t\tlabel: StaticText { text: '', preferredSize: [ 140, 15 ] }, \\\n\t\t\t\tfieldExportSelected: Checkbox { text: '\"+ strLabelExportSelected +\"', value: \"+ exportInfo.exportSelected +\" }, \\\n\t\t\t\tfieldTrim: Checkbox { text: '\"+ strLabelTrim +\"', value: \"+ exportInfo.trim +\" }, \\\n\t\t\t}, \\\n\t\t\tpnlWrapper: Panel { \\\n\t\t\t\ttext: '\"+ escapeString(strLabelWrapper) +\"', \\\n\t\t\t\talignment: 'fill', \\\n\t\t\t\talignChildren: 'left', \\\n\t\t\t\tmargins: [ 20, 20, 20, 20], \\\n\t\t\t\tgrpWrapperMode: Group { \\\n\t\t\t\t\tlabel: StaticText { text: '\"+ escapeString(strLabelWrapperMode) +\"', preferredSize: [ 120, 15 ] }, \\\n\t\t\t\t\tfield: DropDownList { preferredSize: [ 370, 25 ] }, \\\n\t\t\t\t}, \\\n\t\t\t\tgrpWindowTitle: Group { \\\n\t\t\t\t\tlabel: StaticText { text: '\"+ escapeString(strWindowTitle) +\"', preferredSize: [ 120, 15 ] }, \\\n\t\t\t\t\tfield: EditText { text: '\"+ escapeString(exportInfo.Wrapper.windowTitle) +\"', preferredSize: [ 370, 21 ] }, \\\n\t\t\t\t}, \\\n\t\t\t\tgrpWindowURL: Group { \\\n\t\t\t\t\tlabel: StaticText { text: '\"+ escapeString(strWindowURL) +\"', preferredSize: [ 120, 15 ] }, \\\n\t\t\t\t\tfield: EditText { text: '\"+ escapeString(exportInfo.Wrapper.windowURL) +\"', preferredSize: [ 370, 21 ] }, \\\n\t\t\t\t}, \\\n\t\t\t\tgrpBackgroundColor: Group { \\\n\t\t\t\t\tlabel: StaticText { text: '\"+ escapeString(strBackgroundColor) +\"', preferredSize: [ 120, 15 ] }, \\\n\t\t\t\t\tfield: EditText { text: '\"+ escapeString(exportInfo.Wrapper.backgroundColor) +\"', preferredSize: [ 370, 21 ] }, \\\n\t\t\t\t}, \\\n\t\t\t}, \\\n\t\t\tpnlExportSettings: Panel { \\\n\t\t\t\ttext: '\"+ escapeString(strExportSettings) +\"', \\\n\t\t\t\talignment: 'fill', \\\n\t\t\t\talignChildren: 'left', \\\n\t\t\t\tmargins: [ 20, 20, 20, 10], \\\n\t\t\t\tgrpFileType: Group { \\\n\t\t\t\t\tlabel: StaticText { text: '\"+ escapeString(strFileType) +\"', preferredSize: [ 120, 15 ] }, \\\n\t\t\t\t\tfield: DropDownList { preferredSize: [ 100, 25 ] }, \\\n\t\t\t\t}, \\\n\t\t\t\tgrpIncludeICCProfile: Group { \\\n\t\t\t\t\tlabel: StaticText { text: '\"+ escapeString(strIncludeICCProfile) +\"', preferredSize: [ 120, 15 ] }, \\\n\t\t\t\t\tfield: Checkbox { text: '', value: \"+ exportInfo.icc +\" }, \\\n\t\t\t\t}, \\\n\t\t\t\tgrpOptions: Group { \\\n\t\t\t\t\tvisible: false, \\\n\t\t\t\t\torientation: 'stack', \\\n\t\t\t\t\tgrpJPGOptions: Group { \\\n\t\t\t\t\t\tvisible: false, \\\n\t\t\t\t\t}, \\\n\t\t\t\t\tgrpPNGOptions: Group { \\\n\t\t\t\t\t\tvisible: false, \\\n\t\t\t\t\t}, \\\n\t\t\t\t\tgrpPSDOptions: Group { \\\n\t\t\t\t\t\tvisible: false, \\\n\t\t\t\t\t}, \\\n\t\t\t\t\tgrpTIFFOptions: Group { \\\n\t\t\t\t\t\tvisible: false, \\\n\t\t\t\t\t}, \\\n\t\t\t\t}, \\\n\t\t\t}, \\\n\t\t\tgrpButtons: Group { \\\n\t\t\t\torientation: 'stack', \\\n\t\t\t\talignment: 'fill', \\\n\t\t\t\tgrpLeft: Group { \\\n\t\t\t\t\talignment: 'left', \\\n\t\t\t\t\tbtnDocumentation: Button { text: '\"+ escapeString(strButtonDocumentation) +\"', alignment: 'left' }, \\\n\t\t\t\t}, \\\n\t\t\t\tgrpRight: Group { \\\n\t\t\t\t\talignment: 'right', \\\n\t\t\t\t\tbtnRun: Button { text: '\"+ escapeString(strButtonRun) +\"', alignment: 'right', properties: { name:'ok' } }, \\\n\t\t\t\t\tbtnSave: Button { text: '\"+ escapeString(strButtonSave) +\"', alignment: 'right' }, \\\n\t\t\t\t\tbtnCancel: Button { text: '\"+ escapeString(strButtonCancel) +\"', alignment: 'right', properties: { name:'cancel' } }, \\\n\t\t\t\t}, \\\n\t\t\t}, \\\n\t\t} \\\n\t\").replace(/^\\s+/, '');\n\n\tdlgMain = new Window(res);\n\n\t// Adding operation modes\n\tvar operationModeDropdown = dlgMain.grpOperationMode.field;\n\tfor (var i = 0; i < operationModesOrder.length; i++ ) {\n\t\tvar num = operationModesOrder[i];\n\t\tvar item = operationModeDropdown.add( \"item\", operationModes[num] );\n\t\tif ( exportInfo.operationMode == num ) item.selected = true;\n\t}\n\n\t// Adding Wrapper Modes\n\tvar dropdown = dlgMain.pnlWrapper.grpWrapperMode.field;\n\tfor (var i = 0; i < wrapperModes.length; i++ ) {\n\t\tvar item = dropdown.add( \"item\", wrapperModes[i] );\n\t\tif ( exportInfo.Wrapper.mode == i ) item.selected = true;\n\t}\n\n\t// File types selector\n\tvar selectedIndex;\n\tvar selectedFileType;\n\tvar FileTypeDropDown = dlgMain.pnlExportSettings.grpFileType.field;\n\tfor (var i = 0; i < fileTypes.length; i++ ) {\n\t\tvar item = FileTypeDropDown.add( \"item\", fileTypes[i] );\n\t\tif ( exportInfo.fileType == i ) item.selected = true;\n\t}\n\tFileTypeDropDown.onChange = onFileTypeChange;\n\tonFileTypeChange();\n\n\t// Update filename template preview\n\tdlgMain.grpFilenameTemplate.field.onChanging = onFilenameTemplateChange;\n\tonFilenameTemplateChange();\n\n\t// Buttuns Events\n\tdlgMain.grpFilenameTemplate.btnHelp.onClick = onHelpButtonPress;\n\tdlgMain.grpDestination.btnBrowse.onClick = onBrowseButtonPress;\n\tdlgMain.grpButtons.grpRight.btnRun.onClick = onRunButtonPress;\n\tdlgMain.grpButtons.grpRight.btnSave.onClick = onSaveButtonPress;\n\tdlgMain.grpButtons.grpRight.btnCancel.onClick = onCancelButtonPress;\n\tdlgMain.grpButtons.grpLeft.btnDocumentation.onClick = onDocumentationButtonPress;\n\n\t// Open Window\n\tapp.bringToFront();\n\n\tdlgMain.center();\n\n\tvar result = dlgMain.show();\n\tif (cancelButtonID == result) {\n\t\treturn result;\n\t}\n\n\tLog.notice(\"Sending positive response from the dialog\");\n\n\t// Get settings from dialog\n exportInfo.destination = dlgMain.grpDestination.field.text;\n exportInfo.filenameTemplate = dlgMain.grpFilenameTemplate.field.text;\n exportInfo.operationMode = operationModesOrder[dlgMain.grpOperationMode.field.selection.index];\n exportInfo.exportSelected = dlgMain.grpOptions.fieldExportSelected.value;\n exportInfo.trim = dlgMain.grpOptions.fieldTrim.value;\n\n exportInfo.Wrapper.mode = dlgMain.pnlWrapper.grpWrapperMode.field.selection.index;\n exportInfo.Wrapper.windowTitle = dlgMain.pnlWrapper.grpWindowTitle.field.text;\n exportInfo.Wrapper.windowURL = dlgMain.pnlWrapper.grpWindowURL.field.text;\n exportInfo.Wrapper.backgroundColor = dlgMain.pnlWrapper.grpBackgroundColor.field.text;\n\n // Backwards comptibility\n // exportInfo.safariWrap = dlgMain.pnlWrapper.grpEnable.field.value;\n // exportInfo.safariWrap_windowTitle = dlgMain.pnlWrapper.grpWindowTitle.field.text;\n // exportInfo.safariWrap_windowURL = dlgMain.pnlWrapper.grpWindowURL.field.text;\n // exportInfo.safariWrap_backgroundColor = dlgMain.pnlWrapper.grpBackgroundColor.field.text;\n\n exportInfo.fileType = dlgMain.pnlExportSettings.grpFileType.field.selection.index;\n exportInfo.icc = dlgMain.pnlExportSettings.grpIncludeICCProfile.field.value;\n\n\treturn result;\n\n}",
"function settingDialog(exportInfo) {\r\n\r\n dlgMain = new Window(\"dialog\", strTitle);\r\n\r\n\tdlgMain.orientation = 'column';\r\n\tdlgMain.alignChildren = 'left';\r\n\t\r\n\t// -- top of the dialog, first line\r\n dlgMain.add(\"statictext\", undefined, strLabelDestination);\r\n\r\n\t// -- two groups, one for left and one for right ok, cancel\r\n\tdlgMain.grpTop = dlgMain.add(\"group\");\r\n\tdlgMain.grpTop.orientation = 'row';\r\n\tdlgMain.grpTop.alignChildren = 'top';\r\n\tdlgMain.grpTop.alignment = 'fill';\r\n\r\n\t// -- group contains four lines\r\n\tdlgMain.grpTopLeft = dlgMain.grpTop.add(\"group\");\r\n\tdlgMain.grpTopLeft.orientation = 'column';\r\n\tdlgMain.grpTopLeft.alignChildren = 'left';\r\n\tdlgMain.grpTopLeft.alignment = 'fill';\r\n\t\r\n\t// -- the second line in the dialog\r\n\tdlgMain.grpSecondLine = dlgMain.grpTopLeft.add(\"group\");\r\n\tdlgMain.grpSecondLine.orientation = 'row';\r\n\tdlgMain.grpSecondLine.alignChildren = 'center';\r\n\r\n dlgMain.etDestination = dlgMain.grpSecondLine.add(\"edittext\", undefined, exportInfo.destination.toString());\r\n dlgMain.etDestination.preferredSize.width = StrToIntWithDefault( stretDestination, 160 );\r\n\r\n dlgMain.btnBrowse= dlgMain.grpSecondLine.add(\"button\", undefined, strButtonBrowse);\r\n dlgMain.btnBrowse.onClick = btnBrowseOnClick;\r\n\r\n // -- the third line in the dialog\r\n dlgMain.grpThirdLine = dlgMain.grpTopLeft.add(\"statictext\", undefined, strLabelStyle);\r\n\r\n // -- the fourth line in the dialog\r\n dlgMain.etStyle = dlgMain.grpTopLeft.add(\"edittext\", undefined, exportInfo.style.toString());\r\n dlgMain.etStyle.alignment = 'fill';\r\n dlgMain.etStyle.preferredSize.width = StrToIntWithDefault( stretDestination, 160 );\r\n\r\n\t// -- the fifth line in the dialog\r\n dlgMain.cbSelection = dlgMain.grpTopLeft.add(\"checkbox\", undefined, strCheckboxSelectionOnly);\r\n dlgMain.cbSelection.value = exportInfo.selectionOnly;\r\n\r\n\t// the right side of the dialog, the ok and cancel buttons\r\n\tdlgMain.grpTopRight = dlgMain.grpTop.add(\"group\");\r\n\tdlgMain.grpTopRight.orientation = 'column';\r\n\tdlgMain.grpTopRight.alignChildren = 'fill';\r\n\t\r\n\tdlgMain.btnRun = dlgMain.grpTopRight.add(\"button\", undefined, strButtonRun );\r\n dlgMain.btnRun.onClick = btnRunOnClick;\r\n\r\n\tdlgMain.btnCancel = dlgMain.grpTopRight.add(\"button\", undefined, strButtonCancel );\r\n dlgMain.btnCancel.onClick = function() { \r\n\t\tvar d = this;\r\n\t\twhile (d.type != 'dialog') {\r\n\t\t\td = d.parent;\r\n\t\t}\r\n\t\td.close(cancelButtonID); \r\n\t}\r\n\r\n\tdlgMain.defaultElement = dlgMain.btnRun;\r\n\tdlgMain.cancelElement = dlgMain.btnCancel;\r\n\r\n\tdlgMain.grpBottom = dlgMain.add(\"group\");\r\n\tdlgMain.grpBottom.orientation = 'column';\r\n\tdlgMain.grpBottom.alignChildren = 'left';\r\n\tdlgMain.grpBottom.alignment = 'fill';\r\n \r\n dlgMain.pnlHelp = dlgMain.grpBottom.add(\"panel\");\r\n dlgMain.pnlHelp.alignment = 'fill';\r\n\r\n dlgMain.etHelp = dlgMain.pnlHelp.add(\"statictext\", undefined, strHelpText, {multiline:true});\r\n dlgMain.etHelp.alignment = 'fill';\r\n\r\n // in case we double clicked the file\r\n app.bringToFront();\r\n\r\n dlgMain.center();\r\n \r\n var result = dlgMain.show();\r\n \r\n if (cancelButtonID == result) {\r\n return result;\r\n }\r\n \r\n // get setting from dialog\r\n exportInfo.destination = dlgMain.etDestination.text;\r\n exportInfo.style = dlgMain.etStyle.text;\r\n exportInfo.selectionOnly = dlgMain.cbSelection.value;\r\n\r\n return result;\r\n}",
"function showExport() {\n $(\"#export-dialog\").show();\n buildSelectApiTree(\"#export-dialog\",gdata.apiList,\"collapsed\")\n $(\"#export-dialog .filename\").focus();\n}",
"function initExportInfo(exportInfo) { //初始化导出信息\n\n\tvar tmp;\n\n\texportInfo.destination = '';\n\texportInfo.fileNamePrefix = 'export-';\n\texportInfo.visibleOnly = false;\n\texportInfo.fileType = png24Index;\n\texportInfo.icc = true;\n\texportInfo.jpegQuality = 8;\n\texportInfo.psdMaxComp = true;\n\texportInfo.png24Transparency = true;\n\texportInfo.png24Interlaced = false;\n\texportInfo.png24Trim = true;\n\texportInfo.png8Transparency = true;\n\texportInfo.png8Interlaced = false;\n\texportInfo.png8Trim = true;\n\n\ttry {\n\t\texportInfo.destination = new Folder(app.activeDocument.fullName.parent).fsName; // destination folder //目标目录\n\t\ttmp = app.activeDocument.fullName.name;\n\t\texportInfo.fileNamePrefix = decodeURI(tmp.substring(0, tmp.indexOf('.'))); // filename body part 文件名称\n\t} catch (someError) {\n\t\texportInfo.destination = '';\n\t\texportInfo.fileNamePrefix = app.activeDocument.name; // filename body part\n\t}\n}",
"function settingDialog(exportInfo) { //设置对话框\n\n\tvar brush,\n\t\tdestination,\n\t\tresult,\n\t\ttestFolder;\n\n\tdlgMain = new Window('dialog', strTitle);\n\n\t// match our dialog background color to the host application\n\tbrush = dlgMain.graphics.newBrush(dlgMain.graphics.BrushType.THEME_COLOR, 'appDialogBackground');\n\tdlgMain.graphics.backgroundColor = brush;\n\tdlgMain.graphics.disabledBackgroundColor = dlgMain.graphics.backgroundColor;\n\n\tdlgMain.orientation = 'column';\n\tdlgMain.alignChildren = 'left';\n\n\t// -- top of the dialog, first line\n\tdlgMain.add('statictext', undefined, strLabelDestination);\n\n\t// -- two groups, one for left and one for right ok, cancel\n\tdlgMain.grpTop = dlgMain.add('group');\n\tdlgMain.grpTop.orientation = 'row';\n\tdlgMain.grpTop.alignChildren = 'top';\n\tdlgMain.grpTop.alignment = 'fill';\n\n\t// -- group top left\n\tdlgMain.grpTopLeft = dlgMain.grpTop.add('group');\n\tdlgMain.grpTopLeft.orientation = 'column';\n\tdlgMain.grpTopLeft.alignChildren = 'left';\n\tdlgMain.grpTopLeft.alignment = 'fill';\n\n\t// -- the second line in the dialog\n\tdlgMain.grpSecondLine = dlgMain.grpTopLeft.add('group');\n\tdlgMain.grpSecondLine.orientation = 'row';\n\n\tdlgMain.etDestination = dlgMain.grpSecondLine.add('edittext', undefined, exportInfo.destination.toString());\n\n\tdlgMain.etDestination.alignment = 'fill';\n\tdlgMain.etDestination.preferredSize.width = strToIntWithDefault(stretDestination, 160);\n\n\tdlgMain.btnBrowse = dlgMain.grpSecondLine.add('button', undefined, strButtonBrowse);\n\n\tdlgMain.btnBrowse.alignment = 'right';\n\n\tdlgMain.btnBrowse.onClick = function() {\n\t\tvar defaultFolder = dlgMain.etDestination.text;\n\t\ttestFolder = new Folder(dlgMain.etDestination.text);\n\t\tif (!testFolder.exists) {\n\t\t\tdefaultFolder = '~';\n\t\t}\n\t\tvar selFolder = Folder.selectDialog(strTitleSelectDestination, defaultFolder);\n\t\tif (selFolder != null) {\n\t\t\tdlgMain.etDestination.text = selFolder.fsName;\n\t\t}\n\t\tdlgMain.defaultElement.active = true;\n\t};\n\n\t// -- the third line in the dialog\n\tdlgMain.grpTopLeft.add('statictext', undefined, strLabelFileNamePrefix);\n\n\n\n\t// -- the fourth line in the dialog\n\tdlgMain.etFileNamePrefix = dlgMain.grpTopLeft.add('edittext', undefined, exportInfo.fileNamePrefix.toString());\n\tdlgMain.etFileNamePrefix.alignment = 'fill';\n\tdlgMain.etFileNamePrefix.preferredSize.width = strToIntWithDefault(stretDestination, 160);\n\n\t// start\n\t// dlgMain.grpTopLeft.add('statictext', undefined, strLabelCssUnit);\n\n\tdlgMain.cssUnitPanel = dlgMain.grpTopLeft.add('panel', undefined, strLabelCssUnit);\n\tdlgMain.cssUnitPanel.group = dlgMain.cssUnitPanel.add('group');\n\tdlgMain.cssUnitPanel.group.orientation = 'row';\n\tdlgMain.cssUnitPanel.group.alignChildren = 'left';\n\tdlgMain.cssUnitPanel.group.alignment = 'fill';\n\n\tdlgMain.cssUnitPanel.alignment = 'fill';\n\n\tdlgMain.cssUnitPx = dlgMain.cssUnitPanel.group.add('RadioButton', undefined, '');\n\tdlgMain.cssUnitPx.text = '相对单位(rem)';\n\tdlgMain.cssUnitPx.data = 'rem';\n\tdlgMain.cssUnitPx.value = true;\n\n\tdlgMain.cssUnitPx = dlgMain.cssUnitPanel.group.add('RadioButton', undefined, '');\n\tdlgMain.cssUnitPx.text = '像素(px)';\n\tdlgMain.cssUnitPx.data = 'px';\n\n\tdlgMain.cssUnitPer = dlgMain.cssUnitPanel.group.add('RadioButton', undefined, '');\n\tdlgMain.cssUnitPer.text = '百分比(%)';\n\tdlgMain.cssUnitPer.data = '%';\n\n\t// option has been removed, force export visible only\n\n\n\t// -- the fifth line in the dialog\n\tdlgMain.grpTopLeft.add('statictext', undefined, strCheckboxVisibleOnly);\n\n\n\t// -- the sixth line is the panel\n\tdlgMain.pnlFileType = dlgMain.grpTopLeft.add('panel', undefined, strLabelFileType);\n\tdlgMain.pnlFileType.alignment = 'fill';\n\n\t// -- now a dropdown list\n\tdlgMain.ddFileType = dlgMain.pnlFileType.add('dropdownlist');\n\tdlgMain.ddFileType.preferredSize.width = strToIntWithDefault(strddFileType, 100);\n\tdlgMain.ddFileType.alignment = 'left';\n\n\t// file types in the dropdown\n\tdlgMain.ddFileType.add('item', 'PNG-24');\n\tdlgMain.ddFileType.add('item', 'PNG-8');\n\tdlgMain.ddFileType.add('item', 'JPEG');\n\n\tdlgMain.ddFileType.onChange = function() {\n\t\thideAllFileTypePanel();\n\t\tswitch (this.selection.index) {\n\n\t\t\tcase png24Index:\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.text = strPNG24Options;\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.show();\n\t\t\t\tbreak;\n\n\t\t\tcase png8Index:\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.text = strPNG8Options;\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.show();\n\t\t\t\tbreak;\n\n\t\t\tcase jpegIndex:\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.text = strJPEGOptions;\n\t\t\t\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions.show();\n\t\t\t\tbreak;\n\t\t}\n\t};\n\n\tdlgMain.ddFileType.items[exportInfo.fileType].selected = true;\n\n\t// -- now after all the radio buttons\n\tdlgMain.cbIcc = dlgMain.pnlFileType.add('checkbox', undefined, strCheckboxIncludeICCProfile);\n\tdlgMain.cbIcc.value = exportInfo.icc;\n\tdlgMain.cbIcc.alignment = 'left';\n\n\t// -- now the options panel that changes\n\tdlgMain.pnlFileType.pnlOptions = dlgMain.pnlFileType.add('panel', undefined, 'Options');\n\tdlgMain.pnlFileType.pnlOptions.alignment = 'fill';\n\tdlgMain.pnlFileType.pnlOptions.orientation = 'stack';\n\tdlgMain.pnlFileType.pnlOptions.preferredSize.height = strToIntWithDefault(strpnlOptions, 100);\n\n\t// PNG8 options\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options = dlgMain.pnlFileType.pnlOptions.add('group');\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trans = dlgMain.pnlFileType.pnlOptions.grpPNG8Options.add('checkbox', undefined, strCheckboxPNGTransparency.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Inter = dlgMain.pnlFileType.pnlOptions.grpPNG8Options.add('checkbox', undefined, strCheckboxPNGInterlaced.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trm = dlgMain.pnlFileType.pnlOptions.grpPNG8Options.add('checkbox', undefined, strCheckboxPNGTrm.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trans.value = exportInfo.png8Transparency;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Inter.value = exportInfo.png8Interlaced;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trm.value = exportInfo.png8Trim;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG8Options.visible = (exportInfo.fileType == png8Index);\n\n\t// PNG24 options\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options = dlgMain.pnlFileType.pnlOptions.add('group');\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trans = dlgMain.pnlFileType.pnlOptions.grpPNG24Options.add('checkbox', undefined, strCheckboxPNGTransparency.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Inter = dlgMain.pnlFileType.pnlOptions.grpPNG24Options.add('checkbox', undefined, strCheckboxPNGInterlaced.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trm = dlgMain.pnlFileType.pnlOptions.grpPNG24Options.add('checkbox', undefined, strCheckboxPNGTrm.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trans.value = exportInfo.png24Transparency;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Inter.value = exportInfo.png24Interlaced;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trm.value = exportInfo.png24Trim;\n\tdlgMain.pnlFileType.pnlOptions.grpPNG24Options.visible = (exportInfo.fileType == png24Index);\n\n\t// JPEG options\n\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions = dlgMain.pnlFileType.pnlOptions.add('group');\n\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions.add('statictext', undefined, strLabelQuality);\n\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions.etQuality = dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.add('edittext', undefined, exportInfo.jpegQuality.toString());\n\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions.etQuality.preferredSize.width = strToIntWithDefault(stretQuality, 30);\n\tdlgMain.pnlFileType.pnlOptions.grpJPEGOptions.visible = (exportInfo.fileType == jpegIndex);\n\n\t// the right side of the dialog, the ok and cancel buttons\n\tdlgMain.grpTopRight = dlgMain.grpTop.add('group');\n\tdlgMain.grpTopRight.orientation = 'column';\n\tdlgMain.grpTopRight.alignChildren = 'fill';\n\n\tdlgMain.btnRun = dlgMain.grpTopRight.add('button', undefined, strButtonRun);\n\n\tdlgMain.btnRun.onClick = function() {\n\t\t// add by ray\n\t\tcreateCssImgFolder();\n\t\t// get css unit\n\t\tgetCssUnit();\n\t\tdestination = dlgMain.etDestination.text;\n\t\tif (destination.length == 0) {\n\t\t\talert(strAlertSpecifyDestination);\n\t\t\treturn;\n\t\t}\n\t\ttestFolder = new Folder(destination);\n\t\tif (!testFolder.exists) {\n\t\t\talert(strAlertDestinationNotExist);\n\t\t\treturn;\n\t\t}\n\n\t\tdlgMain.close(runButtonID);\n\t};\n\n\tdlgMain.btnCancel = dlgMain.grpTopRight.add('button', undefined, strButtonCancel);\n\n\tdlgMain.btnCancel.onClick = function() {\n\t\tdlgMain.close(cancelButtonID);\n\t};\n\n\tdlgMain.defaultElement = dlgMain.btnRun;\n\tdlgMain.cancelElement = dlgMain.btnCancel;\n\n\t// the bottom of the dialog\n\tdlgMain.grpBottom = dlgMain.add('group');\n\tdlgMain.grpBottom.orientation = 'column';\n\tdlgMain.grpBottom.alignChildren = 'left';\n\tdlgMain.grpBottom.alignment = 'fill';\n\n\tdlgMain.pnlHelp = dlgMain.grpBottom.add('panel');\n\tdlgMain.pnlHelp.alignment = 'fill';\n\n\tdlgMain.etHelp = dlgMain.pnlHelp.add('statictext', undefined, strHelpText, {\n\t\tmultiline: true\n\t});\n\tdlgMain.etHelp.alignment = 'fill';\n\n\tdlgMain.onShow = function() {\n\t\tdlgMain.ddFileType.onChange();\n\t};\n\n\t// give the hosting app the focus before showing the dialog\n\tapp.bringToFront();\n\n\tdlgMain.center();\n\n\tresult = dlgMain.show();\n\n\tif (cancelButtonID == result) {\n\t\treturn result; // close to quit\n\t}\n\n\t// get setting from dialog\n\texportInfo.destination = dlgMain.etDestination.text;\n\t// kpedt force valid prefix for html\n\tif (!dlgMain.etFileNamePrefix.text.length) {\n\t\texportInfo.fileNamePrefix = 'x';\n\t} else {\n\t\texportInfo.fileNamePrefix = webStr(dlgMain.etFileNamePrefix.text);\n\t}\n\t// kpedt force visible only\n\texportInfo.visibleOnly = true;\n\texportInfo.fileType = dlgMain.ddFileType.selection.index;\n\texportInfo.icc = dlgMain.cbIcc.value;\n\texportInfo.jpegQuality = dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.etQuality.text;\n\n\treturn result;\n}",
"function exportParameters() {\n\n YMHandleFileService.downloadFile(\n 'yangman_parameters.json',\n vm.parametersList.toJSON(),\n 'json',\n 'charset=utf-8',\n function (){},\n function (e){\n console.error('Export parameters error:', e);\n }\n );\n }",
"function exportPDFfunction() {\n viz.showExportPDFDialog();\n}",
"function createExport() {\n return apiCrowdin.createExport();\n}",
"function ClickExportar() {\n AtualizaGeral(); // garante o preenchimento do personagem com tudo que ta na planilha.\n var input = Dom(\"json-personagem\");\n input.style.display = 'inline';\n input.value = JSON.stringify(gEntradas);\n input.focus();\n input.select();\n Mensagem(Traduz('Personagem') + ' \"' + gPersonagem.nome + '\" ' + Traduz('exportado com sucesso') + '. ' +\n Traduz('Copie para a área de transferência.'));\n}",
"function ExportProjectDialog ( projectList ) {\n\n (function(dlg){\n\n serverRequest ( fe_reqtype.preparePrjExport,projectList,\n 'Prepare Project Export',function(){ // on success\n\n Widget.call ( dlg,'div' );\n dlg.element.setAttribute ( 'title','Export Project' );\n document.body.appendChild ( dlg.element );\n\n var grid = new Grid('');\n dlg.addWidget ( grid );\n\n grid.setLabel ( '<h3>Export Project \"' + projectList.current + '\"</h3>',0,0,1,3 );\n\n var msgLabel = new Label ( 'Project \"' + projectList.current + '\" is being ' +\n 'prepared for download ....' );\n grid.setWidget ( msgLabel, 1,0,1,3 );\n\n var progressBar = new ProgressBar ( 0 );\n grid.setWidget ( progressBar, 2,0,1,3 );\n\n dlg.projectSize = -2;\n\n // w = 3*$(window).width()/5 + 'px';\n\n $(dlg.element).dialog({\n resizable : false,\n height : 'auto',\n maxHeight : 500,\n width : 'auto',\n modal : true,\n open : function(event, ui) {\n $(this).closest('.ui-dialog').find('.ui-dialog-titlebar-close').hide();\n },\n buttons : [\n {\n id : \"download_btn\",\n text : \"Download\",\n click : function() {\n var token;\n var url;\n // if (__login_token) token = __login_token.getValue();\n if (__login_token)\n token = __login_token;\n else token = '404';\n url = '@/' + token + '/' + projectList.current + '/' +\n projectList.current + '.tar.gz';\n downloadFile ( url );\n $( \"#cancel_btn\" ).button ( \"option\",\"label\",\"Close\" );\n //$(dlg).dialog(\"close\");\n }\n },\n {\n id : \"cancel_btn\",\n text : \"Cancel\",\n click : function() {\n $(this).dialog(\"close\");\n }\n }\n ]\n });\n\n window.setTimeout ( function(){ $('#download_btn').hide(); },0 );\n\n function checkReady() {\n serverRequest ( fe_reqtype.checkPrjExport,projectList,\n 'Prepare Project Export',function(data){\n if ((data.size<=0) && (dlg.projectSize<-1))\n window.setTimeout ( checkReady,1000 );\n else {\n dlg.projectSize = data.size;\n progressBar.hide();\n msgLabel.setText ( 'Project \"' + projectList.current + '\" is prepared ' +\n 'for download. The total download<br>size is ' +\n round(data.size/1000000,3) + ' MB. Push the ' +\n '<i>Download</i> button to begin<br>the project ' +\n 'export. ' +\n '<p><b><i>Do not close this dialog until the ' +\n 'download has finished.</i></b>' );\n $('#download_btn').show();\n }\n },null,function(){ // depress error messages in this case!\n window.setTimeout ( checkReady,1000 );\n });\n }\n\n window.setTimeout ( checkReady,2000 );\n\n $(dlg.element).on( \"dialogclose\",function(event,ui){\n //alert ( 'projectSize = ' + dlg.projectSize );\n serverRequest ( fe_reqtype.finishPrjExport,projectList,\n 'Finish Project Export',null,function(){\n window.setTimeout ( function(){\n $(dlg.element).dialog( \"destroy\" );\n dlg.delete();\n },10 );\n },function(){} ); // depress error messages\n });\n\n },null,null );\n\n }(this))\n\n}",
"onExport(e) {\n e.preventDefault();\n\n if (!e.target.dataset.action) {\n return;\n }\n\n switch (e.target.dataset.action) {\n case 'copy':\n this.onCopyButtonClick();\n break;\n case 'open-viewer':\n this.sendJSONReport();\n break;\n case 'print':\n this.expandDetailsWhenPrinting();\n window.print();\n break;\n case 'save-json': {\n const jsonStr = JSON.stringify(this.json, null, 2);\n this._saveFile(new Blob([jsonStr], {type: 'application/json'}));\n break;\n }\n case 'save-html': {\n let htmlStr = '';\n\n // Since Viewer generates its page HTML dynamically from report JSON,\n // run the ReportGenerator. For everything else, the page's HTML is\n // already the final product.\n if (e.target.dataset.context !== 'viewer') {\n htmlStr = document.documentElement.outerHTML;\n } else {\n const reportGenerator = new ReportGenerator();\n htmlStr = reportGenerator.generateHTML(this.json, 'cli');\n }\n\n try {\n this._saveFile(new Blob([htmlStr], {type: 'text/html'}));\n } catch (err) {\n logger.error('Could not export as HTML. ' + err.message);\n }\n break;\n }\n }\n\n this.closeExportDropdown();\n document.removeEventListener('keydown', this.onKeyDown);\n }",
"function ProcessExport(dlg){\r \r // get selected layers\r var theLayerSelection = new Array();\r // store layer references of selected layers\r \r for (var p = 0; p < dlg.layerRange.layersList.items.length; p++) {\r if (dlg.layerRange.layersList.items[p].selected == true) {\r theLayerSelection = theLayerSelection.concat(dlg.layerRange.layersList.items[p]);\r }\r };\r\r // collect dialog box options,\r var thePrefix = dlg.options.prefixText.text;\r var theDestination = dlg.target.targetField.text;\r\r // update the prefix if we have one\r if(dlg.options.chkFileName.value){\r thePrefix = thePrefix+workingDoc.name;\r }\r \r\r // for each layer in array;\r for (var m = theLayerSelection.length - 1; m >=0; m--) {\r \r // create a new document with same properties as the first\r var theCopy = app.documents.add ( \r workingDoc.ref.width, \r workingDoc.ref.height, \r workingDoc.ref.resolution, \r workingDoc.name + \"_copy.psd\", \r NewDocumentMode.RGB, \r DocumentFill.TRANSPARENT \r );\r \r // move to original document\r app.activeDocument = workingDoc.ref;\r \r // reference the layer\r var theLayer = GetLayerByName(theLayerSelection[m].text);\r $.writeln(\"Getting: \" + theLayer.name);\r \r // build filenames\r var tmpName = thePrefix+theLayer.name;\r \r // transfer layerset over to the copy;\r theLayer.duplicate (theCopy, ElementPlacement.PLACEATBEGINNING);\r \r //switch back to document_copy\r app.activeDocument = theCopy;\r \r // check for trim options\r if(dlg.options.chkTrimPix.value){\r app.activeDocument.trim();\r }\r \r // build folder path from layer structure\r var myp = new Folder(dlg.target.targetField.text + \"/\" + FolderPaths[theLayer.id] );\r myp.create();\r \r // use web export options for png files (pngOpts defined in external file.)\r activeDocument.exportDocument(\r File(dlg.target.targetField.text + \"/\" + FolderPaths[theLayer.id] + \"/\" + tmpName +'.png'), \r ExportType.SAVEFORWEB,\r pngOpts\r );\r \r // close the extranious document\r theCopy.close(SaveOptions.DONOTSAVECHANGES); \r \r }//endfor\r\r \r // happy ending\r $.writeln(\"Export complete. \" );\r dlg.close(1);\r \r}",
"function save_and_export() {\r\n\r\n}",
"function exportPDF() {\n console.log(\"Going to export a PDF\");\n viz.showExportPDFDialog();\n}",
"function pageExportData(){\n BJUI.alertmsg(\"confirm\", \"是否确定要导出数据?\",{\n okCall:function(){\n $.fileDownload('/cmpage/page/excel_export?'+$.CurrentNavtab.find('#pagerForm').serialize(), {\n failCallback: function(responseHtml, url) {\n BJUI.alertmsg(\"warn\", \"下载文件失败!\");\n }\n });\n }\n });\n return false;\n}",
"function exportIt() {\n\n\t\talert('The Export-Feature is currently being implemented. When finished, it will give you a handy ZIP file which includes a standalone version of your Hypervideo.');\n\n\t}",
"function showDialogForExportAllMyListItems(amountOfExports) {\n\t\t\n\t\tvar dialog = new Dialog({\n\t\t\ttitle: 'Export all ' + amountOfExports + ' save(s)?',\n\t\t\ttype: 'confirm',\t\t\t\t\n\t\t\tmessage: 'Are you sure you want to export all ' + amountOfExports + ' save(s) from your My List as a plain text file?',\t\t\t\n\t\t\tbuttonsCssClass: 'my-list',\n\t\t\tshowCloseIcon: false,\n\t\t\tcloseButtonCssClass: 'btn-default',\n\t\t\tkeyboard: false,\n\t\t\tmoveable: true,\n\t\t\tbuttons: {\n\t\t\t\t'Export': function() {\n\t\t\t\t\twindow.location = contextPath + '/myList/all/export';\n\t\t\t\t\tdialog.hide();\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\t\n\t\tdialog.show();\n\t}",
"export() {\n // create the export ob\n let expOb = { panes: [] }\n let rnames = Object.keys(this.panes[0].dataForPlot)\n let csvData = []\n let csvString = \"regionname\"\n let i = 0\n // iterate over the panes\n for (let pane of this.panes) {\n // collect the relevant information\n // omit the boundary file\n let { regionBoundaryData, application, ...rest } = pane\n rest.ta = pane.ta.value\n expOb.panes.push(rest)\n csvData.push(Object.values(pane.dataForPlot))\n csvString += \",pane\" + i\n i += 1\n }\n let a = document.createElement(\"a\")\n let today = new Date()\n let datename = `neuro_choropleth_session_${today.getFullYear()}_${today.getMonth()}_${today.getDate()}_${today.getHours()}_${today.getSeconds()}`\n a.download = datename + \".json\" // note that the date elements start with 0 so december is going to be tthe 11th month, and jan is the 0th\n a.href = URL.createObjectURL(new Blob([JSON.stringify(expOb)]))\n a.click()\n // csv download\n // make header with pane listing\n csvString += \"\\n\"\n for (let i = 0; i < rnames.length; i++) {\n csvString += `${rnames[i]}`\n for (let j = 0; j < csvData.length; j++) {\n csvString += `,${csvData[j][i].toFixed(3)}`\n }\n csvString += \"\\n\"\n }\n a.download = datename + \".csv\"\n a.href = URL.createObjectURL(new Blob([csvString]))\n a.click()\n\n\n }",
"function exportPowerPoint() {\n console.log(\"Going to export a Powerpoint\");\n viz.showExportPowerPointDialog();\n}",
"function makeExportInstructions()\n{\n const instructionsDiv = $(\"<div id='export-instructions'></div>\");\n const instructionsSpan = makeSpan();\n instructionsSpan.html\n (\n \"To export your tasks:</br>\" + \n \"1. Copy the data from the box below</br>\" +\n \"2. Paste into a document or note somewhere safe</br>\" +\n \"3. When you're ready to come back, click the Import button and follow the instructions\");\n instructionsDiv.append(instructionsSpan);\n return instructionsDiv;\n}",
"function userDownload(){\n\tvar d = document.getElementById(\"ExportOption\");\n var ExportAs = d.options[d.selectedIndex].value;\n if(ExportAs == 'PNG')\n {\n chart.exportChart({type: 'image/png', filename: titleName}, {subtitle: {text:''}});\n }\n if(ExportAs == 'JPEG')\n {\n chart.exportChart({type: 'image/jpeg', filename: titleName}, {subtitle: {text:''}});\n }\n if(ExportAs == 'PDF')\n {\n chart.exportChart({type: 'application/pdf', filename: titleName}, {subtitle: {text:''}});\n }\n if(ExportAs == 'SVG')\n {\n chart.exportChart({type: 'image/svg+xml', filename: titleName}, {subtitle: {text:''}});\n }\n}",
"function main() {\r\n\r\n var exportInfo = new Object();\r\n initExportInfo(exportInfo);\r\n try {\r\n var docName = app.activeDocument.name; // save the app.activeDocument name before duplicate.\r\n var compsName = new String(\"none\");\r\n var compsCount = app.activeDocument.layerComps.length;\r\n if ( compsCount < 1 ) {\r\n if ( DialogModes.NO != app.playbackDisplayDialogs ) {\r\n alert ( strAlertNoLayerCompsFound );\r\n }\r\n\t \treturn 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script\r\n } else {\r\n app.activeDocument = app.documents[docName];\r\n docRef = app.activeDocument;\r\n \r\n\r\n app.preferences.maximizeCompatibility = QueryStateType.ALWAYS ;\r\n for ( compsIndex = 0; compsIndex < compsCount; compsIndex++ ) {\r\n var compRef = docRef.layerComps[ compsIndex ];\r\n if (exportInfo.selectionOnly && !compRef.selected) continue; // selected only\r\n compRef.apply();\r\n var duppedDocument = app.activeDocument.duplicate();\r\n var fileNameBody = exportInfo.fileNamePrefix;\r\n fileNameBody += \"_\" + zeroSuppress(compsIndex, 4);\r\n fileNameBody += \"_\" + compRef.name;\r\n if (null != compRef.comment) fileNameBody += \"_\" + compRef.comment;\r\n fileNameBody = fileNameBody.replace(/[:\\/\\\\*\\?\\\"\\<\\>\\|\\\\\\r\\\\\\n]/g, \"_\"); // '/\\:*?\"<>|\\r\\n' -> '_'\r\n if (fileNameBody.length > 120) fileNameBody = fileNameBody.substring(0,120);\r\n saveFile(duppedDocument, fileNameBody, exportInfo);\r\n duppedDocument.close(SaveOptions.DONOTSAVECHANGES);\r\n }\r\n\r\n\r\n\r\n\r\n \r\n if ( DialogModes.ALL == app.playbackDisplayDialogs ) {\r\n alert(strTitle + strAlertWasSuccessful);\r\n }\r\n\r\n app.playbackDisplayDialogs = DialogModes.ALL;\r\n\r\n }\r\n } \r\n catch (e) {\r\n if ( DialogModes.NO != app.playbackDisplayDialogs ) {\r\n alert(e);\r\n }\r\n \treturn 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script\r\n }\r\n\r\n}",
"function GenerateExportParam(gridName) {\n exportGrid = {\n ExportType: '',\n ColumnList: []\n }\n var columns = $('#' + gridName).jqGrid('getGridParam', 'colModel')\n $.each(columns, function (index, item) {\n if (item.name != 'Action' && item.name != 'cb' && item.hidden == false) {\n exportGrid.ColumnList.push({\n \"ColumnName\": item.name,\n \"ColumnAlias\": item.label,\n \"Hidden\": item.hidden\n });\n }\n });\n //return ExportGrid; \n}",
"function buildExportBox()\n{\n const exportDiv = $(\"<div id='export-div'></div>\");\n const instructions = $(\"<button>Instructions</button>\");\n const buttonsSpan = makeSpan();\n buttonsSpan.attr(\"id\",\"export-buttons\");\n instructions.data(\"open\",0);\n instructions.click(\n function() {\n exportInstructionsHandler(this);\n }\n )\n const close = $(\"<button>Close</button>\");\n close.click(\n function()\n {\n exportCloseHandler(this);\n }\n )\n buttonsSpan.append(instructions);\n buttonsSpan.append(close);\n const exportArea = $(\"<textarea rows='10' cols='100' id='export-area'></textarea\");\n exportDiv.append(buttonsSpan);\n exportDiv.append(\"<br>\");\n exportDiv.append(exportArea);\n return exportDiv;\n}",
"function accionBTN_Exportar(){\n\n\t eval(FORMULARIO).oculto = 'S';\n\t set(FORMULARIO+'.conectorAction', 'LPMantenimientoRegistroVentas');\n\t set(FORMULARIO+'.accion', 'exportarArchivo');\n\t enviaSICC(FORMULARIO, null, null, 'N');\n}",
"export() {\r\n return {\r\n name: this.name,\r\n version: this.version,\r\n scrypt: this.scrypt,\r\n accounts: this.accounts.map(acct => acct.export()),\r\n extra: this.extra\r\n };\r\n }",
"getExportableObject() {\n return {\n \"Likely Diagnoses\": this.state.listA.map((row) => ({\n Name: row.snomed && row.snomed.display ? row.snomed.display : \"...\",\n \"SNOMED Code\": row.snomed && row.snomed.code ? row.snomed.code : \"...\",\n \"Note\": row.note ? row.note : \"...\"\n })),\n \"Critical Diagnoses\": this.state.listB.map((row) => ({\n Name: row.snomed && row.snomed.display ? row.snomed.display : \"...\",\n \"SNOMED Code\": row.snomed && row.snomed.code ? row.snomed.code : \"...\",\n \"Note\": row.note ? row.note : \"...\"\n })),\n Metadata: {\n // bump this every time you change the format of the export.\n // that way we can handle imports properly.\n \"Schema Version\": 1,\n },\n };\n }",
"function exportData () {\n const JSONexport = {\n ExportTs: Date.now(),\n Stacks: JSON.parse(localStorage.getItem('stackList')) || [],\n Tasks: JSON.parse(localStorage.getItem('taskList')) || [],\n Settings: JSON.parse(localStorage.getItem('mobySettings')) || [],\n Repos: JSON.parse(localStorage.getItem('repoList')) || [],\n SnGroups: JSON.parse(localStorage.getItem('snGroupList')) || [],\n RallyProjects: JSON.parse(localStorage.getItem('rallyProjectList')) || []\n }\n fs.writeFile(`${desktopPath}/moby_export_${Date.now()}.txt`, JSON.stringify(JSONexport, null, 4), err => {\n if (err) {\n alert('An error occured during the export ' + err.message)\n return\n }\n alert('The export has completed succesfully and is located on your desktop')\n })\n}",
"function chooseExports() {\n $('Exports').addClassName('selected');\n $('Sources').removeClassName('selected');\n $('plottype').value = 'Exports';\n $('coal').enable();\n $('coal_span').setOpacity(1.0).removeClassName('selected');\n $('oil').enable();\n $('oil').checked = true;\n $('oil_span').setOpacity(1.0).removeClassName('selected');\n $('gas').enable();\n $('gas_span').setOpacity(1.0).removeClassName('selected');\n $('nuclear').enable();\n $('nuclear_span').setOpacity(1.0).removeClassName('selected');\n $('hydro').enable();\n $('hydro_span').setOpacity(1.0).removeClassName('selected');\n $('all').disable();\n $('all_span').setOpacity(0.3).removeClassName('selected');\n\n changeAdvancedOptions();\n chooseOil();\n}",
"function exportReport(exportType) {\r\n\tvar network_id = $('#selectbox_agency').val();\r\n\tvar title= $('#selectbox_agency option:selected').text();\r\n\tvar loadingUrl = rootUrl + '/GenerateJasperReport' + '?export_type='\r\n\t\t\t+ exportType + '&jrxml=daily_vlmo&p_end_date='\r\n\t\t\t+ selectEndDate.format('yyyy-mm-dd') + '&p_start_date='\r\n\t\t\t+ selectStartDate.format('yyyy-mm-dd') + '&path=vlmo'\r\n\t\t\t+ \"&p_network_id=\" + network_id+\"&p_title=\"+title;\r\n\twindow.open(loadingUrl);\r\n}"
]
| [
"0.69108146",
"0.6871796",
"0.6547925",
"0.6397909",
"0.6269094",
"0.61239517",
"0.60223556",
"0.59475535",
"0.5934391",
"0.58898175",
"0.583196",
"0.5742452",
"0.5728104",
"0.5722974",
"0.57212543",
"0.57168704",
"0.5666863",
"0.5636692",
"0.56313735",
"0.56248724",
"0.56095135",
"0.5580169",
"0.55756867",
"0.55736804",
"0.55555385",
"0.55336714",
"0.5524726",
"0.54873466",
"0.54620683",
"0.5460359"
]
| 0.7097998 | 0 |
Function: getTempFolder Usage: create a temp folder using random numbers Input: none Return: a new blank folder to put files in temporarily | function getTempFolder()
{
var tempLocation;
var folder = Folder.temp; // File(exportInfo.destination).parent;
while(true) { // set temporary folder with random name
tempLocation = folder.toString() + "/temp" + Math.floor(Math.random()*10000);
var testFolder = new Folder(tempLocation);
if (!testFolder.exists) {
testFolder.create();
break;
}
}
return tempLocation;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findRandomTemporaryDirectory() {\n const randomName = crypto.randomBytes(32).toString('hex')\n const temporaryPath = path.join(libraryBasePath, randomName)\n if (fs.existsSync(temporaryPath)) {\n return findRandomTemporaryDirectory()\n }\n\n return temporaryPath\n }",
"function makeTempFile()\r\n{\r\n var tfolder, TemporaryFolder = 2;\r\n tfolder = fso.GetSpecialFolder(TemporaryFolder);\r\n \r\n var tname = fso.GetTempName();\r\n var tfile = tfolder.CreateTextFile(tname);\r\n tfile.Close();\r\n \r\n return tfolder.Path + \"\\\\\" + tname;\r\n}",
"function mk_temp() {\n fs.mkdir(g_DOWNLOAD_DIR + g_TEMP, function (err) {\n if (err) {\n if (err.code == 'EEXIST') existing_chunks_checker(g_allChunks); // ignore the error if the folder already exists\n else console.log('Error MkDir: ' + err.code); // something else went wrong\n } else existing_chunks_checker(g_allChunks); // successfully created folder\n });\n}",
"async tempDir() {\n let dir = await mkdtemp(resolve(tmpdir(), 'peon-test-'))\n pendingCleanup.push(async() => {\n await remove(dir)\n })\n return dir\n }",
"function createTempDir() {\n let now = Date.now(); // Returns unix-time seconds as our unique name for the tempdir\n if (!fs.existsSync(`${DATADIR}/${now}`)){\n try { fs.mkdirSync(`${DATADIR}/${now}`); }\n catch (e) { elog(`createTempDir`, e); }\n jlog(`createTempDir`, `Created temporary processing directory: ${DATADIR}/${now}`);\n }\n return `${DATADIR}/${now}`;\n}",
"function getTmpFolder() {\n\tvar folder = cachedTmpFolder\n\tif (!folder) {\n\t\tfolder = path.join(getHomeFolder(), 'tmp')\n\t\tif (haraldutil.getType(folder) !== 1) {\n\t\t\tfolder = process.env.TEMP\n\t\t\tif (!folder || getType(folder) !== 1) {\n\t\t\t\tfolder = '/tmp'\n\t\t\t\tif (haraldutil.getType(folder) !== 1) throw Error('no tmp folder found')\n\t\t\t}\n\t\t}\n\t\tcachedTmpFolder = folder\n\t}\n\treturn folder\n}",
"function tmp() {\n return path.join(\n require('os').tmpdir(),\n require('crypto').randomBytes(8).toString('hex') + '.png'\n );\n}",
"function getTmpdir() {\n return (process.platform == 'win32') ? os.tmpdir() : '/tmp/';\n}",
"getTemp(filename) {\n invariant(this.tempFolder, 'No temp folder');\n return path.join(this.tempFolder, filename);\n }",
"function TmpDirectory() {\n this.name = `/tmp/${uuid.v4()}/`;\n}",
"getTmpDir() {\n return os.tmpdir();\n }",
"static createFolderWithRetry(folderName) {\n // Note: If a file exists with the same name, then we fall through and report\n // an error.\n if (Utilities.directoryExists(folderName)) {\n return;\n }\n // We need to do a simple \"fs.mkdirSync(localModulesFolder)\" here,\n // however if the folder we deleted above happened to contain any files,\n // then there seems to be some OS process (virus scanner?) that holds\n // a lock on the folder for a split second, which causes mkdirSync to\n // fail. To workaround that, retry for up to 7 seconds before giving up.\n const maxWaitTimeMs = 7 * 1000;\n return Utilities.retryUntilTimeout(() => fsx.mkdirsSync(folderName), maxWaitTimeMs, (e) => new Error(`Error: ${e}${os.EOL}Often this is caused by a file lock ` +\n 'from a process such as your text editor, command prompt, ' +\n 'or \"gulp serve\"'), 'createFolderWithRetry');\n }",
"function pickTempImage(t){\n var tempPath;\n if (t<=0){\n tempPath='./img/temp0.png';}\n if (t>0 && t<=10){tempPath='./img/temp1.png';}\n if (t>10 && t<=20) {tempPath='./img/temp2.png';}\n if (t>20) {tempPath='./img/temp3.png';}\n return tempPath;\n }",
"function CheckFolder()\r\n\t\t{\t\t\t\t\r\n\t\t\tvar wshell = new ActiveXObject(\"WScript.Shell\"); \r\n\t\t\tvar tempfolder = wshell.ExpandEnvironmentStrings(\"%TEMP%\"); \t \r\n\t\t\tvar path = tempfolder+\"\\\\\";\r\n\t\t\tvar fsobject;\r\n\t\t\tfsobject = new ActiveXObject(\"Scripting.FileSystemObject\");\r\n\t\t\tif(fsobject.FolderExists(tempfolder+\"\\\\Lawson\\\\DocumentArchive\\\\ADC\\\\\"))\r\n\t\t\t{\r\n\t\t\t\t//ADC temp folder already exists\r\n\t\t\t\treturn tempfolder+\"\\\\Lawson\\\\DocumentArchive\\\\ADC\\\\\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//Create sub path for ADC temp folder\r\n\t\t\tvar folderarray = new Array();\r\n\t\t\tfolderarray[0] = \"Lawson\";\r\n\t\t\tfolderarray[1] = \"DocumentArchive\";\r\n\t\t\tfolderarray[2] = \"ADC\";\r\n\t\t\t \r\n\t\t\tvar i;\r\n\t\t\tfor(i=0;i<folderarray.length; i++)\r\n\t\t\t{\r\n\t\t\t\tpath+=folderarray[i]+\"\\\\\";\r\n\t\t\t\ttry\r\n\t\t\t\t{\r\n\t\t\t\t\tif(!fsobject.FolderExists(path))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdebug.WriteLine(path); \r\n\t\t\t\t\t\tfsobject.CreateFolder(path);\r\n\t\t\t\t\t} \r\n\t\t\t\t}\r\n\t\t\t\tcatch(ex)\r\n\t\t\t\t{\r\n\t\t\t\t\tConfirmDialog.ShowErrorDialogWithoutCancel(\"Exception thrown during ADC temp folder creation\", ex.ToString());\t\t\t\r\n\t\t\t\t\tdebug.WriteLine(\"Exception thrown during ADC temp folder creation\");\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tdebug.WriteLine(\"Path: \"+path);\r\n\t\t\treturn path;\r\n\t\t}",
"function getSelfDestructingTempDir () {\n return tmp.dirSync({\n prefix: 'cordova-create-',\n unsafeCleanup: true\n }).name;\n}",
"function UserTempDir(){\r\n\tfso = new ActiveXObject(\"Scripting.FileSystemObject\");\r\n\treturn fso.GetSpecialFolder(2);\r\n}",
"function createTestFolder() {\n return new BbPromise(function(resolve, reject) {\n\n fs.exists(testFolder, function(exists) {\n if (exists) {\n return resolve(testFolder);\n }\n fs.mkdir(testFolder, function(err) {\n if (err) {\n return reject(err);\n }\n return resolve(testFolder);\n })\n })\n });\n }",
"function createRemoteTempFolder() {\n let cmd = \"/bin/rm -rf \" + repoNameTemp + \" && mkdir \" + repoNameTemp; \n\tconsole.log(\"##Creating temp folder on remote host with cmd: \" + cmd);\n\treturn ssh.execCommand(cmd, { cwd:'/home/ubuntu' })\n}",
"function makeFolders(){\n let pathFile = `${imagePath}`;\n if (!fs.existsSync(`${pathFile}temp`)) {\n fs.mkdirSync(`${pathFile}temp`);\n }\n if (!fs.existsSync(`${pathFile}temp/users`)) {\n fs.mkdirSync(`${pathFile}temp/users`);\n }\n if (!fs.existsSync(`${pathFile}temp/items`)) {\n fs.mkdirSync(`${pathFile}temp/items`);\n }\n if (!fs.existsSync(`${pathFile}temp/packages`)) {\n fs.mkdirSync(`${pathFile}temp/packages`);\n }\n if (!fs.existsSync(`${pathFile}temp/categories`)) {\n fs.mkdirSync(`${pathFile}temp/categories`);\n }\n}",
"get tmp () {\n if (!this.#tmpFolder) {\n const rand = require('crypto').randomBytes(4).toString('hex')\n this.#tmpFolder = `npm-${process.pid}-${rand}`\n }\n return resolve(this.config.get('tmp'), this.#tmpFolder)\n }",
"function createFolder(){\n\n\tvar pathName = 'category_output'; \n\n\tmkdirp(pathName, function(err) { \n\t\t//console.log('ok');\n\t});\n\n\n}",
"get tmp () {\n if (!this[_tmpFolder]) {\n const rand = require('crypto').randomBytes(4).toString('hex')\n this[_tmpFolder] = `npm-${process.pid}-${rand}`\n }\n return resolve(this.config.get('tmp'), this[_tmpFolder])\n }",
"function ensureTempDir(done) {\n console.log('Ensuring temp directory exists.');\n mkdirRecursive.mkdir(tempFolder, function(err) {\n if (err && err.code !== 'EEXIST') {\n console.error(err);\n }\n done(err);\n });\n}",
"function randomDir(){\r\n\treturn Math.floor(Math.random()*3)-1;\r\n}",
"get tempDirectory () {\n return this.tmpPath\n }",
"function generateCWDName() {\n var requestId = createRequestId();\n return path.join(TEMP_DIR, requestId);\n }",
"static tempfile() {\n // #Dependency to #Lively4Server \n return lively.files.directory(lively4url) + \"_tmp/\" + generateUuid() \n }",
"function getTempFilePath(name) {\n if (!tmpDir) {\n tmpDir = fs.mkdtempSync(os.tmpdir() + path.sep + 'vscode-go');\n }\n if (!fs.existsSync(tmpDir)) {\n fs.mkdirSync(tmpDir);\n }\n return path.normalize(path.join(tmpDir, name));\n}",
"async createFolders() {\n this.filesPath = path.join(this.storagePath, 'files');\n this.tempPath = path.join(this.storagePath, 'tmp');\n await fse.ensureDir(this.filesPath);\n await fse.ensureDir(this.tempPath);\n }",
"function getUniqScreenshotName() {\n //use the current date/time \"now\" variable captured when the program first ran \n //for the folder names\n const todaysDate = dateFormat(now, \"mm_dd_yy\");\n const startTime = dateFormat(now, \"h_MM_ss_TT\");\n \n //folder to store the screenshots\n const baseScreenshotFolder = \"screenshots\";\n const subFolder = todaysDate + \"__\" + startTime;\n const folderpath = baseScreenshotFolder + \"/\" + subFolder + \"/\";\n //create folders if they dont exist\n if (!fs.existsSync(baseScreenshotFolder)){fs.mkdirSync(baseScreenshotFolder);}\n if (!fs.existsSync(folderpath)){fs.mkdirSync(folderpath);} \n \n // increment the screenshot counter, i.e Awd3.png\n screenshotCounter = screenshotCounter + 1;\n console.log(\"should be creating screenshot: \" + folderpath + currModule + screenshotCounter + \".png\");\n return folderpath + currModule + screenshotCounter + \".png\";\n}"
]
| [
"0.7303385",
"0.72429144",
"0.7017715",
"0.6708041",
"0.6699022",
"0.648603",
"0.64061487",
"0.6265706",
"0.62408775",
"0.60809445",
"0.6061852",
"0.5997148",
"0.5990174",
"0.59865415",
"0.59748805",
"0.59659344",
"0.589774",
"0.5894593",
"0.5851076",
"0.5811833",
"0.57738626",
"0.5764167",
"0.5727528",
"0.5639858",
"0.56239766",
"0.5594522",
"0.55292356",
"0.5515729",
"0.5503078",
"0.54908407"
]
| 0.84796 | 0 |
Function: objectToDescriptor Usage: create an ActionDescriptor from a JavaScript Object Input: JavaScript Object (o) Pre process converter (f) Return: ActionDescriptor NOTE: Only boolean, string, and number are supported, use a pre processor to convert (f) other types to one of these forms. | function objectToDescriptor (o, f) {
if (undefined != f) {
o = f(o);
}
var d = new ActionDescriptor;
var l = o.reflect.properties.length;
for (var i = 0; i < l; i++ ) {
var k = o.reflect.properties[i].toString();
if (k == "__proto__" || k == "__count__" || k == "__class__" || k == "reflect")
continue;
var v = o[ k ];
k = app.stringIDToTypeID(k);
switch ( typeof(v) ) {
case "boolean":
d.putBoolean(k, v);
break;
case "string":
d.putString(k, v);
break;
case "number":
d.putDouble(k, v);
break;
default:
throw( new Error("Unsupported type in objectToDescriptor " + typeof(v) ) );
}
}
return d;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function descriptorToObject (o, d, f) {\r\n\tvar l = d.count;\r\n\tfor (var i = 0; i < l; i++ ) {\r\n\t\tvar k = d.getKey(i); // i + 1 ?\r\n\t\tvar t = d.getType(k);\r\n\t\tstrk = app.typeIDToStringID(k);\r\n\t\tswitch (t) {\r\n\t\t\tcase DescValueType.BOOLEANTYPE:\r\n\t\t\t\to[strk] = d.getBoolean(k);\r\n\t\t\t\tbreak;\r\n\t\t\tcase DescValueType.STRINGTYPE:\r\n\t\t\t\to[strk] = d.getString(k);\r\n\t\t\t\tbreak;\r\n\t\t\tcase DescValueType.DOUBLETYPE:\r\n\t\t\t\to[strk] = d.getDouble(k);\r\n\t\t\t\tbreak;\r\n\t\t\tcase DescValueType.INTEGERTYPE:\r\n\t\t\tcase DescValueType.ALIASTYPE:\r\n\t\t\tcase DescValueType.CLASSTYPE:\r\n\t\t\tcase DescValueType.ENUMERATEDTYPE:\r\n\t\t\tcase DescValueType.LISTTYPE:\r\n\t\t\tcase DescValueType.OBJECTTYPE:\r\n\t\t\tcase DescValueType.RAWTYPE:\r\n\t\t\tcase DescValueType.REFERENCETYPE:\r\n\t\t\tcase DescValueType.UNITDOUBLE:\r\n\t\t\tdefault:\r\n\t\t\t\tthrow( new Error(\"Unsupported type in descriptorToObject \" + t ) );\r\n\t\t}\r\n\t}\r\n\tif (undefined != f) {\r\n\t\to = f(o);\r\n\t}\r\n}",
"function convertToDescriptor(desc) {\r\n\t\t\tfunction hasProperty(obj, prop) {\r\n\t\t\t\treturn Object.prototype.hasOwnProperty.call(obj, prop);\r\n\t\t\t}\r\n\r\n\t\t\tfunction isCallable(v) {\r\n\t\t\t\t// NB: modify as necessary if other values than functions are\r\n\t\t\t\t// callable.\r\n\t\t\t\treturn typeof v === \"function\";\r\n\t\t\t}\r\n\r\n\t\t\tif (typeof desc !== \"object\" || desc === null)\r\n\t\t\t\tthrow new TypeError(\"bad desc\");\r\n\r\n\t\t\tvar d = {};\r\n\t\t\tif (hasProperty(desc, \"enumerable\"))\r\n\t\t\t\td.enumerable = !!obj.enumerable;\r\n\t\t\tif (hasProperty(desc, \"configurable\"))\r\n\t\t\t\td.configurable = !!obj.configurable;\r\n\t\t\tif (hasProperty(desc, \"value\"))\r\n\t\t\t\td.value = obj.value;\r\n\t\t\tif (hasProperty(desc, \"writable\"))\r\n\t\t\t\td.writable = !!desc.writable;\r\n\t\t\tif (hasProperty(desc, \"get\")) {\r\n\t\t\t\tvar g = desc.get;\r\n\t\t\t\tif (!isCallable(g) && g !== \"undefined\")\r\n\t\t\t\t\tthrow new TypeError(\"bad get\");\r\n\t\t\t\td.get = g;\r\n\t\t\t}\r\n\t\t\tif (hasProperty(desc, \"set\")) {\r\n\t\t\t\tvar s = desc.set;\r\n\t\t\t\tif (!isCallable(s) && s !== \"undefined\")\r\n\t\t\t\t\tthrow new TypeError(\"bad set\");\r\n\t\t\t\td.set = s;\r\n\t\t\t}\r\n\r\n\t\t\tif ((\"get\" in d || \"set\" in d) && (\"value\" in d || \"writable\" in d))\r\n\t\t\t\tthrow new TypeError(\"identity-confused descriptor\");\r\n\r\n\t\t\treturn d;\r\n\t\t}",
"function DescriptorToObject(o, d, f) {\n\tvar l = d.count;\n\tfor (var i = 0; i < l; i++) {\n\t\tvar k = d.getKey(i);\n\t\tvar t = d.getType(k);\n\t\tvar strk = app.typeIDToStringID(k);\n if (strk.length == 0) {\n strk = app.typeIDToCharID(k);\n }\n\t\tswitch (t) {\n\t\t\tcase DescValueType.BOOLEANTYPE:\n\t\t\t\to[strk] = d.getBoolean(k);\n\t\t\t\tbreak;\n\t\t\tcase DescValueType.STRINGTYPE:\n\t\t\t\to[strk] = d.getString(k);\n\t\t\t\tbreak;\n\t\t\tcase DescValueType.DOUBLETYPE:\n\t\t\t\to[strk] = d.getDouble(k);\n\t\t\t\tbreak;\n\t\t\tcase DescValueType.INTEGERTYPE:\n o[strk] = d.getInteger(k);\n break;\n case DescValueType.LARGEINTEGERTYPE:\n \to[strk] = d.getLargeInteger(k);\n \tbreak;\n\t\t\tcase DescValueType.OBJECTTYPE:\n var newT = d.getObjectType(k);\n var newV = d.getObjectValue(k);\n o[strk] = new Object();\n DescriptorToObject(o[strk], newV, f);\n break;\n\t\t\tcase DescValueType.UNITDOUBLE:\n var newT = d.getUnitDoubleType(k);\n var newV = d.getUnitDoubleValue(k);\n o[strk] = new Object();\n o[strk].type = typeIDToCharID(newT);\n o[strk].typeString = typeIDToStringID(newT);\n o[strk].value = newV;\n break;\n\t\t\tcase DescValueType.ENUMERATEDTYPE:\n var newT = d.getEnumerationType(k);\n var newV = d.getEnumerationValue(k);\n o[strk] = new Object();\n o[strk].type = typeIDToCharID(newT);\n o[strk].typeString = typeIDToStringID(newT);\n o[strk].value = typeIDToCharID(newV);\n o[strk].valueString = typeIDToStringID(newV);\n break;\n\t\t\tcase DescValueType.CLASSTYPE:\n o[strk] = d.getClass(k);\n break;\n\t\t\tcase DescValueType.ALIASTYPE:\n o[strk] = d.getPath(k);\n break;\n\t\t\tcase DescValueType.RAWTYPE:\n var tempStr = d.getData(k);\n o[strk] = new Array();\n for (var tempi = 0; tempi < tempStr.length; tempi++) { \n o[strk][tempi] = tempStr.charCodeAt(tempi); \n }\n break;\n\t\t\tcase DescValueType.REFERENCETYPE:\n var ref = d.getReference(k);\n o[strk] = new Object();\n ReferenceToObject(o[strk], ref, f);\n break;\n\t\t\tcase DescValueType.LISTTYPE:\n var list = d.getList(k);\n o[strk] = new Array();\n ListToObject(o[strk], list, f);\n break;\n\t\t\tdefault:\n\t\t\t\tmyLogging.LogIt(\"Unsupported type in descriptorToObject \" + t);\n\t\t}\n\t}\n\tif (undefined != f) {\n\t\to = f(o);\n\t}\n}",
"function toPropertyDescriptor(obj) {\n if (Object(obj) !== obj) {\n throw new TypeError(\"property descriptor should be an Object, given: \"+\n obj);\n }\n var desc = {};\n if ('enumerable' in obj) { desc.enumerable = !!obj.enumerable; }\n if ('configurable' in obj) { desc.configurable = !!obj.configurable; }\n if ('value' in obj) { desc.value = obj.value; }\n if ('writable' in obj) { desc.writable = !!obj.writable; }\n if ('get' in obj) {\n var getter = obj.get;\n if (getter !== undefined && typeof getter !== \"function\") {\n throw new TypeError(\"property descriptor 'get' attribute must be \"+\n \"callable or undefined, given: \"+getter);\n }\n desc.get = getter;\n }\n if ('set' in obj) {\n var setter = obj.set;\n if (setter !== undefined && typeof setter !== \"function\") {\n throw new TypeError(\"property descriptor 'set' attribute must be \"+\n \"callable or undefined, given: \"+setter);\n }\n desc.set = setter;\n }\n if ('get' in desc || 'set' in desc) {\n if ('value' in desc || 'writable' in desc) {\n throw new TypeError(\"property descriptor cannot be both a data and an \"+\n \"accessor descriptor: \"+obj);\n }\n }\n return desc;\n}",
"function toPropertyDescriptor(obj) {\n if (Object(obj) !== obj) {\n throw new TypeError(\"property descriptor should be an Object, given: \"+\n obj);\n }\n var desc = {};\n if ('enumerable' in obj) { desc.enumerable = !!obj.enumerable; }\n if ('configurable' in obj) { desc.configurable = !!obj.configurable; }\n if ('value' in obj) { desc.value = obj.value; }\n if ('writable' in obj) { desc.writable = !!obj.writable; }\n if ('get' in obj) {\n var getter = obj.get;\n if (getter !== undefined && typeof getter !== \"function\") {\n throw new TypeError(\"property descriptor 'get' attribute must be \"+\n \"callable or undefined, given: \"+getter);\n }\n desc.get = getter;\n }\n if ('set' in obj) {\n var setter = obj.set;\n if (setter !== undefined && typeof setter !== \"function\") {\n throw new TypeError(\"property descriptor 'set' attribute must be \"+\n \"callable or undefined, given: \"+setter);\n }\n desc.set = setter;\n }\n if ('get' in desc || 'set' in desc) {\n if ('value' in desc || 'writable' in desc) {\n throw new TypeError(\"property descriptor cannot be both a data and an \"+\n \"accessor descriptor: \"+obj);\n }\n }\n return desc;\n}",
"function toJava(obj){\n if(obj instanceof Array){\n return toArray(obj);\n } else if(obj instanceof java.lang.Object){\n return obj;\n } else if(typeof obj == \"object\"){\n return toMap(obj);\n } else{\n return obj;\n }\n}",
"static initialize(obj, actorObject, actionRelationship, actionObject) { \n obj['actor_object'] = actorObject;\n obj['action_relationship'] = actionRelationship;\n obj['action_object'] = actionObject;\n }",
"static create(object) {\n let type = getType(object);\n let result;\n\n // this object has objectify?\n if (Objectify.hasObjectify(object)) {\n result = object.objectify();\n\n } else {\n // nope, we can force to get the public properties then:\n result = JSON.parse(JSON.stringify(object));\n }\n\n result._otype = type;\n\n return result;\n }",
"function convertEnums(obj) {\n if (!'componentEvent' in obj) return obj;\n if (!'component' in obj.componentEvent) return obj;\n var newObj = JSON.parse(JSON.stringify(obj));\n newObj.componentEvent.action = actions[obj.componentEvent.action];\n newObj.componentEvent.component.componentType =\n componentTypes[obj.componentEvent.component.componentType];\n return newObj;\n }",
"function _valueOf(value) {\n var p = {};\n switch (value.type) {\n case 'object':\n p.value = {\n description: value.className,\n hasChildren: true,\n injectedScriptId: value.ref || value.handle,\n type: 'object'\n };\n break;\n case 'function':\n p.value = {\n description: value.text || 'function()',\n hasChildren: true,\n injectedScriptId: value.ref || value.handle,\n type: 'function'\n };\n break;\n case 'undefined':\n p.value = {description: 'undefined'};\n break;\n case 'null':\n p.value = {description: 'null'};\n break;\n case 'script':\n p.value = {description: value.text};\n break;\n default:\n p.value = {description: value.value};\n break;\n }\n return p;\n }",
"function pyobject2jsobject(obj) {\n if(isinstance(obj,dict)){\n var temp = new Object()\n temp.__class__ = 'dict'\n for(var i=0;i<obj.$keys.length;i++){temp[obj.$keys[i]]=obj.$values[i]}\n return temp\n }\n\n // giving up, just return original object\n return obj\n}",
"function encodeObject(o) {\n if (_.isNumber(o)) {\n if (_.isNaN(o)) {\n return ['SPECIAL_FLOAT', 'NaN'];\n } else if (o === Infinity) {\n return ['SPECIAL_FLOAT', 'Infinity'];\n } else if (o === -Infinity) {\n return ['SPECIAL_FLOAT', '-Infinity'];\n } else {\n return o;\n }\n } else if (_.isString(o)) {\n return o;\n } else if (_.isBoolean(o) || _.isNull(o) || _.isUndefined(o)) {\n return ['JS_SPECIAL_VAL', String(o)];\n } else if (typeof o === 'symbol') {\n // ES6 symbol\n return ['JS_SPECIAL_VAL', String(o)];\n } else {\n // render these as heap objects\n\n // very important to use _.has since we don't want to\n // grab the property in your prototype, only in YOURSELF ... SUBTLE!\n if (!_.has(o, 'smallObjId_hidden_')) {\n // make this non-enumerable so that it doesn't show up in\n // console.log() or other inspector functions\n Object.defineProperty(o, 'smallObjId_hidden_', { value: smallObjId,\n enumerable: false });\n smallObjId++;\n }\n assert(o.smallObjId_hidden_ > 0);\n\n var ret = ['REF', o.smallObjId_hidden_];\n\n if (encodedHeapObjects[String(o.smallObjId_hidden_)] !== undefined) {\n return ret;\n }\n else {\n assert(_.isObject(o));\n\n var newEncodedObj = [];\n encodedHeapObjects[String(o.smallObjId_hidden_)] = newEncodedObj;\n\n var i;\n\n if (_.isFunction(o)) {\n var funcProperties = []; // each element is a pair of [name, encoded value]\n\n var encodedProto = null;\n if (_.isObject(o.prototype)) {\n // TRICKY TRICKY! for inheritance to be displayed properly, we\n // want to find the prototype of o.prototype and see if it's\n // non-empty. if that's true, then even if o.prototype is\n // empty (i.e., has no properties of its own), then we should\n // still encode it since its 'prototype' \"uber-hidden\n // property\" is non-empty\n var prototypeOfPrototype = Object.getPrototypeOf(o.prototype);\n if (!_.isEmpty(o.prototype) ||\n (_.isObject(prototypeOfPrototype) && !_.isEmpty(prototypeOfPrototype))) {\n encodedProto = encodeObject(o.prototype);\n }\n }\n\n if (encodedProto) {\n funcProperties.push(['prototype', encodedProto]);\n }\n\n // now get all of the normal properties out of this function\n // object (it's unusual to put properties in a function object,\n // but it's still legal!)\n var funcPropPairs = _.pairs(o);\n for (i = 0; i < funcPropPairs.length; i++) {\n funcProperties.push([funcPropPairs[i][0], encodeObject(funcPropPairs[i][1])]);\n }\n\n var funcCodeString = o.toString();\n\n /*\n\n #craftsmanship -- make nested functions look better by indenting\n the first line of a nested function definition by however much\n the LAST line is indented, ONLY if the last line is simply a\n single ending '}'. otherwise it will look ugly since the\n function definition doesn't start out indented, like so:\n\nfunction bar(x) {\n globalZ += 100;\n return x + y + globalZ;\n }\n\n */\n var codeLines = funcCodeString.split('\\n');\n if (codeLines.length > 1) {\n var lastLine = _.last(codeLines);\n if (lastLine.trim() === '}') {\n var lastLinePrefix = lastLine.slice(0, lastLine.indexOf('}'));\n funcCodeString = lastLinePrefix + funcCodeString; // prepend!\n }\n }\n\n newEncodedObj.push('JS_FUNCTION',\n o.name,\n funcCodeString, /* code string*/\n funcProperties.length ? funcProperties : null, /* OPTIONAL */\n null /* parent frame */);\n } else if (_.isArray(o)) {\n newEncodedObj.push('LIST');\n for (i = 0; i < o.length; i++) {\n newEncodedObj.push(encodeObject(o[i]));\n }\n } else if (o.__proto__.toString() === canonicalSet.__proto__.toString()) { // dunno why 'instanceof' doesn't work :(\n newEncodedObj.push('SET');\n // ES6 Set (TODO: add WeakSet)\n for (let item of o) {\n newEncodedObj.push(encodeObject(item));\n }\n } else if (o.__proto__.toString() === canonicalMap.__proto__.toString()) { // dunno why 'instanceof' doesn't work :(\n // ES6 Map (TODO: add WeakMap)\n newEncodedObj.push('DICT'); // use the Python 'DICT' type since it's close enough; adjust display in frontend\n for (let [key, value] of o) {\n newEncodedObj.push([encodeObject(key), encodeObject(value)]);\n }\n } else {\n // a true object\n\n // if there's a custom toString() function (note that a truly\n // prototypeless object won't have toString method, so check first to\n // see if toString is *anywhere* up the prototype chain)\n var s = (o.toString !== undefined) ? o.toString() : '';\n if (s !== '' && s !== '[object Object]') {\n newEncodedObj.push('INSTANCE_PPRINT', 'object', s);\n } else {\n newEncodedObj.push('INSTANCE', '');\n var pairs = _.pairs(o);\n for (i = 0; i < pairs.length; i++) {\n var e = pairs[i];\n newEncodedObj.push([encodeObject(e[0]), encodeObject(e[1])]);\n }\n\n var proto = Object.getPrototypeOf(o);\n if (_.isObject(proto) && !_.isEmpty(proto)) {\n //log('obj.prototype', proto, proto.smallObjId_hidden_);\n // I think __proto__ is the official term for this field,\n // *not* 'prototype'\n newEncodedObj.push(['__proto__', encodeObject(proto)]);\n }\n }\n }\n\n return ret;\n }\n\n }\n assert(false);\n}",
"function buildFromObject({ declaration, name, mapActionType }) {\n if (typeof declaration === 'object') {\n return () => ensureActionType(declaration, name, mapActionType);\n }\n return null;\n}",
"objd(obj) {\n\n return toObject(obj);\n }",
"function object_object(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n es_rule.required(rule, value, source, errors, options);\n if (value !== undefined) {\n es_rule.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}",
"function object_object(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n es_rule.required(rule, value, source, errors, options);\n if (value !== undefined) {\n es_rule.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}",
"function object_object(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n es_rule.required(rule, value, source, errors, options);\n if (value !== undefined) {\n es_rule.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}",
"function object_object(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n es_rule.required(rule, value, source, errors, options);\n if (value !== undefined) {\n es_rule.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}",
"function object_object(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n es_rule.required(rule, value, source, errors, options);\n if (value !== undefined) {\n es_rule.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}",
"function ObjToSource(o){\n if (!o) return 'null';\n if (typeof(o) == \"object\") {\n if (!ObjToSource.check) ObjToSource.check = new Array();\n for (var i=0, k=ObjToSource.check.length ; i<k ; ++i) {\n if (ObjToSource.check[i] == o) {return '{}';}\n }\n ObjToSource.check.push(o);\n }\n if (typeof(o) == \"string\"){\n return JSON.stringify(o);\n }\n var k=\"\";\n var na=typeof(o.length)== \"undefined\" ? 1 : 0;\n var str=\"\";\n for(var p in o){\n if (na) k = \"'\"+p+ \"':\";\n if (typeof o[p] == \"string\") str += k + \"'\" + o[p]+\"',\";\n else if (typeof o[p] == \"object\") str += k + ObjToSource(o[p])+\",\";\n else str += k + o[p] + \",\";\n }\n if (typeof(o) == \"object\")\n ObjToSource.check.pop();\n\n if (na)\n return \"{\"+str.slice(0,-1)+\"}\";\n else\n return \"[\"+str.slice(0,-1)+\"]\";\n}",
"function castToFabricObject(obj) {\n if(obj) {\n var returnObj;\n if(obj.type == TOOL.RECTANGLE) {\n returnObj = new fabric.Rect(obj);\n } else if (obj.type == TOOL.ELLIPSE) {\n returnObj = new fabric.Ellipse(obj);\n } else if (obj.type == TOOL.LINE) {\n\n var x2 = (obj.x1 < 0) ? obj.left + obj.width : obj.left - obj.width;\n var y2 = (obj.y1 < 0) ? obj.top + obj.height : obj.top - obj.height;\n\n returnObj = new fabric.Line([obj.left, obj.top,\n x2,y2], obj);\n } else if (obj.type == TOOL.TEXT) {\n returnObj = new fabric.IText(\"\", {\n left: obj.left,\n top: obj.top,\n fontFamily: obj.fontFamily,\n fontSize: obj.fontSize,\n fill: obj.fill,\n fontStyle: obj.fontStyle,\n textDecoration: obj.textDecoration,\n fontWeight: obj.fontWeight\n });\n } else if (obj.type == TOOL.PENCIL) {\n\n var path = obj.path;\n var SVGString = \"\";\n for(var i = 0; i < path.length; i++) {\n SVGString += path[i].join(\" \") + \" \";\n }\n SVGString.trim();\n\n returnObj = new fabric.Path(SVGString, {\n strokeWidth: obj.strokeWidth,\n stroke: obj.stroke,\n fill: null\n });\n }else {\n return null;\n }\n\n /**\n * After casting, the attribute \"selectable\" of the new fabricjs is set to true by default.\n * Therefore, its 'selectable' attribute has to be set based on the canvas.selection\n */\n returnObj.selectable = canvas.selection;\n\n return returnObj;\n } else {\n return null;\n }\n}",
"function object_object(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n\n es_rule.required(rule, value, source, errors, options);\n\n if (value !== undefined) {\n es_rule.type(rule, value, source, errors, options);\n }\n }\n\n callback(errors);\n}",
"function objectToFunc (obj) {\n var match = {}\n\n for (var key in obj) {\n match[key] = typeof obj[key] === 'string'\n ? defaultToFunc(obj[key])\n : toFuncton(obj[key])\n }\n return function (val) {\n if (typeof val !== 'object') return false\n for (var key in match) {\n if (!(key in val)) return false\n if (!match[key](val[key])) return false\n }\n return true\n }\n}",
"function processObj(o) {\n if (DEBUG) console.log(\"Object from parser: \", o);\n try {\n var ob = JSON.parse(o);\n if (DEBUG) console.log(\"After JSON.parse: \", ob);\n answers.process(ob);\n } catch (e) {\n console.log(\"Oops, could not parse or process \", o, e.message);\n } \n}",
"decodeObject(_obj) {\n if (typeof _obj === 'undefined') {\n return null;\n }\n const _type = typeChr(_obj);\n if (!_type) {\n console.warn('WARNING: decode of ' + (typeof _obj) + ' not possible');\n return null;\n }\n // return this._decodeString(_obj) if _type == 's'\n if (_type === 'a') {\n return this._decodeArr(_obj);\n }\n else if (_type === 'h') {\n return this._decodeHash(_obj);\n }\n else {\n return _obj;\n }\n }",
"function coercePrimitiveToObject(obj) {\n if(isPrimitiveType(obj)) {\n obj = object(obj);\n }\n if(noKeysInStringObjects && isString(obj)) {\n forceStringCoercion(obj);\n }\n return obj;\n }",
"function DartObject(o) {\n this.o = o;\n}",
"function _functionCoerce(obj) {\n return obj.name + '=>' + obj.toString();\n}",
"function object_object(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (Object(util[\"e\" /* isEmptyValue */])(value) && !rule.required) {\n return callback();\n }\n es_rule.required(rule, value, source, errors, options);\n if (value !== undefined) {\n es_rule.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}",
"function makeEvent(obj) {\n // obj = { type:'ATTACK', value:7, stat:'crew' }\n // Deconstruct obj into variables from it's properties\n const { type, notification, text, value, products, stat } = obj // {type, value, stat}\n console.log(type, notification, text, value, products, stat)\n switch(obj.type) {\n case 'ATTACK':\n return new EventType(type, notification, text)\n case 'STAT-CHANGE': \n return new StatChange(type, notification, text, value, stat)\n case 'SHOP':\n return new ShopEvent(type, notification, text, products)\n default: \n return {} // Handle \n }\n}"
]
| [
"0.62795913",
"0.58345985",
"0.5788902",
"0.57155055",
"0.57155055",
"0.5026582",
"0.49509013",
"0.49452564",
"0.4928153",
"0.47949854",
"0.47505236",
"0.46887055",
"0.46710858",
"0.46704477",
"0.4661458",
"0.4661458",
"0.4661458",
"0.4661458",
"0.4661458",
"0.46578354",
"0.46533236",
"0.46267876",
"0.4612821",
"0.46125644",
"0.46116617",
"0.46070564",
"0.4594809",
"0.457669",
"0.4542776",
"0.4510258"
]
| 0.8270871 | 0 |
Function: descriptorToObject Usage: update a JavaScript Object from an ActionDescriptor Input: JavaScript Object (o), current object to update (output) Photoshop ActionDescriptor (d), descriptor to pull new params for object from JavaScript Function (f), post process converter utility to convert Return: Nothing, update is applied to passed in JavaScript Object (o) NOTE: Only boolean, string, and number are supported, use a post processor to convert (f) other types to one of these forms. | function descriptorToObject (o, d, f) {
var l = d.count;
for (var i = 0; i < l; i++ ) {
var k = d.getKey(i); // i + 1 ?
var t = d.getType(k);
strk = app.typeIDToStringID(k);
switch (t) {
case DescValueType.BOOLEANTYPE:
o[strk] = d.getBoolean(k);
break;
case DescValueType.STRINGTYPE:
o[strk] = d.getString(k);
break;
case DescValueType.DOUBLETYPE:
o[strk] = d.getDouble(k);
break;
case DescValueType.INTEGERTYPE:
case DescValueType.ALIASTYPE:
case DescValueType.CLASSTYPE:
case DescValueType.ENUMERATEDTYPE:
case DescValueType.LISTTYPE:
case DescValueType.OBJECTTYPE:
case DescValueType.RAWTYPE:
case DescValueType.REFERENCETYPE:
case DescValueType.UNITDOUBLE:
default:
throw( new Error("Unsupported type in descriptorToObject " + t ) );
}
}
if (undefined != f) {
o = f(o);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function objectToDescriptor (o, f) {\r\n\tif (undefined != f) {\r\n\t\to = f(o);\r\n\t}\r\n\tvar d = new ActionDescriptor;\r\n\tvar l = o.reflect.properties.length;\r\n\tfor (var i = 0; i < l; i++ ) {\r\n\t\tvar k = o.reflect.properties[i].toString();\r\n\t\tif (k == \"__proto__\" || k == \"__count__\" || k == \"__class__\" || k == \"reflect\")\r\n\t\t\tcontinue;\r\n\t\tvar v = o[ k ];\r\n\t\tk = app.stringIDToTypeID(k);\r\n\t\tswitch ( typeof(v) ) {\r\n\t\t\tcase \"boolean\":\r\n\t\t\t\td.putBoolean(k, v);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"string\":\r\n\t\t\t\td.putString(k, v);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"number\":\r\n\t\t\t\td.putDouble(k, v);\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tthrow( new Error(\"Unsupported type in objectToDescriptor \" + typeof(v) ) );\r\n\t\t}\r\n\t}\r\n return d;\r\n}",
"function DescriptorToObject(o, d, f) {\n\tvar l = d.count;\n\tfor (var i = 0; i < l; i++) {\n\t\tvar k = d.getKey(i);\n\t\tvar t = d.getType(k);\n\t\tvar strk = app.typeIDToStringID(k);\n if (strk.length == 0) {\n strk = app.typeIDToCharID(k);\n }\n\t\tswitch (t) {\n\t\t\tcase DescValueType.BOOLEANTYPE:\n\t\t\t\to[strk] = d.getBoolean(k);\n\t\t\t\tbreak;\n\t\t\tcase DescValueType.STRINGTYPE:\n\t\t\t\to[strk] = d.getString(k);\n\t\t\t\tbreak;\n\t\t\tcase DescValueType.DOUBLETYPE:\n\t\t\t\to[strk] = d.getDouble(k);\n\t\t\t\tbreak;\n\t\t\tcase DescValueType.INTEGERTYPE:\n o[strk] = d.getInteger(k);\n break;\n case DescValueType.LARGEINTEGERTYPE:\n \to[strk] = d.getLargeInteger(k);\n \tbreak;\n\t\t\tcase DescValueType.OBJECTTYPE:\n var newT = d.getObjectType(k);\n var newV = d.getObjectValue(k);\n o[strk] = new Object();\n DescriptorToObject(o[strk], newV, f);\n break;\n\t\t\tcase DescValueType.UNITDOUBLE:\n var newT = d.getUnitDoubleType(k);\n var newV = d.getUnitDoubleValue(k);\n o[strk] = new Object();\n o[strk].type = typeIDToCharID(newT);\n o[strk].typeString = typeIDToStringID(newT);\n o[strk].value = newV;\n break;\n\t\t\tcase DescValueType.ENUMERATEDTYPE:\n var newT = d.getEnumerationType(k);\n var newV = d.getEnumerationValue(k);\n o[strk] = new Object();\n o[strk].type = typeIDToCharID(newT);\n o[strk].typeString = typeIDToStringID(newT);\n o[strk].value = typeIDToCharID(newV);\n o[strk].valueString = typeIDToStringID(newV);\n break;\n\t\t\tcase DescValueType.CLASSTYPE:\n o[strk] = d.getClass(k);\n break;\n\t\t\tcase DescValueType.ALIASTYPE:\n o[strk] = d.getPath(k);\n break;\n\t\t\tcase DescValueType.RAWTYPE:\n var tempStr = d.getData(k);\n o[strk] = new Array();\n for (var tempi = 0; tempi < tempStr.length; tempi++) { \n o[strk][tempi] = tempStr.charCodeAt(tempi); \n }\n break;\n\t\t\tcase DescValueType.REFERENCETYPE:\n var ref = d.getReference(k);\n o[strk] = new Object();\n ReferenceToObject(o[strk], ref, f);\n break;\n\t\t\tcase DescValueType.LISTTYPE:\n var list = d.getList(k);\n o[strk] = new Array();\n ListToObject(o[strk], list, f);\n break;\n\t\t\tdefault:\n\t\t\t\tmyLogging.LogIt(\"Unsupported type in descriptorToObject \" + t);\n\t\t}\n\t}\n\tif (undefined != f) {\n\t\to = f(o);\n\t}\n}",
"function convertToDescriptor(desc) {\r\n\t\t\tfunction hasProperty(obj, prop) {\r\n\t\t\t\treturn Object.prototype.hasOwnProperty.call(obj, prop);\r\n\t\t\t}\r\n\r\n\t\t\tfunction isCallable(v) {\r\n\t\t\t\t// NB: modify as necessary if other values than functions are\r\n\t\t\t\t// callable.\r\n\t\t\t\treturn typeof v === \"function\";\r\n\t\t\t}\r\n\r\n\t\t\tif (typeof desc !== \"object\" || desc === null)\r\n\t\t\t\tthrow new TypeError(\"bad desc\");\r\n\r\n\t\t\tvar d = {};\r\n\t\t\tif (hasProperty(desc, \"enumerable\"))\r\n\t\t\t\td.enumerable = !!obj.enumerable;\r\n\t\t\tif (hasProperty(desc, \"configurable\"))\r\n\t\t\t\td.configurable = !!obj.configurable;\r\n\t\t\tif (hasProperty(desc, \"value\"))\r\n\t\t\t\td.value = obj.value;\r\n\t\t\tif (hasProperty(desc, \"writable\"))\r\n\t\t\t\td.writable = !!desc.writable;\r\n\t\t\tif (hasProperty(desc, \"get\")) {\r\n\t\t\t\tvar g = desc.get;\r\n\t\t\t\tif (!isCallable(g) && g !== \"undefined\")\r\n\t\t\t\t\tthrow new TypeError(\"bad get\");\r\n\t\t\t\td.get = g;\r\n\t\t\t}\r\n\t\t\tif (hasProperty(desc, \"set\")) {\r\n\t\t\t\tvar s = desc.set;\r\n\t\t\t\tif (!isCallable(s) && s !== \"undefined\")\r\n\t\t\t\t\tthrow new TypeError(\"bad set\");\r\n\t\t\t\td.set = s;\r\n\t\t\t}\r\n\r\n\t\t\tif ((\"get\" in d || \"set\" in d) && (\"value\" in d || \"writable\" in d))\r\n\t\t\t\tthrow new TypeError(\"identity-confused descriptor\");\r\n\r\n\t\t\treturn d;\r\n\t\t}",
"function _getWrappedActionDescriptor(desc, props, id)\n{\n var fn = function (desc, props, id, name, value)\n {\n if (typeof value === 'undefined')\n {\n try{\n return _getDescriptorProperty(desc, s2id(name));\n } catch (e) {\n log.warn(['Invalid layer property: \"', name, '\".'].join(''));\n return;\n }\n } else {\n throw new Error(['Property \"', name, '\" is read-only.'].join(''));\n }\n\n var prop = props[name];\n\n if (typeof value === 'undefined')\n {\n // Get\n if (prop.get)\n {\n // Use custom getter for this property\n return prop.get.call(null, prop, id, desc);\n }\n else\n {\n // Call generic getter\n return _getDescriptorProperty(desc, prop.typeId, prop.type);\n }\n }\n else\n {\n // Set\n if (!prop.set)\n throw new Error(['Property \"', name, '\" is read-only.'].join(''));\n\n // Set value\n prop.set.call(null, prop, id, value);\n }\n };\n\n return {\n innerDescriptor: desc,\n prop: fn.bind(null, desc, props, id),\n };\n}",
"function ListToObject(a, l, f) {\n\tvar c = l.count;\n\tfor (var i = 0; i < c; i++) {\n\t\tvar t = l.getType(i);\n\t\tswitch (t) {\n\t\t\tcase DescValueType.BOOLEANTYPE:\n\t\t\t\ta.push(l.getBoolean(i));\n\t\t\t\tbreak;\n\t\t\tcase DescValueType.STRINGTYPE:\n\t\t\t\ta.push(l.getString(i));\n\t\t\t\tbreak;\n\t\t\tcase DescValueType.DOUBLETYPE:\n\t\t\t\ta.push(l.getDouble(i));\n\t\t\t\tbreak;\n\t\t\tcase DescValueType.INTEGERTYPE:\n a.push(l.getInteger(i));\n break;\n case DescValueType.LARGEINTEGERTYPE:\n \ta.push(l.getLargeInteger(i));\n \tbreak;\n\t\t\tcase DescValueType.OBJECTTYPE:\n var newT = l.getObjectType(i);\n var newV = l.getObjectValue(i);\n var newO = new Object();\n a.push(newO);\n DescriptorToObject(newO, newV, f);\n break;\n\t\t\tcase DescValueType.UNITDOUBLE:\n var newT = l.getUnitDoubleType(i);\n var newV = l.getUnitDoubleValue(i);\n var newO = new Object();\n a.push(newO);\n newO.type = typeIDToCharID(newT);\n newO.typeString = typeIDToStringID(newT);\n newO.value = newV;\n break;\n\t\t\tcase DescValueType.ENUMERATEDTYPE:\n var newT = l.getEnumerationType(i);\n var newV = l.getEnumerationValue(i);\n var newO = new Object();\n a.push(newO);\n newO.type = typeIDToCharID(newT);\n newO.typeString = typeIDToStringID(newT);\n newO.value = typeIDToCharID(newV);\n newO.valueString = typeIDToStringID(newV);\n break;\n\t\t\tcase DescValueType.CLASSTYPE:\n a.push(l.getClass(i));\n break;\n\t\t\tcase DescValueType.ALIASTYPE:\n a.push(l.getPath(i));\n break;\n\t\t\tcase DescValueType.RAWTYPE:\n var tempStr = l.getData(i);\n tempArray = new Array();\n for (var tempi = 0; tempi < tempStr.length; tempi++) { \n tempArray[tempi] = tempStr.charCodeAt(tempi); \n }\n a.push(tempArray);\n break;\n\t\t\tcase DescValueType.REFERENCETYPE:\n var ref = l.getReference(i);\n var newO = new Object();\n a.push(newO);\n ReferenceToObject(newO, ref, f);\n break;\n\t\t\tcase DescValueType.LISTTYPE:\n var list = l.getList(i);\n var newO = new Object();\n a.push(newO);\n ListToObject(newO, list, f);\n break;\n\t\t\tdefault:\n\t\t\t\tmyLogging.LogIt(\"Unsupported type in descriptorToObject \" + t);\n\t\t}\n\t}\n\tif (undefined != f) {\n\t\to = f(o);\n\t}\n}",
"function unwrapDescriptor(descriptor) {\n if (hasOwnProperty.call(descriptor, 'value')) {\n descriptor.value = unwrap(descriptor.value);\n }\n return descriptor;\n }",
"function convertEnums(obj) {\n if (!'componentEvent' in obj) return obj;\n if (!'component' in obj.componentEvent) return obj;\n var newObj = JSON.parse(JSON.stringify(obj));\n newObj.componentEvent.action = actions[obj.componentEvent.action];\n newObj.componentEvent.component.componentType =\n componentTypes[obj.componentEvent.component.componentType];\n return newObj;\n }",
"_dehydrateArg(arg) {\n if (typeof arg === \"string\") {\n return ({\n type: \"string\",\n value: String(arg)\n });\n } else if (typeof arg === \"function\") {\n // store a pointer to the function in the function lib\n let functionPointerName = \"f@\" + this._functionPointerCounter;\n this._functionPointerCounter++;\n this._functionPointerLib.put(functionPointerName, arg);\n return ({\n type: \"function\",\n name: functionPointerName\n });\n } else if (typeof arg === \"number\") {\n return ({\n type: \"number\",\n value: arg\n });\n } else if (typeof arg === \"boolean\") {\n return ({\n type: \"boolean\",\n value: arg\n })\n } else if (typeof arg === \"object\") {\n\n if (arg.constructor.name === \"Array\") {\n let argDef = {\n type: \"array\",\n elements: [],\n };\n\n arg.forEach(element => {\n argDef.elements.push(this._dehydrateArg(element));\n });\n\n return argDef;\n } else {\n let argDef = {\n type: \"object\",\n properties: {},\n };\n\n for (let prop in arg) {\n if (arg.hasOwnProperty(prop)) {\n argDef.properties[prop] = this._dehydrateArg(arg[prop]);\n }\n }\n\n return argDef;\n }\n\n // return ({\n // type: \"json\",\n // value: JSON.stringify(arg)\n // })\n } else {\n throw new Error(\"Unsupported argument type for arg: \" + arg)\n }\n }",
"function buildFromObject({ declaration, name, mapActionType }) {\n if (typeof declaration === 'object') {\n return () => ensureActionType(declaration, name, mapActionType);\n }\n return null;\n}",
"function ConvertAndCopyTo(destDescr,\n destTypedObj,\n destOffset,\n fieldName,\n fromValue)\n{\n assert(IsObject(destDescr) && ObjectIsTypeDescr(destDescr),\n \"ConvertAndCopyTo: not type obj\");\n assert(IsObject(destTypedObj) && ObjectIsTypedObject(destTypedObj),\n \"ConvertAndCopyTo: not type typedObj\");\n\n if (!TypedObjectIsAttached(destTypedObj))\n ThrowTypeError(JSMSG_TYPEDOBJECT_HANDLE_UNATTACHED);\n\n TypedObjectSet(destDescr, destTypedObj, destOffset, fieldName, fromValue);\n}",
"function unwrapDescriptor(descriptor) {\n if (hasOwnProperty$2.call(descriptor, 'value')) {\n descriptor.value = unwrap(descriptor.value);\n }\n\n return descriptor;\n }",
"function convertFromHDRNoDialog( newDepth, srcDesc )\n{\n\tfunction descCopyNum( key )\n\t{\n\t\ttoneDesc.putDouble( key, srcDesc.getDouble( key ));\n\t}\n\n function descCopyFlag( key )\n {\n toneDesc.putBoolean( key, srcDesc.getBoolean( key ));\n }\n\n\targs = new ActionDescriptor();\n\targs.putInteger( keyDepth, newDepth );\n\t\n\tvar toneDesc = new ActionDescriptor();\n\t\n\ttoneDesc.putInteger( kversionStr, 4 );\n\n\tvar method = srcDesc.getInteger( kmethodStr );\n\tswitch (method)\n\t{\n\t\t// Methods provided from the Dept. of Mismatched Constants.\n\t\tcase 0:\t// kHighlightCompression\n\t\t{\n\t\t\ttoneDesc.putEnumerated( keyMethod, khdrToningMethodTypeStr, khdrToningType1Str );\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tcase 2:\t// kEqualizeHistogram\n\t\t{\n\t\t\ttoneDesc.putEnumerated( keyMethod, khdrToningMethodTypeStr, khdrToningType3Str );\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tcase 1:\t// kExposureAndGamma\n\t\t{\n\t\t\ttoneDesc.putEnumerated( keyMethod, khdrToningMethodTypeStr, khdrToningType2Str );\n\t\t\tdescCopyNum( kgammaStr );\n\t\t\tdescCopyNum( kexposureStr );\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tcase 3:\t// kLocalAdaptation\n\t\t{\n\t\t\ttoneDesc.putEnumerated( keyMethod, khdrToningMethodTypeStr, khdrToningType4Str );\n\t\t\t\n\t\t\t// Need special case handling for kexposure\n\t\t\tdescCopyNum( kradiusStr );\n\t\t\tdescCopyNum( kthresholdStr );\n\t\t\tdescCopyNum( ksaturationStr );\n\t\t\tdescCopyNum( kvibranceStr );\n\t\t\tdescCopyNum( kdetailStr );\n\t\t\tdescCopyNum( kshallowStr );\n\t\t\tdescCopyNum( khighlightsStr );\n\t\t\tdescCopyNum( kcontrastStr );\n\t\t\tdescCopyNum( kbrightnessStr );\n\t\t\tdescCopyFlag( ksmoothStr );\n\t\t\t\n // Copy the toning curve as well\n var srcCurve = srcDesc.getObjectValue( kclassContour );\n var srcCurvePts = srcCurve.getList( keyCurve );\n\t\t\t\n\t\t\tvar pointList = new ActionList();\n\t\t\tvar i, curveDesc = new ActionDescriptor()\n\t\t\tcurveDesc.putString( keyName, \"Default\" );\n \n for (i = 0; i < srcCurvePts.count; ++i)\n {\n var srcPt = srcCurvePts.getObjectValue(i);\n var ptDesc = new ActionDescriptor();\n ptDesc.putDouble( keyHorizontal, srcPt.getDouble( keyHorizontal ) );\n ptDesc.putDouble( keyVertical, srcPt.getDouble( keyVertical ) );\n ptDesc.putBoolean( keyContinuity, srcPt.getBoolean( keyContinuity ) );\n pointList.putObject( classCurvePoint, ptDesc );\n }\n \n\t\t\tcurveDesc.putList( keyCurve, pointList );\n\t\t\ttoneDesc.putObject( kclassContour, classShapingCurve, curveDesc );\n\t\t\tbreak;\n\t\t}\n\t}\n\n\targs.putObject( keyWith, khdrOptionsStr, toneDesc );\n\texecuteAction( eventConvertMode, args, DialogModes.NO );\n}",
"function toPropertyDescriptor(obj) {\n if (Object(obj) !== obj) {\n throw new TypeError(\"property descriptor should be an Object, given: \"+\n obj);\n }\n var desc = {};\n if ('enumerable' in obj) { desc.enumerable = !!obj.enumerable; }\n if ('configurable' in obj) { desc.configurable = !!obj.configurable; }\n if ('value' in obj) { desc.value = obj.value; }\n if ('writable' in obj) { desc.writable = !!obj.writable; }\n if ('get' in obj) {\n var getter = obj.get;\n if (getter !== undefined && typeof getter !== \"function\") {\n throw new TypeError(\"property descriptor 'get' attribute must be \"+\n \"callable or undefined, given: \"+getter);\n }\n desc.get = getter;\n }\n if ('set' in obj) {\n var setter = obj.set;\n if (setter !== undefined && typeof setter !== \"function\") {\n throw new TypeError(\"property descriptor 'set' attribute must be \"+\n \"callable or undefined, given: \"+setter);\n }\n desc.set = setter;\n }\n if ('get' in desc || 'set' in desc) {\n if ('value' in desc || 'writable' in desc) {\n throw new TypeError(\"property descriptor cannot be both a data and an \"+\n \"accessor descriptor: \"+obj);\n }\n }\n return desc;\n}",
"function toPropertyDescriptor(obj) {\n if (Object(obj) !== obj) {\n throw new TypeError(\"property descriptor should be an Object, given: \"+\n obj);\n }\n var desc = {};\n if ('enumerable' in obj) { desc.enumerable = !!obj.enumerable; }\n if ('configurable' in obj) { desc.configurable = !!obj.configurable; }\n if ('value' in obj) { desc.value = obj.value; }\n if ('writable' in obj) { desc.writable = !!obj.writable; }\n if ('get' in obj) {\n var getter = obj.get;\n if (getter !== undefined && typeof getter !== \"function\") {\n throw new TypeError(\"property descriptor 'get' attribute must be \"+\n \"callable or undefined, given: \"+getter);\n }\n desc.get = getter;\n }\n if ('set' in obj) {\n var setter = obj.set;\n if (setter !== undefined && typeof setter !== \"function\") {\n throw new TypeError(\"property descriptor 'set' attribute must be \"+\n \"callable or undefined, given: \"+setter);\n }\n desc.set = setter;\n }\n if ('get' in desc || 'set' in desc) {\n if ('value' in desc || 'writable' in desc) {\n throw new TypeError(\"property descriptor cannot be both a data and an \"+\n \"accessor descriptor: \"+obj);\n }\n }\n return desc;\n}",
"function unwrapDescriptor$1(descriptor) {\n if (hasOwnProperty$2$1.call(descriptor, 'value')) {\n descriptor.value = unwrap$1(descriptor.value);\n }\n\n return descriptor;\n }",
"function TypedObjectSet(descr, typedObj, offset, name, fromValue) {\n if (!TypedObjectIsAttached(typedObj))\n ThrowTypeError(JSMSG_TYPEDOBJECT_HANDLE_UNATTACHED);\n\n switch (DESCR_KIND(descr)) {\n case JS_TYPEREPR_SCALAR_KIND:\n TypedObjectSetScalar(descr, typedObj, offset, fromValue);\n return;\n\n case JS_TYPEREPR_REFERENCE_KIND:\n TypedObjectSetReference(descr, typedObj, offset, name, fromValue);\n return;\n\n case JS_TYPEREPR_ARRAY_KIND:\n var length = DESCR_ARRAY_LENGTH(descr);\n if (TypedObjectSetArray(descr, length, typedObj, offset, fromValue))\n return;\n break;\n\n case JS_TYPEREPR_STRUCT_KIND:\n if (!IsObject(fromValue))\n break;\n\n // Adapt each field.\n var fieldNames = DESCR_STRUCT_FIELD_NAMES(descr);\n var fieldDescrs = DESCR_STRUCT_FIELD_TYPES(descr);\n var fieldOffsets = DESCR_STRUCT_FIELD_OFFSETS(descr);\n for (var i = 0; i < fieldNames.length; i++) {\n var fieldName = fieldNames[i];\n var fieldDescr = fieldDescrs[i];\n var fieldOffset = fieldOffsets[i];\n var fieldValue = fromValue[fieldName];\n TypedObjectSet(fieldDescr, typedObj, offset + fieldOffset, fieldName, fieldValue);\n }\n return;\n }\n\n ThrowTypeError(JSMSG_CANT_CONVERT_TO,\n typeof(fromValue),\n DESCR_STRING_REPR(descr));\n}",
"static initialize(obj, actorObject, actionRelationship, actionObject) { \n obj['actor_object'] = actorObject;\n obj['action_relationship'] = actionRelationship;\n obj['action_object'] = actionObject;\n }",
"function convertActionBinding(localResolver,implicitReceiver,action,bindingId,interpolationFunction){if(!localResolver){localResolver=new DefaultLocalResolver();}var actionWithoutBuiltins=convertPropertyBindingBuiltins({createLiteralArrayConverter:function createLiteralArrayConverter(argCount){// Note: no caching for literal arrays in actions.\nreturn function(args){return literalArr(args);};},createLiteralMapConverter:function createLiteralMapConverter(keys){// Note: no caching for literal maps in actions.\nreturn function(values){var entries=keys.map(function(k,i){return{key:k.key,value:values[i],quoted:k.quoted};});return literalMap(entries);};},createPipeConverter:function createPipeConverter(name){throw new Error(\"Illegal State: Actions are not allowed to contain pipes. Pipe: \"+name);}},action);var visitor=new _AstToIrVisitor(localResolver,implicitReceiver,bindingId,interpolationFunction);var actionStmts=[];flattenStatements(actionWithoutBuiltins.visit(visitor,_Mode.Statement),actionStmts);prependTemporaryDecls(visitor.temporaryCount,bindingId,actionStmts);var lastIndex=actionStmts.length-1;var preventDefaultVar=null;if(lastIndex>=0){var lastStatement=actionStmts[lastIndex];var returnExpr=convertStmtIntoExpression(lastStatement);if(returnExpr){// Note: We need to cast the result of the method call to dynamic,\n// as it might be a void method!\npreventDefaultVar=createPreventDefaultVar(bindingId);actionStmts[lastIndex]=preventDefaultVar.set(returnExpr.cast(DYNAMIC_TYPE).notIdentical(literal(false))).toDeclStmt(null,[StmtModifier.Final]);}}return new ConvertActionBindingResult(actionStmts,preventDefaultVar);}",
"function ReferenceToObject(o, r, f) {\n // TODO : seems like I should output the desiredClass information here\n // maybe all references have a name, index, etc. and then the are either undefined\n // what about clobber, can I get an index in an index and then that would not work\n // should the second loop be doing something different?\n var originalRef = r;\n\twhile (r != null) {\n\t\tvar refForm = r.getForm();\n var refClass = r.getDesiredClass();\n var strk = app.typeIDToStringID(refClass);\n if (strk.length == 0) {\n strk = app.typeIDToCharID(refClass);\n }\n\t\tswitch (refForm) {\n\t\t\tcase ReferenceFormType.NAME:\n\t\t\t\to[\"name\"] = r.getName();\n\t\t\t\tbreak;\n\t\t\tcase ReferenceFormType.INDEX:\n\t\t\t\to[\"index\"] = r.getIndex();\n\t\t\t\tbreak;\n\t\t\tcase ReferenceFormType.IDENTIFIER:\n o[\"indentifier\"] = r.getIdentifier();\n break;\n\t\t\tcase ReferenceFormType.OFFSET:\n o[\"offset\"] = r.getOffset();\n break;\n\t\t\tcase ReferenceFormType.ENUMERATED:\n var newT = r.getEnumeratedType();\n var newV = r.getEnumeratedValue();\n o[\"enumerated\"] = new Object();\n o[\"enumerated\"].type = typeIDToCharID(newT);\n o[\"enumerated\"].typeString = typeIDToStringID(newT);\n o[\"enumerated\"].value = typeIDToCharID(newV);\n o[\"enumerated\"].valueString = typeIDToStringID(newV);\n break;\n\t\t\tcase ReferenceFormType.PROPERTY:\n o[\"property\"] = app.typeIDToStringID(r.getProperty());\n if (o[\"property\"].length == 0) {\n o[\"property\"] = app.typeIDToCharID(r.getProperty());\n }\n break;\n\t\t\tcase ReferenceFormType.CLASSTYPE:\n o[\"class\"] = refClass; // i already got that r.getDesiredClass(k);\n break;\n\t\t\tdefault:\n\t\t\t\tmyLogging.LogIt(\"Unsupported type in referenceToObject \" + t);\n\t\t}\n r = r.getContainer();\n try {\n r.getDesiredClass();\n } catch(e) {\n r = null;\n }\n\t}\n\tif (undefined != f) {\n\t\to = f(o);\n\t}\n}",
"function updateObject(object, key, value) {\n object[arguments[1]] = value;\n return object;\n}",
"objd(obj) {\n\n return toObject(obj);\n }",
"function Reify(sourceDescr,\n sourceTypedObj,\n sourceOffset) {\n assert(IsObject(sourceDescr) && ObjectIsTypeDescr(sourceDescr),\n \"Reify: not type obj\");\n assert(IsObject(sourceTypedObj) && ObjectIsTypedObject(sourceTypedObj),\n \"Reify: not type typedObj\");\n\n if (!TypedObjectIsAttached(sourceTypedObj))\n ThrowTypeError(JSMSG_TYPEDOBJECT_HANDLE_UNATTACHED);\n\n return TypedObjectGet(sourceDescr, sourceTypedObj, sourceOffset);\n}",
"function fromJSON(object) {\n if (object instanceof ops.Op) return object; // If already patch, return it\n if (object === undefined) return ops.NOP;\n if (object.op) {\n if (object.op === ops.Rpl.name)\n return new ops.Rpl(object.data);\n if (object.op === ops.Ins.name)\n return new ops.Ins(object.data);\n else if (object.op === ops.NOP.name)\n return ops.NOP;\n else if (object.op === ops.DEL.name)\n return ops.DEL;\n else if (object.op === ops.Mrg.name) \n return new ops.Mrg(utils.map(object.data, fromJSON));\n else if (object.op === ops.Map.name) \n return new ops.Map(object.data.map(([key,op]) => [key, fromJSON(op)]));\n else if (object.op === ops.Arr.name) \n return new ops.Arr(object.data.map(([key,op]) => [key, fromJSON(op)]));\n else throw new Error('unknown diff.op ' + object.op);\n } else {\n return new ops.Rpl(object); \n } \n}",
"function actionCreator(payloadValue) {\n //a.1. return action object\n return {\n //a.2. action type(NEEDED)\n type: 'ACTION_TYPE',\n //a.3. payload and any other key needed only based on what you want to do\n payload: payloadValue\n }\n }",
"function _valueOf(value) {\n var p = {};\n switch (value.type) {\n case 'object':\n p.value = {\n description: value.className,\n hasChildren: true,\n injectedScriptId: value.ref || value.handle,\n type: 'object'\n };\n break;\n case 'function':\n p.value = {\n description: value.text || 'function()',\n hasChildren: true,\n injectedScriptId: value.ref || value.handle,\n type: 'function'\n };\n break;\n case 'undefined':\n p.value = {description: 'undefined'};\n break;\n case 'null':\n p.value = {description: 'null'};\n break;\n case 'script':\n p.value = {description: value.text};\n break;\n default:\n p.value = {description: value.value};\n break;\n }\n return p;\n }",
"function toJava(obj){\n if(obj instanceof Array){\n return toArray(obj);\n } else if(obj instanceof java.lang.Object){\n return obj;\n } else if(typeof obj == \"object\"){\n return toMap(obj);\n } else{\n return obj;\n }\n}",
"updateDescriptor(aInstallLocation, aOldAddon, aAddonState) {\n logger.debug(\"Add-on \" + aOldAddon.id + \" moved to \" + aAddonState.descriptor);\n aOldAddon.descriptor = aAddonState.descriptor;\n aOldAddon._sourceBundle.persistentDescriptor = aAddonState.descriptor;\n\n return aOldAddon;\n }",
"function castToFabricObject(obj) {\n if(obj) {\n var returnObj;\n if(obj.type == TOOL.RECTANGLE) {\n returnObj = new fabric.Rect(obj);\n } else if (obj.type == TOOL.ELLIPSE) {\n returnObj = new fabric.Ellipse(obj);\n } else if (obj.type == TOOL.LINE) {\n\n var x2 = (obj.x1 < 0) ? obj.left + obj.width : obj.left - obj.width;\n var y2 = (obj.y1 < 0) ? obj.top + obj.height : obj.top - obj.height;\n\n returnObj = new fabric.Line([obj.left, obj.top,\n x2,y2], obj);\n } else if (obj.type == TOOL.TEXT) {\n returnObj = new fabric.IText(\"\", {\n left: obj.left,\n top: obj.top,\n fontFamily: obj.fontFamily,\n fontSize: obj.fontSize,\n fill: obj.fill,\n fontStyle: obj.fontStyle,\n textDecoration: obj.textDecoration,\n fontWeight: obj.fontWeight\n });\n } else if (obj.type == TOOL.PENCIL) {\n\n var path = obj.path;\n var SVGString = \"\";\n for(var i = 0; i < path.length; i++) {\n SVGString += path[i].join(\" \") + \" \";\n }\n SVGString.trim();\n\n returnObj = new fabric.Path(SVGString, {\n strokeWidth: obj.strokeWidth,\n stroke: obj.stroke,\n fill: null\n });\n }else {\n return null;\n }\n\n /**\n * After casting, the attribute \"selectable\" of the new fabricjs is set to true by default.\n * Therefore, its 'selectable' attribute has to be set based on the canvas.selection\n */\n returnObj.selectable = canvas.selection;\n\n return returnObj;\n } else {\n return null;\n }\n}",
"function Action(i, n, oFunc, dft) {\n\tthis.id = i;\n this.name = n;\n\tthis.optionFunc = oFunc;\n\tthis.defaultVal = dft;\t\t// Default actionParam value - may be undefined\n}",
"createFromAction(from, newProperties) {\n return this.create({ ...from.payload, ...newProperties });\n }"
]
| [
"0.75533724",
"0.6569119",
"0.5526549",
"0.51103747",
"0.5047909",
"0.4884658",
"0.48834768",
"0.4799259",
"0.4798489",
"0.4789828",
"0.47839227",
"0.47755012",
"0.47672334",
"0.47672334",
"0.4724588",
"0.46902186",
"0.46416414",
"0.4628304",
"0.45911044",
"0.4453492",
"0.44394946",
"0.441692",
"0.43729496",
"0.4370529",
"0.43593737",
"0.43264318",
"0.4306833",
"0.43002003",
"0.42986378",
"0.4294813"
]
| 0.718284 | 1 |
Function: StrToIntWithDefault Usage: convert a string to a number, first stripping all characters Input: string and a default number Return: a number | function StrToIntWithDefault( s, n ) {
var onlyNumbers = /[^0-9]/g;
var t = s.replace( onlyNumbers, "" );
t = parseInt( t );
if ( ! isNaN( t ) ) {
n = t;
}
return n;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function strToIntWithDefault(s, n) { //把字符串转换为数字\n\n\tvar onlyNumbers = /[^0-9]/g,\n\t\tt = s.replace(onlyNumbers, '');\n\n\tt = parseInt(t, 10);\n\n\tif (!isNaN(t)) {\n\t\tn = t;\n\t}\n\n\treturn n;\n}",
"function TryParseInt(str, defaultValue){\n var retValue = defaultValue;\n if(str != null){\n if(jQuery.trim(new String(str)).length > 0){\n if (!isNaN(str)){\n retValue = parseInt(str);\n }\n }\n } \n return retValue; \n}",
"function getNumberFromString(s) {\n return +s.replace(/\\D/g, \"\");\n}",
"function parseIntMaybe(string) {\n var parsed = parseInt(string);\n return !isNaN(parsed) ? parsed : string;\n}",
"function convertStringToInt(string) {\n\tif(!isNaN(parseInt(string, 10))) {\n\t\t/* https://stackoverflow.com/questions/10398834/using-javascript-parseint-and-a-radix-parameter */\n\t\treturn parseInt(string, 10)\n\t} else {\n\t\treturn string;\n\t}\n}",
"function getNumberFromString(s) {\n return Number(s.replace(/\\D/g, \"\"));\n}",
"function ConvertStringToNumber(str) {\n if (isEmptyOrWhiteSpace(str)) return 0;\n if (!isNaN(str)) return Number(str);\n return 0;\n}",
"function forceInt(strText, booLeftZero)\n{\n strText += '';\n booLeftZero = (empty(booLeftZero)) ? false : booLeftZero;\n var strNumbers = '1234567890\\n';\n var strNewText = '';\n for (var intCount = 0; intCount < strText.length; ++intCount) {\n if (strNumbers.indexOf(strText.charAt(intCount)) != -1)\n strNewText += strText.charAt(intCount);\n }\n if (strNewText === '')\n return '';\n if (!booLeftZero)\n strNewText = parseInt(strNewText, 10);\n return strNewText;\n}",
"function stringInt(str) {\n\treturn Number(str);\n}",
"function changeStrToNum(str){\n return Number(str)\n}",
"function tryInt(text){\n return isNaN(+text) ? text : +text;\n}",
"function changeToNumber(myString) {\n return parseInt(myString);\n}",
"function stringToNum(arg){\n return parseInt(arg);\n}",
"function stringToIntegerAlt(string) {\n numberCharacters = string.split('').filter((element) => (element >= '0' && element <= '9'))\n return +numberCharacters.join('');\n}",
"function getOnlyNumbers(str) {\n\t\tconst notNumbers = /\\D/g;\n\t\treturn parseInt(str.replace(notNumbers, \"\"));\n\t}",
"function convertToInt(stringValue) {\r\n var parseValue = parseInt(\"stringValue\");\r\n return parseValue;\r\n\r\n}",
"function parseToInt(inputString) {\n\tconst parsing = /^\\d+$/.exec(inputString);\n\treturn (parsing || [])[0];\n}",
"function stringToNumber(s)\n{\n return parseInt(('0' + s), 10)\n}",
"function getNumberFromString(s) {\n return +s.replace(/[^0-9.]/g,''); //remove all the alphabetic characters\n}",
"function string2int(str){\n var arr = [];\n for(let i=0;i<str.length;i++){\n arr.push(str.charAt(i)-0);\n }\n return arr.reduce(((x,y)=>x*10+y));\n}",
"function get_int(str, index) {\n var orig = index;\n while (str[index] >= '0' && str[index] <= '9') {\n index++;\n }\n return { value: parseInt(str.slice(orig)), len: index - orig };\n}",
"function parseFirstInt(input) {\n\nlet inputToParse = input;\n\nfor (let i = 0; i < input.length; i++) {\n let firstInt = parseInt(inputToParse);\n if (!Number.isNaN(firstInt)) {\n return firstInt;\n }\n inputToParse = inputToParse.substr(1);\n}\n\nreturn NaN;\n}",
"function strToNum() {\n if (activeString !== '') {\n activeNum = Number(activeString);\n };\n }",
"function getNumFromString(fullStr, numTrailingChars = 0, numPreceedingChars = 0) {\n\tconsole.log(\"fullStr: \" + fullStr + \"; trailing: \" + numTrailingChars + \", preceeding: \" + numPreceedingChars);\n\tfullStr = fullStr.slice(numPreceedingChars, /*fullStr.length - (*/-numTrailingChars/* + 1)*/);\n\tconsole.log(fullStr);\n\tlet retVal = Number(fullStr);\n\tconsole.log(\"RetVal: \" + retVal);\n\treturn retVal;\n}",
"function _default(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\":\n i0 = i1 = i;\n break;\n\n case \"0\":\n if (i0 === 0) i0 = i;\n i1 = i;\n break;\n\n default:\n if (!+s[i]) break out;\n if (i0 > 0) i0 = 0;\n break;\n }\n }\n\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}",
"function _default(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\":\n i0 = i1 = i;\n break;\n\n case \"0\":\n if (i0 === 0) i0 = i;\n i1 = i;\n break;\n\n default:\n if (!+s[i]) break out;\n if (i0 > 0) i0 = 0;\n break;\n }\n }\n\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}",
"function convertStringToInt(str) {\n let int = Number(str);\n return int;\n}",
"function stringToNum(string) {\n return parseInt(string)\n}",
"function toNum(s, def) {\n return !isNaN(parseFloat(s)) ? parseFloat(s) : def;\n}",
"function makeStringNumeric(string) {\n\tif (!string){\n\t\treturn \"\";\n\t}\n\treturn string.replace(/[^0-9]/gmi, \"\");\n}"
]
| [
"0.82995236",
"0.6905283",
"0.67226857",
"0.66155624",
"0.66009635",
"0.65952545",
"0.6586593",
"0.6560997",
"0.6512591",
"0.64873964",
"0.6486105",
"0.64746135",
"0.6465985",
"0.6452506",
"0.6438687",
"0.6436834",
"0.6375978",
"0.6341577",
"0.63101",
"0.6306241",
"0.6300914",
"0.62516797",
"0.6228168",
"0.61663413",
"0.61657614",
"0.61657614",
"0.61651784",
"0.61580265",
"0.61471623",
"0.61461705"
]
| 0.83300906 | 0 |
Takes a lock object, and sends a request to that lock to unlock | function unlock_lock(lock, callback) {
let str = JSON.stringify({
Action: "TOGGLE"
})
send_command(lock, str)
callback(f.hacker.verb())
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async unlock() {\n\t\tif (this.lock_status_id === 2) {\n\t\t\treturn;\n\t\t}\n\t\tawait this.send_command(1);\n\t\tawait this.await_event('status:UNLOCKED');\n\t}",
"unlock() {\n this.locked = 0\n }",
"unlock() {\n this.isLocked = false;\n this.refreshState();\n }",
"unlock() {\n Atomics.store(this.sabArr, this.lockIndex, this.UNLOCKED);\n Atomics.notify(this.sabArr, this.lockIndex);\n }",
"handleUnlockAction() {\n const prNumber = this.appContext.payload.issue.number\n let prLock = new PrLock()\n\n // if user wants to unlock, and lock is held by current PR, unlock\n if (prLock.getPrNumber() == prNumber) {\n this.appContext.log(\"received unlock request, unlocking...\")\n prLock.unlock(prNumber)\n return ArgoBot.respondWithComment(this.appContext, \"Lock has been released!\")\n }\n else {\n // notify user to unlock from the PR that owns the lock\n this.appContext.log(\"received unlock request from the wrong PR\")\n const lockMessage = prLock.getLockInfo() + \"; is holding the lock, please comment on that PR to unlock\"\n return ArgoBot.respondWithComment(this.appContext, lockMessage)\n }\n }",
"unlock() {\n const that = this;\n\n that.locked = false;\n }",
"function unlock(wopi, req, res, userHost) {\n let requestLock = req.headers[reqConsts.requestHeaders.Lock.toLowerCase()];\n\n let userAddress = req.docManager.curUserHostAddress(userHost);\n let filePath = req.docManager.storagePath(wopi.id, userAddress);\n\n if (!lockManager.hasLock(filePath)) {\n // file isn't locked => mismatch\n returnLockMismatch(res, \"\", \"File isn't locked\");\n } else if (lockManager.getLock(filePath) == requestLock) {\n // lock matches current lock => unlock\n lockManager.unlock(filePath);\n res.sendStatus(200);\n } else {\n // lock mismatch\n returnLockMismatch(res, lockManager.getLock(filePath), \"Lock mismatch\");\n }\n}",
"function lock_lock(lock, callback) {\n unlock_lock(lock, callback)\n}",
"lock() {\n this.close();\n this.isLocked = true;\n this.refreshState();\n }",
"function unlockAndRelock(wopi, req, res, userHost) {\n let requestLock = req.headers[reqConsts.requestHeaders.Lock.toLowerCase()];\n let oldLock = req.headers[reqConsts.requestHeaders.oldLock.toLowerCase()]; // get the X-WOPI-OldLock header\n\n let userAddress = req.docManager.curUserHostAddress(userHost);\n let filePath = req.docManager.storagePath(wopi.id, userAddress);\n\n if (!lockManager.hasLock(filePath)) {\n // file isn't locked => mismatch\n returnLockMismatch(res, \"\", \"File isn't locked\");\n } else if (lockManager.getLock(filePath) == oldLock) {\n // lock matches current lock => lock with new key\n lockManager.lock(filePath, requestLock);\n res.sendStatus(200);\n } else {\n // lock mismatch\n returnLockMismatch(res, lockManager.getLock(filePath), \"Lock mismatch\");\n }\n}",
"function releaseLock() {\n if (lockCounter === 1) {\n setLocked(false);\n }\n\n --lockCounter;\n }",
"function handleLock(type) {\n\t\t\t//onLockRecived make the locking action according to the status of the object\n\t\t\treturn getLockingObject(type, onLockRecieved)\n\t\t}",
"unlock(key) {\n const me = this;\n\n me._unlock(key);\n }",
"unlock(updateData=true) {\n return new Promise((resolve, reject) => {\n this._getCreds()\n .then((creds) => {\n if (creds) {\n this.creds.deviceID = creds.deviceID;\n this.creds.password = creds.password;\n this.creds.endpoint = creds.endpoint || null;\n }\n return this._initSession();\n })\n .then(() => {\n return this._connect(updateData);\n })\n .then(() => {\n return resolve('Unlocked');\n })\n .catch((err) => {\n return reject(new Error(err));\n })\n })\n }",
"function unlock(cb) {\n lockFile.unlock(lock, function (err) {\n if (err) {\n console.error('\\n', err.stack || err, '\\n');\n }\n\n cb && cb();\n });\n}",
"async lock() {\n\t\tif (this.lock_status_id === 3) {\n\t\t\treturn;\n\t\t}\n\t\tawait this.send_command(0);\n\t\tawait this.await_event('status:LOCKED');\n\t}",
"function unlockNode(node){\n node.isLocked = false;\n node.currentOwner = \"NONE\";\n }",
"unlock(updateData=true) {\n return new Promise((resolve, reject) => {\n this._getCreds()\n .then((creds) => {\n if (creds) {\n this.creds.deviceID = creds.deviceID;\n this.creds.password = creds.password;\n }\n return this._initSession();\n })\n .then(() => {\n return this._connect(updateData);\n })\n .then(() => {\n return resolve('Unlocked');\n })\n .catch((err) => {\n return reject(new Error(err));\n })\n })\n }",
"function unlockNode(node) {\n node.isLocked = false;\n node.currentOwner = \"NONE\";\n}",
"unlockClaimTimeout() {\n this.claimLock = false;\n }",
"function sideChainCancelLockout(obj) {\n if(!currentLockinSecret || !currentLockinSecretHash) {\n alert(\"must prepare lockout and notify notary first\")\n return\n }\n showMaskLayer(\"cancel spectrum lockout,please wait ...\")\n $(\"#signTransaction\").text('');\n doSideChainCancelLockout()\n}",
"_unlock(key) {\n const me = this;\n\n debug(`${me._unlock.name}: ${key}`);\n\n if (me.keyLockCounterMap.has(key)) {\n let counter = me.keyLockCounterMap.get(key);\n\n if (counter !== 0) {\n me.keyLockCounterMap.set(key, --counter);\n\n if (counter === 0) {\n me.emit(`_unlock_${key}`);\n }\n }\n }\n }",
"function lockCallback(data) {\n if(data.acquired == true) {\n console.log(\"I got the lock!\");\n\n // send email notification\n sendMessage(data);\n }\n else console.log(\"No lock for me :(\");\n}",
"function setLock(locked)\r\n{\r\n lock = locked;\r\n}",
"function close() {\n lock.writeSync(0); // turn the lock pin off\n}",
"lock(callback)\n {\n /* aquire lock */\n var onRelease = () => {\n /* still locked? */\n if (this._locked)\n return;\n \n /* drop the number of credits */\n this._locked = true;\n /* remove listener */\n this._ee.removeListener('release', onRelease);\n /* call callback */\n process.nextTick(() => callback());\n };\n \n /* mutex is locked: wait for release */\n if (this._locked) {\n this._ee.on('release', onRelease);\n /* not locked */\n } else {\n /* drop the number of credits */\n this._locked = true;\n /* call callback */\n process.nextTick(() => callback());\n }\n }",
"function lockfile_make_unlock(lf) {\n var holder_id;\n\n mod_assert.strictEqual(lf.lf_holder_id, -1);\n\n lf.lf_holder_id = holder_id = ++NEXT_HOLDER_ID;\n\n return (function __unlock(ulcb) {\n mod_assert.strictEqual(lf.lf_holder_id, holder_id,\n 'mismatched lock holder or already unlocked');\n lf.lf_holder_id = -1;\n\n mod_assert.strictEqual(lf.lf_state, 'LOCKED');\n mod_assert.notStrictEqual(lf.lf_fd, -1);\n\n lf.lf_state = 'UNLOCKING';\n\n mod_fs.close(lf.lf_fd, function (err) {\n lf.lf_state = 'UNLOCKED';\n lf.lf_fd = -1;\n\n ulcb(err);\n\n lockfile_dispatch(lf);\n });\n });\n}",
"unlock() {\n return dispatch => {\n return new Promise((resolve, reject) => {\n dispatch({\n resolve,\n reject\n });\n }).then(was_unlocked => {\n //DEBUG console.log('... WalletUnlockStore\\tmodal unlock')\n if (was_unlocked) WrappedWalletUnlockActions.change();\n }).catch(params => {\n throw params;\n });\n };\n }",
"function _unlockFunctionality() {\n lockUserActions = false;\n viewModel.set(\"lockUserActions\", lockUserActions);\n}",
"function mainChainCancelLockin(obj) {\n if(!currentLockinSecret || !currentLockinSecretHash) {\n alert(\"must prepare lockin and notify notary first\")\n return\n }\n showMaskLayer(\"cancel Ethereum lockin,please wait ...\")\n $(\"#signTransaction\").text('');\n doMainChainCancelLockin()\n}"
]
| [
"0.6994963",
"0.66803813",
"0.66722",
"0.66555375",
"0.66543484",
"0.6508819",
"0.639839",
"0.615003",
"0.6100489",
"0.6085905",
"0.60403425",
"0.59574896",
"0.5905636",
"0.58783865",
"0.5866898",
"0.5821947",
"0.5785694",
"0.5782023",
"0.5712773",
"0.5666819",
"0.564414",
"0.56387365",
"0.5631606",
"0.56268215",
"0.5594964",
"0.554936",
"0.55422884",
"0.5523774",
"0.5463015",
"0.5437857"
]
| 0.6942008 | 1 |
To check for presence of diamond on click | function checkForDiamond (e) {
let elementToCheck = e.srcElement
let elementPosition = elementToCheck.getBoundingClientRect()
let elementPositionObj = {
cellPositionTop: parseInt(elementPosition.top),
cellPositionLeft: parseInt(elementPosition.left)
}
elementToCheck.classList.remove('unknown')
score.textContent = 'Score : ' + (--initialScore)
if (elementToCheck.classList.contains('diamond')) {
elementToCheck.parentNode.style['background-color'] = '#78e08f'
/* When all diamonds are uncovered display score using modal */
if (diamondsUncovered === 7) {
let score = document.getElementById('final-score')
score.textContent = 'Your score : ' + initialScore
toggleModal()
}
++diamondsUncovered
console.log('You just found a diamond')
// arrayOfDiamonds.splice(arrayOfDiamonds.indexOf(elementPositionObj), 1) // debug
} else {
/* To display arrow according to location of the nearest diamond */
elementToCheck.parentNode.style['background-color'] = '#2e383a'
let dynamicDistanceArray = findTheNearestDiamond(elementPositionObj)
let closestDiamondIndex = dynamicDistanceArray.indexOf(Math.min(...dynamicDistanceArray))
let diamondPosition = arrayOfDiamonds[closestDiamondIndex]
let typeOfArrow = findTypeOfArrow(elementPositionObj, diamondPosition)
elementToCheck.classList.add('arrow')
elementToCheck.style['transform'] = arrowDirections[typeOfArrow]
setTimeout(() => elementToCheck.classList.remove('arrow'), 1000)
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"checkDiamond(elem, diamondPos) {\n\n /** If the square is already checked, then don't check again*/\n if(elem.classList.contains(\"done\") || this.gameOver)\n {\n return;\n }\n\n let isDiamond = false;\n let x = elem.getAttribute(\"x\");\n let y = elem.getAttribute(\"y\");\n let dIndex; \n\n elem.classList.remove(\"unknown\");\n elem.classList.add(\"done\");\n this.maxScore -= 1;\n document.querySelector(\"#score\").innerHTML = this.maxScore;\n\n /** Check the array which contains the diamond position, if the clicked position contains in it */\n for(const pos of diamondPos) {\n if(x === pos.split(\",\")[1] && y === pos.split(\",\")[0]) {\n elem.classList.add(\"diamond\");\n dIndex = diamondPos.indexOf(pos);\n diamondPos.splice(dIndex, 1);\n isDiamond = true;\n break;\n }\n }\n if(diamondPos.length === 0) {\n document.querySelector(\"#message\").innerHTML = \"GAME OVER!\"\n document.querySelector(\"#score-section\").classList.add(\"score-blink\");\n this.gameOver = true;\n return;\n }\n /** If there is no diamond, show the arrow in the respective direction*/\n if(!isDiamond) {\n let direction = this.getArrowDirection(x, y, diamondPos);\n if(direction){\n elem.classList.add(\"arrow\", `${direction}`);\n setTimeout(function(){\n elem.classList.remove(\"arrow\", `${direction}`);\n }, 2000);\n } \n }\n }",
"function isDancingClicked(x,y) {\n return x >= buttonX - buttonWidth/2 &&\n x <= buttonX + buttonWidth/2 &&\n y >= secondButtonYpos - buttonHeight/2 &&\n y <= secondButtonYpos + buttonHeight/2;\n}",
"function drawDiamond() {\n\t\n\t//Gray diamond slot, or diamond itself?\n\tif (diamondIsAvailable) {\n\t\tcanvasContext.drawImage(diamondImage, 292.5-17.5,100-21);\n }else if (diamondIsAvailable == false) {\n\t\tcanvasContext.drawImage(grayDiamondImage, 292.5-17.5,100-21);\n }else{\n\t\tconsole.log(\"DRAW DIAMOND ERROR: Impossible\");\n\t}\n\t\n}",
"function diamondCorner(diamond, box) {\n var x = diamond.x,\n y = diamond.y,\n side = diamond.side;\n return ((box.x == x && box.y == y) || (box.x == x - side && box.y == y + side) || (box.x == x + side && box.y == y + side) || (box.x == x && box.y == y + 2 * side));\n}",
"function isClicked(door)\n{\n if (door.src === closedDoorPath) {\n return false;\n }\n return true;\n}",
"function checkVictoryClick() {\n\t// Dazu muss die gesamte Matrix durchlaufen werden\n\tfor(var i = 0; i < arrayDimensionLine; i++) {\n\t\tfor(var j = 0; j < arrayDimensionColumn; j++) {\n\t\t\t// Und fuer jede Zelle muss geprueft werden, ob sie auf der Map ist\n\t\t\tif(hexatileOnMap(i,j))\n\t\t\t\t// Dann wird geprueft, ob diese Zelle noch verdeckt und keine Mine ist\n\t\t\t\tif(!gameField[i][j].isOpen && !gameField[i][j].isMine)\n\t\t\t\t\t// in diesem Fall hat man noch nicht durch aufdecken aller leeren Felder gewonnen\n\t\t\t\t\treturn false;\n\t\t}\n\t}\n\n\t// An dieser Stelle ist klar, dass alle leeren Felder aufgedeckt wurden \n\treturn true;\n}",
"detectClicks() {\n if (\n hand.x > this.x &&\n hand.y > this.y &&\n hand.x < this.x + this.markerW &&\n hand.y < this.y + this.markerH\n ) {\n return true;\n } else {\n return false;\n }\n }",
"function isHowToClicked(x,y) {\n return x >= buttonX - buttonWidth/2 &&\n x <= buttonX + buttonWidth/2 &&\n y >= buttonY - buttonHeight/2 &&\n y <= buttonY + buttonHeight/2;\n\n}",
"function setDrawFlgWhenClick() {\n console.log(\"setDrawFlgWhenClick\");\n for (var i in selectedAnnos) {\n var e = SVG.get(selectedAnnos[i]);\n if (hasIntersection(iv.sMultipleSvg, e)) {\n return false;\n }\n }\n\n if (clickOnSelectedBound) {\n return false;\n }\n return true;\n}",
"function isMouseDown() {\n let allUnvisited = document.querySelectorAll(\".unvisited\");\n allUnvisited.forEach((point) => {\n point.addEventListener(\"mousedown\", function () {\n canDrag = true;\n });\n });\n}",
"function checkPieceClicked(){\n var i;\n var piece;\n for(i = 0; i < _pieces.length; i ++){\n piece = _pieces[i];\n if(_mouse.x < piece.xPos || _mouse.x > (piece.xPos + _pieceWidth) || _mouse.y < piece.yPos || _mouse.y > (piece.yPos + _pieceHeight)){\n // This Piece is not selected \n }else{\n return piece;\n }\n }\n return null;\n}",
"function checkClick(tile) {\n\tif (tile.type === 0) {\n\t\trevealTile(tile)\n\t\trevealBlanks(tile) \n\t} else if (tile.type > 0) \n\t\trevealTile(tile)\n\telse {\n\t\trevealMines(tile)\n\t\tdisplayLose(tile)\n\t}\n}",
"function checkIfAllClicked() {\n for (let i = 0; i < squares.length; i++) {\n if (squares[i].dataset.clicked == \"-1\") {\n return false;\n }\n }\n return true;\n}",
"clicked(x, y)\r\n {\r\n var d = dist(x, y, this.x, this.y);\r\n if(d < this.radius)\r\n {\r\n return true;\r\n }\r\n }",
"function isClicked(mouse) {\n for(var i=0;i<Object.keys(icons).length;i++) {\n curr_x = icons[Object.keys(icons)[i]][1];\n curr_y = icons[Object.keys(icons)[i]][2];\n curr_height = icons[Object.keys(icons)[i]][3];\n curr_width = icons[Object.keys(icons)[i]][4];\n if (mouse[0] < curr_x + curr_width && mouse[0] > curr_x - curr_width) {\n if (mouse[1] < curr_y + curr_height && mouse[1] > curr_y - curr_height) {\n return (icons[Object.keys(icons)[i]][0]);\n }\n }\n else {\n }\n }\n return false;\n }",
"function alreadyClicked(evt) {\n return ($(evt.target).parent().attr('clicked'));\n}",
"function checkRedPressed() {\n isRedElementClicked = true;\n}",
"function hasClickToShow(gd, hoverData) {\n\t var sets = getToggleSets(gd, hoverData);\n\t return sets.on.length > 0 || sets.explicitOff.length > 0;\n\t}",
"checkClick() {\n\t\t//click is only possible if count > 0 and within distance\n\t\tif (dist(mouseX, mouseY, this.x, this.y) <= 25 && this.count > 0) {\n\t\t\t//change arrow directions\n\t\t\tif (this.direction == \"up\") {\n\t\t\t\tthis.direction = \"right\";\n\t\t\t}\n\t\t\telse if (this.direction == \"right\") {\n\t\t\t\tthis.direction = \"down\";\n\t\t\t}\n\t\t\telse if (this.direction == \"down\") {\n\t\t\t\tthis.direction = \"left\";\n\t\t\t}\n\t\t\telse if (this.direction == \"left\") {\n\t\t\t\tthis.direction = \"up\";\n\t\t\t}\n\t\t\tthis.count -= 1;\n\t\t}\n\n\t}",
"function isValidClick(numberOnCell) {\n var emptyRow = getRowNumber(NUMBER_ON_EMPTY_CELL), emptyCol = getColumnNumber(NUMBER_ON_EMPTY_CELL);\n var clickRow = getRowNumber(numberOnCell), clickCol = getColumnNumber(numberOnCell);\n // console.log(\"number on cell: \" + numberOnCell + \", erow: \" + emptyRow + \", ecol: \" + emptyCol + \", cRow: \" + clickRow + \", cCol: \" + clickCol);\n return (emptyRow == clickRow) || (emptyCol == clickCol);\n }",
"function checkForClick() {\n\tfor (let i = 0; i < gridBlocks.length; i++) {\n\t\tgridBlocks[i].addEventListener('click', () => {\n\t\t\tif (!eraser) {\n\t\t\t\tgridBlocks[i].classList.toggle('blockColor');\n\t\t\t} else {\n\t\t\t\tgridBlocks[i].classList.remove('blockColor');\n\t\t\t\tgridBlocks[i].classList.toggle('blockTransparent');\n\t\t\t}\n\t\t});\n\t}\n}",
"function isDownClear (ghostCurrentPosition) {\n if (!cells[ghostCurrentPosition + width].classList.contains(borderClass) && (!cells[ghostCurrentPosition + width].classList.contains(tarantulaClass) || !cells[ghostCurrentPosition].classList.contains(scorpianClass) || !cells[ghostCurrentPosition].classList.contains(waspClass))) {\n // console.log('down clear')\n return true\n }\n }",
"mouseClicked(){\n //If we are highlighted and we clicked, return true\n if(this.highlighted){\n return true\n }\n //Else return false\n return false;\n }",
"static IsDown(button = 0) {\n return Mouse._button_down.includes(button)\n }",
"clickedOn(xPos, yPos) {\n return(xPos > this.x && xPos < this.x + this.w && yPos > this.y && yPos < this.y +this.w);\n }",
"function diamond()\n{\n\ttriangle(0, 1, 4, 4); // top left blue\n triangle(0, 1, 2, 1); // top back red\n\ttriangle(2, 1, 4, 3); // top right green\n\ttriangle(0, 3, 4, 1); // bot left red\n triangle(0, 3, 2, 3); // bot back green\n triangle(2, 3, 4, 4); // bot right blue\n}",
"function hasClickToShow(gd, hoverData) {\n var sets = getToggleSets(gd, hoverData);\n return sets.on.length > 0 || sets.explicitOff.length > 0;\n}",
"function hasClickToShow(gd, hoverData) {\n var sets = getToggleSets(gd, hoverData);\n return sets.on.length > 0 || sets.explicitOff.length > 0;\n}",
"function give_up(){\n // if button on line \n}",
"is_clicked(image, event) {\n var width = image.width\n var height = image.height\n var begin_x = image.x\n var begin_y = image.y\n var end_x = begin_x + width\n var end_y = begin_y + height \n var buffer = 10\n var click_x = event.offsetX\n var click_y = event.offsetY\n var has_been_clicked = false\n\n if (click_x >= begin_x - buffer && click_x <= end_x + buffer && click_y >= begin_y - buffer && click_y <= end_y + buffer) {\n has_been_clicked = true\n } else {\n has_been_clicked = false\n }\n\n return has_been_clicked\n }"
]
| [
"0.68239886",
"0.6273277",
"0.6249081",
"0.60598344",
"0.60344017",
"0.60270023",
"0.6007742",
"0.599134",
"0.5991333",
"0.5940339",
"0.58954006",
"0.58666563",
"0.5865667",
"0.58490616",
"0.58330333",
"0.58104396",
"0.575806",
"0.5751387",
"0.5733285",
"0.5723229",
"0.5705781",
"0.5702285",
"0.56959194",
"0.56932074",
"0.56725806",
"0.5659487",
"0.5653108",
"0.5653108",
"0.56498563",
"0.5637661"
]
| 0.70848995 | 0 |
get list of all indexers | async function getAllIndexers() {
const url = getIndexerUrl();
const indexerList = await getData({ uri: url });
return indexerList;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getIndexerValue() {\n const indexers = this._indexers,\n result = [];\n\n for (let i = 0; i < indexers.length; i++) {\n result.push(indexers[i].val());\n }\n\n return result;\n }",
"getIndices() {\n return this._registry.get('properties', 'schemaData', { indices: [] })\n .indices.map(data => {\n if (!data.hasOwnProperty('name') || !data.name)\n data.indexName = this.getStorageIndexName();\n else\n data.indexName = this.getStorageIndexPrefix() + data.name;\n return data;\n }).filter(schema => schema != undefined);\n }",
"get indices() {\n return this._state.indices;\n }",
"get indices() {\n return this._indices;\n }",
"get index() {\n\n }",
"getAllByIndex(storeName, indexName, keyRange) {\n const data = [];\n return from(new Promise((resolve, reject) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db) => {\n validateBeforeTransaction(db, storeName, reject);\n const transaction = createTransaction(db, optionsGenerator(DBMode.readonly, storeName, reject, resolve));\n const objectStore = transaction.objectStore(storeName);\n const index = objectStore.index(indexName);\n const request = index.openCursor(keyRange);\n request.onsuccess = (event) => {\n const cursor = event.target.result;\n if (cursor) {\n data.push(cursor.value);\n cursor.continue();\n }\n else {\n resolve(data);\n }\n };\n })\n .catch((reason) => reject(reason));\n }));\n }",
"calAllIndex() {\n for (let i = 0; i < this.length; i++) {\n for (let j = 0; j < this.breath; j++) {\n let index = i + \"-\" + j;\n this.indexes.push(index);\n }\n }\n return this.indexes;\n }",
"async function getIndexes() {\n return await fetch('https://api.coingecko.com/api/v3/indexes').then(res => res.json());\n }",
"function loadIndexes() {\n // Get search indexes.\n dataService.fetch('get', '/api/admin/indexes').then(\n function (data) {\n $scope.activeIndexes = data;\n // Get mappings configuration.\n dataService.fetch('get', '/api/admin/mappings').then(\n function (mappings) {\n // Reset the scopes variables for mappings.\n $scope.activeMappings = {};\n $scope.inActiveMappings = {};\n\n // Filter out active indexes.\n for (var index in mappings) {\n if (!$scope.activeIndexes.hasOwnProperty(index)) {\n $scope.inActiveMappings[index] = mappings[index];\n }\n else {\n $scope.activeMappings[index] = mappings[index];\n }\n }\n },\n function (reason) {\n $scope.message = reason.message;\n $scope.messageClass = 'alert-danger';\n }\n );\n },\n function (reason) {\n $scope.message = reason.message;\n $scope.messageClass = 'alert-danger';\n }\n );\n }",
"get engines() {\n var engines = [ ];\n var tree = this.getElement({type: \"engine_list\"}).getNode();\n\n for (var ii = 0; ii < tree.view.rowCount; ii ++) {\n engines.push({name: tree.view.getCellText(ii, tree.columns.getColumnAt(0)),\n keyword: tree.view.getCellText(ii, tree.columns.getColumnAt(1))});\n }\n\n return engines;\n }",
"function keys() {\n return Object.keys(index);\n}",
"all() {\r\n return Object.keys(this._documents).map(key => this._documents[key]);\r\n }",
"all() {\r\n return Object.keys(this._documents).map(key => this._documents[key]);\r\n }",
"function getAllComponentsIndexNames() {\n socketService.getAllComponentsIndexNames()\n .success(function (resp) {\n $scope.responseStatusHandler(resp);\n resp.allComponentsIndexNames.forEach(function (componentReference) {\n $scope.allComponentsIndexNames[componentReference.componentIndex] = componentReference.name;\n });\n })\n .error(function (errResponse) {\n $scope.responseStatusHandler(errResponse);\n })\n }",
"function indexDump() {\n\tconst indexes = {};\n\tfor (const collection of db.getCollectionNames()) {\n\t\tindexes[collection] = db.getCollection(collection).getIndexes();\n\t}\n\tprintjson(indexes);\n}",
"function forgetAll() {\n return dataStore.forgetAll();\n }",
"getKeys() {\n this.logger.trace(\"Retrieving all cache keys\");\n // read cache\n const cache = this.getCache();\n return [...Object.keys(cache)];\n }",
"list() {\n const listings = this._listings.all();\n return Object.keys(listings).map(key => listings[key]);\n }",
"get engines()\n {\n var engines = [ ];\n var popup = this.getElement({type: \"searchBar_dropDownPopup\"});\n\n for (var ii = 0; ii < popup.getNode().childNodes.length; ii++) {\n var entry = popup.getNode().childNodes[ii];\n if (entry.className.indexOf(\"searchbar-engine\") != -1) {\n engines.push({name: entry.id,\n selected: entry.selected,\n tooltipText: entry.getAttribute('tooltiptext')\n });\n }\n }\n\n return engines;\n }",
"async index () {\n return await Operator.all()\n }",
"keys () {\n\t\treturn this.cache.keys();\n\t}",
"get keys() {}",
"list() {\n return this.ready.then(db => {\n const transaction = db.transaction([STORE_NAME], 'readonly');\n const store = transaction.objectStore(STORE_NAME);\n const request = store.index('store').getAll(IDBKeyRange.only(this.name));\n return waitForRequest(request);\n }).then(files => {\n const result = {};\n files.forEach(file => {\n result[file.fileID] = file.data;\n });\n return result;\n });\n }",
"async fetchExistingRecords () {\n const client = getAlgoliaClient()\n\n // return an empty array if the index does not exist yet\n const { items: indices } = await client.listIndices()\n\n if (!indices.find(index => index.name === this.name)) {\n console.log(`index '${this.name}' does not exist!`)\n return []\n }\n\n const index = client.initIndex(this.name)\n let records = []\n\n await index.browseObjects({\n batch: batch => (records = records.concat(batch))\n })\n\n return records\n }",
"function getAllClients() {\n return clients;\n }",
"get installableEngines()\n {\n var engines = [ ];\n var popup = this.getElement({type: \"searchBar_dropDownPopup\"});\n\n for (var ii = 0; ii < popup.getNode().childNodes.length; ii++) {\n var entry = popup.getNode().childNodes[ii];\n if (entry.className.indexOf(\"addengine-item\") != -1) {\n engines.push({name: entry.getAttribute('title'),\n selected: entry.selected,\n tooltipText: entry.getAttribute('tooltiptext')\n });\n }\n }\n\n return engines;\n }",
"getInitialIndexes() {\n this.setState({\n initialLoading: true,\n initialLoadText: 'índices...',\n loadError: false\n });\n this.subscribe(\n TimeseriesService.list({template_category: 'emac-index', max_events: 1}),\n data => {\n this.setState(state => ({\n indexes: data,\n tableData: generateTableData(Object.values(state.targets), data, state.tickets, availability),\n initialLoading: false,\n lastUpdate: moment().format(config.DATETIME_FORMAT)\n }));\n this.setDataUpdate();\n },\n (err) => this.setState({loadError: true, initialLoading: false})\n );\n }",
"function WorkspaceIndexer(){\n\tthis._init();\n}",
"async function setIndexer(indexer) {\n const url = getIndexerUrl(indexer.id);\n const indexerList = await putData({ uri: url, body: indexer });\n return indexerList;\n}",
"function _index(req, res) {\n var registryList = _getRegistryList(req.user);\n\n _respond(req, res, \"index\", {\n user: registry_utils.formatUserId.call({user: req.user}),\n registry: registryList,\n repositoryBaseURL: config.repositoryBaseURL,\n helpURL: config.helpURL\n });\n}"
]
| [
"0.6700296",
"0.6373289",
"0.5961235",
"0.5952486",
"0.58707345",
"0.5865344",
"0.58385175",
"0.5815432",
"0.57516646",
"0.5702357",
"0.5625296",
"0.55507374",
"0.55507374",
"0.5531465",
"0.54669195",
"0.5431267",
"0.5422411",
"0.5420051",
"0.54129714",
"0.54033834",
"0.53877014",
"0.53467095",
"0.5345642",
"0.533746",
"0.530709",
"0.5299246",
"0.5292077",
"0.52779186",
"0.52391",
"0.523876"
]
| 0.8348808 | 0 |
GET One Todo with the provided ID | function readOne(req, res, next) {
todoRepository.findOne({
_id: req.params.id
}, function (err, todos) {
if (err) {
res.send(err);
}
else {
res.json(todos);
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getTodoById(id) {\n for (const i in todos) {\n const todo = todos[i];\n debugVar = todo;\n return todo;\n }\n\n if (todo.id === id) {\n return todo;\n }\n\n return null;\n }",
"function selectATodo(todo_id) {\n return db(\"todos\").select(\"id\", \"rank\", \"title\", \"completed\", \"category_id\")\n .where({\n deleted: false,\n id: todo_id\n });\n }",
"getTask(id) {\n if (!id) \n return Promise.reject(\"You must provide an id to search for\");\n \n return todoItems().then((taskCollection) => {\n return taskCollection.findOne({_id: id});\n }).catch((error) => {\n return Promise.reject(error); \n });\n }",
"at(id) {\n\n // get the idx of the todo\n let idx = typeof id == 'number' ? id : this.data.findIndex(function (item) { return item.id == id });\n\n // no todo? return null\n if (idx == -1) return null;\n\n // return the Todo\n return this.data[idx];\n }",
"function show(req, res) {\n\tToDo.findById(req.params.id, function(err,toDo){\n\t\tif (err) console.log(err)\n\t\tres.json(toDo)\n\t})\n}",
"function readTodo(id){\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\treturn listArr[index];\n\t\t}\n\t}\n\treturn -1;\n}",
"static getTodoDetails(id) {\n return dispatch => {\n dispatch(actionDispatch(ActionType.GET_TODO_DETAIL));\n get(id)\n .then(response => {\n dispatch(\n actionDispatch(\n ActionType.GET_TODO_DETAIL_SUCCESS,\n response\n )\n );\n })\n .catch(error => {\n dispatch(\n actionDispatch(ActionType.GET_TODO_DETAIL_FAIL, error)\n );\n });\n };\n }",
"function todoDelete(id) {\n \t// Inititate the promise to be returned.\n \tvar defer = $q.defer();\n \t// Use $http.delete to put the generated API key to use, for the delete function.\n \t$http.delete('http://localhost:60401/api/VSTDAs' + '/' + id). 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;\t\n }",
"function deleteToDo( id ) {\n\n return fetch( `${postToDoURL}` + '/' + `${id}`, {\n method: 'DELETE',\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n }\n } ).then( response => response.json() );\n }",
"*resolveTodo(todoID) {\n return this.todos[todoID];\n }",
"async loadTodo(todoListId, todoId) {\n const FIND_TODO = 'SELECT * FROM todos ' +\n 'WHERE todolist_id = $1 ' +\n 'AND id = $2 ' +\n 'AND username = $3';\n let result = await dbQuery(FIND_TODO, todoListId, todoId, this.username);\n return result.rows[0];\n }",
"getTodo({ commit }, todo) {\n commit(\"GET_TODO\", todo);\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 }",
"async function getTodo(id: string): Promise<?Todo> {\n const respository = await wordRepo();\n const todo: Word = await respository.findOne(id);\n return {...todo, text: todo.name};\n}",
"static async findById(req, res, next) {\n try {\n const data = await ToDo.findByPk(+req.params.id, {\n where: { UserId: +req.decoded.id },\n })\n if (data) {\n res.status(200).json(data)\n return\n } else {\n throw { status: 404 }\n }\n } catch (err) {\n next(err)\n }\n }",
"obterPorId(_id){\n return this.lista.filter( aluno => aluno._id === _id )[0];\n }",
"static dSTIdNoteGET({ id }) {\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 }",
"get(id) {\n return http.get(`/orders/${id}`);\n }",
"get(id) {\n\n }",
"async GetOneRepuesto(id) {\n\n\n return await Repuesto.findById(id);\n }",
"get(id) {\n return this.rest.get(`${this.baseUrl}/${id}`);\n }",
"get(id) {\n return this.rest.get(`${this.baseUrl}/${id}`);\n }",
"function get(id) {\n\n\t\treturn _.find(service.notes, 'id', id);\n \n\t\t/*\n\t\treturn $q(function(resolve, reject) {\n\t\t\tRestangular.one('notes').get({x: 'y'})\n\t\t\t.then(function(result) {\n\t\t\t\tvar newResult = result;\n\t\t\t\tresolve(newResult);\n\t\t\t});\n\t\t});\n\t\t*/\n\t}",
"function thisToDoId(id) {\n return id;\n}",
"function getTaskById(req, res, done) {\n task.findTaskById(req.params.taskId, (e, r) => {\n if(e) return done(new HttpError(500, e));\n if(!r) return done(new HttpError(400, 'Task with this id does not exists'));\n\n res.send({\n id: r._id,\n name: r.name,\n desc: r.desc,\n shortInfo: r.shortInfo,\n chatType: r.chatType,\n character: {\n name: r.character.name,\n desc: r.character.desc,\n image: r.character.image\n },\n location: {\n name: r.location.name,\n desc: r.location.desc,\n lon: r.location.lon,\n lat: r.location.lat,\n image: r.location.image\n },\n dueDate: r.dueDate,\n chat: _.map(r.chat, (e) => {\n return {\n _type: e._type,\n text: e.text,\n audioId: e.audioId,\n answers: e.answers\n }\n })\n })\n })\n}",
"get(id: number) {\n return axios.get<Task>('/tasks/' + id).then((response) => response.data);\n }",
"getById (url, id) {\n url = `${url}/${id}?f=json`;\n return this.request(url, {method: 'GET'});\n }",
"function getTask(taskId){\n console.log(\"getTask\");\n return todoItems.find(({ id }) => id === taskId);\n}",
"getOne(req, res) {\n Activity.findById(req.params.id).then(results => {\n res.json(results);\n });\n }",
"get(id)\n {\n return this._fetch(this._url + '/' + id);\n }"
]
| [
"0.7446939",
"0.720031",
"0.69799197",
"0.6963429",
"0.68636817",
"0.67221177",
"0.67046577",
"0.6697848",
"0.66908777",
"0.6569379",
"0.6531879",
"0.6494542",
"0.6489736",
"0.6485646",
"0.6426763",
"0.641737",
"0.64111006",
"0.64087814",
"0.63859665",
"0.63856345",
"0.6349915",
"0.6349915",
"0.63396233",
"0.63271874",
"0.63224036",
"0.6304894",
"0.6297414",
"0.6294162",
"0.62934506",
"0.6271707"
]
| 0.74806696 | 0 |
globally initializing the styleIds array | function initStyles() { // function for getting the ids from the local storage into the styleIds array
var storedNames = JSON.parse(localStorage.getItem("styles") || '[]');
styleIds = storedNames.map(element => JSON.parse(element).id);
console.log('styleIds'.styleIds)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static get styles() { return []; }",
"setupStyles_() {\n if (this.styles_.length) {\n return;\n }\n\n for (let i = 0, size; size = this.sizes[i]; i++) {\n this.styles_.push({\n url: `${this.imagePath_ + (i + 1)}.${this.imageExtension_}`,\n height: size,\n width: size\n });\n }\n }",
"createAllStyle(id) {\n\t\t// Set style of the tab\n\t\tStyle.createStyle(\n\t\t'.bgroup' + id + ` {\n\t\t\toverflow: hidden;\n\t\t\twidth: 150px;\n\t\t\theight: 100px;\n\t\t\tbackground: #f1f1f1;\n\t\t\tborder: 1px solid #ccc;\n\t\t\tpadding: 4px 4px;\n\t\t\tfloat: left;\n\t\t}\n\t\t`);\n\n\t\t// Set style of the buttons inside the tab\n\t\tStyle.createStyle(\n\t\t'.button' + id + ` {\n\t\t\tbackground: #ddd;\n\t\t\tfloat: left;\n\t\t\twidth: 60px;\n\t\t\twhite-space: nowrap;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t}\n\t\t`);\n\t}",
"static get styles() {\n return [style];\n }",
"function StyleRegistry(){\r\n this._collection = Object.create(null, {});\r\n}",
"setStyles(_id, _styles, _noCache) {\n const _this = this;\n if (this.isObject(_styles)) {\n _styles = Object.entries(_styles);\n }\n if (this.isArray(_styles)) {\n _styles.forEach(([_key, _value]) => {\n _this.setStyle(_id, _key, _value, _noCache);\n });\n }\n else {\n console.error('ERROR calling ELEM.setStyles; _styles is not an object nor Array:', typeof _styles);\n }\n }",
"setStyles(_id, _styles, _noCache) {\n const _this = this;\n if (this.isObject(_styles)) {\n _styles = Object.entries(_styles);\n }\n if (this.isArray(_styles)) {\n _styles.forEach(([_key, _value]) => {\n _this.setStyle(_id, _key, _value, _noCache);\n });\n }\n else {\n console.error('ERROR calling ELEM.setStyles; _styles is not an object nor Array:', typeof _styles);\n }\n }",
"function stylingInit() {\n var lView = getLView();\n var index = getSelectedIndex();\n var tNode = getTNode(index, lView);\n updateLastDirectiveIndex(tNode, getActiveDirectiveStylingIndex());\n}",
"getDefaultStyles() {\n const styles = [\n {\n key: 'mainTitle',\n style: { progress: 0 },\n },\n {\n key: 'subTitle',\n style: { progress: 0 },\n data: { precededBy: 'mainTitle' },\n },\n {\n key: 'divider',\n style: { progress: 0 },\n data: { precededBy: 'subTitle' },\n },\n {\n key: 'summary',\n style: { progress: 0 },\n data: { precededBy: 'divider', triggeredAt: 0.55 },\n },\n ];\n\n // Setup the icon styles using a loop, since they're all super similar.\n for (var i = 1; i <= 7; i++) {\n styles.push({\n key: 'icon' + i,\n style: { progress: 0 },\n data: { precededBy: 'divider', triggeredAt: (0.14 * i - 0.05) },\n });\n }\n\n return styles;\n }",
"useStyle() {\n let index = Math.max(0, this.sums_.index - 1);\n index = Math.min(this.styles_.length - 1, index);\n const style = this.styles_[index];\n this.url_ = style['url'];\n this.height_ = style['height'];\n this.width_ = style['width'];\n this.textColor_ = style['textColor'];\n this.anchor_ = style['anchor'];\n this.textSize_ = style['textSize'];\n this.backgroundPosition_ = style['backgroundPosition'];\n }",
"function _initialize() {\n\tthis.styleElId = `rw-indicator-bar-${uid(12)}`;\n\n\tlet styleEl = document.createElement(\"STYLE\"),\n\t\thead = document.head || document.getElementsByTagName('head')[0];\n\n\tstyleEl.type = \"text/css\";\n\tstyleEl.id = this.styleElId;\n\thead.appendChild(styleEl);\n}",
"styles() { }",
"function makeStyles() {\n // One style per geometry type, with overlay blending\n return ['polygons', 'lines', 'points', 'text'].reduce(function (tgStyles, geomType) {\n tgStyles[(\"XYZ_\" + geomType)] = {\n base: geomType,\n blend: 'overlay'\n };\n return tgStyles;\n }, {});\n }",
"constructor() {\n const {\n defaultStyle,\n globalStyle,\n fontStyle,\n formStyle,\n buttonStyle\n } = { ...getInitialStyles };\n\n this.initialStyles = {\n ...defaultStyle,\n ...globalStyle,\n ...fontStyle,\n ...formStyle,\n ...buttonStyle\n };\n }",
"static configureStyle() {\n const styleId = gCssPrefix;\n if (document.getElementById(styleId) !== null) {\n // Already created.\n return;\n }\n const node = document.createElement(\"style\");\n node.id = styleId;\n node.innerHTML = GLOBAL_CSS;\n document.head.appendChild(node);\n }",
"static configureStyle() {\n const styleId = gCssPrefix;\n if (document.getElementById(styleId) !== null) {\n // Already created.\n return;\n }\n const node = document.createElement(\"style\");\n node.id = styleId;\n node.innerHTML = GLOBAL_CSS;\n document.head.appendChild(node);\n }",
"static configureStyle() {\n const styleId = gCssPrefix;\n if (document.getElementById(styleId) !== null) {\n // Already created.\n return;\n }\n const node = document.createElement(\"style\");\n node.id = styleId;\n node.innerHTML = GLOBAL_CSS;\n document.head.appendChild(node);\n }",
"static get styles() {\n return styles;\n }",
"function CSSStyleSheetInit() {}",
"_initCache(_id) {\n this._styleTodo[_id] = [];\n this._styleCache[_id] = {};\n this._elemTodoH[_id] = false;\n }",
"_initCache(_id) {\n this._styleTodo[_id] = [];\n this._styleCache[_id] = {};\n this._elemTodoH[_id] = false;\n }",
"function initializeStyles() {\n const shapeNodeStyle = new ShapeNodeStyle({\n shape: 'round-rectangle',\n stroke: 'rgb(102, 153, 204)',\n fill: 'rgb(102, 153, 204)'\n })\n defaultNodeStyle = new PackageNodeStyleDecorator(shapeNodeStyle)\n\n normalEdgeStyle = new PolylineEdgeStyle({\n stroke: '2px black',\n targetArrow: IArrow.TRIANGLE,\n smoothingLength: 10\n })\n\n addedEdgeStyle = new PolylineEdgeStyle({\n stroke: '2px rgb(51, 102, 153)',\n targetArrow: new Arrow({\n fill: 'rgb(51, 102, 153)',\n stroke: 'rgb(51, 102, 153)',\n type: ArrowType.TRIANGLE\n }),\n smoothingLength: 10\n })\n\n removedEdgeStyle = new PolylineEdgeStyle({\n stroke: '2px dashed gray',\n targetArrow: new Arrow({\n fill: 'gray',\n stroke: 'gray',\n type: ArrowType.TRIANGLE\n }),\n smoothingLength: 10\n })\n\n nodeLabelStyle = new DefaultLabelStyle({\n font: 'Arial',\n textFill: 'white'\n })\n\n const nodeLabelModel = new InteriorLabelModel({\n insets: 9\n })\n nodeLabelParameter = nodeLabelModel.createParameter(InteriorLabelModelPosition.EAST)\n}",
"get styles() {\n return this._styles;\n }",
"function get_style_id(style_name) {\n for (let i = 0; i < object_styles.length; i++) {\n if (object_styles[i].name == style_name) {\n return i;\n }\n }\n return -1;\n }",
"function generateStyleElements(styleHash = \"\"){\r\n \r\n if (styleHash == \"\"){\r\n return ;\r\n }\r\n \r\n var inlineStyle = \"\";\r\n $.each(styleHash, function(key, value){\r\n inlineStyle += key+\":\"+ value + \";\"\r\n })\r\n \r\n return '\"' + inlineStyle + '\"';\r\n }",
"function addOrvCoreStyles() {\n let s = [],s2=[];\n const o1 = \".\"+sOrvCoreLibClassName+\" \"\n let sPos\n\n try {\n if (typeof styleBlk !== \"undefined\") {\n return; // aleady set up\n } // end if\n\n styleBlk = document.createElement(\"STYLE\")\n styleBlk.id = orvCoreLibStyleBlockId;\n\n\n // s.push(\"\")\n\n s.push(o1+\"{\")\n s.push(\" box-sizing:border-box;\")\n s.push(\" margin:0px;\")\n s.push(\" padding:0px;\")\n s.push(\"}\")\n\n s.push(o1+\".bx {\")\n s.push(\" position:absolute;\")\n s.push(\" overflow:hidden;\")\n s.push(\"}\")\n\n s.push(o1+\".tint{\")\n s.push(\" background-color:black;\")\n s.push(\" top:0px;\")\n s.push(\" bottom:0px;\")\n s.push(\" left:0px;\")\n s.push(\" right:0px;\")\n s.push(\" opacity:.6;\")\n s.push(\" z-index:\"+(nHighestZIndex+1)+\";\")\n s.push(\"}\")\n\n // s2.push(\"\")\n s2 = []\n s2.push(o1+\".debugIcon{\")\n s2.push(\" text-align:center;\") \n s2.push(\" width:15px;\")\n s2.push(\" height:15px;\")\n s2.push(\" line-height:12px;\")\n s2.push(\" font-family:Tahoma;\")\n s2.push(\" font-size:11px;\")\n s2.push(\" padding:0px;\")\n s2.push(\" margin:0px;\")\n s2.push(\" margin-right:6px;\") \n s2.push(\" color: white;\")\n s2.push(\" border-radius:3px;\")\n s2.push(\" overflow:hidden;\")\n s2.push(\" display:inline-block;\")\n s2.push(\"}\")\n s.push(s2.join(\"\\n\"))\n\n\n s2 = []\n s2.push(o1+\".debugIconGreen{\")\n s2.push(\" border:solid #799876 1.5px;\")\n s2.push(\" text-shadow: 1px 1px #799876,-1px -1px #799876, 1px -1px #799876,-1px 1px #799876;\") \n s2.push(\" background-color: #A8C9A6;\")\n s2.push(\"}\")\n s.push(s2.join(\"\\n\"))\n\n s2 = []\n s2.push(o1+\".debugIconBlue{\")\n s2.push(\" border:solid #6B89A8 1.5px;\")\n s2.push(\" text-shadow: 1px 1px #6B89A8,-1px -1px #6B89A8, 1px -1px #6B89A8,-1px 1px #6B89A8;\") \n s2.push(\" background-color: #96B9D9;\")\n s2.push(\"}\")\n s.push(s2.join(\"\\n\"))\n\n s2 = []\n s2.push(o1+\".debugIconTan{\")\n s2.push(\" border:solid #CAB471 1.5px;\")\n s2.push(\" text-shadow: 1px 1px #CAB471,-1px -1px #CAB471, 1px -1px #CAB471,-1px 1px #CAB471;\") \n s2.push(\" background-color: #F5DE97;\")\n s2.push(\"}\")\n s.push(s2.join(\"\\n\"))\n\n s2 = []\n s2.push(o1+\".debugIconPurple{\")\n s2.push(\" border:solid #8C7698 1.5px;\")\n s2.push(\" text-shadow: 1px 1px #8C7698,-1px -1px #8C7698, 1px -1px #8C7698,-1px 1px #8C7698;\") \n s2.push(\" background-color: #BDA6C9;\")\n s2.push(\"}\")\n s.push(s2.join(\"\\n\"))\n\n s2 = []\n s2.push(o1+\".debugIconRed{\")\n s2.push(\" border:solid #BC6F70 1.5px;\")\n s2.push(\" text-shadow: 1px 1px #BC6F70,-1px -1px #BC6F70, 1px -1px #BC6F70,-1px 1px #BC6F70;\") \n s2.push(\" background-color: #E9999A;\")\n s2.push(\"}\")\n s.push(s2.join(\"\\n\"))\n\n s2 = []\n s2.push(o1+\".debugIconGray{\")\n s2.push(\" border:solid #999999 1.5px;\")\n s2.push(\" text-shadow: 1px 1px #999999,-1px -1px #999999, 1px -1px #999999,-1px 1px #999999;\") \n s2.push(\" background-color: #D9D9D9;\")\n s2.push(\"}\")\n s.push(s2.join(\"\\n\"))\n\n\n // s.push(\" \")\n sPos = \"30px\"\n s.push(o1+\".dialog {\")\n s.push(\" background-color:silver;\")\n s.push(\" border:solid yellow 3px;\")\n s.push(\" width:700px;\")\n s.push(\" left:\"+sPos+\";\")\n s.push(\" top:\"+sPos+\";\")\n s.push(\" bottom:\"+sPos+\";\")\n s.push(\" z-index:\"+(nHighestZIndex+2)+\";\")\n s.push(\"}\")\n\n s.push(o1+\".diaTitleBar {\")\n s.push(\" left:0px;\")\n s.push(\" right:0px;\")\n s.push(\" top:0px;\")\n s.push(\" height:35px;\")\n s.push(\" line-height:35px;\")\n s.push(\" color:white;\")\n s.push(\" font-size:18pt;\")\n s.push(\" background-color:gray;\")\n s.push(\" text-align:center;\") \n s.push(\"}\")\n\n s.push(o1+\".varArrayLen {\")\n s.push(\" color:gray; \") \n s.push(\" font-size:14px;\") \n s.push(\"}\")\n\n s.push(o1+\".varLst {\")\n s.push(\" list-style-type: none; \") \n s.push(\" background-color:white;\")\n s.push(\" border-radius:4px;\") \n s.push(\" padding-left:4px;\") \n s.push(\" padding-bottom:8px;\") \n s.push(\"}\")\n\n s.push(o1+\".varPropCntr {\") \n s.push(\" margin-left:16px;\") \n s.push(\"}\")\n\n\n // 🔴🔵🔴🔵🔴🔵🔴🔵🔴🔵🔴🔵🔴🔵🔴🔵🔴🔵🔴🔵🔴🔵🔴🔵🔴🔵🔴🔵\n s.push(o1+\"LI {\")\n s.push(\" font-family: Menlo, Monaco, 'Courier New', monospace;\")\n s.push(\" font-size:16px;\")\n s.push(\" width:655px;\")\n //s.push(\" background-color:lightblue;\") \n s.push(\"}\")\n\n s.push(o1+\".varCntr2 {\")\n s.push(\" font-family: Monaco, MonoSpace;\")\n s.push(\" width:655px;\")\n s.push(\" height:20px;\")\n s.push(\" position:relative; \") \n s.push(\" top:0px;\")\n s.push(\" left:0px;\")\n s.push(\" padding-left:17px;\")\n // s.push(\" background-color:lightgreen;\") \n s.push(\"}\")\n\n // s.push(\" \")\n s.push(o1+\".dataType_lbl {\")\n s.push(\" position:absolute; \") \n s.push(\" right:0px;\")\n s.push(\" top:2px;\")\n s.push(\" margin-right:4px;\")\n s.push(\" padding-left:4px;\")\n s.push(\" padding-right:4px;\")\n s.push(\" border-radius:4px;\")\n s.push(\" font-size:9pt;\")\n s.push(\" background-color:#800000;\")\n s.push(\" color:white;\")\n s.push(\"}\")\n\n // alert(s.join(\"\\n\"))\n s.push(o1+\".codeBackground {\")\n s.push(\"}\")\n\n s.push(o1+\".numberValue {\")\n s.push(\"}\")\n\n s.push(o1+\".stringValue {\")\n s.push(\"}\")\n\n s.push(o1+\".typeLabel {\")\n s.push(\"}\")\n\n // s.push(\"\")\n s.push(o1+\".booleanValue {\")\n s.push(\"}\")\n\n s.push(o1+\".dateValue {\")\n s.push(\"}\")\n\n\n styleBlk.innerHTML = s.join(\"\\n\")\n document.body.append(styleBlk)\n\n } catch(err) {\n console.dir(err)\n debugger \n } // end of try/catch\n //styleBlk\n \n }",
"function setStyles() {\n\t\t_.each(_.keys(site.styles), function(classKey) {\n\t\t\tvar cssClass = site.styles[classKey];\n\t\t\t_.each(_.keys(cssClass), function(styleKey) {\n\t\t\t\tsetStyle(classKey, styleKey, cssClass[styleKey]);\n\t\t\t});\n\t\t});\n\t}",
"static get styleUrls() {\n return [\n 'jqx.listbox.css',\n 'jqx.dropdownlist.css',\n 'jqx.dropdown.css'\n ]\n }",
"static get styleUrls() {\n return [\n 'jqx.scrollbar.css',\n 'jqx.scrollviewer.css',\n 'jqx.tree.css'\n ]\n }",
"function loadStyles(id, styleContent) {\n if (!_styleCache[id]) {\n _styleElem.append('<style type=\"text/css\" data-style-id=\"' + id + '\">' + styleContent + '</style>');\n _styleCache[id] = true; // Mark entry in cache for this script src\n }\n }"
]
| [
"0.67286617",
"0.6711965",
"0.62842315",
"0.6019971",
"0.59924304",
"0.59844387",
"0.59844387",
"0.59195125",
"0.5919479",
"0.59068644",
"0.5899297",
"0.5859986",
"0.5847478",
"0.580809",
"0.5790694",
"0.5790694",
"0.5790694",
"0.5787608",
"0.576951",
"0.57650995",
"0.57650995",
"0.5732925",
"0.57284385",
"0.5710519",
"0.56967896",
"0.569186",
"0.5675502",
"0.5636269",
"0.5598023",
"0.55924094"
]
| 0.74856 | 0 |
Check for threads that are scheduled to be closed and close them | async function applyScheduledCloses() {
const threadsToBeClosed = await threads.getThreadsThatShouldBeClosed();
for (const thread of threadsToBeClosed) {
const closeMode = thread.scheduled_close_silent;
if (config.closeMessage && ! closeMode & SCHEDULED_CLOSE_MODE.SILENT) {
const closeMessage = utils.readMultilineConfigValue(
config.closeMessage
);
await thread.sendSystemMessageToUser(closeMessage).catch(() => {});
}
await thread.close(false, closeMode & SCHEDULED_CLOSE_MODE.SILENT);
if (closeMode & SCHEDULED_CLOSE_MODE.PING) {
await sendCloseNotification(
thread,
`Почтовый тред #${thread.thread_number} с ${thread.user_name} (${thread.user_id}) был закрыт автоматически по истечению времени <@${thread.scheduled_close_id}>`
);
} else {
await sendCloseNotification(
thread,
`Почтовый тред #${thread.thread_number} с ${thread.user_name} (${thread.user_id}) был запланированно закрыт ${thread.scheduled_close_name}`
);
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function applyScheduledCloses() {\r\n const threadsToBeClosed = await threads.getThreadsThatShouldBeClosed();\r\n for (const thread of threadsToBeClosed) {\r\n if (config.closeMessage && ! thread.scheduled_close_silent) {\r\n const closeMessage = utils.readMultilineConfigValue(config.closeMessage);\r\n await thread.sendSystemMessageToUser(closeMessage).catch(() => {});\r\n }\r\n\r\n await thread.close(false, thread.scheduled_close_silent);\r\n\r\n await sendCloseNotification(thread, `Modmail thread #${thread.thread_number} with ${thread.user_name} (${thread.user_id}) was closed as scheduled by ${thread.scheduled_close_name}`);\r\n }\r\n }",
"close() {\n if (this._shells && this._shells.constructor.name !== 'Error') {\n this._shells.forEach((queue) => queue.shutdown())\n this._shells = undefined\n }\n }",
"close() {\n\t\tthis._killCheckPeriod();\n\t}",
"async function detenerCheckJobs() {\n clearInterval(nIntervId);\n monitorJobs = false;\n }",
"function close(){\n if(queue.size==0)\n {\n console.log('we dont have any more people in the queue.');\n rl.close();\n process.exit();\n }\n }",
"function cleanup(){\n var ret;\n modifier.stop().then(function() {\n \t for(var i = 0; i < wsConnections.length; i++) {\n \t \t// Could have been set to null if client closed\n \t \tif (wsConnections[i] !== null) {\n\t \t \twsConnections[i].send(ServerStatus[ServerStatus.Stopped]);\n\t \t \twsConnections[i].close(1000);\n\t \t \t// Unfortunately, the callback on the close-method is not working\n\t \t \t// So we have to do it with setTimeout.\n\t \t }\n \t }\n \t setTimeout(function() {\n \t \tret = true;\n \t }, 1000);\n }).catch(function(err) {\n \tconsole.error(err);\n });\n while(ret === undefined) {\n require('deasync').runLoopOnce();\n }\n return ret;\n}",
"function allStreamsClosed () {\n if (--j === 0) {\n callback();\n }\n }",
"function cleanup() {\n isShuttingDown = true;\n server.close(() => {\n debug('Closing remaining connections');\n db.then((_db) => _db.close().then(process.exit()));\n });\n\n setTimeout(() => {\n debug('Could not close connections in time, forcing shutdown');\n process.exit(1);\n }, 30 * 1000);\n}",
"function shutDown(){\n var self = instance;\n self.threadCancelled = true;\n //block while waiting for thread to terminate\n while (self.thread.isAlive()){\n try {\n Thread.sleep(1000);\n }\n catch (e) {\n self.threadCancelled = true;\n }\n }\n return true;\n}",
"dispose() {\n this.workers.forEach(t => t.dispose());\n if (this.own) {\n this.terminal.dispose();\n }\n }",
"closeAll() {\n return Promise.all(this._contexts.map(context => this._widgetManager.closeWidgets(context))).then(() => undefined);\n }",
"close() {\r\n this.setClosed(true);\r\n this.queue().close();\r\n }",
"async function closed () {\n return await getStatus() === 'closed'\n }",
"function isCloseCalled() {\n return globalThis.closed;\n }",
"shutdown () {\r\n for (let ix = 0; ix < this._sockets.length; ix++) {\r\n this.close(this._sockets[ix]);\r\n }\r\n this._sockets.length = 0;\r\n }",
"close(timeout) {\n if (this.closePromise) {\n return this.closePromise;\n }\n this.closePromise = new Promise(async (resolve) => {\n // this.closing prevents the worker from starting work on any new tasks\n this.closing = true;\n if (this.restartPollingAfterLongPollTimeout) {\n clearTimeout(this.restartPollingAfterLongPollTimeout);\n }\n if (this.activeJobs <= 0) {\n clearInterval(this.keepAlive);\n await this.grpcClient.close(timeout);\n this.grpcClient.removeAllListeners();\n Object.keys(this.jobStreams).forEach(key => {\n var _a, _b, _c, _d;\n (_b = (_a = this.jobStreams[key]) === null || _a === void 0 ? void 0 : _a.removeAllListeners) === null || _b === void 0 ? void 0 : _b.call(_a);\n (_d = (_c = this.jobStreams[key]) === null || _c === void 0 ? void 0 : _c.cancel) === null || _d === void 0 ? void 0 : _d.call(_c);\n delete this.jobStreams[key];\n this.logger.logDebug('Removed Job Stream Listeners');\n });\n resolve();\n }\n else {\n this.capacityEmitter.once(CapacityEvent.Empty, async () => {\n clearInterval(this.keepAlive);\n await this.grpcClient.close(timeout);\n this.grpcClient.removeAllListeners();\n this.emit('close');\n this.removeAllListeners();\n resolve();\n });\n }\n });\n return this.closePromise;\n }",
"function doneClosing()\n\t{\n\t\tthat.terminate();\n\t}",
"function stopOfflineStreamProcessors() {\n for (var i = 0; i < offlineStreamProcessors.length; i++) {\n offlineStreamProcessors[i].stop();\n }\n }",
"countClosing() {\n return(Object.keys(tClosers).length)\n }",
"function closeOnProcessTermination() {\n if (cleanup_registered) {\n return;\n }\n cleanup_registered = true;\n process.on(\"exit\", function () {\n logger(\"Shutting down\");\n killProcesses();\n });\n}",
"closeAllEntries() {\n for(var entryIndex in entries) {\n var entry = entries[entryIndex];\n\n if(entry.isCloseable()) {\n entry.close();\n }\n }\n\n this.updateWindowHeight();\n }",
"function h$resolveDeadlocks() {\n ;\n var kill, t, iter, bo, mark = h$gcMark;\n do {\n h$markWeaks();\n // deal with unreachable blocked threads: kill an unreachable thread and restart the process\n kill = null;\n iter = h$blocked.iter();\n while((t = iter.next()) !== null) {\n // we're done if the thread is already reachable\n if(((typeof t.m === 'number' && (t.m & 3) === mark) || (typeof t.m === 'object' && ((t.m.m & 3) === mark)))) continue;\n // check what we're blocked on\n bo = t.blockedOn;\n if(bo instanceof h$MVar) {\n // blocked on MVar\n if(bo.m === mark) throw \"assertion failed: thread should have been marked\";\n // MVar unreachable\n kill = h$ghcjszmprimZCGHCJSziPrimziInternalziblockedIndefinitelyOnMVar;\n break;\n } else if(t.blockedOn instanceof h$TVarsWaiting) {\n // blocked in STM transaction\n kill = h$ghcjszmprimZCGHCJSziPrimziInternalziblockedIndefinitelyOnSTM;\n break;\n } else {\n // blocked on something else, we can't do anything\n }\n }\n if(kill) {\n h$killThread(t, kill);\n h$markThread(t);\n }\n } while(kill);\n}",
"function h$resolveDeadlocks() {\n ;\n var kill, t, iter, bo, mark = h$gcMark;\n do {\n h$markWeaks();\n // deal with unreachable blocked threads: kill an unreachable thread and restart the process\n kill = null;\n iter = h$blocked.iter();\n while((t = iter.next()) !== null) {\n // we're done if the thread is already reachable\n if(((typeof t.m === 'number' && (t.m & 3) === mark) || (typeof t.m === 'object' && ((t.m.m & 3) === mark)))) continue;\n // check what we're blocked on\n bo = t.blockedOn;\n if(bo instanceof h$MVar) {\n // blocked on MVar\n if(bo.m === mark) throw \"assertion failed: thread should have been marked\";\n // MVar unreachable\n kill = h$ghcjszmprimZCGHCJSziPrimziInternalziblockedIndefinitelyOnMVar;\n break;\n } else if(t.blockedOn instanceof h$TVarsWaiting) {\n // blocked in STM transaction\n kill = h$ghcjszmprimZCGHCJSziPrimziInternalziblockedIndefinitelyOnSTM;\n break;\n } else {\n // blocked on something else, we can't do anything\n }\n }\n if(kill) {\n h$killThread(t, kill);\n h$markThread(t);\n }\n } while(kill);\n}",
"function h$resolveDeadlocks() {\n ;\n var kill, t, iter, bo, mark = h$gcMark;\n do {\n h$markWeaks();\n // deal with unreachable blocked threads: kill an unreachable thread and restart the process\n kill = null;\n iter = h$blocked.iter();\n while((t = iter.next()) !== null) {\n // we're done if the thread is already reachable\n if(((typeof t.m === 'number' && (t.m & 3) === mark) || (typeof t.m === 'object' && ((t.m.m & 3) === mark)))) continue;\n // check what we're blocked on\n bo = t.blockedOn;\n if(bo instanceof h$MVar) {\n // blocked on MVar\n if(bo.m === mark) throw \"assertion failed: thread should have been marked\";\n // MVar unreachable\n kill = h$ghcjszmprimZCGHCJSziPrimziInternalziblockedIndefinitelyOnMVar;\n break;\n } else if(t.blockedOn instanceof h$TVarsWaiting) {\n // blocked in STM transaction\n kill = h$ghcjszmprimZCGHCJSziPrimziInternalziblockedIndefinitelyOnSTM;\n break;\n } else {\n // blocked on something else, we can't do anything\n }\n }\n if(kill) {\n h$killThread(t, kill);\n h$markThread(t);\n }\n } while(kill);\n}",
"closeAll() {\n const that = this;\n\n for (var i = that._instances.length - 1; i > -1; i--) {\n that._close(that._instances[i]);\n }\n }",
"async function termination() {\n await crawlQueue.close();\n process.exit();\n}",
"function poll() {\n if (isClosing) {\n if (!isClosed && !activeJobs.size) {\n isClosed = true\n worker.emit('close')\n }\n // else wait for jobHandlers to complete\n }\n else {\n worker.emit('poll')\n abort = util.retry(RETRY_INTERVAL, pop, run)\n }\n }",
"function destroyStopped() {\n for (var id in _timers) {\n if (_timers[id].stopped) {\n destroy(id);\n }\n }\n}",
"function closeMail() {\n\t\tshutDown = true\n\t\tif (smtpTransport && pendingSends == 0) {\n\t\t\tsmtpTransport.close()\n\t\t\tsmtpTransport = undefined\n\t\t\tlogger('mail shut down')\n\t\t}\n\t}",
"function close() {\n lock.writeSync(0); // turn the lock pin off\n}"
]
| [
"0.72873867",
"0.59656674",
"0.57460296",
"0.5633413",
"0.5598141",
"0.54074544",
"0.53801537",
"0.535614",
"0.5314782",
"0.5295674",
"0.52796066",
"0.527865",
"0.5245535",
"0.5244968",
"0.51843786",
"0.51372606",
"0.51300836",
"0.5121815",
"0.50970364",
"0.5092351",
"0.5080278",
"0.50631005",
"0.50631005",
"0.50631005",
"0.50446165",
"0.5042955",
"0.5041695",
"0.5031328",
"0.5014003",
"0.49786565"
]
| 0.7417025 | 0 |
Fetch all posts created by a user | posts(user) {
return user.getPosts();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getPosts(){\n var posts = [];\n var currentUserId = Meteor.userId();\n \n // display only user's posts if currently logged in\n if (currentUserId){\n posts = Posts.find({owner: currentUserId}, {sort: {creationDate: -1}});\n } else {\n posts = Posts.find({}, {sort: {creationDate: -1}});\n }\n \n return posts;\n}",
"function getPosts() {\n Post\n // remote method that returns `posts` array with username\n .findAll()\n .$promise\n .then(function(results) {\n vm.posts = results.posts;\n });\n }",
"async myPosts(parent, args, ctx, info) {\n if (!ctx.request.userId) {\n throw new Error(\"You must be logged in\");\n }\n\n return ctx.db.query.posts(\n {\n where: {\n author: {\n id: ctx.request.userId,\n },\n },\n },\n info\n );\n }",
"function getPostsByUser(id) {\n const sql = `SELECT * FROM user_post WHERE userID = '${id}';`;\n const list = [];\n return db.execute(sql).then(([resp]) => {\n resp.forEach((elem) => {\n list.push(getPost(elem.postID));\n });\n return list;\n });\n}",
"function getPostByUserId(userId){\n // Get the user\n // and get their posts\n // and return it all together!!!\n db.many(`\n SELECT * FROM posts\n WHERE user_id = $1\n `, userId)\n .then((posts => {\n const user = getUserById(userId)\n \n user.then(theUser => {\n //console.log((theUser))\n console.log(theUser)\n posts.forEach((blog) => {\n console.log(`${theUser.name}: ${blog.url}`)\n })\n })\n }))\n .catch((e)=>{\n console.log(e)\n })\n\n}",
"async getUsers () {\n\t\tlet userIds = this.posts.reduce((accum, post) => {\n\t\t\taccum = [...accum, post.get('creatorId'), ...(post.get('mentionedUserIds') || [])];\n\t\t\treturn accum;\n\t\t}, []);\n\t\tuserIds = ArrayUtilities.unique(userIds);\n\n\t\tthis.users = await this.data.users.getByIds(userIds);\n\t}",
"async function _findPosts (filter) {\n const posts = await model.findAll({\n where: filter\n })\n const result = []\n for (const post of posts) {\n const author = await model._models.User.findById(post.authorId)\n const replies = await model.count({ where: { parentId: { [Op.eq]: post.id } } })\n result.push({ author: author, date: post.createdOn, text: post.content, replyCount: replies, id: post.id })\n }\n return result\n}",
"function getMyPosts(username) {\n const endpoint = `posts?query={\"author\":\"${username}\"}&sort={\"_kmd.ect\": -1}`;\n\n return remote.get('appdata', endpoint, 'kinvey');\n }",
"function getPosts(client, user, callBack) {\n client.HGETALL('posts', function(error, reply) {\n if (reply) {\n var list = Object.keys(reply).map(id => JSON.parse(reply[id]));\n if (user === 'all') {\n callBack(error, list)\n } else {\n list = list.filter(post => {return post.author === user})\n callBack(error, list)\n }\n } else {\n callBack(null, [])\n }\n })\n}",
"function getPostsByUser(uid, cb, count) {\n if (!count) {\n count = 50;\n }\n get_even({\n filter: \"user\",\n count: count,\n filter_data: uid,\n from: selfId,\n original: selfId,\n posts: {}\n }, function(posts) {\n cb(posts);\n });\n}",
"async getProfilePosts (req, res, next) {\n await Post.getUserPosts(req.params.username, (err, posts) => {\n if (err) return next(err)\n\n res.send(posts)\n })\n }",
"function getPostsByUserId(userId) {\n//1. Get the user\n//2. Get their posts\n db.many(`\n select * from posts\n where user_id = $1\n ;\n `, userId)\n .then(posts => {\n const userPromise = getUserById(userId);\n console.log(userPromise);\n userPromise.then(theUser => {\n // console.log(theUser);\n posts.forEach(post => {\n console.log(`${post.id}: ${post.url}`);\n })\n })\n})\n .catch(e => {\n console.log(e);\n })\n //and return it all together\n}",
"getPostsForUser(u) {\n return this.http.get(\"http://localhost:8080/api/posts/poster/\" + u.id);\n }",
"function fetchPostList(user, cb) {\r\n xhrWithAuth('GET',\r\n 'https://api.github.com/repos/' + user + '/' + user + '.github.io/contents/_posts',\r\n true,\r\n cb, onLogInFailed);\r\n }",
"function loadPosts() {\n API.userPosts(pathParams.user_id)\n .then(res =>\n setPosts(res.data)\n )\n .catch(err => console.log(err));\n }",
"async function getPosts() {\n // TODO: implement pagination\n const posts = await knex('posts')\n .select('*')\n .where({\n parent_id: null\n });\n\n const ownerUsers = await knex('users')\n .select('*')\n .distinct()\n .whereIn('id', posts.map(p => p.owner_user_id));\n\n // Map users to posts\n const usersMap = {};\n for (const u of ownerUsers) {\n usersMap[u.id] = u;\n }\n for (const p of posts) {\n p.ownerUser = usersMap[p.owner_user_id];\n }\n\n return camelize(posts);\n}",
"async getUsers(filter) {\n return await User.find({}, null, filter).\n select('-password -__v').\n populate('posts')\n }",
"async getPosts() {\n try {\n const posts = await Post.find().sort({ createdAt: -1 });\n return posts;\n } catch (err) {\n console.log(` An error as occurred while fetching the posts ${JSON.stringify(err)} `);\n throw new Error(err);\n }\n }",
"async getReposts (req, res, next) {\n User.getReposts(req.params.username, (err, posts) => {\n if (err) {\n res.status(400).send(err)\n } else {\n res.send(posts)\n }\n })\n }",
"posts(parent, args, ctx, info) {\n // 'User' Object data -> is present in 'parent' argument in posts() method\n return POSTS_DATA.filter(post => {\n return post.author === parent.id\n })\n }",
"static getAllPosts() {\n return fetch('https://dev-selfiegram.consumertrack.com/users/1/feed').then(response => {\n return response.json();\n }).catch(error => {\n return error;\n });\n }",
"function findPosts(id) {\n return db('posts as p')\n .join('users as u', 'u.id', 'p.user_id')\n .select('p.id', 'u.username', 'p.contents')\n .where({ user_id: id });\n}",
"function getPosts(res, posts) {\n const user = db.users[res.locals.userid];\n const feed = db.posts.feed;\n const filtered = user[posts].reduce((result, id) => {\n if (!feed[id].isDeleted)\n result.push(feed[id]);\n return result;\n }, []);\n return filtered;\n}",
"fetchAll(params) {\n return api.get('posts', params).then(response => ({\n posts: _.map(_.filter(response.data, filterPosts), post => new Post(post)),\n paging: response.paging\n }));\n }",
"function getPosts() {\n\tvar snippet = {\n\t\tquery : {},\n\t\tfields: \"title,category,thumbnail\"\n\t}\n\t// for unpublished\n\t// snippet.query = {published: false, nextKey: '-K_W8zLX65ktmaKwf1Yx'}\n\n\trimer.post.find(snippet, function(error, value) {\n\t\tif(error) {\n\t\t\tconsole.log(error)\n\t\t}\n\t\telse {\n\t\t\tconsole.log(value)\n\t\t}\n\t})\n}",
"allPostByUser(req, res) {\n const userId = req.params.id\n let posts = postModel.find({ postedBy: userId }).populate(\"postedBy\", \"_id name profile_pic\").sort({ _id: -1 });\n posts.exec((err, posts) => {\n if (err) { console.log(err) };\n return res.json({ posts })\n })\n }",
"appliedPosts(u) {\n return this.http.get(\"http://localhost:8080/api/posts/applied/\" + u.username);\n }",
"function getAllPostsByMe(){\n\tvar info = {\n\t\t\t\"type\":\"postByMe\",\n\t\t};\n\t$.get(BASE_URL+\"php/view.php\",info,function(data){\n\t\t\tconsole.log(data);\n\t\t\tviewMyPosts(data);\n\t\t}).fail(function(jqXHR){\n\t\tconsole.log(jqXHR.statusText);\n\t});\n}",
"async function getPostsByUserId(id) {\n const [ results ] = await mysqlPool.query(\n 'SELECT * FROM posts WHERE userId = ?',\n [ id ]\n );\n\n if(results) {\n for(var i = 0; i < results.length; i++){\n console.log(results[i].postId);\n results[i].comments = await getCommentsByPostId(results[i].postId);\n results[i].likes = await getLikesByPostId(results[i].postId);\n }\n }\n console.log(results);\n return results;\n}",
"async getPosts (params) {\n const endpoint = this.addParamsToEndPoint('posts', params)\n\n const { posts } = await this.get(endpoint)\n return posts\n }"
]
| [
"0.74919844",
"0.74148387",
"0.7263313",
"0.72552896",
"0.7079012",
"0.7008244",
"0.70023364",
"0.69027275",
"0.686663",
"0.6862673",
"0.6860463",
"0.6856039",
"0.6796464",
"0.67176944",
"0.66719204",
"0.6638497",
"0.6590459",
"0.6585281",
"0.65516216",
"0.65416783",
"0.6527407",
"0.6491962",
"0.64327466",
"0.6392051",
"0.63835776",
"0.6375538",
"0.63526386",
"0.6350825",
"0.6341888",
"0.63184345"
]
| 0.7831254 | 0 |
Label with required field display, htmlFor, and block styling | function Label(_ref) {
var htmlFor = _ref.htmlFor,
label = _ref.label,
required = _ref.required;
return _react.default.createElement("label", {
style: {
display: "block"
},
htmlFor: htmlFor
}, label, " ", required && _react.default.createElement("span", {
style: {
color: "red"
}
}, " *"));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function FieldLabel({ model }) {\n const { label, isMandatory } = model;\n\n if (!label || label.length === 0) {\n return null;\n }\n return (\n <div className=\"ff-field-label\" >\n {label}\n {(isMandatory) && (\n <span className=\"ff-field-mandatory\">*</span>\n )}\n </div>\n );\n}",
"function Label({\n children,\n className,\n disabled,\n hide,\n id,\n invalid,\n required,\n}) {\n if (hide) {\n return (\n <label\n id={`${id}Label`}\n htmlFor={id}\n style={{ position: 'relative' }}\n >\n <VisuallyHidden>{children}</VisuallyHidden>\n </label>\n );\n }\n\n const labelClasses = classNames(\n 'db',\n 'mb-2',\n 'fs-6',\n 'fw-700',\n {\n 'neutral-500': disabled,\n red: invalid,\n },\n className,\n );\n\n return (\n <Block direction=\"column\">\n <label id={`${id}Label`} htmlFor={id} className={labelClasses}>\n <span className={classNames({ 'required-input': required })}>\n {children}\n </span>\n </label>\n </Block>\n );\n}",
"function _labelIsRequired(){\n\n\t\tif (this.getRequired && this.getRequired()) {\n\t\t\treturn true;\n\t\t}\n\n\t\tvar oFormElement = this.getParent();\n\t\tvar aFields = oFormElement.getFields();\n\n\t\tfor ( var i = 0; i < aFields.length; i++) {\n\t\t\tvar oField = aFields[i];\n\t\t\tif (oField.getRequired && oField.getRequired() === true &&\n\t\t\t\t\t(!oField.getEditable || oField.getEditable())) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\n\t}",
"function SP_RequiredLabelToggle(labelId,setRequired)\n{\n\tif(arguments.length > 2)\n\t{\n\t\tvar label = $('label[for='+labelId+']');\n\t\tif(setRequired == true)\n\t\t{\n\t\t\tif(label.text().indexOf(\"*\") == -1)\n\t\t\t{\n\t\t\t\tlabel.text(\"* \"+ label.text());\n\t\t\t\tlabel.addClass(\"dynamicRequiredLabel\");\n\t\t\t}\n\t\t}\n\t\telse if(setRequired == false)\n\t\t{\n\t\t\tif(label.text().indexOf(\"*\") == 0)\n\t\t\t{\n\t\t\t\tlabel.text(label.text().split(\"*\")[1]);\n\t\t\t\tlabel.removeClass(\"dynamicRequiredLabel\");\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(setRequired == true && SP_HasClass(document.getElementById(labelId),'dynamicLabel'))\n\t\t{\n\t\t\tdocument.getElementById(labelId).innerHTML = \"* \"+document.getElementById(labelId).innerHTML;\n\t\t\tSP_RemoveClass(document.getElementById(labelId),\"dynamicLabel\");\n\t\t\tSP_AddClass(document.getElementById(labelId),\"dynamicRequiredLabel\");\n\t\t}\n\t\telse if(setRequired == false && SP_HasClass(document.getElementById(labelId),'dynamicRequiredLabel'))\n\t\t{\n\t\t\tdocument.getElementById(labelId).innerHTML = document.getElementById(labelId).innerHTML.slice(1);\n\t\t\tSP_AddClass(document.getElementById(labelId),\"dynamicLabel\");\n\t\t\tSP_RemoveClass(document.getElementById(labelId),\"dynamicRequiredLabel\");\n\t\t}\n\t}\n}",
"function renderLabel(inputObject, inputLine) {\n\n var leadingLabelTag = \"<a class=\\\"mLabel\\\" data-toggle=\\\"tooltip\\\" data-placement=\\\"top\\\" title=\\\"Line Label\\\">\";\n var trailingTag = \"</a>\";\n\n if (inputObject.lineLabel) {\n inputLine = inputLine + leadingLabelTag + inputObject.lineLabel + trailingTag;\n }\n if (inputObject.lineLeadSpace) {\n inputLine = inputLine + inputObject.lineLeadSpace;\n }\n return inputLine;\n}",
"function VLabel(value, name, isMandatory, isADControl) {\n value = value != null ? value.replace(\"[&]\", \"\") : \"\";\n var strFor = ' for=\"' + name + '\"';\n if (isADControl)\n strFor = '';\n\n var $ctrl = $('<label ' + strFor + '></label>');\n\n IControl.call(this, $ctrl, VIS.DisplayType.Label, true, isADControl ? name : \"lbl\" + name);\n if (isMandatory) {\n $ctrl.text(value).append(\"<sup>*</sup>\");\n }\n else {\n $ctrl.text(value);\n }\n\n this.disposeComponent = function () {\n $ctrl = null;\n self = null;\n }\n }",
"function _labelIsDisplayOnly(){\n\n\t\tif (this.getDisplayOnly) {\n\t\t\tif (!this.isPropertyInitial(\"displayOnly\")) {\n\t\t\t\treturn this.getDisplayOnly();\n\t\t\t}\n\n\t\t\tvar oFormElement = this.getParent();\n\t\t\treturn !oFormElement._getEditable();\n\t\t}\n\n\t\treturn false;\n\n\t}",
"function errorLabel(message) {\n\treturn '<label class=\"control-label\">\\\n\t\t\t\t<i class=\"fa fa-times-circle-o\"></i> '+message+'</label>'\n}",
"getFormLabelContent() {\n\t\tif (this.props.textDictionary.labelText && this.props.textDictionary.labelText.length !== 0) {\n\t\t\treturn (\n\t\t\t\t<label className={ClassNameUtil.getClassNames(['fbra_passwordFormInput_label', 'fbra_test_passwordFormInput_label'])}>{this.props.textDictionary.labelText}</label>\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t}",
"function AddDisplay(fieldName, fieldValue) {\r\n\r\n if (fieldName == \"Address Verification\") {\r\n var string = \"<div class=\\\"form-group\\\">\";\r\n string += \"<label class=\\\"col-md-4 control-label\\\">\";\r\n string += fieldName;\r\n string += \"</label>\";\r\n string += \"<div class=\\\"col-md-7\\\">\";\r\n string += \"<p class=\\\"form-control text-center\\\">\";\r\n string += fieldValue;\r\n string += \"</p>\";\r\n string += \"</div>\";\r\n string += \"</div>\";\r\n return string;\r\n }\r\n else if (fieldValue) {\r\n var string = \"<div class=\\\"form-group\\\">\";\r\n string += \"<label class=\\\"col-md-4 control-label\\\">\";\r\n string += fieldName;\r\n string += \"</label>\";\r\n string += \"<div class=\\\"col-md-7\\\">\";\r\n string += \"<p class=\\\"form-control text-center\\\">\";\r\n string += fieldValue;\r\n string += \"</p>\";\r\n string += \"</div>\";\r\n string += \"</div>\";\r\n return string;\r\n }\r\n else\r\n return \"\";\r\n }",
"_hideLabelIfEmpty() {\n const label = this._elements.label;\n\n // If it's empty and has no non-textnode children, hide the label\n const hiddenValue = !(label.children.length === 0 && label.textContent.replace(/\\s*/g, '') === '');\n\n // Toggle the screen reader text\n this._elements.labelWrapper.style.margin = !hiddenValue ? '0' : '';\n this._elements.screenReaderOnly.hidden = hiddenValue || this.labelled;\n }",
"function addAsteriskToLabel($fields){\n var required = $fields.attr('required');\n var label = getFieldLabelType($fields);\n\n $fields.each(function(){\n var $this = $(this);\n var required = $this.attr('required');\n var label = getFieldLabelType($this);\n \n var $formfieldWrap = $this.parents('.formfield');\n\n labelValue = $this.parents('.formfield').find('label').text();\n\n if (required && !hasAsterisk(labelValue)){\n $formfieldWrap.find(label).append('<span class=\"yv-required-field\">*</span>'); // Add asterisk to label\n }\n });\n\n }",
"function required(element) {\n if (element.value === \"\") {\n $(element).next().remove();\n var value = $(element).closest('.form__group').find('.form__label').text();\n $(element).after(`<span class=\"form-error-msg\">${value} is required</span>`\n );\n return true;\n } else {\n $(element).next().remove();\n return false;\n }\n}",
"function fillLabel(opt) {\n Object(util_model[\"f\" /* defaultEmphasis */])(opt, 'label', ['show']);\n} // { [componentType]: MarkerModel }",
"@readOnly\n @computed('renderLabel')\n addLabel (renderLabel) {\n return `Add ${Ember.String.singularize(renderLabel).toLowerCase()}`\n }",
"renderConfirmationForm() {\n return (\n <form>\n <FormGroup controlId=\"confirmationCode\" bsSize=\"large\">\n <ControlLabel>Confirm your identity via your email address</ControlLabel>\n <HelpBlock>Please check your email for the verification link.</HelpBlock>\n </FormGroup>\n\n </form>\n );\n }",
"renderLabel() {\n return (\n {\n Name: () => {\n if (this.state.error[0] === true) {\n return <Label bsStyle=\"danger\">Please input Name</Label>\n }\n },\n Address: () => {\n if (this.state.error[1] === true) {\n return <Label bsStyle=\"danger\">Please input Address</Label>\n }\n },\n Revenue: () => {\n if (this.state.error[2] === true) {\n return <Label bsStyle=\"danger\">Please input Revenue</Label>\n }\n },\n Phone: () => {\n if (this.state.error[3] === true || this.state.error[4] === true) {\n return <Label bsStyle=\"danger\">Please input Code & Phone Number</Label>\n }\n }\n }\n )\n }",
"render() {\n if (this.textContent) {\n return html`\n <label part=\"label\" for=\"${this.name}\"><slot /></label>\n ${this.renderSelect()}\n `;\n }\n return this.renderSelect();\n }",
"function setInputLabel(elemId) {\n // Define label selector\n let label = `label[for=\"${elemId}\"]`;\n\n // Get default label text\n let labelText = $(label).attr(\"data-default\");\n\n // Define label color var\n let labelColor = '';\n\n // If the input element has the invalid class...\n if ($(`#${elemId}`).hasClass('invalid')) {\n // Get the error label text\n labelText = $(label).attr(\"data-error\");\n\n // Set the label color to the MaterializeCSS invalid class color\n labelColor = \"#F44336\";\n }\n\n // Set the label text and color\n $(label).html(labelText).\n css(\"color\", labelColor);\n}",
"function toggleLabel() {\n var input = $(this);\n setTimeout(function() {\n var def = input.attr('title');\n if (!input.val() || (input.val() == def)) {\n input.prev('span').css('visibility', '');\n if (def) {\n var dummy = $('<label></label>').text(def).css('visibility','hidden').appendTo('body');\n input.prev('span').css('margin-left', dummy.width() + 3 + 'px');\n dummy.remove();\n }\n } else {\n input.prev('span').css('visibility', 'hidden');\n }\n }, 0);\n }",
"get label() {\n if (this.isObject(this.options)) {\n return this.options.label;\n }\n else {\n return '';\n }\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}",
"get escapeLabelHTML() {\n return false;\n }",
"function markAsInvalid(element, labelName) {\r\n\t \r\n\t new YAHOO.util.Element(element).addClass(\"invalid\");\r\n\t if (labelName != null && labelName != \"\") {\r\n\t\t// labelName is the value of the 'for' attribute\r\n\t\t// for the label tag that should be highlighted.\r\n\t\tvar labelEl = YAHOO.util.Dom.getElementBy(function(el){return(el.htmlFor == labelName);},\"label\");\r\n\t\t\r\n\t\tnew YAHOO.util.Element(labelEl).addClass(\"invalid\");\r\n\t }\r\n}",
"function addBlockedLabel() {\n $('.issue-list-item[data-blocked=\"true\"]').each(function() {\n var label = '<span class=\"label label-danger\">BLOCKED</span>'\n $(this).find('.issue-text').append(\" \" + label);\n });\n}",
"function label(fieldName, fieldLabel) {\n let label = document.createElement('label');\n\n label.setAttribute('for', fieldName);\n label.textContent = fieldLabel;\n\n return label;\n}",
"labelClass () {\n let klass = ''\n\n if (this.state.error) {\n klass += ' usa-input-error-label'\n }\n\n if (this.state.checked) {\n klass += ' checked'\n }\n\n if (this.state.focus) {\n klass += ' usa-input-focus'\n }\n\n return klass.trim()\n }",
"function beginLabel(TokenConstructor) {\n var token = new TokenConstructor('html_inline', '', 0);\n token.content = '<label>';\n return token;\n }",
"function Label(opt_options) {\n // Initialization\n this.setValues(opt_options);\n\n var div = this.div_ = document.createElement('div');\n div.style.cssText = 'position: absolute; display: none;';\n }",
"function printErrorMessage() {\n $(\"#error-message\").append(\n \"<label class='container-fluid mt-5 text-center text-danger h3'>Group Code Does Not Exist!</label>\"\n );\n}"
]
| [
"0.670288",
"0.60990804",
"0.5998615",
"0.5868826",
"0.5847852",
"0.5778551",
"0.5767557",
"0.5738318",
"0.568455",
"0.5545074",
"0.5482438",
"0.54752636",
"0.5445866",
"0.5419466",
"0.5392262",
"0.5384172",
"0.5381788",
"0.5366222",
"0.53472376",
"0.5327174",
"0.53151035",
"0.5315044",
"0.5307909",
"0.5300695",
"0.5291739",
"0.5273167",
"0.52690893",
"0.52566135",
"0.5252305",
"0.522745"
]
| 0.63564664 | 1 |
Create a function that takes a number (step) as an argument and returns the number of matchsticks in that step. See step 1, 2 and 3 in the image above. | function matchHouses(step) {
if (step === 0){
return 0;
} else {
return (5 * step) + 1
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function numWays(steps){\n var stairs = new Array(steps+1);\n stairs[0] = 1;\n stairs[1] = 1;\n for(var i=2;i<stairs.length;i++){\n stairs[i] = stairs[i-1]+stairs[i-2];\n }\n return stairs[steps]\n}",
"function stepsCount(num, steps) {\n if (num <= 0) return;\n if (num === 1) {\n // console.log(steps + \" steps\");\n return steps;\n }\n if (num % 2 === 0) {\n num /= 2;\n // steps++;\n // console.log(num);\n // console.log(steps);\n return 1 + stepsCount(num, steps);\n } else if (num % 2 === 1) {\n num = num * 3 + 1;\n // steps++;\n return 1 + stepsCount(num, steps);\n }\n}",
"function counter(step = 1) {\n var count = 0;\n return function increaseCount() {\n count = count + step;\n return count;\n };\n }",
"function stepsCount(num, steps) {\n if (num <= 0) return;\n if (num === 1) {\n console.log(steps + \" steps\");\n return;\n }\n if (num % 2 === 0) {\n num /= 2;\n steps++;\n // console.log(num);\n // console.log(steps);\n stepsCount(num, steps);\n } else if (num % 2 === 1) {\n num = num * 3 + 1;\n steps++;\n stepsCount(num, steps);\n }\n}",
"function steps(steps) {\n if ( steps === void 0 ) steps = 10;\n\n return function (t) { return Math.round(t * steps) * (1 / steps); };\n}",
"function steps(steps) {\n if ( steps === void 0 ) steps = 10;\n\n return function (t) { return Math.round(t * steps) * (1 / steps); };\n}",
"function steps(steps) {\n if ( steps === void 0 ) steps = 10;\n\n return function (t) { return Math.round(t * steps) * (1 / steps); };\n}",
"function steps(steps) {\n if ( steps === void 0 ) steps = 10;\n\n return function (t) { return Math.ceil((minMax(t, 0.000001, 1)) * steps) * (1 / steps); };\n}",
"function numStepsUtil(steps, mem) {\n if (steps < 0) {\n return 0;\n } else if (steps === 0) {\n return 1;\n } else if(mem[steps]){\n return mem[steps];\n } else {\n mem[steps] = numSteps(steps - 1, mem) + numSteps(steps - 2, mem) + numSteps(steps- 3, mem);\n return mem[steps];\n }\n}",
"function incrementMatchCount() {\n matchCount += 2;\n}",
"function numberSteps() {\n\tlet countPlay = numMove + 1; \n\tnumMove = document.getElementById('moveCount').innerHTML = countPlay;\n}",
"function countSteps() {\n\n steps += 1;\n document.getElementById(\"numberOfSteps\").innerHTML = \"Steps: \" + steps;\n}",
"function howManyStickers(numberOfLines) { // Write this function\n return numberOfLines*numberOfLines*6;\n}",
"function countSteps(val, step, overflow){\n\t val = Math.floor(val / step);\n\n\t if (overflow) {\n\t return val % overflow;\n\t }\n\n\t return val;\n\t }",
"function stepCounter(stepRatio) {\n stepRatio = Math.floor((today.adjusted.steps/goals.steps)*720);\n return stepRatio;\n}",
"function generateStep (steps) {\n\t\t return function (p) {\n\t\t return Math.round(p * steps) * (1 / steps);\n\t\t };\n\t\t }",
"function generateStep (steps) {\n return function (p) {\n return Math.round(p * steps) * (1 / steps);\n };\n }",
"function generateStep (steps) {\n\t return function (p) {\n\t return Math.round(p * steps) * (1 / steps);\n\t };\n\t }",
"function generateStep (steps) {\n\t return function (p) {\n\t return Math.round(p * steps) * (1 / steps);\n\t };\n\t }",
"function generateStep (steps) {\n\t return function (p) {\n\t return Math.round(p * steps) * (1 / steps);\n\t };\n\t }",
"function foldTo(distance) {\n if (distance < 0) return null;\n let numFolds = 0;\n let thickness = 0.0001;\n while (thickness < distance) {\n numFolds++;\n thickness *= 2;\n }\n return numFolds;\n}",
"function generateStep (steps) {\n return function (p) {\n return Math.round(p * steps) * (1 / steps);\n };\n }",
"function generateStep (steps) {\n return function (p) {\n return Math.round(p * steps) * (1 / steps);\n };\n }",
"function generateStep (steps) {\n return function (p) {\n return Math.round(p * steps) * (1 / steps);\n };\n }",
"function generateStep (steps) {\n return function (p) {\n return Math.round(p * steps) * (1 / steps);\n };\n }",
"function generateStep (steps) {\n return function (p) {\n return Math.round(p * steps) * (1 / steps);\n };\n }",
"function generateStep(steps) {\n return function (p) {\n return Math.round(p * steps) * (1 / steps);\n };\n }",
"function generateStep(steps) {\r\n\t\t\treturn function(p) {\r\n\t\t\t\treturn Math.round(p * steps) * (1 / steps);\r\n\t\t\t};\r\n\t\t}",
"function generateStep(steps) {\r\n\t\t\treturn function(p) {\r\n\t\t\t\treturn Math.round(p * steps) * (1 / steps);\r\n\t\t\t};\r\n\t\t}",
"function generateStep(steps) {\n\t\t\t\treturn function(p) {\n\t\t\t\t\treturn Math.round(p * steps) * (1 / steps);\n\t\t\t\t};\n\t\t\t}"
]
| [
"0.6326018",
"0.62703425",
"0.61365795",
"0.6103491",
"0.60844654",
"0.60844654",
"0.60844654",
"0.59861463",
"0.5896685",
"0.58959943",
"0.5886099",
"0.5827093",
"0.57891214",
"0.57764864",
"0.57749146",
"0.5746566",
"0.57333976",
"0.56991816",
"0.56991816",
"0.56991816",
"0.5690977",
"0.5672241",
"0.5672241",
"0.5672241",
"0.5672241",
"0.5672241",
"0.5660913",
"0.5652614",
"0.5652614",
"0.5626191"
]
| 0.7258101 | 0 |
prints the deck of card objects | print_deck() {
if (this.deck.length === 0) {
console.log(
"Deck has not been generated. Call generate_deck() on deck object before continuing.",
)
} else {
for (let c = 0; c < this.deck.length; c++) {
console.log(this.deck[c])
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"printDeck(){\n console.log(\"Printing deck..\");\n for (const card of this.cards){\n card.displayCard();\n }\n // for (let i=0; i < this.cards.length; i++){\n // console.log(`${i+1}:${this.cards[i]}`);\n //}\n }",
"function printDeck() {\n var result = \"[\";\n for (var i = 0; i < deckCards.arrayOfCards.length; i++) {\n result += deckCards.arrayOfCards[i] + \", \";\n }\n result += \"]\";\n return result;\n}",
"function printStringsDeck() {\n var result = \"\";\n for (var i = 0; i < 52; i++) {\n result += \"Card ---> \" + deckCards.arrayOfCards[i] + \"\\n\";\n }\n return result;\n}",
"function ShowCards(deck)\n{\n deck.forEach(element => {\n console.log(element.value + ' of ' + element.suit)\n });\n\n console.log('***************************************************')\n}",
"function showCards(deck) {\n if (deck.length === 0) {\n console.log(\"\\nThis deck appears to be empty. Create cards to populate this deck.\\n\")\n menu()\n }\n else {\n for (var x = 0; x < deck.length; x++) { \n var partial = getCard(deck[x])\n // Determine cloze vs basic\n // cloze case\n if (deck[x].type === 'Cloze') {\n console.log(chalk.bgBlack(\"--------------------------CLOZE CARD--------------------------\"));\n console.log(chalk.blue(\"Position in deck: \") + x )\n console.log(chalk.bgBlack(\"-------------------------Partial Text-------------------------\"))\n console.log(chalk.blue(partial))\n console.log(chalk.bgBlack(\"--------------------------Cloze Text--------------------------\"))\n console.log(chalk.blue(deck[x].cloze))\n console.log(chalk.bgBlack(\"--------------------------------------------------------------\" + \"\\n\"))\n }\n // basic case\n else {\n console.log(chalk.bgBlack(\"--------------------------BASIC CARD--------------------------\"))\n console.log(chalk.blue(\"Position in deck: \") + x )\n console.log(chalk.bgBlack(\"----------------------------FRONT-----------------------------\"))\n console.log(chalk.blue(deck[x].front))\n console.log(chalk.bgBlack(\"-----------------------------BACK-----------------------------\"))\n console.log(chalk.blue(deck[x].back))\n console.log(chalk.bgBlack(\"--------------------------------------------------------------\" + \"\\n\"))\n }\n }\n inquirer.prompt([\n {\n \"name\": \"next\",\n \"message\": \"What would you like to do next?\",\n \"type\": \"list\",\n \"choices\": [\"Create a new card\", \"Delete a card from this deck\", \"Return to the main menu\"]\n }\n ]).then(function(answer) {\n switch (answer.next) {\n case \"Create a new card\":\n createCard();\n break;\n case \"Delete a card from this deck\":\n inquirer.prompt([\n {\n \"name\": \"toDelete\",\n \"message\": \"Please input the position number of the card you would like to delete. This is denoted on each card.\",\n \"type\": \"input\"\n } \n ]).then(function(answer) {\n var index = parseInt(answer.toDelete)\n deleteCard(deck, index)\n })\n \n break;\n case \"Return to the main menu\":\n menu()\n break;\n }\n })\n }\n}",
"function printCards(pid)\n{\t\n\tp = players[pid];\t\n\t// print suspects\n\tconsole.log(\"Player \" + p.id + \"\\nSuspects\" + \"\\nYes: \");\n\tvar j;\n\tfor(j = 0; j < p.suspects.yes.length; j++)\n\t{\n\t\tconsole.log(p.suspects.yes[j]);\n\t}\n\tconsole.log(\"\\nMaybe: \");\n\tfor(j = 0; j < p.suspects.maybe.length; j++)\n\t{\n\t\tconsole.log(p.suspects.maybe[j]);\n\t}\n\tconsole.log(\"\\nNo: \");\n\tfor(j = 0; j < p.suspects.no.length; j++)\n\t{\n\t\tconsole.log(p.suspects.no[j]);\n\t}\n\t// print weapons\n\tconsole.log(\"Weapons\" + \"\\nYes: \");\n\tvar j;\n\tfor(j = 0; j < p.weapons.yes.length; j++)\n\t{\n\t\tconsole.log(p.weapons.yes[j]);\n\t}\n\tconsole.log(\"\\nMaybe: \");\n\tfor(j = 0; j < p.weapons.maybe.length; j++)\n\t{\n\t\tconsole.log(p.weapons.maybe[j]);\n\t}\n\tconsole.log(\"\\nNo: \");\n\tfor(j = 0; j < p.weapons.no.length; j++)\n\t{\n\t\tconsole.log(p.weapons.no[j]);\n\t}\n\t// print rooms\n\tconsole.log(\"Rooms\" + \"\\nYes: \");\n\tvar j;\n\tfor(j = 0; j < p.rooms.yes.length; j++)\n\t{\n\t\tconsole.log(p.rooms.yes[j]);\n\t}\n\tconsole.log(\"\\nMaybe: \");\n\tfor(j = 0; j < p.rooms.maybe.length; j++)\n\t{\n\t\tconsole.log(p.rooms.maybe[j]);\n\t}\n\tconsole.log(\"\\nNo: \");\n\tfor(j = 0; j < p.rooms.no.length; j++)\n\t{\n\t\tconsole.log(p.rooms.no[j]);\n\t}\n}",
"viewHand() {\n console.log(\"Printing the hand of player [\" + this.name + \"]\");\n this.cards.forEach(card => {\n console.log(card.toString());\n });\n }",
"printPlayerCard(Player){\n console.log(` ---------${Player.name} CARD---------- `)\n console.log(`STONES:${Player.stonesLeft}-- TOKEN:${Player.tokensLeft}--|`)\n console.log(` ---------${Player.name} DICE---------- `)\n for(var dice in Player.playerDicePot ) {\n console.log(dice.currentFace) \n }\n console.log(` -------------------------------- `);\n console.log(\"GOD FAVOURS\")\n for(var token in Player.godTokenObjectList ) {\n console.log(token) \n }\n }",
"showCard() {\n // console.log(`${this.name} of ${this.suit}`);\n }",
"function displayCardFromDeck(card){\n return card.value + \" of \" + card.suit;\n}",
"display() {\n if (this.cards.length) {\n // show the top card and make all cards move towards the position\n // of the deck\n this.cards[0].display(this.pos.x, this.pos.y, true);\n this.cards.forEach(c => c.approach(this.pos));\n } else {\n //show the empty slot\n stroke(0);\n strokeWeight(3);\n fill(255, 255, 255, 100);\n rect(this.pos.x, this.pos.y, CARDWIDTH, CARDHEIGHT);\n }\n }",
"function consoleCards(array){\n for(x in array){\n console.log(x + '. ' + array[x].name);\n }\n}",
"function _displayDeck () {\n _sortDeck(); // the deck must be sorted for it to be displayed correctly (all repeated cards grouped instead of showing twice).\n\n let jDeckCards = $(\"#deck-cards\");\n jDeckCards.empty();\n \n for (let i = 0; i < deck.length; i++) {\n let cardId = deck[i];\n let card = getCardById(cardId);\n let isLegendary = card.rarity === \"LEGENDARY\";\n let areTwo = deck[i + 1] === cardId;\n\n jDeckCards.append(`\n <div class=\"card-token-reduced draggable\" data-id=\"${cardId}\" draggable=\"true\" ondragstart=\"dragDeckCard(event)\" ondragend=\"dragDeckCardEnd(event)\">\n <div class=\"card-cost rarity-${card[\"rarity\"].toLowerCase()}\">${card[\"cost\"]}</div>\n <div class=\"card-name\">\n <img class=\"tile\" src=\"https://art.hearthstonejson.com/v1/tiles/${cardId}.png\" />\n <span class=\"tile-fade-out\"></span>\n <span class=\"caption\">${card[\"name\"]}</span>\n </div>\n ${areTwo ? `<div class=\"card-amount\">2</div>` : \"\"}\n ${isLegendary ? `<div class=\"card-amount\">★</div>` : \"\"}\n </div>\n `);\n \n i += areTwo;\n }\n\n console.log(deck);\n}",
"show(hideFirstCard = false)\n\t{\n\t\tif (this.numCards == 0)\n\t\t\treturn;\n\n\t\tif (hideFirstCard == true)\n\t\t\tcout(\"** \");\n\t\telse\n\t\t{\n\t\t\tthis.cards[0].print(true);\n\t\t\tcout(\" \");\n\t\t}\n\n\t\tfor (let x = 1; x < this.numCards; x++)\n\t\t{\n\t\t\tthis.cards[x].print(true);\n\t\t\tcout(\" \");\n\t\t}\n\t}",
"function createDeck() {\r\n let deckDOM = document.querySelector('.deck');\r\n\r\n shuffle(deckOfCards);\r\n\r\n let temp = '';\r\n let i = 0;\r\n let len = deckOfCards.length;\r\n for (; i < len; i++) {\r\n temp = temp + printCardHTML(deckOfCards[i]);\r\n }\r\n\r\n deckDOM.innerHTML = temp;\r\n}",
"function listCards(arr) {\r\n for (i in arr) {\r\n console.log(i + \": \" + arr[i].value + \" of \" + arr[i].suit);\r\n }\r\n}",
"cardToString(){\n return this.number + \" of \" + this.suit + \" (\" + this._isFaceUp + \")\";\n }",
"displayInConsole() {\n console.log(\"{ name: \" + this.name + \", colors: \" + this.colors + \", manaCost: \" + this.manaCost + \", type: \" + this.modifier + \", TCGPlayer price: \" + this.tcgprice + \", Card Kingdom price: \" + this.ckprice);\n }",
"function draw_show_cards(deck) {\n drawn_cards = jsPsych.randomization.sampleWithoutReplacement(deck, 4)\n left_card = drawn_cards[0];\n right_card = drawn_cards[1];\n left_with_tag = \"<img class='card_left' src='\" + left_card + \"'>\"\n right_with_tag = \"<img class='card_right' src='\" + right_card + \"'>\"\n return left_with_tag + right_with_tag + fixation;\n}",
"function drawcards(cards, suits) {\n var lines = [\"\", \"\", \"\", \"\", \"\"];\n var value = [];\n if (cards.length == 1) { //if only one card is passed we draw the first card face down\n lines = [\".---.\", \"|///|\", \"|///|\", \"|///|\", \"'---'\"];\n }\n //topline\n for (i = 0; i < cards.length; i++) {\n lines[0] += \".---.\";\n }\n lines[0] += \"</br>\";\n\n //2nd line (contains value)\n for (i = 0; i < cards.length; i++) {\n lines[1] += \"|\" + cardvalue(cards[i]);\n if (cardvalue(cards[i]) == 10) {\n lines[1] += \" |\";\n } else {\n lines[1] += \" |\";\n }\n }\n lines[1] += \"</br>\";\n\n //3rd line (contains suit)\n for (i = 0; i < cards.length; i++) {\n\n lines[2] += \"| \" + suits[i] + \" |\";\n }\n lines[2] += \"</br>\";\n\n //4th line (contains value)\n for (i = 0; i < cards.length; i++) {\n if (cardvalue(cards[i]) == 10) {\n lines[3] += \"| \" + cardvalue(cards[i]) + \"|\";\n } else {\n lines[3] += \"| \" + cardvalue(cards[i]) + \"|\";\n }\n\n }\n lines[3] += \"</br>\";\n\n //bottom line\n for (i = 0; i < cards.length; i++) {\n lines[4] += \"'---'\";\n }\n lines[4] += \"</br>\";\n return lines[0] + lines[1] + lines[2] + lines[3] + lines[4];\n}",
"function render_cards(){\n var cards = game_instance.get_cards();\n for(var i = 0; i < cards.length; i++){\n cards[i].render_card();\n }\n }",
"drawCards() {\n let g = this,\n cxt = g.context,\n cards = window._main.cards;\n for (let card of cards) {\n card.draw(cxt);\n }\n }",
"deckToString() {\n\t\t// Temp string to assemble the Deck in text form\n\t\tvar temp = \"\";\n\n\t\t// Loop through the deck\n\t\tfor (var i = 0; i < this.deckSize(); i++) {\n\t\t\t// Add the abbrervation of the card to the string\n\t\t\ttemp += this.mCardDeck[i].getAbbv();\n\n\t\t\tif (i != this.deckSize() - 1) {\n\t\t\t\ttemp += \" \";\n\t\t\t}\n\t\t}\n\n\t\t// Return the deck in string form\n\t\treturn temp;\n\t}",
"function BasicCard(front, back){\n this.front = front;\n this.back = back;\n this.cardInfo = function(front, back){\n console.log(\"\\n{front: '\" + this.front + \"',\" + \n \"\\nback: '\" + this.back + \"'},\");\n }\n}",
"function renderMwDeckFormat(cards, sbCards, attrib) {\n var output = '// ' + attrib + '\\r\\n';\n var prefix = \" \";\n if (cards !== null && cards.length > 0) {\n output += _.reduce(cards, function (memo, card) { return memo += prefix + card.count + ' [' + card.set.toUpperCase() + '] ' + card.title.replace(' & ', '/') + '\\r\\n'; }, '');\n }\n if (sbCards !== null && sbCards.length > 0) {\n prefix = \"SB: \";\n output += _.reduce(sbCards, function (memo, card) { return memo += prefix + card.count + ' [' + card.set.toUpperCase() + '] ' + card.title.replace(' & ', '/') + '\\r\\n'; }, \"// Sideboard:\\r\\n\");\n }\n return output;\n }",
"function Deck() {\n 'use strict';\n\n var suits = ['Hearts', 'Spades', 'Clubs', 'Diamonds'];\n var cardValues = [2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 'Jack' , 'Queen' , 'King' , 'Ace'];\n this.allCards = [];\n\n for(var i = 0; i < suits.length; i++) {\n for(var v = 0; v < cardValues.length; v++) {\n this.allCards.push(new PlayingCard(suits[i], cardValues[v]));\n }\n }\n\n this.shuffle = function () {};\n this.draw = function () {};\n\n // define other factors of what a deck is\n\n}",
"function Deck() {\n\tthis.deck = new Array();\n\tfor ( var suit=1 ; suit<=4 ; ++suit ) {\n\t\tfor ( var value=1 ; value<=13 ; ++value ) {\n\t\t\tthis.deck[ this.deck.length ] = new Card( suit , value );\n\t\t\tthis.deck[ this.deck.length ] = new Card( suit , value );\n\t\t}\n\t}\n\tthis.deck[ this.deck.length ] = new Card( 5 , 0 );\n\tthis.deck[ this.deck.length ] = new Card( 5 , 0 );\n\tthis.deck[ this.deck.length ] = new Card( 6 , 0 );\n\tthis.deck[ this.deck.length ] = new Card( 6 , 0 );\n\t\n\tthis.shuffle = function() {\n\t\t\n\t\t//swap each card with a random index\n\t\tfor ( var i=0 ; i<this.deck.length ; ++i ) {\n\t\t\tvar idxToSwapWith = Math.floor(Math.random()*this.deck.length);\n\t\t\tvar tmp = this.deck[ idxToSwapWith ];\n\t\t\tthis.deck[ idxToSwapWith ] = this.deck[ i ];\n\t\t\tthis.deck[ i ] = tmp;\n\t\t}\n\t};\n\t\n\tthis.get = function( idx ) {\n\t\treturn this.deck[ idx ];\n\t};\n\t\n\tthis.size = function() {\n\t\treturn this.deck.length;\n\t};\n\t\n\tthis.draw = function() {\n\t\treturn this.deck.shift();\n\t}\n}",
"function generateDeck(cards) {\n // Loop through each element in the cards array and create its HTML\n var deck = cards.map(function(card) {\n return `<li class=\"card\"><i class=\"${card}\"></i></li>`;\n });\n\n return deck.join('');\n}",
"function renderCards() {\n for (const card of cards) {\n card.classList.remove('match', 'show', 'open');\n }\n cards = shuffle([...cards]);\n const fragment = document.createDocumentFragment();\n for (const card of cards) {\n fragment.appendChild(card);\n }\n deck.appendChild(fragment);\n}",
"function runBasic() {\n// output instructions\n console.log(\"\\nAfter each card is shown, Press Ener to flip the card and see the next\\n\");\n// construct and fill 5 cards\n cards.push(new basicCard(\"This computer was the first portable computer?\", \"Osborne I\"));\n cards.push(new basicCard(\"A famous Super Bowl advertisement, from 1984, announced this computer?\", \"Macintosh\"));\n cards.push(new basicCard(\"The predessessor of the modern Internet?\", \"ARPANET\"));\n cards.push(new basicCard(\"Paul Allen and this man created Microsoft.\", \"Bill Gates\"));\n cards.push(new basicCard(\"IBM created this computer and won playing against Gary Kasparov in chess?\", \"Deep Blue\"));\n // call the display function\n queryCard(0)\n}"
]
| [
"0.7851098",
"0.75887036",
"0.7290327",
"0.723787",
"0.7114862",
"0.6987267",
"0.6956463",
"0.6883937",
"0.6878408",
"0.6862186",
"0.6740982",
"0.6673502",
"0.6654526",
"0.6578331",
"0.65128076",
"0.64945745",
"0.6441548",
"0.6438234",
"0.64375144",
"0.6435145",
"0.64243954",
"0.64081",
"0.6400485",
"0.63500124",
"0.631418",
"0.626948",
"0.6250953",
"0.6233718",
"0.62202793",
"0.6212461"
]
| 0.8022254 | 0 |
FIND // FROM, SELECT, CALLBACK | static find(from, select, callback) {
find(from, {}, select, {}, callback);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static findOne(from, select, callback) {\n findOne(from, {}, select, {}, callback);\n }",
"static findWhere(from, select, where, callback) {\n find(from, where, select, {}, callback);\n }",
"static findOneWhere(from, select, where, callback) {\n findOne(from, where, select, {}, callback);\n }",
"function find() {}",
"function FindUser(id,callback){\n Find(\"users\",\"id\",id,callback);\n}",
"static findWhereOrder(from, select, where, orderby, callback) {\n find(from, where, select, orderby, callback);\n }",
"afterFind(results, params, populate) {\n console.log(\"Hereeeeeeeeeee 4\");\n }",
"static find(name, cb){\n db.get('SELECT * FROM artists WHERE name=?', name, cb);\n }",
"function onGetAllSuccess_GetResponseFromDatabaseWhereClause(records){\n isSuccess = true;\n ReturnRecords = (records);\n}",
"static find(id, callback)\n { db.get('select * from User where ID = ?', id, (err, row) => {\n if (err)\n return console.error(err.message);\n callback(row);\n });\n }",
"static findOrder(from, select, orderby, callback) {\n find(from, {}, select, orderby, callback);\n }",
"static find(id, cb) {\n db.get('SELECT * FROM articles WHERE id = ?', id, cb);\n }",
"function find(collection, callback) {\n\t var result;\n\t exports.forEach(collection, function (item, i) {\n\t if (result)\n\t return;\n\t if (callback(item, i))\n\t result = item;\n\t });\n\t return result;\n\t}",
"function find(collection, callback) {\n\t var result;\n\t exports.forEach(collection, function (item, i) {\n\t if (result)\n\t return;\n\t if (callback(item, i))\n\t result = item;\n\t });\n\t return result;\n\t}",
"find(callback) {\r\n for (let i = 0; i < this.array.length; i++) {\r\n const item = this.array[i];\r\n if (callback(item)) return item;\r\n }\r\n }",
"function find(collection, callback) {\n var result;\n exports.forEach(collection, function (item, i) {\n if (result)\n return;\n if (callback(item, i))\n result = item;\n });\n return result;\n}",
"function find(collection, callback) {\n var result;\n exports.forEach(collection, function (item, i) {\n if (result)\n return;\n if (callback(item, i))\n result = item;\n });\n return result;\n}",
"function find(collection, callback) {\n var result;\n forEach(collection, function (item, i) {\n if (result)\n return;\n if (callback(item, i))\n result = item;\n });\n return result;\n}",
"function find(collection, callback) {\n var result;\n forEach(collection, function (item, i) {\n if (result)\n return;\n if (callback(item, i))\n result = item;\n });\n return result;\n}",
"getHomeItem(searchText, _callback) {\n db.transaction(\n txn => {\n txn.executeSql(\"select id, username, name, description, price, photo, address from images where is_active=1 AND (username like ? OR name like ?) order by id desc\", [searchText, searchText], (tx, res) => {\n if(_callback){\n _callback(res.rows._array);\n }\n });\n }\n );\n }",
"static find(id, cb){\n db.get('SELECT * FROM artwork WHERE id=?', id, cb);\n }",
"function find(collection, callback) {\n var result;\n forEach(collection, function (item, i) {\n if (result)\n return;\n if (callback(item, i))\n result = item;\n });\n return result;\n }",
"function findByIDCallback(err, item, callback, type) {\n if (err)\n console.error(err);\n else if (!item)\n if (type) {\n if (Print.error) console.error(type + ' >> Find by ID error: NOT FOUND')\n }\n else {\n if (Print.error) console.error('Find by ID error: NOT FOUND')\n }\n callback(err, item);\n}",
"find( query, fields, callback )\n {\n callback = callback || noop;\n\n if ( typeof(fields) === 'function' )\n {\n callback = fields;\n fields = null;\n }\n\n return new Promise( ( resolve, reject ) =>\n {\n rnsyncModule.find( this.databaseName, query, fields, ( error, docs ) =>\n {\n if ( !error && Platform.OS === \"android\" )\n {\n docs = docs.map( doc => JSON.parse( doc ) )\n }\n\n callback( error, docs );\n\n error == null ? resolve( docs ) : reject( error )\n } );\n\n } );\n }",
"static findOneWhereOrder(from, select, where, orderBy, callback) {\n findOne(from, where, select, orderBy, callback);\n }",
"function ProcessFindEvent (friend_to_data, callback) {\n\tUsers.findById({'_id': friend_to_data}, function (err, friend_fined) {\n\t\tif(err) {\n\t\t\treturn callback(err)\n\t\t}\n\t\t//console.log('Datos del amigo solicitado')\n\t\t//console.log(friend_fined)\n\n\t\tif(friend_fined) {\n\t\t\tcallback(err, friend_fined)\n\t\t\n\t\t}\n\n\t})\n}",
"function findfromdb(uid, callback) {\n\n MongoClient.connect(url, function (err, db) {\n\n db.db('data').collection('documents').find({_id: Mongodb.ObjectID(uid)}).toArray(function (err, result) {\n\n var record = result[0];\n console.log(\"Record \", record);\n callback(record);\n });\n });\n}",
"function find(collection,search,callback)\r\n{\r\n collection.findOne(search, function(err, docu) { \r\n callback(docu || false ); \r\n });\r\n}",
"static $find(condition) {\n\t\tvar className = this;\n\t\tlet connector = className.$getConfig('connector');\n\t\treturn connector.$query(condition).then((records) => {\n\t\t\t// create new instance for each found record\n\t\t\tvar rtn = getCollectionInstance(className, condition);\n\t\t\tif(Array.isArray(records)){\n\t\t\t\tfor(let r of records){\n\t\t\t\t\tlet instance = className.$new(r);\n\t\t\t\t\trtn.push(instance)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn Promise.resolve(rtn);\n\t\t})\n\t}",
"function find() {\n GeneralSvc.showLoading(vmUser);\n getListData();\n }"
]
| [
"0.70508325",
"0.69658035",
"0.6775976",
"0.67516553",
"0.63515645",
"0.6249541",
"0.62335974",
"0.6201742",
"0.6182281",
"0.61668193",
"0.60927075",
"0.6061717",
"0.6053274",
"0.6053274",
"0.599711",
"0.5993098",
"0.5993098",
"0.59373194",
"0.59373194",
"0.58883005",
"0.5881185",
"0.58760303",
"0.58624595",
"0.58535486",
"0.5822757",
"0.57778275",
"0.57724243",
"0.5749168",
"0.57094556",
"0.5681698"
]
| 0.7520128 | 0 |
FROM, SELECT, WHERE, ORDERBY, CALLBACK | static findWhereOrder(from, select, where, orderby, callback) {
find(from, where, select, orderby, callback);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"queryAll(callback) {\r\n var self = this;\r\n this.table.findAll(this.select)\r\n .then(function (data) {\r\n self.data = data;\r\n callback(self);\r\n },\r\n function (err) {\r\n localData = { error: err };\r\n callback(self);\r\n });\r\n }",
"function onGetAllSuccess_GetResponseFromDatabaseWhereClause(records){\n isSuccess = true;\n ReturnRecords = (records);\n}",
"static findOrder(from, select, orderby, callback) {\n find(from, {}, select, orderby, callback);\n }",
"lista(callback) {\n this._db.query('select * from resposta', function(err, recordset) {\n callback(err, recordset);\n });\n }",
"static findOneWhereOrder(from, select, where, orderBy, callback) {\n findOne(from, where, select, orderBy, callback);\n }",
"get(cb,args = {}){\n\t\tvar argDef = {\n\t\t\tid:[\"int\",false],\n\t\t\temail:[\"varchar\",false]\n\t\t};\n\t\tvar byID = args.id ? 'and person.id = @id' : '';\n\t\tvar byEmail = args.email ? 'and person.email = @email' : '';\n\t\tvar queryText = `\n\t\t\tselect top 3\n\t\t\tperson.*,\n\t\t\tstuff(\n\t\t\t\t(\n\t\t\t\t\tselect ',' + cast(instrument.id as varchar(10))\n\t\t\t\t\tfrom instrument\n\t\t\t\t\tinner join person_instrument on person_instrument.instrument_id = instrument.id\n\t\t\t\t\t\tand person_instrument.active = 1\n\t\t\t\t\t\tand person_instrument.person_id = person.id\n\t\t\t\t\t\twhere instrument.active = 1\n\t\t\t\t\t\torder by instrument.id asc\n\t\t\t\t\t\tfor xml path('')\n\t\t\t\t)\n\t\t\t,1,1,'') as instrument_ids\n\t\t\tfrom person\n\t\t\twhere person.active = 1\n\n\t\t\t${byID}\n\t\t\t${byEmail}\n\t\t`;\n\n\t\tthis.query(cb,queryText,args,argDef);\n\t}",
"load(callback) {\n const selectTodoItems = \"SELECT * FROM todo_items\";\n this.dbConnection.query(selectTodoItems, function (err, results, fields) {\n if (err) {\n callback(err);\n return;\n }\n\n callback(null, results);\n });\n }",
"static all(callback)\n { const sql = \"SELECT * FROM User ORDER BY Type\"\n db.all(sql, [], (err, rows) => {\n if (err)\n return console.error(err.message);\n callback(rows);\n });\n }",
"function doQuery(args, internCallback) {\r\n var sql = args[0],\r\n params = args[1],\r\n cb = args[2] || null;\r\n\r\n if (!Array.isArray(params)) {\r\n cb = params;\r\n params = [];\r\n }\r\n\r\n mySqlWorm.query(sql, params, function(err, rows) {\r\n if (err) {\r\n cb(err);\r\n } else {\r\n internCallback(rows, cb);\r\n }\r\n });\r\n }",
"function callBackSucesso(deferido) {\n return function (tx, results) {\n //se tiver resultados organiza os dados \n if (results) {\n var len = results.rows.length, i;\n var resultados = [];\n for (i = 0; i < len; i++) {\n var user = {\n id: results.rows.item(i).user_id,\n name: results.rows.item(i).user_name,\n nick: results.rows.item(i).user_nick\n }\n resultados.push(user);\n// console.log(results.rows.item(i));\n }\n deferido.resolve(resultados);\n }\n }\n }",
"function selectAllRows(table, orderBy, callback) {\r\n const sql = `SELECT * FROM ${table} ${orderBy};`;\r\n const query = db.query(sql, (err, rows) => {\r\n if (err) {\r\n console.log(err);\r\n callback(err, INTERNAL_SERVER_ERROR, INTERNAL_ERROR_MSG, null);\r\n }\r\n else {\r\n callback(null, OK, null, rows);\r\n }\r\n });\r\n}",
"function ______MA_Query() {}",
"function _select(sql, args, resultHandle){\r\n\tmyjdbc.exequery(sql, args, function(err, result){\r\n\t\tif(err){\r\n\t\t\tconsole.log(err.toString().red);\r\n\t\t\tresultHandle(null);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tresultHandle(result);\r\n\t});\r\n}",
"getItemData(id, _callback) {\n db.transaction(\n txn => {\n txn.executeSql(\"select id, name, description, price, photo, address from images where is_active=1 AND id=? order by id desc\", [id], (tx, res) => {\n if(_callback){\n _callback(res);\n }\n });\n }\n );\n }",
"static findOneOrder(from, select, orderBy, callback) {\n findOne(from, {}, select, orderBy, callback);\n }",
"async getAll(params,res) {\n\n try{\n let query = \"SELECT * FROM events\";\n let queryParams = [\n this.table\n ];\n\n let result=null;\n \n if (params.from && params.to) { \n\n query += \" WHERE end_date >= $1 AND start_date < $2\";\n queryParams.push(params.from);\n queryParams.push(params.to);\n result = await this._db.query(query,[params.from,params.to]);\n }else result = await this._db.query(query);\n \n \n\n result.rows.forEach((entry) => {\n // format date and time\n entry.start_date = entry.start_date.format(\"YYYY-MM-DD hh:mm\");\n entry.end_date = entry.end_date.format(\"YYYY-MM-DD hh:mm\");\n });\n\n return result;\n }catch(err){\n console.log(err);\n }\n }",
"static consultarCliente(id, callback) {\n //Armamos la consulta segn los parametros que necesitemos\n let query = 'SELECT * ';\n query += 'FROM '+table.name+' ';\n query += 'WHERE '+table.fields.id+'='+id+';'; \n //Verificamos la conexion\n if(sql){\n sql.query(query, (err, result) => {\n if(err){\n throw err;\n }else{ \n let cliente = Cliente.mapFactory(result[0]); \n console.log(cliente); \n callback(null,cliente);\n }\n })\n }else{\n throw \"Problema conectado con Mysql en consultarCliente\";\n } \n }",
"function selectQuery(select_str, from_str, where_str, callback) {\n $.post(\n selectScript,\n {\n SELECT: select_str,\n FROM: from_str,\n WHERE: where_str\n },\n function (data, status) {\n callback(data);\n }\n );\n}",
"function fetchEntryItems(){\n\n var d = $.Deferred();\n\n db.transaction(function (tx) {\n\n tx.executeSql('SELECT * FROM entries ORDER BY sortIndex ASC', [], function (tx, results) {\n var len = results.rows.length, i, items;\n\n items = [];\n\n for (i = 0; i < len; i++) {\n items.push(results.rows.item(i));\n }\n\n d.resolve(items);\n },\n function (tx, error) {\n console.log(\"Query Error: \" + error.message);\n d.reject();\n });\n\n });\n\n return d;\n }",
"function getTodos(callbackFn) {\n return dbPool.query('SELECT id, entry FROM todo_items', callbackFn)\n}",
"static fetchAll(callBack){\n getProductsFromFile(callBack);\n }",
"getHomeItem(searchText, _callback) {\n db.transaction(\n txn => {\n txn.executeSql(\"select id, username, name, description, price, photo, address from images where is_active=1 AND (username like ? OR name like ?) order by id desc\", [searchText, searchText], (tx, res) => {\n if(_callback){\n _callback(res.rows._array);\n }\n });\n }\n );\n }",
"function customQuery(db, fun, opts) {\n\t return new PouchPromise$1(function (resolve, reject) {\n\t db._query(fun, opts, function (err, res) {\n\t if (err) {\n\t return reject(err);\n\t }\n\t resolve(res);\n\t });\n\t });\n\t }",
"function customQuery(db, fun, opts) {\n\t return new PouchPromise(function (resolve, reject) {\n\t db._query(fun, opts, function (err, res$$1) {\n\t if (err) {\n\t return reject(err);\n\t }\n\t resolve(res$$1);\n\t });\n\t });\n\t }",
"function simpleQuery(mySqlClient, query, cb) {\n\tmySqlClient.query(query, function select(error, results, fields) {\n\t\tif (error) {\n\t\t\tconsole.log(error);\t\t\t\n\t\t} else {\n\t\t\treturn cb(results)\n\t\t}\n\t})\n}",
"static find(from, select, callback) {\n find(from, {}, select, {}, callback);\n }",
"function getAllTheData() {\n var render = function (tx, rs) {\n // rs contains our SQLite recordset, at this point you can do anything with it\n // in this case we'll just loop through it and output the results to the console\n for (var i = 0; i < rs.rows.length; i++) {\n /* alert(JSON.stringify(rs.rows.item(i)));*/\n }\n }\n\n app.selectAllRecords(render);\n}",
"function getAllTheData() {\n var render = function (tx, rs) {\n // rs contains our SQLite recordset, at this point you can do anything with it\n // in this case we'll just loop through it and output the results to the console\n for (var i = 0; i < rs.rows.length; i++) {\n /* alert(JSON.stringify(rs.rows.item(i)));*/\n }\n }\n\n app.selectAllRecords(render);\n}",
"function selectRecords(tblname, cols, callback) {\n var output = \"\";\n var sqlQuery = `SELECT ${cols} FROM ${tblname}`;\n db.transaction((trans) => {\n trans.executeSql(sqlQuery, [], (trans, res) => {\n callback(res);\n });\n })\n}",
"function querySelect(sql, callback) {\n con.query(sql, (err, res) => {\n callback((!err) ? res : []);\n });\n}"
]
| [
"0.61639965",
"0.6125367",
"0.5998499",
"0.5948966",
"0.5885602",
"0.58367777",
"0.58326936",
"0.57719743",
"0.5720882",
"0.5657524",
"0.56434005",
"0.5624733",
"0.5588958",
"0.55889195",
"0.55826503",
"0.558083",
"0.55767155",
"0.5570669",
"0.5560254",
"0.5554302",
"0.55188274",
"0.5499289",
"0.5459503",
"0.5448052",
"0.5425207",
"0.5420854",
"0.5420497",
"0.5420497",
"0.54126275",
"0.5403542"
]
| 0.6181167 | 0 |
FIND ONE // FROM, SELECT, CALLBACK | static findOne(from, select, callback) {
findOne(from, {}, select, {}, callback);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static find(from, select, callback) {\n find(from, {}, select, {}, callback);\n }",
"static findOneWhere(from, select, where, callback) {\n findOne(from, where, select, {}, callback);\n }",
"function find() {}",
"static findWhere(from, select, where, callback) {\n find(from, where, select, {}, callback);\n }",
"function FindUser(id,callback){\n Find(\"users\",\"id\",id,callback);\n}",
"find(callback) {\r\n for (let i = 0; i < this.array.length; i++) {\r\n const item = this.array[i];\r\n if (callback(item)) return item;\r\n }\r\n }",
"function findByIDCallback(err, item, callback, type) {\n if (err)\n console.error(err);\n else if (!item)\n if (type) {\n if (Print.error) console.error(type + ' >> Find by ID error: NOT FOUND')\n }\n else {\n if (Print.error) console.error('Find by ID error: NOT FOUND')\n }\n callback(err, item);\n}",
"static find(id, callback)\n { db.get('select * from User where ID = ?', id, (err, row) => {\n if (err)\n return console.error(err.message);\n callback(row);\n });\n }",
"function find(collection, callback) {\n var result;\n forEach(collection, function (item, i) {\n if (result)\n return;\n if (callback(item, i))\n result = item;\n });\n return result;\n}",
"function find(collection, callback) {\n var result;\n forEach(collection, function (item, i) {\n if (result)\n return;\n if (callback(item, i))\n result = item;\n });\n return result;\n}",
"static find(name, cb){\n db.get('SELECT * FROM artists WHERE name=?', name, cb);\n }",
"function find(collection, callback) {\n\t var result;\n\t exports.forEach(collection, function (item, i) {\n\t if (result)\n\t return;\n\t if (callback(item, i))\n\t result = item;\n\t });\n\t return result;\n\t}",
"function find(collection, callback) {\n\t var result;\n\t exports.forEach(collection, function (item, i) {\n\t if (result)\n\t return;\n\t if (callback(item, i))\n\t result = item;\n\t });\n\t return result;\n\t}",
"function find(collection, callback) {\n var result;\n exports.forEach(collection, function (item, i) {\n if (result)\n return;\n if (callback(item, i))\n result = item;\n });\n return result;\n}",
"function find(collection, callback) {\n var result;\n exports.forEach(collection, function (item, i) {\n if (result)\n return;\n if (callback(item, i))\n result = item;\n });\n return result;\n}",
"function find(collection, callback) {\n var result;\n forEach(collection, function (item, i) {\n if (result)\n return;\n if (callback(item, i))\n result = item;\n });\n return result;\n }",
"static findOneWhereOrder(from, select, where, orderBy, callback) {\n findOne(from, where, select, orderBy, callback);\n }",
"static find(id, cb){\n db.get('SELECT * FROM artwork WHERE id=?', id, cb);\n }",
"function getPlayer(player_ID, foundPlayer) {\n\n Player.find({'playerID': player_ID}, function(err, playerfound) {\n if(err) console.error(err);\n playerfound = playerfound[0]; \n\n foundPlayer(playerfound); \n }); \n}",
"static find(id, cb) {\n db.get('SELECT * FROM articles WHERE id = ?', id, cb);\n }",
"find(callback) {\n for (const ele of this.arr) {\n if (callback(ele)) {\n return ele;\n }\n }\n }",
"static $findOne(condition){\n\t\treturn this.$find(condition).then((found) => {\n\t\t\treturn Promise.resolve(found.shift())\n\t\t})\n\t}",
"function itemOneSearch(t, callback) {\n\tItem\n\t\t.findOne({'id':t})\n\t\t.exec(function(err,term) {\n\t\t\tcallback (term);\n\t\t})\n}",
"function find(collection,search,callback)\r\n{\r\n collection.findOne(search, function(err, docu) { \r\n callback(docu || false ); \r\n });\r\n}",
"static findOneOrder(from, select, orderBy, callback) {\n findOne(from, {}, select, orderBy, callback);\n }",
"function ProcessFindEvent (friend_to_data, callback) {\n\tUsers.findById({'_id': friend_to_data}, function (err, friend_fined) {\n\t\tif(err) {\n\t\t\treturn callback(err)\n\t\t}\n\t\t//console.log('Datos del amigo solicitado')\n\t\t//console.log(friend_fined)\n\n\t\tif(friend_fined) {\n\t\t\tcallback(err, friend_fined)\n\t\t\n\t\t}\n\n\t})\n}",
"function find(collection, callback){\n\tif(Array.isArray(collection)){\n\t\tfor(var i = 0, result; i<collection.length; i++){\n\t\t\tif(callback(collection[i])){\n\t\t\t\treturn collection[i];\n\t\t\t\t//break;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor(var key in collection){\n\t\t\tif(callback(collection[key])){\n\t\t\t\treturn collection[key];\n\t\t\t\t//break;\n\t\t\t}\n\t\t}\n\t}\n\treturn undefined;\n}",
"findByName(name, cb) {\n\t\tthis.db.view('item', 'by_name', {key: name}, (err, itemByName) => {\n\t\t\tif (err) {\n\t\t\t\tconsole.error(err)\n\t\t\t\treturn cb(err, null)\n\t\t\t}\n\n\t\t\tif (itemByName.rows.length > 0) {\n\t\t\t\treturn this.foundItem(itemByName, name, cb)\n\t\t\t} else {\n\t\t\t\treturn cb(null, null) // No item found\n\t\t\t}\n\t\t})\n\t}",
"afterFind(results, params, populate) {\n console.log(\"Hereeeeeeeeeee 4\");\n }",
"static findByID(id, call_Back){\n let required_product;\n products.forEach(product=>{\n if (product.id==id){\n required_product=product;\n call_Back(required_product);\n }\n });\n }"
]
| [
"0.7305295",
"0.718484",
"0.6932672",
"0.6691217",
"0.64910847",
"0.644256",
"0.64323795",
"0.630001",
"0.6285284",
"0.6285284",
"0.6278437",
"0.6244728",
"0.6244728",
"0.6239255",
"0.6239255",
"0.6237212",
"0.6205782",
"0.61498463",
"0.6144593",
"0.61239946",
"0.60439783",
"0.60381645",
"0.603039",
"0.6025346",
"0.59623116",
"0.59535253",
"0.5943651",
"0.5941059",
"0.5931042",
"0.5869006"
]
| 0.75772613 | 0 |
FIND INNER JOIN // FROM, SELECT, JOIN, CALLBACK | static findInnerJoin(from, select, join, callback) {
findInnerJoin(from, {}, select, join, {}, callback);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static findInnerJoinWhere(from, select, where, join, callback) {\n findInnerJoin(from, where, select, join, {}, callback);\n }",
"static findInnerJoinWhereOrder(from, select, where, join, orderby, callback) {\n findInnerJoin(from, where, select, join, orderby, callback);\n }",
"static findInnerJoinOrder(from, select, join, orderby, callback) {\n findInnerJoin(from, {}, select, join, orderby, callback);\n }",
"_addJoins(query, listAdapter, where, tableAlias) {\n // Insert joins to handle 1:1 relationships where the FK is stored on the other table.\n // We join against the other table and select its ID as the path name, so that it appears\n // as if it existed on the primary table all along!\n\n const joinPaths = Object.keys(where).filter(\n path => !this._getQueryConditionByPath(listAdapter, path)\n );\n \n const joinedPaths = [];\n listAdapter.fieldAdapters\n .filter(a => a.isRelationship && a.rel.cardinality === '1:1' && a.rel.right === a.field)\n .forEach(({ path, rel }) => {\n \n const { tableName, columnName } = rel;\n const otherTableAlias = `${tableAlias}__${path}`;\n if (!this._tableAliases[otherTableAlias]) {\n this._tableAliases[otherTableAlias] = true;\n // LEFT OUTERJOIN on ... table>.<id> = <otherTable>.<columnName> SELECT <othertable>.<id> as <path> \n query.leftOuterJoin(\n `${tableName} as ${otherTableAlias}`,\n `${otherTableAlias}.${columnName}`,\n `${tableAlias}.id`\n );\n\n if(this._selectNames[path] !== true) { \n query.select(`${otherTableAlias}.id as ${path}`);\n this._selectNames[path] = true; \n } else {\n query.select(`${otherTableAlias}.id as ${path}_${++this._selectNamesCount}`);\n }\n \n joinedPaths.push(path);\n }\n });\n \n for (let path of joinPaths) {\n if (path === 'AND' || path === 'OR') {\n // AND/OR we need to traverse their children \n where[path].forEach(x => this._addJoins(query, listAdapter, x, tableAlias));\n } else {\n \n const otherAdapter = listAdapter.fieldAdaptersByPath[path];\n // If no adapter is found, it must be a query of the form `foo_some`, `foo_every`, etc.\n // These correspond to many-relationships, which are handled separately\n if (otherAdapter && !joinedPaths.includes(path)) {\n // We need a join of the form:\n // ... LEFT OUTER JOIN {otherList} AS t1 ON {tableAlias}.{path} = t1.id\n // Each table has a unique path to the root table via foreign keys\n // This is used to give each table join a unique alias\n // E.g., t0__fk1__fk2\n const otherList = otherAdapter.refListKey;\n const otherListAdapter = listAdapter.getListAdapterByKey(otherList);\n const otherTableAlias = `${tableAlias}__${path}`;\n if (!this._tableAliases[otherTableAlias]) {\n this._tableAliases[otherTableAlias] = true;\n query.leftOuterJoin(\n `${otherListAdapter.tableName} as ${otherTableAlias}`,\n `${otherTableAlias}.id`,\n `${tableAlias}.${path}`\n );\n }\n \n this._addJoins(query, otherListAdapter, where[path], otherTableAlias);\n }\n }\n }\n }",
"function doJoin (query, scope, h) {\r\n//\tconsole.log('doJoin', arguments);\r\n//\tconsole.log(query.sources.length);\r\n\t// Check, if this is a last join?\r\n\tif(h>=query.sources.length) {\r\n//console.log(query.wherefns);\r\n\t\t// Then apply where and select\r\n//\t\tconsole.log(query);\r\n\t\tif(query.wherefn(scope,query.params, alasql)) {\r\n\r\n//\t\t\tconsole.log(\"scope\",scope.schools);\r\n\r\n//\t\t\tvar res = query.selectfn(scope, query.params, alasql);\r\n//\t\t\tconsole.log(\"last\",res);\r\n\t\t\t// If there is a GROUP BY then pipe to groupping function\r\n\t\t\tif(query.groupfn) {\r\n\t\t\t\tquery.groupfn(scope, query.params, alasql)\r\n\t\t\t} else {\r\n//\t\t\t\tquery.qwerty = 999;\r\n//console.log(query.qwerty, query.queriesfn && query.queriesfn.length,2);\r\n\t\t\t\tquery.data.push(query.selectfn(scope, query.params, alasql));\r\n\t\t\t}\t\r\n\t\t}\r\n\t} else if(query.sources[h].applyselect) {\r\n//\t\tconsole.log('APPLY',scope);\r\n//\t\t\tconsole.log('scope1',scope);\r\n//\t\t\t\tconsole.log(scope);\r\n\t\tvar source = query.sources[h];\r\n\t\tsource.applyselect(query.params, function(data){\r\n\t\t\tif(data.length > 0) {\r\n\t//\t\t\tconsole.log('APPLY CB');\r\n\t\t\t\tfor(var i=0;i<data.length;i++) {\r\n\t\t\t\t\tscope[source.alias] = data[i];\r\n\t\t\t\t\tdoJoin(query, scope, h+1);\r\n\t\t\t\t};\t\t\t\r\n\t\t\t} else {\r\n//\t\t\t\tconsole.log(source.applymode);\r\n\t\t\t\tif (source.applymode == 'OUTER') {\r\n\t\t\t\t\tscope[source.alias] = {};\r\n\t\t\t\t\tdoJoin(query, scope, h+1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},scope);\r\n\r\n//\t\tconsole.log(data);\r\n\t} else {\r\n\r\n// STEP 1\r\n\r\n\t\tvar source = query.sources[h];\r\n\t\tvar nextsource = query.sources[h+1];\r\n\r\n//\t\tif(source.joinmode == \"LEFT\" || source.joinmode == \"INNER\" || source.joinmode == \"RIGHT\"\r\n//\t\t\t|| source.joinmode == \"OUTER\" || source.joinmode == \"SEMI\") {\r\n\t\tif(true) {//source.joinmode != \"ANTI\") {\r\n\r\n\t\t\t// if(nextsource && nextsource.joinmode == \"RIGHT\") {\r\n\t\t\t// \tif(!nextsource.rightdata) {\r\n\t\t\t// \t\tconsole.log(\"ok\");\r\n\t\t\t// \t\tnextsource.rightdata = new Array(nextsource.data.length);\r\n\t\t\t// \t\tconsole.log(nextsource.data.length, nextsource.rightdata);\r\n\t\t\t// \t}\r\n\t\t\t// }\r\n\r\n\t\t\tvar tableid = source.alias || source.tableid; \r\n\t\t\tvar pass = false; // For LEFT JOIN\r\n\t\t\tvar data = source.data;\r\n\t\t\tvar opt = false;\r\n\r\n\t\t\t// Reduce data for looping if there is optimization hint\r\n\t\t\tif(!source.getfn || (source.getfn && !source.dontcache)) {\r\n\t\t\t\tif(source.joinmode != \"RIGHT\" && source.joinmode != \"OUTER\" && source.joinmode != \"ANTI\" && source.optimization == 'ix') {\r\n\t\t\t\t\tdata = source.ix[ source.onleftfn(scope, query.params, alasql) ] || [];\r\n\t\t\t\t\topt = true;\r\n//\t\t\t\t\tconsole.log(source.onleftfns);\r\n//\t\t\t\t\tconsole.log(source.ix);\r\n//\tconsole.log(source.onleftfn(scope, query.params, alasql));\r\n//\t\t\t\t\tconsole.log(opt, data, data.length);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Main cycle\r\n\t\t\tvar i = 0;\r\n\t\t\tif(typeof data == 'undefined') {\r\n\t\t\t\tthrow new Error('Data source number '+h+' in undefined')\r\n\t\t\t}\r\n\t\t\tvar ilen=data.length;\r\n\t\t\tvar dataw;\r\n//\t\t\tconsole.log(h,opt,source.data,i,source.dontcache);\r\n\t\t\twhile((dataw = data[i]) || (!opt && (source.getfn && (dataw = source.getfn(i)))) || (i<ilen) ) {\r\n\t\t\t\tif(!opt && source.getfn && !source.dontcache) data[i] = dataw;\r\n//console.log(h, i, dataw);\r\n\t\t\t\tscope[tableid] = dataw;\r\n\t\t\t\t// Reduce with ON and USING clause\r\n\t\t\t\tif(!source.onleftfn || (source.onleftfn(scope, query.params, alasql) == source.onrightfn(scope, query.params, alasql))) {\r\n\t\t\t\t\t// For all non-standard JOINs like a-b=0\r\n\t\t\t\t\tif(source.onmiddlefn(scope, query.params, alasql)) {\r\n\t\t\t\t\t\t// Recursively call new join\r\n//\t\t\t\t\t\tif(source.joinmode == \"LEFT\" || source.joinmode == \"INNER\" || source.joinmode == \"OUTER\" || source.joinmode == \"RIGHT\" ) {\r\n\t\t\t\t\t\tif(source.joinmode != \"SEMI\" && source.joinmode != \"ANTI\") { \r\n//\t\t\t\t\t\t\tconsole.log(scope);\r\n\t\t\t\t\t\t\tdoJoin(query, scope, h+1);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// if(source.data[i].f = 200) debugger;\r\n\r\n//\t\t\t\t\t\tif(source.joinmode == \"RIGHT\" || source.joinmode == \"ANTI\" || source.joinmode == \"OUTER\") {\r\n\t\t\t\t\t\tif(source.joinmode != \"LEFT\" && source.joinmode != \"INNER\") {\r\n\t\t\t\t\t\t\tdataw._rightjoin = true;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// for LEFT JOIN\r\n\t\t\t\t\t\tpass = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\ti++;\r\n\t\t\t};\r\n\r\n\r\n\t\t\t// Additional join for LEFT JOINS\r\n\t\t\tif((source.joinmode == 'LEFT' || source.joinmode == 'OUTER' || source.joinmode == 'SEMI' ) && !pass) {\r\n\t\t\t// Clear the scope after the loop\r\n\t\t\t\tscope[tableid] = {};\r\n\t\t\t\tdoJoin(query,scope,h+1);\r\n\t\t\t}\t\r\n\r\n\r\n\t\t}\r\n\r\n\t\t// When there is no records\r\n//\t\tif(data.length == 0 && query.groupfn) {\r\n//\t\t\tscope[tableid] = undefined;\r\n//\t\t\tdoJoin(query,scope,h+1);\r\n//\t\t}\r\n\r\n// STEP 2\r\n\r\n\t\tif(h+1 < query.sources.length) {\r\n\r\n\t\t\tif(nextsource.joinmode == \"OUTER\" || nextsource.joinmode == \"RIGHT\" \r\n\t\t\t\t|| nextsource.joinmode == \"ANTI\") {\r\n\r\n\r\n\t\t\t\tscope[source.alias] = {};\r\n\t\t\t\r\n\t\t\t\tvar j = 0;\r\n\t\t\t\tvar jlen = nextsource.data.length;\r\n\t\t\t\tvar dataw;\r\n\r\n\t\t\t\twhile((dataw = nextsource.data[j]) || (nextsource.getfn && (dataw = nextsource.getfn(j))) || (j<jlen)) {\r\n\t\t\t\t\tif(nextsource.getfn && !nextsource.dontcache) nextsource.data[j] = dataw;\r\n\r\n\t\t\t\t\tif(!dataw._rightjoin) {\r\n\t\t\t\t\t\tscope[nextsource.alias] = dataw;\r\n\t\t\t\t\t\tdoJoin(query, scope, h+2);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t//dataw._rightjoin = undefined;\t\r\n\t\t\t\t\t\tdelete dataw._rightjoin;\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tj++;\r\n\t\t\t\t}\r\n//\t\t\t\tconsole.table(nextsource.data);\r\n//\t\t\t\tdebugger;\t\r\n\r\n\t\t\t};\r\n\t\t};\r\n\r\n\r\n\t\tscope[tableid] = undefined;\r\n\r\n/*\r\n\t\tif(h+1 < query.sources.length) {\r\n\t\t\tvar nextsource = query.sources[h+1];\r\n\r\n\t\t\tif(nextsource.joinmode == \"OUTER\" || nextsource.joinmode == \"RIGHT\" \r\n\t\t\t\t|| nextsource.joinmode == \"ANTI\") {\r\n\r\n\r\n\t\t\t\tconsole.log(h,query.sources.length);\r\n\t\t\t\t// Swap\r\n\r\n\r\n//\t\t\t\tswapSources(query,h);\r\n\r\n//\t\t\t\tconsole.log(query.sources);\r\n\t\t\t\t//debugger;\r\n//\t\t\t\tvar source = query.sources[h];\r\n\r\n//\t\t\t\tvar tableid = source.alias || source.tableid; \r\n//\t\t\t\tvar data = source.data;\r\n\r\n\t\t\t\t// Reduce data for looping if there is optimization hint\r\n//\t\t\t\tif(source.optimization == 'ix') {\r\n//\t\t\t\t\tdata = source.ix[ source.onleftfn(scope, query.params, alasql) ] || [];\r\n//\t\t\t\t}\r\n\r\n\t\t\t\t// Main cycle\r\n\t\t\t\tvar pass = false;\r\n//\t\t\t\tconsole.log(tableid, data.length);\r\n\t\t\t\tfor(var i=0, ilen=nextsource.data.length; i<ilen; i++) {\r\n\t\t\t\t\tscope[nextsource.tableid] = nextsource.data[i];\r\n\t\t\t\t\t// Reduce with ON and USING clause\r\n\t\t\t\t\tif(!source.onleftfn || (source.onleftfn(scope, query.params, alasql) == source.onrightfn(scope, query.params, alasql))) {\r\n\t\t\t\t\t\t// For all non-standard JOINs like a-b=0\r\n\t\t\t\t\t\tif(source.onmiddlefn(scope, query.params, alasql)) {\r\n\t\t\t\t\t\t\t// Recursively call new join\r\n//\t\t\t\t\t\t\tif(source.joinmode == \"OUTER\") {\r\n\t\t\t\t\t\t\t\tdoJoin(query, scope, h+2);\r\n//\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// for LEFT JOIN\r\n\t\t\t\t\t\t\tpass = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t\tif(!pass) {\r\n\t\t\t\t\t// Clear the scope after the loop\r\n//\t\t\t\t\t\tscope[tableid] = {};\r\n\t\t\t\t\t\tconsole.log(scope);\r\n\t\t\t\t\t\tdoJoin(query,scope,h+2);\r\n\t\t\t\t\t}\t\r\n\t\t\t\t};\r\n\r\n\t\t\t\t// Additional join for LEFT JOINS\r\n\t\t\t\t\tscope[query.sources[h+1].tableid] = {};\r\n\t\t\t\t\tconsole.log(scope);\r\n\r\n\t\t\t\tscope[tableid] = undefined;\r\n\r\n\t\t\t\t// SWAP BACK\r\n\t\t\t\tswapSources(query,h);\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n*/\r\n\t}\r\n\r\n}",
"static findLeftJoinWhere(from, select, where, join, callback) {\n findLeftJoin(from, where, select, join, {}, callback);\n }",
"_addWheres(whereJoiner, listAdapter, where, tableAlias) {\n for (let path of Object.keys(where)) {\n const condition = this._getQueryConditionByPath(listAdapter, path, tableAlias);\n if (condition) {\n whereJoiner(condition(where[path]));\n } else if (path === 'AND' || path === 'OR') {\n whereJoiner(q => {\n // AND/OR need to traverse both side of the query\n let subJoiner;\n if (path == 'AND') {\n q.whereRaw('true');\n subJoiner = w => q.andWhere(w);\n } else {\n q.whereRaw('false');\n subJoiner = w => q.orWhere(w);\n }\n where[path].forEach(subWhere =>\n this._addWheres(subJoiner, listAdapter, subWhere, tableAlias)\n );\n });\n } else {\n // We have a relationship field\n let fieldAdapter = listAdapter.fieldAdaptersByPath[path];\n if (fieldAdapter) {\n // Non-many relationship. Traverse the sub-query, using the referenced list as a root.\n const otherListAdapter = listAdapter.getListAdapterByKey(fieldAdapter.refListKey);\n this._addWheres(whereJoiner, otherListAdapter, where[path], `${tableAlias}__${path}`);\n } else {\n // Many relationship\n const [p, constraintType] = path.split('_');\n fieldAdapter = listAdapter.fieldAdaptersByPath[p];\n const { rel } = fieldAdapter;\n const { cardinality, tableName, columnName } = rel;\n const subBaseTableAlias = this._getNextBaseTableAlias();\n const otherList = fieldAdapter.refListKey;\n const otherListAdapter = listAdapter.getListAdapterByKey(otherList);\n const subQuery = listAdapter._query();\n let otherTableAlias;\n let selectCol;\n if (cardinality === '1:N' || cardinality === 'N:1') {\n otherTableAlias = subBaseTableAlias;\n selectCol = columnName;\n subQuery\n .select(`${subBaseTableAlias}.${selectCol}`)\n .from(`${tableName} as ${subBaseTableAlias}`);\n // We need to filter out nulls before passing back to the top level query\n // otherwise postgres will give very incorrect answers.\n subQuery.whereNotNull(columnName);\n } else {\n const { near, far } = listAdapter._getNearFar(fieldAdapter);\n otherTableAlias = `${subBaseTableAlias}__${p}`;\n selectCol = near;\n subQuery\n .select(`${subBaseTableAlias}.${selectCol}`)\n .from(`${tableName} as ${subBaseTableAlias}`);\n subQuery.innerJoin(\n `${otherListAdapter.tableName} as ${otherTableAlias}`,\n `${otherTableAlias}.id`,\n `${subBaseTableAlias}.${far}`\n );\n }\n \n this._addJoins(subQuery, otherListAdapter, where[path], otherTableAlias);\n\n // some: the ID is in the examples found\n // none: the ID is not in the examples found\n // every: the ID is not in the counterexamples found\n // FIXME: This works in a general and logical way, but doesn't always generate the queries that PG can best optimise\n // 'some' queries would more efficient as inner joins\n\n if (constraintType === 'every') {\n subQuery.whereNot(q => {\n q.whereRaw('true');\n this._addWheres(w => q.andWhere(w), otherListAdapter, where[path], otherTableAlias);\n });\n } else {\n subQuery.whereRaw('true');\n this._addWheres(\n w => subQuery.andWhere(w),\n otherListAdapter,\n where[path],\n otherTableAlias\n );\n }\n\n // Ensure there therwhereIn/whereNotIn query is run against\n // a table with exactly one column.\n const subSubQuery = listAdapter.parentAdapter.knex\n .select(selectCol)\n .from(subQuery.as('unused_alias'));\n if (constraintType === 'some') {\n whereJoiner(q => q.whereIn(`${tableAlias}.id`, subSubQuery));\n } else {\n whereJoiner(q => q.whereNotIn(`${tableAlias}.id`, subSubQuery));\n }\n }\n }\n }\n }",
"function doJoin (query, scope, h) {\n\n\t// Check, if this is a last join?\n\tif(h>=query.sources.length) { // Todo: check if this runs once too many\n\n\t\t// Then apply where and select\n\n\t\tif(query.wherefn(scope,query.params, alasql)) {\n\n\t\t\t// If there is a GROUP BY then pipe to groupping function\n\t\t\tif(query.groupfn) {\n\t\t\t\tquery.groupfn(scope, query.params, alasql)\n\t\t\t} else {\n\n\t\t\t\tquery.data.push(query.selectfn(scope, query.params, alasql));\n\t\t\t}\t\n\t\t}\n\t} else if(query.sources[h].applyselect) {\n\n\t\tvar source = query.sources[h];\n\t\tsource.applyselect(query.params, function(data){\n\t\t\tif(data.length > 0) {\n\n\t\t\t\tfor(var i=0;i<data.length;i++) {\n\t\t\t\t\tscope[source.alias] = data[i];\n\t\t\t\t\tdoJoin(query, scope, h+1);\n\t\t\t\t};\t\t\t\n\t\t\t} else {\n\t\t\t\tif (source.applymode == 'OUTER') {\n\t\t\t\t\tscope[source.alias] = {};\n\t\t\t\t\tdoJoin(query, scope, h+1);\n\t\t\t\t}\n\t\t\t}\n\t\t},scope);\n\n\t} else {\n\n// STEP 1\n\n\t\tvar source = query.sources[h];\n\t\tvar nextsource = query.sources[h+1];\n\n\t\t// Todo: check if this is smart\n\t\tif(true) {//source.joinmode != \"ANTI\") {\n\n\t\t\tvar tableid = source.alias || source.tableid; \n\t\t\tvar pass = false; // For LEFT JOIN\n\t\t\tvar data = source.data;\n\t\t\tvar opt = false;\n\n\t\t\t// Reduce data for looping if there is optimization hint\n\t\t\tif(!source.getfn || (source.getfn && !source.dontcache)) {\n\t\t\t\tif(source.joinmode != \"RIGHT\" && source.joinmode != \"OUTER\" && source.joinmode != \"ANTI\" && source.optimization == 'ix') {\n\t\t\t\t\tdata = source.ix[ source.onleftfn(scope, query.params, alasql) ] || [];\n\t\t\t\t\topt = true;\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Main cycle\n\t\t\tvar i = 0;\n\t\t\tif(typeof data == 'undefined') {\n\t\t\t\tthrow new Error('Data source number '+h+' in undefined')\n\t\t\t}\n\t\t\tvar ilen=data.length;\n\t\t\tvar dataw;\n\n\t\t\twhile((dataw = data[i]) || (!opt && (source.getfn && (dataw = source.getfn(i)))) || (i<ilen) ) {\n\t\t\t\tif(!opt && source.getfn && !source.dontcache) data[i] = dataw;\n\n\t\t\t\tscope[tableid] = dataw;\n\t\t\t\t// Reduce with ON and USING clause\n\t\t\t\tif(!source.onleftfn || (source.onleftfn(scope, query.params, alasql) == source.onrightfn(scope, query.params, alasql))) {\n\t\t\t\t\t// For all non-standard JOINs like a-b=0\n\t\t\t\t\tif(source.onmiddlefn(scope, query.params, alasql)) {\n\t\t\t\t\t\t// Recursively call new join\n\n\t\t\t\t\t\tif(source.joinmode != \"SEMI\" && source.joinmode != \"ANTI\") { \n\n\t\t\t\t\t\t\tdoJoin(query, scope, h+1);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// if(source.data[i].f = 200) debugger;\n\n\t\t\t\t\t\tif(source.joinmode != \"LEFT\" && source.joinmode != \"INNER\") {\n\t\t\t\t\t\t\tdataw._rightjoin = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// for LEFT JOIN\n\t\t\t\t\t\tpass = true;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\ti++;\n\t\t\t};\n\n\t\t\t// Additional join for LEFT JOINS\n\t\t\tif((source.joinmode == 'LEFT' || source.joinmode == 'OUTER' || source.joinmode == 'SEMI' ) && !pass) {\n\t\t\t// Clear the scope after the loop\n\t\t\t\tscope[tableid] = {};\n\t\t\t\tdoJoin(query,scope,h+1);\n\t\t\t}\t\n\n\t\t}\n\n\t\t// When there is no records\n\n// STEP 2\n\n\t\tif(h+1 < query.sources.length) {\n\n\t\t\tif(nextsource.joinmode == \"OUTER\" || nextsource.joinmode == \"RIGHT\" \n\t\t\t\t|| nextsource.joinmode == \"ANTI\") {\n\n\t\t\t\tscope[source.alias] = {};\n\n\t\t\t\tvar j = 0;\n\t\t\t\tvar jlen = nextsource.data.length;\n\t\t\t\tvar dataw;\n\n\t\t\t\twhile((dataw = nextsource.data[j]) || (nextsource.getfn && (dataw = nextsource.getfn(j))) || (j<jlen)) {\n\t\t\t\t\tif(nextsource.getfn && !nextsource.dontcache) {\n\t\t\t\t\t\tnextsource.data[j] = dataw;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(dataw._rightjoin) {\n\t\t\t\t\t\tdelete dataw._rightjoin;\t\t\t\t\t\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif(h==0) {\n\t\t\t\t\t\t\tscope[nextsource.alias] = dataw;\n\t\t\t\t\t\t\tdoJoin(query, scope, h+2);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t//scope[nextsource.alias] = dataw;\n\t\t\t\t\t\t\t//doJoin(query, scope, h+2);\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tj++;\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t};\n\t\t} else {\n\n\t\t};\n\n\t\tscope[tableid] = undefined;\n\n\t}\n\n}",
"static findLeftJoin(from, select, join, callback) {\n findLeftJoin(from, {}, select, join, {}, callback);\n }",
"function includeHasManySimple(callback) {\n //Map for Indexing objects by their id for faster retrieval\n var objIdMap2 = includeUtils.buildOneToOneIdentityMapWithOrigKeys(objs, relation.keyFrom);\n\n filter.where[relation.keyTo] = {\n inq: uniq(objIdMap2.getKeys()),\n };\n\n relation.applyScope(null, filter);\n relation.modelTo.find(filter, options, targetFetchHandler);\n\n function targetFetchHandler(err, targets) {\n if (err) {\n return callback(err);\n }\n var targetsIdMap = includeUtils.buildOneToManyIdentityMapWithOrigKeys(targets, relation.keyTo);\n includeUtils.join(objIdMap2, targetsIdMap, function(obj1, valueToMergeIn) {\n defineCachedRelations(obj1);\n obj1.__cachedRelations[relationName] = valueToMergeIn;\n processTargetObj(obj1, function() {});\n });\n callback(err, objs);\n }\n }",
"static findWhere(from, select, where, callback) {\n find(from, where, select, {}, callback);\n }",
"function join(lookupTable, mainTable, lookupKey, mainKey, select) {\n\t\n var l = lookupTable.length,\n m = mainTable.length,\n lookupIndex = [],\n output = [];\n for (var i = 0; i < l; i++) { // loop through l items\n var row = lookupTable[i];\n lookupIndex[row[lookupKey]] = row; // create an index for lookup table\n }\n for (var j = 0; j < m; j += 1) { // loop through m items\n var y = mainTable[j];\n var x = lookupIndex[y[mainKey]]; // get corresponding row from lookupTable\n output.push(select(y, x)); // select only the columns you need\n }\n return output;\n}",
"function join(lookupTable, mainTable, lookupKey, mainKey, select) {\r\n var l = lookupTable.length,\r\n m = mainTable.length,\r\n lookupIndex = [],\r\n output = [];\r\n for (var i = 0; i < l; i++) { // loop through l items\r\n var row = lookupTable[i];\r\n lookupIndex[row[lookupKey]] = row; // create an index for lookup table\r\n }\r\n for (var j = 0; j < m; j++) { // loop through m items\r\n var y = mainTable[j];\r\n var x = lookupIndex[y[mainKey]]; // get corresponding row from lookupTable\r\n output.push(select(y, x)); // select only the columns you need\r\n }\r\n return output;\r\n}",
"static findLeftJoinWhereOrder(from, select, where, join, orderby, callback) {\n findLeftJoin(from, where, select, join, orderby, callback);\n }",
"function joinClause( arr ) {\n\tvar ret = \" \";\n\tfor( var i=0; i < arr.length; i++ ) {\n\t\t// TODO: join clause is hard coded\n\t\tif( arr[i].criteria ) {\n\t\t\t// we always give table alias to support multiple joins of same table\n\t\t\tret += \"join \" + arr[i].table + \" on \" + arr[i].criteria + \" \";\n\t\t}\n\t\telse {\n\t\t\tret += \"join \" + arr[i].table + \" on fk_parentid = parent.id \";\n\t\t}\n\t}\n\treturn ret;\n}",
"useJoinsUnsafe(...arr) {\n return QueryUtil.useJoins(this, arr);\n }",
"function join(tableA, tableB, predicate){\n var result = [];\n tableA.forEach(function(a){\n tableB.forEach(function(b){\n if(predicate(a, b)){\n result.push(extend(a, b));\n }\n });\n });\n return result;\n}",
"static findOneWhere(from, select, where, callback) {\n findOne(from, where, select, {}, callback);\n }",
"function getRecords(res, mysql, context, id, pass, complete)\n{\n mysql.pool.query(\"SELECT * FROM records r INNER JOIN user u ON r.user = u.id WHERE u.user_name=? and u.user_password=?\", [id, pass], function(error, results, fields) {\n if (error) {\n console.log(JSON.stringify(error));\n return;\n }\n context.records=results;\n //console.log(context.records);\n complete();\n });\n}",
"function getJoinFilter(data, exp) {\n var test = getJoinFilterTestFunction(exp, data);\n var calc = null;\n if (expressionHasCalcFunction(exp)) {\n calc = getJoinFilterCalcFunction(exp, data);\n }\n\n return function(srcIds, destRec) {\n var d = calc ? calc(srcIds) : null;\n var filtered = [],\n retn, i;\n for (i=0; i<srcIds.length; i++) {\n retn = test(srcIds[i], destRec, d);\n if (retn === true) {\n filtered.push(srcIds[i]);\n } else if (retn !== false) {\n stop('\"where\" expression must return true or false');\n }\n }\n return filtered;\n };\n }",
"static find(from, select, callback) {\n find(from, {}, select, {}, callback);\n }",
"static findWhereOrder(from, select, where, orderby, callback) {\n find(from, where, select, orderby, callback);\n }",
"findByLinkKey(payload, err, success) {\n tables[table].find({\n where: {\n maumasiFyKey: payload.maumasiFyKey,\n },\n include: [{\n all: true,\n nested: true,\n }],\n }).then(success).catch(err);\n\n log(null, __filename,\n 'Model CRUD',\n 'Search by link key');\n }",
"_findInIndex(index0, key0, key1, key2, name0, name1, name2, graph, callback, array) {\n var tmp,\n index1,\n index2,\n varCount = !key0 + !key1 + !key2,\n // depending on the number of variables, keys or reverse index are faster\n entityKeys = varCount > 1 ? Object.keys(this._ids) : this._entities; // If a key is specified, use only that part of index 0.\n\n if (key0) (tmp = index0, index0 = {})[key0] = tmp[key0];\n\n for (var value0 in index0) {\n var entity0 = entityKeys[value0];\n\n if (index1 = index0[value0]) {\n // If a key is specified, use only that part of index 1.\n if (key1) (tmp = index1, index1 = {})[key1] = tmp[key1];\n\n for (var value1 in index1) {\n var entity1 = entityKeys[value1];\n\n if (index2 = index1[value1]) {\n // If a key is specified, use only that part of index 2, if it exists.\n var values = key2 ? key2 in index2 ? [key2] : [] : Object.keys(index2); // Create quads for all items found in index 2.\n\n for (var l = 0; l < values.length; l++) {\n var parts = {\n subject: null,\n predicate: null,\n object: null\n };\n parts[name0] = fromId(entity0, this._factory);\n parts[name1] = fromId(entity1, this._factory);\n parts[name2] = fromId(entityKeys[values[l]], this._factory);\n\n var quad = this._factory.quad(parts.subject, parts.predicate, parts.object, fromId(graph, this._factory));\n\n if (array) array.push(quad);else if (callback(quad)) return true;\n }\n }\n }\n }\n }\n\n return array;\n }",
"function handleJoin( result, idCounter, item, parentId ) {\n\n // activity data\n var actId = '_:join' + idCounter['activity']++,\n actStartTime = (new Date( item.getData( 'startTime' ) )).toISOString(),\n actEndTime = (new Date( item.getData( 'endTime' ) )).toISOString();\n\n // activity entry\n result['activity'][ actId ] = {\n 'prov:startTime': actStartTime,\n 'prov:endTime': actEndTime,\n 'prov:type': convertType( item.getData( 'type' ) ),\n 'yavaa:params': JSON.stringify( item.getData('params') ),\n 'yavaa:action': item.getData( 'action' ),\n 'yavaa:columns': JSON.stringify( item.getData( 'columns' ) ),\n 'yavaa:prevActivity': []\n };\n\n // resulting (intermediate?) entity\n var newEntId = '_:result' + idCounter['entity']++;\n result['entity'][ newEntId ] = {\n 'prov:type': { '$': 'prov:Collection', 'type': 'xsd:QName' },\n };\n\n // link to resulting entity\n result['wasGeneratedBy'][ '_:wasGeneratedBy' + idCounter['relation']++ ] = {\n 'prov:entity': newEntId,\n 'prov:activity': actId\n };\n\n // add links\n linkToParent( result, idCounter, newEntId, actId, parentId );\n linkToProv( item, actId, newEntId );\n\n return actId;\n }",
"async readEmpresa(){\n const sql = 'SELECT * FROM usuarios INNER JOIN empresas ON usuarios.id_usuario = empresas.id_empresa';\n const result = await pool.query(sql);\n return result.rows;\n }",
"_decorateRead () {\n this.relatedQuery.where(this.toKey, this.parent[this.fromKey])\n }",
"function getPostWithLikes(){\n // DB many to do SQL to get your data\n db.many(`\n SELECT * FROM likes\n INNER JOIN comments \n ON likes.post_id = comments.post_id\n `)\n // start a callback function to grab data from SQL\n .then((results) =>{\n // Do a forEach to be able to store the object data!\n results.forEach((row) =>{\n console.log(`Post id ${row.post_id} made comment ${row.comment}`)\n\n })\n })\n .catch((e)=> {\n console.log(e)\n })\n}",
"function findMany(callback){\n async.map(ids, findOne, callback);\n }",
"async function find(context) {\r\n let query = baseQuery;\r\n const binds = {};\r\n \r\n if (context.id) {\r\n binds.IDS_DADOSPROPOSTADS = context.id;\r\n \r\n query += `\\nwhere IDS_DADOSPROPOSTADS = :IDS_DADOSPROPOSTADS`;\r\n }\r\n \r\n const result = await database.simpleExecute(query, binds);\r\n \r\n return result.rows;\r\n}"
]
| [
"0.7549586",
"0.69616145",
"0.6910877",
"0.60859513",
"0.57186496",
"0.5668827",
"0.56324303",
"0.5555086",
"0.5535045",
"0.5451174",
"0.5352476",
"0.5272109",
"0.51424843",
"0.51024616",
"0.5095254",
"0.5060973",
"0.50348043",
"0.5022924",
"0.49924514",
"0.4932506",
"0.49254662",
"0.49124974",
"0.48311922",
"0.4801324",
"0.47657502",
"0.4747319",
"0.47444478",
"0.47355312",
"0.47242582",
"0.47137097"
]
| 0.78167605 | 0 |
FROM, SELECT, JOIN, ORDERBY, CALLBACK | static findInnerJoinOrder(from, select, join, orderby, callback) {
findInnerJoin(from, {}, select, join, orderby, callback);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"queryAll(callback) {\r\n var self = this;\r\n this.table.findAll(this.select)\r\n .then(function (data) {\r\n self.data = data;\r\n callback(self);\r\n },\r\n function (err) {\r\n localData = { error: err };\r\n callback(self);\r\n });\r\n }",
"function getRecords(res, mysql, context, id, pass, complete)\n{\n mysql.pool.query(\"SELECT * FROM records r INNER JOIN user u ON r.user = u.id WHERE u.user_name=? and u.user_password=?\", [id, pass], function(error, results, fields) {\n if (error) {\n console.log(JSON.stringify(error));\n return;\n }\n context.records=results;\n //console.log(context.records);\n complete();\n });\n}",
"static findInnerJoinWhereOrder(from, select, where, join, orderby, callback) {\n findInnerJoin(from, where, select, join, orderby, callback);\n }",
"load(callback) {\n const selectTodoItems = \"SELECT * FROM todo_items\";\n this.dbConnection.query(selectTodoItems, function (err, results, fields) {\n if (err) {\n callback(err);\n return;\n }\n\n callback(null, results);\n });\n }",
"static findLeftJoinWhereOrder(from, select, where, join, orderby, callback) {\n findLeftJoin(from, where, select, join, orderby, callback);\n }",
"lista(callback) {\n this._db.query('select * from resposta', function(err, recordset) {\n callback(err, recordset);\n });\n }",
"function fetchEntryItems(){\n\n var d = $.Deferred();\n\n db.transaction(function (tx) {\n\n tx.executeSql('SELECT * FROM entries ORDER BY sortIndex ASC', [], function (tx, results) {\n var len = results.rows.length, i, items;\n\n items = [];\n\n for (i = 0; i < len; i++) {\n items.push(results.rows.item(i));\n }\n\n d.resolve(items);\n },\n function (tx, error) {\n console.log(\"Query Error: \" + error.message);\n d.reject();\n });\n\n });\n\n return d;\n }",
"static findOrder(from, select, orderby, callback) {\n find(from, {}, select, orderby, callback);\n }",
"get(cb,args = {}){\n\t\tvar argDef = {\n\t\t\tid:[\"int\",false],\n\t\t\temail:[\"varchar\",false]\n\t\t};\n\t\tvar byID = args.id ? 'and person.id = @id' : '';\n\t\tvar byEmail = args.email ? 'and person.email = @email' : '';\n\t\tvar queryText = `\n\t\t\tselect top 3\n\t\t\tperson.*,\n\t\t\tstuff(\n\t\t\t\t(\n\t\t\t\t\tselect ',' + cast(instrument.id as varchar(10))\n\t\t\t\t\tfrom instrument\n\t\t\t\t\tinner join person_instrument on person_instrument.instrument_id = instrument.id\n\t\t\t\t\t\tand person_instrument.active = 1\n\t\t\t\t\t\tand person_instrument.person_id = person.id\n\t\t\t\t\t\twhere instrument.active = 1\n\t\t\t\t\t\torder by instrument.id asc\n\t\t\t\t\t\tfor xml path('')\n\t\t\t\t)\n\t\t\t,1,1,'') as instrument_ids\n\t\t\tfrom person\n\t\t\twhere person.active = 1\n\n\t\t\t${byID}\n\t\t\t${byEmail}\n\t\t`;\n\n\t\tthis.query(cb,queryText,args,argDef);\n\t}",
"function doJoin (query, scope, h) {\r\n//\tconsole.log('doJoin', arguments);\r\n//\tconsole.log(query.sources.length);\r\n\t// Check, if this is a last join?\r\n\tif(h>=query.sources.length) {\r\n//console.log(query.wherefns);\r\n\t\t// Then apply where and select\r\n//\t\tconsole.log(query);\r\n\t\tif(query.wherefn(scope,query.params, alasql)) {\r\n\r\n//\t\t\tconsole.log(\"scope\",scope.schools);\r\n\r\n//\t\t\tvar res = query.selectfn(scope, query.params, alasql);\r\n//\t\t\tconsole.log(\"last\",res);\r\n\t\t\t// If there is a GROUP BY then pipe to groupping function\r\n\t\t\tif(query.groupfn) {\r\n\t\t\t\tquery.groupfn(scope, query.params, alasql)\r\n\t\t\t} else {\r\n//\t\t\t\tquery.qwerty = 999;\r\n//console.log(query.qwerty, query.queriesfn && query.queriesfn.length,2);\r\n\t\t\t\tquery.data.push(query.selectfn(scope, query.params, alasql));\r\n\t\t\t}\t\r\n\t\t}\r\n\t} else if(query.sources[h].applyselect) {\r\n//\t\tconsole.log('APPLY',scope);\r\n//\t\t\tconsole.log('scope1',scope);\r\n//\t\t\t\tconsole.log(scope);\r\n\t\tvar source = query.sources[h];\r\n\t\tsource.applyselect(query.params, function(data){\r\n\t\t\tif(data.length > 0) {\r\n\t//\t\t\tconsole.log('APPLY CB');\r\n\t\t\t\tfor(var i=0;i<data.length;i++) {\r\n\t\t\t\t\tscope[source.alias] = data[i];\r\n\t\t\t\t\tdoJoin(query, scope, h+1);\r\n\t\t\t\t};\t\t\t\r\n\t\t\t} else {\r\n//\t\t\t\tconsole.log(source.applymode);\r\n\t\t\t\tif (source.applymode == 'OUTER') {\r\n\t\t\t\t\tscope[source.alias] = {};\r\n\t\t\t\t\tdoJoin(query, scope, h+1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},scope);\r\n\r\n//\t\tconsole.log(data);\r\n\t} else {\r\n\r\n// STEP 1\r\n\r\n\t\tvar source = query.sources[h];\r\n\t\tvar nextsource = query.sources[h+1];\r\n\r\n//\t\tif(source.joinmode == \"LEFT\" || source.joinmode == \"INNER\" || source.joinmode == \"RIGHT\"\r\n//\t\t\t|| source.joinmode == \"OUTER\" || source.joinmode == \"SEMI\") {\r\n\t\tif(true) {//source.joinmode != \"ANTI\") {\r\n\r\n\t\t\t// if(nextsource && nextsource.joinmode == \"RIGHT\") {\r\n\t\t\t// \tif(!nextsource.rightdata) {\r\n\t\t\t// \t\tconsole.log(\"ok\");\r\n\t\t\t// \t\tnextsource.rightdata = new Array(nextsource.data.length);\r\n\t\t\t// \t\tconsole.log(nextsource.data.length, nextsource.rightdata);\r\n\t\t\t// \t}\r\n\t\t\t// }\r\n\r\n\t\t\tvar tableid = source.alias || source.tableid; \r\n\t\t\tvar pass = false; // For LEFT JOIN\r\n\t\t\tvar data = source.data;\r\n\t\t\tvar opt = false;\r\n\r\n\t\t\t// Reduce data for looping if there is optimization hint\r\n\t\t\tif(!source.getfn || (source.getfn && !source.dontcache)) {\r\n\t\t\t\tif(source.joinmode != \"RIGHT\" && source.joinmode != \"OUTER\" && source.joinmode != \"ANTI\" && source.optimization == 'ix') {\r\n\t\t\t\t\tdata = source.ix[ source.onleftfn(scope, query.params, alasql) ] || [];\r\n\t\t\t\t\topt = true;\r\n//\t\t\t\t\tconsole.log(source.onleftfns);\r\n//\t\t\t\t\tconsole.log(source.ix);\r\n//\tconsole.log(source.onleftfn(scope, query.params, alasql));\r\n//\t\t\t\t\tconsole.log(opt, data, data.length);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Main cycle\r\n\t\t\tvar i = 0;\r\n\t\t\tif(typeof data == 'undefined') {\r\n\t\t\t\tthrow new Error('Data source number '+h+' in undefined')\r\n\t\t\t}\r\n\t\t\tvar ilen=data.length;\r\n\t\t\tvar dataw;\r\n//\t\t\tconsole.log(h,opt,source.data,i,source.dontcache);\r\n\t\t\twhile((dataw = data[i]) || (!opt && (source.getfn && (dataw = source.getfn(i)))) || (i<ilen) ) {\r\n\t\t\t\tif(!opt && source.getfn && !source.dontcache) data[i] = dataw;\r\n//console.log(h, i, dataw);\r\n\t\t\t\tscope[tableid] = dataw;\r\n\t\t\t\t// Reduce with ON and USING clause\r\n\t\t\t\tif(!source.onleftfn || (source.onleftfn(scope, query.params, alasql) == source.onrightfn(scope, query.params, alasql))) {\r\n\t\t\t\t\t// For all non-standard JOINs like a-b=0\r\n\t\t\t\t\tif(source.onmiddlefn(scope, query.params, alasql)) {\r\n\t\t\t\t\t\t// Recursively call new join\r\n//\t\t\t\t\t\tif(source.joinmode == \"LEFT\" || source.joinmode == \"INNER\" || source.joinmode == \"OUTER\" || source.joinmode == \"RIGHT\" ) {\r\n\t\t\t\t\t\tif(source.joinmode != \"SEMI\" && source.joinmode != \"ANTI\") { \r\n//\t\t\t\t\t\t\tconsole.log(scope);\r\n\t\t\t\t\t\t\tdoJoin(query, scope, h+1);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// if(source.data[i].f = 200) debugger;\r\n\r\n//\t\t\t\t\t\tif(source.joinmode == \"RIGHT\" || source.joinmode == \"ANTI\" || source.joinmode == \"OUTER\") {\r\n\t\t\t\t\t\tif(source.joinmode != \"LEFT\" && source.joinmode != \"INNER\") {\r\n\t\t\t\t\t\t\tdataw._rightjoin = true;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// for LEFT JOIN\r\n\t\t\t\t\t\tpass = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\ti++;\r\n\t\t\t};\r\n\r\n\r\n\t\t\t// Additional join for LEFT JOINS\r\n\t\t\tif((source.joinmode == 'LEFT' || source.joinmode == 'OUTER' || source.joinmode == 'SEMI' ) && !pass) {\r\n\t\t\t// Clear the scope after the loop\r\n\t\t\t\tscope[tableid] = {};\r\n\t\t\t\tdoJoin(query,scope,h+1);\r\n\t\t\t}\t\r\n\r\n\r\n\t\t}\r\n\r\n\t\t// When there is no records\r\n//\t\tif(data.length == 0 && query.groupfn) {\r\n//\t\t\tscope[tableid] = undefined;\r\n//\t\t\tdoJoin(query,scope,h+1);\r\n//\t\t}\r\n\r\n// STEP 2\r\n\r\n\t\tif(h+1 < query.sources.length) {\r\n\r\n\t\t\tif(nextsource.joinmode == \"OUTER\" || nextsource.joinmode == \"RIGHT\" \r\n\t\t\t\t|| nextsource.joinmode == \"ANTI\") {\r\n\r\n\r\n\t\t\t\tscope[source.alias] = {};\r\n\t\t\t\r\n\t\t\t\tvar j = 0;\r\n\t\t\t\tvar jlen = nextsource.data.length;\r\n\t\t\t\tvar dataw;\r\n\r\n\t\t\t\twhile((dataw = nextsource.data[j]) || (nextsource.getfn && (dataw = nextsource.getfn(j))) || (j<jlen)) {\r\n\t\t\t\t\tif(nextsource.getfn && !nextsource.dontcache) nextsource.data[j] = dataw;\r\n\r\n\t\t\t\t\tif(!dataw._rightjoin) {\r\n\t\t\t\t\t\tscope[nextsource.alias] = dataw;\r\n\t\t\t\t\t\tdoJoin(query, scope, h+2);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t//dataw._rightjoin = undefined;\t\r\n\t\t\t\t\t\tdelete dataw._rightjoin;\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tj++;\r\n\t\t\t\t}\r\n//\t\t\t\tconsole.table(nextsource.data);\r\n//\t\t\t\tdebugger;\t\r\n\r\n\t\t\t};\r\n\t\t};\r\n\r\n\r\n\t\tscope[tableid] = undefined;\r\n\r\n/*\r\n\t\tif(h+1 < query.sources.length) {\r\n\t\t\tvar nextsource = query.sources[h+1];\r\n\r\n\t\t\tif(nextsource.joinmode == \"OUTER\" || nextsource.joinmode == \"RIGHT\" \r\n\t\t\t\t|| nextsource.joinmode == \"ANTI\") {\r\n\r\n\r\n\t\t\t\tconsole.log(h,query.sources.length);\r\n\t\t\t\t// Swap\r\n\r\n\r\n//\t\t\t\tswapSources(query,h);\r\n\r\n//\t\t\t\tconsole.log(query.sources);\r\n\t\t\t\t//debugger;\r\n//\t\t\t\tvar source = query.sources[h];\r\n\r\n//\t\t\t\tvar tableid = source.alias || source.tableid; \r\n//\t\t\t\tvar data = source.data;\r\n\r\n\t\t\t\t// Reduce data for looping if there is optimization hint\r\n//\t\t\t\tif(source.optimization == 'ix') {\r\n//\t\t\t\t\tdata = source.ix[ source.onleftfn(scope, query.params, alasql) ] || [];\r\n//\t\t\t\t}\r\n\r\n\t\t\t\t// Main cycle\r\n\t\t\t\tvar pass = false;\r\n//\t\t\t\tconsole.log(tableid, data.length);\r\n\t\t\t\tfor(var i=0, ilen=nextsource.data.length; i<ilen; i++) {\r\n\t\t\t\t\tscope[nextsource.tableid] = nextsource.data[i];\r\n\t\t\t\t\t// Reduce with ON and USING clause\r\n\t\t\t\t\tif(!source.onleftfn || (source.onleftfn(scope, query.params, alasql) == source.onrightfn(scope, query.params, alasql))) {\r\n\t\t\t\t\t\t// For all non-standard JOINs like a-b=0\r\n\t\t\t\t\t\tif(source.onmiddlefn(scope, query.params, alasql)) {\r\n\t\t\t\t\t\t\t// Recursively call new join\r\n//\t\t\t\t\t\t\tif(source.joinmode == \"OUTER\") {\r\n\t\t\t\t\t\t\t\tdoJoin(query, scope, h+2);\r\n//\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// for LEFT JOIN\r\n\t\t\t\t\t\t\tpass = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t\tif(!pass) {\r\n\t\t\t\t\t// Clear the scope after the loop\r\n//\t\t\t\t\t\tscope[tableid] = {};\r\n\t\t\t\t\t\tconsole.log(scope);\r\n\t\t\t\t\t\tdoJoin(query,scope,h+2);\r\n\t\t\t\t\t}\t\r\n\t\t\t\t};\r\n\r\n\t\t\t\t// Additional join for LEFT JOINS\r\n\t\t\t\t\tscope[query.sources[h+1].tableid] = {};\r\n\t\t\t\t\tconsole.log(scope);\r\n\r\n\t\t\t\tscope[tableid] = undefined;\r\n\r\n\t\t\t\t// SWAP BACK\r\n\t\t\t\tswapSources(query,h);\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n*/\r\n\t}\r\n\r\n}",
"function fetchResultsTable(_x,_x2,_x3){return _fetchResultsTable.apply(this,arguments);}",
"static findLeftJoinOrder(from, select, join, orderby, callback) {\n findLeftJoin(from, {}, select, join, orderby, callback);\n }",
"static findWhereOrder(from, select, where, orderby, callback) {\n find(from, where, select, orderby, callback);\n }",
"static findInnerJoin(from, select, join, callback) {\n findInnerJoin(from, {}, select, join, {}, callback);\n }",
"getEventTickets(event_id: number, callback) {\n super.query(\n 'SELECT tt.name, tt.description, et.price, et.amount FROM ticket_type tt LEFT JOIN event_ticket et ON et.ticket_type_id = tt.ticket_type_id WHERE et.event_id = ?',\n [event_id],\n callback,\n );\n }",
"function doJoin (query, scope, h) {\n\n\t// Check, if this is a last join?\n\tif(h>=query.sources.length) { // Todo: check if this runs once too many\n\n\t\t// Then apply where and select\n\n\t\tif(query.wherefn(scope,query.params, alasql)) {\n\n\t\t\t// If there is a GROUP BY then pipe to groupping function\n\t\t\tif(query.groupfn) {\n\t\t\t\tquery.groupfn(scope, query.params, alasql)\n\t\t\t} else {\n\n\t\t\t\tquery.data.push(query.selectfn(scope, query.params, alasql));\n\t\t\t}\t\n\t\t}\n\t} else if(query.sources[h].applyselect) {\n\n\t\tvar source = query.sources[h];\n\t\tsource.applyselect(query.params, function(data){\n\t\t\tif(data.length > 0) {\n\n\t\t\t\tfor(var i=0;i<data.length;i++) {\n\t\t\t\t\tscope[source.alias] = data[i];\n\t\t\t\t\tdoJoin(query, scope, h+1);\n\t\t\t\t};\t\t\t\n\t\t\t} else {\n\t\t\t\tif (source.applymode == 'OUTER') {\n\t\t\t\t\tscope[source.alias] = {};\n\t\t\t\t\tdoJoin(query, scope, h+1);\n\t\t\t\t}\n\t\t\t}\n\t\t},scope);\n\n\t} else {\n\n// STEP 1\n\n\t\tvar source = query.sources[h];\n\t\tvar nextsource = query.sources[h+1];\n\n\t\t// Todo: check if this is smart\n\t\tif(true) {//source.joinmode != \"ANTI\") {\n\n\t\t\tvar tableid = source.alias || source.tableid; \n\t\t\tvar pass = false; // For LEFT JOIN\n\t\t\tvar data = source.data;\n\t\t\tvar opt = false;\n\n\t\t\t// Reduce data for looping if there is optimization hint\n\t\t\tif(!source.getfn || (source.getfn && !source.dontcache)) {\n\t\t\t\tif(source.joinmode != \"RIGHT\" && source.joinmode != \"OUTER\" && source.joinmode != \"ANTI\" && source.optimization == 'ix') {\n\t\t\t\t\tdata = source.ix[ source.onleftfn(scope, query.params, alasql) ] || [];\n\t\t\t\t\topt = true;\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Main cycle\n\t\t\tvar i = 0;\n\t\t\tif(typeof data == 'undefined') {\n\t\t\t\tthrow new Error('Data source number '+h+' in undefined')\n\t\t\t}\n\t\t\tvar ilen=data.length;\n\t\t\tvar dataw;\n\n\t\t\twhile((dataw = data[i]) || (!opt && (source.getfn && (dataw = source.getfn(i)))) || (i<ilen) ) {\n\t\t\t\tif(!opt && source.getfn && !source.dontcache) data[i] = dataw;\n\n\t\t\t\tscope[tableid] = dataw;\n\t\t\t\t// Reduce with ON and USING clause\n\t\t\t\tif(!source.onleftfn || (source.onleftfn(scope, query.params, alasql) == source.onrightfn(scope, query.params, alasql))) {\n\t\t\t\t\t// For all non-standard JOINs like a-b=0\n\t\t\t\t\tif(source.onmiddlefn(scope, query.params, alasql)) {\n\t\t\t\t\t\t// Recursively call new join\n\n\t\t\t\t\t\tif(source.joinmode != \"SEMI\" && source.joinmode != \"ANTI\") { \n\n\t\t\t\t\t\t\tdoJoin(query, scope, h+1);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// if(source.data[i].f = 200) debugger;\n\n\t\t\t\t\t\tif(source.joinmode != \"LEFT\" && source.joinmode != \"INNER\") {\n\t\t\t\t\t\t\tdataw._rightjoin = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// for LEFT JOIN\n\t\t\t\t\t\tpass = true;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\ti++;\n\t\t\t};\n\n\t\t\t// Additional join for LEFT JOINS\n\t\t\tif((source.joinmode == 'LEFT' || source.joinmode == 'OUTER' || source.joinmode == 'SEMI' ) && !pass) {\n\t\t\t// Clear the scope after the loop\n\t\t\t\tscope[tableid] = {};\n\t\t\t\tdoJoin(query,scope,h+1);\n\t\t\t}\t\n\n\t\t}\n\n\t\t// When there is no records\n\n// STEP 2\n\n\t\tif(h+1 < query.sources.length) {\n\n\t\t\tif(nextsource.joinmode == \"OUTER\" || nextsource.joinmode == \"RIGHT\" \n\t\t\t\t|| nextsource.joinmode == \"ANTI\") {\n\n\t\t\t\tscope[source.alias] = {};\n\n\t\t\t\tvar j = 0;\n\t\t\t\tvar jlen = nextsource.data.length;\n\t\t\t\tvar dataw;\n\n\t\t\t\twhile((dataw = nextsource.data[j]) || (nextsource.getfn && (dataw = nextsource.getfn(j))) || (j<jlen)) {\n\t\t\t\t\tif(nextsource.getfn && !nextsource.dontcache) {\n\t\t\t\t\t\tnextsource.data[j] = dataw;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(dataw._rightjoin) {\n\t\t\t\t\t\tdelete dataw._rightjoin;\t\t\t\t\t\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif(h==0) {\n\t\t\t\t\t\t\tscope[nextsource.alias] = dataw;\n\t\t\t\t\t\t\tdoJoin(query, scope, h+2);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t//scope[nextsource.alias] = dataw;\n\t\t\t\t\t\t\t//doJoin(query, scope, h+2);\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tj++;\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t};\n\t\t} else {\n\n\t\t};\n\n\t\tscope[tableid] = undefined;\n\n\t}\n\n}",
"function onGetAllSuccess_GetResponseFromDatabaseWhereClause(records){\n isSuccess = true;\n ReturnRecords = (records);\n}",
"function query_callback(entities, fn) {\n for (let entity of entities) {\n fn([entity.a, entity.b]);\n }\n}",
"function doQuery(args, internCallback) {\r\n var sql = args[0],\r\n params = args[1],\r\n cb = args[2] || null;\r\n\r\n if (!Array.isArray(params)) {\r\n cb = params;\r\n params = [];\r\n }\r\n\r\n mySqlWorm.query(sql, params, function(err, rows) {\r\n if (err) {\r\n cb(err);\r\n } else {\r\n internCallback(rows, cb);\r\n }\r\n });\r\n }",
"function getTodos(callbackFn) {\n return dbPool.query('SELECT id, entry FROM todo_items', callbackFn)\n}",
"getItemData(id, _callback) {\n db.transaction(\n txn => {\n txn.executeSql(\"select id, name, description, price, photo, address from images where is_active=1 AND id=? order by id desc\", [id], (tx, res) => {\n if(_callback){\n _callback(res);\n }\n });\n }\n );\n }",
"static all(callback)\n { const sql = \"SELECT * FROM User ORDER BY Type\"\n db.all(sql, [], (err, rows) => {\n if (err)\n return console.error(err.message);\n callback(rows);\n });\n }",
"function callBackSucesso(deferido) {\n return function (tx, results) {\n //se tiver resultados organiza os dados \n if (results) {\n var len = results.rows.length, i;\n var resultados = [];\n for (i = 0; i < len; i++) {\n var user = {\n id: results.rows.item(i).user_id,\n name: results.rows.item(i).user_name,\n nick: results.rows.item(i).user_nick\n }\n resultados.push(user);\n// console.log(results.rows.item(i));\n }\n deferido.resolve(resultados);\n }\n }\n }",
"static consultarClientes(callback) {\n //Armamos la consulta segn los parametros que necesitemos\n let query = 'SELECT * ';\n query += 'FROM '+table.name+';'; \n //Verificamos la conexion\n if(sql){\n sql.query(query, (err, result) => {\n if(err){\n throw err;\n }else{ \n let clientes = [];\n for(let entity of result){\n let cliente = Cliente.mapFactory(entity); \n clientes.push(cliente);\n } \n console.log(clientes); \n callback(null,clientes);\n }\n })\n }else{\n throw \"Problema conectado con Mysql\";\n } \n }",
"static getOrderItemsProducts(orderId) {\n return db.execute(\n `SELECT orderitems.*, products.* FROM orderitems\n JOIN products ON products.id = orderitems.productId\n WHERE orderitems.orderId = ?`, [orderId]\n )\n .then(([result, metaData]) => {\n return result;\n })\n .catch(err => console.log(err));\n }",
"selectAll(cb) {\n orm.selectAll('burgers', (res) => cb(res));\n }",
"static async getApplications(){\n let appQuery = `SELECT A.*, B.ID AS JOBID, B.ACTIVE FROM APPLICATIONS AS A \n INNER JOIN JOBOFFERS AS B ON A.JOBID=B.ID WHERE ACTIVE=1`;\n try{\n let client = await pool.connect();\n let result = await client.query(appQuery);\n client.release();\n return result.rows;\n } catch(err){\n console.log(err);\n }\n }",
"_addJoins(query, listAdapter, where, tableAlias) {\n // Insert joins to handle 1:1 relationships where the FK is stored on the other table.\n // We join against the other table and select its ID as the path name, so that it appears\n // as if it existed on the primary table all along!\n\n const joinPaths = Object.keys(where).filter(\n path => !this._getQueryConditionByPath(listAdapter, path)\n );\n \n const joinedPaths = [];\n listAdapter.fieldAdapters\n .filter(a => a.isRelationship && a.rel.cardinality === '1:1' && a.rel.right === a.field)\n .forEach(({ path, rel }) => {\n \n const { tableName, columnName } = rel;\n const otherTableAlias = `${tableAlias}__${path}`;\n if (!this._tableAliases[otherTableAlias]) {\n this._tableAliases[otherTableAlias] = true;\n // LEFT OUTERJOIN on ... table>.<id> = <otherTable>.<columnName> SELECT <othertable>.<id> as <path> \n query.leftOuterJoin(\n `${tableName} as ${otherTableAlias}`,\n `${otherTableAlias}.${columnName}`,\n `${tableAlias}.id`\n );\n\n if(this._selectNames[path] !== true) { \n query.select(`${otherTableAlias}.id as ${path}`);\n this._selectNames[path] = true; \n } else {\n query.select(`${otherTableAlias}.id as ${path}_${++this._selectNamesCount}`);\n }\n \n joinedPaths.push(path);\n }\n });\n \n for (let path of joinPaths) {\n if (path === 'AND' || path === 'OR') {\n // AND/OR we need to traverse their children \n where[path].forEach(x => this._addJoins(query, listAdapter, x, tableAlias));\n } else {\n \n const otherAdapter = listAdapter.fieldAdaptersByPath[path];\n // If no adapter is found, it must be a query of the form `foo_some`, `foo_every`, etc.\n // These correspond to many-relationships, which are handled separately\n if (otherAdapter && !joinedPaths.includes(path)) {\n // We need a join of the form:\n // ... LEFT OUTER JOIN {otherList} AS t1 ON {tableAlias}.{path} = t1.id\n // Each table has a unique path to the root table via foreign keys\n // This is used to give each table join a unique alias\n // E.g., t0__fk1__fk2\n const otherList = otherAdapter.refListKey;\n const otherListAdapter = listAdapter.getListAdapterByKey(otherList);\n const otherTableAlias = `${tableAlias}__${path}`;\n if (!this._tableAliases[otherTableAlias]) {\n this._tableAliases[otherTableAlias] = true;\n query.leftOuterJoin(\n `${otherListAdapter.tableName} as ${otherTableAlias}`,\n `${otherTableAlias}.id`,\n `${tableAlias}.${path}`\n );\n }\n \n this._addJoins(query, otherListAdapter, where[path], otherTableAlias);\n }\n }\n }\n }",
"function selectAllRows(table, orderBy, callback) {\r\n const sql = `SELECT * FROM ${table} ${orderBy};`;\r\n const query = db.query(sql, (err, rows) => {\r\n if (err) {\r\n console.log(err);\r\n callback(err, INTERNAL_SERVER_ERROR, INTERNAL_ERROR_MSG, null);\r\n }\r\n else {\r\n callback(null, OK, null, rows);\r\n }\r\n });\r\n}",
"static consultarCliente(id, callback) {\n //Armamos la consulta segn los parametros que necesitemos\n let query = 'SELECT * ';\n query += 'FROM '+table.name+' ';\n query += 'WHERE '+table.fields.id+'='+id+';'; \n //Verificamos la conexion\n if(sql){\n sql.query(query, (err, result) => {\n if(err){\n throw err;\n }else{ \n let cliente = Cliente.mapFactory(result[0]); \n console.log(cliente); \n callback(null,cliente);\n }\n })\n }else{\n throw \"Problema conectado con Mysql en consultarCliente\";\n } \n }"
]
| [
"0.58848023",
"0.57687473",
"0.5705418",
"0.5487354",
"0.5480866",
"0.54615325",
"0.54339117",
"0.5423955",
"0.53772235",
"0.5350298",
"0.53425974",
"0.5338893",
"0.5319425",
"0.5319411",
"0.5313796",
"0.5313753",
"0.5251842",
"0.5248762",
"0.5232248",
"0.5194783",
"0.51748645",
"0.51718354",
"0.517122",
"0.5164794",
"0.5161887",
"0.5156618",
"0.5147867",
"0.51471025",
"0.5133983",
"0.5128056"
]
| 0.5788549 | 1 |
FROM, SELECT, WHERE, JOIN, ORDERBY, CALLBACK | static findInnerJoinWhereOrder(from, select, where, join, orderby, callback) {
findInnerJoin(from, where, select, join, orderby, callback);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"queryAll(callback) {\r\n var self = this;\r\n this.table.findAll(this.select)\r\n .then(function (data) {\r\n self.data = data;\r\n callback(self);\r\n },\r\n function (err) {\r\n localData = { error: err };\r\n callback(self);\r\n });\r\n }",
"function getRecords(res, mysql, context, id, pass, complete)\n{\n mysql.pool.query(\"SELECT * FROM records r INNER JOIN user u ON r.user = u.id WHERE u.user_name=? and u.user_password=?\", [id, pass], function(error, results, fields) {\n if (error) {\n console.log(JSON.stringify(error));\n return;\n }\n context.records=results;\n //console.log(context.records);\n complete();\n });\n}",
"static findWhereOrder(from, select, where, orderby, callback) {\n find(from, where, select, orderby, callback);\n }",
"function onGetAllSuccess_GetResponseFromDatabaseWhereClause(records){\n isSuccess = true;\n ReturnRecords = (records);\n}",
"get(cb,args = {}){\n\t\tvar argDef = {\n\t\t\tid:[\"int\",false],\n\t\t\temail:[\"varchar\",false]\n\t\t};\n\t\tvar byID = args.id ? 'and person.id = @id' : '';\n\t\tvar byEmail = args.email ? 'and person.email = @email' : '';\n\t\tvar queryText = `\n\t\t\tselect top 3\n\t\t\tperson.*,\n\t\t\tstuff(\n\t\t\t\t(\n\t\t\t\t\tselect ',' + cast(instrument.id as varchar(10))\n\t\t\t\t\tfrom instrument\n\t\t\t\t\tinner join person_instrument on person_instrument.instrument_id = instrument.id\n\t\t\t\t\t\tand person_instrument.active = 1\n\t\t\t\t\t\tand person_instrument.person_id = person.id\n\t\t\t\t\t\twhere instrument.active = 1\n\t\t\t\t\t\torder by instrument.id asc\n\t\t\t\t\t\tfor xml path('')\n\t\t\t\t)\n\t\t\t,1,1,'') as instrument_ids\n\t\t\tfrom person\n\t\t\twhere person.active = 1\n\n\t\t\t${byID}\n\t\t\t${byEmail}\n\t\t`;\n\n\t\tthis.query(cb,queryText,args,argDef);\n\t}",
"static findInnerJoinOrder(from, select, join, orderby, callback) {\n findInnerJoin(from, {}, select, join, orderby, callback);\n }",
"function doQuery(args, internCallback) {\r\n var sql = args[0],\r\n params = args[1],\r\n cb = args[2] || null;\r\n\r\n if (!Array.isArray(params)) {\r\n cb = params;\r\n params = [];\r\n }\r\n\r\n mySqlWorm.query(sql, params, function(err, rows) {\r\n if (err) {\r\n cb(err);\r\n } else {\r\n internCallback(rows, cb);\r\n }\r\n });\r\n }",
"static findOrder(from, select, orderby, callback) {\n find(from, {}, select, orderby, callback);\n }",
"lista(callback) {\n this._db.query('select * from resposta', function(err, recordset) {\n callback(err, recordset);\n });\n }",
"load(callback) {\n const selectTodoItems = \"SELECT * FROM todo_items\";\n this.dbConnection.query(selectTodoItems, function (err, results, fields) {\n if (err) {\n callback(err);\n return;\n }\n\n callback(null, results);\n });\n }",
"static findLeftJoinWhereOrder(from, select, where, join, orderby, callback) {\n findLeftJoin(from, where, select, join, orderby, callback);\n }",
"static findOneWhereOrder(from, select, where, orderBy, callback) {\n findOne(from, where, select, orderBy, callback);\n }",
"function ______MA_Query() {}",
"function fetchEntryItems(){\n\n var d = $.Deferred();\n\n db.transaction(function (tx) {\n\n tx.executeSql('SELECT * FROM entries ORDER BY sortIndex ASC', [], function (tx, results) {\n var len = results.rows.length, i, items;\n\n items = [];\n\n for (i = 0; i < len; i++) {\n items.push(results.rows.item(i));\n }\n\n d.resolve(items);\n },\n function (tx, error) {\n console.log(\"Query Error: \" + error.message);\n d.reject();\n });\n\n });\n\n return d;\n }",
"function fetchResultsTable(_x,_x2,_x3){return _fetchResultsTable.apply(this,arguments);}",
"static consultarCliente(id, callback) {\n //Armamos la consulta segn los parametros que necesitemos\n let query = 'SELECT * ';\n query += 'FROM '+table.name+' ';\n query += 'WHERE '+table.fields.id+'='+id+';'; \n //Verificamos la conexion\n if(sql){\n sql.query(query, (err, result) => {\n if(err){\n throw err;\n }else{ \n let cliente = Cliente.mapFactory(result[0]); \n console.log(cliente); \n callback(null,cliente);\n }\n })\n }else{\n throw \"Problema conectado con Mysql en consultarCliente\";\n } \n }",
"getEventTickets(event_id: number, callback) {\n super.query(\n 'SELECT tt.name, tt.description, et.price, et.amount FROM ticket_type tt LEFT JOIN event_ticket et ON et.ticket_type_id = tt.ticket_type_id WHERE et.event_id = ?',\n [event_id],\n callback,\n );\n }",
"function selectQuery(select_str, from_str, where_str, callback) {\n $.post(\n selectScript,\n {\n SELECT: select_str,\n FROM: from_str,\n WHERE: where_str\n },\n function (data, status) {\n callback(data);\n }\n );\n}",
"static findInnerJoin(from, select, join, callback) {\n findInnerJoin(from, {}, select, join, {}, callback);\n }",
"function query_callback(entities, fn) {\n for (let entity of entities) {\n fn([entity.a, entity.b]);\n }\n}",
"function doJoin (query, scope, h) {\r\n//\tconsole.log('doJoin', arguments);\r\n//\tconsole.log(query.sources.length);\r\n\t// Check, if this is a last join?\r\n\tif(h>=query.sources.length) {\r\n//console.log(query.wherefns);\r\n\t\t// Then apply where and select\r\n//\t\tconsole.log(query);\r\n\t\tif(query.wherefn(scope,query.params, alasql)) {\r\n\r\n//\t\t\tconsole.log(\"scope\",scope.schools);\r\n\r\n//\t\t\tvar res = query.selectfn(scope, query.params, alasql);\r\n//\t\t\tconsole.log(\"last\",res);\r\n\t\t\t// If there is a GROUP BY then pipe to groupping function\r\n\t\t\tif(query.groupfn) {\r\n\t\t\t\tquery.groupfn(scope, query.params, alasql)\r\n\t\t\t} else {\r\n//\t\t\t\tquery.qwerty = 999;\r\n//console.log(query.qwerty, query.queriesfn && query.queriesfn.length,2);\r\n\t\t\t\tquery.data.push(query.selectfn(scope, query.params, alasql));\r\n\t\t\t}\t\r\n\t\t}\r\n\t} else if(query.sources[h].applyselect) {\r\n//\t\tconsole.log('APPLY',scope);\r\n//\t\t\tconsole.log('scope1',scope);\r\n//\t\t\t\tconsole.log(scope);\r\n\t\tvar source = query.sources[h];\r\n\t\tsource.applyselect(query.params, function(data){\r\n\t\t\tif(data.length > 0) {\r\n\t//\t\t\tconsole.log('APPLY CB');\r\n\t\t\t\tfor(var i=0;i<data.length;i++) {\r\n\t\t\t\t\tscope[source.alias] = data[i];\r\n\t\t\t\t\tdoJoin(query, scope, h+1);\r\n\t\t\t\t};\t\t\t\r\n\t\t\t} else {\r\n//\t\t\t\tconsole.log(source.applymode);\r\n\t\t\t\tif (source.applymode == 'OUTER') {\r\n\t\t\t\t\tscope[source.alias] = {};\r\n\t\t\t\t\tdoJoin(query, scope, h+1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},scope);\r\n\r\n//\t\tconsole.log(data);\r\n\t} else {\r\n\r\n// STEP 1\r\n\r\n\t\tvar source = query.sources[h];\r\n\t\tvar nextsource = query.sources[h+1];\r\n\r\n//\t\tif(source.joinmode == \"LEFT\" || source.joinmode == \"INNER\" || source.joinmode == \"RIGHT\"\r\n//\t\t\t|| source.joinmode == \"OUTER\" || source.joinmode == \"SEMI\") {\r\n\t\tif(true) {//source.joinmode != \"ANTI\") {\r\n\r\n\t\t\t// if(nextsource && nextsource.joinmode == \"RIGHT\") {\r\n\t\t\t// \tif(!nextsource.rightdata) {\r\n\t\t\t// \t\tconsole.log(\"ok\");\r\n\t\t\t// \t\tnextsource.rightdata = new Array(nextsource.data.length);\r\n\t\t\t// \t\tconsole.log(nextsource.data.length, nextsource.rightdata);\r\n\t\t\t// \t}\r\n\t\t\t// }\r\n\r\n\t\t\tvar tableid = source.alias || source.tableid; \r\n\t\t\tvar pass = false; // For LEFT JOIN\r\n\t\t\tvar data = source.data;\r\n\t\t\tvar opt = false;\r\n\r\n\t\t\t// Reduce data for looping if there is optimization hint\r\n\t\t\tif(!source.getfn || (source.getfn && !source.dontcache)) {\r\n\t\t\t\tif(source.joinmode != \"RIGHT\" && source.joinmode != \"OUTER\" && source.joinmode != \"ANTI\" && source.optimization == 'ix') {\r\n\t\t\t\t\tdata = source.ix[ source.onleftfn(scope, query.params, alasql) ] || [];\r\n\t\t\t\t\topt = true;\r\n//\t\t\t\t\tconsole.log(source.onleftfns);\r\n//\t\t\t\t\tconsole.log(source.ix);\r\n//\tconsole.log(source.onleftfn(scope, query.params, alasql));\r\n//\t\t\t\t\tconsole.log(opt, data, data.length);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Main cycle\r\n\t\t\tvar i = 0;\r\n\t\t\tif(typeof data == 'undefined') {\r\n\t\t\t\tthrow new Error('Data source number '+h+' in undefined')\r\n\t\t\t}\r\n\t\t\tvar ilen=data.length;\r\n\t\t\tvar dataw;\r\n//\t\t\tconsole.log(h,opt,source.data,i,source.dontcache);\r\n\t\t\twhile((dataw = data[i]) || (!opt && (source.getfn && (dataw = source.getfn(i)))) || (i<ilen) ) {\r\n\t\t\t\tif(!opt && source.getfn && !source.dontcache) data[i] = dataw;\r\n//console.log(h, i, dataw);\r\n\t\t\t\tscope[tableid] = dataw;\r\n\t\t\t\t// Reduce with ON and USING clause\r\n\t\t\t\tif(!source.onleftfn || (source.onleftfn(scope, query.params, alasql) == source.onrightfn(scope, query.params, alasql))) {\r\n\t\t\t\t\t// For all non-standard JOINs like a-b=0\r\n\t\t\t\t\tif(source.onmiddlefn(scope, query.params, alasql)) {\r\n\t\t\t\t\t\t// Recursively call new join\r\n//\t\t\t\t\t\tif(source.joinmode == \"LEFT\" || source.joinmode == \"INNER\" || source.joinmode == \"OUTER\" || source.joinmode == \"RIGHT\" ) {\r\n\t\t\t\t\t\tif(source.joinmode != \"SEMI\" && source.joinmode != \"ANTI\") { \r\n//\t\t\t\t\t\t\tconsole.log(scope);\r\n\t\t\t\t\t\t\tdoJoin(query, scope, h+1);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// if(source.data[i].f = 200) debugger;\r\n\r\n//\t\t\t\t\t\tif(source.joinmode == \"RIGHT\" || source.joinmode == \"ANTI\" || source.joinmode == \"OUTER\") {\r\n\t\t\t\t\t\tif(source.joinmode != \"LEFT\" && source.joinmode != \"INNER\") {\r\n\t\t\t\t\t\t\tdataw._rightjoin = true;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// for LEFT JOIN\r\n\t\t\t\t\t\tpass = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\ti++;\r\n\t\t\t};\r\n\r\n\r\n\t\t\t// Additional join for LEFT JOINS\r\n\t\t\tif((source.joinmode == 'LEFT' || source.joinmode == 'OUTER' || source.joinmode == 'SEMI' ) && !pass) {\r\n\t\t\t// Clear the scope after the loop\r\n\t\t\t\tscope[tableid] = {};\r\n\t\t\t\tdoJoin(query,scope,h+1);\r\n\t\t\t}\t\r\n\r\n\r\n\t\t}\r\n\r\n\t\t// When there is no records\r\n//\t\tif(data.length == 0 && query.groupfn) {\r\n//\t\t\tscope[tableid] = undefined;\r\n//\t\t\tdoJoin(query,scope,h+1);\r\n//\t\t}\r\n\r\n// STEP 2\r\n\r\n\t\tif(h+1 < query.sources.length) {\r\n\r\n\t\t\tif(nextsource.joinmode == \"OUTER\" || nextsource.joinmode == \"RIGHT\" \r\n\t\t\t\t|| nextsource.joinmode == \"ANTI\") {\r\n\r\n\r\n\t\t\t\tscope[source.alias] = {};\r\n\t\t\t\r\n\t\t\t\tvar j = 0;\r\n\t\t\t\tvar jlen = nextsource.data.length;\r\n\t\t\t\tvar dataw;\r\n\r\n\t\t\t\twhile((dataw = nextsource.data[j]) || (nextsource.getfn && (dataw = nextsource.getfn(j))) || (j<jlen)) {\r\n\t\t\t\t\tif(nextsource.getfn && !nextsource.dontcache) nextsource.data[j] = dataw;\r\n\r\n\t\t\t\t\tif(!dataw._rightjoin) {\r\n\t\t\t\t\t\tscope[nextsource.alias] = dataw;\r\n\t\t\t\t\t\tdoJoin(query, scope, h+2);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t//dataw._rightjoin = undefined;\t\r\n\t\t\t\t\t\tdelete dataw._rightjoin;\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tj++;\r\n\t\t\t\t}\r\n//\t\t\t\tconsole.table(nextsource.data);\r\n//\t\t\t\tdebugger;\t\r\n\r\n\t\t\t};\r\n\t\t};\r\n\r\n\r\n\t\tscope[tableid] = undefined;\r\n\r\n/*\r\n\t\tif(h+1 < query.sources.length) {\r\n\t\t\tvar nextsource = query.sources[h+1];\r\n\r\n\t\t\tif(nextsource.joinmode == \"OUTER\" || nextsource.joinmode == \"RIGHT\" \r\n\t\t\t\t|| nextsource.joinmode == \"ANTI\") {\r\n\r\n\r\n\t\t\t\tconsole.log(h,query.sources.length);\r\n\t\t\t\t// Swap\r\n\r\n\r\n//\t\t\t\tswapSources(query,h);\r\n\r\n//\t\t\t\tconsole.log(query.sources);\r\n\t\t\t\t//debugger;\r\n//\t\t\t\tvar source = query.sources[h];\r\n\r\n//\t\t\t\tvar tableid = source.alias || source.tableid; \r\n//\t\t\t\tvar data = source.data;\r\n\r\n\t\t\t\t// Reduce data for looping if there is optimization hint\r\n//\t\t\t\tif(source.optimization == 'ix') {\r\n//\t\t\t\t\tdata = source.ix[ source.onleftfn(scope, query.params, alasql) ] || [];\r\n//\t\t\t\t}\r\n\r\n\t\t\t\t// Main cycle\r\n\t\t\t\tvar pass = false;\r\n//\t\t\t\tconsole.log(tableid, data.length);\r\n\t\t\t\tfor(var i=0, ilen=nextsource.data.length; i<ilen; i++) {\r\n\t\t\t\t\tscope[nextsource.tableid] = nextsource.data[i];\r\n\t\t\t\t\t// Reduce with ON and USING clause\r\n\t\t\t\t\tif(!source.onleftfn || (source.onleftfn(scope, query.params, alasql) == source.onrightfn(scope, query.params, alasql))) {\r\n\t\t\t\t\t\t// For all non-standard JOINs like a-b=0\r\n\t\t\t\t\t\tif(source.onmiddlefn(scope, query.params, alasql)) {\r\n\t\t\t\t\t\t\t// Recursively call new join\r\n//\t\t\t\t\t\t\tif(source.joinmode == \"OUTER\") {\r\n\t\t\t\t\t\t\t\tdoJoin(query, scope, h+2);\r\n//\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// for LEFT JOIN\r\n\t\t\t\t\t\t\tpass = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t\tif(!pass) {\r\n\t\t\t\t\t// Clear the scope after the loop\r\n//\t\t\t\t\t\tscope[tableid] = {};\r\n\t\t\t\t\t\tconsole.log(scope);\r\n\t\t\t\t\t\tdoJoin(query,scope,h+2);\r\n\t\t\t\t\t}\t\r\n\t\t\t\t};\r\n\r\n\t\t\t\t// Additional join for LEFT JOINS\r\n\t\t\t\t\tscope[query.sources[h+1].tableid] = {};\r\n\t\t\t\t\tconsole.log(scope);\r\n\r\n\t\t\t\tscope[tableid] = undefined;\r\n\r\n\t\t\t\t// SWAP BACK\r\n\t\t\t\tswapSources(query,h);\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n*/\r\n\t}\r\n\r\n}",
"function callBackSucesso(deferido) {\n return function (tx, results) {\n //se tiver resultados organiza os dados \n if (results) {\n var len = results.rows.length, i;\n var resultados = [];\n for (i = 0; i < len; i++) {\n var user = {\n id: results.rows.item(i).user_id,\n name: results.rows.item(i).user_name,\n nick: results.rows.item(i).user_nick\n }\n resultados.push(user);\n// console.log(results.rows.item(i));\n }\n deferido.resolve(resultados);\n }\n }\n }",
"function getTodos(callbackFn) {\n return dbPool.query('SELECT id, entry FROM todo_items', callbackFn)\n}",
"static all(callback)\n { const sql = \"SELECT * FROM User ORDER BY Type\"\n db.all(sql, [], (err, rows) => {\n if (err)\n return console.error(err.message);\n callback(rows);\n });\n }",
"function _select(sql, args, resultHandle){\r\n\tmyjdbc.exequery(sql, args, function(err, result){\r\n\t\tif(err){\r\n\t\t\tconsole.log(err.toString().red);\r\n\t\t\tresultHandle(null);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tresultHandle(result);\r\n\t});\r\n}",
"static consultarClientes(callback) {\n //Armamos la consulta segn los parametros que necesitemos\n let query = 'SELECT * ';\n query += 'FROM '+table.name+';'; \n //Verificamos la conexion\n if(sql){\n sql.query(query, (err, result) => {\n if(err){\n throw err;\n }else{ \n let clientes = [];\n for(let entity of result){\n let cliente = Cliente.mapFactory(entity); \n clientes.push(cliente);\n } \n console.log(clientes); \n callback(null,clientes);\n }\n })\n }else{\n throw \"Problema conectado con Mysql\";\n } \n }",
"function makeSelect(table, condition, cb) {\n querySelect(\"select * from \" + table + ((condition != \"\") ? (\" where \" + condition) : \"\") + \";\", (res) => {\n cb(res);\n });\n}",
"function LQuery() {}",
"function LQuery() {}",
"function LQuery() {}"
]
| [
"0.60357344",
"0.57442415",
"0.5700293",
"0.5689771",
"0.5654416",
"0.56365913",
"0.55299103",
"0.5524143",
"0.54805267",
"0.5469346",
"0.5459586",
"0.5427421",
"0.5328001",
"0.53189456",
"0.5310093",
"0.53100014",
"0.52856827",
"0.5280557",
"0.52684355",
"0.52655685",
"0.5256601",
"0.525298",
"0.52294123",
"0.5219814",
"0.51988393",
"0.519612",
"0.5185543",
"0.5184972",
"0.5184972",
"0.5184972"
]
| 0.57911855 | 1 |
FIND LEFT JOIN // FROM, SELECT, JOIN, CALLBACK | static findLeftJoin(from, select, join, callback) {
findLeftJoin(from, {}, select, join, {}, callback);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static findLeftJoinWhere(from, select, where, join, callback) {\n findLeftJoin(from, where, select, join, {}, callback);\n }",
"static findLeftJoinOrder(from, select, join, orderby, callback) {\n findLeftJoin(from, {}, select, join, orderby, callback);\n }",
"static findLeftJoinWhereOrder(from, select, where, join, orderby, callback) {\n findLeftJoin(from, where, select, join, orderby, callback);\n }",
"function doJoin (query, scope, h) {\n\n\t// Check, if this is a last join?\n\tif(h>=query.sources.length) { // Todo: check if this runs once too many\n\n\t\t// Then apply where and select\n\n\t\tif(query.wherefn(scope,query.params, alasql)) {\n\n\t\t\t// If there is a GROUP BY then pipe to groupping function\n\t\t\tif(query.groupfn) {\n\t\t\t\tquery.groupfn(scope, query.params, alasql)\n\t\t\t} else {\n\n\t\t\t\tquery.data.push(query.selectfn(scope, query.params, alasql));\n\t\t\t}\t\n\t\t}\n\t} else if(query.sources[h].applyselect) {\n\n\t\tvar source = query.sources[h];\n\t\tsource.applyselect(query.params, function(data){\n\t\t\tif(data.length > 0) {\n\n\t\t\t\tfor(var i=0;i<data.length;i++) {\n\t\t\t\t\tscope[source.alias] = data[i];\n\t\t\t\t\tdoJoin(query, scope, h+1);\n\t\t\t\t};\t\t\t\n\t\t\t} else {\n\t\t\t\tif (source.applymode == 'OUTER') {\n\t\t\t\t\tscope[source.alias] = {};\n\t\t\t\t\tdoJoin(query, scope, h+1);\n\t\t\t\t}\n\t\t\t}\n\t\t},scope);\n\n\t} else {\n\n// STEP 1\n\n\t\tvar source = query.sources[h];\n\t\tvar nextsource = query.sources[h+1];\n\n\t\t// Todo: check if this is smart\n\t\tif(true) {//source.joinmode != \"ANTI\") {\n\n\t\t\tvar tableid = source.alias || source.tableid; \n\t\t\tvar pass = false; // For LEFT JOIN\n\t\t\tvar data = source.data;\n\t\t\tvar opt = false;\n\n\t\t\t// Reduce data for looping if there is optimization hint\n\t\t\tif(!source.getfn || (source.getfn && !source.dontcache)) {\n\t\t\t\tif(source.joinmode != \"RIGHT\" && source.joinmode != \"OUTER\" && source.joinmode != \"ANTI\" && source.optimization == 'ix') {\n\t\t\t\t\tdata = source.ix[ source.onleftfn(scope, query.params, alasql) ] || [];\n\t\t\t\t\topt = true;\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Main cycle\n\t\t\tvar i = 0;\n\t\t\tif(typeof data == 'undefined') {\n\t\t\t\tthrow new Error('Data source number '+h+' in undefined')\n\t\t\t}\n\t\t\tvar ilen=data.length;\n\t\t\tvar dataw;\n\n\t\t\twhile((dataw = data[i]) || (!opt && (source.getfn && (dataw = source.getfn(i)))) || (i<ilen) ) {\n\t\t\t\tif(!opt && source.getfn && !source.dontcache) data[i] = dataw;\n\n\t\t\t\tscope[tableid] = dataw;\n\t\t\t\t// Reduce with ON and USING clause\n\t\t\t\tif(!source.onleftfn || (source.onleftfn(scope, query.params, alasql) == source.onrightfn(scope, query.params, alasql))) {\n\t\t\t\t\t// For all non-standard JOINs like a-b=0\n\t\t\t\t\tif(source.onmiddlefn(scope, query.params, alasql)) {\n\t\t\t\t\t\t// Recursively call new join\n\n\t\t\t\t\t\tif(source.joinmode != \"SEMI\" && source.joinmode != \"ANTI\") { \n\n\t\t\t\t\t\t\tdoJoin(query, scope, h+1);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// if(source.data[i].f = 200) debugger;\n\n\t\t\t\t\t\tif(source.joinmode != \"LEFT\" && source.joinmode != \"INNER\") {\n\t\t\t\t\t\t\tdataw._rightjoin = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// for LEFT JOIN\n\t\t\t\t\t\tpass = true;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\ti++;\n\t\t\t};\n\n\t\t\t// Additional join for LEFT JOINS\n\t\t\tif((source.joinmode == 'LEFT' || source.joinmode == 'OUTER' || source.joinmode == 'SEMI' ) && !pass) {\n\t\t\t// Clear the scope after the loop\n\t\t\t\tscope[tableid] = {};\n\t\t\t\tdoJoin(query,scope,h+1);\n\t\t\t}\t\n\n\t\t}\n\n\t\t// When there is no records\n\n// STEP 2\n\n\t\tif(h+1 < query.sources.length) {\n\n\t\t\tif(nextsource.joinmode == \"OUTER\" || nextsource.joinmode == \"RIGHT\" \n\t\t\t\t|| nextsource.joinmode == \"ANTI\") {\n\n\t\t\t\tscope[source.alias] = {};\n\n\t\t\t\tvar j = 0;\n\t\t\t\tvar jlen = nextsource.data.length;\n\t\t\t\tvar dataw;\n\n\t\t\t\twhile((dataw = nextsource.data[j]) || (nextsource.getfn && (dataw = nextsource.getfn(j))) || (j<jlen)) {\n\t\t\t\t\tif(nextsource.getfn && !nextsource.dontcache) {\n\t\t\t\t\t\tnextsource.data[j] = dataw;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(dataw._rightjoin) {\n\t\t\t\t\t\tdelete dataw._rightjoin;\t\t\t\t\t\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif(h==0) {\n\t\t\t\t\t\t\tscope[nextsource.alias] = dataw;\n\t\t\t\t\t\t\tdoJoin(query, scope, h+2);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t//scope[nextsource.alias] = dataw;\n\t\t\t\t\t\t\t//doJoin(query, scope, h+2);\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tj++;\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t};\n\t\t} else {\n\n\t\t};\n\n\t\tscope[tableid] = undefined;\n\n\t}\n\n}",
"_addJoins(query, listAdapter, where, tableAlias) {\n // Insert joins to handle 1:1 relationships where the FK is stored on the other table.\n // We join against the other table and select its ID as the path name, so that it appears\n // as if it existed on the primary table all along!\n\n const joinPaths = Object.keys(where).filter(\n path => !this._getQueryConditionByPath(listAdapter, path)\n );\n \n const joinedPaths = [];\n listAdapter.fieldAdapters\n .filter(a => a.isRelationship && a.rel.cardinality === '1:1' && a.rel.right === a.field)\n .forEach(({ path, rel }) => {\n \n const { tableName, columnName } = rel;\n const otherTableAlias = `${tableAlias}__${path}`;\n if (!this._tableAliases[otherTableAlias]) {\n this._tableAliases[otherTableAlias] = true;\n // LEFT OUTERJOIN on ... table>.<id> = <otherTable>.<columnName> SELECT <othertable>.<id> as <path> \n query.leftOuterJoin(\n `${tableName} as ${otherTableAlias}`,\n `${otherTableAlias}.${columnName}`,\n `${tableAlias}.id`\n );\n\n if(this._selectNames[path] !== true) { \n query.select(`${otherTableAlias}.id as ${path}`);\n this._selectNames[path] = true; \n } else {\n query.select(`${otherTableAlias}.id as ${path}_${++this._selectNamesCount}`);\n }\n \n joinedPaths.push(path);\n }\n });\n \n for (let path of joinPaths) {\n if (path === 'AND' || path === 'OR') {\n // AND/OR we need to traverse their children \n where[path].forEach(x => this._addJoins(query, listAdapter, x, tableAlias));\n } else {\n \n const otherAdapter = listAdapter.fieldAdaptersByPath[path];\n // If no adapter is found, it must be a query of the form `foo_some`, `foo_every`, etc.\n // These correspond to many-relationships, which are handled separately\n if (otherAdapter && !joinedPaths.includes(path)) {\n // We need a join of the form:\n // ... LEFT OUTER JOIN {otherList} AS t1 ON {tableAlias}.{path} = t1.id\n // Each table has a unique path to the root table via foreign keys\n // This is used to give each table join a unique alias\n // E.g., t0__fk1__fk2\n const otherList = otherAdapter.refListKey;\n const otherListAdapter = listAdapter.getListAdapterByKey(otherList);\n const otherTableAlias = `${tableAlias}__${path}`;\n if (!this._tableAliases[otherTableAlias]) {\n this._tableAliases[otherTableAlias] = true;\n query.leftOuterJoin(\n `${otherListAdapter.tableName} as ${otherTableAlias}`,\n `${otherTableAlias}.id`,\n `${tableAlias}.${path}`\n );\n }\n \n this._addJoins(query, otherListAdapter, where[path], otherTableAlias);\n }\n }\n }\n }",
"static findInnerJoin(from, select, join, callback) {\n findInnerJoin(from, {}, select, join, {}, callback);\n }",
"function DTLJ (bd, datos, res) {\n\t//<>Left Join\n\n\tvar tabla=datos.tabla1;\n\tswitch (tabla) {\n\t\tcase \"pup\": tabla=\"per\"; break;\n\t\tcase \"cuc\": tabla=\"cur\"; break;\n\t};\n\n\tconnection.query(\"USE \"+bd);\n\tconsole.log(bd+\" DTLJ() \"+\"Select * From \" + tabla + \" LEFT JOIN \" + datos.tabla2 + \" ON \" + \n\t\ttabla + \".\" + datos.col1 + \"=\" + datos.tabla2 + \".\" + datos.col2 + \n\t\t\" \" + datos.filtro);\n\n\tconnection.query(\"SELECT * FROM \" + \n\t\ttabla + \" LEFT JOIN \" + datos.tabla2 + \" ON \" + \n\t\ttabla + \".\" + datos.col1 + \"=\" + datos.tabla2 + \".\" + datos.col2 + \n\t\t\" \" + datos.filtro,\n\t\tfunction (err, results, fields) {\n\t\t\tif (err) {throw err;} \n\t\t\telse {\n\n\t\t\t\tif (results.length>0) {\n\n\t\t\t\t\tswitch (datos.tabla1) {\n\t\t\t/*P3*/\t\tcase \"rqp\": \n\t \t\t\t\t\tfor(var i=0; i < results.length; i++) {\n\t \t\t\t\t\t\tresults[i].rqp1 = results[i].req1;//Descripción del requisito\n\t \t\t\t\t\t\tresults[i].rqp2 = results[i].req4;//Estado\n\t \t\t\t\t\t\tresults[i].rqp4 = results[i].req0;// Id del requisito en req\n\t \t\t\t\t\t\t// if (results[i].rqp9) {//compruebo que hay link a archivo antes de dar formato <a>\n\t\t\t\t \t\t\t// \tvar nuevoid = \"mLb4-\"+results[i].req0;//Creo el identificador del enlace al archivo. Con \"mL\"+el id.\n\t\t\t\t \t\t\t// \tvar subfilename = results[i].rqp3.substring(0,60);\n\t\t\t\t \t\t\t// \tresults[i].rqp3 = \"<a id='\"+nuevoid+\"' class='doc' href='\"+results[i].req9+\"' target='_blank'>\"+subfilename+\"</a>\";\n\t\t\t\t \t\t\t// } else {results[i].rqp3 = \"\"; results[i].req9 = \"\"};\n\t\t\t\t \t\t\tresults[i].rqp6 = fchSQLaWEB(results[i].rqp6);//Cambio el formato de fecha para que se vea bien en la tabla\n\t\t\t\t \t\t\tresults[i].rqp7 = fchSQLaWEB(results[i].rqp7);\n\t\t\t\t \t\t\tif (results[i].rqp9) {//compruebo que hay link a archivo antes de dar formato <a>\n\t\t\t\t \t\t\t\tvar nuevoid = \"mLb3-\"+results[i].rqp0;//Creo el identificador del enlace al archivo. Con \"mL\"+el id.\n\t\t\t\t \t\t\t\tvar minifilename = results[i].rqp8.substring(0,6);\n\t\t\t\t \t\t\t\tvar subfilename = results[i].rqp8.substring(0,60);\n\t\t\t\t \t\t\t\tresults[i].rqp8 = \"<a id='\"+nuevoid+\"' class='doc' href='\"+results[i].rqp9+\"' target='_blank'>\"+subfilename+\"</a>\";\n\t\t\t\t \t\t\t\tresults[i].rqp9 = \"<a id='\"+nuevoid+\"' class='doc' href='\"+results[i].rqp9+\"' target='_blank'>\"+minifilename+\"...</a>\";\n\t\t\t\t \t\t\t} else {results[i].rqp8 = \"\"; results[i].rqp9 = \"\"};\n\t\t\t\t \t\t}; break;\n\t\t\t/*P4*/\t\tcase \"cup\": \n\t \t\t\t\t\tfor(var i=0; i < results.length; i++) {\n\t \t\t\t\t\t\tresults[i].cup1 = results[i].per3;\n\t \t\t\t\t\t\tresults[i].cup2 = results[i].per4;\n\t \t\t\t\t\t\tresults[i].cup4 = fchSQLaWEB(results[i].cup4);\n\t \t\t\t\t\t\tif (results[i].cup3) {results[i].cup3 = results[i].cup3} else {results[i].cup3 = \"\"};//Evita que salgan \"null\" en las casillas de texto del formulario.\n\t \t\t\t\t\t\tif (results[i].cup7) {results[i].cup7 = results[i].cup7} else {results[i].cup7 = \"\"};//Evita que salgan \"null\" en las casillas de texto del formulario.\n\t\t\t\t \t\t\tif (results[i].cup6) {//compruebo que hay link a archivo antes de dar formato <a>\n\t\t\t\t \t\t\t\tvar nuevoid = \"mLa1-\"+results[i].cup0;//Creo el identificador del enlace al archivo. Con \"mL\"+el id.\n\t\t\t\t \t\t\t\tvar minifilename = results[i].cup5.substring(0,6);\n\t\t\t\t \t\t\t\tvar subfilename = results[i].cup5.substring(0,60);\n\t\t\t\t \t\t\t\tresults[i].cup5 = \"<a id='\"+nuevoid+\"' class='doc' href='\"+results[i].cup6+\"' target='_blank'>\"+subfilename+\"</a>\";\n\t\t\t\t \t\t\t\tresults[i].cup6 = \"<a id='\"+nuevoid+\"' class='doc' href='\"+results[i].cup6+\"' target='_blank'>\"+minifilename+\"...</a>\";\n\t\t\t\t \t\t\t} else {results[i].cup5 = \"\"; results[i].cup6 = \"\"};\n\t\t\t\t \t\t}; break;\n\t\t\t\t\t\tcase \"per\" || \"pup\": \n\t \t\t\t\t\tfor(var i=0; i < results.length; i++) {\n\t\t\t\t \t\t\tresults[i].per8 = fchSQLaWEB(results[i].per8);//Cambio el formato de fecha para que se vea bien en la tabla\n\t\t\t\t \t\t\tresults[i].per9 = fchSQLaWEB(results[i].per9);\n\t\t\t\t \t\t\tresults[i].per10 = fchSQLaWEB(results[i].per10);\n\t\t\t\t \t\t\tresults[i].pe217 = fchSQLaWEB(results[i].pe217);\n\t\t\t\t \t\t\tif (results[i].pe210) {//compruebo que hay link a archivo antes de dar formato <a>\n\t\t\t\t \t\t\t\tvar nuevoid = \"mLb1-\"+results[i].per0;//Creo el identificador del enlace al archivo. Con \"mL\"+el id.\n\t\t\t\t \t\t\t\tvar subfilename = results[i].pe29.substring(0,60);\n\t\t\t\t \t\t\t\tresults[i].pe29 = \"<a id='\"+nuevoid+\"' class='doc' href='\"+results[i].pe210+\"' target='_blank'>\"+subfilename+\"</a>\";\n\t\t\t\t \t\t\t} else {results[i].pe29 = \"\"; results[i].pe210 = \"\"};\n\t\t\t\t \t\t}; break;\n\t\t\t\t\t\tcase \"cuc\": \n\t \t\t\t\t\tfor(var i=0; i < results.length; i++) {\n\t\t\t\t \t\t\tresults[i].cur3 = results[i].cur6;//Pongo el estado del curso en tercera posición de la tabla.\n\t\t\t\t \t\t\tresults[i].cur2 = fchSQLaWEB(results[i].cur4);\n\t\t\t\t \t\t\tif (results[i].cup6) {//compruebo que hay link a archivo antes de dar formato <a>\n\t\t\t\t \t\t\t\tvar nuevoid = \"mLb1-\"+results[i].cup0;//Creo el identificador del enlace al archivo. Con \"mL\"+el id.\n\t\t\t\t \t\t\t\tvar minifilename = results[i].cup5.substring(0,6);\n\t\t\t\t \t\t\t\tresults[i].cur4 = \"<a id='\"+nuevoid+\"' class='doc' href='\"+results[i].cup6+\"' target='_blank'>\"+minifilename+\"...</a>\";\n\t\t\t\t \t\t\t} else {results[i].cur4 = \"\"; results[i].cup6 = \"\"};\n\t\t\t\t \t\t}; break;\n\t\t\t/*P7*/ \tcase \"mrv\": \n\t \t\t\t\t\tfor(var i=0; i < results.length; i++) {\n\t \t\t\t\t\t\tresults[i].mrv1 = results[i].man3;//Adelanto la descripción del MAN para que aparezca en la tabla\n\t \t\t\t\t\t\tresults[i].mrv6 = fchSQLaWEB(results[i].mrv6);\n\t \t\t\t\t\t\tresults[i].mrv7 = fchSQLaWEB(results[i].mrv7);\n\t\t\t\t \t\t\tif (results[i].mrv9) {//compruebo que hay link a archivo antes de dar formato <a>\n\t\t\t\t \t\t\t\tvar nuevoid = \"mLb2-\"+results[i].mrv0;//Creo el identificador del enlace al archivo. Con \"mL\"+el id.\n\t\t\t\t \t\t\t\tvar subfilename = results[i].mrv8.substring(0,60);\n\t\t\t\t \t\t\t\tresults[i].mrv8 = \"<a id='\"+nuevoid+\"' class='doc' href='\"+results[i].mrv9+\"' target='_blank'>\"+subfilename+\"</a>\";\n\t\t\t\t \t\t\t} else {results[i].mrv8 = \"\"; results[i].mrv9 = \"\"};\n\t\t\t\t \t\t}; break;\n\t\t\t/*P10*/ \tcase \"rec\": \n\t \t\t\t\t\tfor(var i=0; i < results.length; i++) {\n\t \t\t\t\t\t\tresults[i].rec4 = fchSQLaWEB(results[i].rec4);\n\t \t\t\t\t\t\tresults[i].rec6 = fchSQLaWEB(results[i].rec6);\n\t\t\t\t \t\t\tif (results[i].rec12) {//compruebo que hay link a archivo antes de dar formato <a>\n\t\t\t\t \t\t\t\tvar nuevoid = \"mLa1-\"+results[i].rec0;//Creo el identificador del enlace al archivo. Con \"mL\"+el id.\n\t\t\t\t \t\t\t\tvar subfilename = results[i].rec11.substring(0,60);\n\t\t\t\t \t\t\t\tresults[i].rec11 = \"<a id='\"+nuevoid+\"' class='doc' href='\"+results[i].rec12+\"' target='_blank'>\"+subfilename+\"</a>\";\n\t\t\t\t \t\t\t} else {results[i].rec11 = \"\"; results[i].rec12 = \"\"};\n\t\t\t\t \t\t}; break;\n\t\t\t\t \tcase \"enc\": \n\t \t\t\t\t\tfor(var i=0; i < results.length; i++) {\n\t \t\t\t\t\t\tresults[i].enc1 = results[i].cli1;//Adelanto el nombre del cliente para sacarlo en la tabla.\n\t \t\t\t\t\t\tresults[i].enc5 = fchSQLaWEB(results[i].enc5);\n\t \t\t\t\t\t\tresults[i].enc6 = fchSQLaWEB(results[i].enc6);\n\t\t\t\t \t\t\tif (results[i].enc31) {//compruebo que hay link a archivo antes de dar formato <a>\n\t\t\t\t \t\t\t\tvar nuevoid = \"mLb2-\"+results[i].enc0;//Creo el identificador del enlace al archivo. Con \"mL\"+el id.\n\t\t\t\t \t\t\t\tvar subfilename = results[i].enc30.substring(0,60);\n\t\t\t\t \t\t\t\tresults[i].enc30 = \"<a id='\"+nuevoid+\"' class='doc' href='\"+results[i].enc31+\"' target='_blank'>\"+subfilename+\"</a>\";\n\t\t\t\t \t\t\t} else {results[i].enc30 = \"\"; results[i].enc31 = \"\"};\n\t\t\t\t \t\t}; break;\n\n\n\t\t\t\t };\n\n\t\t\t\t\tvar losdatos = pasarJSONaArray(results);//Paso el array de JSONs a una matriz (array de arrays).\n\t\t\t\t\tvar losdatos2= \"{'data':[\"+losdatos+\"]}\";//Completo el string.\n\t\t\t\t\tvar resultsJSON = eval(\"(\"+losdatos2+\")\");//Convierto el string en un JSON.\n\t\t\t\t\t\n\t\t\t\t\tres.json(200, resultsJSON);\n\t\t\t\t\t\t//console.log(bd+\" DTLJ() Devuelve: \" + losdatos);\n\t\t\t\t\t\tconsole.log(bd+\" DTLJ() Devuelto.\");\n\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log(bd+\" DTLJ() 0 resultados\");\n\t\t\t\t\tres.set('Content-Type', 'text/plain');\n\t\t\t\t\tres.send('nosuccess');\t\n\t\t\t\t};\n\t\t\t};\n\t\t});\n}",
"function includeHasManySimple(callback) {\n //Map for Indexing objects by their id for faster retrieval\n var objIdMap2 = includeUtils.buildOneToOneIdentityMapWithOrigKeys(objs, relation.keyFrom);\n\n filter.where[relation.keyTo] = {\n inq: uniq(objIdMap2.getKeys()),\n };\n\n relation.applyScope(null, filter);\n relation.modelTo.find(filter, options, targetFetchHandler);\n\n function targetFetchHandler(err, targets) {\n if (err) {\n return callback(err);\n }\n var targetsIdMap = includeUtils.buildOneToManyIdentityMapWithOrigKeys(targets, relation.keyTo);\n includeUtils.join(objIdMap2, targetsIdMap, function(obj1, valueToMergeIn) {\n defineCachedRelations(obj1);\n obj1.__cachedRelations[relationName] = valueToMergeIn;\n processTargetObj(obj1, function() {});\n });\n callback(err, objs);\n }\n }",
"function doJoin (query, scope, h) {\r\n//\tconsole.log('doJoin', arguments);\r\n//\tconsole.log(query.sources.length);\r\n\t// Check, if this is a last join?\r\n\tif(h>=query.sources.length) {\r\n//console.log(query.wherefns);\r\n\t\t// Then apply where and select\r\n//\t\tconsole.log(query);\r\n\t\tif(query.wherefn(scope,query.params, alasql)) {\r\n\r\n//\t\t\tconsole.log(\"scope\",scope.schools);\r\n\r\n//\t\t\tvar res = query.selectfn(scope, query.params, alasql);\r\n//\t\t\tconsole.log(\"last\",res);\r\n\t\t\t// If there is a GROUP BY then pipe to groupping function\r\n\t\t\tif(query.groupfn) {\r\n\t\t\t\tquery.groupfn(scope, query.params, alasql)\r\n\t\t\t} else {\r\n//\t\t\t\tquery.qwerty = 999;\r\n//console.log(query.qwerty, query.queriesfn && query.queriesfn.length,2);\r\n\t\t\t\tquery.data.push(query.selectfn(scope, query.params, alasql));\r\n\t\t\t}\t\r\n\t\t}\r\n\t} else if(query.sources[h].applyselect) {\r\n//\t\tconsole.log('APPLY',scope);\r\n//\t\t\tconsole.log('scope1',scope);\r\n//\t\t\t\tconsole.log(scope);\r\n\t\tvar source = query.sources[h];\r\n\t\tsource.applyselect(query.params, function(data){\r\n\t\t\tif(data.length > 0) {\r\n\t//\t\t\tconsole.log('APPLY CB');\r\n\t\t\t\tfor(var i=0;i<data.length;i++) {\r\n\t\t\t\t\tscope[source.alias] = data[i];\r\n\t\t\t\t\tdoJoin(query, scope, h+1);\r\n\t\t\t\t};\t\t\t\r\n\t\t\t} else {\r\n//\t\t\t\tconsole.log(source.applymode);\r\n\t\t\t\tif (source.applymode == 'OUTER') {\r\n\t\t\t\t\tscope[source.alias] = {};\r\n\t\t\t\t\tdoJoin(query, scope, h+1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},scope);\r\n\r\n//\t\tconsole.log(data);\r\n\t} else {\r\n\r\n// STEP 1\r\n\r\n\t\tvar source = query.sources[h];\r\n\t\tvar nextsource = query.sources[h+1];\r\n\r\n//\t\tif(source.joinmode == \"LEFT\" || source.joinmode == \"INNER\" || source.joinmode == \"RIGHT\"\r\n//\t\t\t|| source.joinmode == \"OUTER\" || source.joinmode == \"SEMI\") {\r\n\t\tif(true) {//source.joinmode != \"ANTI\") {\r\n\r\n\t\t\t// if(nextsource && nextsource.joinmode == \"RIGHT\") {\r\n\t\t\t// \tif(!nextsource.rightdata) {\r\n\t\t\t// \t\tconsole.log(\"ok\");\r\n\t\t\t// \t\tnextsource.rightdata = new Array(nextsource.data.length);\r\n\t\t\t// \t\tconsole.log(nextsource.data.length, nextsource.rightdata);\r\n\t\t\t// \t}\r\n\t\t\t// }\r\n\r\n\t\t\tvar tableid = source.alias || source.tableid; \r\n\t\t\tvar pass = false; // For LEFT JOIN\r\n\t\t\tvar data = source.data;\r\n\t\t\tvar opt = false;\r\n\r\n\t\t\t// Reduce data for looping if there is optimization hint\r\n\t\t\tif(!source.getfn || (source.getfn && !source.dontcache)) {\r\n\t\t\t\tif(source.joinmode != \"RIGHT\" && source.joinmode != \"OUTER\" && source.joinmode != \"ANTI\" && source.optimization == 'ix') {\r\n\t\t\t\t\tdata = source.ix[ source.onleftfn(scope, query.params, alasql) ] || [];\r\n\t\t\t\t\topt = true;\r\n//\t\t\t\t\tconsole.log(source.onleftfns);\r\n//\t\t\t\t\tconsole.log(source.ix);\r\n//\tconsole.log(source.onleftfn(scope, query.params, alasql));\r\n//\t\t\t\t\tconsole.log(opt, data, data.length);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Main cycle\r\n\t\t\tvar i = 0;\r\n\t\t\tif(typeof data == 'undefined') {\r\n\t\t\t\tthrow new Error('Data source number '+h+' in undefined')\r\n\t\t\t}\r\n\t\t\tvar ilen=data.length;\r\n\t\t\tvar dataw;\r\n//\t\t\tconsole.log(h,opt,source.data,i,source.dontcache);\r\n\t\t\twhile((dataw = data[i]) || (!opt && (source.getfn && (dataw = source.getfn(i)))) || (i<ilen) ) {\r\n\t\t\t\tif(!opt && source.getfn && !source.dontcache) data[i] = dataw;\r\n//console.log(h, i, dataw);\r\n\t\t\t\tscope[tableid] = dataw;\r\n\t\t\t\t// Reduce with ON and USING clause\r\n\t\t\t\tif(!source.onleftfn || (source.onleftfn(scope, query.params, alasql) == source.onrightfn(scope, query.params, alasql))) {\r\n\t\t\t\t\t// For all non-standard JOINs like a-b=0\r\n\t\t\t\t\tif(source.onmiddlefn(scope, query.params, alasql)) {\r\n\t\t\t\t\t\t// Recursively call new join\r\n//\t\t\t\t\t\tif(source.joinmode == \"LEFT\" || source.joinmode == \"INNER\" || source.joinmode == \"OUTER\" || source.joinmode == \"RIGHT\" ) {\r\n\t\t\t\t\t\tif(source.joinmode != \"SEMI\" && source.joinmode != \"ANTI\") { \r\n//\t\t\t\t\t\t\tconsole.log(scope);\r\n\t\t\t\t\t\t\tdoJoin(query, scope, h+1);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// if(source.data[i].f = 200) debugger;\r\n\r\n//\t\t\t\t\t\tif(source.joinmode == \"RIGHT\" || source.joinmode == \"ANTI\" || source.joinmode == \"OUTER\") {\r\n\t\t\t\t\t\tif(source.joinmode != \"LEFT\" && source.joinmode != \"INNER\") {\r\n\t\t\t\t\t\t\tdataw._rightjoin = true;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// for LEFT JOIN\r\n\t\t\t\t\t\tpass = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\ti++;\r\n\t\t\t};\r\n\r\n\r\n\t\t\t// Additional join for LEFT JOINS\r\n\t\t\tif((source.joinmode == 'LEFT' || source.joinmode == 'OUTER' || source.joinmode == 'SEMI' ) && !pass) {\r\n\t\t\t// Clear the scope after the loop\r\n\t\t\t\tscope[tableid] = {};\r\n\t\t\t\tdoJoin(query,scope,h+1);\r\n\t\t\t}\t\r\n\r\n\r\n\t\t}\r\n\r\n\t\t// When there is no records\r\n//\t\tif(data.length == 0 && query.groupfn) {\r\n//\t\t\tscope[tableid] = undefined;\r\n//\t\t\tdoJoin(query,scope,h+1);\r\n//\t\t}\r\n\r\n// STEP 2\r\n\r\n\t\tif(h+1 < query.sources.length) {\r\n\r\n\t\t\tif(nextsource.joinmode == \"OUTER\" || nextsource.joinmode == \"RIGHT\" \r\n\t\t\t\t|| nextsource.joinmode == \"ANTI\") {\r\n\r\n\r\n\t\t\t\tscope[source.alias] = {};\r\n\t\t\t\r\n\t\t\t\tvar j = 0;\r\n\t\t\t\tvar jlen = nextsource.data.length;\r\n\t\t\t\tvar dataw;\r\n\r\n\t\t\t\twhile((dataw = nextsource.data[j]) || (nextsource.getfn && (dataw = nextsource.getfn(j))) || (j<jlen)) {\r\n\t\t\t\t\tif(nextsource.getfn && !nextsource.dontcache) nextsource.data[j] = dataw;\r\n\r\n\t\t\t\t\tif(!dataw._rightjoin) {\r\n\t\t\t\t\t\tscope[nextsource.alias] = dataw;\r\n\t\t\t\t\t\tdoJoin(query, scope, h+2);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t//dataw._rightjoin = undefined;\t\r\n\t\t\t\t\t\tdelete dataw._rightjoin;\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tj++;\r\n\t\t\t\t}\r\n//\t\t\t\tconsole.table(nextsource.data);\r\n//\t\t\t\tdebugger;\t\r\n\r\n\t\t\t};\r\n\t\t};\r\n\r\n\r\n\t\tscope[tableid] = undefined;\r\n\r\n/*\r\n\t\tif(h+1 < query.sources.length) {\r\n\t\t\tvar nextsource = query.sources[h+1];\r\n\r\n\t\t\tif(nextsource.joinmode == \"OUTER\" || nextsource.joinmode == \"RIGHT\" \r\n\t\t\t\t|| nextsource.joinmode == \"ANTI\") {\r\n\r\n\r\n\t\t\t\tconsole.log(h,query.sources.length);\r\n\t\t\t\t// Swap\r\n\r\n\r\n//\t\t\t\tswapSources(query,h);\r\n\r\n//\t\t\t\tconsole.log(query.sources);\r\n\t\t\t\t//debugger;\r\n//\t\t\t\tvar source = query.sources[h];\r\n\r\n//\t\t\t\tvar tableid = source.alias || source.tableid; \r\n//\t\t\t\tvar data = source.data;\r\n\r\n\t\t\t\t// Reduce data for looping if there is optimization hint\r\n//\t\t\t\tif(source.optimization == 'ix') {\r\n//\t\t\t\t\tdata = source.ix[ source.onleftfn(scope, query.params, alasql) ] || [];\r\n//\t\t\t\t}\r\n\r\n\t\t\t\t// Main cycle\r\n\t\t\t\tvar pass = false;\r\n//\t\t\t\tconsole.log(tableid, data.length);\r\n\t\t\t\tfor(var i=0, ilen=nextsource.data.length; i<ilen; i++) {\r\n\t\t\t\t\tscope[nextsource.tableid] = nextsource.data[i];\r\n\t\t\t\t\t// Reduce with ON and USING clause\r\n\t\t\t\t\tif(!source.onleftfn || (source.onleftfn(scope, query.params, alasql) == source.onrightfn(scope, query.params, alasql))) {\r\n\t\t\t\t\t\t// For all non-standard JOINs like a-b=0\r\n\t\t\t\t\t\tif(source.onmiddlefn(scope, query.params, alasql)) {\r\n\t\t\t\t\t\t\t// Recursively call new join\r\n//\t\t\t\t\t\t\tif(source.joinmode == \"OUTER\") {\r\n\t\t\t\t\t\t\t\tdoJoin(query, scope, h+2);\r\n//\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// for LEFT JOIN\r\n\t\t\t\t\t\t\tpass = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t\tif(!pass) {\r\n\t\t\t\t\t// Clear the scope after the loop\r\n//\t\t\t\t\t\tscope[tableid] = {};\r\n\t\t\t\t\t\tconsole.log(scope);\r\n\t\t\t\t\t\tdoJoin(query,scope,h+2);\r\n\t\t\t\t\t}\t\r\n\t\t\t\t};\r\n\r\n\t\t\t\t// Additional join for LEFT JOINS\r\n\t\t\t\t\tscope[query.sources[h+1].tableid] = {};\r\n\t\t\t\t\tconsole.log(scope);\r\n\r\n\t\t\t\tscope[tableid] = undefined;\r\n\r\n\t\t\t\t// SWAP BACK\r\n\t\t\t\tswapSources(query,h);\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n*/\r\n\t}\r\n\r\n}",
"function includeOneToOne(callback) {\n var targetIds = [];\n var objTargetIdMap = {};\n for (var i = 0; i < objs.length; i++) {\n var obj = objs[i];\n if (relation.type === 'belongsTo') {\n if (obj[relation.keyFrom] === null ||\n obj[relation.keyFrom] === undefined) {\n defineCachedRelations(obj);\n obj.__cachedRelations[relationName] = null;\n continue;\n }\n }\n var targetId = obj[relation.keyFrom];\n if (targetId) {\n targetIds.push(targetId);\n var targetIdStr = targetId.toString();\n objTargetIdMap[targetIdStr] = objTargetIdMap[targetIdStr] || [];\n objTargetIdMap[targetIdStr].push(obj);\n }\n defineCachedRelations(obj);\n obj.__cachedRelations[relationName] = null;\n }\n filter.where[relation.keyTo] = {\n inq: uniq(targetIds),\n };\n relation.applyScope(null, filter);\n relation.modelTo.find(filter, options, targetFetchHandler);\n /**\n * Process fetched related objects\n * @param err\n * @param {Array<Model>} targets\n * @returns {*}\n */\n function targetFetchHandler(err, targets) {\n if (err) {\n return callback(err);\n }\n var tasks = [];\n //simultaneously process subIncludes\n if (subInclude && targets) {\n tasks.push(function subIncludesTask(next) {\n relation.modelTo.include(targets, subInclude, options, next);\n });\n }\n //process each target object\n tasks.push(targetLinkingTask);\n function targetLinkingTask(next) {\n async.each(targets, linkOneToMany, next);\n function linkOneToMany(target, next) {\n var targetId = target[relation.keyTo];\n var objList = objTargetIdMap[targetId.toString()];\n async.each(objList, function(obj, next) {\n if (!obj) return next();\n obj.__cachedRelations[relationName] = target;\n processTargetObj(obj, next);\n }, next);\n }\n }\n\n execTasksWithInterLeave(tasks, callback);\n }\n }",
"static findInnerJoinWhere(from, select, where, join, callback) {\n findInnerJoin(from, where, select, join, {}, callback);\n }",
"findByLinkKey(payload, err, success) {\n tables[table].find({\n where: {\n maumasiFyKey: payload.maumasiFyKey,\n },\n include: [{\n all: true,\n nested: true,\n }],\n }).then(success).catch(err);\n\n log(null, __filename,\n 'Model CRUD',\n 'Search by link key');\n }",
"static findInnerJoinOrder(from, select, join, orderby, callback) {\n findInnerJoin(from, {}, select, join, orderby, callback);\n }",
"reduceInRelation(className: string, query: any, schema: any): Promise<any> {\n // Search for an in-relation or equal-to-relation\n // Make it sequential for now, not sure of paralleization side effects\n const promises = [];\n if (query['$or']) {\n const ors = query['$or'];\n promises.push(\n ...ors.map((aQuery, index) => {\n return this.reduceInRelation(className, aQuery, schema).then(aQuery => {\n query['$or'][index] = aQuery;\n });\n })\n );\n }\n if (query['$and']) {\n const ands = query['$and'];\n promises.push(\n ...ands.map((aQuery, index) => {\n return this.reduceInRelation(className, aQuery, schema).then(aQuery => {\n query['$and'][index] = aQuery;\n });\n })\n );\n }\n\n const otherKeys = Object.keys(query).map(key => {\n if (key === '$and' || key === '$or') {\n return;\n }\n const t = schema.getExpectedType(className, key);\n if (!t || t.type !== 'Relation') {\n return Promise.resolve(query);\n }\n let queries: ?(any[]) = null;\n if (\n query[key] &&\n (query[key]['$in'] ||\n query[key]['$ne'] ||\n query[key]['$nin'] ||\n query[key].__type == 'Pointer')\n ) {\n // Build the list of queries\n queries = Object.keys(query[key]).map(constraintKey => {\n let relatedIds;\n let isNegation = false;\n if (constraintKey === 'objectId') {\n relatedIds = [query[key].objectId];\n } else if (constraintKey == '$in') {\n relatedIds = query[key]['$in'].map(r => r.objectId);\n } else if (constraintKey == '$nin') {\n isNegation = true;\n relatedIds = query[key]['$nin'].map(r => r.objectId);\n } else if (constraintKey == '$ne') {\n isNegation = true;\n relatedIds = [query[key]['$ne'].objectId];\n } else {\n return;\n }\n return {\n isNegation,\n relatedIds,\n };\n });\n } else {\n queries = [{ isNegation: false, relatedIds: [] }];\n }\n\n // remove the current queryKey as we don,t need it anymore\n delete query[key];\n // execute each query independently to build the list of\n // $in / $nin\n const promises = queries.map(q => {\n if (!q) {\n return Promise.resolve();\n }\n return this.owningIds(className, key, q.relatedIds).then(ids => {\n if (q.isNegation) {\n this.addNotInObjectIdsIds(ids, query);\n } else {\n this.addInObjectIdsIds(ids, query);\n }\n return Promise.resolve();\n });\n });\n\n return Promise.all(promises).then(() => {\n return Promise.resolve();\n });\n });\n\n return Promise.all([...promises, ...otherKeys]).then(() => {\n return Promise.resolve(query);\n });\n }",
"function includePolymorphicHasOne(callback) {\n var sourceIds = [];\n //Map for Indexing objects by their id for faster retrieval\n var objIdMap = {};\n for (var i = 0; i < objs.length; i++) {\n var obj = objs[i];\n // one-to-one: foreign key reference is modelTo -> modelFrom.\n // use modelFrom.keyFrom in where filter later\n var sourceId = obj[relation.keyFrom];\n if (sourceId) {\n sourceIds.push(sourceId);\n objIdMap[sourceId.toString()] = obj;\n }\n // sourceId can be null. but cache empty data as result\n defineCachedRelations(obj);\n obj.__cachedRelations[relationName] = null;\n }\n filter.where[relation.keyTo] = {\n inq: uniq(sourceIds),\n };\n relation.applyScope(null, filter);\n relation.modelTo.find(filter, options, targetFetchHandler);\n /**\n * Process fetched related objects\n * @param err\n * @param {Array<Model>} targets\n * @returns {*}\n */\n function targetFetchHandler(err, targets) {\n if (err) {\n return callback(err);\n }\n var tasks = [];\n //simultaneously process subIncludes\n if (subInclude && targets) {\n tasks.push(function subIncludesTask(next) {\n relation.modelTo.include(targets, subInclude, options, next);\n });\n }\n //process each target object\n tasks.push(targetLinkingTask);\n function targetLinkingTask(next) {\n async.each(targets, linkOneToOne, next);\n function linkOneToOne(target, next) {\n var sourceId = target[relation.keyTo];\n if (!sourceId) return next();\n var obj = objIdMap[sourceId.toString()];\n if (!obj) return next();\n obj.__cachedRelations[relationName] = target;\n processTargetObj(obj, next);\n }\n }\n\n execTasksWithInterLeave(tasks, callback);\n }\n }",
"_addWheres(whereJoiner, listAdapter, where, tableAlias) {\n for (let path of Object.keys(where)) {\n const condition = this._getQueryConditionByPath(listAdapter, path, tableAlias);\n if (condition) {\n whereJoiner(condition(where[path]));\n } else if (path === 'AND' || path === 'OR') {\n whereJoiner(q => {\n // AND/OR need to traverse both side of the query\n let subJoiner;\n if (path == 'AND') {\n q.whereRaw('true');\n subJoiner = w => q.andWhere(w);\n } else {\n q.whereRaw('false');\n subJoiner = w => q.orWhere(w);\n }\n where[path].forEach(subWhere =>\n this._addWheres(subJoiner, listAdapter, subWhere, tableAlias)\n );\n });\n } else {\n // We have a relationship field\n let fieldAdapter = listAdapter.fieldAdaptersByPath[path];\n if (fieldAdapter) {\n // Non-many relationship. Traverse the sub-query, using the referenced list as a root.\n const otherListAdapter = listAdapter.getListAdapterByKey(fieldAdapter.refListKey);\n this._addWheres(whereJoiner, otherListAdapter, where[path], `${tableAlias}__${path}`);\n } else {\n // Many relationship\n const [p, constraintType] = path.split('_');\n fieldAdapter = listAdapter.fieldAdaptersByPath[p];\n const { rel } = fieldAdapter;\n const { cardinality, tableName, columnName } = rel;\n const subBaseTableAlias = this._getNextBaseTableAlias();\n const otherList = fieldAdapter.refListKey;\n const otherListAdapter = listAdapter.getListAdapterByKey(otherList);\n const subQuery = listAdapter._query();\n let otherTableAlias;\n let selectCol;\n if (cardinality === '1:N' || cardinality === 'N:1') {\n otherTableAlias = subBaseTableAlias;\n selectCol = columnName;\n subQuery\n .select(`${subBaseTableAlias}.${selectCol}`)\n .from(`${tableName} as ${subBaseTableAlias}`);\n // We need to filter out nulls before passing back to the top level query\n // otherwise postgres will give very incorrect answers.\n subQuery.whereNotNull(columnName);\n } else {\n const { near, far } = listAdapter._getNearFar(fieldAdapter);\n otherTableAlias = `${subBaseTableAlias}__${p}`;\n selectCol = near;\n subQuery\n .select(`${subBaseTableAlias}.${selectCol}`)\n .from(`${tableName} as ${subBaseTableAlias}`);\n subQuery.innerJoin(\n `${otherListAdapter.tableName} as ${otherTableAlias}`,\n `${otherTableAlias}.id`,\n `${subBaseTableAlias}.${far}`\n );\n }\n \n this._addJoins(subQuery, otherListAdapter, where[path], otherTableAlias);\n\n // some: the ID is in the examples found\n // none: the ID is not in the examples found\n // every: the ID is not in the counterexamples found\n // FIXME: This works in a general and logical way, but doesn't always generate the queries that PG can best optimise\n // 'some' queries would more efficient as inner joins\n\n if (constraintType === 'every') {\n subQuery.whereNot(q => {\n q.whereRaw('true');\n this._addWheres(w => q.andWhere(w), otherListAdapter, where[path], otherTableAlias);\n });\n } else {\n subQuery.whereRaw('true');\n this._addWheres(\n w => subQuery.andWhere(w),\n otherListAdapter,\n where[path],\n otherTableAlias\n );\n }\n\n // Ensure there therwhereIn/whereNotIn query is run against\n // a table with exactly one column.\n const subSubQuery = listAdapter.parentAdapter.knex\n .select(selectCol)\n .from(subQuery.as('unused_alias'));\n if (constraintType === 'some') {\n whereJoiner(q => q.whereIn(`${tableAlias}.id`, subSubQuery));\n } else {\n whereJoiner(q => q.whereNotIn(`${tableAlias}.id`, subSubQuery));\n }\n }\n }\n }\n }",
"getAllEmployeeByManager(){\n connection.query(\"select employee.manager_id, employee.first_name, employee.last_name from department RIGHT JOIN role ON role.department_id LEFT JOIN employee ON employee.id\", function(err, res) {\n if (err) throw err;\n \n // Log all results of the SELECT statement\n console.table(res);\n connection.end();\n });\n }",
"static findInnerJoinWhereOrder(from, select, where, join, orderby, callback) {\n findInnerJoin(from, where, select, join, orderby, callback);\n }",
"function extractFirstRow (mapFn, defaultResult = {}) {\n return neoData => {\n const allRows = extractAllRows(mapFn)(neoData);\n\n return allRows.length ? allRows[0] : defaultResult;\n };\n}",
"function equijoinWithDefault(xs, ys, primary, foreign, sel, def) {\n const iy = ys.reduce((iy, row) => iy.set(row[foreign], row), new Map);\n return xs.map(row => typeof iy.get(row[primary]) !== 'undefined' ? sel(row, iy.get(row[primary])): sel(row, def));\n}",
"useJoinsUnsafe(...arr) {\n return QueryUtil.useJoins(this, arr);\n }",
"function findFrom(q) {\n\t\t\t\t\tif(typeof q === 'object') {\n\t\t\t\t\t\tif(q.type === 'select') {\n\t\t\t\t\t\t\tif(!q.from) q.from = {};\n\t\t\t\t\t\t\tvar id = '_outer_tuple';\n\t\t\t\t\t\t\twhile(q.from[id]) id = '_'+id;\n\t\t\t\t\t\t\tvar f = new singleTuple({}, schema);\n\t\t\t\t\t\t\tq.from[id] = f;\n\t\t\t\t\t\t\tfroms.push(f);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor(var i in q) {\n\t\t\t\t\t\t\t// find all from clauses\n\t\t\t\t\t\t\tfindFrom(q[i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}",
"joinProducts() {\n this.query\n .select(\n `${this.table}.id as id`,\n `${this.table}.name as recipe_name`,\n 'products.name as product_name'\n )\n .leftJoin('product_recipes', `${this.table}.id`, 'product_recipes.recipe_id')\n .leftJoin('products', 'product_recipes.product_id', 'products.id');\n\n return this;\n }",
"function findPreceding(i, data0, data1, key) {\n\t\t var m = data0.length;\n\t\t while (--i >= 0) {\n\t\t var k = key(data1[i]);\n\t\t for (var j = 0; j < m; ++j) {\n\t\t if (key(data0[j]) === k) return data0[j];\n\t\t }\n\t\t }\n\t\t}",
"findAllEmployeesByManager(managerId) {\n return this.connection.query(\n \"SELECT employee.id, employee.first_name, employee.last_name, department.name AS department, role.title FROM employee LEFT JOIN role on role.id = employee.role_id LEFT JOIN department ON department.id = role.department_id WHERE manager_id = ?;\",\n managerId\n );\n}",
"function joinClause( arr ) {\n\tvar ret = \" \";\n\tfor( var i=0; i < arr.length; i++ ) {\n\t\t// TODO: join clause is hard coded\n\t\tif( arr[i].criteria ) {\n\t\t\t// we always give table alias to support multiple joins of same table\n\t\t\tret += \"join \" + arr[i].table + \" on \" + arr[i].criteria + \" \";\n\t\t}\n\t\telse {\n\t\t\tret += \"join \" + arr[i].table + \" on fk_parentid = parent.id \";\n\t\t}\n\t}\n\treturn ret;\n}",
"function first(table,args) {\n let select = _.remove(args.select,'count');\n return from(where(orderBy(limit(db,args),table,args),args),table).first(_.map(select,_.snakeCase));\n}",
"function findPreceding(i, data0, data1, key) {\n var m = data0.length;\n while (--i >= 0) {\n var k = key(data1[i]);\n for (var j = 0; j < m; ++j) {\n if (key(data0[j]) === k) return data0[j];\n }\n }\n }",
"getEntity(entityId) {\n entityId = this.esc(entityId) // escape entityId\n // INSIGHT: select specific columns, otherwise it'll replace from the joined table\n // aka, stop selecting *, making it specific\n var sql = [`SELECT entity.*, post.content, photo.photo, user.username FROM\n entity\n LEFT JOIN post ON post.entityId = entity.entityId\n LEFT JOIN photo ON photo.entityId = entity.entityId\n LEFT JOIN user ON user.userId = entity.userId\n WHERE entity.entityId = '${entityId}' LIMIT 1`, // only one post after all\n `SELECT entity_tag.* FROM entity_tag\n WHERE entity_tag.entityId = '${entityId}'`,\n `SELECT COUNT(*) AS likes FROM entity_like\n WHERE entity_like.entityId = '${entityId}'`,\n `SELECT entity_comment.userId, entity_comment.content, user.username FROM\n entity_comment\n JOIN user ON user.userId = entity_comment.userId\n WHERE entity_comment.entityId = '${entityId}'`\n ];\n\n var hook = {};\n return Promise.all(sql.map(sql_code => {\n return this.query(sql_code);\n }))\n .then(rows => {\n // rows[0] = entity + post/photo\n // rows[1] = tags\n // rows[2] = likes\n // rows[3] = comments\n\n hook = rows[0][0];\n hook.tags = rows[1].map(tag => {\n return tag.tagName;\n });\n hook.likes = rows[2][0].likes;\n hook.comments = rows[3];\n\n var users = [hook.userId]; //make array of all the userId's we'd like the name of\n users.push(hook.comments.map(comment => {\n return comment.userId;\n }));\n\n return hook;\n });\n }",
"function employeeSearch() {\n\n connection.query(\"SELECT employee.id, employee.last_name, employee.first_name, role.title, name AS department, role.salary, CONCAT(manager.first_name, ' ', manager.last_name) AS manager FROM employee LEFT JOIN role on employee.role_id = role.id LEFT JOIN department on role.department_id = department.id LEFT JOIN employee manager on manager.id = employee.manager_id;\",\n\n function (err, res) {\n if (err) throw err\n console.table(res)\n beginTracker()\n }\n )\n}"
]
| [
"0.7722422",
"0.71773404",
"0.7132845",
"0.5753619",
"0.57143575",
"0.5251691",
"0.5065213",
"0.49813566",
"0.49480498",
"0.48615816",
"0.47994074",
"0.47624263",
"0.47337973",
"0.46875355",
"0.4653055",
"0.46352357",
"0.46176502",
"0.4595695",
"0.45810297",
"0.45780098",
"0.45712516",
"0.45694652",
"0.45680866",
"0.456614",
"0.45650497",
"0.45364",
"0.4535721",
"0.45253018",
"0.45169482",
"0.45077372"
]
| 0.7944322 | 0 |
UPDATE // TABLE, UPDATES, WHERE, CALLBACK | static update(table, updates, query, callback) {
if (table.length === 0 || updates.length === 0 || query.length === 0) {
return;
}
let options = [table];
let sql = 'UPDATE ?? SET ';
let sets = [];
for (let key in updates) {
if (updates.hasOwnProperty(key) && typeof updates[key] !== 'undefined') {
sets.push(' ?? = ?');
options.push(key, updates[key]);
}
}
sql += sets.join(',');
if (Object.keys(query).length > 0) {
sql += ' WHERE';
}
let wheres = [];
for (let key in query) {
if (query.hasOwnProperty(key) && typeof query[key] !== 'undefined') {
wheres.push('?? = ? ');
options.push(key, query[key]);
}
}
sql += wheres.join('AND ');
return con.query(sql, options, (err,rows) => {
if(err || rows.length > 0) {
callback(err, null);
} else {
callback(null, rows);
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateData(sqlQuery, obj, callback){\r\n console.log(\"\\nSQL Query::\"+sqlQuery);\r\n connMgr.getConn(function (connection) {\r\n connection.query(sqlQuery, obj, function(err,res){\r\n if(err) throw err;\r\n if(callback)callback();\r\n console.log('Changed ' + res.changedRows + ' rows');\r\n });\r\n });\r\n}",
"queryUpdateHook() { }",
"updateOne(table,objColVals, condition, cb){\n let query = `UPDATE ${table}`;\n query += ` SET ${objToSql(objColVals)}`;\n query += ` WHERE ${condition}`\n\n connection.query(query,(err,result) =>{\n if(err) throw err;\n cb(result);\n });\n }",
"static update(table_name, attributes, where, response, cb) {\n\t\ttable_name\n\t\t\t.findOne({\n\t\t\t\twhere\n\t\t\t})\n\t\t\t.then((found) => {\n\t\t\t\tif (found !== null) {\n\t\t\t\t\ttable_name\n\t\t\t\t\t\t.update(attributes, {\n\t\t\t\t\t\t\twhere: {\n\t\t\t\t\t\t\t\tid: found.id\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.then((updated) => {\n\t\t\t\t\t\t\tif (updated[0]) {\n\t\t\t\t\t\t\t\tif (typeof cb === 'function') {\n\t\t\t\t\t\t\t\t\tcb({\n\t\t\t\t\t\t\t\t\t\tcode: 200,\n\t\t\t\t\t\t\t\t\t\ttitle: 'Success',\n\t\t\t\t\t\t\t\t\t\tmessage: 'Data is updated',\n\t\t\t\t\t\t\t\t\t\ttype: 'success',\n\t\t\t\t\t\t\t\t\t\tdata: updated\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\tresponse.status(200).json({\n\t\t\t\t\t\t\t\t\t\tcode: 200,\n\t\t\t\t\t\t\t\t\t\ttitle: 'Success',\n\t\t\t\t\t\t\t\t\t\tmessage: 'Data is updated',\n\t\t\t\t\t\t\t\t\t\ttype: 'success',\n\t\t\t\t\t\t\t\t\t\tdata: updated\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (typeof cb === 'function') {\n\t\t\t\t\t\t\t\t\tcb({\n\t\t\t\t\t\t\t\t\t\tcode: 400,\n\t\t\t\t\t\t\t\t\t\ttitle: 'Warning',\n\t\t\t\t\t\t\t\t\t\tmessage: 'Unable to update',\n\t\t\t\t\t\t\t\t\t\ttype: 'warning',\n\t\t\t\t\t\t\t\t\t\tdata: []\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\tresponse.status(200).json({\n\t\t\t\t\t\t\t\t\t\tcode: 400,\n\t\t\t\t\t\t\t\t\t\ttitle: 'Warning',\n\t\t\t\t\t\t\t\t\t\tmessage: 'Unable to update',\n\t\t\t\t\t\t\t\t\t\ttype: 'warning',\n\t\t\t\t\t\t\t\t\t\tdata: []\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\t\tif (typeof cb === 'function') {\n\t\t\t\t\t\t\t\tcb({\n\t\t\t\t\t\t\t\t\tcode: 400,\n\t\t\t\t\t\t\t\t\ttitle: 'Failed',\n\t\t\t\t\t\t\t\t\tmessage: error.message,\n\t\t\t\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\t\t\t\ttrace: {\n\t\t\t\t\t\t\t\t\t\taddress: 'update : Function model.update()',\n\t\t\t\t\t\t\t\t\t\terror: JSON.stringify(error)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tresponse.status(400).json({\n\t\t\t\t\t\t\t\t\tcode: 400,\n\t\t\t\t\t\t\t\t\ttitle: 'Failed',\n\t\t\t\t\t\t\t\t\tmessage: error.message,\n\t\t\t\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\t\t\t\ttrace: {\n\t\t\t\t\t\t\t\t\t\taddress: 'update : Function model.update()',\n\t\t\t\t\t\t\t\t\t\terror: JSON.stringify(error)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof cb === 'function') {\n\t\t\t\t\t\tcb({\n\t\t\t\t\t\t\tcode: 404,\n\t\t\t\t\t\t\ttitle: 'Warning',\n\t\t\t\t\t\t\tmessage: 'Data not found',\n\t\t\t\t\t\t\ttype: 'warning',\n\t\t\t\t\t\t\tdata: []\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresponse.status(200).json({\n\t\t\t\t\t\t\tcode: 404,\n\t\t\t\t\t\t\ttitle: 'Warning',\n\t\t\t\t\t\t\tmessage: 'Data not found',\n\t\t\t\t\t\t\ttype: 'warning',\n\t\t\t\t\t\t\tdata: []\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\t.catch((error) => {\n\t\t\t\tif (typeof cb === 'function') {\n\t\t\t\t\tcb({\n\t\t\t\t\t\tcode: 400,\n\t\t\t\t\t\ttitle: 'Failed',\n\t\t\t\t\t\tmessage: error.message,\n\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\ttrace: {\n\t\t\t\t\t\t\taddress: 'update : Function model.findOne()',\n\t\t\t\t\t\t\terror: JSON.stringify(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tresponse.status(400).json({\n\t\t\t\t\t\tcode: 400,\n\t\t\t\t\t\ttitle: 'Failed',\n\t\t\t\t\t\tmessage: error.message,\n\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\ttrace: {\n\t\t\t\t\t\t\taddress: 'update : Function model.findOne()',\n\t\t\t\t\t\t\terror: JSON.stringify(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t}",
"function makeUpdate(param, newValue, condition, cb) {\n queryUpdate(\"update items set \" + param + \" = \" + newValue + \" where \" + condition + \";\", (res) => {\n cb(res);\n });\n}",
"updateReport(query, update) {\n\n }",
"function db_updateHandler()\n{\n\tvar callback = function(){alert(\"1234567\");};\n\tvar metersUpdated=false, readingsUpdated=false, usersUpdated=false, callbackDone=false;\n\tvar isSuccess = true;\n\n//\tfunction trigger(callback, metersUpdated, readingsUpdated, usersUpdated, callbackDone)\n\tthis.trigger=function()\n\t{\n\t\t//if(callback && !callbackDone && metersUpdated && readingsUpdated && usersUpdated)\n\t\tif(callback && !callbackDone && metersUpdated && readingsUpdated)\n\t\t{\n\t\t\tcallbackDone = true;\n\t\t\tcallback(isSuccess);\n\t\t}\n\t};\n\t\n\tthis.reset = function(_callback)\n\t{\n\t\tcallback=_callback; \n\t\tcallbackDone =false; \n\t\tmetersUpdated=false; \n\t\treadingsUpdated=false; \n\t\tusersUpdated=false;\n\t};\n\t\n\tthis.meters = function(_isSuccess) \n\t{\n\t\tmetersUpdated=true; \n\t\tif(_isSuccess==false)\n\t\t\tisSuccess &= _isSuccess;\n\t\t\t\n\t\t//trigger(callback, metersUpdated, readingsUpdated, usersUpdated, callbackDone);\n\t\tthis.trigger();\n\t};\n\n\tthis.readings = function(_isSuccess) \n\t{\n\t\treadingsUpdated=true; \n\t\tif(_isSuccess==false)\n\t\t\tisSuccess &= _isSuccess;\n\t\t//trigger(callback, metersUpdated, readingsUpdated, usersUpdated, callbackDone);\n\t\tthis.trigger();\n\t};\n\t\n\tthis.users = function(_isSuccess) \n\t{\n\t\tusersUpdated=true; \n\t\tif(_isSuccess==false)\n\t\t\tisSuccess &= _isSuccess;\n\t\t//trigger(callback, metersUpdated, readingsUpdated, usersUpdated, callbackDone);\n\t\tthis.trigger();\n\t};\n}",
"update(){}",
"update(){}",
"update(){}",
"updateData(id, data, userID, _callback) {\n db.transaction(\n tx => {\n tx.executeSql('update images set photo = ?, name = ?, description = ?, price = ?, address = ? where id = ?', [data[0], data[1], data[2], data[3], data[4], id], () => {\n this.insertIntoLog(userID, \"edit data : \" + data[1] + '[' + id + ']');\n if(_callback){\n _callback();\n }\n });\n }\n );\n }",
"updateQuery(queryId, oldText, newText, callback) {}",
"function getTableUpdate() {\n\n}",
"function queryUpdate(sql, cb) {\n con.query(sql, (err, res) => {\n cb((!err) ? 1 : 0);\n });\n}",
"function update(id, payload) {\n return new Promise((resolve, reject) => {\n const sql = `UPDATE [user] SET name = @name, birthday = @birthday, email = @email, gender = @gender, country = @country WHERE id = @id`;\n const request = new Request(sql, (err, rowcount) => {\n console.log('rowcount', rowcount);\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 updated.!' })\n }\n });\n\n request.addParameter(\"id\", TYPES.Int, id);\n request.addParameter(\"name\", TYPES.VarChar, payload.name);\n request.addParameter(\"birthday\", TYPES.Date, payload.birthday);\n request.addParameter(\"email\", TYPES.VarChar, payload.email);\n request.addParameter(\"gender\", TYPES.VarChar, payload.gender);\n request.addParameter(\"country\", TYPES.VarChar, payload.country);\n\n request.on(\"done\", (row) => {\n console.log(\"User Updated\", row);\n // resolve(\"user Updated\", row);\n });\n\n request.on(\"doneProc\", function (rowCount, more, returnStatus, rows) {\n console.log('Row Count' + rowCount);\n console.log('More? ' + more);\n console.log('Return Status: ' + returnStatus);\n console.log('Rows:' + rows);\n });\n\n connection.execSql(request);\n });\n}",
"function UpdateOrderItemsHasPaidFlag(items_id, orders_id, hasPaid){\n let sql_query = mysql.format(\"UPDATE ordered_items SET has_paid = ? WHERE orders_id = ? && items_id = ?\", [hasPaid, orders_id, items_id]);\n con.query(sql_query, function(err,result,fields){\n if (err) return false;\n console.log(result);\n return true;\n });\n //main();\n}",
"function updateTable( jsonData, successCallback ) {\n var dataType;\n if ( !jsonData ) {\n throw \"MobileDb.updateTable: Required parameter jsonData is null or undefined\";\n }\n if ( !db ) {\n throw \"MobileDb.updateTable: Database instance is not open. Call openDB() before calling this method.\";\n }\n\n var count = jsonData['total'];\n dataType = JSONData.getDataTypeFromJSONFeedData( jsonData );\n debug && console.log( \"MobileDb.updateTable: JSON datatype = \" + dataType + \", update count = \" + count );\n\n // Use default callbacks if callback params are undefined\n if ( !successCallback ) {\n successCallback = function() {\n debug && console.log( \"MobileDb.updateTable: \" + dataType + \" table update successful\" );\n };\n }\n var index = 0;\n var insertSql = \"\";\n var sqlUpdateBatch = [];\n if ( count > 0 ) {\n // Add DELETE statements for each object inside the jsonData\n debug && console.log( \"MobileDb.updateTable: Adding DELETE statements to SQL batch\" );\n for ( index = 0; index < count; index++ ) {\n sqlUpdateBatch.push( SQL_DELETE_ROW_BY_WEBID.replace( \"tableName\", dataType ) +\n jsonData[dataType][index].webId );\n }\n // Add INSERT statements for each object inside the jsonData\n debug && console.log( \"MobileDb.updateTable: Adding INSERT statements to SQL batch\" );\n _.each( jsonData[dataType], function( jsonInList ) {\n insertSql = getInsertSql( dataType, jsonInList );\n if ( insertSql ) {\n sqlUpdateBatch.push( insertSql );\n }\n });\n // Execute the SQL batch\n debug && console.log( \"MobileDb.updateTable: Executing batch to update table \" + dataType );\n executeSqlBatch( sqlUpdateBatch,\n // Success callback\n function() {\n debug && console.log( \"MobileDb.updateTable: SQL update batch successful\" );\n // Update complete, call the success callback\n successCallback();\n },\n // Error callback\n function( err1, err2 ) {\n console.error( \"MobileDb.updateTable: SQL update batch failed\" );\n defaultErrorCallbackFn( err1, err2 );\n // Update complete, call the success callback\n successCallback();\n }\n );\n } else {\n // Call success callback immediately if there is nothing to update\n successCallback();\n }\n }",
"function UpdateTotalInMeter(connection,data,item,amount,callback) {\n\n var sql = '';\n var insert;\n var updated = new Date();\n\n CheckOnlineMeters(connection,data,function(err,results) {\n\n if (err) {\n connection.close();\n connection = null; \n return callback(err,null);\n } else {\n\n if(results > 0) {\n //update\n insert = false;\n sql = 'update db_LTDMeters set meterAmount = meterAmount + @amount,updated = @date where unitId = @unitid and unitPropId = @propid ' +\n 'and itemId = @item';\n } else {\n //insert\n insert = true;\n sql = 'insert into db_LTDMeters(unitId,unitPropId,itemId,meterAmount,updated,denom,operatorId)values(@unitid,@propid,' +\n '@amount,@date,@oper)';\n }\n\n var request = new Request(sql,function(err,rowCount) {\n if(err) {\n errMsg = 'UpdateTotalInMeter error: ' + err;\n sql = null;\n request = null;\n delete updated;\n return callback(errMsg,null) ;\n } else {\n sql = null;\n request = null;\n delete updated;\n rowCount = null;\n return callback(null,'ok');\n }\n }); \n\n if (insert) {\n\n request.addParameter('oper', TYPES.Int,data.operatorid); \n request.addParameter('denom', TYPES.Int,data.denom); \n }\n request.addParameter('unitid', TYPES.Int,data.unit);\n request.addParameter('propid', TYPES.Int,data.propid);\n request.addParameter('item', TYPES.NVarChar,item);\n request.addParameter('amount', TYPES.Int, amount);\n request.addParameter('date', TYPES.DateTime,updated);\n\n connection.execSql(request);\n }\n\n\n });\n\n}",
"function update_1_row(req, res, next) {\n 'use strict';\n\tvar __FUNCTION__ = \"update_1_row\";\n\tvar table_name = req.params.table_name;\n\tvar stmt_saved;\n\tvar valid_table = check_table_name ( table_name );\n\tif ( valid_table.error ) {\n\t\treturn next(valid_table.error);\n\t}\n\tvar v = validate_data( 'update', table_name, req.params );\n\tif ( ! v.ok ) {\n \treturn next(new restify.MissingParameterError(\"Missing or invalid data;\"+v.msg));\t\t\n\t}\n\n\tvar crud_info = gen_crud_info ( {}, 'update', table_name, req.params, __FUNCTION__, __FILE__, 420 );\n\tif ( crud_info.error ) {\n\t\treturn next(crud_info.error);\n\t}\n\tdn.runQuery ( stmt_saved = ts0( 'update %{log_comment%} %{table_name%} set %{update_set%} %{update_pk_where%}', crud_info ), function ( err, query ) {\n\t\tif ( $debug$.showQuery ) {\n\t\t\tconsole.log ( \"Query is:\\nFile: \"+ \".1.views.m4.js\" +\" Function:\"+ __FUNCTION__ + \" Line: \"+ 426 + \" \" + stmt_saved + \"\\n\\n\" );\n\t\t}\n\t\t//if ( query && typeof query.count !== \"undefined\" && query.count === 0 ) {\n\t\t//\tdebug_2(\".1.views.m4.js\",__FUNCTION__,429,\"No Rows Updated; trying insert -- debuging check\");\n\t\t//}\n\t\tif ( err ) {\n\t\t\tdebug_2(\".1.views.m4.js\",__FUNCTION__,432,\"typeof(err)==\"+typeof(err));\n\t\t\tsend_result ( res, next, null, { \"status\":\"error\", \"msg\":\"invalid query\", \"raw\": JSON.stringify(err), \"query\":stmt_saved } );\n\t\t} else {\n\t\t\t//if ( query.count === 0 ) {\n\t\t\t\t// Xyzzy - use regular insert since we are checking query.count???\n\t\t\t\tdebug_2(\".1.views.m4.js\",__FUNCTION__,437,\"No Rows Updated; trying insert\");\n\t\t\t\tdn.runQuery ( stmt_saved = ts0( 'insert into %{table_name%} ( %{insert_col_names%} ) select %{insert_col_no_s%} '+\n\t\t\t\t\t'where not exists ( select 1 from %{table_name%} %{update_pk_where%} ) ', crud_info ), function ( err2, query2 ) {\n\t\t\t\t\tif ( err2 ) {\n\t\t\t\t\t\tsend_result ( res, next, null, { \"status\":\"error\", \"msg\":\"invalid query\", \"raw\": JSON.stringify(err2), \"query\":stmt_saved } );\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tdebug_2(\".1.views.m4.js\",__FUNCTION__,444,\"insert occured.\");\n\t\t\t\t\t\t\tres.send({\"status\":\"ok\"}); \n\t\t\t\t\t\t\treturn next();\n\t\t\t\t\t\t} catch ( err ) {\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t//} else {\n\t\t\t//\ttry {\n\t\t\t//\t\tdebug_2(\".1.views.m4.js\",__FUNCTION__,453,\"insert occured.\");\n\t\t\t//\t\tres.send({\"status\":\"ok\"}); \n\t\t\t//\t\treturn next();\n\t\t\t//\t} catch ( err ) {\n\t\t\t//\t}\n\t\t\t//}\n\t\t}\n\t});\n}",
"function updateData(modSql, modSqlParams){\n connection.query('UPDATE ' + modSql, modSqlParams,function (err, result) {\n if(err){\n console.log('[UPDATE ERROR] - ',err.message);\n return;\n } \n console.log('--------------------------UPDATE----------------------------');\n console.log('UPDATE affectedRows',result.affectedRows);\n console.log('------------------------------------------------------------');\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}",
"function syncingCallback (tableBeingUpdated, callback) {\n var callCount = 0;\n var lengthOfTable = Object.keys(tableBeingUpdated).length;\n\n var callbackForUser = function() {\n if (++callCount == lengthOfTable) {\n callback();\n }\n }\n\n return callback ? callbackForUser : undefined;\n}",
"function updatedb_sql(){\n\n}",
"update(id, data, params) {}",
"function SetPendingTransToComplete( data, callback) {\n\n var conenction;\n var sql = '';\n var updated = new Date();\n\n dbConnect.GetDbConnection(data.operatorid,function(err,results) {\n\n if (err) {\n errMsg = 'GetDbConnection error: ' + err;\n return callback(err,null);\n } else {\n \n connection = results;\n sql = 'update db_unitTrans set transStatus = @transstatus, updated = @date where unitId = @unitid and ' +\n 'unitPropId = @propid and transNumber = @transnumber';\n\n\n var request = new Request(sql,function(err,rowCount) {\n \n \n if (err) {\n errMsg = 'SetPendingTransToComplete error: ' + err;\n connection.close();\n connection = null;\n sql = null;\n request = null;\n delete updated;\n return callback(errMsg,null);\n \n } else{\n connection.close();\n connection = null;\n sql = null;\n request = null;\n delete updated;\n rowCount = null;\n return callback(null,'ok');\n \n }\n\n\n });\n\n\n request.addParameter('transstatus', TYPES.Int,data.transstatus);\n request.addParameter('date', TYPES.DateTime,updated);\n request.addParameter('unitid', TYPES.Int,data.unit);\n request.addParameter('propid', TYPES.Int,data.propid);\n request.addParameter('transnumber', TYPES.Int,data.transnumber);\n \n connection.execSql(request);\n\n }\n }); \n\n\n}",
"function updateSomething(obj1, obj2) {\n console.log(\"Updating employee roles!\");\n connection.query(\"UPDATE employee_role SET ? WHERE ?\", [obj1, obj2], function(\n err,\n res\n ) {\n if (err) throw err;\n });\n connection.query(\"SELECT * FROM employee_role\", function(err, res) {\n if (err) throw err;\n const newTable = table.getTable(res);\n console.log(newTable);\n });\n console.clear();\n initiation();\n}",
"function updatedItem(id) {\n console.log(\"\");\n var query = connection.query(\"SELECT ID, Product_Name , Price, Stock_QTY FROM products WHERE ID = ?;\",[id],function(err, res) {\n if (err) throw err;\n console.log('Your item has been updated. Please see below:');\n console.table(res);\n console.log(\"\");\n managerAsk();\n \n });\n}",
"function updateInv(){\n connection.query(\n \"UPDATE products SET ? WHERE ?\",\n [\n {\n stock_quantity: remainingInv\n },\n {\n item_id: purchId\n }\n ],\n function(err) {\n if (err) throw err;\n //if the update is successful, show the user the ourchase is being processed\n console.log(\"***** Processing order... *****\");\n //call the function that displays the current order\n setTimeout(displayOrder, 1 * 2000); \n }\n );\n}",
"updateToAll() {}",
"function updateInformation(doneUpdateEmployeeRCallback) {\n // Must grab everything from employee table.\n connection.query(\"SELECT * FROM employee\", function (err, res) {\n console.table(res);\n inquirer.prompt(\n [\n { \n name: \"employeeId\",\n type: \"number\",\n message: \"Please input the id of the employee you want to update.\",\n\n },\n {\n name: \"employeeUpdateRole\",\n type: \"number\",\n message: \"Please update employee's role by selecting a new role ID.\",\n },\n\n ]).then((userInput) => {\n connection.query(\"UPDATE employee SET ? WHERE ?\",\n [\n { role_Id: userInput.employeeUpdateRole },\n { id: userInput.employeeId }\n ], function (err, res) {\n // console.log('error:' + err);\n viewEmployee();\n });\n })\n })\n}"
]
| [
"0.692523",
"0.6757804",
"0.66608644",
"0.66053283",
"0.65152186",
"0.6473978",
"0.64712006",
"0.64691204",
"0.64691204",
"0.64691204",
"0.6465907",
"0.643347",
"0.6372709",
"0.6261236",
"0.62578446",
"0.6214459",
"0.6213561",
"0.619379",
"0.61779755",
"0.61732286",
"0.6147865",
"0.6145973",
"0.61450386",
"0.6136101",
"0.6130639",
"0.6080035",
"0.6070371",
"0.603899",
"0.6011017",
"0.60007864"
]
| 0.685313 | 1 |
CREATE UPDATE // TABLE, DATA, CALLBACK | static createUpdate(table, data, callback) {
if (table.length === 0 || data.length === 0) {
return;
}
let options = [table];
let sql = 'INSERT INTO ?? (';
let sets = [];
let setValues = [];
if (!Array.isArray(data)) {
data = [data];
}
let allValueKeys = [];
let allValues = [];
let updatesVals = [];
for (let row of data) {
let values = [];
for (let key in row) {
if (row.hasOwnProperty(key) && typeof row[key] !== 'undefined') {
if (setValues.indexOf(key) === -1) {
sets.push('??');
setValues.push(key);
}
updatesVals.push(key);
values.push('?');
allValues.push(row[key]);
}
}
allValueKeys.push(values);
}
sql += sets.join(', ');
sql += ') VALUES ';
let vals = [];
for (let row of allValueKeys) {
vals.push('(' + row.join(', ') + ')');
}
sql += vals.join(', ');
options = options.concat(setValues);
options = options.concat(allValues);
if (updatesVals.length > 0) {
sql += ' ON DUPLICATE KEY UPDATE ';
let updates = [];
for (let key of updatesVals) {
updates.push('?? = VALUES(??)');
options.push(key, key);
}
sql += updates.join(', ');
}
return con.query(sql, options, (err,rows) => {
if(err || rows.length > 0) {
callback(err, null);
} else {
callback(null, rows);
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"updateData(id, data, userID, _callback) {\n db.transaction(\n tx => {\n tx.executeSql('update images set photo = ?, name = ?, description = ?, price = ?, address = ? where id = ?', [data[0], data[1], data[2], data[3], data[4], id], () => {\n this.insertIntoLog(userID, \"edit data : \" + data[1] + '[' + id + ']');\n if(_callback){\n _callback();\n }\n });\n }\n );\n }",
"function updateData(sqlQuery, obj, callback){\r\n console.log(\"\\nSQL Query::\"+sqlQuery);\r\n connMgr.getConn(function (connection) {\r\n connection.query(sqlQuery, obj, function(err,res){\r\n if(err) throw err;\r\n if(callback)callback();\r\n console.log('Changed ' + res.changedRows + ' rows');\r\n });\r\n });\r\n}",
"function getTableUpdate() {\n\n}",
"update(id, data, params) {}",
"updateReport(query, update) {\n\n }",
"update(){}",
"update(){}",
"update(){}",
"function SetPendingTransToComplete( data, callback) {\n\n var conenction;\n var sql = '';\n var updated = new Date();\n\n dbConnect.GetDbConnection(data.operatorid,function(err,results) {\n\n if (err) {\n errMsg = 'GetDbConnection error: ' + err;\n return callback(err,null);\n } else {\n \n connection = results;\n sql = 'update db_unitTrans set transStatus = @transstatus, updated = @date where unitId = @unitid and ' +\n 'unitPropId = @propid and transNumber = @transnumber';\n\n\n var request = new Request(sql,function(err,rowCount) {\n \n \n if (err) {\n errMsg = 'SetPendingTransToComplete error: ' + err;\n connection.close();\n connection = null;\n sql = null;\n request = null;\n delete updated;\n return callback(errMsg,null);\n \n } else{\n connection.close();\n connection = null;\n sql = null;\n request = null;\n delete updated;\n rowCount = null;\n return callback(null,'ok');\n \n }\n\n\n });\n\n\n request.addParameter('transstatus', TYPES.Int,data.transstatus);\n request.addParameter('date', TYPES.DateTime,updated);\n request.addParameter('unitid', TYPES.Int,data.unit);\n request.addParameter('propid', TYPES.Int,data.propid);\n request.addParameter('transnumber', TYPES.Int,data.transnumber);\n \n connection.execSql(request);\n\n }\n }); \n\n\n}",
"updateOne(table,objColVals, condition, cb){\n let query = `UPDATE ${table}`;\n query += ` SET ${objToSql(objColVals)}`;\n query += ` WHERE ${condition}`\n\n connection.query(query,(err,result) =>{\n if(err) throw err;\n cb(result);\n });\n }",
"__createOrUpdateDb(data, result, callback) {\n let fnt = this.apiFnts[data.type],\n model = fnt.model,\n asset_id = this.asset.id,\n output = this.__convertRawDataToStructured(data, result);\n if (output.status == 'SUCCESS') {\n let chart_data = output.data.chart_data;\n // if (data.type != 'INTRA') {\n model\n .upsert({\n asset_id: asset_id,\n close_price: JSON.stringify(chart_data)\n })\n .then(values => {\n console.log(`${data.type} table created|updated`);\n });\n // }\n callback(false, output.data);\n } else {\n callback(output, null);\n }\n }",
"queryUpdateHook() { }",
"function update_1_row(req, res, next) {\n 'use strict';\n\tvar __FUNCTION__ = \"update_1_row\";\n\tvar table_name = req.params.table_name;\n\tvar stmt_saved;\n\tvar valid_table = check_table_name ( table_name );\n\tif ( valid_table.error ) {\n\t\treturn next(valid_table.error);\n\t}\n\tvar v = validate_data( 'update', table_name, req.params );\n\tif ( ! v.ok ) {\n \treturn next(new restify.MissingParameterError(\"Missing or invalid data;\"+v.msg));\t\t\n\t}\n\n\tvar crud_info = gen_crud_info ( {}, 'update', table_name, req.params, __FUNCTION__, __FILE__, 420 );\n\tif ( crud_info.error ) {\n\t\treturn next(crud_info.error);\n\t}\n\tdn.runQuery ( stmt_saved = ts0( 'update %{log_comment%} %{table_name%} set %{update_set%} %{update_pk_where%}', crud_info ), function ( err, query ) {\n\t\tif ( $debug$.showQuery ) {\n\t\t\tconsole.log ( \"Query is:\\nFile: \"+ \".1.views.m4.js\" +\" Function:\"+ __FUNCTION__ + \" Line: \"+ 426 + \" \" + stmt_saved + \"\\n\\n\" );\n\t\t}\n\t\t//if ( query && typeof query.count !== \"undefined\" && query.count === 0 ) {\n\t\t//\tdebug_2(\".1.views.m4.js\",__FUNCTION__,429,\"No Rows Updated; trying insert -- debuging check\");\n\t\t//}\n\t\tif ( err ) {\n\t\t\tdebug_2(\".1.views.m4.js\",__FUNCTION__,432,\"typeof(err)==\"+typeof(err));\n\t\t\tsend_result ( res, next, null, { \"status\":\"error\", \"msg\":\"invalid query\", \"raw\": JSON.stringify(err), \"query\":stmt_saved } );\n\t\t} else {\n\t\t\t//if ( query.count === 0 ) {\n\t\t\t\t// Xyzzy - use regular insert since we are checking query.count???\n\t\t\t\tdebug_2(\".1.views.m4.js\",__FUNCTION__,437,\"No Rows Updated; trying insert\");\n\t\t\t\tdn.runQuery ( stmt_saved = ts0( 'insert into %{table_name%} ( %{insert_col_names%} ) select %{insert_col_no_s%} '+\n\t\t\t\t\t'where not exists ( select 1 from %{table_name%} %{update_pk_where%} ) ', crud_info ), function ( err2, query2 ) {\n\t\t\t\t\tif ( err2 ) {\n\t\t\t\t\t\tsend_result ( res, next, null, { \"status\":\"error\", \"msg\":\"invalid query\", \"raw\": JSON.stringify(err2), \"query\":stmt_saved } );\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tdebug_2(\".1.views.m4.js\",__FUNCTION__,444,\"insert occured.\");\n\t\t\t\t\t\t\tres.send({\"status\":\"ok\"}); \n\t\t\t\t\t\t\treturn next();\n\t\t\t\t\t\t} catch ( err ) {\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t//} else {\n\t\t\t//\ttry {\n\t\t\t//\t\tdebug_2(\".1.views.m4.js\",__FUNCTION__,453,\"insert occured.\");\n\t\t\t//\t\tres.send({\"status\":\"ok\"}); \n\t\t\t//\t\treturn next();\n\t\t\t//\t} catch ( err ) {\n\t\t\t//\t}\n\t\t\t//}\n\t\t}\n\t});\n}",
"static update(table, updates, query, callback) {\n if (table.length === 0 || updates.length === 0 || query.length === 0) {\n return;\n }\n\n let options = [table];\n\n let sql = 'UPDATE ?? SET ';\n let sets = [];\n for (let key in updates) {\n if (updates.hasOwnProperty(key) && typeof updates[key] !== 'undefined') {\n sets.push(' ?? = ?');\n options.push(key, updates[key]);\n }\n }\n sql += sets.join(',');\n\n if (Object.keys(query).length > 0) {\n sql += ' WHERE';\n }\n let wheres = [];\n for (let key in query) {\n if (query.hasOwnProperty(key) && typeof query[key] !== 'undefined') {\n wheres.push('?? = ? ');\n options.push(key, query[key]);\n }\n }\n\n sql += wheres.join('AND ');\n\n return con.query(sql, options, (err,rows) => {\n if(err || rows.length > 0) {\n callback(err, null);\n } else {\n callback(null, rows);\n }\n });\n }",
"function updatedb_sql(){\n\n}",
"function makeUpdate(param, newValue, condition, cb) {\n queryUpdate(\"update items set \" + param + \" = \" + newValue + \" where \" + condition + \";\", (res) => {\n cb(res);\n });\n}",
"async function updateMySQL(tableName, data, id) {\n if (tableName === 'environment') {\n if (data.hasOwnProperty('thingy')) {\n await deleteTableInfluxDB(data.thingy);\n await mqtt.deleteAllSubscriptions(data.thingy);\n }\n if (!data.hasOwnProperty('thingy')) {\n const tableReading = 'SELECT thingy FROM environment WHERE id = ' + id;\n const res = await connM.query(tableReading).catch((err) => {return err;});\n data['thingy'] = res[0].thingy;\n }\n await mqtt.changeSubscriptions(data['thingy'], data);\n }\n let tableModification = 'UPDATE ' + tableName + ' SET ';\n for (const key in data) {\n if (data.hasOwnProperty(key))\n if (key.endsWith('notif')) tableModification += key + \" = \" + data[key] + \",\";\n else tableModification += key + \" = '\" + data[key] + \"',\";\n }\n tableModification = tableModification.substring(0, tableModification.length-1) + \" WHERE id = \" + id;\n return await connM.query(tableModification).catch((err) => {return err;});\n}",
"static update (data, callback = f => f) {\n return createRequest({\n url: this.HOST + this.URL,\n data,\n method: 'POST',\n responseType: 'json',\n callback (e, response) {\n if (e === null && response) {\n callback(e, response);\n } else {\n console.error(e);\n };\n }\n });\n }",
"function update(id, payload) {\n return new Promise((resolve, reject) => {\n const sql = `UPDATE [user] SET name = @name, birthday = @birthday, email = @email, gender = @gender, country = @country WHERE id = @id`;\n const request = new Request(sql, (err, rowcount) => {\n console.log('rowcount', rowcount);\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 updated.!' })\n }\n });\n\n request.addParameter(\"id\", TYPES.Int, id);\n request.addParameter(\"name\", TYPES.VarChar, payload.name);\n request.addParameter(\"birthday\", TYPES.Date, payload.birthday);\n request.addParameter(\"email\", TYPES.VarChar, payload.email);\n request.addParameter(\"gender\", TYPES.VarChar, payload.gender);\n request.addParameter(\"country\", TYPES.VarChar, payload.country);\n\n request.on(\"done\", (row) => {\n console.log(\"User Updated\", row);\n // resolve(\"user Updated\", row);\n });\n\n request.on(\"doneProc\", function (rowCount, more, returnStatus, rows) {\n console.log('Row Count' + rowCount);\n console.log('More? ' + more);\n console.log('Return Status: ' + returnStatus);\n console.log('Rows:' + rows);\n });\n\n connection.execSql(request);\n });\n}",
"function UpdateApplicationInfo(){\t\r\n\t\t\r\n\t\t/*\r\n \t// Delete Event Table \r\n db.transaction(function(tx)\r\n\t {\t \t\r\n\t \ttx.executeSql('DROP TABLE IF EXISTS ApplicationInfo'); \t\r\n\t }\r\n\t , transaction_error,ResetDevice_success); \r\n \t\r\n \t*/\r\n var sqlCreateApplicationInfo = \r\n\t\t\t\t\t\t\"CREATE TABLE IF NOT EXISTS ApplicationInfo ( \"+\r\n\t\t\t\t\t\t\"ID INTEGER PRIMARY KEY , \" +\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\"version VARCHAR(100))\";\r\n\t\t\r\n\tsetTimeout(function(){ \t\r\n \t\t db.transaction(function(tx)\r\n\t {\t \t\r\n\t \ttx.executeSql(sqlCreateApplicationInfo); \t\r\n\t }\r\n\t , transaction_error, ResetDevice_success);\r\n\t\t}, 5000);\t\r\n\t\t\r\n }",
"function updateRecord(TABLE, itemID, values) {\n log(\"updateRecord\");\n var query = ClearBlade.Query({collectionName:TABLE});\n query.equalTo('item_id', itemID);\n query.update(values, statusCallBack);\n \n values.timestamp=new Date(Date.now()).toISOString();\n createRecord(tblHistorian, values);\n}",
"function updateRegistro(id, data, valor, obs, desc, callback) {\n db.pool.query(`UPDATE reg SET dtreg = '${data}', valorreg = ${valor}, obsreg = '${obs}', descreg = '${desc}' WHERE nreg = ${id} RETURNING *`, function (err, res) {\n console.log(err)\n if (err) {\n callback(err, null)\n } else {\n callback(null, res.rows[0])\n }\n })\n}",
"function updateDynamicTable(tableName,updateColumns,whereColumns)\r\n{\r\n\t\r\n\t\r\n\tdb.transaction(function(transaction){ updateTable(transaction, tableName,updateColumns,whereColumns);}, errorCB, successCB);\r\n}",
"function updateTable( jsonData, successCallback ) {\n var dataType;\n if ( !jsonData ) {\n throw \"MobileDb.updateTable: Required parameter jsonData is null or undefined\";\n }\n if ( !db ) {\n throw \"MobileDb.updateTable: Database instance is not open. Call openDB() before calling this method.\";\n }\n\n var count = jsonData['total'];\n dataType = JSONData.getDataTypeFromJSONFeedData( jsonData );\n debug && console.log( \"MobileDb.updateTable: JSON datatype = \" + dataType + \", update count = \" + count );\n\n // Use default callbacks if callback params are undefined\n if ( !successCallback ) {\n successCallback = function() {\n debug && console.log( \"MobileDb.updateTable: \" + dataType + \" table update successful\" );\n };\n }\n var index = 0;\n var insertSql = \"\";\n var sqlUpdateBatch = [];\n if ( count > 0 ) {\n // Add DELETE statements for each object inside the jsonData\n debug && console.log( \"MobileDb.updateTable: Adding DELETE statements to SQL batch\" );\n for ( index = 0; index < count; index++ ) {\n sqlUpdateBatch.push( SQL_DELETE_ROW_BY_WEBID.replace( \"tableName\", dataType ) +\n jsonData[dataType][index].webId );\n }\n // Add INSERT statements for each object inside the jsonData\n debug && console.log( \"MobileDb.updateTable: Adding INSERT statements to SQL batch\" );\n _.each( jsonData[dataType], function( jsonInList ) {\n insertSql = getInsertSql( dataType, jsonInList );\n if ( insertSql ) {\n sqlUpdateBatch.push( insertSql );\n }\n });\n // Execute the SQL batch\n debug && console.log( \"MobileDb.updateTable: Executing batch to update table \" + dataType );\n executeSqlBatch( sqlUpdateBatch,\n // Success callback\n function() {\n debug && console.log( \"MobileDb.updateTable: SQL update batch successful\" );\n // Update complete, call the success callback\n successCallback();\n },\n // Error callback\n function( err1, err2 ) {\n console.error( \"MobileDb.updateTable: SQL update batch failed\" );\n defaultErrorCallbackFn( err1, err2 );\n // Update complete, call the success callback\n successCallback();\n }\n );\n } else {\n // Call success callback immediately if there is nothing to update\n successCallback();\n }\n }",
"function updateSomething(obj1, obj2) {\n console.log(\"Updating employee roles!\");\n connection.query(\"UPDATE employee_role SET ? WHERE ?\", [obj1, obj2], function(\n err,\n res\n ) {\n if (err) throw err;\n });\n connection.query(\"SELECT * FROM employee_role\", function(err, res) {\n if (err) throw err;\n const newTable = table.getTable(res);\n console.log(newTable);\n });\n console.clear();\n initiation();\n}",
"function db_updateHandler()\n{\n\tvar callback = function(){alert(\"1234567\");};\n\tvar metersUpdated=false, readingsUpdated=false, usersUpdated=false, callbackDone=false;\n\tvar isSuccess = true;\n\n//\tfunction trigger(callback, metersUpdated, readingsUpdated, usersUpdated, callbackDone)\n\tthis.trigger=function()\n\t{\n\t\t//if(callback && !callbackDone && metersUpdated && readingsUpdated && usersUpdated)\n\t\tif(callback && !callbackDone && metersUpdated && readingsUpdated)\n\t\t{\n\t\t\tcallbackDone = true;\n\t\t\tcallback(isSuccess);\n\t\t}\n\t};\n\t\n\tthis.reset = function(_callback)\n\t{\n\t\tcallback=_callback; \n\t\tcallbackDone =false; \n\t\tmetersUpdated=false; \n\t\treadingsUpdated=false; \n\t\tusersUpdated=false;\n\t};\n\t\n\tthis.meters = function(_isSuccess) \n\t{\n\t\tmetersUpdated=true; \n\t\tif(_isSuccess==false)\n\t\t\tisSuccess &= _isSuccess;\n\t\t\t\n\t\t//trigger(callback, metersUpdated, readingsUpdated, usersUpdated, callbackDone);\n\t\tthis.trigger();\n\t};\n\n\tthis.readings = function(_isSuccess) \n\t{\n\t\treadingsUpdated=true; \n\t\tif(_isSuccess==false)\n\t\t\tisSuccess &= _isSuccess;\n\t\t//trigger(callback, metersUpdated, readingsUpdated, usersUpdated, callbackDone);\n\t\tthis.trigger();\n\t};\n\t\n\tthis.users = function(_isSuccess) \n\t{\n\t\tusersUpdated=true; \n\t\tif(_isSuccess==false)\n\t\t\tisSuccess &= _isSuccess;\n\t\t//trigger(callback, metersUpdated, readingsUpdated, usersUpdated, callbackDone);\n\t\tthis.trigger();\n\t};\n}",
"static update(table_name, attributes, where, response, cb) {\n\t\ttable_name\n\t\t\t.findOne({\n\t\t\t\twhere\n\t\t\t})\n\t\t\t.then((found) => {\n\t\t\t\tif (found !== null) {\n\t\t\t\t\ttable_name\n\t\t\t\t\t\t.update(attributes, {\n\t\t\t\t\t\t\twhere: {\n\t\t\t\t\t\t\t\tid: found.id\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.then((updated) => {\n\t\t\t\t\t\t\tif (updated[0]) {\n\t\t\t\t\t\t\t\tif (typeof cb === 'function') {\n\t\t\t\t\t\t\t\t\tcb({\n\t\t\t\t\t\t\t\t\t\tcode: 200,\n\t\t\t\t\t\t\t\t\t\ttitle: 'Success',\n\t\t\t\t\t\t\t\t\t\tmessage: 'Data is updated',\n\t\t\t\t\t\t\t\t\t\ttype: 'success',\n\t\t\t\t\t\t\t\t\t\tdata: updated\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\tresponse.status(200).json({\n\t\t\t\t\t\t\t\t\t\tcode: 200,\n\t\t\t\t\t\t\t\t\t\ttitle: 'Success',\n\t\t\t\t\t\t\t\t\t\tmessage: 'Data is updated',\n\t\t\t\t\t\t\t\t\t\ttype: 'success',\n\t\t\t\t\t\t\t\t\t\tdata: updated\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (typeof cb === 'function') {\n\t\t\t\t\t\t\t\t\tcb({\n\t\t\t\t\t\t\t\t\t\tcode: 400,\n\t\t\t\t\t\t\t\t\t\ttitle: 'Warning',\n\t\t\t\t\t\t\t\t\t\tmessage: 'Unable to update',\n\t\t\t\t\t\t\t\t\t\ttype: 'warning',\n\t\t\t\t\t\t\t\t\t\tdata: []\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\tresponse.status(200).json({\n\t\t\t\t\t\t\t\t\t\tcode: 400,\n\t\t\t\t\t\t\t\t\t\ttitle: 'Warning',\n\t\t\t\t\t\t\t\t\t\tmessage: 'Unable to update',\n\t\t\t\t\t\t\t\t\t\ttype: 'warning',\n\t\t\t\t\t\t\t\t\t\tdata: []\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\t\tif (typeof cb === 'function') {\n\t\t\t\t\t\t\t\tcb({\n\t\t\t\t\t\t\t\t\tcode: 400,\n\t\t\t\t\t\t\t\t\ttitle: 'Failed',\n\t\t\t\t\t\t\t\t\tmessage: error.message,\n\t\t\t\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\t\t\t\ttrace: {\n\t\t\t\t\t\t\t\t\t\taddress: 'update : Function model.update()',\n\t\t\t\t\t\t\t\t\t\terror: JSON.stringify(error)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tresponse.status(400).json({\n\t\t\t\t\t\t\t\t\tcode: 400,\n\t\t\t\t\t\t\t\t\ttitle: 'Failed',\n\t\t\t\t\t\t\t\t\tmessage: error.message,\n\t\t\t\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\t\t\t\ttrace: {\n\t\t\t\t\t\t\t\t\t\taddress: 'update : Function model.update()',\n\t\t\t\t\t\t\t\t\t\terror: JSON.stringify(error)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof cb === 'function') {\n\t\t\t\t\t\tcb({\n\t\t\t\t\t\t\tcode: 404,\n\t\t\t\t\t\t\ttitle: 'Warning',\n\t\t\t\t\t\t\tmessage: 'Data not found',\n\t\t\t\t\t\t\ttype: 'warning',\n\t\t\t\t\t\t\tdata: []\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresponse.status(200).json({\n\t\t\t\t\t\t\tcode: 404,\n\t\t\t\t\t\t\ttitle: 'Warning',\n\t\t\t\t\t\t\tmessage: 'Data not found',\n\t\t\t\t\t\t\ttype: 'warning',\n\t\t\t\t\t\t\tdata: []\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\t.catch((error) => {\n\t\t\t\tif (typeof cb === 'function') {\n\t\t\t\t\tcb({\n\t\t\t\t\t\tcode: 400,\n\t\t\t\t\t\ttitle: 'Failed',\n\t\t\t\t\t\tmessage: error.message,\n\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\ttrace: {\n\t\t\t\t\t\t\taddress: 'update : Function model.findOne()',\n\t\t\t\t\t\t\terror: JSON.stringify(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tresponse.status(400).json({\n\t\t\t\t\t\tcode: 400,\n\t\t\t\t\t\ttitle: 'Failed',\n\t\t\t\t\t\tmessage: error.message,\n\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\ttrace: {\n\t\t\t\t\t\t\taddress: 'update : Function model.findOne()',\n\t\t\t\t\t\t\terror: JSON.stringify(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t}",
"commit() {\n }",
"function updateTrades(processed_data, callback) {\n var query_string = 'INSERT INTO trades SET ?';\n var trade_data_map = {\n timestamp: processed_data.timestamp,\n instrument_id: processed_data.instrument_id,\n trade_type: processed_data.trade_type,\n trade_volume: processed_data.trade_volume\n };\n connection.query(query_string, trade_data_map, function (error, result) {\n if (result) {\n console.log(result);\n return callback(null, processed_data.instrument_id);\n } else {\n console.log(error);\n return callback(error, null);\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}"
]
| [
"0.6365311",
"0.63515353",
"0.6273513",
"0.62477237",
"0.623554",
"0.6218646",
"0.6218646",
"0.6218646",
"0.6214957",
"0.6201936",
"0.6128711",
"0.610704",
"0.6089083",
"0.60854906",
"0.60675275",
"0.60041606",
"0.5985274",
"0.5971839",
"0.59590966",
"0.59426886",
"0.5935435",
"0.5928852",
"0.59283686",
"0.5924695",
"0.5914255",
"0.5907499",
"0.5905436",
"0.58659357",
"0.58549666",
"0.5848906"
]
| 0.68953604 | 0 |
fyi: ALL fields must be present in the bo (for it to be created correctly if necessary) but that makes the matching unrealistic/undesired. Thus this method is likely practically unusable. | getMatchOrCreate(bo) {
return this.getMatching(bo).then(obj => {
let matchingBo;
try {
matchingBo = obj.val();
} catch (_err) {}
if (matchingBo) {
return Right(matchingBo);
}
return this.create(bo);
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static assertFieldsExist(fields = []) {\n if (fields === RETURNS_ALL_FIELDS) {\n return;\n }\n\n const modelFields = this.fields();\n\n // Ensure that all fields are defined within our model\n const missing = fields.reduce((missing, field) => {\n if (modelFields.indexOf(field) === -1) {\n missing.push(field);\n }\n return missing;\n }, []);\n\n if (missing.length > 0) {\n throw new Error(\n `All fields must be defined within your model. Missing: ` +\n missing.join(', ')\n );\n }\n }",
"validate(object, ignore, cb){\n //Object if valid\n let result = {\n result: true,\n object: {\n valid: true,\n messages: []\n },\n message: \"Object is valid\"\n }\n \n //this variable will be filled in the check loop\n let uniqueFields = [];\n\n //Check if fields are filled, need to be filled and are the right type\n for(let key in this.model){\n let property = this.model[key];\n let required = property.required != null ? property.required : false;\n let unique = property.unique != null ? property.unique : false;\n let type = (property.type != null ? property.type : \"string\").toLowerCase();\n let minLength = property[\"min-length\"] != null ? property[\"min-length\"] : 0;\n let maxLength = property[\"max-length\"] != null ? property[\"max-length\"] : Number.MAX_SAFE_INTEGER;\n \n //push into unique fields array for the unique check\n if(unique) uniqueFields.push(key);\n\n //other checks\n if(required && object[key] == null) result.object.messages.push(key + \" is required\");\n if(object[key] != null){\n if(typeof(object[key]) !== type) result.object.messages.push(key + \" must be a \" + type);\n let objectLength = null\n \n if(type == \"number\")\n objectLength = object[key];\n else if(type == \"string\")\n objectLength = object[key].length;\n\n if(objectLength != null){ \n if(minLength > objectLength) result.object.messages.push(\"minimum length for \" + key + \" is \" + minLength); \n if(maxLength < objectLength) result.object.messages.push(\"maximum length for \" + key + \" is \" + minLength); \n if(property.length != null && property.length != objectLength) result.object.messages.push(\"the length of \" + key + \"must be \" + property.length);\n }\n }\n }\n //the unique check\n this.read(function(readResult){\n for(let recordIndex = 0; recordIndex < readResult.object.length; recordIndex++){\n let record = readResult.object[recordIndex];\n if(ignore.indexOf(record.id) < 0){\n for(let i = 0; i < uniqueFields.length; i++){\n if(record[uniqueFields[i]] == object[uniqueFields[i]]){\n result.object.messages.push(uniqueFields[i] + \": \"+ object[uniqueFields[i]] +\" is already in use\");\n }\n }\n }\n }\n if(result.object.messages.length > 0){\n result.object.valid = false;\n result.message = \"Object is not valid\";\n }\n cb(result);\n });\n }",
"is_match(fuzzy_fields, ordered_fields) {\n for (let i = 0; i < fuzzy_fields.length; ++i) {\n let pos = this.fields.indexOf(fuzzy_fields[i]);\n if (pos < 0 || pos >= fuzzy_fields.length) { return false; }\n }\n\n outer:\n for (let i = 0; i <= fuzzy_fields.length && i + ordered_fields.length <= this.fields.length; ++i) {\n for (let j = 0; j < ordered_fields.length; ++j) {\n if (this.fields[i + j] !== ordered_fields[j]) {\n continue outer;\n }\n }\n return true;\n }\n return false;\n }",
"function filterInternalMatchFields(rawDocs) {\n var filteredResults = [];\n rawDocs.forEach(function(rawDoc) {\n // Skip invalid matches that do not have associated users/offerings\n if ((rawDoc.owner && rawDoc.owner._id) && (rawDoc.requester && rawDoc.requester._id) && (rawDoc.offering && rawDoc.offering._id)) {\n filteredResults.push(rawDoc.getPublicObject());\n }\n });\n return filteredResults;\n}",
"function fixInconsistentFields(records) {\n var fields = findIncompleteFields(records);\n patchMissingFields(records, fields);\n }",
"validate() {\n\t\tconst schemaKeys = Object.keys(this.schema).sort();\n\t\tconst fieldsKeys = Object.keys(this.fields).sort();\n\t\t\n\t\tschemaKeys.sort();\n\t\tfieldsKeys.sort();\n\n\t\tconst match = _.isEqual(schemaKeys, fieldsKeys);\n\t\tif (!match) {\n\t\t\treturn response({invalid: true, message: `Field does not match! Required fields: ${schemaKeys} but got: ${fieldsKeys}`});\n\t\t} else {\n\t\t\treturn response({valid: true});\n\t\t}\n\t}",
"is_match(fuzzy_fields, ordered_fields) {\n for (let i = 0; i < fuzzy_fields.length; ++i) {\n const pos = this.fields.indexOf(fuzzy_fields[i]);\n if (pos < 0 || pos >= fuzzy_fields.length) { return false; }\n }\n\n outer: // eslint-disable-line no-labels\n for (let i = 0; i <= fuzzy_fields.length && i + ordered_fields.length <= this.fields.length; ++i) {\n for (let j = 0; j < ordered_fields.length; ++j) {\n if (this.fields[i + j] !== ordered_fields[j]) {\n continue outer; // eslint-disable-line no-labels\n }\n }\n return true;\n }\n return false;\n }",
"static checkSomeFields(data) {\n const modelValidationErrors = {\n modelHasErrors: false\n };\n Object.entries(data).forEach(([fieldName, value]) => {\n const field = this[fieldName];\n const valueInData = data[fieldName];\n if (field instanceof fields_1.Field) {\n const fieldValidationErrors = field.getValidationErrors(valueInData);\n if (fieldValidationErrors.fieldHasErrors) {\n modelValidationErrors.modelHasErrors = true;\n }\n modelValidationErrors[fieldName] = fieldValidationErrors;\n }\n });\n return modelValidationErrors;\n }",
"find(props) {\n const constraints = [];\n\n Object.keys(props).forEach((prop) => {\n // Check property is in schema\n if(this.props[prop] === undefined){\n console.log(`SchemaType Error: No such property \"${prop}\"`);\n return;\n }\n\n // Forward to correct parser\n switch (this.props[prop].type) {\n case \"int\":\n constraints.push(this._matchInt(prop, props[prop]))\n break;\n\n case \"string\":\n constraints.push(this._matchString(prop, props[prop]))\n break;\n\n // rel type\n default:\n break;\n }\n });\n\n console.log(constraints);\n\n const db = DatabaseConnection.getConnection();\n let query = `MATCH (a:${this.name}) WHERE `\n\n constraints.forEach((entry, index) => {\n query += \" a.\" + entry;\n\n if(index < constraints.length - 1){\n query += \" AND \";\n }\n })\n\n query += ` return a`;\n console.log(query);\n return db.query(query);\n }",
"toUpdateSafeDBModel() {\n\t\tvar updateModel = {}\n\t\t// non-nullable fields\n\n\t\t// nullable fields\n\t\tif(this.acceptedBid !== undefined) updateModel.accepted_bid = this.acceptedBid\n\t\tif(this.name !== undefined) updateModel.name = this.name\n\t\tif(this.description !== undefined) updateModel.description = this.description\n\n\t\treturn updateModel;\n\t}",
"constructor (name,table) {\n super()\n \n // Object.assign(this,cfg)\n\n this.name = name\n\n // process the pk & fk's\n this.fields = {} // build the object anew\n this.indexes = []\n this.keys = table.keys\n\n // pk\n if(this.keys && this.keys.pk) {\n \n this.pk = this.keys.pk\n this.pk.name = 'id' // use a naming protocol object\n // this seems to cause a circ ref\n // pk.this = this // this pointer\n\n // fields.unshift(this.keys.pk)\n \n // add the field\n this.fields.id = this.pk\n\n this.indexes.push( {unique: true, fields: [this.pk.name]} ) \n }\n\n\n // create the foreign keys\n if(this.keys && this.keys.fks) {\n this.keys.fks.forEach(fk => {\n const plural = fk.entityName + 's' // simplistic\n const tableName = plural\n const fkName = lowerCaseFirstLetter(fk.entityName) + 'Id'\n \n fk.name = fkName\n // fk.this = this\n\n // this is the remote/foreign this\n fk.tableName = tableName\n\n this.fields[fkName] = fk \n // prob create an index!!\n this.indexes.push( {unique: false, fields: [fk.name]} ) \n\n // constraints??\n })\n }\n \n // process the normal fields\n if(table.fields) {\n for( const [name,field] of Object.entries(table.fields) ) {\n field.name = name\n\n // field.this = this\n // we prob should do some processing here\n this.fields[name] = field\n // index it?\n // use either unique or isUnique type attr name\n if(field.indexed || field.isIndexed || field.isUnique || field.unique) {\n this.indexes.push( {unique: field.isUnique || field.unique, fields: [field.name]} ) \n }\n }\n\n }\n\n }",
"addFieldsToParam(searchParam) {\n let allFields = this.fields.split(',');\n allFields.push('Id');\n allFields.push('Name');\n let cleanFields = this.dedupeArray(allFields).join(',');\n searchParam.fieldsToQuery = cleanFields;\n }",
"async create() {\r\n try {\r\n // Record (cross-field) validation\r\n const valRec = await this.tableValidation(this.req.body, \"CREATE\")\r\n if (valRec !== \"\") {\r\n this.res.status(422).json({ errors: valRec })\r\n return valRec\r\n }\r\n\r\n // Collect data from request body\r\n const data = await this.parseReq(\"CREATE\")\r\n // const createFields = this.primaryFields.concat(this.fields)\r\n // 1/20/21: Primary field is included in fields\r\n const createFields = this.fields\r\n return await super.create(createFields, data)\r\n } catch (e) {\r\n //throw e;\r\n throw utils.errMsg(e)\r\n }\r\n }",
"validateFieldOptions() {\n this.options.fields.forEach((f) => {\n let name = f;\n if (typeof f === 'object') {\n name = f.name;\n }\n\n if (this.availableFields.indexOf(name) === -1) {\n throw new Error(`Field ${name} not available. Make sure the fields array item has\\\n a string or a object with a name attribute containing one of the available fields.`);\n }\n });\n }",
"matchAttributes(context, obj) {\n return this.attribute_whitelist(context).intersect(Object.keys(obj));\n }",
"only(fields) {\n // Empty the included fields.\n this.includes = new Set();\n if (typeof fields === 'string' && this.fields.indexOf(fields) !== -1) {\n this.includes.add(fields);\n this.validateIncludes();\n return this;\n }\n const toInclude = [];\n for (const field of fields) {\n // @ts-ignore\n if (this.fields.indexOf(field) !== -1) {\n // @ts-ignore\n toInclude.push(field);\n }\n }\n if (toInclude.length) {\n this.includes = new Set(toInclude);\n }\n this.validateIncludes();\n return this;\n }",
"_setRequiredFields() {\n const that = this;\n\n if (!that.requiredFields || !that.requiredFields.length) {\n return;\n }\n\n const currentValue = that.value;\n let reqGroup = [];\n\n for (let i = 0; i < that.requiredFields.length; i++) {\n const reqField = that.requiredFields[i],\n field = that.fields.find(field => field.dataField === reqField);\n\n if (field) {\n let valueRecords = [];\n\n if (currentValue) {\n let i = 0;\n\n //Doing a lookup on the value for records that contain 'requiredFields'\n //Modifies the value dynamically\n while (i < currentValue.length) {\n const val = currentValue[i];\n\n if (Array.isArray(val)) {\n let r = 0;\n\n while (r < val.length) {\n let record = val[r];\n\n if (record && record[0] === field.dataField) {\n valueRecords.push(record);\n val.splice(r > 0 ? r - 1 : r, 2);\n continue;\n }\n\n r++;\n }\n }\n\n if (!val.length) {\n currentValue.splice(i, 2);\n continue;\n }\n\n i++;\n }\n }\n\n //Check if group records exist inside value\n if (valueRecords) {\n for (let r = 0; r < valueRecords.length; r++) {\n reqGroup.push(valueRecords[r]);\n reqGroup.push('and');\n }\n }\n else {\n //If no records create a placeholder\n reqGroup.push([reqField]);\n reqGroup.push('and');\n }\n }\n }\n\n //Remove the lastly added 'and' condition\n if (typeof reqGroup[reqGroup.length - 1] === 'string') {\n reqGroup.pop();\n }\n\n //Add the Required Fields on Top of the value\n that.value.unshift(reqGroup, 'and')\n }",
"function mergeMetaFields(matched) {\r\n return matched.reduce((meta, record) => assign(meta, record.meta), {});\r\n}",
"function isEmptyCheck(body) {\n\n var insertObj = {};\n if (!empty(body.firstName)) {\n insertObj.firstName = body.firstName;\n }\n if (!empty(body.lastName)) {\n insertObj.lastName = body.lastName;\n } else {\n insertObj.lastName = '';\n }\n if (!empty(body.email)) {\n insertObj.email = body.email;\n }\n if (!empty(body.mobileNumber)) {\n insertObj.mobileNumber = body.mobileNumber;\n }\n if (!empty(body.roleId)) {\n insertObj.roleId = body.roleId;\n }\n if (!empty(body.tenantId)) {\n insertObj.tenantId = body.tenantId;\n }\n if (!empty(body.fleetId)) {\n insertObj.fleetId = body.fleetId;\n }\n if (!empty(body.area)) {\n insertObj.area = body.area;\n }\n if (!empty(body.licenseNumber)) {\n insertObj.licenseNumber = body.licenseNumber;\n }\n if (body.isDriverAssign === 1 || body.isDriverAssign === 0) {\n insertObj.isDriverAssign = parseInt(body.isDriverAssign);\n }\n if (body.isRemoveFleet && body.isRemoveFleet === true) {\n insertObj.fleetId = null;\n }\n\n return insertObj;\n}",
"function checkFields(requestBody, requiredFields){\n\tfor(let i = 0; i <requiredFields.length; i++){\n\t\tconst field = requiredFields[i];\n\t\tif(!(field in requestBody)){\n\t\t\tconst message = `\\`${field}\\` property missing in request.`;\n\t\t\tconsole.error(message);\n\t\t\tthrow Error(message);\n\t\t}\n\t}\n}",
"checkExistingQuery () {\n\t\t// we match on a New Relic object ID and object type, in which case we add a new stack trace as needed\n\t\treturn {\n\t\t\tquery: {\n\t\t\t\tobjectId: this.attributes.objectId,\n\t\t\t\tobjectType: this.attributes.objectType,\n\t\t\t\tdeactivated: false\n\t\t\t},\n\t\t\thint: Indexes.byObjectId\n\t\t}\n\t}",
"dynamic() {\n\t\tconst dynamicSchema = Object.keys(this.schema)\n\t\t\t.filter(key => this.field.includes(key))\n\t\t\t.reduce((obj, key) => {\n\t\t\t\tobj[key] = this.schema[key];\n\t\t\t\treturn obj;\n\t\t\t}, {});\n\t\t\t\n\t\tconst validate = Joi.object(dynamicSchema).validateAsync(this.fields);\n\t\treturn validate.then(() => {\n\t\t\treturn response({valid: true});\n\t\t}).catch(error => {\n\t\t\treturn response({invalid: true, message: joiError(error.toString())});\n\t\t})\n\t}",
"function mergeMetaFields(matched) {\n return matched.reduce((meta, record) => assign(meta, record.meta), {});\n}",
"function MatchingCriteria() {\n\tthis.inputFile;\n\tthis.businessUnit;\n\tthis.activeOnly;\n\tthis.resellers;\n\tthis.xrefTypes;\n\tthis.matchTypes;\n\tthis.additionalFields;\n\tthis.outputFilename;\n\tthis.outputFormat;\n}",
"static validateFields(newTask) {\n if (newTask.name === \"\") {\n return { flag: false, field: 0 };\n }\n if (newTask.description === \"\") {\n return { flag: false, field: 1 };\n }\n return { flag: true, field: -1 };\n }",
"async checkProperties(data, fields) {\n this.fill(data, fields);\n return this.valid(false, false);\n }",
"static match(fields, keyValuePairs) {\n const matchesMap = new Map();\n keyValuePairs.forEach((value, key, map) => {\n const fuzzyFields = FuzzySet(fields); //a = FuzzySet(['Michael Axiak']);\n const auditorFieldMatch = fuzzyFields.get(key); //a.get(\"micael asiak\"); returns [[0.8461538461538461, 'Michael Axiak']]\n if (auditorFieldMatch) {\n const match = auditorFieldMatch[0][1];\n matchesMap.set(match, value);\n //TODO: For multiple matches do a if statement that checks if the map already has a key equal to 'match', if it does, add it to the corresponding value's list\n }\n });\n return matchesMap;\n }",
"configureFields() {\n let fields = {}\n\n for(let fieldName in this.props.schema.fields) {\n let field = this.props.schema.fields[fieldName]\n\n fields[fieldName] = {}\n fields[fieldName].value = undefined\n fields[fieldName].isValid = false\n fields[fieldName].required = false\n\n if(\n field.type === 'select'\n || field.type === 'checkbox'\n ) {\n fields[fieldName].isValid = true\n }\n }\n\n if(this.props.schema.required) {\n this.props.schema.required.forEach(fieldName => {\n fields[fieldName].required = true\n })\n }\n\n return fields\n }",
"toUpdateSafeDBModel() {\n\t\tvar updateModel = {}\n\t\t// non-nullable fields\n\t\tif(this.email != undefined) updateModel.email = this.email\n\t\tif(this.userType != undefined) updateModel.user_type = this.userType\n\n\t\t// nullable fields\n\t\tif(this.firstname !== undefined) updateModel.firstname = this.firstname\n\t\tif(this.lastname !== undefined) updateModel.lastname = this.lastname\n\n\t\treturn updateModel;\n\t}",
"_initSearchFields() {\n\t\t\tvar oFields = this._oViewModel.getProperty(\"/fields\");\n\t\t\tvar aSearchFields = Object.entries(oFields)\n\t\t\t\t.filter(([, oField]) => oField.canSearch)\n\t\t\t\t.map(([sKey, oField]) => Object.assign({\n\t\t\t\t\tpath: sKey,\n\t\t\t\t\tsearchSelected: true\n\t\t\t\t}, oField));\n\t\t\tthis._oViewModel.setProperty(\"/search/fields\", aSearchFields);\n\t\t}"
]
| [
"0.5737411",
"0.5457191",
"0.5374542",
"0.5360257",
"0.53312933",
"0.5265744",
"0.51736456",
"0.51610607",
"0.50864327",
"0.50282425",
"0.49672687",
"0.49584824",
"0.49451214",
"0.4941018",
"0.49217084",
"0.4913216",
"0.4911907",
"0.48920283",
"0.48672137",
"0.48573485",
"0.4839204",
"0.48315358",
"0.48176366",
"0.48048216",
"0.48037085",
"0.479652",
"0.4777053",
"0.47769243",
"0.47728568",
"0.47669157"
]
| 0.5877177 | 0 |
Render a success TwiML and optionally sends notifications To notify via SMS: req.query.notify = sms:4081234567 req.query.notify = 4081234567 To notify via yo: req.query.notify = yo:recipient:apikey | function renderSuccess(req, res, identifier) {
var notifyQuery = req.query.notify || '';
var notify = notifyQuery.split(':');
var protocol = notify[0];
var successParams = parseNotify(req, identifier);
return res.render('success', successParams);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sendNotification() {\n // overrides default that no notifs will show when app is in foregruond\n Notifications.setNotificationHandler({\n handleNotification: async () => ({\n shouldShowAlert: true\n })\n });\n\n Notifications.scheduleNotificationAsync({\n content: {\n title: 'Your Service Request',\n body: `Your request for ${selectedService}, ${date} has been submitted`\n },\n // causes notif to fire immed. cd also set to future or repeat or both\n trigger: null\n });\n }",
"function showNotificationWhenSuccess(res) {\n iSuccess.css('display', 'inline-block');\n iError.css('display', 'none');\n iMessage.html(res);\n notification.removeClass('error').addClass('success slide-left');\n notification.css('display', 'flex');\n }",
"function display_notification(response) {\n $.notify({\n message: response[\"message\"]\n }, {\n type: (response[\"status\"] ? 'success' : 'danger'), \n placement: {\n from: \"bottom\",\n align: \"center\"\n }\n })\n}",
"function notify(text, type, translate) {\n\tif (typeof type == undefined) {\n\t\ttype = 'info';\n\t}\n\tif (typeof translate == undefined) {\n\t\ttranslate = true;\n\t}\n\t$('#notifications').append('<div data-alert class=\"alert-message fade in ' + type + '\"><a class=\"close\" href=\"#\">×</a><p>' + (translate ? str(text) : text ) + '</p></div>');\n}",
"function respondSimpleMessage(res, message) {\n res.render('simpleStatus', { \n pageTitle: message,\n status: message,\n bodyID: 'body_simplestatus',\n mainTitle: message\n });\n}",
"function notify(json){\r\n\t//console.log(json);\r\n\tnotification = json2message(json); //Convert error message into readable message\r\n\tnotification.message = prettyPiget(notification.message); //Prettify piget\r\n\tdisplay_alert(notification.message, notification.type); //Display notifications\r\n}",
"function notify(string) {\n // Construct email template for notifications\n // Must have to, subject, htmlBody\n var emailTemplate = {\n to: emailForNotify,\n subject: accountName,\n htmlBody: \"<h1>Comporium Media Services Automation Scripts</h1>\" + \"<br>\" + \"<p>This account has encountered an issue</p>\" + accountName +\n \"<br>\" + \"<p>The issue is with this campaign: </p>\" + campaignName + \"<br>\" + \"<p>This is what is wrong - </p>\" + \"<br>\"\n + string + \"<br>\" + \"Ads Disapproved = \" + adDisapproval +\"<p>If something is incorrect with this notification please forward this email to [email protected]. Thanks!</p>\"\n }\n MailApp.sendEmail(emailTemplate);\n }",
"function notify() {\n console.log(\"fire alarm\");\n\n notifySMS();\n\n var payload = { value: \"fire alarm\", datetime: new Date().toISOString() };\n datastore.log(config, payload);\n mqtt.log(config, payload);\n}",
"function notificationToMentor(obj,callback) {\n if(typeof obj === \"object\"){\n $.ajax({\n type: 'POST',\n data: obj,\n url: '/notifications/notificationtomentor',\n dataType: 'JSON'\n }).done(function( response ) {\n\n callback(response);\n // Check for successful (blank) response\n if (response.msg === '') { //This condition needs to be modified\n // Show success message\n console.log(\"success\");\n\n //Make an entry in the notification collection/doc with the notification type \"\".\n } else {\n\n // If something goes wrong, alert the error message that our service returned\n //alert('Error: ' + response.msg);\n\n }\n }); \n }\n}",
"function notifyMe(data) {\n const textsPerType = {\n idle: {\n title: \"Don't stay idle!!!\",\n body: data => {\n return \"Hey there! You've been idle for \" + data.idleTime + ' minute(s)';\n }\n },\n done: {\n title: 'Timer complete',\n body: data => {\n return \"Feel free to take a break! Do it!\";\n }\n }\n };\n const texts = textsPerType[data.type];\n // Request permission if not yet granted\n if (Notification.permission !== \"granted\") {\n Notification.requestPermission();\n }\n else {\n var notification = new Notification(texts.title, {\n icon: 'https://ares.gods.ovh/img/Tomato_icon-icons.com_68675.png',\n body: texts.body(data),\n });\n\n notification.onclick = function () {\n window.open(\"http://stackoverflow.com/a/13328397/1269037\"); \n };\n }\n }",
"function notify(req, res) {\n News.findOne({\n isNotified: false\n }, function(err, result) {\n if (err || !result) {\n console.log(err);\n return res.status(400).send(err);\n } \n console.log(result);\n notifier.sendNewsToUsers(result, () => {\n console.log('done')\n News.findByIdAndUpdate(result._id, {$set:{\n isNotified: true\n }}, function(err) {\n console.log(err)\n res.send('Success');\n })\n })\n });\n}",
"function notify(string) {\n // Construct email template for notifications\n // Must have to, subject, htmlBody\n var emailTemplate = {\n to: emailForNotify,\n subject: accountName,\n htmlBody: \"<h1>Comporium Media Services Automation Scripts</h1>\" + \"<br>\" + \"<p>This account has encountered an issue</p>\" + accountName +\n \"<br>\" + \"<p>The issue is with this campaign: </p>\" + campaignName + \"<br>\" + \"<p>This is what is wrong - </p>\" + \"<br>\"\n + string + \"<p>Total Impressions Currently: \" + avgImpressions + \"<br>\" +\"<p>If something is incorrect with this notification please reply to this email. Thanks!</p>\"\n }\n MailApp.sendEmail(emailTemplate);\n }",
"function notifySMS() {\n if (!config.TWILIO_ACCT_SID || !config.TWILIO_AUTH_TOKEN) {\n return;\n }\n\n // only send an SMS every 1 minute\n if (smsSent) {\n return;\n }\n\n var opts = { to: config.NUMBER_TO_SEND_TO,\n from: config.TWILIO_OUTGOING_NUMBER,\n body: \"fire alarm\" };\n\n // send SMS\n twilio.sendMessage(opts, function(err, response) {\n if (err) { return console.error(\"err:\", err); }\n console.log(\"SMS sent\", response);\n });\n\n smsSent = true;\n setTimeout(function() {\n smsSent = false;\n }, 1000 * 60);\n}",
"success(notification) {\n notification = normalize(notification, \"success\");\n return notification;\n }",
"function showNewNotification(subject,body,link,date,notification_id,status_id,receiver_id) {\n\n $('#notificationModal .modal-title').text(subject);\n $('#notificationModal .modal-body').html(body + '<br /><br /><a href=\"' + link + '\">' + link + '</a>');\n $('#notificationModal').modal();\n\n // Mark as read & update totals\n $.ajax({\n url: notificationsApiPath + '/notifications/' + notification_id,\n dataType: 'json',\n method: 'PUT',\n data: {\n receiver_id: receiver_id,\n status_id: status_id\n },\n beforeSend: function (xhr) {\n xhr.setRequestHeader('Authorization', accessToken());\n },\n complete: function () {\n getNewNotifications();\n // getNotifications();\n }\n });\n}",
"function updateNotification(data){\n \n if(data.notification[0]['new'].length)\n {\n //console.log(' send notification receive status to server',data);\n data.action_flag = 'update';\n data.submitted = 1;\n delete data.initial_flag;\n socket.emit('getsurveylist',data);\n }\n }",
"function Nitication(titles,messages)\n{\n notifier.notify({\n title: titles,\n message: messages,\n }, function (err, response) {\n // Response is response from notification\n });\n}",
"function showNotification(subject, text, url, timestamp) {\n $('#notificationModal .modal-title').text(subject);\n $('#notificationModal .modal-body').html(text + '<br /><br /><a href=\"' + url + '\">' + url + '</a>');\n // Show modal\n $('#notificationModal').modal();\n\n // Mark as read & update totals\n $.ajax({\n url: notificationsPath + '/' + integerID + '/' + timestamp,\n dataType: 'json',\n method: 'POST',\n complete: function () {\n // Get notifications\n getNotifications();\n }\n });\n}",
"function slackSend() {\n var total = 0\n var attachments = []\n var statusColor\n Object.keys(stats).map(function(objectKey, i) {\n total += stats[objectKey][0]\n if (stats[objectKey][0] > stats[objectKey][3]) {\n statusColor = disqusRed\n statusIcon = \"🔥\"\n } else if (stats[objectKey][0] <= 5) {\n statusColor = disqusGreen\n statusIcon = \":partyporkchop:\"\n } else {\n statusColor = disqusGreen\n statusIcon = \"🆒\"\n }\n attachments.push({\n \"fallback\": stats[objectKey][0] + \" total\" + stats[objectKey][1] + \" new\" + stats[objectKey][2] + \" open\",\n \"color\": statusColor, \n \"title\": statusIcon + \" \" + objectKey + \": \" + stats[objectKey][0],\n \"text\": stats[objectKey][1] + \" new, \" + stats[objectKey][2] + \" open\"\n })\n });\n \n let statusMessage = {\n \"response_type\": \"in_channel\",\n \"text\": total + \" total cases right now.\",\n \"attachments\": attachments\n }\n // depending on request origin, also send the response as webhook for daily notifications\n if (type === 'notification') {\n webhook({text:\"Morning report incoming!\"});\n webhook(statusMessage);\n }\n res.send(statusMessage);\n // TODO Write function that stores this data to database\n //store(stats);\n }",
"function respond(message) {\n var twiml = new MessagingResponse();\n twiml.message(message);\n res.type('text/xml');\n res.send(twiml.toString());\n }",
"function showNotification(msg, type) {\n if (!(new RegExp(/^(success|normal|error|warning)$/).test(type))) {\n type = \"normal\";\n }\n msg = ScapString(msg);\n\n if (type === \"success\") {\n $.growl.notice({ message: msg });\n } else if (type === \"error\") {\n $.growl.error({ message: msg });\n } else if (type === \"warning\") {\n $.growl.warning({ message: msg });\n } else {\n $.growl({ title: \"Information\", message: msg });\n }\n}",
"async function sendSMS(req, res) {\n const {contactId} = req.params;\n const response = await autopilot.journeys.add('0001', xss(contactId));\n console.log(response);\n res.success();\n}",
"static notifySuccess()\n\t\t{\n\t\t\tthis.notify(NotificationFeedbackType.Success);\n\t\t}",
"function twilioSend(res, data) {\n res.type('text/xml')\n res.send(data)\n}",
"function OnSuccessCallMaladie(data, status, jqXHR) {\n\t\t\tnotif(\"success\", \"Brief envoyé avec <strong>succès</strong> !\");\n\t\t}",
"function sendNotificationEmail(){\n \n var htmlBody = '<html><body>Your AdWords URL Checker Summary for ' + ACCOUNT_NAME + ' is available at ' + SPREADSHEET_URL + '.</body></html>';\n var date = new Date();\n var subject = 'AdWords URL Checker Summary Results for ' + ACCOUNT_NAME + ' ' + date;\n var body = subject;\n var options = { htmlBody : htmlBody };\n \n for(var i in NOTIFY) {\n MailApp.sendEmail(NOTIFY[i], subject, body, options);\n Logger.log(\"An Email has been sent.\");\n }\n}",
"function acceptNotification(email, name, appId) {\n //email = '[email protected]';\n //name = 'name';\n //appId = '222';\n \n var html = \"<p>Dear \"+name+\",\"+\"</p><p>We are happy to inform you that your iBoost application has been accepted.\"+\n \"</p><p> Please follow these next steps to officially register your team. Ensure you read through the information carefully, ALSO PLEASE SECURELY SAVE YOUR iBoost Team ID. You will need this throughout your time at iBoost\"+\n \n \"</p><p>Your iBoost Team ID: \"+appId+\"</p><p>Please click <a href='www.iboostzone.com/onboarding/registration'>here</a> to register your team at iBoost.<br><br><br><br><p>Best,</p><br><img src='cid:logo' height='50' width='150'>\";\n var template = HtmlService.createHtmlOutput(html).getContent();\n //Logger.log(template)\n MailApp.sendEmail(email, \"iBoost Application Review\",\"\", {htmlBody: template, inlineImages:{logo: imageLogo}});\n \n}",
"function notification(html) {\n\n\t$('.message-ajax #message-here').html(html);\n\t$('.message-ajax').show();\n\t$('.message-ajax').fadeOut(4000);\n}",
"function renderTicketMessage() {\n res.render('index', {title: 'Ticket Checker', message: message, errorMessage: errorMessage});\n }",
"function emailPending(id) {\n //Trigger email\n uri = \"/remindPayment/\"+id;\n $.getJSON(uri, function( data ) {\n if (data.status = \"TRUE\") {\n alert(\"A email notification has been sent\")\n } else {\n alert(\"An Error occurred\")\n }\n });\n}"
]
| [
"0.5794008",
"0.5759697",
"0.55709374",
"0.55594426",
"0.55066866",
"0.5472384",
"0.5464021",
"0.54527056",
"0.54133725",
"0.5389886",
"0.5381415",
"0.5357388",
"0.533699",
"0.5305945",
"0.5287527",
"0.5271591",
"0.52711457",
"0.52659965",
"0.52626544",
"0.5260453",
"0.5222309",
"0.51904666",
"0.518942",
"0.5171512",
"0.51713425",
"0.51636755",
"0.5162745",
"0.5152761",
"0.5148935",
"0.51435995"
]
| 0.6763276 | 0 |
saves th customer to the localstorage and rettturns customer overview state | _saveCustomer(){
if (Object.keys(this.customer).length === 7) {
this.storage.setData('customers', this.customer, this.formState);
this._cancel();
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getCustomer(){\n return(\n this.formState ?\n this.storage.getItem('customers', this.customerId) : {}\n )\n }",
"function CustomerLocal(customer){\n localStorage.clear();\n localStorage.setItem(\"customerId\", parseInt(customer.id));\n localStorage.setItem(\"customerEmail\", customer.email);\n if(customer.id == 1){\n window.location.href = \"ManagerProduct.html\";\n }\n else {\n window.location.href = \"CustomerIndex.html\";\n }\n}",
"saveData(){\n\t\t\t\tlocalStorage.clear();\n\t\t\t\tlet postData = {\n\t\t\t\t\t\t\t\t\t invoice: {\n\t\t\t\t\t\t\t\t\t customers: [\n\t\t\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t\t name: this.state.name,\n\t\t\t\t\t\t\t\t\t email: this.state.email,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdate: window.selectedDate,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tamountTotal: this.state.amountTotal.toFixed(2),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlineItems: this.state.lineItemsArray\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\tlocalStorage.setItem('storeData', JSON.stringify(postData));\n\t\t\t\tnotify.show(\"Invoice successfully saved/sent\", \"success\", 2000,\"#0E1717\");\n\t\t\t\twindow.setTimeout(function(){location.reload()},1000)\n\t\t}",
"function on_customer_save() {\n var username = $(\"#widget-customers-manage input#username\").val();\n var selected_type = $(\"#user_type option:selected\").val();\n afrimesh.customers.generate(username, selected_type, 0, function(error, result) {\n console.debug(\"Inserted: \" + dump_object(result[0]));\n $(\"ul#menu ul#customers li#manage\").click();\n });\n }",
"function saveCustomerData(form){\n // pick the data from the inputs\n let first = $(\"input[name=first]\").val();\n let email = $(\"input[name=email]\").val();\n let products = $(\"select[name=products]\").val();\n let quantity = $(\"input[name=quantity]\").val();\n\n // store the data in the object\n let CustomerData = {\n first: first,\n\t\temail: email,\n products:products,\n quantity:quantity\n\t};\n console.log(CustomerData);\n //stroing all the input in the local variable\n\tlocalStorage[\"CustomerData\"]=JSON.stringify(CustomerData);\n form.submit();\n}",
"function finish() {\n const customer = {\n fullName: fullName.value,\n identifyCard: identifyCard.value,\n birthday: birthday.value,\n email: email.value,\n address: address.value,\n customerType: customerType.value,\n discount: discount.value,\n quantityInclude: quantityInclude.value,\n rentDays: rentDays.value,\n typeOfService: typeOfService.value,\n typeOfRoom: typeOfRoom.value,\n totalPay: totalPay.innerHTML,\n };\n customers.push(customer);\n console.log(customers);\n displayCustomer();\n editData();\n}",
"function storingBottlesaAndState(){\n\n\t\tvar purchaseDetails = {\n\t\t\t\n\t\t\tbottleTotal: quantitySelected(),\n\t\t\tstateChosen: document.getElementById(\"selectStateOption\").value\n\t\t};\n\t\t\n\t\tvar json = JSON.stringify(purchaseDetails);\n\t\tlocalStorage.setItem(\"purchaseDetails\", json);\n\t} // End localStorage ",
"function storeCityInfo() {\n localStorage.setItem('cities', JSON.stringify(cities));\n }",
"_save() {\n if (this.store && localStorage) {\n localStorage.setItem(this.store, JSON.stringify(this.records));\n }\n }",
"function storeOpportunityDetails(opportunityObj){\n\tlocalStorage.konyOpportunityDetails = opportunityObj; //storing the corresponding opportunity details in localstorage\n\tchangePage('opportunitydetailspage','');\n}",
"function save() {\n localStorage.productData = JSON.stringify(Product.allProducts);\n localStorage.totalCounter = totalCounter;\n}",
"function storeCurrentCity() {\n\n localStorage.setItem(\"currentCity\", JSON.stringify(cityname));\n}",
"function saveCity() {\n localStorage.setItem(\"lscity\", JSON.stringify(cities));\n }",
"function storeCities(){\n localStorage.setItem(\"savedCity\", JSON.stringify(savedCity));\n }",
"function updateCustomer() {\n var cust = $scope.customer;\n\n CustomerService.save(cust)\n .success(function() {\n $location.path('/customer');\n $scope.status = 'Updated Customer! Refreshing customer list.';\n })\n .error(function(error) {\n $scope.status = 'Unable to update customer: ' + error.message;\n });\n }",
"updateCustomer() {\r\n\t\treturn null\r\n\t}",
"function saveManageBusinessFields() {\n // Save business details in local Storage\n var businessName = document.getElementById('businessName').value;\n if (businessName != null) {\n localStorage.setItem('businessName', businessName);\n }\n\n var businessPhone = document.getElementById('businessPhone').value;\n if (businessPhone != null) {\n localStorage.setItem('businessPhone', businessPhone);\n }\n\n var businessAddress = document.getElementById('set-address').value;\n if (businessAddress != null) {\n localStorage.setItem('businessAddress', businessAddress);\n }\n}",
"updateCustomers(state, payload){\n state.customers = payload;\n }",
"function viewcustomer(a) {\n $(\".inventorydisp .unactivate\").toggleClass(\"deactivate unactivate\");\n $(\"#customer-list .deactivate\").toggleClass(\"deactivate\");\n /*$(\".customerdisp .unactivate\").toggleClass(\"deactivate\")*/\n $(\"li.actparent\").toggleClass(\"actparent\");\n if ($(\".inventorydisp .tab1\").css(\"display\") == \"none\") {\n $(\".inventorydisp .tab1\").toggle();\n $(\".inventorydisp .tab2\").toggle();\n }\n $(\".customer_name.act\").toggleClass(\"act\");\n //name = $(\".username.act\").html()\n $(a).find(\".customer_name\").toggleClass(\"act\");\n $(a).toggleClass(\"actparent\");\n name = $(\".customer_name.act\").html();\n console.log(name);\n $(\".customername\").text(name);\n $(\"#customerhistorypane\").css(\"opacity\", \"0\");\n dbOperations(\"inventory\", \"select_operation\", [\"customerinvoice\", \"customer\", String($(\".customername\").html())]);\n check_for_active_row(\"customer_name\", \"inventory\");\n $(\"#customerhistorypane\").animate({\n opacity: 1\n });\n}",
"function saveState() {\n const state = {\n cf: cfSelect.value,\n gf: gfSelect.value,\n mf: mfSelect.value,\n am: amSelect.value,\n };\n localStorage.setItem('collecting_together_form', JSON.stringify(state));\n }",
"saveToStorage() {\r\n localStorage.setItem('accountList', JSON.stringify(this._accountList));\r\n localStorage.setItem('settings', JSON.stringify(this._settings));\r\n localStorage.setItem('lastAssignedID', JSON.stringify(this._lastAssignedID));\r\n }",
"function updateStudent() {\n studentString = JSON.stringify(Student.all);\n localStorage.setItem(\"studentinfo\", studentString);\n}",
"function savCities() {\n localStorage.setItem(\"saveCity\", JSON.stringify(cities));\n }",
"function updateLocalStorage() {\r\n localStorage.setItem('transactions', JSON.stringify(transactions));\r\n}",
"function storeCases()\n{\n localStorage.setItem('caseList', JSON.stringify(caseList));\n}",
"function updateTransferView(customerData) {\n var customer = customerData.customers[0];\n transferSection.find('.glyphicon-customer-id').css(\"display\", \"\");\n transferSection.find('.searchButton').css(\"margin-left\", \"10px\");\n transferSection.find('#cancelReasonDropdown').css(\"display\", \"\");\n transferSection.find('#customerInfoPlaceholder').css(\"display\", \"\").text(\"\");\n if (typeof customer.email !== 'undefined' && customer.email !== null) {\n transferSection.find('#customerInfoPlaceholder').append(customer.name + \"<br>\" + customer.email + \n \"<br>\" + customer.address + \"<br>\" + customer.postNumber + \" \" + customer.postOffice);\n } else {\n transferSection.find('#customerInfoPlaceholder').append(customer.name + \"<br>\" + customer.address + \n \"<br>\" + customer.postNumber + \" \" + customer.postOffice);\n }\n \n }",
"function storeOpportunityDetails(opportunityObj){\n\tlocalStorage.konyOpportunityDetails = JSON.stringify(opportunityObj); //storing the corresponding opportunity details in localstorage\n\twindow.location.href = \"opportunityDetails.html\"; //redirecting to details page\n}",
"function updateLocalStorage(){\n localStorage.setItem('transactions',JSON.stringify(transactions));\n}",
"function storeCities(){\n localStorage.setItem(\"cities\", JSON.stringify(cities)); \n}",
"_commit() {\n localStorage.setItem('degree_plan', JSON.stringify(this.store));\n }"
]
| [
"0.7025117",
"0.6902631",
"0.68171936",
"0.67184013",
"0.66212994",
"0.6575759",
"0.6474541",
"0.64126784",
"0.63545185",
"0.6304186",
"0.62972",
"0.6262501",
"0.6237662",
"0.6190239",
"0.6167383",
"0.6164728",
"0.6147107",
"0.61382836",
"0.6115855",
"0.6076733",
"0.6071015",
"0.6065002",
"0.60557806",
"0.60417897",
"0.602839",
"0.60263526",
"0.601496",
"0.60109836",
"0.6009395",
"0.5987644"
]
| 0.7455452 | 0 |
if formState is true we are editing the customer and gets the data form the local storage. else we are creating new customer. | getCustomer(){
return(
this.formState ?
this.storage.getItem('customers', this.customerId) : {}
)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_saveCustomer(){\n if (Object.keys(this.customer).length === 7) {\n this.storage.setData('customers', this.customer, this.formState);\n this._cancel();\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 }",
"updateFormFromStorage() {\n // check for data if none return\n let data = localStorage.getItem('formData');\n if (!data) {\n this.setTransactions([]);\n // Looks like new user without data show tips modal.\n setTimeout(() => $('#tipsModal').modal(), 10000);\n return;\n }\n this.setForm(JSON.parse(data));\n // set the interface (transactions) options on the form\n this.setFormTransactions(JSON.parse(localStorage.getItem('transactions')));\n }",
"function saveCustomerData(form){\n // pick the data from the inputs\n let first = $(\"input[name=first]\").val();\n let email = $(\"input[name=email]\").val();\n let products = $(\"select[name=products]\").val();\n let quantity = $(\"input[name=quantity]\").val();\n\n // store the data in the object\n let CustomerData = {\n first: first,\n\t\temail: email,\n products:products,\n quantity:quantity\n\t};\n console.log(CustomerData);\n //stroing all the input in the local variable\n\tlocalStorage[\"CustomerData\"]=JSON.stringify(CustomerData);\n form.submit();\n}",
"render() {\n const {properties} = this.props;\n const {\n onChangeFirstName, customerInfo, onChangeLastName, onChangeEmail, onChangePhone,\n onChangeShippingAddress, onSaveCustomer\n } = properties;\n return (\n <div className=\"container\">\n <h2>Customer</h2>\n <div className=\"form-group\">\n <label htmlFor=\"usr\">Name:</label>\n <input type=\"text\" value={customerInfo.firstName} className=\"form-control\" id=\"usr\" onChange={\n ({target: {value}}) => {\n onChangeFirstName(value)\n }\n }/>\n </div>\n <div className=\"form-group\">\n <label htmlFor=\"pwd\">Last Name:</label>\n <input type=\"text\" value={customerInfo.lastName} className=\"form-control\" id=\"pwd\"\n onChange={({target: {value}}) => {\n onChangeLastName(value)\n }}/>\n </div>\n <div className=\"form-group\">\n <label htmlFor=\"pwd\">Email:</label>\n <input type=\"text\" value={customerInfo.email} className=\"form-control\" id=\"pwd\"\n onChange={({target: {value}}) => {\n onChangeEmail(value)\n }}/>\n </div>\n <div className=\"form-group\">\n <label htmlFor=\"pwd\">Phone</label>\n <input type=\"text\" value={customerInfo.phone} className=\"form-control\" id=\"pwd\"\n onChange={({target: {value}}) => {\n onChangePhone(value)\n }}/>\n </div>\n <div className=\"form-group\">\n <label htmlFor=\"pwd\">Shipping Address</label>\n <input type=\"text\" value={customerInfo.shippingAddress} className=\"form-control\" id=\"pwd\"\n onChange={({target: {value}}) => {\n onChangeShippingAddress(value)\n }}/>\n </div>\n <button type=\"text\" className=\"btn btn-primary\" onClick={() => onSaveCustomer(customerInfo)}>Save customer\n </button>\n </div>\n );\n }",
"function formCustomer(value){\n let kode_customer = $('#kode_customer').val(value.kode_customer);\n let nama_customer = $('#nama_customer').val(value.nama_customer);\n let nama_pimpinan = $('#nama_pimpinan').val(value.nama_pimpinan);\n let alamat = $('#alamat').val(value.alamat);\n let kode_provinsi = $('#kode_provinsi').val(value.kode_provinsi);\n let kode_kabupaten = $('#kode_kabupaten').val(value.kode_kabupaten);\n let sales_group = $('#sales_group').val(value.sales_group);\n let no_telepon = $('#no_telepon').val(value.no_telepon);\n let npwp = $('#npwp').val(value.npwp);\n let email = $('#email').val(value.email);\n let active = $('#active').val(value.active);\n }",
"addCustomer() {\n if (this.validationService.isFormValid()) // check the modal form if its data is valid.\n {\n let type = this.state.type;\n // call external api to add a new customer\n this.CustomerService.add(type[\"required\"], type[\"email\"], type[\"number\"], type[\"activated\"])\n .then(res => {\n var id = res.id;\n let data = this.state.data;\n data.push(this.produceCustomer(id, type[\"required\"], type[\"email\"], type[\"number\"], type[\"activated\"], 0));\n this.setState({data});\n let options = {\n place: \"tr\",\n message: \"A new customer is added successfully.\",\n type: \"info\",\n icon: \"now-ui-icons ui-1_bell-53\",\n autoDismiss: 3\n };\n this.refs.notificationAlert.notificationAlert(options);\n });\n this.setState({ // close the modal\n modal: !this.state.modal\n });\n }\n }",
"renderCreateForm() {\n return (\n <form onSubmit={this.handleSave} > \n <Errors errors={this.state.errors} />\n \n <div className=\"form-group row\" >\n <input type=\"hidden\" name=\"id\" value={this.state.customers.id} />\n </div>\n < div className=\"form-group row\" >\n <label className=\" control-label col-md-12\" htmlFor=\"Name\">First Name</label>\n <div className=\"col-md-4\">\n <input className=\"form-control\" type=\"text\" name=\"firstName\" defaultValue={this.state.customers.firstName} required onChange={(evt) => this.setState({ firstName: evt.target.value })} />\n </div> \n </div >\n < div className=\"form-group row\" >\n <label className=\" control-label col-md-12\" htmlFor=\"Name\">Last Name</label>\n <div className=\"col-md-4\">\n <input className=\"form-control\" type=\"text\" name=\"lastName\" defaultValue={this.state.customers.lastName} required onChange={(evt) => this.setState({ lastName: evt.target.value })}/>\n </div> \n </div >\n < div className=\"form-group row\" >\n <label className=\" control-label col-md-12\" htmlFor=\"Name\">Date of birth</label>\n <div className=\"col-md-4\">\n <input className=\"form-control\" type=\"date\" name=\"dateOfBirth\" defaultValue={this.state.customers.dateOfBirth} required onChange={(evt) => this.setState({ dateOfBirth: evt.target.value })} />\n </div> \n </div >\n <div className=\"form-group\">\n <button type=\"submit\" className=\"btn btn-primary\">Save</button>\n <button className=\"btn\" onClick={this.handleCancel}>Cancel</button>\n </div >\n </form >\n )\n }",
"handleSave(event) {\n event.preventDefault(); \n const data = new FormData(event.target);\n // PUT request for Edit customer. \n if (this.state.customers.id) {\n var id = this.state.customers.id;\n fetch('api/Customer/Edit/'+id, {\n method: 'PUT',\n body: data,\n })\n .then((response) => {\n if (response.ok) {\n this.props.history.push(\"/\");\n }\n return response.json();\n })\n .then((responseJson) => { \n this.setState({ errors: this.handleErrors(responseJson) });\n })\n .catch(function (error) {\n this.setState({ errors: error });\n }.bind(this));\n }\n // POST request for Add customer. \n else {\n fetch('api/Customer/Create', {\n method: 'POST',\n body: data,\n }) \n .then((response) => {\n if (response.ok) {\n this.props.history.push(\"/\"); \n }\n return response.json();\n })\n .then((responseJson) => { \n this.setState({ errors: this.handleErrors(responseJson) });\n }) \n .catch(function (error) {\n this.setState({ errors: error });\n }.bind(this)); \n }\n }",
"updateCustomer() {\r\n\t\treturn null\r\n\t}",
"function editCust(id){\n $.getJSON(\"customers/singleCustomer\",{\n queryString: id\n }, \n function(data){\n if(data.length > 0 && typeof(data) != 'undefined'){\n var token = \"{{ csrf_token() }}\";\n var custForm = \"<button class='uk-modal-close' type='button' style='float: right' uk-close></button><br><div class='alert alert-danger' id='requiredFields' hidden>\\n\\\n <p>The following fields are required before the account can be created.</p>\\n\\\n </div>\\n\\\n <div id='issueDrops'>\\n\\\n <form class='uk-grid-small uk-form-horizontal' method='post' uk-grid action='/editCustomer' >\\n\\\n <ul class='uk-subnav uk-subnav-pill' uk-switcher>\\n\\\n <li><a href='#'>Customer Information</a></li>\\n\\\n <li><a href='#'>System Information</a></li>\\n\\\n <li><a href='#'>Accounts Information</a></li>\\n\\\n <li><a href='#'>Wholesaler Link Information</a>\\n\\\n </ul>\\n\\\n <ul class='uk-switcher uk-margin' style='width: 100%'>\\n\\\n <li>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Account Code</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].CustCode + \"' + +'' value='\" + data[0].CustCode + \"' name='code' required>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Company Name</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].CustName + \"' name='companyName' value='\" + data[0].CustName + \"' required>\\n\\\n </div>\\n\\\n </div><br>\\n\\\n \\n\\<input type='hidden' name='id' value='\" + id + \"'\\n\\\n <br>\\n\\\n <input type='hidden' name='_token' value='\" + token + \"'>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Street 1</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].Street1 + \"' name='street1' value='\" + data[0].Street1 + \"'required>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Street 2</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].Street2 + \"' name='street2' value='\" + data[0].Street2 + \"' >\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Town</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].Town + \"' name='town' value='\" + data[0].Town + \"' required>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>County</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].County + \"' value='\" + data[0].County + \"' name='county' required>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Postcode</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].Postcode + \"' value='\" + data[0].Postcode + \"' name='postcode' required>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Main Phone</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].MainPhone + \"' value='\" + data[0].MainPhone + \"' name='mainphone' required>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Fax</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].Fax + \"' value='\" + data[0].Fax + \"' name='fax' >\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Main Email</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='email' placeholder='\" + data[0].MainEmail + \"' value='\" + data[0].MainEmail + \"' name='mainemail' required>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Comments</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <textarea class='uk-textarea' rows='6' placeholder='\" + data[0].Comments + \"' value='\" + data[0].Comments + \"' name='comments' ></textarea>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Install Date</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='date' placeholder='\" + data[0].InstallDate + \"' value='\" + data[0].InstallDate + \"' name='install' >\\n\\\n </div>\\n\\\n </div>\\n\\\n </li>\\n\\\n <li>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Hosted Pulse?</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-checkbox' type='checkbox' name='hosted'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Stock?</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-checkbox' type='checkbox' name='stock'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>PulseStore?</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-checkbox' type='checkbox' name='pulseStore'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Terminal Server?</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-checkbox' type='checkbox' name='terminalserver' >\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>PulseOffice Version #</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].PulseVersion + \"' value='\" + data[0].PulseVersion + \"' name='pulseVersion'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>OPXML PC</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].OPXMLPC + \"' value='\" + data[0].OPXMLPC + \"' name='opxmlpc'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Sage PC</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].SageLinkPC + \"' value='\" + data[0].SageLinkPC + \"' name='sagepc'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>PulseLink PC</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].PulseLinkPC + \"' value='\" + data[0].PulseLinkPC + \"' name='pulselinkpc'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Sage Version #</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].SageVersion + \"' value='\" + data[0].SageVersion + \"' name='sagenum'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>PulseStore Shop #</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].PulseStoreShopNumber + \"' value='\" + data[0].PulseStoreShopNumber + \"' name='pulsestorenumber'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>PulseStore Password</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].PulseStorePassword + \"' value='\" + data[0].PulseStorePassword + \"' name='pulsestorepassword'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Special Upgrade Requirements</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <textarea class='uk-textarea' rows='6' placeholder='\" + data[0].SpecialUpgradeNotes + \"' value='\" + data[0].SpecialUpgradeNotes + \"' name='upgradeNotes' ></textarea>\\n\\\n </div>\\n\\\n </div>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Network Details</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <textarea class='uk-textarea' rows='6' placeholder='\" + data[0].NetworkDetails + \"' value='\" + data[0].NetworkDetails + \"' name='network' ></textarea>\\n\\\n </div>\\n\\\n </div>\\n\\\n </li>\\n\\\n <li>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Licence Expiry Date</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='date' placeholder='date' name='expiry'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Licence To Date</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='date' placeholder='date' name='licenceToDate'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>On hold?</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-checkbox' type='checkbox' name='onhold' >\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Date paid until</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='date' placeholder='\" + data[0].DatePaidTo + \"' value='\" + data[0].DatePaidTo + \"' name='paidto'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Licence Notes</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <textarea class='uk-textarea' rows='6' placeholder='\" + data[0].LicenceNotes + \"' value='' name='licenceNotes' ></textarea>\\n\\\n </div>\\n\\\n </div>\\n\\\n </li>\\n\\\n <li>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Vow Account #</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].VowAccNo + \"' value='\" + data[0].VowAccNo + \"' name='vowacc'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Vow Password</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].VowPasword + \"' value='\" + data[0].VowPassword + \"' name='vowpass'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Vow Discount %</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='number' min='0' max='100' placeholder='\" + data[0].VowDiscount + \"' value='\" + data[0].VowDiscount + \"' name='vowdisc'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Spicer Account #</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].SpicerAccNo + \"' value='\" + data[0].SpicerAccNo + \"' name='spicacc'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Spicers Password</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].SpicerPassword + \"' \" + data[0].SpicerPassword + \" name='spicpass'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Antalis Account #</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].AntalisAccNo + \"' value='\" + data[0].AntalisAccNo + \"' name='antacc'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Antalis Password</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].AntalisPassword + \"' value='\" + data[0].AntalisPassword + \"' name='antpass'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Truline Account #</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].TrulineAccNo + \"' value='\" + data[0].TrulineAccNo + \"' name='truacc'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Truline Password</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].TrulinePassword + \"' value='\" + data[0].TrulinePassword + \"' name='trupass'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Beta Account</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].BeteAccNo + \"' value='\" + data[0].BetaAccNo + \"' name='betaacc'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Beta Password</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].BetaPassword + \"' value='\" + data[0].BetaPassword + \"' name='betapass'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Exertis Account #</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].ExertisAccNo + \"' value='\" + data[0].ExertisAccNo + \"' name='exertacc'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Exertis Password</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].ExertisPassword + \"' value='\" + data[0].ExertisPassword + \"' name='exertpass'>\\n\\\n </div>\\n\\\n </div>\\n\\\n <br>\\n\\\n <div class='uk-width-1-2@s'>\\n\\\n <label class='uk-form-label' for='form-horizontal-text'>Buying Group</label>\\n\\\n <div class='uk-form-controls'>\\n\\\n <input class='uk-input' type='text' placeholder='\" + data[0].BuyingGroup + \"' value='\" + data[0].BuyingGroup + \"' name='buyinggroup'>\\n\\\n </div>\\n\\\n </div>\\n\\\n </li>\\n\\\n </ul>\\n\\\n <br>\\n\\\n <input type='submit' class='btn btn-primary' value='save' >\\n\\\n </form>\\n\\\n </div>\\n\\ \"; \n UIkit.modal.alert(\"<div id='editCustForm'><h3 style='text-align: center;'>Editing customer : \" + data[0].CustName + \"</h3><br> \" + custForm + \"</div>\");\n $('.uk-modal-dialog').css('width','80%');\n if(data[0].PulseStore == 1){\n $(\"input[name='pulseStore']\").prop('checked', true);\n }\n if(data[0].hosted == 1){\n $(\"input[name='hosted']\").prop('checked', true);\n }\n if(data[0].StockControl == 0){\n $(\"input[name='stock']\").prop('checked', true);\n }\n $('.uk-modal-footer').hide(); \n if(data[0].TerminalServer == 1){\n $(\"input[name='terminalserver']\").prop('checked', true);\n }\n } else {\n //made a whoops\n };\n }); \n}",
"function editCustomer() {\n let $row = jQuery(this).closest('tr');\n let $columns = $row.find('td');\n\n $(\"#addButton\").hide();\n $(\"#customer-form\").slideDown();\n $(\"#back-button\").show();\n $(\"#update-button\").show();\n $(\"#delete-button\").show();\n $(\"#submit-button\").hide();\n\n global_selectedCustomer = $columns[0].innerHTML;\n\n $(\"#input-name\").val($columns[1].innerHTML);\n $(\"#input-address\").val($columns[2].innerHTML);\n $(\"#input-city\").val($columns[3].innerHTML);\n $(\"#input-state\").val($columns[4].innerHTML);\n $(\"#input-zip\").val($columns[5].innerHTML);\n}",
"function updateCustomer() {\n var cust = $scope.customer;\n\n CustomerService.save(cust)\n .success(function() {\n $location.path('/customer');\n $scope.status = 'Updated Customer! Refreshing customer list.';\n })\n .error(function(error) {\n $scope.status = 'Unable to update customer: ' + error.message;\n });\n }",
"showEditForm(data) {\n const newData = {\n id: data.id,\n title: data.title,\n city: data.city_id,\n oldTitle: data.title\n };\n\n this.showCreateForm(newData);\n }",
"function goToCustomerEditPage() {\n $('#name').val(window.customerRecord.item.object.name);\n $('#location_number').val(window.customerRecord.item.object.location_number);\n $('#address').val(window.customerRecord.item.object.address);\n $('#city').val(window.customerRecord.item.object.city);\n $('#state').val(window.customerRecord.item.object.state);\n $('#zip').val(window.customerRecord.item.object.zip);\n $('#fax').val(window.customerRecord.item.object.fax);\n $('#contact').val(window.customerRecord.item.object.contact);\n $('#phone').val(window.customerRecord.item.object.phone);\n $('#email').val(window.customerRecord.item.object.email);\n $('textarea#cus_internal_notes').val(window.customerRecord.item.object.internal_notes);\n $('#customer_id').val(window.customerRecord.item.object.id);\n }",
"handleEdit(id){\n this.setState({showEditForm: true, applicantIdToEdit: id});\n sessionStorage.setItem('showEditForm', 'true');\n sessionStorage.setItem('applicantIdToEdit', id);\n }",
"handleSubmit(e) {\n\n e.preventDefault();\n\n // get form data\n const name = document.getElementById('name');\n const surname = document.getElementById('surname');\n const email = document.getElementById('email');\n const age = document.getElementById('age');\n const city = document.getElementById('city');\n\n // create a copy of customer data\n let newCustomerData = [...this.state.customerData];\n\n console.log(newCustomerData);\n\n let newCustomer = {\n name: name.value,\n surname: surname.value,\n email: email.value,\n age: age.value,\n city: city.value\n }\n\n newCustomerData.unshift(newCustomer);\n\n this.setState({\n customerData: newCustomerData\n })\n\n // reset form data\n name.value = '';\n surname.value = '';\n email.value = '';\n age.value = '';\n city.value = '';\n\n // close modal\n this.setState({\n isModalOpen: false\n });\n\n // remove body fixed class\n document.body.classList.remove('is-fixed');\n\n }",
"function CustomerLocal(customer){\n localStorage.clear();\n localStorage.setItem(\"customerId\", parseInt(customer.id));\n localStorage.setItem(\"customerEmail\", customer.email);\n if(customer.id == 1){\n window.location.href = \"ManagerProduct.html\";\n }\n else {\n window.location.href = \"CustomerIndex.html\";\n }\n}",
"function on_customer_save() {\n var username = $(\"#widget-customers-manage input#username\").val();\n var selected_type = $(\"#user_type option:selected\").val();\n afrimesh.customers.generate(username, selected_type, 0, function(error, result) {\n console.debug(\"Inserted: \" + dump_object(result[0]));\n $(\"ul#menu ul#customers li#manage\").click();\n });\n }",
"function customerAddSuccess(customer) {\n customerAddRow(customer);\n formClear();\n}",
"function saveCustomers(customerId){ \n $scope.editCustomerValues = {\n \"action\": \"edit\",\n \"cAddress\": $scope.customer.customerAddress,\n \"cContact\": $scope.customer.customerContact,\n \"cDOB\": $scope.customer.customerDOB,\n \"cEmail\": $scope.customer.customerEmail,\n \"cID\":customerId,\n \"cName\":$scope.customer.customerName\n };\n $scope.customer.action = \"edit\";\n $http.post('/customerActions',$scope.editCustomerValues).success(function(response){\n if(response == '\"fail\"' || response == '\"junk data\"'){\n swal({title: \"Not edited!\", text: \"Please retry\", type: \"error\", confirmButtonText: \"ok\" });\n }\n else if(response == '\"connection_error\"'){\n $scope.isLoading = null;\n swal({title: \"Connection Error!\", text: \"Connection could not be established\", type: \"error\", confirmButtonText: \"ok\" });\n }\n else{\n for (var i = 0; i < $scope.customers.length; i++){\n if ($scope.customers[i].Id == customerId){\n $scope.customers[i].Name = $scope.customerName;\n $scope.customers[i].City = $scope.customerCity;\n }\n }\n $scope.onEdit = null;\n }\n });\n }",
"handleCustomerNameChange(event) {\n //Error message should disappear once corrected\n //Invoice sent message should disappear when starting new invoice\n this.setState({\n errorMessage: '',\n showErrorMessage: false,\n invoiceSent:false\n })\n //Validate customer name\n if(!validCustomerName(event.target.value)){\n this.setState({\n errorMessage: 'Customer name can only contain letters A-Z, a-z and spaces',\n showErrorMessage: true\n })\n return;\n }\n let currentCustomerInfo = this.state.customerInfo;\n currentCustomerInfo.customerName = event.target.value;\n this.setState({\n customerInfo: currentCustomerInfo\n });\n }",
"function CollectData(customer) {\n try {\n if(customer.name){customerModal.name = customer.name};\n if(customer.address){customerModal.address = customer.address};\n if(customer.phone){customerModal.phone = customer.phone};\n } catch (e) {\n console.log('customer.field undefined now');\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 finish() {\n const customer = {\n fullName: fullName.value,\n identifyCard: identifyCard.value,\n birthday: birthday.value,\n email: email.value,\n address: address.value,\n customerType: customerType.value,\n discount: discount.value,\n quantityInclude: quantityInclude.value,\n rentDays: rentDays.value,\n typeOfService: typeOfService.value,\n typeOfRoom: typeOfRoom.value,\n totalPay: totalPay.innerHTML,\n };\n customers.push(customer);\n console.log(customers);\n displayCustomer();\n editData();\n}",
"function onSubmit() {\n props.addCustomerModal(customerModal);\n }",
"function saveManageBusinessFields() {\n // Save business details in local Storage\n var businessName = document.getElementById('businessName').value;\n if (businessName != null) {\n localStorage.setItem('businessName', businessName);\n }\n\n var businessPhone = document.getElementById('businessPhone').value;\n if (businessPhone != null) {\n localStorage.setItem('businessPhone', businessPhone);\n }\n\n var businessAddress = document.getElementById('set-address').value;\n if (businessAddress != null) {\n localStorage.setItem('businessAddress', businessAddress);\n }\n}",
"function UpdateCustomers({match}) {\n const [values, setValues] = useState({\n firstName: \"\",\n lastName: \"\",\n email: \"\",\n phone: \"\",\n address: \"\",\n description: \"\",\n })\n\n useEffect(() => {\n if(match.params && match.params.pk)\n {\n CustomersAPI.getCustomer(match.params.pk).then((c)=> {\n setValues({\n firstName: c.first_name,\n lastName: c.last_name,\n email: c.email,\n phone: c.phone,\n address: c.address,\n description: c.description,\n })\n })\n }\n }, [])\n\n const handleChange = name => event => {\n setValues({ ...values, [name]: event.target.value });\n };\n\n function handleCreate() {\n console.log(\"handle create called\")\n CustomersAPI.createCustomer({\n \"first_name\": values.firstName,\n \"last_name\": values.lastName,\n \"email\": values.email,\n \"phone\": values.phone,\n \"address\": values.address,\n \"description\": values.description,\n }).then((result) => {\n alert(\"Customer created!!\")\n }).catch((error)=>{\n alert('There was an error! Please re-check your form.' + error);\n });\n }\n\n function handleUpdate(pk){\n CustomersAPI.updateCustomer(\n {\n \"pk\": pk,\n \"first_name\": values.firstName,\n \"last_name\": values.lastName,\n \"email\": values.email,\n \"phone\": values.phone,\n \"address\": values.address,\n \"description\": values.description\n }\n ).then((result)=>{\n alert(\"Customer updated!\");\n }).catch(()=>{\n alert('There was an error! Please re-check your form.');\n });\n }\n\n function handleSubmit(event) {\n if(match.params && match.params.pk){\n handleUpdate(match.params.pk);\n }\n else\n {\n handleCreate();\n }\n event.preventDefault();\n }\n return (\n <form onSubmit={handleSubmit}>\n <div className=\"form-group\">\n <label>\n First Name:</label>\n <input className=\"form-control\" type=\"text\"\n value={values.firstName}\n onChange={handleChange('firstName')}\n />\n\n <label>\n Last Name:</label>\n <input className=\"form-control\" type=\"text\"\n value={values.lastName}\n onChange={handleChange('lastName')}\n />\n\n <label>\n Phone:</label>\n <input className=\"form-control\" type=\"text\"\n value={values.phone}\n onChange={handleChange('phone')}\n />\n\n <label>\n Email:</label>\n <input className=\"form-control\" type=\"text\"\n value={values.email}\n onChange={handleChange('email')}\n />\n\n <label>\n Address:</label>\n <input className=\"form-control\" type=\"text\"\n value={values.address}\n onChange={handleChange('address')}\n />\n\n <label>\n Description:</label>\n <textarea className=\"form-control\"\n value={values.description}\n onChange={handleChange('description')}\n ></textarea>\n\n\n <input className=\"btn btn-primary\" type=\"submit\" value=\"Submit\" />\n </div>\n </form>\n );\n\n}",
"function handleChangeFields(event) {\n setNewCustomers({\n ...newCustomer,\n [event.target.name]: event.target.value,\n });\n }",
"handleEditChanges(event){\n this.setState({canSubmit: true});\n const field = event.target.name;\n const storeinformation = this.state.storeinformation;\n storeinformation[field] = event.target.value;\n\n if(!!this.state.errors[event.target.name]) {\n let errors = Object.assign({}, this.state.errors);\n delete errors[event.target.name];\n this.setState({errors});\n }\n var domainuniquekey = window.sessionStorage.getItem(\"domainuniquekey\");\n storeinformation[\"domainuniquekey\"] = domainuniquekey;\n //console.log(storeinformation);\n\n window.sessionStorage.setItem('storeinformation', JSON.stringify(storeinformation));\n}"
]
| [
"0.73254466",
"0.64708704",
"0.6376936",
"0.6292517",
"0.62639695",
"0.6226702",
"0.622496",
"0.6151249",
"0.6150682",
"0.614703",
"0.61087084",
"0.6080229",
"0.60107684",
"0.59823847",
"0.5976923",
"0.59622717",
"0.59557474",
"0.5948932",
"0.5936509",
"0.59264094",
"0.5919963",
"0.5903166",
"0.589976",
"0.5894067",
"0.5889249",
"0.5888318",
"0.5884978",
"0.58727115",
"0.5847789",
"0.58379793"
]
| 0.7083344 | 1 |
specifies which steps of the pathway to draw and draws them | function render() {
var ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.clientWidth, canvas.clientHeight);
var varList = document.getElementsByClassName("inner-flex-horiz");
//Draw each step of the pathway, including reversible and non-reversible steps
for (var i = 0; i < enzymeList.length; i++) {
getDotPos(i);
//set speed
if (i === 0) {
firstRectMidX = xCoords[i] * 75 + (canvas.clientWidth / 2 + 50);
firstRectMidY = yCoords[i] * 100;
}
if (revList[i].toLowerCase() === "reversible") {
var nextX;
var nextY;
if (i != enzymeList.length) {
nextX = xCoords[i+1] * 75 + (canvas.clientWidth / 2 + 50);
nextY = yCoords[i+1] * 100;
} else {
nextX = xCoords[i] * 75 + (canvas.clientWidth / 2 + 50);
nextY = yCoords[i] * 100;
}
revStep(substrateList[i][0], productList[i][0], enzymeList[i],
xCoords[i] * 75 + (canvas.clientWidth / 2 + 50), yCoords[i] * 100,
nextX, nextY, ctx, i);
} else {
notRevStep(substrateList[i][0], productList[i][0], enzymeList[i],
xCoords[i] * 75 + (canvas.clientWidth / 2 + 50), yCoords[i] * 100,
ctx, i);
}
if (varList[i].getAttribute("drawRect") === "true") {
ctx.beginPath();
ctx.rect(highlightRects[i][0], highlightRects[i][1], highlightRects[i][2],
highlightRects[i][3]);
ctx.stroke();
}
}
ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.fillStyle = "blue";
for (var i = 0; i < dotPositions.length; i++) {
ctx.moveTo(dotPositions[i][0] + 5, dotPositions[i][1]);
ctx.arc(dotPositions[i][0], dotPositions[i][1], 5, 0, 2 * Math.PI);
if (dotPositions[i].length === 4) {
ctx.moveTo(dotPositions[i][2] + 5, dotPositions[i][3]);
ctx.arc(dotPositions[i][2], dotPositions[i][3], 5, 0, 2 * Math.PI);
}
}
ctx.fill();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"debug( draw, steps=10, inc_dxdy=false, inc_dxdy2=false ){\r\n let prev = new Vec3();\r\n let pos = new Vec3();\r\n let dev = new Vec3();\r\n let t;\r\n\r\n // Draw First Point\r\n this.at( 0, prev );\r\n draw.pnt( prev, \"yellow\", 0.05, 1 );\r\n\r\n for( let i=1; i <= steps; i++ ){\r\n t = i / steps;\r\n\r\n //------------------------------------\r\n // Draw Step\r\n this.at( t, pos );\r\n draw\r\n .ln( prev, pos, \"yellow\" )\r\n .pnt( pos, \"yellow\", 0.05, 1 );\r\n\r\n //------------------------------------\r\n // Draw Forward Direction\r\n if( inc_dxdy ){\r\n this.at( t, null, dev );\r\n draw.ln( pos, dev.norm().scale( 0.4 ).add( pos ), \"white\" );\r\n }\r\n\r\n //------------------------------------\r\n // Draw Forward Direction\r\n if( inc_dxdy2 ){\r\n this.at( t, null, null, dev );\r\n draw.ln( pos, dev.norm().scale( 0.4 ).add( pos ), \"cyan\" );\r\n }\r\n\r\n //------------------------------------\r\n prev.copy( pos );\r\n }\r\n }",
"function draw() {\n if (controllers.free_flow_flag) {\n draw_step();\n }\n\n}",
"function draw() {\n const pathColor = (getComputedStyle(document.documentElement).getPropertyValue('--path') || '#ffffff').trim();\n\n const ctx = canvas.getContext(\"2d\");\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n\n const pathTransform = new DOMMatrix().scale(scaleFactor).multiply(transformFromMeter).multiplySelf(accountForFlip);\n let first = true;\n ctx.beginPath();\n ctx.lineWidth = 1;\n ctx.strokeStyle = pathColor;\n for (const coord of path) {\n const [xMeter, yMeter] = coord;\n const { x, y } = new DOMPoint(xMeter, yMeter).matrixTransform(pathTransform);\n if (first) {\n ctx.moveTo(x, y);\n first = false;\n }\n else {\n ctx.lineTo(x, y);\n }\n }\n ctx.stroke();\n }",
"function go_step_pressed(){\n draw_step();\n}",
"function animate(){\n\tdone = false;\n if(t<points.length-1 && visible){ \n\t\trequestAnimationFrame(animate); \n\t} else {\n\t\tif (!visible) {\n\t\t\treturn;\n\t\t}\n\t\t//continues to next lines if avaliable\n\t\tif (index < paths.length) {\n\t\t\tpoints = paths[index];\n\t\t\tindex++;\n\t\t\tt = 1;\n\t\t\tanimate();\n\t\t} else {\n\t\t\tdone = true;\n\t\t}\n\t}\n ctx.beginPath();\n\tctx.strokeStyle = \"white\";\n\t//draws path from prev way point to current\n ctx.moveTo(points[t-1].x,points[t-1].y);\n ctx.lineTo(points[t].x,points[t].y);\n ctx.stroke();\n\tctx.closePath();\n\t//increments paths\n t++;\n}",
"drawPath() {\n this.ctx.stroke();\n this.begin();\n }",
"addStep(closePoint, farPoint, edgePoint) {\n this.closePoints.push(closePoint);\n this.farPoints.push(farPoint);\n // this.edgePoints.push(edgePoint);\n \n let lastIndex = this.getCount() - 2;\n let currentIndex = this.getCount() - 1;\n if(lastIndex < 0) {lastIndex = 0;}\n \n let polygonDrawable = (new PolygonDrawable([this.farPoints[lastIndex], this.farPoints[currentIndex], this.closePoints[currentIndex], this.closePoints[lastIndex]])).setStyle(this.trailStyle.copy().setStep(this.trailStyle.getStep())).setLifespan(this.trailStyle.duration).setCamera(this.camera);\n \n // polygonDrawable.translate(Vector.subtraction(farPoint, closePoint).normalize(16));\n \n this.polygonDrawables.push(polygonDrawable);\n // this.edgePolygons.push((new PolygonDrawable([this.farPoints[lastIndex], this.farPoints[currentIndex], this.edgePoints[currentIndex], this.edgePoints[lastIndex]])).setStyle(ColorTransition.from(this.edgeStyle)).setLifespan(this.edgeStyle.duration).setCamera(this.camera));\n \n this.lifespan = Math.max(this.lifespan, this.trailStyle.duration, this.edgeStyle.duration);\n \n for(let i = 0; i < this.otherTrails.length; ++i) {\n let otherTrail = this.otherTrails[i];\n \n if(otherTrail.edgeWidth) {\n let vector = Vector.subtraction(farPoint, closePoint).normalize(otherTrail.edgeWidth);\n \n closePoint = farPoint;\n farPoint = vector.add(farPoint);\n \n if(otherTrail.edgeWidth < 0) {\n let x = closePoint;\n closePoint = farPoint;\n farPoint = x;\n }\n }\n \n otherTrail.addStep(closePoint, farPoint);\n }\n \n return this;\n }",
"function keyDownHandler(e) {\n if (e.keyCode === 39) {\n if (stepCount + 1 < steps.length) {\n stepCount++;\n for (i = 0; i < steps[stepCount][1].length; i++) {\n ctx.beginPath();\n ctx.moveTo(nodes[edges[steps[stepCount][1][i][0]][1]].xCord, nodes[edges[steps[stepCount][1][i][0]][1]].yCord);\n ctx.lineTo(nodes[edges[steps[stepCount][1][i][0]][2]].xCord, nodes[edges[steps[stepCount][1][i][0]][2]].yCord);\n ctx.strokeStyle = steps[stepCount][1][i][1];\n ctx.stroke();\n //three times to make up for bug in canvas that leaves some pixilation \n ctx.stroke();\n ctx.stroke();\n ctx.stroke();\n ctx.closePath();\n }\n\n for (i = 0; i < steps[stepCount][0].length; i++) {\n nodes[steps[stepCount][0][i][0]].colour = steps[stepCount][0][i][1];\n nodes[steps[stepCount][0][i][0]].value = steps[stepCount][0][i][2];\n }\n drawNodes();\n\n\n\n }\n } else if (e.keyCode === 37) {\n if (stepCount - 1 >= 0) {\n stepCount--;\n\n for (i = 0; i < steps[stepCount][1].length; i++) {\n ctx.beginPath();\n ctx.moveTo(nodes[edges[steps[stepCount][1][i][0]][1]].xCord, nodes[edges[steps[stepCount][1][i][0]][1]].yCord);\n ctx.lineTo(nodes[edges[steps[stepCount][1][i][0]][2]].xCord, nodes[edges[steps[stepCount][1][i][0]][2]].yCord);\n ctx.strokeStyle = steps[stepCount][1][i][1];\n ctx.stroke();\n //three times to make up for bug in canvas that leaves some pixilation \n ctx.stroke();\n ctx.stroke();\n ctx.stroke();\n ctx.closePath();\n }\n for (i = 0; i < steps[stepCount][0].length; i++) {\n nodes[steps[stepCount][0][i][0]].colour = steps[stepCount][0][i][1];\n nodes[steps[stepCount][0][i][0]].value = steps[stepCount][0][i][2];\n }\n drawNodes();\n\n\n\n }\n }\n //after every step change get the corresponding explination and display it to screen\n document.getElementById(\"descriptions\").innerHTML = stepsExplinations[stepCount];\n}",
"function drawPaths( obj, moveTO, midPoint, lineTO, isDashed, strokeColor, lineWidth, arrowDir, middleArrowHeadReq) {\n\t\tvar headlen = 10;\t// length of head in pixels\n\t\tobj.paint= function(_director, time) {\t\n\t\t\tvar dx = lineTO.x - moveTO.x;\n\t\t\tvar dy = lineTO.y - moveTO.y;\n\t\t\tif(dx == 0 && dy == 0) return;\n\t\t\tvar angle = Math.atan2(dy,dx);\n\t\t\tvar canvas = _director.ctx;\n\t\t\tcanvas.strokeStyle = strokeColor;\n\t\t\tcanvas.fillStyle = strokeColor;\n\t\t\tcanvas.lineWidth = lineWidth;\n\t\t\tcanvas.beginPath();\n\t\t\tif(arrowDir == 'leftArrowHead') {\n\t\t\t\tcanvas.moveTo( moveTO.x, moveTO.y);\t\t\t\n\t\t\t\tcanvas.lineTo( moveTO.x + headlen * Math.cos(angle-Math.PI/8), moveTO.y + headlen*Math.sin(angle-Math.PI/8));\n\t\t\t\tcanvas.lineTo( moveTO.x + headlen * Math.cos(angle+Math.PI/8), moveTO.y + headlen*Math.sin(angle+Math.PI/8));\n\t\t\t\tcanvas.fill();\n\t\t\t} else if(arrowDir == 'rightArrowHead'){\n\t\t\t\tcanvas.moveTo( lineTO.x, lineTO.y);\n\t\t\t\tcanvas.lineTo( lineTO.x - headlen * Math.cos(angle-Math.PI/8), lineTO.y - headlen*Math.sin(angle-Math.PI/8));\n\t\t\t\tcanvas.lineTo( lineTO.x - headlen * Math.cos(angle+Math.PI/8), lineTO.y - headlen*Math.sin(angle+Math.PI/8));\n\t\t\t\tcanvas.fill();\n\t\t\t}\t\t\n\t\t\tif(middleArrowHeadReq) {\n\t\t\t\tvar dx = midPoint.x - moveTO.x;\n\t\t\t\tvar dy = midPoint.y - moveTO.y;\n\t\t\t\tvar angle = Math.atan2(dy,dx);\n\t\t\t\tcanvas.fillStyle = strokeColor;\n\t\t\t\tcanvas.moveTo( (midPoint.x - 5), midPoint.y);\n\t\t\t\tcanvas.lineTo( (midPoint.x - 5) - headlen * Math.cos(angle-Math.PI/10), midPoint.y - headlen*Math.sin(angle-Math.PI/10));\n\t\t\t\tcanvas.lineTo( (midPoint.x - 5) - headlen * Math.cos(angle+Math.PI/10), midPoint.y - headlen*Math.sin(angle+Math.PI/10));\n\t\t\t\tcanvas.fill();\n\t\t\t}\n\t\t\t\n\t\t\tcanvas.moveTo(moveTO.x, moveTO.y);\n\t\t\tcanvas.lineTo(lineTO.x, lineTO.y);\n\t\t\n\t\t\t//canvas.lineJoin = 'round';\n\t\t\t//canvas.lineCap = 'round';\n\t\t\t//canvas.closePath();\t\n\t\t\tcanvas.stroke();\t\n\t\t};\t\n\t}",
"function draw_step(){\n // perform these many iterations\n for (let i = 0; i < controllers.iterations; i++) {\n // set the styling of points\n strokeWeight(controllers.pointStroke);\n // stroke(\"#EC7272\");\n stroke(255);\n // pick next points\n let next = random(points);\n // skip to match condition\n if (controllers.notPrevious && next === previous) continue;\n if (controllers.noAdjacent) {\n var indexOfPrev = points.indexOf(previous)\n if (abs(points.indexOf(next) - indexOfPrev) == 2) continue;\n }\n if (controllers.no2PreviousSame && earlier === previous){\n var indexOfPrev = points.indexOf(previous);\n var indexOfNext = points.indexOf(next);\n if (indexOfNext === mod_index(indexOfPrev-1)) continue;\n if (indexOfNext === mod_index(indexOfPrev+1)) continue;\n }\n // universal step, update current and plot it\n current.x = lerp(current.x, next.x, controllers.compressionRatio);\n current.y = lerp(current.y, next.y, controllers.compressionRatio);\n // if (points.indexOf(next)==0)\n // {\n // // current = rotation_x.mult(current.x).add(rotation_y.mult(current.y));\n // current = createVector(\n // p5.Vector.dot(createVector(0, 1), current),\n // p5.Vector.dot(createVector(-1, 0), current)\n // )\n // }\n point(current.x, current.y);\n // current is nesxt\n earlier = previous;\n previous = next;\n }\n}",
"function drawPath(path, ctx) {\n var turnTable = Object.freeze({\n LEFTUP: \"LEFTUP\", RIGHTUP: \"RIGHTUP\",\n LEFTDOWN: \"LEFTDOWN\", RIGHTDOWN: \"RIGHTDOWN\",\n HORIZ: \"HORIZ\", VERT: \"VERT\"\n });\n\n function determineTurn(before, current, after) {\n // b - c - a\n if (before.position.x + 1 == current.position.x &&\n before.position.y == current.position.y &&\n current.position.x + 1 == after.position.x &&\n current.position.y == after.position.y)\n {\n return turnTable.HORIZ;\n }\n // b\n // |\n // c\n // |\n // a\n if (before.position.x == current.position.x &&\n before.position.y + 1 == current.position.y &&\n current.position.x == after.position.x &&\n current.position.y + 1 == after.position.y)\n {\n return turnTable.VERT;\n }\n // a\n // |\n // b - c\n if (before.position.x + 1 == current.position.x &&\n before.position.y == current.position.y &&\n current.position.x == after.position.x &&\n current.position.y - 1 == after.position.y)\n {\n return turnTable.LEFTUP;\n }\n // b\n // |\n // c - a\n if (before.position.x == current.position.x &&\n before.position.y + 1 == current.position.y &&\n current.position.x + 1 == after.position.x &&\n current.position.y == after.position.y)\n {\n return turnTable.RIGHTUP;\n }\n // b - c\n // |\n // a\n if (before.position.x + 1 == current.position.x &&\n before.position.y == current.position.y &&\n current.position.x == after.position.x &&\n current.position.y + 1 == after.position.y)\n {\n return turnTable.LEFTDOWN;\n }\n // c - a\n // |\n // b\n if (before.position.x == current.position.x &&\n before.position.y - 1 == current.position.y &&\n current.position.x + 1 == after.position.x &&\n current.position.y == after.position.y)\n {\n return turnTable.RIGHTDOWN;\n }\n }\n\n for (var i = 0; i < path.length; i++) {\n if (i === 0) {\n // start path sprite\n ctx.fillStyle = \"#FF0000\";\n } else if (i == path.length - 1) {\n // end path sprite\n ctx.fillStyle = \"#00FF00\";\n } else {\n var turn1 = determineTurn(path[i - 1], path[i], path[i + 1]);\n var turn2 = determineTurn(path[i + 1], path[i], path[i - 1]);\n var turn = turn1 || turn2;\n switch(turn) {\n case turnTable.HORIZ:\n ctx.fillStyle = \"#F0F000\";\n break;\n case turnTable.VERT:\n ctx.fillStyle = \"#FFFFFF\";\n break;\n case turnTable.LEFTUP:\n ctx.fillStyle = \"#0F0F00\";\n break;\n case turnTable.RIGHTUP:\n ctx.fillStyle = \"#0F00F0\";\n break;\n case turnTable.LEFTDOWN:\n ctx.fillStyle = \"#0F000F\";\n break;\n case turnTable.RIGHTDOWN:\n ctx.fillStyle = \"#0F0FF0\";\n break;\n }\n }\n var pos = camera.transformToCameraSpace(path[i].position.x, path[i].position.y);\n ctx.fillRect(pos.cam_x + 25, pos.cam_y + 25, 50, 50);\n }\n}",
"function draw() {\n\n// Establishing the colors\n background( 'grey' );\n stroke('pink');\n\n//Creating the for loop to create my abstract grid design. Going from top to bottom.\nfor(var x= 0; x<800; x+= 40){\nline(x, 0, x - slant, height);\n\n}\n\n// Creating the for loop going from bottom to top.\nfor(var x= 0; x<800; x+= 40){\n line(x, 0, x + slant, height);\n}\n\n}",
"function DrawPathBus() {\n\n g_context.strokeStyle = \"rgb(23, 145, 167)\";\n g_context.moveTo(g_tablePathBus1[0]-g_posxPlan, g_tablePathBus1[1]+g_posyPlan); // 1er point\n g_context.beginPath();\n g_context.lineWidth = \"5\";\n\n for (var i=2;i<g_tablePathBus1.length;i+=2)\n {\n // console.log(g_tablePathBus[i]+','+g_tablePathBus[i+1]);\n // console.log('bus='+i+','+cursorX+','+cursorY);\n g_context.lineTo(g_tablePathBus1[i]-g_posxPlan*g_scalePlan, g_tablePathBus1[i+1]-g_posyPlan*g_scalePlan); // 2e point\n }\n g_context.lineTo(parseInt(cursorX),parseInt(cursorY)); // 2e point\n g_context.stroke();\n}",
"draw() {\n\n // Read in selected value(s)\n\n var curve_type = document.querySelector('#pattern-controls > div:nth-child(1) > select').value;\n this.curve = this[curve_type];\n\n this.config.iterations.value = document.querySelector('#pattern-controls > div:nth-child(2) > input').value;\n this.curve.iterations = this.config.iterations.value;\n this.config.length.value = document.querySelector('#pattern-controls > div:nth-child(3) > input').value;\n this.config.rotate.value = document.querySelector('#pattern-controls > div:nth-child(4) > input').value;\n\n // Display selected value(s)\n document.querySelector('#pattern-controls > div.pattern-control:nth-child(2) > span').innerHTML = this.config.iterations.value;\n document.querySelector('#pattern-controls > div.pattern-control:nth-child(3) > span').innerHTML = this.config.length.value + \" \" + units;\n document.querySelector('#pattern-controls > div.pattern-control:nth-child(4) > span').innerHTML = this.config.rotate.value + \"°\";\n\n let lindenmayer_string = this.curve.l_system.axiom;\n for (let i = 0; i < this.curve.iterations; i++) {\n lindenmayer_string = this.compose_lindenmayer_string(lindenmayer_string);\n }\n\n // Log Lindemayer System string\n // console.log(lindenmayer_string);\n\n // Calculate path\n let path = this.calc(lindenmayer_string, this.config.length.value);\n\n // Log Path coordinates\n // console.log(path);\n\n // Update object\n this.path = path;\n\n return path;\n }",
"draw() {\n\n this.drawInteractionArea();\n\n //somewhat depreciated - we only really draw the curve interaction but this isnt hurting anyone\n if(lineInteraction)\n this.drawLine();\n else\n this.drawCurve();\n\n this.drawWatch(); \n\n }",
"function step1(ctx) {\n // ground\n ctx.beginPath();\n ctx.moveTo(360, 380);\n ctx.quadraticCurveTo(200, 270, 40, 360);\n ctx.quadraticCurveTo(35, 363, 40, 366);\n ctx.quadraticCurveTo(180, 290, 360, 386);\n ctx.quadraticCurveTo(365, 383, 360, 380);\n ctx.fill();\n // grass\n ctx.beginPath();\n ctx.lineWidth = 1;\n ctx.moveTo(116, 330);\n ctx.quadraticCurveTo(110, 323, 100, 325);\n ctx.closePath();\n ctx.stroke();\n ctx.moveTo(116, 330);\n ctx.quadraticCurveTo(110, 317, 100, 320);\n ctx.quadraticCurveTo(114, 310, 115, 328);\n ctx.fill();\n ctx.moveTo(116, 330);\n ctx.quadraticCurveTo(110, 300, 105, 314);\n ctx.quadraticCurveTo(111, 290, 118, 330);\n ctx.fill();\n ctx.moveTo(122, 330);\n ctx.quadraticCurveTo(138, 312, 138, 310);\n ctx.quadraticCurveTo(130, 305, 120, 330);\n ctx.fill();\n ctx.moveTo(120, 330);\n ctx.quadraticCurveTo(130, 300, 133, 305);\n ctx.quadraticCurveTo(127, 290, 120, 330);\n ctx.fill();\n}",
"function draw() {\r\n\tbackground(53, 74, 35);\r\n\tfor (let i = 0; i < maze_grid.length; i++) {\r\n\t\tmaze_grid[i].displayGrid();\r\n\t}\r\n\r\n\tlet following_unit = current_unit.findAdjcent();\r\n\r\n\tcurrent_unit.visited = true;\r\n\t// console.log(current_unit);\r\n\r\n\tif (complete == false) {\r\n\t\tcurrent_unit.mark();\r\n\t\tif (following_unit) {\r\n\t\t\t// pushes current Unit to the stack for backtracking\r\n\t\t\tmaze_stack.push(current_unit);\r\n\t\t\tclearSide(current_unit, following_unit);\r\n\r\n\t\t\t// sets the current Unit to the following Unit in iteration\r\n\t\t\tfollowing_unit.visited = true;\r\n\t\t\tcurrent_unit = following_unit;\r\n\t\t// if no adjcent cells available then will pop \"backtrack\" until one becomes avaiable\r\n\t\t} else if (maze_stack.length > 0) {\r\n\t\t\tcurrent_unit = maze_stack.pop();\r\n\t\t}\r\n\t}\r\n\r\n\tdetermineComplete(maze_stack);\r\n\r\n\t// displays final path\r\n\tif (complete_path == true) {\r\n\t\tdisplayPath(path_stack)\r\n\t}\r\n\r\n\t// starts path finding process\r\n\tif (complete == true) {\r\n\t\tpath_iteration.pathvisit = true;\r\n\t\tpath_iteration.marksolve();\r\n\r\n\t\tvar following_path = path_iteration.findAdjcentPath();\r\n\t\tif(following_path) {\r\n\t\t\t// pushes current path to the stack for backtracking\r\n\t\t \tpath_stack.push(path_iteration);\r\n\r\n\t\t \t// sets the current path to the following path in iteration\r\n\t\t \tfollowing_path.pathvisit = true;\r\n\t\t \tpath_iteration = following_path;\r\n\t\t } else if(path_stack.length > 0 ) {\r\n\t\t \tpath_iteration = path_stack.pop();\r\n\t\t \tpath_iteration.markbacktrack();\r\n\t\t }\r\n\t}\r\n}",
"_drawWalkableArea() {\n if (this.scene && this.scene.walkable) {\n this.graphics.beginFill(0xFF3300, 0.0);\n this.graphics.lineStyle(1, 0xFF3300, 1.0);\n this.graphics.drawPolygon(this.scene.walkable);\n this.graphics.endFill();\n }\n }",
"function drawStep(x,y,symbol){\n\n // Give new values\n width(5)\n\n // For random player\n if (symbol == \"r\" || symbol == \"R\") {\n rcheck = Math.random()\n if (rcheck>=0.5){\n symbol=\"X\"\n }\n else{\n symbol=\"O\"\n }\n }\n\n // Does this if needs to draw X\n if (symbol==\"X\" || symbol==\"x\") {\n x_coordinates.push([x,y])\n myX = -cs/2+x*(squareSize)-(squareSize)+(squareSize/5)\n myY = cs/2-(y*squareSize)+(squareSize/5)\n goto(myX,myY)\n color(\"blue\")\n right(45)\n forward((4.24*squareSize)/5)\n goto(myX+(squareSize*3/5),myY)\n left(90)\n forward((4.24*squareSize)/5)\n right(45)\n\n\n let arrToCheck = [x,y]\n for (let i = 0; i < free_coordinates.length; i++) {\n if (arraysEqual(free_coordinates[i],arrToCheck)) {\n free_coordinates.splice(i,1)\n break\n }\n }\n }\n\n // Does this if needs to draw O\n if(symbol==\"O\" || symbol==\"o\" || symbol==\"0\"){\n o_coordinates.push([x,y])\n myX = -cs/2+x*(squareSize)-(squareSize)+(squareSize/2)\n myY = cs/2-(y*squareSize)+(squareSize/2)\n radius = squareSize*3/10\n goto(myX,myY+radius)\n right(90)\n color(\"red\")\n for (let r = 0; r < 100; r++) {\n forward(squareSize/55.5)\n right(360/100)\n }\n left(90)\n\n let arrToCheck = [x,y]\n for (let i = 0; i < free_coordinates.length; i++) {\n if (arraysEqual(free_coordinates[i],arrToCheck)) {\n free_coordinates.splice(i,1)\n break\n }\n }\n }\n\n // Back default options\n goto(1000,1000)\n color(\"black\")\n width(2)\n}",
"function draw(x, y, length, direction) {\n var move;\n var headlen = 5;\n var angle;\n var fromx = x;\n var fromy = y;\n var tox, toy;\n var dx, dy;\n\n if (direction == \"forward\") {\n move = y - length;\n }\n if (direction == \"backward\") {\n move = y + length;\n }\n\n if (direction == \"right\") {\n move = x + length;\n }\n if (direction == \"left\") {\n move = x - length;\n }\n ctx.beginPath();\n ctx.moveTo(x, y);\n if (direction == \"forward\" || direction == \"backward\") {\n tox = x;\n toy = move;\n\n dx = tox - fromx;\n dy = toy - fromy;\n angle = Math.atan2(dy, dx);\n\n ctx.lineTo(tox, toy);\n ctx.lineTo(\n tox - headlen * Math.cos(angle - Math.PI / 6),\n toy - headlen * Math.sin(angle - Math.PI / 6)\n );\n ctx.moveTo(tox, toy);\n ctx.lineTo(\n tox - headlen * Math.cos(angle + Math.PI / 6),\n toy - headlen * Math.sin(angle + Math.PI / 6)\n );\n\n ctx.stroke();\n //update endpoint\n this.endpoint_x = x;\n this.endpoint_y = move;\n }\n if (direction == \"right\" || direction == \"left\") {\n tox = move;\n toy = y;\n\n dx = tox - fromx;\n dy = toy - fromy;\n angle = Math.atan2(dy, dx);\n\n ctx.lineTo(tox, toy);\n ctx.lineTo(\n tox - headlen * Math.cos(angle - Math.PI / 6),\n toy - headlen * Math.sin(angle - Math.PI / 6)\n );\n ctx.moveTo(tox, toy);\n ctx.lineTo(\n tox - headlen * Math.cos(angle + Math.PI / 6),\n toy - headlen * Math.sin(angle + Math.PI / 6)\n );\n\n ctx.stroke();\n //update endpoint\n this.endpoint_x = move;\n this.endpoint_y = y;\n }\n}",
"function drawPath( svg, X, Y, i, j, form, path, sX, sY ){\n\t\t//take care of the pattern part\n\t\tvar command1 = '';\n\t\tvar points1 = path.array();\n\t\tfor( var k in points1.value ){\n\t\t\tif( points1.value[k][0] == \"M\" ){\n\t\t\t\tvar text = 'M '+( ( ( points1.value[k][1] )+( sX*1 ) )+( X*i ) )+' '+( ( ( points1.value[k][2] )+( sY*1 ) )+( Y*j ) );\n\t\t\t\tvar command1 = command1.concat( text );\n\n\t\t\t}else if( points1.value[k][0] == \"C\" ){\n\t\t\t\tvar text = ' C '+( ( ( points1.value[k][1] )+( sX*1 ) )+( X*i ) )+' '+( ( ( points1.value[k][2] )+( sY*1 ) )+( Y*j ) )+' '+\n\t\t\t\t\t\t\t\t\t\t\t\t ( ( ( points1.value[k][3] )+( sX*1 ) )+( X*i ) )+' '+( ( ( points1.value[k][4] )+( sY*1 ) )+( Y*j ) )+' '+\n\t\t\t\t\t\t\t\t\t\t\t\t ( ( ( points1.value[k][5] )+( sX*1 ) )+( X*i ) )+' '+( ( ( points1.value[k][6] )+( sY*1 ) )+( Y*j ) );\n\t\t\t\tvar command1 = command1.concat( text );\n\n\t\t\t}else if( points1.value[k][0] == \"L\" ){\n\t\t\t\tvar text = ' L '+( ( ( points1.value[k][1] )+( sX*1 ) )+( X*i ) )+' '+( ( ( points1.value[k][2] )+( sY*1 ) )+( Y*j ) );\n\t\t\t\tvar command1 = command1.concat( text );\n\n\t\t\t}else if( points1.value[k][0] == \"Z\" ){\n\t\t\t\tvar element1 = svgOut.path( command1 ).stroke( { width : 0 } ).fill( \"none\" );\n\t\t\t\t//take care of the shape part that can be an ellipse form\n\t\t\t\tif( form.type == \"path\" ){\n\t\t\t\t\tvar command2 = '';\n\t\t\t\t\tvar points2 = form.array();\n\t\t\t\t\tfor( var k in points2.value ){\n\t\t\t\t\t\tif( points2.value[k][0] == \"M\" ){\n\t\t\t\t\t\t\tvar text = 'M '+( points2.value[k][1] )+' '+( points2.value[k][2] );\n\t\t\t\t\t\t\tvar command2 = command2.concat( text );\n\n\t\t\t\t\t\t}else if( points2.value[k][0] == \"C\" ){\n\t\t\t\t\t\t\tvar text = ' C '+( points2.value[k][1] )+' '+( points2.value[k][2] )+' '+\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ( points2.value[k][3] )+' '+( points2.value[k][4] )+' '+\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ( points2.value[k][5] )+' '+( points2.value[k][6] );\n\t\t\t\t\t\t\tvar command2 = command2.concat( text );\n\n\t\t\t\t\t\t}else if( points2.value[k][0] == \"L\" ){\n\t\t\t\t\t\t\tvar text = ' L '+( points2.value[k][1] )+' '+( points2.value[k][2] );\n\t\t\t\t\t\t\tvar command2 = command2.concat( text );\n\n\t\t\t\t\t\t}else if( points2.value[k][0] == \"Z\" ){\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\tvar element2 = svgOut.path( command2 ).stroke( { width : 0 } ).fill( \"none\" );\n\t\t\t\t} else{\n\t\t\t\t\tvar element2 = form;\n\t\t\t\t}\n\t\t\t drawSplittedData( element1, element2 );\n\t\t\t command1='';\n\t\t\t}\n\t\t\t//if the pattern element is not closed then run the script one more time\n\t\t\tif( points1.value[points1.value.length-1][0] != \"Z\" ){\n\t\t\t\tvar element1 = svgOut.path( command1 ).stroke( { width : 0 } ).fill( \"none\" );\n\t\t\t\t//take care of the shape part that can be an ellipse form\n\t\t\t\tif( form.type == \"path\" ){\n\t\t\t\t\tvar command2 = '';\n\t\t\t\t\tvar points2 = form.array();\n\t\t\t\t\tfor( var k in points2.value ){\n\t\t\t\t\t\tif( points2.value[k][0] == \"M\" ){\n\t\t\t\t\t\t\tvar text = 'M '+( points2.value[k][1] )+' '+( points2.value[k][2] );\n\t\t\t\t\t\t\tvar command2 = command2.concat( text );\n\n\t\t\t\t\t\t}else if( points2.value[k][0] == \"C\" ){\n\t\t\t\t\t\t\tvar text = ' C '+( points2.value[k][1] )+' '+( points2.value[k][2] )+' '+\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ( points2.value[k][3] )+' '+( points2.value[k][4] )+' '+\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ( points2.value[k][5] )+' '+( points2.value[k][6] );\n\t\t\t\t\t\t\tvar command2 = command2.concat( text );\n\n\t\t\t\t\t\t}else if( points2.value[k][0] == \"L\" ){\n\t\t\t\t\t\t\tvar text = ' L '+( points2.value[k][1] )+' '+( points2.value[k][2] );\n\t\t\t\t\t\t\tvar command2 = command2.concat( text );\n\n\t\t\t\t\t\t}else if( points2.value[k][0] == \"Z\" ){\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\tvar element2 = svgOut.path( command2 ).stroke( { width : 0 } ).fill( \"none\" );\n\t\t\t\t} else {\n\t\t\t\t\tvar element2 = form;\n\t\t\t\t}\n\t\t\t drawSplittedData( element1, element2 );\n\t\t\t}\n\t\t}\n\t\t\n\t}",
"draw() {\n // drawing curbs first\n const shades = ['#9ca297', '#b1bab0'];\n for (let i = 0; i < 2; i++) {\n ctx.fillStyle = shades[i];\n // curbs just big rects mildly translated so some shading\n if (i) {\n ctx.translate(0, 3.3);\n }\n ctx.fillRect(0, this.y - (this.linH / 3) * 1.5, init.w, inProptn(1, 7) + (this.linH / 3) * (3 - i * 1.5));\n }\n ctx.translate(0, -3.3);\n\n // road itself\n ctx.fillStyle = 'black';\n ctx.fillRect(0, this.y, init.w, inProptn(1, 7));\n\n this.markings();\n }",
"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 }",
"drawCurrentState(){\n reset();\n drawPolygonLines(this.hull, \"red\"); \n drawLine(this.currentVertex, this.nextVertex, \"green\");\n drawLine(this.currentVertex,this.points[this.index]);\n for(let i=0;i<this.points.length;i++){\n this.points[i].draw();\n }\n\n for(let i=0;i<this.hull.length;i++){\n this.hull[i].draw(5,\"red\");\n }\n }",
"function drawStep(currStep) {\n var x = document.getElementById(\"canvas\");\n var draw = x.getContext(\"2d\");\n draw.beginPath();\n draw.font = \"20px Georgia\";\n draw.fillStyle = 'black';\n draw.fillText(\"Step: \" + currStep, 600, 80);\n draw.closePath();\n}",
"function Navigate() {\n source_vector_draw_rdc.clear();\n source_vector_draw_etage.clear();\n drawPinStart();\n\n var porte_start = porteStartLocalisation;\n var porte_end = document.getElementById(\"endNavigation\").value;\n\n var collection_route = Route(porte_start, porte_end);\n collection_route.forEach(triple => { //start, end, layer\n Drawline(triple[0], triple[1], triple[2]);\n });\n}",
"draw(){\n var canvas = document.getElementById(\"2d-plane\");\n var context = canvas.getContext(\"2d\");\n context.beginPath();\n context.strokeStyle=\"white\";\n context.rect(this.boundary.x-this.boundary.w,this.boundary.y-this.boundary.h,this.boundary.w*2,this.boundary.h*2); \n context.stroke();\n //Draw recursive the children\n if(this.isDivided){\n this.northeast.draw();\n this.northwest.draw();\n this.southeast.draw();\n this.southwest.draw();\n }\n //Draw Points in Boarder\n for(let i=0;i<this.points.length;i++){\n context.beginPath();\n context.fillStyle=\"red\";\n context.arc(this.points[i].x, this.points[i].y, 2, 0, 2*Math.PI);\n context.fill();\n }\n}",
"function drawPath() {\n\tif(path.length===0) { return; }\n\tif(Quality>=2 && !isColorblind()) {\n\t\tconst rad = pathW * .6;\n\t\t\n\t\tconst rOpt = ['9','A','A','B','C'];\n\t\tconst gOpt = ['9','8','7'];\n\t\tconst bOpt = ['4','5'];\n\t\t\n\t\tconst first = (totalPaths%2)+1;\n\t\tfor(let i=first;i<path.length;i+=2) {\n\t\t\tconst j = i+totalPaths;\n\t\t\tconst r = rOpt[j%rOpt.length];\n\t\t\tconst g = gOpt[j%gOpt.length];\n\t\t\tconst b = bOpt[j%bOpt.length];\n\t\t\t\n\t\t\tmctx.fillStyle=`#${r}${g}${b}7`;\n\t\t\tmctx.beginPath();\n\t\t\tmctx.ellipse(path[i].x, path[i].y, pathW, rad, 0, 0, Math.PI*2)\n\t\t\tmctx.fill();\n\t\t}\n\t}\n\t\n\tmctx.lineWidth = pathW;\n\tmctx.strokeStyle =\"#B85\";\n\n\t// if(isColorblind()) {\n\t\t// mctx.strokeStyle = GetColorblindColor();\n\t// }\n\t\n\tconst pCount = 4;\n\tfor(let i=0;i<pCount;i++){\n\t\tmctx.beginPath();\n\t\tmctx.moveTo(path[0].x, path[0].y);\n\t\tfor(let j=i;j<path.length;j+=pCount){\n\t\t\tmctx.lineTo(path[j].x, path[j].y);\n\t\t}\n\t\tmctx.stroke();\n\t}\n}",
"function draw()\n{\n\tcontext.moveTo(x,y);\n\tif(direction == 0)\n\t{\n\t\ty = y - speed;\n\t}\n\telse if(direction == 1)\n\t{\n\t\tx = x + speed;\n\t}\n\telse if(direction == 2)\n\t{\n\t\ty = y + speed;\n\t}\n\telse //direction == 3\n\t{\n\t\tx = x - speed;\n\t}\n\tcontext.lineTo(x, y);\n\tcontext.stroke();\n}",
"function drawCurve(fn, steps) {\n noFill();\n stroke(0, 150);\n beginShape();\n for(var i = 0; i <= steps; i++) {\n // normalize i to the range (0, 1)\n var t = norm(i, 0, steps);\n // compute function\n var pt = fn(t);\n vertex(pt.x, pt.y);\n }\n endShape();\n}"
]
| [
"0.70697945",
"0.67920697",
"0.67242545",
"0.67022383",
"0.6664862",
"0.66017634",
"0.6601743",
"0.65780336",
"0.65537614",
"0.6550907",
"0.6531512",
"0.6468508",
"0.6457658",
"0.6450764",
"0.6445439",
"0.6426784",
"0.64162934",
"0.64034486",
"0.6393927",
"0.6391958",
"0.6381909",
"0.63512856",
"0.6338825",
"0.63387114",
"0.63109344",
"0.62698567",
"0.6224805",
"0.62224686",
"0.6212322",
"0.6208642"
]
| 0.6842936 | 1 |
Jquery ajax call to get roles & populate role dropdown | function getRoles(userId) {
$("#ddlrole").empty();
$("#ddlrole").append($("<option></option>").val("").html(""));
if (roles.length === 0) {
$.ajax({
type: "POST",
url: "ManageUserApi.aspx/GetRoles",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
roles = data.d;
$.each(roles, function (key, value) {
$("#ddlrole").append($("<option></option>").val(value.RoleId).html(value.Description));
});
getUser(userId);
},
failure: function (response) {
alert(response.d);
}
});
} else {
$.each(roles, function (key, value) {
$("#ddlrole").append($("<option></option>").val(value.RoleId).html(value.Description));
});
getUser(userId);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fillRoles() {\n $(\"select[name='RoleId']\").empty();\n $.ajax({\n url: \"/Employee/Roles/\" + $('select[name=\"DepartmentId\"]').val(),\n dataType: \"Json\",\n type: \"Get\",\n data: {},\n success: function (response) {\n $(\"select[name='RoleId']\").append(`<option value=` + 0 + `>Role</option>`)\n $.each(response, function (key, value) {\n var option = `<option value=` + value.Id + `>` + value.Name + `</option>`\n $(\"select[name='RoleId']\").append(option)\n })\n }\n\n })\n }",
"async function ajaxRoles() {\n const result = await $.ajax({\n type: \"POST\",\n url: \"CurrentManagement.aspx/GetRoles\",\n data: \"{}\",\n contentType: \"application/json; charset=utf-8\",\n dataType: \"json\"\n });\n return result;\n }",
"function getDataForSelect() {\n $.ajax({\n url: `${G_BASE_URL}/roles`,\n method: `get`,\n success: renderSelectData,\n error: (e) => {\n $('#modal-error').modal('show');\n $('#error').text(e.responseText);\n },\n });\n }",
"function LoadRole(element) {\n $.ajax({\n type: \"Get\",\n url: \"/Roles/LoadRole\",\n success: function (data) {\n Roles = data;\n var $option = $(element);\n $option.empty();\n $option.append($('<option/>').val('0').text('Select Role').hide());\n $.each(Roles, function (i, val) {\n $option.append($('<option/>').val(val.id).text(val.name));\n });\n }\n });\n}",
"function populate_host_roles(platform_ui, software_ui, region_ui, roles_ui) {\r\n roles_ui.find('option').remove();\r\n roles_ui.append('<option value=\"ALL\">ALL</option>');\r\n $.ajax({\r\n url: \"/api/get_distinct_host_roles/platform/\" + platform_ui.val() +\r\n \"/software_versions/\" + (software_ui.val() == null ? 'ALL' : software_ui.val()) +\r\n \"/region_ids/\" + ((region_ui.val() == null || region_ui.val() == -1) ? 'ALL' : region_ui.val()),\r\n dataType: 'json',\r\n success: function(data) {\r\n $.each(data, function(index, element) {\r\n for (i = 0; i < element.length; i++) {\r\n roles_ui.append('<option value=\"' + element[i].role + '\">' + element[i].role + '</option>');;\r\n }\r\n });\r\n }\r\n });\r\n}",
"function _roles_append(data){\n $('#role_body').append(\n '<option value=\"'+ data.id +'\">'+ data.name +'</option>'\n )\n $('#role_body2').append(\n '<option value=\"'+ data.id +'\">'+ data.name + '</option>'\n )\n}",
"function _roles_list(){\n _loading(1);\n $.post('/api/v1/ams/role',{\n 'id': userData['id'],\n 'token': userData['token'],\n 'status': 0,\n }, function (e) {\n let i;\n if(e['status'] === '00'){\n if(e.data.length > 0){\n for(i=0; i < e.data.length; i++){\n _roles_append(e.data[i], i);\n console.log(i);\n }\n }\n\n console.log(document.getElementById(\"role_body2\"));\n }else{\n notif('danger', 'System Error!', e.message);\n }\n }).fail(function(){\n notif('danger', 'System Error!', 'Mohon kontak IT Administrator');\n }).done(function(){\n _loading(0);\n });\n}",
"function prepAssignments()\n{\n\tvar role_area = document.getElementById(\"assignment-area\");\n\tif (role_area != null) \n\t{\n\t\tvar json_users = {};\n\t\tvar json_roles = {};\n\t\trole_area.innerHTML = \"\";\n\t\tvar httpRequest = new XMLHttpRequest();\n\t\t//var turl = \"http://localhost/final/data.php\";\n\t\thttpRequest.open('POST', turl, true);\n\t\tvar params = \"action=allUsers\";\n\t\thttpRequest.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n\t\thttpRequest.send(params);\t\n\t\thttpRequest.onreadystatechange = function()\n\t\t{\n\t\t\tif(httpRequest.readyState == 4)\n\t\t\t{\n\t\t\t\tif(httpRequest.status == 200)\n\t\t\t\t{\n\t\t\t\t\tjson_users = JSON.parse(httpRequest.responseText);\n\t\t\t\t\tvar elem = document.createElement(\"select\");\n\t\t\t\t\telem.id = \"select-user\";\n\t\t\t\t\tfor(var i = 0; i < json_users.length; i++) \n\t\t\t\t\t{\n\t\t\t\t\t var obj = json_users[i]; \n\t\t\t\t\t var opt = document.createElement(\"option\");\n\t\t\t\t\t opt.value = obj['id'];\n\t\t\t\t\t opt.innerHTML = obj['first_name'] +\" \"+ obj['last_name'];\n\t\t\t\t\t elem.appendChild(opt);\n\t\t\t\t\t role_area.appendChild(elem);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconsole.log(json_users);\n\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tvar httpRequest2 = new XMLHttpRequest();\n\t\thttpRequest2.open('POST', turl, true);\n\t\tvar params2 = \"action=allRoles\";\n\t\thttpRequest2.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n\t\thttpRequest2.send(params2);\t\n\t\thttpRequest2.onreadystatechange = function()\n\t\t{\n\t\t\tif(httpRequest2.readyState == 4)\n\t\t\t{\n\t\t\t\tif(httpRequest2.status == 200)\n\t\t\t\t{\n\t\t\t\t\tjson_roles = JSON.parse(httpRequest2.responseText);\n\t\t\t\t\tvar elem = document.createElement(\"select\");\n\t\t\t\t\telem.id = \"select-role\";\n\t\t\t\t\tfor(var i = 0; i < json_roles.length; i++) \n\t\t\t\t\t{\n\t\t\t\t\t var obj = json_roles [i]; \n\t\t\t\t\t var opt = document.createElement(\"option\");\n\t\t\t\t\t opt.value = obj['id'];\n\t\t\t\t\t opt.innerHTML = obj['name'];\n\t\t\t\t\t elem.appendChild(opt);\n\t\t\t\t\t role_area.appendChild(elem);\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t//var btn = \"<button id='assign_btn' onClick=setAssignments()>Assign Role</button>\";\n\t\t//role_area.appendChild(btn);\n\t\tvar btn_div = document.getElementById(\"assignment-btn\");\n\t\tvar btn_elem = document.createElement(\"button\")\n\t\tbtn_elem.id = \"assign_btn\";\n\t\tbtn_elem.setAttribute('onclick','setAssignments()');\n\t\tbtn_elem.innerHTML = \"Asssign Role\";\n\t\tbtn_div.appendChild(btn_elem);\n\t\tvar br = document.createElement(\"br\");\n\t\tbtn_div.appendChild(br);\n\t\t//role_area.appendChild(btn_div);\n\t\t//var btn = \"<button id='assign_btn' onClick=setAssignments()>Assign Role</button>\";\n\n\t\t//console.log(\"a-start\");\n\t\t//console.log(json_roles);\n\t\t//console.log(json_users);\n\t\t//console.log(\"a-end\"\t);\n\t}\n\n}",
"function getRoles() {\n\t$.getJSON(\"/rpc/account/GetRoles\").done(function (jsonData) {\n\t\twindow.roles = jsonData;\n\t});\n}",
"function getRolesAndThen(func) {\n\t$.ajax({\n // this call is synchronous to ensure that\n // there are participants created for roles\n // before we start loggin in as one\n async: false,\n type: 'GET',\n url: JODA_ENGINE_ADRESS + '/api/identity/roles',\n success: function(data) {\n func(data);\n },\n dataType: \"json\"\n });\n}",
"function populate(){\n\t\t\t$.ajax({\n url: '/app/gui/role/list',\n \"headers\": header,\n type: \"GET\",\n crossDomain: true,\n dataType: \"json\",\n success: function(data) {\n var obj=JSON.parse(data.result);\n var roleRecords=obj.roleResources;\n\n for(var i in roleRecords)\n {\n var roleName=roleRecords[i].role; \n if(roleName!='ROLE_ADMIN'){\n \t $('#role-table tbody').append('<tr>'+\n \t\t\t\t\t\t\t'<td id=\"rolename\">'+roleName+'</td>'+\n \t\t\t\t\t\t\t'<td>'+'<button id=\"edit\" class=\"btn btn-primary btn-sm\" onclick=\"editRole(this)\">'+\n \t\t\t\t\t\t\t'<i class=\"fa fa-edit\"></i>'+\n \t\t\t\t\t\t\t'</button> '+\n \t\t\t\t\t\t\t'<button id=\"delete\" class=\"btn btn-danger btn-sm\" onclick=\"deleteRole(this)\">'+\n \t\t\t\t\t\t\t'<i class=\"fa fa-trash\"></i>'+\n \t\t\t\t\t\t\t'</button>'+\n \t\t\t\t\t\t\t'</td>'+\n \t\t\t\t\t\t\t'</tr>'); \n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown) {\n console.log('error while get');\n }\n });\n\t}",
"function createRoleListOnEdit(data) {\r\n\t\t\r\n\t $(\"#userRole\").find(\"option\").remove();\r\n\t\tvar availableRole = \"\";\r\n\t\t$.each(data[0].availableRoleList, function(index, value){\r\n\t\t\tif(data[0].availableRoleList[index].roleName != 'ROLE_GRW'){\r\n\t\t\t\tif(data[0].availableRoleList[index].roleDescription != 'Class Admin User'){\r\n\t\t\t\t\tavailableRole += '<option value=\"'+ data[0].availableRoleList[index].roleName +'\" >' +data[0].availableRoleList[index].roleDescription+'</option>';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\t$(\"#userRole\").append(availableRole);\t\t\r\n\t\t$(\"#userRole\").change(function(){\r\n\t\t\t$(\"#userRole option[value='ROLE_USER']\").attr('selected', true);\r\n\t\t});\r\n\t\t//alert(masterRole);\r\n\t}",
"function fntRolesUsuario(){\n\tif (document.querySelector('#listRolid')) {\n\t\t\n\t\tlet ajaxUrl = base_url+'/Roles/getSelectRoles';\n\t\tlet request = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');\n\t\trequest.open(\"GET\", ajaxUrl, true);\n\t\trequest.send();\n\n\t\trequest.onreadystatechange = function(){\n\t\t\tif (request.readyState == 4 && request.status == 200) {\n\t\t\t\tdocument.querySelector('#listRolid').innerHTML = request.responseText;\n\t\t\t\tdocument.querySelector('#listRolid').value = 1;\n\t\t\t\t$('#listRolid').selectpicker('render');\n\t\t\t\t// $('#listRolid').selectpicker('refresh');\n\n\t\t\t}\n\t\t}\n\t}\n}",
"function ListarRol() {\n $.ajax({\n type: \"GET\",\n //dataType: \"JSON\",\n url: \"/Usuario/Listado\",\n dataType: 'json',\n success: function (data) {\n console.log(data);\n $.each(data.listaRol, function (key, rol) {\n $(\"#idRol\").append(`<option data-item=${key} value='${rol.codRol}' >${rol.nomRol}</option`);\n })\n } \n });\n // .then(function (roles) {\n // $.each(roles, function (key, rol) {\n // $(\"#idRol\").append(\"<option value='\" + rol.codRol + \"'>\" + rol.nomRol + \"</option\");\n // })\n //})\n}",
"function GetLoggedUserRoleName(userRoleId) {\n ShowLoading();\n var odataSelect = Xrm.Page.context.getClientUrl() + \"/XRMServices/2011/OrganizationData.svc\" + \"/\" + \"RoleSet?$filter=RoleId eq guid'\" + userRoleId + \"'\";\n var roleName = null;\n $.ajax(\n {\n type: \"GET\",\n async: false,\n contentType: \"application/json; charset=utf-8\",\n datatype: \"json\",\n url: odataSelect,\n beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader(\"Accept\", \"application/json\"); },\n success: function (data, textStatus, XmlHttpRequest) {\n roleName = data.d.results[0].Name;\n HideLoading();\n },\n error: function (XmlHttpRequest, textStatus, errorThrown) { alert('OData Select Failed: ' + textStatus + errorThrown + odataSelect); HideLoading(); }\n }\n );\n return roleName;\n}",
"function populateRoleDropDown() {\n\t// populate the option lists if they don't exist\n\tlet roleDropdown = document.getElementById('role-dropdown');\t\n\tif(roleDropdown.length == 0) {\n\t\trolesData = pullRoleData();\n\t\t\n\t\tfor (let i=0; i<=rolesData.length-1; i++) {\n\t\t\tlet option = document.createElement(\"option\");\n\t\t\toption.text = rolesData[i].name;\n\t\t\toption.value = rolesData[i].role_id;\n\t\t\troleDropdown.appendChild(option);\n\t\t}\n\t}\n}",
"function createRoleListOnAdd(data,orgLevel) {\r\n\t var masterRole = \"\";\r\n\t\t$.each(data, function(index, value){\r\n\t\t\tif(data[index].roleName != 'ROLE_GRW'){\r\n\t\t\t\tif(orgLevel == '4'){\r\n\t\t\t\t\tif(data[index].roleName != 'ROLE_ADMIN'){\r\n\t\t\t\t\t\tmasterRole += '<option value=\"'+ data[index].roleName +'\" '+data[index].defaultSelection+'>' +data[index].roleDescription+'</option>';\r\n\t\t\t\t\t}\r\n\t\t\t\t}else{\r\n\t\t\t\t\tmasterRole += '<option value=\"'+ data[index].roleName +'\" '+data[index].defaultSelection+'>' +data[index].roleDescription+'</option>';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\t//alert(masterRole);\r\n\t\t$(\"#addUserRole\").empty().append(masterRole);\r\n\t\t$(\"#addUserRole\").change(function(){\r\n\t\t\t$(\"#addUserRole option[value='ROLE_USER']\").attr('selected', true);\r\n\t\t});\r\n\t\t$('#addUserRole').trigger('update-select-list');\r\n\t}",
"function populateMasterRoles(data) {\n var index = 0;\n\n $(\"#orgRoleList\").empty();\n\n while (index < data.length) {\n // Declare a local Role object\n var role = new Role();\n role.ID = data[index].ID;\n role.Name = data[index].Name;\n role.Description = data[index].Description;\n // Add the current role to the referece role array\n referenceRoles.push(role);\n // Add a list item for the organization.\n // Add a check box for each master role\n $(\"<DIV id='rowContainer\" + data[index].ID + \"'</DIV>\").addClass(\"sectionSpan\").appendTo(\"#orgRoleList\");\n// var node = <label for = 'role\" + data[index].ID + \"'>\" + data[index].Name + \"</label>\";\n $(\"<input type='checkbox' id='role\" + data[index].ID + \"'/>\").val(data[index].ID).css({ 'margin-left': '15px' }).on(\"click\", activateRole).appendTo(\"#rowContainer\" + data[index].ID);\n $(\"<label for='role\" + data[index].ID + \"'>\" + data[index].Name + \" </label>\").addClass(\"sectionLabel\").css({'margin-left':'10px','font-weight':'normal','width':'200px'}).appendTo(\"#rowContainer\" + data[index].ID);\n index++;\n }\n $(\"#masterRoleList\").change(masterRoleSelectHandler);\n }",
"function showRoles() {\n\t$.ajax({\n\t\ttype : \"GET\",\n\t\turl : \"roles/goShowRoles\",\n\t\tcache : false,\n\t\tsuccess : function(data) {\n\t\t\t$(\"#showDynamicContent\").html(\"\");\n\t\t\t$(\"#dynamicContent\").html(data);\n\t\t\t$('#roleLists').dataTable({\n\t\t\t\t\"bJQueryUI\" : true,\n\t\t\t\t\"sPaginationType\" : \"full_numbers\",\n\t\t\t\t\"iDisplayLength\" : 25,\n\t\t\t\t\"sScrollY\" : \"390px\",\n\t\t\t\t\"bFilter\" : true,\n\t\t\t\t\"bDestroy\" : true\n\t\t\t});\n\t\t}\n\t});\n\n}",
"function getRoles() {\n selectRole();\n return roleArray;\n}",
"function loadMasterRoles(callback, errorHandler) {\n // Declare a Deferred construct to return from this method\n var promise;\n // Declare a resonse structure to return from this object\n var response = new Response();\n var targetUrl;\n\n var token = sessionStorage.getItem(tokenKey);\n var headers = {};\n if (token) {\n headers.Authorization = 'Bearer ' + token;\n }\n\n // Empy any current options from the Project Select control\n// emptyProjectList();\n\n // Add a blank option to the combo box\n $('<option></option>').appendTo($('#projectList'));\n\n targetUrl = MasterRoleUrl;\n\n promise = $.ajax({\n url: targetUrl,\n type: 'GET',\n dataType: 'json',\n headers: headers,\n success: function (data, txtStatus, xhr) {\n callback(data);\n },\n error: function (xhr, textStatus, errorThrown) {\n response.status = xhr.status;\n errorHandler(response,503);\n }\n });\n\n return (promise);\n }",
"function populateCurrentRoles(data) {\n // Reset the Role list box to delete and current records\n resetRoleListbox()\n\n // Reset the Role array for the current ORg\n currentOrg.Roles.length = 0;\n var dummy2 = \"text\";\n // Loop over the defined dimensions and set them active as apporpriate\n $('#orgRoleList input').each(function (index, value) {\n $(value).prop('checked', false);\n // loop over the values in the current unit dimension array\n var count = 0;\n while (count < data.length) {\n if ($(value).val() == data[count].MasterRoleID) {\n\n $(value).prop('checked', data[count].isActive);\n // Update the overhead value\n $(\"#txtOverhead\" + data[count].MasterRoleID).val(data[count].Overhead);\n // Add the current role to the orgRoles array\n var newRole = new Role();\n newRole.ID = data[count].ID;\n newRole.MasterRoleID = data[count].MasterRoleID;\n newRole.Overhead = data[count].Overhead;\n newRole.OrganizationID = currentOrg.ID;\n newRole.isActive = data[count].isActive;\n currentOrg.Roles.push(newRole);\n break;\n }\n count++;\n }\n });\n var dummy = \"text\";\n }",
"function getRoles() {\n\n queries.executeRequest('GET', 'permissions/roles')\n .then(function (result) {\n if (result.success) {\n $scope.roles = result.data;\n }\n });\n }",
"function handleGetRolesResponse(response){\n ROLES = response;\n response.forEach((role) => {\n addRoleOptionToRoleSelect(role.roleName);\n addRoleToRolesTable(role);\n });\n\n}",
"function rolesToSelect(id) {\r\n roleService.getRoles().then(function(roleRes) {\r\n var selectPermissionElements = selectedPermission = '';\r\n if (id > 0 && id != undefined) {\r\n permissionService.getPermission(id).then(function(permissionRes) {\r\n var rolesArray = [];\r\n if (permissionRes.roles) {\r\n for (var i = 0; i < permissionRes.roles.length; i++) {\r\n rolesArray.push(permissionRes.roles[i].name);\r\n }\r\n }\r\n roleRes.forEach((element, index, array) => {\r\n if (permissionRes.roles) {\r\n\r\n if (jQuery.inArray(element.name, rolesArray) != -1) {\r\n selectedPermission = \"selected\";\r\n } else {\r\n selectedPermission = '';\r\n }\r\n selectPermissionElements += \"<option value='\" + element.role_id + \"' \" + selectedPermission + \">\" + element.name + \"</option>\";\r\n } else {\r\n selectPermissionElements += \"<option value='\" + element.role_id + \"'>\" + element.name + \"</option>\";\r\n }\r\n });\r\n $(\"#permissionRoleSelect\").html(selectPermissionElements);\r\n $('#permissionRoleSelect').select2({\r\n width: \"100%\",\r\n placeholder: \"Select Role\"\r\n });\r\n $(\"input.select2-search__field\").addClass(\"form-control\");\r\n $(\"#loading\").css(\"display\", \"none\");\r\n }, function(error) {\r\n \t$(\"#loading\").css(\"display\", \"none\");\r\n common.infoMessage(error.responseJSON['error-auxiliary-message'], 'error');\r\n });\r\n }\r\n }, function(err) {\r\n common.infoMessage(error.responseJSON['error-auxiliary-message'], 'error');\r\n });\r\n }",
"function GetNotesPrivelegeRole(type) {\n ShowLoading();\n var odataSelect = Xrm.Page.context.getClientUrl() + \"/XRMServices/2011/OrganizationData.svc\" + \"/\" + \"permobil_settingsSet?$select=permobil_value&filter=permobil_key eq 'Notes Roles'\";\n var roleName = null;\n $.ajax(\n {\n type: \"GET\",\n async: false,\n contentType: \"application/json; charset=utf-8\",\n datatype: \"json\",\n url: odataSelect,\n beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader(\"Accept\", \"application/json\"); },\n success: function (data, textStatus, XmlHttpRequest) {\n roleName = data.d.results[0].permobil_value;\n HideLoading();\n },\n error: function (XmlHttpRequest, textStatus, errorThrown) { alert('OData Select Failed: ' + textStatus + errorThrown + odataSelect); HideLoading(); }\n }\n );\n return roleName;\n}",
"function getRoles() {\n\n DashboardFactory.getRoles().then(\n\n function(response) {\n\n vm.roles = response;\n console.log(response);\n\n // Get all the Users that exist in the origin.API DB\n getUsers();\n\n },\n\n function(error) {\n\n console.log(error);\n \n });\n\n }",
"function loadAssignedManager(userId,roleId){\n\tvar data=ajaxCall('GET',contextPath()+\"atr/assignManagerList?userId=\"+userId+\"&roleId=\"+roleId+\"\");\n\tif(data !=undefined){\n\t $(\"#assignedToList option:gt(0)\").remove();\n\t $(\"#editAssignedToList option:gt(0)\").remove();\n\t\tfor (var i = 0; i < data.length; i++) {\n\t\t\tvar opt = \"<option class='text-capitalize' value='\" + data[i].userId + \"'>\"\n\t\t\t\t\t+ data[i].userName + \"</option>\";\n\t\t\t$('#assignedToList').append(opt);\n\t\t\t$('#editAssignedToList').append(opt);\n\t\t\t\n\t\t}\n } \n}",
"function loadAllDropDownList() {\n\t\t\n\t\t//call ajax and load data into #ddlAgent\n\t\t$.ajax({\n\t\t\tdataType: \"json\",\n\t\t\ttype: 'GET',\n\t\t\tdata: {},\n\t\t\turl: getAbsolutePath() + \"agent/list\",\n\t\t\tcontentType: \"application/json\",\n\t\t\tsuccess: function(data){\n\t\t\t\t$.each(data.list,function(key,value){\n\t\t\t\t\t$('#ddlAgent').append($('<option>', {\n\t\t\t\t\t\tvalue : value.agentcode,\n\t\t\t\t\t\ttext : value.shortname\n\t\t\t\t\t}));\n\t\t\t\t\t//edit part\n\t\t\t\t\t$(\"#editUserDialog\").find('#ddlAgent').append($('<option>', {\n\t\t\t\t\t\tvalue : value.agentcode,\n\t\t\t\t\t\ttext : value.shortname\n\t\t\t\t\t}));\n\t\t\t\t});\n\t\t\t},\n\t\t\terror: function(){\n\t\t\t\talert('Lỗi load dữ liệu unit (40)!');\n\t\t\t}\n\t\t});\n\t\t\n\t\t//call ajax and load data into #ddlAgent\n\t\t$.ajax({\n\t\t\tdataType: \"json\",\n\t\t\ttype: 'GET',\n\t\t\tdata: {},\n\t\t\turl: getAbsolutePath() + \"role/list\",\n\t\t\tcontentType: \"application/json\",\n\t\t\tsuccess: function(data){\n\t\t\t\t$.each(data.list,function(key,value){\n\t\t\t\t\t$('#ddlRole').append($('<option>', {\n\t\t\t\t\t\tvalue : value.roleid,\n\t\t\t\t\t\ttext : value.rolename\n\t\t\t\t\t}));\n\t\t\t\t\t//edit part\n\t\t\t\t\t$(\"#editUserDialog\").find('#ddlRole').append($('<option>', {\n\t\t\t\t\t\tvalue : value.roleid,\n\t\t\t\t\t\ttext : value.rolename\n\t\t\t\t\t}));\n\t\t\t\t});\n\t\t\t},\n\t\t\terror: function(){\n\t\t\t\talert('Lỗi load dữ liệu unit (40)!');\n\t\t\t}\n\t\t});\n\t\t\n\t}",
"getRoles() {\n return this.#fetchAdvanced(this.#getRolesURL()).then((responseJSON) => {\n let roles = Role.fromJSON(responseJSON);\n // console.info(roles);\n return new Promise(function (resolve) {\n resolve(roles);\n })\n })\n }"
]
| [
"0.7696604",
"0.76254886",
"0.7573151",
"0.7380626",
"0.73712444",
"0.7306547",
"0.7224069",
"0.7114847",
"0.7094175",
"0.7090697",
"0.7025095",
"0.69665056",
"0.6868839",
"0.68439126",
"0.6810113",
"0.68028665",
"0.68014115",
"0.6794497",
"0.6732222",
"0.6713366",
"0.67092055",
"0.65814584",
"0.65692973",
"0.64990455",
"0.64894",
"0.6442418",
"0.6421987",
"0.6420024",
"0.6419405",
"0.6403046"
]
| 0.779096 | 0 |
set all the widths to the elements | function setWidths() {
var unitWidth = getUnitWidth() - 20; // adjust for padding. for padding:0, make this 1
$isocontainer.children(":not(.width2)").css({ width: unitWidth });
$isocontainer.children(".width2").css({ width: (unitWidth * 2) });
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setOrigWidth()\n{\n\tfor(var i=0; i < hdr.length; i++)\n\t{\n\t\thdr[i].width = hWidth[i];\n\t}\n\t\n\tfor(var i=0; i < drow1.length; i++)\n\t{\n\t\tdrow1[i].width = dWidth[i];\n\t}\n\t\n}",
"function _increaseWidth(){\n layout.changeWidth(1);\n }",
"function setWidths() {\n\t\t\t$t.find( 'thead th' ).each( setHeadingWidth ).end().find( 'tr' ).each( setRowHeight );\n\n\t\t\t// Set width of sticky table head:\n\t\t\t$stickyHead.width( $t.width() );\n\n\t\t\t// Set width of sticky table column:\n\t\t\t$stickyCol.find( 'th' ).add( $stickyIntersect.find( 'th' ) ).width( $t.find( 'thead th' ).width() );\n\t\t}",
"updateInnerWidthDependingOnChilds(){}",
"function setupSliderWidth() {\n // resets sliderElement\n sliderElement.style.width = '0px';\n\n var totalWidth = 0;\n elements.forEach(function (element, index) {\n slideWidth = element.offsetWidth;\n totalWidth = totalWidth += slideWidth;\n });\n sliderElement.style.width = totalWidth + 'px';\n }",
"function setWidth(){\n var width = 500/(columnCounter + 1);\n\n for(var i=0; i<=columnCounter; i++){\n for(var j=0; j<columns[i].length; j++) {\n columns[i][j].style.width = (width - 3) + 'px';\n columns[i][j].style.marginLeft = width * i + 'px';\n }\n }\n }",
"set width (width) { this._width = width }",
"function adjustContainerWidth() {\r\n\tvar width = (elmWidth + 2) * elements.length;\r\n\t$('#thecontainer').attr('style', 'width: ' + width + 'px;' );\r\n}",
"function setBoxWidths() {\n var leftWidth = dragBarPos - 2,\n rightWidth = outerWidth - dragBarPos - 12;\n\n left.css('width', '' + toPercent(leftWidth) + '%');\n right.css('width', '' + toPercent(rightWidth) + '%');\n }",
"function setOuterWidth() {\n outerWidth = wrap.offsetWidth;\n dragBarPos = calcDragBarPosFromCss() || Math.floor(outerWidth / 2) - 5;\n }",
"function setWidth(width)\n {\n _width = width;\n }",
"changeWidth() {\n $(\"#hunger\").css(\"width\", `${this.hunger}%`)\n $(\"#energy\").css(\"width\", `${this.energy}%`)\n $(\"#hygiene\").css(\"width\", `${this.hygiene}%`)\n $(\"#fun\").css(\"width\", `${this.fun}%`)\n }",
"set width(width) {\n // this._width = width;\n }",
"set width(width) {\n // this._width = width;\n }",
"setWidth(width) {\n this.width = width;\n }",
"function setWidth() {\n\t\t\t\tvar width;\n\t\t\t\tvar style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false;\n\t\t\t\t\n\t\t\t\tif (style) {\n\n\t\t\t\t\twidth = ta.getBoundingClientRect().width;\n\n\t\t\t\t\tif (width === 0) {\n\t\t\t\t\t\twidth = parseInt(style.width,10);\n\t\t\t\t\t}\n\n\t\t\t\t\t$.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){\n\t\t\t\t\t\twidth -= parseInt(style[val],10);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\twidth = Math.max($ta.width(), 0);\n\t\t\t\t}\n\n\t\t\t\tmirror.style.width = width + 'px';\n\t\t\t}",
"function setWidth() {\r\n /*determind the siblings of the box in focus*/\r\n var boxSiblings = $(this).siblings();\r\n /*count the number of siblings a box has*/\r\n var numberOfSiblings = boxSiblings.length;\r\n /*determine the size the box should scale to*/\r\n var lg = newFeatureBoxWidth;\r\n var lgString = lg + \"%\";\r\n /*determine the remaining space int eh row after the box has scaled*/\r\n var rem = (100 - lg) / numberOfSiblings;\r\n var remString = rem + \"%\";\r\n /*determine which box should be scaled*/\r\n var boxFocus = $(this);\r\n\r\n /*disable box scaling on mobile/devices smaller than 769px*/\r\n if ($(window).width() >= 769) {\r\n TweenLite.to(boxFocus, 0.5, {width: lgString});\r\n TweenLite.to(boxSiblings, 0.5, {width: remString});\r\n }\r\n }",
"function setWidth() {\n\t\t\t\tvar width;\n\t\t\t\tvar style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false;\n\t\t\t\t\n\t\t\t\tif (style) {\n\n\t\t\t\t\twidth = ta.getBoundingClientRect().width;\n\n\t\t\t\t\tif (width === 0 || typeof width !== 'number') {\n\t\t\t\t\t\twidth = parseInt(style.width,10);\n\t\t\t\t\t}\n\n\t\t\t\t\t$.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){\n\t\t\t\t\t\twidth -= parseInt(style[val],10);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\twidth = $ta.width();\n\t\t\t\t}\n\n\t\t\t\tmirror.style.width = Math.max(width,0) + 'px';\n\t\t\t}",
"function setWidth() {\n\t\t\t\tvar width;\n\t\t\t\tvar style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false;\n\t\t\t\t\n\t\t\t\tif (style) {\n\n\t\t\t\t\twidth = ta.getBoundingClientRect().width;\n\n\t\t\t\t\tif (width === 0 || typeof width !== 'number') {\n\t\t\t\t\t\twidth = parseInt(style.width,10);\n\t\t\t\t\t}\n\n\t\t\t\t\t$.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){\n\t\t\t\t\t\twidth -= parseInt(style[val],10);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\twidth = $ta.width();\n\t\t\t\t}\n\n\t\t\t\tmirror.style.width = Math.max(width,0) + 'px';\n\t\t\t}",
"function setWidth() {\n\t\t\t\tvar width;\n\t\t\t\tvar style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false;\n\t\t\t\t\n\t\t\t\tif (style) {\n\n\t\t\t\t\twidth = ta.getBoundingClientRect().width;\n\n\t\t\t\t\tif (width === 0 || typeof width !== 'number') {\n\t\t\t\t\t\twidth = parseInt(style.width,10);\n\t\t\t\t\t}\n\n\t\t\t\t\t$.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){\n\t\t\t\t\t\twidth -= parseInt(style[val],10);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\twidth = $ta.width();\n\t\t\t\t}\n\n\t\t\t\tmirror.style.width = Math.max(width,0) + 'px';\n\t\t\t}",
"function setWidth() {\r\n\t\t\t\tvar width;\r\n\t\t\t\tvar style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false;\r\n\t\t\t\t\r\n\t\t\t\tif (style) {\r\n\r\n\t\t\t\t\twidth = ta.getBoundingClientRect().width;\r\n\r\n\t\t\t\t\tif (width === 0 || typeof width !== 'number') {\r\n\t\t\t\t\t\twidth = parseInt(style.width,10);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t$.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){\r\n\t\t\t\t\t\twidth -= parseInt(style[val],10);\r\n\t\t\t\t\t});\r\n\t\t\t\t} else {\r\n\t\t\t\t\twidth = $ta.width();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tmirror.style.width = Math.max(width,0) + 'px';\r\n\t\t\t}",
"applyWidth() {\n var columns = this.template.querySelectorAll('.dynamicColumn');\n for (var i = 0; i < columns.length; i++) {\n columns[i].style.width = this.percentage + \"%\";\n //columns[i].style.display = \"inline\";\n columns[i].style.textAlign = \"center\";\n //columns[i].style.border = \"1px solid #4CAF50\";\n }\n }",
"function setEltWidth(elt,wdth)\n{\n\tif(is.nav4)\n { \n\t elt.document.width = wdth;\n }\n else if(elt.style)\n { \n elt.style.width = wdth;\n }\n}",
"set width(width) {\n this._width = width;\n this.updateSize();\n }",
"function setWidth() {\n\t\t\t\tvar width;\n\t\t\t\tvar style = window.getComputedStyle ? window.getComputedStyle(ta, null) : null;\n\n\t\t\t\tif (style) {\n\t\t\t\t\twidth = parseFloat(style.width);\n\t\t\t\t\tif (style.boxSizing === 'border-box' || style.webkitBoxSizing === 'border-box' || style.mozBoxSizing === 'border-box') {\n\t\t\t\t\t\t$.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){\n\t\t\t\t\t\t\twidth -= parseFloat(style[val]);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\twidth = $ta.width();\n\t\t\t\t}\n\n\t\t\t\tmirror.style.width = Math.max(width,0) + 'px';\n\t\t\t}",
"function changeCanvasElementsWidth() {\n canvasWrapperParentElement.style.width = `calc(100% - ${rightSideBar.width + leftSideBar.width}px)`;\n // could be the reason for uneven results\n zoomOverflowWrapperParentElement.style.width = `calc(100% - ${rightSideBar.width + leftSideBar.width + 1}px)`;\n}",
"function setWidth() {\n\t\t\t\t\tvar width;\n\t\t\t\t\tvar style = window.getComputedStyle ? window.getComputedStyle(ta, null) : null;\n\n\t\t\t\t\tif (style) {\n\t\t\t\t\t\twidth = parseFloat(style.width);\n\t\t\t\t\t\tif (style.boxSizing === 'border-box' || style.webkitBoxSizing === 'border-box' || style.mozBoxSizing === 'border-box') {\n\t\t\t\t\t\t\t$.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function (i, val) {\n\t\t\t\t\t\t\t\twidth -= parseFloat(style[val]);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\twidth = $ta.width();\n\t\t\t\t\t}\n\n\t\t\t\t\tmirror.style.width = Math.max(width, 0) + 'px';\n\t\t\t\t}",
"function setWidths(evt) {\n let newColWidth = (resize.colStartWidth + evt.clientX - resize.startX),\n newSibWidth = (resize.sibStartWidth - evt.clientX + resize.startX),\n numToPercentString = (num) => {\n return num.toString() + '%';\n },\n percent = (width) => {\n return (width / resize.rowWidth * 100);\n },\n colWidthPercent = percent(newColWidth),\n sibWidthPercent = percent(newSibWidth);\n\n column.dataset.colWidth = numToPercentString(Math.round(colWidthPercent));\n sibling.dataset.colWidth = numToPercentString(Math.round(sibWidthPercent));\n\n column.style.width = numToPercentString(colWidthPercent);\n sibling.style.width = numToPercentString(sibWidthPercent);\n }",
"updateWidth() {\n this.get('objectlistviewEventsService').updateWidthTrigger();\n }",
"function setMaxXSWidth(width){\n xs = width;\n }"
]
| [
"0.7077539",
"0.7010517",
"0.6996412",
"0.6984562",
"0.698392",
"0.6913587",
"0.69069856",
"0.6885303",
"0.6835429",
"0.6812564",
"0.67487574",
"0.6721842",
"0.66989815",
"0.66989815",
"0.66935444",
"0.6677265",
"0.6660298",
"0.6651036",
"0.6651036",
"0.6651036",
"0.66369313",
"0.6632199",
"0.6610668",
"0.66016936",
"0.6586424",
"0.65712005",
"0.65649927",
"0.6547797",
"0.6539063",
"0.6518368"
]
| 0.80272555 | 0 |
Ajax Call for Username Forgot Page. | function UsernameAjaxMethod() {
var user = $("#usernameCheck").val();
$.ajax({
type: "POST",
url: "Login.aspx/UsernameForgotPageMethod",
data: "{Forgotuser: '" + user + "'}",
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function (response) {
$('.UsernameCheck').fadeOut(function () {
$('.ContactCheck').fadeIn(700);
});
},
error: function () {
if (user == "") {
$('#ErrorUser').text("Username is Empty");
$('#ErrorUser').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' });
$('#ErrorUser').addClass('animated shake');
return false;
}
else {
$('#ErrorUser').text("Username is incorrect, if you have forgot your username, you are not able to go forward, you can contact from the Website Owner (+923159382193) regarding you account's unlock.");
$('#ErrorUser').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '2', 'font-size': '15px' });
$('#ErrorUser').addClass('animated shake');
}
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function reset_password()\n{\n\tvar username=$('#username').val();\n\tif(username=='')\n\t{\n\t\talert('please enter email id');\n\t}\n\telse\n\t{\n\t\t$.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl:\"http://codeuridea.net/kidssitter/resetting/send-email\",\n\t\t\t\tdata:{'username':$('#username').val()},\n\t\t\t\tdataType: \"json\",\n\t\t\t\tcrossDomain: true\n\t\t\t});\n\t}\n}",
"function submitForgotUsername(){\n\ttry{\n\t\tvar license = $.txtfieldLicense.value;\n\t\tlicense = license.replace(/&(?!amp;)/g, '&');\n\t var\tmail = $.txtfieldMail.value;\n\t var\temiratesid = $.txtfieldEmirateId.value.replace(/[-]/gi, \"\");\n\t Ti.API.info('emiratesid '+emiratesid);\n\t var\tmobile = $.txtfieldMobile.value.replace(/[-]/gi, \"\");\n\t var\tpassport = $.txtfieldPassport.value;\n\t passport = passport.replace(/&(?!amp;)/g, '&');\n\t var lblEmiratesPassport;\n\t \n\tif($.imgIndividual.image === Alloy.Globals.path.radioActive){\n\t\tif(emiratesid === \"\" && passport === \"\"){\n\t\t\tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.validateHintText,function(){});\n\t\t}else if(mail === \"\"){\n\t\t \tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.mailId,function(){});\n\t\t}else if(mobile === \"\"){\n\t\t utilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.mobileNumber,function(){});\n\t\t}else if (emiratesid !== \"\" && emiratesid.length < 15) {\n\t\t\t$.txtfieldEmirateId.value = \"\";\n\t\t \tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.invalidEmiratesId,function(){});\n\t\t}\n\t\telse if (mobile.length !== 10 && mobile.value !== \"\") {\n\t\t \tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.mobileLength,function(){});\n\t\t}else{\n\t\t\ttry{\n\t\t\t\tlblEmiratesPassport = (emiratesid !== \"\")?emiratesid:passport;\n\t\t\t\thttpManager.forgetUsername(function(result){\n\t\t\t\tvar rootNode = result.getElementsByTagName(\"output\");\n\t\t\t\tvar ns =\"http://ForgetUserName\";\n\t\t\t\t//var subNode = result.response.getElementsByTagNameNS(\"ns1:Status\");\n\t\t\t\tif(rootNode.length > 0){\n\t\t\t\t\tvar status = result.getElementsByTagNameNS(ns, \"Status\").item(0).textContent;\n\t\t\t\t\t\n\t\t\t\t\tif(status === \"Success\"){\n\t\t\t\t\t\tAlloy.Globals.hideLoading();\n\t\t\t\t\t\tvar alertView = Ti.UI.createAlertDialog({\n\t\t\t\t\t\t\ttitle : Alloy.Globals.selectedLanguage.appTitle,\n\t\t\t\t\t\t\tmessage : (Alloy.Globals.isEnglish)?result.getElementsByTagNameNS(ns, \"Message_EN\").item(0).textContent:result.getElementsByTagNameNS(ns, \"Message_AR\").item(0).textContent,\n\t\t\t\t\t\t\tbuttonNames : [Alloy.Globals.selectedLanguage.ok]\n\t\t\t\t\t\t});\n\t\t\t\t\t\talertView.addEventListener('click', function(e) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (e.index == 0) {\n\t\t\t\t\t\t\t\tvar winMenu = Alloy.createController('UserManagement/winLogin',{\n\t\t\t\t\t\t\t\t\tisFromLeftPanel : false\n\t\t\t\t\t\t\t\t}).getView();\n\t\t\t\t\t\t\t\tAlloy.Globals.openWindow(winMenu);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\talertView.show();\n\t\t\t\t\t}else if(status === \"Failure\"){\n\t\t\t \t\t\tAlloy.Globals.hideLoading();\n\t\t\t \t\t\tvar alertView = Ti.UI.createAlertDialog({\n\t\t\t\t\t\t\t\ttitle : Alloy.Globals.selectedLanguage.appTitle,\n\t\t\t\t\t\t\t\tmessage : (Alloy.Globals.isEnglish)?result.getElementsByTagNameNS(ns, \"Message_EN\").item(0).textContent:result.getElementsByTagNameNS(ns, \"Message_AR\").item(0).textContent,\n\t\t\t\t\t\t\t\tbuttonNames : [Alloy.Globals.selectedLanguage.ok]\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\talertView.show();\n\t\t\t \t\t}\n\t\t\t\t}else{\n\t\t \t\tvar alertView = Ti.UI.createAlertDialog({\n\t\t\t\t\t\ttitle : Alloy.Globals.selectedLanguage.appTitle,\n\t\t\t\t\t\tmessage : Alloy.Globals.selectedLanguage.serviceError,\n\t\t\t\t\t\tbuttonNames : [Alloy.Globals.selectedLanguage.ok]\n\t\t\t\t });\n\t\t\t\t alertView.show();\n\t\t \t Alloy.Globals.hideLoading();\n\t\t \t}\n\t\t\t\tAlloy.Globals.hideLoading();\n\t\t\t},1,mail,mobile,lblEmiratesPassport);\n\t\t\t}catch(e){\n\t\t\t\tTi.API.info('Error '+e.message);\n\t\t\t}\n\t\t}\n\t}else if($.imgEstablishment.image === Alloy.Globals.path.radioActive){\n\t\tif(license === \"\"){\n\t\t utilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.licenseNumber,function(){});\n\t }else if(mail === \"\"){\n\t\t \tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.mailId,function(){});\n\t\t}else if(mobile === \"\"){\n\t\t utilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.mobileNumber,function(){});\n\t\t}\n\t\t// else if (isNaN(mobile)) {\n\t\t \t// utilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.invalidMobile,function(){});\n\t\t// }\n\t\telse if (mobile.length !== 10 && mobile.value !== \"\") {\n\t\t \tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.mobileLength,function(){});\n\t\t}else{\n\t\t\ttry{\n\t\t\t\thttpManager.forgetUsername(function(result){\n\t\t\t\tvar rootNode = result.getElementsByTagName(\"output\");\n\t\t\t\tvar ns =\"http://ForgetUserName\";\n\t\t\t\t//var subNode = result.getElementsByTagName(\"ns1:Status\");\n\t\t\t\tvar ns =\"http://ForgetUserName\";\n\t\t \tif(rootNode.length > 0){\n\t\t \t\t\t \t\t\n\t\t \t\tvar status = result.getElementsByTagNameNS(ns, \"Status\").item(0).textContent;\n\t\t \t\t\n\t\t \t\tif(status === \"Success\"){\n\t\t \t\t\t\n\t\t \t\t\tvar alert = Ti.UI.createAlertDialog({\n\t\t\t\t\t\t\ttitle : Alloy.Globals.selectedLanguage.appTitle,\n\t\t\t\t\t\t\tmessage : (Alloy.Globals.isEnglish)?result.getElementsByTagNameNS(ns, \"Message_EN\").item(0).textContent:result.getElementsByTagNameNS(ns, \"Message_AR\").item(0).textContent,\n\t\t\t\t\t\t\tbuttonNames : [Alloy.Globals.selectedLanguage.ok]\n\t\t\t\t\t\t});\n\t\t\t\t\t\talert.addEventListener('click', function(e) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (e.index == 0) {\n\t\t\t\t\t\t\t\tvar winMenu = Alloy.createController('UserManagement/winLogin',{\n\t\t\t\t\t\t\t\t\tisFromLeftPanel : false\n\t\t\t\t\t\t\t\t}).getView();\n\t\t\t\t\t\t\t\tAlloy.Globals.openWindow(winMenu);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\talert.show();\n\t\t \t\t}else if(status === \"Failure\"){\n\t\t\t \t\t\tAlloy.Globals.hideLoading();\n\t\t\t \t\t\tvar alert = Ti.UI.createAlertDialog({\n\t\t\t\t\t\t\t\ttitle : Alloy.Globals.selectedLanguage.appTitle,\n\t\t\t\t\t\t\t\tmessage : (Alloy.Globals.isEnglish)?result.getElementsByTagNameNS(ns, \"Message_EN\").item(0).textContent:result.getElementsByTagNameNS(ns, \"Message_AR\").item(0).textContent,\n\t\t\t\t\t\t\t\tbuttonNames : [Alloy.Globals.selectedLanguage.ok]\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\talert.show();\n\t\t\t \t}\n\t\t \t}else{\n\t\t \t\tvar alert = Ti.UI.createAlertDialog({\n\t\t\t\t\ttitle : Alloy.Globals.selectedLanguage.appTitle,\n\t\t\t\t\t//title:\"tset\",\n\t\t\t\t\tmessage : Alloy.Globals.selectedLanguage.serviceError,\n\t\t\t\t\tbuttonNames : [Alloy.Globals.selectedLanguage.ok]\n\t\t\t\t });\n\t\t\t\t alert.show();\n\t\t \t Alloy.Globals.hideLoading();\n\t\t \t}\n\t\t \tAlloy.Globals.hideLoading();\n\t\t\t},2,mail,mobile,license);\n\t\t\t}catch(e){\n\t\t\t\tTi.API.info('Error '+e.message);\n\t\t\t}\n\t\t}\n\t}\n\t}catch(e){\n\t\tTi.API.info('Error in submit forget data function '+JSON.stringify(e));\n\t}\n}",
"function ajaxUsername(){\r\n\tif($(\"#username\").val()!=\"\"){\r\n\t\t$.ajax(\"/register/user/\",{\r\n\t\t\tdata:{username:$(\"#username\").val()},\r\n\t\t\ttype:\"GET\",\r\n\t\t\tdataType:\"text\",\r\n\t\t\tsuccess: function(data){\r\n\t\t\t\tif(data==\"true\"){\r\n\t\t\t\t\tsuccessMsg($(\"#username\"));\r\n\t\t\t\t} else {\r\n\t\t\t\t\tspecError($(\"#username\"),\"username in use\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n}",
"checkUsername(username, email, for_user_id) {\n\n return Nilavu.ajax('/users/check_email', {\n data: {\n username,\n email,\n for_user_id\n }\n });\n }",
"function forgotPassword() { \n\n\t\t\t$( \"#load\" ).show();\n\t\t\t\n\t\t\tvar form = new FormData(document.getElementById('reset_form'));\n\t\t\t\n\t\t\tvar validate_url = $('#reset_form').attr('action');\n\t\t\t\n\t\t\t$.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: validate_url,\n\t\t\t\t//data: dataString,\n\t\t\t\tdata: form,\n\t\t\t\t//dataType: \"json\",\n\t\t\t\tcache : false,\n\t\t\t\tcontentType: false,\n\t\t\t\tprocessData: false,\n\t\t\t\tsuccess: function(data){\n\n\t\t\t\t\t\n\t\t\t\t\tif(data.success == true ){\n\t\t\t\t\t\t\n\t\t\t\t\t\t$( \"#load\" ).hide();\n\t\t\t\t\t\t$(\"input\").val('');\n\t\t\t\t\t\t\n\t\t\t\t\t\t$(\".forgot-password-box\").html(data.notif);\n\t\n\t\t\t\t\t\tsetTimeout(function() { \n\t\t\t\t\t\t\t//$(\"#notif\").slideUp({ opacity: \"hide\" }, \"slow\");\n\t\t\t\t\t\t\t//window.location.reload(true);\n\t\t\t\t\t\t}, 2000); \n\n\t\t\t\t\t}else if(data.success == false){\n\t\t\t\t\t\t$( \"#load\" ).hide();\n\t\t\t\t\t\t$(\"#notif\").html(data.notif);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t},error: function(xhr, status, error) {\n\t\t\t\t\t$( \"#load\" ).hide();\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn false;\n\t\t}",
"function cancelForgotUsername(){\n\tcloseWindow();\n}",
"function forgotPassword(divid,url,mailid,type,fid){\n\t var emailvalue=document.getElementById(mailid).value;\n\t \n\t\t\t emailvalue=rm_trim(emailvalue);\n\t\t\t if(emailvalue==''){\n\t\t\t alert(\"Please Enter Email\");\n\t\t\t document.getElementById(mailid).focus();\n\t\t\t return false;\n\t\t\t }\n\t\t\t else if(!emailValidator(emailvalue)){\n\t\t\t\t\talert(\"Invalid Email \");\n\t\t\t\t\tdocument.getElementById(divid).innerHTML=\"\";\n\t\t\t\t\tdocument.getElementById(mailid).value=\"\";\n\t\t\t\t\tocument.getElementById(mailid).focus();\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t }\n\t\t\t\t\t // alert(url);\n\t\t\turl=url+\"&email=\"+emailvalue;\n\t\t\tgetServerResponse(divid,url,\"\",true)\n}",
"function vpb_request_password_link()\n{\n\tvar ue_data = $(\"#ue_data\").val();\n\t\n\tif(ue_data == \"\")\n\t{\n\t\t$(\"#ue_data\").focus();\n\t\t$(\"#this_page_errors\").html('<div class=\"vwarning\">'+$(\"#empty_username_field\").val()+'</div>');\n\t\t$('html, body').animate({\n\t\t\tscrollTop: $('#ue_data').offset().top-parseInt(200)+'px'\n\t\t}, 1600);\n\t\treturn false;\n\t} else {\n\t\tvar dataString = {'ue_data': ue_data, 'page':'reset-password-validation'};\n\t\t$.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: vpb_site_url+'forget-password',\n\t\t\tdata: dataString,\n\t\t\tcache: false,\n\t\t\tbeforeSend: function() \n\t\t\t{\n\t\t\t\t$(\"#this_page_errors\").html('');\n\t\t\t\t$(\"#disable_or_enable_this_box\").removeClass('enable_this_box');\n\t\t\t\t$(\"#disable_or_enable_this_box\").addClass('disable_this_box');\n\t\t\t\t\n\t\t\t\t$(\"#forgot_password_buttoned\").hide();\n\t\t\t\t$(\"#log_in_status\").html('<center><div align=\"center\"><img style=\"margin-top:-40px;\" src=\"'+vpb_site_url+'img/loadings.gif\" align=\"absmiddle\" alt=\"Loading\" /></div></center>');\n\t\t\t},\n\t\t\tsuccess: function(response)\n\t\t\t{\n\t\t\t\t$(\"#disable_or_enable_this_box\").removeClass('disable_this_box');\n\t\t\t\t$(\"#disable_or_enable_this_box\").addClass('enable_this_box');\n\t\t\n\t\t\t\t$(\"#log_in_status\").html('');\n\t\t\t\t$(\"#forgot_password_buttoned\").show();\n\t\t\t\t\t\n\t\t\t\tvar response_brought = response.indexOf(\"processCompletedStatus\");\n\t\t\t\t$vlog=JSON.parse(response);\n\t\t\t\tif(response_brought != -1)\n\t\t\t\t{\n\t\t\t\t\tif($vlog.processCompletedStatus==true){\n $(\"#ue_data\").val('');\n $(\"#this_page_errors\").html($vlog.response);\n return false;\n\t\t\t\t\t}else{\n setTimeout(function() {\n \twindow.alert(\"To change the password you first need to verify the account by entering the verification code which was sent to your gmail account earlier while sign up in the 'Enter the verification code ... ' field to proceed.\");\n window.location.replace(vpb_site_url+'verification');\n },500);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$(\"#this_page_errors\").html($vlog.response);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}",
"function check_username(str,field_name,id){\n\tvar eid =\"#\"+field_name;\n\t$.ajax({\n\t\t\t type: 'POST',\n\t\t\t url: ADMINSITEURL+\"ajax/check_username\",\n\t\t\t data: {st:str,bid:id},\n\t\t\t success: function(response) {\n\t\t\t \tif(!response.status){\n\t\t\t \t\t//alert(eid);\n\t\t\t \t\t$(eid).val('');\n\t\t\t \t\t$(eid).after(\"<span class='form-error' style='color:red;'>\"+response.message+\"</span>\");\n\t\t\t \t}\n\n\t\t\t }\n\t\t })\n}",
"function resetPassword(email){\n $.ajax({\n method: 'POST',\n url: \"inc/Auth/forget.php\",\n data: {email: email}\n }).done(function(msg){\n if(msg == 'user issue')\n {\n AJAXloader(false, '#loader-pass-forgot');\n displayMessagesOut();\n $('.error-field').addClass('novisible');\n $('.error-forgot-exist').removeClass('novisible');\n displayError([], '#pass-forgot-form', ['input[name=\"pass-forgot\"]'], '');\n }\n if(msg == 'confirm issue')\n {\n AJAXloader(false, '#loader-pass-forgot');\n displayMessagesOut();\n $('.error-field').addClass('novisible');\n $('.error-forgot-confirm').removeClass('novisible');\n displaySpecial([], '#pass-forgot-form', ['input[name=\"pass-forgot\"]'], '');\n }\n //ce msg est un retour de la fonction de mail et non de la fonction de reset\n if(msg == 'success')\n {\n AJAXloader(false, '#loader-pass-forgot');\n displayMessagesOut();\n $('.error-field').addClass('novisible');\n $('.valid-forgot').removeClass('novisible');\n displaySuccess([], '#pass-forgot-form', ['input[name=\"pass-forgot\"]'], '');\n }\n });\n}",
"function checkUsername()\r\n{\r\n var username = document.getElementById(\"userBox\").value;\r\n if(username != \"\") {\r\n \t$.ajax({\r\n \t type: 'POST',\r\n \t url: 'DBFuncs.php',\r\n \t data: { functionName:'checkUsernameReg',argument:[username] },\r\n\t success: function (response){\r\n \t if(response == 0) {\r\n\t \t document.getElementById(\"userMessage\").innerHTML=\"Username is already in use\";\r\n\t }\r\n else {\r\n\t \t document.getElementById(\"userMessage\").innerHTML=\"Username is avaliable\";\r\n\t }\r\n\t }\r\n\t});\r\n }\r\n}",
"function checkEmailExist(email,entity_id){\n $.ajax({\n type: \"POST\",\n url: BASEURL+\"backoffice/users/checkEmailExist\",\n data: 'email=' + email +'&entity_id='+entity_id,\n cache: false,\n success: function(html) {\n if(html > 0){\n $('#EmailExist').show();\n $('#EmailExist').html(\"User is already exist with this email id!\"); \n $(':input[type=\"submit\"]').prop(\"disabled\",true);\n } else {\n $('#EmailExist').html(\"\");\n $('#EmailExist').hide(); \n $(':input[type=\"submit\"]').prop(\"disabled\",false);\n }\n },\n error: function(XMLHttpRequest, textStatus, errorThrown) { \n $('#EmailExist').show();\n $('#EmailExist').html(errorThrown);\n }\n });\n}",
"function forgotPasswordDetails\n(\n emailID\n)\n{\n var data;\n var username = getEncode(emailID); \n var iv = username.iv; \n username = username.activate;\n \n var dataToSend = \n {\n \"action\" : VALIDATE_USER,\n \"iv\" : JSON.stringify(iv),\n \"encodeUN\" : JSON.stringify(username), \n \"activate\" : false\n }\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 \n return false;\n },\n success : function(result)\n { \n data = result; \n }\n \n });\n return data;\n}",
"function checkUsernames() {\n var inputtedUser = inputUser.val().trim();\n var inputtedZip = inputZip.val().trim();\n console.log(\"Username input: \" + inputtedUser);\n var userString = \"/\" + inputtedUser;\n\n $.get(\"/check-user\" + userString, function(data) {\n console.log(data);\n if (data === null) {\n updateUsername(inputtedUser, inputtedZip)\n }\n\n else {\n nameHelpText.text(\"Sorry. That user exists. Please try again\")\n console.log(\"User exists. Try a different username\")\n renderModal();\n }\n })\n }",
"function doRetrieve(){\n\t$j('forgetResult').html('Please Wait... <img src=\"static/loading.gif\"/>').slideDown();\n\t\n\tvar params = prepForQuery(getFormVars('forgot'));\n\t\n\t$j.ajax({\n\t\turl: \"user/forgot\",\n\t\ttype: 'post',\n\t\tdata: params,\n\t\tsuccess: returnForgot\n\t});\n}",
"function check_username(username,div,url)\r\n{ //var ruta_imagenes=document.getElementById('ruta_imagenes').value;\r\n\t//document.getElementById( div ).innerHTML='<br><div align=\"center\" style=\"height:100%;\"><i style=\"font-size:large;color:darkred;\" class=\"fa fa-cog fa-spin\"></i></div>';\r\n\tvar data = new FormData();\r\n\tdata.append('event', 'check_username');\t\r\n\tdata.append('username', username);\t\r\n\tvar xhr = new XMLHttpRequest();\r\n\txhr.open('POST', url , true);\r\n\txhr.onreadystatechange=function()\r\n\t{ if (xhr.readyState==4 && xhr.status==200)\r\n\t\t{ $(\"#check_username\").removeClass(\"has-success\");\r\n\t\t\t$(\"#check_username\").removeClass(\"has-error\");\r\n\t\t\t$(\"#check_username\").addClass(xhr.responseText);\r\n\t\t\tif (username==\"\")\r\n\t\t\t\t$(\"#check_username\").removeClass(xhr.responseText);\r\n\t\t}\r\n\t};\r\n\txhr.send(data);\r\n}",
"function checkUser() {\r\n // abort previous request, if any\r\n if (uaro != undefined) uaro.abort();\r\n\r\n reset_username_status();\r\n\r\n uaro = $j.ajax({\r\n url: 'checkMemberID.php',\r\n type: 'GET',\r\n data: { 'memberID': $j('#username').val() },\r\n success: function (resp) {\r\n var ua = resp;\r\n if (ua.match(/\\<!-- AVAILABLE --\\>/)) {\r\n reset_username_status('success');\r\n } else {\r\n reset_username_status('error');\r\n }\r\n }\r\n });\r\n}",
"function UsernamePasswordTwoCheckAjaxMethod() {\n var user = $(\"#usernameCheck\").val();\n var pwdTwo = $(\"#PasswordTwoCheck\").val();\n $.ajax({\n type: \"POST\",\n url: \"Login.aspx/UsernameAndPasswordTwoCheckForgotPageMethodAjax\",\n data: \"{userCheck:'\" + user + \"', pwdCheck:'\" + pwdTwo + \"'}\",\n dataType: \"json\",\n contentType: \"application/json; charset=utf-8\",\n success: function () {\n $('.PasswordCheck').fadeOut(function () {\n $('.AllisGood').fadeIn(700);\n });\n },\n error: function () {\n if (pwdTwo == \"\") {\n $('#ErrorPwd2').text(\"Password is Empty\");\n $('#ErrorPwd2').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' });\n $('#ErrorPwd2').addClass('animated shake');\n return false;\n }\n else\n $('#ErrorPwd2').text(\"Password is Incorrect\");\n }\n });\n}",
"function ajaxLoggedInUsername() {\n $.ajax({\n url: USER_LIST_URL,\n data: {\n action: \"username\"\n },\n success: function(username) {\n $.each($(\".username-logged-in\") || [], function(index, element) {\n element.innerHTML = username;\n });\n },\n error: function(relocation) {\n window.location.href = buildUrlWithContextPath(relocation.responseText);\n }\n });\n}",
"function UsernamePasswordCheckAjaxMethod() {\n var user = $(\"#usernameCheck\").val();\n var pwd1 = $('#PasswordOneCheck').val();\n $.ajax({\n type: \"POST\",\n url: \"Login.aspx/UsernameAndPasswordOneCheckForgotPageMethod\",\n data: \"{userCheck:'\" + user + \"', pwdCheck:'\" + pwd1 + \"'}\",\n dataType: \"json\",\n contentType: \"application/json; charset=utf-8\",\n success: function () {\n $('.ContactCheck').fadeOut(function () {\n $('.AllisGood').fadeIn(700);\n });\n },\n error: function () {\n if(pwd1 == \"\")\n {\n $('#ErrorPwd1').text(\"Password is Empty\");\n $('#ErrorPwd1').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' });\n $('#ErrorPwd1').addClass('animated shake');\n return false;\n }\n else\n $('#ErrorPwd1').text(\"Password is Incorrect\");\n }\n });\n}",
"function oldUsernameAjaxValidator() {\n\t\t\t//console.log(\"Executing test ajax function\");\n\t\t\tvar xmlhttp;\n\t\t\tif (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari\n\t\t\t\txmlhttp=new XMLHttpRequest();\n\t\t\t}\n\t\t\telse {// code for IE6, IE5\n\t\t\t\txmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n\t\t\t}\n\t\t\t//console.log(\"xml request created\");\n\t\t\txmlhttp.onreadystatechange=function() {\n\t\t\t\t//console.log(\"ready state changed\");\n\t\t\t\tif (xmlhttp.readyState==4) {\n\t\t\t\t\tif (xmlhttp.responseText == 1) {\n\t\t\t\t\t\tdocument.getElementById('oldusernamemessage').innerHTML = \"Logged in !!!\";\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Validation successful , now log in the user\n\t\t\t\t\t\tdocument.getElementById('oldUserName').submit();\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t//document.getElementById('usernamemessage').innerHTML = xmlhttp.responseText;\n\t\t\t\t\t\tdocument.getElementById('oldusernamemessage').innerHTML = \"Username not found !!!\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\txmlhttp.open(\"POST\",\"oldUsernameValidator.php\",true);\n\t\t\t//console.log(\"POST method set\");\n\t\t\txmlhttp.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\");\n\t\t\t//console.log(\"request header set\");\n\t\t\t//console.log(document.getElementById('oldusername').value);\n\t\t\txmlhttp.send(\"username=\" + document.getElementById('oldusername').value);\n\t\t\t//console.log(\"request sent\");\n\t\t\t\n\t\t}",
"function sendEmailForgot() {\n var password = newPss();\n var emailToSendPassword = $(\"#emailSendingInput\").val();\n\n if (!validateForm(emailToSendPassword)) {\n swal(\"טעות\", \"האימייל אינו נכון נסה שנית\", \"warning\");\n $('#emailSendingInput').focus();\n return\n }\n $.ajax({\n type: 'POST',\n url: sendPassByEmail,\n data: {\n email: emailToSendPassword,\n password: password,\n },\n success: function (response) {\n if (response) {\n swal(\"אימייל נשלח\", \"סיסמא חדשה נשלחה לאימייל שצויין\", \"success\");\n $(\"#myForgotPasswordModal\").modal('hide');\n $(\"#myLogin\").modal('hide');\n }\n else\n swal(\"שגיאה\", \"נסיון שליחת אימייל עם סיסמה חדשה נכשל\", \"error\");\n }\n });\n}",
"function change_username() {\n\tvar new_username = document.getElementById(\"new_username\").value;\n\tif(new_username == \"\") alert(\"New username field is empty\");\n\t\n\tconst uri = getLink(\"UpdateUsername\");\n\tvar xhr = createRequest(\"POST\", uri);\n\txhr.send(new_username);\n\txhr.onload = function() {\n\t\tif(xhr.status == 409) alert(\"Username already exists\");\n\t\telse if(xhr.status != 200) alert(\"Something went wrong on the server :/\");\n\t\telse {\n\t\t\tlocalStorage.setItem(\"user\", xhr.response);\n\t\t\tuser = JSON.parse(localStorage.getItem(\"user\"));\n\t\t\tconsole.log(user);\n\t\t\tsetUserItems();\n\t\t\tshow_user_content();\n\t\t\tdocument.getElementById(\"new_username\").value = \"\";\n\t\t}\n\t}\n}",
"function managePasswordForgotten() {\n\t$('#passwordReset').click(function() { \n\t\t// We must reset the document and send a link to the registered email\n\t\t// to a form where the end user can update the password\n\t\tclearDocument();\n\t\tloadHTML(\"navbar.html\");\n\t\tnavbarHover();\n\t\t$(document.body).append(\"<center><h1>Please fill in the following form !</h1><center>\");\n\t\tloadHTML(\"passwordForgotten.html\");\n\t\tloadJS(\"js/forms.js\");\n formSubmission('#passwordForgotten','generatePasswordLnkRst','Reset email successfully sent','Unknown user');\n loadHTML(\"footer.html\");\n\t});\n}",
"function newUsernameAjaxValidator() {\n\t\t\t//console.log(\"Executing test ajax function\");\n\t\t\tvar xmlhttp;\n\t\t\tif (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari\n\t\t\t\txmlhttp=new XMLHttpRequest();\n\t\t\t}\n\t\t\telse {// code for IE6, IE5\n\t\t\t\txmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n\t\t\t}\n\t\t\t//console.log(\"xml request created\");\n\t\t\txmlhttp.onreadystatechange=function() {\n\t\t\t\t//console.log(\"ready state changed\");\n\t\t\t\tif (xmlhttp.readyState==4) {\n\t\t\t\t\tif (xmlhttp.responseText == 1) {\n\t\t\t\t\t\tdocument.getElementById('newusernamemessage').innerHTML = \"Successful !!!\";\n\t\t\t\t\t\tdocument.getElementById('newUserName').submit();\t\t//8888888888888888\tNew username created , so log the new user in \n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t//document.getElementById('usernamemessage').innerHTML = xmlhttp.responseText;\n\t\t\t\t\t\tdocument.getElementById('newusernamemessage').innerHTML = \"Username already exists !!!\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\txmlhttp.open(\"POST\",\"newUsernameValidator.php\",true);\n\t\t\t//console.log(\"POST method set\");\n\t\t\txmlhttp.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\");\n\t\t\t//console.log(\"request header set\");\n\t\t\t//console.log(document.getElementById('newusername').value);\n\t\t\txmlhttp.send(\"username=\" + document.getElementById('newusername').value);\n\t\t\t//console.log(\"request sent\");\n\t\t\t\n\t\t}",
"function postResetPassword(data, textStatus, jqXHR, param) {\n\tvar user = param.user;\n\tvar uiDiv = $('#ui');\n\tuiDiv.html('');\n\tvar p = $('<p>');\n\tuiDiv.append(p);\n\tp.html('The password for \"' + user + '\" has been reset.');\n\tvar ul = $('<ul>');\n\tuiDiv.append(ul);\n\tvar li = $('<li>');\n\tul.append(li);\n\tli.html('New password: \"' + data[user] + '\"');\n}",
"function chkLogin_for_existinguser(pBody,email, password, bounceval)\n{\n\tvar urllength = bounceval.length;\n\tvar urlindex = bounceval.lastIndexOf('&page');\n\tif(urlindex != -1){\n\t\tvar bounceval = bounceval.substr(urlindex, urllength);\n\t}\n\txmlHttp=GetXmlHttpObject();\n\tif (xmlHttp==null)\n\t{\n\t\talert (\"Your browser does not support AJAX!\");\n\t\treturn;\n\t}\n\tvar url = host + '/community/exchange_register/welcome.htm?email=' + email + '&password=' + password + '&' +bounceval + '&flag=existuser_new_emailalert'+'&'+pBody;\n\tvardiv='newregistration';\n\txmlHttp.open(\"GET\",url,true);\n\txmlHttp.onreadystatechange=function()\n\t{ \n\t\tregistrationstateChanged(vardiv); \n\t};\n\txmlHttp.send(null);\n}",
"function getLoginForm() {\n $.ajax({\n type: \"POST\",\n url: \"Controllers/controller.User.php\",\n data: {locate: \"GetLoginForm\"}\n })\n .done(function(msg) {\n $(\"#loginsubscribefroms\").html(msg);\n });\n\n}",
"function fingerprintData(nickname) {\n\n $.ajax({\n type: 'POST',\n url: '/tweb/home/getFingerprint',\n data: {user: nickname},\n beforeSend: function () {\n $(\"#msg\").fadeOut();\n },\n success: function (data) {\n },\n error: function () {\n }\n });\n\n}",
"function getProfileForm(userid) {\n $.ajax({\n type: \"POST\",\n url: \"Controllers/controller.User.php\",\n data: {locate: \"GetProfileForm\", userid: userid}\n })\n .done(function(msg) {\n $(\"#loginsubscribefroms\").html(msg);\n });\n\n}"
]
| [
"0.6690176",
"0.66683954",
"0.6453761",
"0.6408495",
"0.63641775",
"0.62688625",
"0.62679505",
"0.6256149",
"0.622892",
"0.6155679",
"0.6136436",
"0.6123072",
"0.6092463",
"0.6090744",
"0.604611",
"0.6017466",
"0.6014703",
"0.6010808",
"0.60059583",
"0.60032654",
"0.59902346",
"0.5988914",
"0.5987129",
"0.59533584",
"0.59277934",
"0.5902837",
"0.5895617",
"0.5888746",
"0.58844745",
"0.5881448"
]
| 0.6906878 | 0 |
Ajax Call for username and PasswordTwo Forgot page. | function UsernamePasswordTwoCheckAjaxMethod() {
var user = $("#usernameCheck").val();
var pwdTwo = $("#PasswordTwoCheck").val();
$.ajax({
type: "POST",
url: "Login.aspx/UsernameAndPasswordTwoCheckForgotPageMethodAjax",
data: "{userCheck:'" + user + "', pwdCheck:'" + pwdTwo + "'}",
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function () {
$('.PasswordCheck').fadeOut(function () {
$('.AllisGood').fadeIn(700);
});
},
error: function () {
if (pwdTwo == "") {
$('#ErrorPwd2').text("Password is Empty");
$('#ErrorPwd2').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' });
$('#ErrorPwd2').addClass('animated shake');
return false;
}
else
$('#ErrorPwd2').text("Password is Incorrect");
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function UsernamePasswordCheckAjaxMethod() {\n var user = $(\"#usernameCheck\").val();\n var pwd1 = $('#PasswordOneCheck').val();\n $.ajax({\n type: \"POST\",\n url: \"Login.aspx/UsernameAndPasswordOneCheckForgotPageMethod\",\n data: \"{userCheck:'\" + user + \"', pwdCheck:'\" + pwd1 + \"'}\",\n dataType: \"json\",\n contentType: \"application/json; charset=utf-8\",\n success: function () {\n $('.ContactCheck').fadeOut(function () {\n $('.AllisGood').fadeIn(700);\n });\n },\n error: function () {\n if(pwd1 == \"\")\n {\n $('#ErrorPwd1').text(\"Password is Empty\");\n $('#ErrorPwd1').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' });\n $('#ErrorPwd1').addClass('animated shake');\n return false;\n }\n else\n $('#ErrorPwd1').text(\"Password is Incorrect\");\n }\n });\n}",
"function vpb_request_password_link()\n{\n\tvar ue_data = $(\"#ue_data\").val();\n\t\n\tif(ue_data == \"\")\n\t{\n\t\t$(\"#ue_data\").focus();\n\t\t$(\"#this_page_errors\").html('<div class=\"vwarning\">'+$(\"#empty_username_field\").val()+'</div>');\n\t\t$('html, body').animate({\n\t\t\tscrollTop: $('#ue_data').offset().top-parseInt(200)+'px'\n\t\t}, 1600);\n\t\treturn false;\n\t} else {\n\t\tvar dataString = {'ue_data': ue_data, 'page':'reset-password-validation'};\n\t\t$.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: vpb_site_url+'forget-password',\n\t\t\tdata: dataString,\n\t\t\tcache: false,\n\t\t\tbeforeSend: function() \n\t\t\t{\n\t\t\t\t$(\"#this_page_errors\").html('');\n\t\t\t\t$(\"#disable_or_enable_this_box\").removeClass('enable_this_box');\n\t\t\t\t$(\"#disable_or_enable_this_box\").addClass('disable_this_box');\n\t\t\t\t\n\t\t\t\t$(\"#forgot_password_buttoned\").hide();\n\t\t\t\t$(\"#log_in_status\").html('<center><div align=\"center\"><img style=\"margin-top:-40px;\" src=\"'+vpb_site_url+'img/loadings.gif\" align=\"absmiddle\" alt=\"Loading\" /></div></center>');\n\t\t\t},\n\t\t\tsuccess: function(response)\n\t\t\t{\n\t\t\t\t$(\"#disable_or_enable_this_box\").removeClass('disable_this_box');\n\t\t\t\t$(\"#disable_or_enable_this_box\").addClass('enable_this_box');\n\t\t\n\t\t\t\t$(\"#log_in_status\").html('');\n\t\t\t\t$(\"#forgot_password_buttoned\").show();\n\t\t\t\t\t\n\t\t\t\tvar response_brought = response.indexOf(\"processCompletedStatus\");\n\t\t\t\t$vlog=JSON.parse(response);\n\t\t\t\tif(response_brought != -1)\n\t\t\t\t{\n\t\t\t\t\tif($vlog.processCompletedStatus==true){\n $(\"#ue_data\").val('');\n $(\"#this_page_errors\").html($vlog.response);\n return false;\n\t\t\t\t\t}else{\n setTimeout(function() {\n \twindow.alert(\"To change the password you first need to verify the account by entering the verification code which was sent to your gmail account earlier while sign up in the 'Enter the verification code ... ' field to proceed.\");\n window.location.replace(vpb_site_url+'verification');\n },500);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$(\"#this_page_errors\").html($vlog.response);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}",
"function submitForgotUsername(){\n\ttry{\n\t\tvar license = $.txtfieldLicense.value;\n\t\tlicense = license.replace(/&(?!amp;)/g, '&');\n\t var\tmail = $.txtfieldMail.value;\n\t var\temiratesid = $.txtfieldEmirateId.value.replace(/[-]/gi, \"\");\n\t Ti.API.info('emiratesid '+emiratesid);\n\t var\tmobile = $.txtfieldMobile.value.replace(/[-]/gi, \"\");\n\t var\tpassport = $.txtfieldPassport.value;\n\t passport = passport.replace(/&(?!amp;)/g, '&');\n\t var lblEmiratesPassport;\n\t \n\tif($.imgIndividual.image === Alloy.Globals.path.radioActive){\n\t\tif(emiratesid === \"\" && passport === \"\"){\n\t\t\tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.validateHintText,function(){});\n\t\t}else if(mail === \"\"){\n\t\t \tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.mailId,function(){});\n\t\t}else if(mobile === \"\"){\n\t\t utilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.mobileNumber,function(){});\n\t\t}else if (emiratesid !== \"\" && emiratesid.length < 15) {\n\t\t\t$.txtfieldEmirateId.value = \"\";\n\t\t \tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.invalidEmiratesId,function(){});\n\t\t}\n\t\telse if (mobile.length !== 10 && mobile.value !== \"\") {\n\t\t \tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.mobileLength,function(){});\n\t\t}else{\n\t\t\ttry{\n\t\t\t\tlblEmiratesPassport = (emiratesid !== \"\")?emiratesid:passport;\n\t\t\t\thttpManager.forgetUsername(function(result){\n\t\t\t\tvar rootNode = result.getElementsByTagName(\"output\");\n\t\t\t\tvar ns =\"http://ForgetUserName\";\n\t\t\t\t//var subNode = result.response.getElementsByTagNameNS(\"ns1:Status\");\n\t\t\t\tif(rootNode.length > 0){\n\t\t\t\t\tvar status = result.getElementsByTagNameNS(ns, \"Status\").item(0).textContent;\n\t\t\t\t\t\n\t\t\t\t\tif(status === \"Success\"){\n\t\t\t\t\t\tAlloy.Globals.hideLoading();\n\t\t\t\t\t\tvar alertView = Ti.UI.createAlertDialog({\n\t\t\t\t\t\t\ttitle : Alloy.Globals.selectedLanguage.appTitle,\n\t\t\t\t\t\t\tmessage : (Alloy.Globals.isEnglish)?result.getElementsByTagNameNS(ns, \"Message_EN\").item(0).textContent:result.getElementsByTagNameNS(ns, \"Message_AR\").item(0).textContent,\n\t\t\t\t\t\t\tbuttonNames : [Alloy.Globals.selectedLanguage.ok]\n\t\t\t\t\t\t});\n\t\t\t\t\t\talertView.addEventListener('click', function(e) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (e.index == 0) {\n\t\t\t\t\t\t\t\tvar winMenu = Alloy.createController('UserManagement/winLogin',{\n\t\t\t\t\t\t\t\t\tisFromLeftPanel : false\n\t\t\t\t\t\t\t\t}).getView();\n\t\t\t\t\t\t\t\tAlloy.Globals.openWindow(winMenu);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\talertView.show();\n\t\t\t\t\t}else if(status === \"Failure\"){\n\t\t\t \t\t\tAlloy.Globals.hideLoading();\n\t\t\t \t\t\tvar alertView = Ti.UI.createAlertDialog({\n\t\t\t\t\t\t\t\ttitle : Alloy.Globals.selectedLanguage.appTitle,\n\t\t\t\t\t\t\t\tmessage : (Alloy.Globals.isEnglish)?result.getElementsByTagNameNS(ns, \"Message_EN\").item(0).textContent:result.getElementsByTagNameNS(ns, \"Message_AR\").item(0).textContent,\n\t\t\t\t\t\t\t\tbuttonNames : [Alloy.Globals.selectedLanguage.ok]\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\talertView.show();\n\t\t\t \t\t}\n\t\t\t\t}else{\n\t\t \t\tvar alertView = Ti.UI.createAlertDialog({\n\t\t\t\t\t\ttitle : Alloy.Globals.selectedLanguage.appTitle,\n\t\t\t\t\t\tmessage : Alloy.Globals.selectedLanguage.serviceError,\n\t\t\t\t\t\tbuttonNames : [Alloy.Globals.selectedLanguage.ok]\n\t\t\t\t });\n\t\t\t\t alertView.show();\n\t\t \t Alloy.Globals.hideLoading();\n\t\t \t}\n\t\t\t\tAlloy.Globals.hideLoading();\n\t\t\t},1,mail,mobile,lblEmiratesPassport);\n\t\t\t}catch(e){\n\t\t\t\tTi.API.info('Error '+e.message);\n\t\t\t}\n\t\t}\n\t}else if($.imgEstablishment.image === Alloy.Globals.path.radioActive){\n\t\tif(license === \"\"){\n\t\t utilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.licenseNumber,function(){});\n\t }else if(mail === \"\"){\n\t\t \tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.mailId,function(){});\n\t\t}else if(mobile === \"\"){\n\t\t utilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.mobileNumber,function(){});\n\t\t}\n\t\t// else if (isNaN(mobile)) {\n\t\t \t// utilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.invalidMobile,function(){});\n\t\t// }\n\t\telse if (mobile.length !== 10 && mobile.value !== \"\") {\n\t\t \tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.mobileLength,function(){});\n\t\t}else{\n\t\t\ttry{\n\t\t\t\thttpManager.forgetUsername(function(result){\n\t\t\t\tvar rootNode = result.getElementsByTagName(\"output\");\n\t\t\t\tvar ns =\"http://ForgetUserName\";\n\t\t\t\t//var subNode = result.getElementsByTagName(\"ns1:Status\");\n\t\t\t\tvar ns =\"http://ForgetUserName\";\n\t\t \tif(rootNode.length > 0){\n\t\t \t\t\t \t\t\n\t\t \t\tvar status = result.getElementsByTagNameNS(ns, \"Status\").item(0).textContent;\n\t\t \t\t\n\t\t \t\tif(status === \"Success\"){\n\t\t \t\t\t\n\t\t \t\t\tvar alert = Ti.UI.createAlertDialog({\n\t\t\t\t\t\t\ttitle : Alloy.Globals.selectedLanguage.appTitle,\n\t\t\t\t\t\t\tmessage : (Alloy.Globals.isEnglish)?result.getElementsByTagNameNS(ns, \"Message_EN\").item(0).textContent:result.getElementsByTagNameNS(ns, \"Message_AR\").item(0).textContent,\n\t\t\t\t\t\t\tbuttonNames : [Alloy.Globals.selectedLanguage.ok]\n\t\t\t\t\t\t});\n\t\t\t\t\t\talert.addEventListener('click', function(e) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (e.index == 0) {\n\t\t\t\t\t\t\t\tvar winMenu = Alloy.createController('UserManagement/winLogin',{\n\t\t\t\t\t\t\t\t\tisFromLeftPanel : false\n\t\t\t\t\t\t\t\t}).getView();\n\t\t\t\t\t\t\t\tAlloy.Globals.openWindow(winMenu);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\talert.show();\n\t\t \t\t}else if(status === \"Failure\"){\n\t\t\t \t\t\tAlloy.Globals.hideLoading();\n\t\t\t \t\t\tvar alert = Ti.UI.createAlertDialog({\n\t\t\t\t\t\t\t\ttitle : Alloy.Globals.selectedLanguage.appTitle,\n\t\t\t\t\t\t\t\tmessage : (Alloy.Globals.isEnglish)?result.getElementsByTagNameNS(ns, \"Message_EN\").item(0).textContent:result.getElementsByTagNameNS(ns, \"Message_AR\").item(0).textContent,\n\t\t\t\t\t\t\t\tbuttonNames : [Alloy.Globals.selectedLanguage.ok]\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\talert.show();\n\t\t\t \t}\n\t\t \t}else{\n\t\t \t\tvar alert = Ti.UI.createAlertDialog({\n\t\t\t\t\ttitle : Alloy.Globals.selectedLanguage.appTitle,\n\t\t\t\t\t//title:\"tset\",\n\t\t\t\t\tmessage : Alloy.Globals.selectedLanguage.serviceError,\n\t\t\t\t\tbuttonNames : [Alloy.Globals.selectedLanguage.ok]\n\t\t\t\t });\n\t\t\t\t alert.show();\n\t\t \t Alloy.Globals.hideLoading();\n\t\t \t}\n\t\t \tAlloy.Globals.hideLoading();\n\t\t\t},2,mail,mobile,license);\n\t\t\t}catch(e){\n\t\t\t\tTi.API.info('Error '+e.message);\n\t\t\t}\n\t\t}\n\t}\n\t}catch(e){\n\t\tTi.API.info('Error in submit forget data function '+JSON.stringify(e));\n\t}\n}",
"function UsernameAjaxMethod() {\n var user = $(\"#usernameCheck\").val();\n $.ajax({\n type: \"POST\",\n url: \"Login.aspx/UsernameForgotPageMethod\",\n data: \"{Forgotuser: '\" + user + \"'}\",\n dataType: \"json\",\n contentType: \"application/json; charset=utf-8\",\n success: function (response) {\n $('.UsernameCheck').fadeOut(function () {\n $('.ContactCheck').fadeIn(700);\n });\n },\n error: function () {\n if (user == \"\") {\n $('#ErrorUser').text(\"Username is Empty\");\n $('#ErrorUser').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' });\n $('#ErrorUser').addClass('animated shake');\n return false;\n }\n else {\n $('#ErrorUser').text(\"Username is incorrect, if you have forgot your username, you are not able to go forward, you can contact from the Website Owner (+923159382193) regarding you account's unlock.\");\n $('#ErrorUser').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '2', 'font-size': '15px' });\n $('#ErrorUser').addClass('animated shake');\n }\n }\n });\n}",
"function sendEmailForgot() {\n var password = newPss();\n var emailToSendPassword = $(\"#emailSendingInput\").val();\n\n if (!validateForm(emailToSendPassword)) {\n swal(\"טעות\", \"האימייל אינו נכון נסה שנית\", \"warning\");\n $('#emailSendingInput').focus();\n return\n }\n $.ajax({\n type: 'POST',\n url: sendPassByEmail,\n data: {\n email: emailToSendPassword,\n password: password,\n },\n success: function (response) {\n if (response) {\n swal(\"אימייל נשלח\", \"סיסמא חדשה נשלחה לאימייל שצויין\", \"success\");\n $(\"#myForgotPasswordModal\").modal('hide');\n $(\"#myLogin\").modal('hide');\n }\n else\n swal(\"שגיאה\", \"נסיון שליחת אימייל עם סיסמה חדשה נכשל\", \"error\");\n }\n });\n}",
"function resetPassword(email){\n $.ajax({\n method: 'POST',\n url: \"inc/Auth/forget.php\",\n data: {email: email}\n }).done(function(msg){\n if(msg == 'user issue')\n {\n AJAXloader(false, '#loader-pass-forgot');\n displayMessagesOut();\n $('.error-field').addClass('novisible');\n $('.error-forgot-exist').removeClass('novisible');\n displayError([], '#pass-forgot-form', ['input[name=\"pass-forgot\"]'], '');\n }\n if(msg == 'confirm issue')\n {\n AJAXloader(false, '#loader-pass-forgot');\n displayMessagesOut();\n $('.error-field').addClass('novisible');\n $('.error-forgot-confirm').removeClass('novisible');\n displaySpecial([], '#pass-forgot-form', ['input[name=\"pass-forgot\"]'], '');\n }\n //ce msg est un retour de la fonction de mail et non de la fonction de reset\n if(msg == 'success')\n {\n AJAXloader(false, '#loader-pass-forgot');\n displayMessagesOut();\n $('.error-field').addClass('novisible');\n $('.valid-forgot').removeClass('novisible');\n displaySuccess([], '#pass-forgot-form', ['input[name=\"pass-forgot\"]'], '');\n }\n });\n}",
"function forgotPassword() { \n\n\t\t\t$( \"#load\" ).show();\n\t\t\t\n\t\t\tvar form = new FormData(document.getElementById('reset_form'));\n\t\t\t\n\t\t\tvar validate_url = $('#reset_form').attr('action');\n\t\t\t\n\t\t\t$.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: validate_url,\n\t\t\t\t//data: dataString,\n\t\t\t\tdata: form,\n\t\t\t\t//dataType: \"json\",\n\t\t\t\tcache : false,\n\t\t\t\tcontentType: false,\n\t\t\t\tprocessData: false,\n\t\t\t\tsuccess: function(data){\n\n\t\t\t\t\t\n\t\t\t\t\tif(data.success == true ){\n\t\t\t\t\t\t\n\t\t\t\t\t\t$( \"#load\" ).hide();\n\t\t\t\t\t\t$(\"input\").val('');\n\t\t\t\t\t\t\n\t\t\t\t\t\t$(\".forgot-password-box\").html(data.notif);\n\t\n\t\t\t\t\t\tsetTimeout(function() { \n\t\t\t\t\t\t\t//$(\"#notif\").slideUp({ opacity: \"hide\" }, \"slow\");\n\t\t\t\t\t\t\t//window.location.reload(true);\n\t\t\t\t\t\t}, 2000); \n\n\t\t\t\t\t}else if(data.success == false){\n\t\t\t\t\t\t$( \"#load\" ).hide();\n\t\t\t\t\t\t$(\"#notif\").html(data.notif);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t},error: function(xhr, status, error) {\n\t\t\t\t\t$( \"#load\" ).hide();\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn false;\n\t\t}",
"function reset_password()\n{\n\tvar username=$('#username').val();\n\tif(username=='')\n\t{\n\t\talert('please enter email id');\n\t}\n\telse\n\t{\n\t\t$.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl:\"http://codeuridea.net/kidssitter/resetting/send-email\",\n\t\t\t\tdata:{'username':$('#username').val()},\n\t\t\t\tdataType: \"json\",\n\t\t\t\tcrossDomain: true\n\t\t\t});\n\t}\n}",
"function ksForgotPassword(){\n //check if the form is valid\n if(!$('#forgotpassword').valid()) return;\n \n //put the loading screen on\n loadingScreen();\n \n //create an object to send to varify auth\n var obj=new Object();\n obj.email = $('#forgotpassword input[name=\"email\"]').val();\n \n //send the reset information via ajax\n $.ajax({\n type: \"POST\",\n url: \"/login/resetpassword/\",\n dataType: \"json\",\n data: obj ,\n async: false,\n success: function(res) {\n if (res.items[0].status ==='success'){\n setSuccessToSuccess();\n //loading screen\n removeLoadingScreen();\n\n //display success failure screen\n displaySuccessFailure();\n \n \n $('#glassnoloading').fadeOut('normal');\n \n //change the dialog to be more informative\n $('.registerdialog img').attr(\"src\" , \"/img/success.png\");\n $('.registerdialog * .message').text('Successfully identified your account. A mail was sent to the address you supplied. To proceed with password change follow the link in the mail sent.');\n $('.registerdialog > .front-card').remove();\n \n }\n else{\n setSuccessToFailed();\n //loading screen\n removeLoadingScreen();\n\n //display success failure screen\n displaySuccessFailure();\n\n $('#glassnoloading').fadeOut('normal');\n \n //change the dialog to be more informative\n $('.registerdialog img').attr(\"src\" , \"/img/failed.png\");\n $('.registerdialog * .message').text(res.items[0].msg);\n }\n },\n error: function(res){\n setSuccessToFailed();\n //loading screen\n removeLoadingScreen();\n \n //display success failure screen\n displaySuccessFailure();\n \n //$(\"#error\").text(\"Connection failure! Try again\");\n //change the dialog to be more informative\n $('.registerdialog img').attr(\"src\" , \"/img/failed.png\");\n $('.registerdialog * .message').text('Error! Connection failure. Try again');\n }\n });\n}",
"function loginUser() {\n var email,\n password;\n email = $(\"#inputEmail3\").val();\n password = $(\"#inputPassword3\").val();\n $.ajax({\n type: \"POST\",\n url: \"Controllers/controller.User.php\",\n data: {locate: 'UserLogin', email: email, password: password}\n })\n .done(function(msg) {\n if (msg === '') {\n noty({\n layout: 'bottom',\n type: 'alert',\n text: 'Your Email or your Password are wrong!',\n dismissQueue: true,\n animation: {\n open: {height: 'toggle'},\n close: {height: 'toggle'},\n easing: 'swing',\n speed: 500\n },\n timeout: 4000\n });\n return;\n }else{\n alert(msg);\n }\n });\n\n}",
"function forgotPassword(method,type) {\n hideError('email');\n addFunActionLabel=\"Forgot Pasword Submit\";\n if(pageType=='not_login'){\n var email = $.trim($(\"#TenTimes-Modal #userEmailCopy\").val()); \n }else{\n var email = $.trim($(\"#TenTimes-Modal #userEmail\").val());\n }\n if(!validateEmail12345(email)){\n $(\".alert_email\").show();\n return 0;\n }\n var otpType='password';\n if(type=='N' || type=='U'){\n otpType='otp';\n }\n\n if(method == \"connect\")\n var postData = {'email':email, 'name' : receiverData.name , 'type' : otpType }\n else\n var postData = {'email':email, 'name' : email , 'type' : otpType }\n showloading();\n $.post(site_url_attend+'/user/getpassword',postData,function(response){\n hideloading();\n response=$.parseJSON(response);\n var resText=response.resText;\n var resLink=response.resLink;\n if(type=='N' || type=='U'){\n resText=response.resText_typeN;\n resLink=response.resLink_typeN;\n \n }\n \n switch(response.response) {\n case 'true':\n $('#getpassword').parent().replaceWith(function() { return \"<a style='text-decoration:none'>\" + \"<p class='text-center' style='text-decoration:none;color:#909090;'>\" + resText + \"</p>\"+$('#getpassword').get(0).outerHTML+\"</a>\"; });\n\n $('#getpassword').text(resLink);\n if(method!='signup' && method!='connect' && method!='contact_organizer_venue'){\n $('#TenTimes-Modal .partial-log').hide();\n $('#getpassword').removeAttr(\"onclick\").click(function() {\n partialLog(method,type)\n }).text(resLink).css('color','#335aa1');\n }\n break;\n case 'false':\n $(\".alert_email\").html(\"Sorry, 10times doesn't recognize that email.\");\n $(\".alert_email\").show();\n break;\n }\n }); \n}",
"function forgotPasswordDetails\n(\n emailID\n)\n{\n var data;\n var username = getEncode(emailID); \n var iv = username.iv; \n username = username.activate;\n \n var dataToSend = \n {\n \"action\" : VALIDATE_USER,\n \"iv\" : JSON.stringify(iv),\n \"encodeUN\" : JSON.stringify(username), \n \"activate\" : false\n }\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 \n return false;\n },\n success : function(result)\n { \n data = result; \n }\n \n });\n return data;\n}",
"function modif_password(){\n //mot de passe actuel, nouveau et confirmé et l'id \n var act =$(\"#act\").val();\n \n var npas =$(\"#npas\").val();\n var cpas =$(\"#cpas\").val();\n if(npas!=cpas){\n $('#alert-profil-npas').html('<span class=\"text-danger\">Mots de passe différents</span>'); \n $('#alert-profil-cpas').html('<span class=\"text-danger\">Mots de passe différents</span>'); \n }else{\n var action =\"update_pass\";\n var id = $(\"#user-id\").val();\n xhr = new XMLHttpRequest;\n xhr.responseType = 'json';\n var URL = \"ajax/users.php?action=\"+action+\"&id=\"+id+\"&pass=\"+npas;\n xhr.open(\"GET\",URL,true);\n xhr.send(null);\n xhr.onreadystatechange = result;\n function result(){\n if (this.readyState === 4 && this.status === 200) {\n var data = xhr.response;\n $('#alert4').html(data.result);\n \n $('#alert4').css('display','block');\n $(\"#act\").val();\n $(\"#cpas\").val();\n $(\"#npas\").val();\n }\n }\n }\n \n \n\n}",
"function managePasswordForgotten() {\n\t$('#passwordReset').click(function() { \n\t\t// We must reset the document and send a link to the registered email\n\t\t// to a form where the end user can update the password\n\t\tclearDocument();\n\t\tloadHTML(\"navbar.html\");\n\t\tnavbarHover();\n\t\t$(document.body).append(\"<center><h1>Please fill in the following form !</h1><center>\");\n\t\tloadHTML(\"passwordForgotten.html\");\n\t\tloadJS(\"js/forms.js\");\n formSubmission('#passwordForgotten','generatePasswordLnkRst','Reset email successfully sent','Unknown user');\n loadHTML(\"footer.html\");\n\t});\n}",
"function forgotPassword(divid,url,mailid,type,fid){\n\t var emailvalue=document.getElementById(mailid).value;\n\t \n\t\t\t emailvalue=rm_trim(emailvalue);\n\t\t\t if(emailvalue==''){\n\t\t\t alert(\"Please Enter Email\");\n\t\t\t document.getElementById(mailid).focus();\n\t\t\t return false;\n\t\t\t }\n\t\t\t else if(!emailValidator(emailvalue)){\n\t\t\t\t\talert(\"Invalid Email \");\n\t\t\t\t\tdocument.getElementById(divid).innerHTML=\"\";\n\t\t\t\t\tdocument.getElementById(mailid).value=\"\";\n\t\t\t\t\tocument.getElementById(mailid).focus();\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t }\n\t\t\t\t\t // alert(url);\n\t\t\turl=url+\"&email=\"+emailvalue;\n\t\t\tgetServerResponse(divid,url,\"\",true)\n}",
"function UsernameSecurityCheckAjaxMethod() {\n var user = $(\"#usernameCheck\").val();\n var security = $('#Securty').val();\n var answer = $('#AnswerCheck').val();\n $.ajax({\n type: \"POST\",\n url: \"Login.aspx/UsernameAndPasswordTwoCheckForgotPageMethod\",\n data: \"{userCheck: '\" + user + \"', security: '\" + security + \"', answer: '\" + answer + \"'}\",\n dataType: \"json\",\n contentType: \"application/json; charset=utf-8\",\n success: function () {\n $('.SecurityCheck').fadeOut(function () {\n $('.AllisGood').fadeIn(700);\n });\n },\n error: function () {\n if (security == \"Choose Security Question\") {\n $('#SecurityError').text(\"Please select Security Question.\");\n $('#SecurityError').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' });\n $('#SecurityError').addClass('animated shake');\n return false;\n }\n else if (answer == \"\") {\n $('#SecurityError').text(\"Please give Answer.\");\n $('#SecurityError').css({ 'color': 'red', 'font-weight': 'bold', 'margin-top': '-15px', 'margin-bottom': '20px', 'font-size': '15px' });\n $('#SecurityError').addClass('animated shake');\n return false;\n }\n else\n $('#SecurityError').text(\"It is not Correct.\");\n }\n });\n}",
"function getUserForManagePassword(username) {\r\n\tblockUI();\r\n\t$.ajax({\r\n\t\ttype : \"GET\",\r\n\t\turl : \"getUserForResetPassword.do\",\r\n\t\tdata : \"username=\" + username,\r\n\t\tdataType : \"json\",\r\n\t\tcache : false,\r\n\t\tsuccess : function(data) {\r\n\t\t\tunblockUI();\r\n\t\t\tif (data) {\r\n\t\t\t\t$(\"#userSearchRpHidden\").val(username);\r\n\t\t\t\t$(\"#userIdRP\").val(data.userId);\r\n\t\t\t\t$('#userSearchRP').blur(); \r\n\r\n\t\t\t\t$(\"#firstNameRP\").text(data.firstName);\r\n\t\t\t\t$(\"#middleNameRP\").text(data.middleName);\r\n\t\t\t\t$(\"#lastNameRP\").text(data.lastName);\r\n\t\t\t\t$(\"#emailRP\").text(data.emailId);\r\n\t\t\t\t$(\"#contactNumberRP\").text(data.phoneNumber);\r\n\t\t\t\t$(\"#streetRP\").text(data.street);\r\n\t\t\t\t$(\"#cityRP\").text(data.city);\r\n\t\t\t\t$(\"#stateRP\").text(data.state);\r\n\t\t\t\t$(\"#zipRP\").text(data.zip);\r\n\t\t\t\t$(\"#countryRP\").text(data.country);\r\n\r\n\t\t\t\tif (data.pwdHintList[0]) {\r\n\t\t\t\t\t$(\"#question1RP\").text(data.pwdHintList[0].questionValue);\r\n\t\t\t\t\t$(\"#answer1RP\").text(data.pwdHintList[0].answerValue);\r\n\t\t\t\t}\r\n\t\t\t\tif (data.pwdHintList[1]) {\r\n\t\t\t\t\t$(\"#question2RP\").text(data.pwdHintList[1].questionValue);\r\n\t\t\t\t\t$(\"#answer2RP\").text(data.pwdHintList[1].answerValue);\r\n\t\t\t\t}\r\n\t\t\t\tif (data.pwdHintList[2]) {\r\n\t\t\t\t\t$(\"#question3RP\").text(data.pwdHintList[2].questionValue);\r\n\t\t\t\t\t$(\"#answer3RP\").text(data.pwdHintList[2].answerValue);\r\n\t\t\t\t}\r\n\t\t\t\tif (data.userId == 0) {\r\n\t\t\t\t\t$.modal.alert(strings['script.noUserFound']);\r\n\t\t\t\t\t$(\"#userDetailsRP\").attr(\"class\", \"wizard-fieldset fields-list hidden\");\r\n\t\t\t\t\t$(\"#securityQuestionsRP\").attr(\"class\", \"wizard-fieldset fields-list hidden\");\r\n\t\t\t\t\t$(\"#userSearchRP\").attr('readonly', false);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$(\"#userSearchRP\").attr('readonly', true);\r\n\t\t\t\t\t$(\"#userDetailsRP\").attr(\"class\", \"wizard-fieldset fields-list\");\r\n\t\t\t\t\t$(\"#securityQuestionsRP\").attr(\"class\", \"wizard-fieldset fields-list\");\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\t$.modal.alert(strings['script.noUserFound']);\r\n\t\t\t\t$(\"#userDetailsRP\").attr(\"class\", \"wizard-fieldset fields-list hidden\");\r\n\t\t\t\t$(\"#securityQuestionsRP\").attr(\"class\", \"wizard-fieldset fields-list hidden\");\r\n\t\t\t\t$(\"#userSearchRP\").attr('readonly', false);\r\n\t\t\t}\r\n\t\t},\r\n\t\terror : function(data) {\r\n\t\t\tunblockUI();\r\n\t\t\t$.modal.alert(strings['script.user.search']);\r\n\t\t},\r\n\t\tcomplete : function(data) {\r\n\t\t}\r\n\t});\r\n}",
"function doRetrieve(){\n\t$j('forgetResult').html('Please Wait... <img src=\"static/loading.gif\"/>').slideDown();\n\t\n\tvar params = prepForQuery(getFormVars('forgot'));\n\t\n\t$j.ajax({\n\t\turl: \"user/forgot\",\n\t\ttype: 'post',\n\t\tdata: params,\n\t\tsuccess: returnForgot\n\t});\n}",
"function sendForgetPassword(){\n //check validation\n if(!$('#forget_password_dialog form').valid()) return;\n \n //put loading screen\n loadingScreen();\n \n //prepare the object to send\n var obj=new Object();\n obj.email = $.trim($('#forget_password_dialog_textbox').val());\n \n //send the reset information via ajax\n $.ajax({\n type: \"POST\",\n url: \"/login/resetpassword/\",\n dataType: \"json\",\n data: obj ,\n async: false,\n success: function(res) {\n if (res.items[0].status ==='success'){\n $('#forget_password_dialog_error').css('display', 'none');\n $('#forget_password_dialog_body').fadeOut('normal', function(){\n $('#forget_password_dialog_success').fadeIn('normal');\n });\n }\n else{\n $('#forget_password_dialog_error * p').text(res.items[0].msg);\n $('#forget_password_dialog_error').fadeIn('normal');\n }\n removeLoadingScreen();\n },\n error: function(res){\n $('#forget_password_dialog_error * p').text('Connection failure: Try again');\n $('#forget_password_dialog_error').fadeIn('normal');\n removeLoadingScreen();\n }\n });\n}",
"function z_usersPassword(id) {\r\n var usrId = id;\r\n var pass = $(\"#newPassword\").val();\r\n var cnfmPass = $(\"#confirmPassword\").val();\r\n if ($(\"#resetPassForm\").valid()) {\r\n var data = {\r\n userId: usrId,\r\n password: pass\r\n };\r\n $.ajax({\r\n url: \"/api/updateUserCredential\",\r\n type: \"POST\",\r\n data: data,\r\n dataType: 'text',\r\n success: function (result) {\r\n console.log(result);\r\n var form = document.getElementById(\"resetPassForm\");\r\n if (result.split(\":\")[1] == \"Done\") {\r\n alertPopup('success', \"Password Updated Successfully\");\r\n } else {\r\n alertPopup('alert', \"User Not found\");\r\n }\r\n $('#z-resetPass-popup').modal(\"hide\");\r\n },\r\n error: function (result) {\r\n console.log(result);\r\n }\r\n });\r\n }\r\n}",
"function passwordsMatching(password_one, password_two) {\r\n\t\tif (password_one != password_two) {\r\n\r\n\t\t\t$.ajax({\r\n\t\t\t\ttype : \"POST\",\r\n\t\t\t\turl : \"logic/process_inputcheck.php\",\r\n\t\t\t\tdata : {\r\n\t\t\t\t\taction : \"get_message_passwords_not_matching\"\r\n\t\t\t\t}\r\n\t\t\t}).done(function(msg) {\r\n\t\t\t\t$('div[id=passwords_not_matching]').remove();\r\n\t\t\t\t$('#messagearea').append(msg);\r\n\t\t\t\t$('html, body').animate({\r\n\t\t\t\t\tscrollTop : $('#messagearea').offset().top\r\n\t\t\t\t}, 600);\r\n\t\t\t});\r\n\t\t\treturn false;\r\n\t\t} else {\r\n\t\t\t$('div[id=passwords_not_matching]').remove();\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}",
"function updateUserPassword(){\n\t\tif($(\"#searchusername\").val() && $('#editpassword').val()){\n\t\t\t$.ajax({\n\t\t\t\ttype: 'POST',\n\t\t\t\turl: \"../UserServlet\",\n\t\t\t\tdata: {\n\t\t\t\t\t\taction:'updateUserPassowrd',\n\t\t\t\t\t\tusername: $('#searchusername').val(),\n\t\t\t\t\t\tpassword:$('#editpassword').val()\n\t\t\t\t\t\t},\n\t\t\t\tsuccess: function(response) {\n\t\t\t\t\t\tif(response.status==\"success\"){\n\t\t\t\t\t\t\talert('Password successfully updated');\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(response.status==\"failure\") {\n\t\t\t\t\t\t\talert(response.error);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\tdataType: \"json\"\n\t\t});\n\t\t}\n\t\telse{\n\t\t\talert(\"Username or Password cannot be empty\");\n\t\t}\n\n\t}",
"function otbot_attempt_login(ot_username, ot_password){\n\n $.post(\n \n // see tip #1 for how we declare global javascript variables\n \n ajaxurl,\n {// here we declare the parameters to send along with the request\n \n action : 'otbot_attempt_login',\n // other parameters can be added along with \"action\"\n //requests only come from pages which originate with our server\n \n //username and password for ot\n otbot_username: ot_username,\n otbot_password: ot_password\n },\n \n function( response ) {\n $('#wait').hide();\n if(response ==\"ERROR!!!\"){\n alert(\"Password or Username is incorrect, please try again.\");\n $('#credentials').show();\n }else{\n cookieName = response;\n $('#status').append('1. ' + ot_username );\n $('#status').attr('otusername',('1. ' + ot_username) );\n otbot_query_projects();\n $('#wait').show();\n \n }\n });//end ajax post\n\n}//end otbot_attempt_login",
"function resetPass(){\nif (document.getElementById('userid').value =='' || document.getElementById('userid').value == null) {\nparent.swal({title: \"Missing Input!\",text: \"Please enter your User ID.\",type: \"error\"},function(){setTimeout(function(){document.getElementById('userid').focus();},100);});\nreturn false;\n};\nswal({\n title: \"Please wait.. \",\n text: \"This may take a few seconds! Please wait for a confirmation message!\",\n showConfirmButton: false\n});\n $.ajax({\t\t\t\n\t\t\t\tdataType: \"jsonp\",\n\t\t\t\ttimeout: 10000,\n\t\t\t\turl: 'utils/forgotpassword.php?jsoncall=?',\n\t\t\t\ttype: \"POST\",\n data: {\n userid: document.getElementById(\"userid\").value, process: \"forgotpass\"\n }, \n success:function (data) {\n\t\t\t\t\tvar data2=data.response;\n if (data2 == \"2\")\n {\n\t\t\t\t\t\tdocument.getElementById(\"userid\").value=\"\";\n\t\t\t\t\t\tswal({title: \"Success!\",text: \"Information on resetting your password has been sent to your registered email address!\", type: \"success\"});\n }\n\t\t\t\t\telse if (data2 == \"8\")\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.getElementById(\"userid\").value=\"\";\n\t\t\t\t\tswal({title: \"An error has occurred!\",text: \"Please try again!\", type: \"error\"});\n\t\t\t\t\t}\n\t\t\t\t\telse if (data2 == \"7\")\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.getElementById(\"userid\").value=\"\";\n\t\t\t\t\tswal({title: \"Details entered do not match any on file!\",text: \"Please try again!\", type: \"error\"});\n\t\t\t\t\t}\n else\n {\n\t\t\t\t\t\tdocument.getElementById(\"userid\").value=\"\";\n\t\t\t\t\tswal({title: \"Error!\",text: \"An un-documented error has occurred, please try again.\", type: \"error\"});\n }\n }\n }); \n}",
"function loginAjax() {\n let username = $('input#username').val();\n let pwd = $('input#pwd').val();\n if(username===\"\" || pwd===\"\") {\n loginResponse({status:-1});\n return false;\n }\n sendAjax('login',{\n 'username': username,\n 'password': sha256(pwd)\n });\n return false; // Prevent auto refresh\n}",
"function verify_repass(repassword){\n var password = $(\"#password\").val();\n $(\".re_error\").hide();\n $(\".re_correct\").hide();\n if(repassword == \"\"){\n $(\".re_error\").show();\n $(\".re_error\").html(\"Please enter password\");\n \n } else{\n $.ajax({\n url: \"action.php\",\n method: \"POST\",\n data: {check_repass:1,repassword:repassword,password:password},\n success: function(data){ \n if(data == \"password_short\"){\n $(\".re_error\").show();\n $(\".re_error\").html(\"Password too short!\");\n } else if(data == \"not_matched\"){\n $(\".re_error\").show();\n $(\".re_error\").html(\"Password not matched!\");\n } else if(data == \"ok\"){\n $(\".re_correct\").show();\n $(\".re_correct\").html(\"OK\");\n }\n }\n });\n } \n }",
"function resetPass() {\n $('form#reset-pass').submit(function(e) {\n e.preventDefault()\n e.stopImmediatePropagation();\n var newPass = $('#user-reset-pass');\n var newPassAgain = $('#user-reset-pass-again');\n if (newPass.val() === newPassAgain.val()) {\n $.ajax({\n url: \"process/ajaxHandler.php\",\n method: \"POST\",\n dataType: \"JSON\",\n data: {\n action: \"resetPassword\",\n userNewPass: newPass.val()\n },\n success: function(response) {\n if (response.status == \"success\") {\n $('div#container').remove();\n $('body').append(\"<h3 class='successfully-change-pass-msg'>Your password successfully changed</h3>\");\n setTimeout(function() { window.location.replace(response.redirectAddress) }, 2000);\n } else if (response.status == \"error\") {\n alert(response.description)\n }\n }\n })\n } else {\n alert('password not match.')\n }\n })\n}",
"function checkUserLogin(){\n var userLogemail = $(\"#userLogemail\").val();\n var userLogpass = $(\"#userLogpass\").val();\n $.ajax({\n url:'users/adduser.php',\n method: \"POST\",\n data: {\n checkLogemail: \"checkLogemail\",\n userLogemail: userLogemail,\n userLogpass: userLogpass,\n },\n success: function(data) {\n //console.log(data);\n if (data == 0) {\n $(\"#statusLogMsg\").html(\n '<small class=\"alert alert-denger\">Invalid Email ID or Password !</small>');\n\n }else if (data == 1) {\n $(\"#statusLogMsg\").html(\n '<div class=\"spinner-border text-success\" role=\"status\"></div>'\n );\n setTimeout(()=>{\n window.location.href = \"index.php\";\n },1000);\n }\n },\n });\n}",
"function submitForm()\r\n\t\t{\t\t\r\n\t\t\tvar data = $(\".forgotform\").serialize();\r\n\t\t\t\t\r\n\t\t\t$.ajax({\r\n\t\t\t\t\r\n\t\t\ttype : 'POST',\r\n\t\t\t//url : 'engine/login_process.php',\r\n\t\t\turl : 'http://api.haagendazsindonesia.co.id/v1/auth/forgot_password',\r\n\t\t\t//crossDomain: true,\r\n\t\t\t//headers: {\r\n // 'Access-Control-Allow-Origin': '*'\r\n //'Content-Type':'application/x-www-form-urlencoded'\r\n \t//},\r\n\t\t\tdata : data,\r\n\t\t\t//dataType : 'jsonp',\r\n\t\t\tbeforeSend: function()\r\n\t\t\t{\t\r\n\t\t\t\t$(\".loads\").fadeIn();\r\n\t\t\t\t$(\".loads\").html('Resetting your password...');\r\n\t\t\t\t$(\".forgotform\").fadeOut();\r\n\t\t\t},\r\n\t\t\tsuccess : function(response)\r\n\t\t\t {\r\n\t\t\t \t\tvar respon = jQuery.parseJSON(response);\r\n\t\t\t\t\tif(respon.is_error===false){\r\n\t\t\t\t\t\t$(\".loads\").html('Success! Your new password has been sent to your email.');\r\n\t\t\t\t\t\tsetTimeout('location.reload();',4000);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t$(\".loads\").html('<div class=\"alert alert-danger\"> <span class=\"glyphicon glyphicon-info-sign\"></span> '+respon.status_msg+' !</div>');\r\n\t\t\t\t\t\t$(\".forgotform\").fadeIn();\r\n\t\t\t\t\t\tsetTimeout(function () {\r\n\r\n\t\t\t\t\t\t\t$(\".alert-danger\").hide();\r\n\r\n\t\t\t\t\t\t},1000)\r\n\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t }\r\n\t\t\t});\r\n\t\t\t\treturn false;\r\n\t\t}",
"function chkLogin_for_existinguser(pBody,email, password, bounceval)\n{\n\tvar urllength = bounceval.length;\n\tvar urlindex = bounceval.lastIndexOf('&page');\n\tif(urlindex != -1){\n\t\tvar bounceval = bounceval.substr(urlindex, urllength);\n\t}\n\txmlHttp=GetXmlHttpObject();\n\tif (xmlHttp==null)\n\t{\n\t\talert (\"Your browser does not support AJAX!\");\n\t\treturn;\n\t}\n\tvar url = host + '/community/exchange_register/welcome.htm?email=' + email + '&password=' + password + '&' +bounceval + '&flag=existuser_new_emailalert'+'&'+pBody;\n\tvardiv='newregistration';\n\txmlHttp.open(\"GET\",url,true);\n\txmlHttp.onreadystatechange=function()\n\t{ \n\t\tregistrationstateChanged(vardiv); \n\t};\n\txmlHttp.send(null);\n}"
]
| [
"0.67950946",
"0.6754989",
"0.6718557",
"0.66401005",
"0.65080565",
"0.6493332",
"0.64481765",
"0.64315546",
"0.6399592",
"0.63384277",
"0.62695366",
"0.6263902",
"0.62500465",
"0.6236251",
"0.6214668",
"0.62064695",
"0.6189092",
"0.6146866",
"0.61059314",
"0.60973126",
"0.6058279",
"0.6055569",
"0.6049839",
"0.60223025",
"0.6021568",
"0.6020123",
"0.5996411",
"0.5956976",
"0.5927345",
"0.59269583"
]
| 0.71463114 | 0 |
close create feed modal | function closeModal() {
document.getElementById("backdrop").style.display = "none";
document.getElementById("createFeedModal").style.display = "none";
document.getElementById("createFeedModal").classList.remove("show");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function closeCreatePostModal() {\r\n\t\r\n\tvar modalBackdrop = document.getElementById('modal-backdrop');\r\n\tvar createPostModal = document.getElementById('create-post-modal');\r\n\r\n\tmodalBackdrop.classList.add('hidden');\r\n\tcreatePostModal.classList.add('hidden');\r\n\r\n\t// This function is defined below\r\n\tclearPostInputValues();\r\n}",
"function closePostClick() {\n var modalPost = document.getElementById(\"modal-post\");\n modalPost.style.display = \"none\";\n}",
"function closeCreatePollModal() {\n \n var backdropElem = document.getElementById('modal-backdrop');\n var createPollElem = document.getElementById('create-poll-modal');\n\n // Hide the modal and its backdrop.\n backdropElem.classList.add('hidden');\n createPollElem.classList.add('hidden');\n \n //clearInputValues();\n}",
"function close() {\n $mdDialog.hide();\n }",
"function hideCreatePostModal(){\r\n var modal = document.getElementById(\"create-post-modal\");\r\n modal.style.display = \"none\";\r\n }",
"close() {\n this._showPopup = false;\n }",
"function onCancelButtonClick() {\n modal.close();\n }",
"function onCancelButtonClick() {\n modal.close();\n }",
"function closeDialog() {\n\t\t\tdocument.getElementById(\"newBookmarkConfirmation\").open = false;\n\t\t}",
"function close() {\n $modalInstance.dismiss();\n }",
"close() {\n this.reset();\n this.$store.commit(HIDE_CREATE_FOLDER_MODAL);\n }",
"closeModal() {\n this.close();\n }",
"function closeDialog () {\n controls.validator.resetValidationErrors();\n table.clearHighlight();\n popup.hide();\n window.scrollTo(permissionManager.bookmark.scrollX, permissionManager.bookmark.scrollY);\n }",
"function closeDialog () {\n controls.validator.resetValidationErrors();\n table.clearHighlight();\n popup.hide();\n window.scrollTo(permissionManager.bookmark.scrollX, permissionManager.bookmark.scrollY);\n }",
"close() {\n this.closeButton.on('click', null);\n this.modal(false);\n this.window.remove();\n }",
"function hideCreatePostModal() {\n var modal = document.getElementById(\"create-post-modal\");\n modal.style.display = \"none\";\n}",
"function closePopup() {\n $modalInstance.dismiss();\n }",
"@action closeDeletingCategoryDialog() {\n this.isDeletingCategory = false;\n this.deletingCategoryData = {\n name: '',\n id: null,\n };\n }",
"function closeDialog() {\n $mdDialog.hide();\n }",
"onBtnNew(){\n this._doOpenModalPost();\n }",
"function pay_more_close() {\n $(\".pay-more-popup-close\").click(function() {\n $(\".dialog_box\").empty();\n });\n }",
"function close_dialog() {\n\tif (win) {\n\t\twin.close();\n\t\tif (feed_summary.selected_users_in_list == null || feed_summary.selected_users_in_list.length == 0 ) {\n\t\t\t//users_selection.use_all_users\n\t\t\tif ( last_selected_user_filter==\"all\" ) {\n\t\t\t\t\t//alert(\"have to selecte teh all\");\n\t\t\t\t\tusers_selection.use_all_users();\n\t\t\t\t\tswap_users($('show_users_all'));\r\n\t\t\t}\n\t\t\tif ( last_selected_user_filter==\"network\" ) {\n\t\t\t\t\t//alert(\"have to selecte teh all\");\n\t\t\t\t\tusers_selection.use_my_network_users();\n\t\t\t\t\tswap_users($('show_users_network'));\n\t\t\t}\n\n\t\t\t\r\n\t\t}\n\t\t//let'see what in the box\n\t\t\r\n\t}\r\n}",
"function closeDialog() {\n jQuery('#oexchange-dialog').hide();\n jQuery('#oexchange-remember-dialog').hide();\n refreshShareLinks();\n }",
"function openDelete(){\n $('#modalWindow').css('display', 'block');\n $('#confirmDelete').css('display', 'block');\n var domElement = $(this).parent().parent();\n var id = $(domElement).attr(\"id\");\n $('#aceptDelete').click(function(){\n remove(id);\n closeModal();\n });\n }",
"function win_close() {\n if (jQuery(\"#SocialToolbarActiveWindow\").length > 0) { \n jQuery(\"#SocialToolbarActiveWindow\").fadeOut(function(){\n jQuery('#SocialToolbarActiveWindow').remove();\n closeShare();\n });\n \n }\n }",
"function closeCreateIssueForm(elt) {\n $j(elt).closest('.code-issue-create-form').remove();\n return false;\n}",
"function closeModelDialog() {\n document.getElementById('myModal').style.display = \"none\";\n document.getElementById(\"detailContent\").innerHTML = \"\";\n}",
"function openModal() {\n document.getElementById(\"backdrop\").style.display = \"block\";\n document.getElementById(\"createFeedModal\").style.display = \"block\";\n document.getElementById(\"createFeedModal\").classList.add(\"show\");\n}",
"function closeMe() {\n\t\t $('#' + settings.id).modal('hide');\n\t\t if (settings.isSubModal)\n\t\t $('body').addClass('modal-open');\n\t\t }",
"close() {\n this.$store.commit(HIDE_SHARE_MODAL);\n this.$store.commit(LOAD_FULL_CONTENTS_SUCCESS, null);\n }"
]
| [
"0.6863503",
"0.6671225",
"0.6381248",
"0.6369099",
"0.6344691",
"0.6299557",
"0.626921",
"0.626921",
"0.62435544",
"0.6240885",
"0.61899865",
"0.61791176",
"0.61532605",
"0.61532605",
"0.6139722",
"0.6077376",
"0.60741377",
"0.6056354",
"0.6052493",
"0.60463095",
"0.6042145",
"0.6026464",
"0.6017889",
"0.60178196",
"0.6016706",
"0.60158336",
"0.6015169",
"0.6011316",
"0.5982452",
"0.59695953"
]
| 0.6841656 | 1 |
hide add button if it's not current logged in users own profile | function toggleAddButton() {
const loggedInUserId =
document.querySelector(".logged-in-user-id").innerHTML;
const profileId = document.querySelector(".current-profile-id").innerHTML;
if (loggedInUserId !== profileId) {
document.querySelector(".new-feed-button").classList.add("d-none");
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"checkToShowAddButton() {\n const hasResult = this.hasQuery && (! this.hasUsers && ! this.hasDepartment);\n\n this.setShowAddButton( hasResult );\n }",
"function handleClick() {\n setShowUserProfile((!showUserProfile))\n }",
"function toggleAddButton() {\n const loggedInUserId =\n document.querySelector(\".logged-in-user-id\").innerHTML;\n const profileId = document.querySelector(\".current-profile-id\").innerHTML;\n if (loggedInUserId !== profileId) {\n document\n .querySelector(\".create-feed-container\") //needs to be the container/card\n .classList.add(\"is-invisible\");\n }\n}",
"function addPostButtonDisplay(){\n if(userLoggedIn()){\n document.getElementById(\"addPostButton\").style.display = \"block\";\n } else {\n document.getElementById(\"addPostButton\").style.display = \"none\";\n }\n}",
"function showButtons() {\n $(\".private\").css(\"display\", \"inherit\");\n $(\"#signUp\").css(\"display\", \"none\"); //Ocultamos el boton iniciar sesion\n}",
"function addUserProfileIfLogged() {\n\n const localStorageContent = lsContent();\n\n const loggedUserCredentials = localStorageContent.find(item => item.logged == 1);\n\n\n if (loggedUserCredentials !== undefined && loggedUserCredentials.logged == 1) {\n\n const userID = loggedUserCredentials.name;\n\n document.getElementById('loginButton').innerText = 'Salir';\n document.getElementById('userProfile').innerHTML =\n `<span id=\"userProfileName\" class=\"text-white mr-1\">${userID}</span>\n <img class=\"profileImg mr-2\" src=\"media/user.svg\"></img>`;\n }\n}",
"function showExistingUserData() {\n\t//Be sure that mainContent is shown\n\t$(\"#mainContent\").show();\n\t//Remove the action in the Delete button\n\t$(\"form#user_public_form\").attr('action','#');\n\t//Empty the nickname and registration data\n\t$(\"form#user_public_form\")[0].reset();\n\t//Remove all data of the user\n\t$(\"#userRestrictedInfo\").empty();\n\t//Clean the message list\n\t$(\"#messages #list\").empty();\n\t//Reset the number of messages\n\t$(\"#messagesNumber\").text(\"\");\n\t//Hide the newUserData if it was shown\n\t$(\"#newUserData\").hide();\n\t//Show existingUserData\n\t$(\"#existingUserData\").show();\n}",
"function isEditProfileShowing() {\n return profileStates.editProfile;\n}",
"function pageLoad() {\n $('.move_button').hide();\n $('.add_button').hide();\n $('.like_button').hide();\n \n $('.box').hover(function(){\n $($(this).find('.move_button')).show();\n }, function (){\n $($(this).find('.move_button')).hide();\n });\n //If it is not the current user\n $('.box').hover(function(){\n $($(this).find('.add_button, .like_button')).show();\n }, function (){\n $($(this).find('.add_button, .like_button')).hide();\n });\n }",
"isUserLoggedIn() {\n //console.log(`User registered button should be present`);\n return this.userRegisteredButton.isExisting();\n }",
"function showProfile() {\r\n // making list invisible----\r\n if (getComputedStyle(document.querySelector('.list')).visibility == 'visible') {\r\n document.querySelector('.list').style.visibility = 'hidden';\r\n }\r\n // making user info box visible\r\n if (getComputedStyle(document.querySelector('.main')).visibility == 'hidden') {\r\n document.querySelector('.main').style.visibility = 'visible';\r\n }\r\n}",
"function remove_profile(){\n $('.active').hide();\n}",
"function show_manage_user(){\n var manage_user = fill_template('user-management',{});\n $('#dd-log-in-menu').remove();\n $('.navbar-nav').append(manage_user);\n $('#dd-manage-alerts').click( function(e) {\n show_manage_alerts();\n });\n $('#dd-log-out').click( function(e) {\n set_cookie('dd-email','', -100);\n show_log_in();\n });\n }",
"function actionWithoutSession() {\n $(\".link-login\").show();\n $(\".link-register\").show();\n $(\".link-logout\").hide();\n $(\".new-tweet\").hide();\n }",
"function handleClick() {\n if (isAuthenticated) {\n document.getElementById(\"edit\").children[2].style.display = \"none\"; // Show only authorise buttons\n document.getElementById(\"edit\").children[1].style.display = \"none\";\n document.getElementById(\"edit\").children[6].style.display = \"block\";\n document.getElementById(\"edit\").children[5].style.display = \"block\";\n document.getElementById(\"edit\").children[4].style.display = \"block\";\n document.getElementById(\"edit\").children[3].style.display = \"block\";\n }\n if (!isAuthenticated) {\n document.getElementById(\"edit\").children[2].style.display = \"block\";\n document.getElementById(\"edit\").children[6].style.display = \"none\";\n }\n }",
"function handleSignUp(e) {\n setVisible(false);\n setSignUp('true');\n }",
"function allowCreateMeetup() {\n\n /* No Friends */\n if (localStorage.getItem(\"friendCount\") < 1) {\n $(document.getElementById('createMeetup')).prop('disabled', true);\n $(document.getElementById(\"friendsList\")).tooltip({trigger: \"manual\"}).tooltip(\"show\");\n }\n\n else {\n $(document.getElementById('createMeetup')).prop('disabled', false);\n $(document.getElementById(\"friendsList\")).tooltip(\"destroy\");\n }\n}",
"function displayProfile(profile) {\n if (toShow) {\n toShow.style.display = \"none\"\n toShow = profile\n toShow.style.display = \"block\"\n }\n} //end of displayProfile",
"function showCreateAccount()\n{\n hideOrShow(\"helloButtons\", false)\n hideOrShow(\"createAccount\", true)\n hideOrShow(\"login\", false)\n hideOrShow(\"text\", false)\n hideOrShow(\"backButton\", true)\n}",
"function displayAdmin() {\n if (localStorage.getItem('x-auth-token')) {\n document.getElementById('postBtn').style.display='block';\n document.getElementById('login-icon').style.display='none';\n document.getElementById('logout-icon').style.display='block';\n //you are logged in, hide the log in, show log out and show post button\n }\n}",
"function checkProfile(){\n if(!loggedIn){\n alert(\"Please login before using Profile!\");\n\t\tdocument.getElementById('myProfile').style.display='none';\n }\n else{\n alert(\"Welcome!\");\n\t\t document.getElementById('myProfile').style.display='block';\n\t\tdocument.getElementById(\"defaultOpen2\").click();\n }\n}",
"function checkFav(){\r\n if (currentManipulatedUser && currentManipulatedUser.fav){\r\n addFav.style.color = \"gold\";\r\n // console.log(currentManipulatedUser);\r\n return;\r\n }\r\n addFav.style.color = \"white\";\r\n }",
"function uploadwizard_newusers() {\n if (wgNamespaceNumber == 4 && wgTitle == \"Upload\" && wgAction == \"view\") {\n var oldDiv = document.getElementById(\"autoconfirmedusers\"),\n newDiv = document.getElementById(\"newusers\");\n if (oldDiv && newDiv) {\n if (typeof wgUserGroups == \"object\" && wgUserGroups) {\n for (i = 0; i < wgUserGroups.length; i++) {\n if (wgUserGroups[i] == \"autoconfirmed\") {\n oldDiv.style.display = \"block\";\n newDiv.style.display = \"none\";\n return;\n }\n }\n }\n oldDiv.style.display = \"none\";\n newDiv.style.display = \"block\";\n return;\n }\n }\n}",
"function subCate_userProfile(){\n var folderShow = document.getElementById('user-profile-account-details');\n if(folderShow.style.display == \"none\"){\n folderShow.style.display = \"block\";\n } else{\n folderShow.style.display = \"none\";\n }\n}",
"function showUserInfo() {\n\tvar currentUser = sessionStorage.getItem('currentUser');\n\tif(currentUser === null){\n\t\t$(\"#loginBtn\").html(\"<span class=\\\"glyphicon glyphicon-log-in\\\" style=\\\"margin-right: 5px\\\"></span>Login\");\n\t}\n\telse{\n\t\tcurrentUser = JSON.parse(currentUser);\n\t\t$(\"#loginBtn\").attr('href', '#');\n\t\t$(\"#loginBtn\").click(closeSession);\n\t\t$(\"#loginBtn\").html(\"<span class=\\\"glyphicon glyphicon-log-out\\\" style=\\\"margin-right: 5px\\\"></span>Salir\");\n\t\t$(\"#right-navBar\").append(\"<li><a href=\\\"#\\\" style=\\\"text-transform: capitalize\\\"><span class=\\\"glyphicon glyphicon-user\\\" style=\\\"margin-right: 5px;\\\"></span>\"+currentUser.user_info.name+\"</a></li>\");\n\t}\n}",
"function memberAddClicked(){\n $(\"#div_memberAdd\").css(\"display\",\"block\");\n }",
"function isProfilePage() {\n return $('#profile_card').length > 0;\n}",
"function showuser() {\n var user = document.getElementById('userinfo');\n if (user.style.display === \"none\") {\n user.style.display = \"block\";\n } else {\n user.style.display = \"none\";\n }\n }",
"function showuser() {\n var user = document.getElementById('userinfo');\n if (user.style.display === \"none\") {\n user.style.display = \"block\";\n } else {\n user.style.display = \"none\";\n }\n }",
"function showAddNewIfNeeded(allSessions) {\n if (allSessions.length == 0) {\n showAddNewButton();\n }\n}"
]
| [
"0.6933118",
"0.6854732",
"0.67922974",
"0.675933",
"0.64543074",
"0.6411886",
"0.6378024",
"0.6368346",
"0.6321812",
"0.6281145",
"0.6266627",
"0.6223535",
"0.6173657",
"0.61585486",
"0.61256045",
"0.6111671",
"0.6039487",
"0.6028034",
"0.60268646",
"0.6011177",
"0.6006853",
"0.5961159",
"0.59506994",
"0.59472954",
"0.59468347",
"0.5926904",
"0.5906727",
"0.5902664",
"0.5902664",
"0.589631"
]
| 0.72641385 | 0 |
Is the final check for organicness, before adding to array, to be used in RestrictListProducts function | function _organicCheck(item, organicBool){
if(organicBool.checked && item.organic == true){
restricted_prods.push(item);
} else if (!(organicBool.checked)) {
restricted_prods.push(item);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function restrictListProducts(prods, restriction, organic) {\n\tvar product_information = [];\n if (organic){\n\n for (let i=0; i<prods.length; i+=1) {\n if ((restriction == \"lactosenutfree\") && (prods[i].lactosefree) && (prods[i].nutfree) && (prods[i].organic)){\n product_information.push([prods[i].price, prods[i].name]);\n }\n else if ((restriction == \"lactosefree\") && (prods[i].lactosefree) && (prods[i].organic)){\n product_information.push([prods[i].price, prods[i].name]);\n }\n else if ((restriction == \"nutfree\") && (prods[i].nutfree) && (prods[i].organic)){\n product_information.push([prods[i].price, prods[i].name]);\n }\n else if ((restriction == \"None\") && (prods[i].organic)){\n product_information.push([prods[i].price, prods[i].name]);\n }\n }\n return product_information.sort(function sortListProducts(valA, valB) {\n return valA[0] - valB[0];\n });\n\n }else{\n\n for (let i=0; i<prods.length; i+=1) {\n if ((restriction == \"lactosenutfree\") && (prods[i].lactosefree) && (prods[i].nutfree)){\n product_information.push([prods[i].price, prods[i].name]);\n }\n else if ((restriction == \"lactosefree\") && (prods[i].lactosefree)){\n product_information.push([prods[i].price, prods[i].name]);\n }\n else if ((restriction == \"nutfree\") && (prods[i].nutfree)){\n product_information.push([prods[i].price, prods[i].name]);\n }\n else if (restriction == \"None\"){\n product_information.push([prods[i].price, prods[i].name]);\n }\n }\n return product_information.sort(function sortListProducts(valA, valB) {\n return valA[0] - valB[0];\n });\n }\n}",
"function restrictListProducts(prods, restriction, organicProduct) {\n\tlet product_names = [];\n\tconsole.log(organicProduct, restriction);\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tvar product = { name: null, price: null };\n\n\t\tif (organicProduct == true && prods[i].organic == true){\n\t\t\tif ((restriction == \"Vegetarian\") && (prods[i].vegetarian == true)){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t}\n\t\t\telse if ((restriction == \"GlutenFree\") && (prods[i].glutenFree == true)){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t}\n\t\t\telse if ((restriction == \"VegetarianANDGlutenFree\") && (prods[i].glutenFree == true && prods[i].vegetarian == true)){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t }\n\t\t\telse if (restriction == \"None\"){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t}\n\t\t}\n\t\telse if (organicProduct == false) {\n\t\t\tif ((restriction == \"Vegetarian\") && (prods[i].vegetarian == true)){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t}\n\t\t\telse if ((restriction == \"GlutenFree\") && (prods[i].glutenFree == true)){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t}\n\t\t\telse if ((restriction == \"VegetarianANDGlutenFree\") && (prods[i].glutenFree == true && prods[i].vegetarian == true)){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t }\n\t\t\telse if (restriction == \"None\"){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t}\n\t\t}\n\t}\n\treturn product_names;\n}",
"function restrictListProducts(prods, restriction, organic) {\n\trestricted_prods = [];\n\n\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif ((restriction[\"nut-free\"] == true && restriction[\"lactose-free\"] == false) && (prods[i].nut == false)){\n\t\t\t_organicCheck(prods[i],organic);\n\t\t}\n\n\t\telse if ((restriction[\"lactose-free\"] == true && restriction[\"nut-free\"] == false) && (prods[i].lactose == false)){\n\t\t\t_organicCheck(prods[i],organic);\n\t\t}\n\n\t\telse if((restriction[\"lactose-free\"] == true && restriction[\"nut-free\"] == true) && (prods[i].lactose == false && prods[i].nut == false)) {\n\t\t\t_organicCheck(prods[i],organic);\n\t\t}\n\n\t\telse if(restriction[\"none\"] == true){\n\t\t\t_organicCheck(prods[i],organic);\n\t\t}\n\n\t}\n\treturn restricted_prods;\n}",
"function restrictList(product, restriction, is_organic, type){\n let temp;\n for (let i = 0; i < product.length; i++) {\n for (let j = 0; j < product.length; j++) {\n if (product[i].price < product[j].price) {\n temp = product[i]\n product[i] = product[j]\n product[j] = temp\n }\n }\n }\n let product_names = [];\n if (type==\"all\") {\n if (is_organic == true) {\n for (let i = 0; i < product.length; i += 1) {\n if ((restriction == \"Vegetarian\") && (product[i].vegetarian == true) && (product[i].organic == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"GlutenFree\") && (product[i].glutenFree == true) && (product[i].organic == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"VegAGlu\") && (product[i].glutenFree == true) && (product[i].vegetarian == true) && (product[i].organic == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"None\") && (product[i].organic == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n }\n }\n } else {\n for (let i = 0; i < product.length; i += 1) {\n if ((restriction == \"Vegetarian\") && (product[i].vegetarian == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"GlutenFree\") && (product[i].glutenFree == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"VegAGlu\") && (product[i].glutenFree == true) && (product[i].vegetarian == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if (restriction == \"None\") {\n product_names.push(product[i].name + \" $\" + product[i].price);\n }\n }\n }\n }\n else{\n if (is_organic == true) {\n for (let i = 0; i < product.length; i += 1) {\n if ((restriction == \"Vegetarian\") && (product[i].vegetarian == true) && (product[i].organic == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"GlutenFree\") && (product[i].glutenFree == true) && (product[i].organic == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"VegAGlu\") && (product[i].glutenFree == true) && (product[i].vegetarian == true) && (product[i].organic == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"None\") && (product[i].organic == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n }\n }\n } else {\n for (let i = 0; i < product.length; i += 1) {\n if ((restriction == \"Vegetarian\") && (product[i].vegetarian == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"GlutenFree\") && (product[i].glutenFree == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"VegAGlu\") && (product[i].glutenFree == true) && (product[i].vegetarian == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if (restriction == \"None\" &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n }\n }\n }\n }\n return product_names;\n}",
"function restrictListProducts(prods, restriction, organic) {\n\tlet product_names = new Map();\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif ((organic == true) && (prods[i].organic == true)) {\n\t\t\tif ((restriction == \"Both Restrictions\") && !prods[i].containLactose && !prods[i].containNuts) {\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if ((restriction == \"Lactose Free\") && !prods[i].containLactose){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if ((restriction == \"Nuts Free\") && !prods[i].containNuts){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if (restriction == \"No Restrictions\"){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t} else if((organic == false) && (prods[i].organic == false)){\n\t\t\tif ((restriction == \"Both Restrictions\") && !prods[i].containLactose && !prods[i].containNuts) {\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if ((restriction == \"Lactose Free\") && !prods[i].containLactose){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if ((restriction == \"Nuts Free\") && !prods[i].containNuts){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if (restriction == \"No Restrictions\"){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t} else if((organic == null)){\n\t\t\tif ((restriction == \"Both Restrictions\") && !prods[i].containLactose && !prods[i].containNuts) {\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if ((restriction == \"Lactose Free\") && !prods[i].containLactose){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if ((restriction == \"Nuts Free\") && !prods[i].containNuts){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if (restriction == \"No Restrictions\"){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t}\n\t}\n\n\tproduct_names[Symbol.iterator] = function* () {\n\t\tyield* [...this.entries()].sort((a, b) => a[1] - b[1]);\n\t}\n\n\treturn product_names;\n}",
"function restrictListProducts(prods, restriction) {\r\n\tlet product_names = [];\r\n var restrictions = restriction.split(',');\r\n// console.log(restrictions);\r\n\tfor (let i=0; i<prods.length; i+=1) {\r\n var productVegetarian = prods[i].vegetarian;\r\n var productGlutenFree = prods[i].glutenFree;\r\n var productOrganic = prods[i].organic;\r\n var restrictVeg = false;\r\n var restrictGlu = false;\r\n var restrictOrg = false;\r\n var None = false;\r\n// console.log(restrictions.length);\r\n \r\n if(restrictions.length >= 2){\r\n for(let j = 0; j < restrictions.length; j++){\r\n if(restrictions[j] == \"Vegetarian\") restrictVeg = true;\r\n if(restrictions[j] == \"GlutenFree\") restrictGlu = true;\r\n if(restrictions[j] == \"Organic\") restrictOrg = true;\r\n }\r\n if ((restrictVeg && restrictOrg && restrictGlu) && (productVegetarian && productOrganic && productGlutenFree)){\r\n\t\t\t product_names.push(prods[i].name + \":\" + prods[i].price);\r\n }else if ((restrictGlu && restrictVeg && !restrictOrg) && (productVegetarian && productGlutenFree)){\r\n\t\t\t product_names.push(prods[i].name + \":\" + prods[i].price);\r\n\t\t }else if ((restrictGlu && restrictOrg && !restrictVeg) && (productGlutenFree&& productOrganic)){\r\n\t\t\t product_names.push(prods[i].name + \":\" + prods[i].price);\r\n }else if ((restrictVeg && restrictOrg && !restrictGlu) && (productVegetarian && productOrganic)){\r\n\t\t\t product_names.push(prods[i].name + \":\" + prods[i].price);\r\n }\r\n }else{\r\n if ((restrictions[0] == \"Vegetarian\") && (productVegetarian)){\r\n product_names.push(prods[i].name + \":\" + prods[i].price);\r\n }else if ((restrictions[0] == \"GlutenFree\") && (productGlutenFree)){\r\n product_names.push(prods[i].name + \":\" + prods[i].price);\r\n }else if ((restrictions[0] == \"Organic\") && (productOrganic)){\r\n product_names.push(prods[i].name + \":\" + prods[i].price);\r\n }else if (restrictions[0] == \"None\"){\r\n product_names.push(prods[i].name + \":\" + prods[i].price);\r\n }\r\n }\r\n \r\n\r\n\t}\r\n\treturn product_names;\r\n}",
"noOfferProducts(productsListFromProps) {\n if (productsListFromProps.length > 0 && this.props.company && this.props.company.offers.items.length > 0) {\n let coOffers;\n this.props.company.offers.items.forEach((item) => { coOffers = coOffers + item.productID + ';;' });\n const l = productsListFromProps.length;\n let indexedProductsNoOffer = [];\n let count = 0;\n for (let x = 0; x < l; x++) {\n if (!coOffers.includes(productsListFromProps[x].id)) {\n indexedProductsNoOffer.push({\n seqNumb: count++,\n details: productsListFromProps[x]\n })\n }\n }\n return indexedProductsNoOffer;\n } else {\n return this.allProducts(productsListFromProps);\n }\n }",
"function restrictListProducts(prods, restrictions) {\n\tvar lactoseFree = false;\n\tvar nutFree = false;\n\tvar organic = false;\n\tif (restrictions.length > 0){\n\t\tfor (i = 0; i < restrictions.length; i++) { \n\t\t\tif (restrictions[i] == \"organic\"){\n\t\t\t\torganic = true;\n\t\t\t}\n\t\t\telse if (restrictions[i] == \"nutFree\"){\n\t\t\t\tnutFree = true;\n\t\t\t}\n\t\t\telse if (restrictions[i] == \"lactoseFree\"){\n\t\t\t\tlactoseFree = true;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tlet product_names = [];\n\t\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif ((lactoseFree == true) && (nutFree == true)&& (organic == true) && (prods[i].lactoseFree == true) && (prods[i].organic == true) && (prods[i].nutFree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((lactoseFree == true) && (nutFree == true) && (organic == false) && (prods[i].lactoseFree == true) && (prods[i].nutFree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((lactoseFree == true) && (organic == true) && (nutFree == false) && (prods[i].lactoseFree == true) && (prods[i].organic == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((nutFree == true) && (organic == true) && (lactoseFree == false) && (prods[i].organic == true) && (prods[i].nutFree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((lactoseFree == false) && (nutFree == true)&& (organic == false) && (prods[i].nutFree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((lactoseFree == true) && (nutFree == false)&& (organic == false) && (prods[i].lactoseFree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((lactoseFree == false) && (nutFree == false)&& (organic == false)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((lactoseFree == false) && (nutFree == false)&& (organic == true) && (prods[i].organic == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t}\n\treturn product_names;\n}",
"function restrictListProducts(prods, lactoseIntolerant, nutFree, organic, sorter) {\n\tlet products = [];\n\tfor (let i = 0; i < prods.length; i += 1) {\n\t\tif (ableToEat(prods[i], lactoseIntolerant, nutFree, organic)) {\n\t\t\tproducts.push(prods[i]);\n\t\t}\n\t}\n\treturn products.sort(sorter);\n}",
"function restrictListProducts(prods, restriction) {\n\tlet product_names = [];\n\t/*for (let i=0; i<prods.length; i+=1) {\n\t\tif (restriction==\"None\"){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\t\n }\n\t\telse if ((restriction == \"Lactose-intolerant Nutallergy and Organic\") && (prods[i].lactoseFree == true && (prods[i].nutFree == true)&& (prods[i].organic== true))){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\n\t\t}\n\t\telse if ((restriction == \"Lactose-intolerant and Nutallergy\") && (prods[i].lactoseFree == true && (prods[i].nutFree == true))){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\n\t\t}\n\t\telse if ((restriction == \"Lactose-intolerant and Organic\") && (prods[i].lactoseFree == true && (prods[i].organic == true))){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\n\t\t}\n\t\telse if ((restriction == \"Nutallergy and Organic\") && (prods[i].organic == true && (prods[i].nutFree == true))){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\n\t\t}\n\t\telse if ((restriction == \"Lactose-intolerant\") && (prods[i].lactoseFree == true)){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\n\t\t}\n\t\telse if ((restriction == \"Nutallergy\") && (prods[i].nutFree == true)){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\n\t\t}\n\t\telse if (restriction == \"Organic\" && prods[i].organic==true){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\t\n\t\t}\n\t}*/\n\tif(restriction[\"None\"]==true){\n\t\tfor (let i=0; i<prods.length; i+=1) {\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\t\n\t}}else{\n\t\tfor (let i=0; i<prods.length; i+=1) {\n\t\t\tconsole.log(restriction[\"Organic\"]+ \"==\"+ prods[i].organic+ \" \"+ restriction[\"Nutallergt\"]+ \"==\"+ prods[i].nutFree+ \" \"+ restriction[\"Lactose-intolerant\"]+ \"==\"+ prods[i].lactoseFree+ \" \");\n\t\t\tif((restriction[\"Organic\"]==prods[i].organic|| restriction[\"Organic\"]==false) &&(restriction[\"Nutallergy\"]==prods[i].nutFree|| restriction[\"Nutallergy\"]==false) && (restriction[\"Lactose-intolerant\"]==prods[i].lactoseFree|| restriction[\"Lactose-intolerant\"]==false)){\n\t\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\t\n\t\t\t}\n\t\t}\n\t}\n\treturn product_names.sort(function([a,b], [c,d]){ // method taken from https://stackoverflow.com/a/50415269\n\t\treturn b-d;\n\t});;\n}",
"function restrictListProducts(prods, lactose, nut, organic) {\n\tlet products = [];\n\n\tprods.sort(function(a, b){\n\t\t\treturn a.price - b.price;\n\t})\n\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif (lactose && !prods[i].lactose) continue;\n\t\tif (nut && !prods[i].nutFree) continue;\n\t\tif (organic && !prods[i].organic) continue;\n\t\tproducts.push(prods[i]);\n\n\t}\n\treturn products;\n}",
"pushOffensiveItem(offensiveItem) {\n if (offensiveItem instanceof Item) {\n if (this.offensive == null) { this.offensive = []; }\n this.offensive.push(offensiveItem);\n return true;\n }\n return false;\n }",
"function restrictListProducts(prods, restriction) {\n\tlet product_names = [];\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif ((restriction.includes(\"nutAllergy\")) && (restriction.includes(\"lactoseIntolerant\")) && (prods[i].lactoseIntolerant == true) && (prods[i].nutAllergy == true) && (prods[i].organic == false)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction.includes(\"lactoseIntolerant\")) && !(restriction.includes(\"nutAllergy\")) && !(restriction.includes(\"organic\")) && (prods[i].lactoseIntolerant == true) && (prods[i].organic == false)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction.includes(\"nutAllergy\")) && !(restriction.includes(\"lactoseIntolerant\")) && (prods[i].nutAllergy == true) && (prods[i].organic == false)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction.includes(\"organic\")) && (prods[i].organic == true)){\n\t\t\tproduct_names.push(prods[i]); \n\t\t}\n\t\telse if (restriction.includes(\"none\")){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t}\n\treturn product_names;\n}",
"function restrictListProducts(prods, restriction) {\n\tlet product_names = [];\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif ((restriction == \"Vegetarian\") && (prods[i].vegetarian == true)){\n\t\t\tproduct_names.push([prods[i].name,prods[i].price,prods[i].category,prods[i].img]);\n\t\t}\n\t\telse if ((restriction == \"GlutenFree\") && (prods[i].glutenFree == true)){\n\t\t\tproduct_names.push([prods[i].name,prods[i].price,prods[i].category,prods[i].img]);\n }\n else if ((restriction == \"Vegetarian&GlutenFree\") && (prods[i].vegetarian == true) && (prods[i].glutenFree == true)){\n\t\t\tproduct_names.push([prods[i].name,prods[i].price,prods[i].category,prods[i].img]);\n }\n else if ((restriction == \"Organic\") && (prods[i].Organic == true)){\n\t\t\tproduct_names.push([prods[i].name,prods[i].price,prods[i].category,prods[i].img]);\n }\n\t\telse if (restriction == \"None\"){\n\t\t\tproduct_names.push([prods[i].name,prods[i].price,prods[i].category,prods[i].img]);\n }\n else if (restriction == \"\"){\n\t\t\tproduct_names.push([prods[i].name,prods[i].price,prods[i].category,prods[i].img]);\n\t\t}\n }\n product_names.sort(compareSecondColumn);\n\treturn product_names;\n}",
"function restrictListProducts(prods) {\r\n\tlet product_names = [];\r\n\tprods.sort((a,b) => a.price - b.price);\r\n\tfor (let i=0; i<prods.length; i+=1) {\r\n\t\tif (!(((document.getElementById(\"lactoseFree\").checked==true) && (prods[i].lactoseFree == false)) ||\r\n\t\t((document.getElementById(\"nutFree\").checked==true) && (prods[i].nutFree == false)) ||\r\n\t\t((document.getElementById(\"organic\").checked==true) && (prods[i].organic == false)) ))\r\n\t\t{\r\n\t\t\tproduct_names.push(prods[i].name)\r\n\t\t}\r\n\t}\r\n\r\n\treturn product_names;\r\n}",
"checkNewCritterTargets (donations) { //confusing b/c critter.donations and donation message are objects with \"target\" \"amount\" \"total\"\n let targetA = donations[0].target;\n let targetB = donations[1].target;\n let newOrgA = true;\n let newOrgB = true;\n for (let org of this.donations) {\n if (org[\"target\"] == targetA) {\n newOrgA = false;\n }\n if (org[\"target\"] == targetB) {\n newOrgB = false;\n }\n }\n //new donation target\n if (newOrgA) {\n this.donations.push({\n target: targetA,\n funds: 0,\n link: null\n }) \n }\n if (newOrgB) {\n this.donations.push({\n target: targetB,\n funds: 0,\n link: null\n }) \n } \n if (newOrgA || newOrgB) {\n this.sortTargets();\n return true; //so ecosystem can emit fundsUpdate\n } else {\n return false;\n }\n }",
"pushDefensiveItem(defensiveItem) {\n if (defensiveItem instanceof Item) {\n if (this.defensive == null) { this.defensive = []; }\n this.defensive.push(defensiveItem);\n return true;\n }\n return false;\n }",
"validateOrder(_givenOrder, _preparedOrder) {\n _preparedOrder = _preparedOrder.sort((n1, n2) => n1 - n2); // Sorts both orders\n _givenOrder.ingredients = _givenOrder.ingredients.sort((n1, n2) => n1 - n2);\n KebapHouse.soldOrders++;\n for (let i = 0; i < _givenOrder.ingredients.length; i++) { // Checks if ingredients match\n if (_givenOrder.ingredients[i] != _preparedOrder[i]) {\n return false;\n }\n }\n return true;\n }",
"function restrictListProducts(prods, restriction) {\n\tlet restrictedProduct = [];\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\t//Vegetarian\n\t\tif ((restriction[0]) && (!prods[i].vegetarian)){\n\t\t\tcontinue;\n\t\t}\n\t\t//Gluten-Free\n\t\tif ((restriction[1]) && (!prods[i].glutenFree)){\n\t\t\tcontinue;\n\t\t}\n\t\t//organic\n\t\tif ((restriction[2]) && (!prods[i].organic)){\n\t\t\tcontinue;\n\t\t}\n\t\t//vegan \n\t\tif ((restriction[3]) && (!prods[i].vegan)){\n\t\t\tcontinue;\n\t\t}\n\t\t//dairy Free\n\t\tif ((restriction[4]) && (!prods[i].dairyF)){\n\t\t\tcontinue;\n\t\t}\n\t\trestrictedProduct.push(prods[i]);\n\t}\n\treturn restrictedProduct;\n}",
"function restrictListProducts(prods, restriction) {\n\tlet product_names = [];\n\tvar checkBox1 = document.getElementById(\"lactoseF\");\n\tvar checkBox2 = document.getElementById(\"nutsF\");\n\tvar checkBox3 = document.getElementById(\"organique\");\n\tvar checkBox4 = document.getElementById(\"none\");\n\n\n\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\t/*if ((document.querySelector(\".organiqueCB\").checked)&&(document.querySelector(\".pasDeNoix\").checked) && (document.querySelector(\".lactoseFreeCB\").checked)&& (prods[i].all == true)){\n\t\t\tproduct_names.push(prods[i].name);\n\n\t\t}*/\n\t\tif (checkBox1.checked==true && checkBox2.checked==true && checkBox3.checked==true && prods[i].all==true){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\t\telse if(checkBox3.checked==true &&checkBox2.checked==true && prods[i].vegAndNut==true){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\t\telse if (checkBox3.checked==true && checkBox1.checked==true && prods[i].vegAndGlu==true){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\n\t\telse if (checkBox1.checked==true && checkBox2.checked==true && prods[i].nutAndGlu==true){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\t\telse if(checkBox1.checked==true && checkBox2.checked==false && checkBox3.checked==false && prods[i].glutenFree==true ){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\t\telse if(checkBox2.checked==true && checkBox1.checked==false && checkBox3.checked==false && prods[i].no_nuts==true){\n\t\t\tproduct_names.push(prods[i].name);\n\n\t\t}\n\t\telse if (checkBox3.checked==true && checkBox1.checked==false&&checkBox2.checked==false && prods[i].vegetarian==true){\n\t\t\tproduct_names.push(prods[i].name);\n\n\t\t\n\t\t}\n\t\telse if (checkBox4.checked==true){\n\t\t\t\n\t\t\tproduct_names.push(prods[i].name);\n\t\t\t\n\t\t\t\n\t\t}\n\t\t/*if (checkBox1.checked==false && checkBox2.checked==false && checkBox3.checked==false && (prods[i].vegetarian==true || prods[i].glutenFree==true || prods[i].no_nuts==true)){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\n\t\t/*else if ((document.querySelector(\".organiqueCB\").checked)&& (prods[i].vegetarian == true)){\n\n\t\t\tif ((document.querySelector(\".lactoseFreeCB\").checked) && (prods[i].glutenFree == true)){\n\t\t\t\tproduct_names.push(prods[i].name);\n\t\t\t}\n\t\t\telse if ((restriction == \"pasDeNoix\")&& (prods[i].no_nuts == true)){\n\t\t\t\tproduct_names.push(prods[i].name);\n\t\t\t}else{\n\t\t\tproduct_names.push(prods[i].name);}\n\t\t}\n\t\telse if ((document.querySelector(\".lactoseFreeCB\").checked) && (prods[i].glutenFree == true)){\n\t\t\tif ((restriction == \"pasDeNoix\")&& (prods[i].no_nuts == true)){\n\t\t\t\tproduct_names.push(prods[i].name);\n\t\t\t}else{\n\t\t\t\tproduct_names.push(prods[i].name);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t/*else if ((restriction == \"pasDeNoix\")&& (prods[i].no_nuts == true)){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\t\t\n\t\telse if ((restriction == \"none\")){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}*/\n\t\t\n\t}\n\treturn product_names;\n}",
"function restrictListProducts(prods, restriction) {\n\tlet product_names = [];\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif ((restriction == \"lactose\") &&(prods[i].LactoseFree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"noix\") && (prods[i].noixfree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"vegetarian\")&& (prods[i].vegetarian == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"gluten\") && (prods[i].glutenFree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"jus\") && (prods[i].type == \"jus\")){\n\t\t product_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"legume\") && (prods[i].type == \"legume\")){\n\t\t product_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"fruit\") && (prods[i].type == \"fruit\")){\n\t\t product_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"laitier\") && (prods[i].type == \"laitier\")){\n\t\t product_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"orga\") && (prods[i].organic == true)){\n\t\t product_names.push(prods[i]);\n\t\t}\n\n\n\t}\n\n\tvar sorted = product_names.sort((a, b) => a.price - b.price);\n\treturn sorted;\n}",
"static getManufactuer(arrayManu, clothesCollection) {\n for (let i = 0; i < clothesCollection.length; i++) {\n if (!arrayManu.includes(clothesCollection[i].manufacturer)) {\n arrayManu.push(clothesCollection[i].manufacturer);\n }\n }\n }",
"function restrictListProducts(prods, restriction) {\n\tlet product_names = [];\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\n\t\t\t\n\tlet lactoseFree = document.getElementById(\"lactoseIntolerant\");\n\t\n\tlet Nut = document.getElementById(\"nutFree\");\n\n\tlet isOrganic = document.getElementById(\"organic\");\n\n\tlet isHealthy = document.getElementById(\"healthy\");\n\n\tlet goodForWeightLoss = document.getElementById(\"weightLoss\");\n\n\n\tif(lactoseFree.checked) {\n\t\tproduct_names = product_names.filter(product_names => product_names.lactoseIntolerant);\n\n\t}\n\n\tif(Nut.checked) {\n\t\tproduct_names = product_names.filter(product_names => product_names.nutFree);\n\n\t}\n\n\tif(isOrganic.checked) {\n\t\tproduct_names = product_names.filter(product_names => product_names.organic);\n\n\t}\n\n\tif(isHealthy.checked) {\n\t\tproduct_names = product_names.filter(product_names => product_names.healthy);\n\n\t}\n\n\tif(goodForWeightLoss.checked) {\n\t\tproduct_names = product_names.filter(product_names => product_names.weightLoss);\n\n\t}\n\n\t\t\t\n\t// Sort the array by price so that the items show in price order\n\n\tproduct_names.sort(function(a, b){\n\t\treturn a.price - b.price\n\t});\n\t\n\n\t\n\treturn product_names;\n}",
"function restrictListProducts(prods, restriction) {\r\n\tlet product_names = [];\r\n\tfor (let i=0; i<prods.length; i+=1) {\r\n\t\tprods.sort(function(a, b){return a.price - b.price}); //sort product list by price\r\n\t\tif ((restriction == \"Lactose\") && (prods[i].lactoseF == true)){\r\n\t\t\tproduct_names.push(prods[i].name);\r\n\t\t}\r\n\t\telse if ((restriction == \"Nuts\") && (prods[i].nutsF == true)){\r\n\t\t\tproduct_names.push(prods[i].name);\r\n\t\t}\r\n\t\telse if ((restriction == \"Organic\") && (prods[i].org == true)){\r\n\t\t\tproduct_names.push(prods[i].name);\r\n\t\t}\r\n\t\telse if (restriction == \"None\"){\r\n\t\t\tproduct_names.push(prods[i].name);\r\n\t\t}\r\n\t}\r\n\treturn product_names;\r\n}",
"function allPremium(shoppingCart) {\n const premiumProducts = filterPremiumProducts(shoppingCart);\n if (premiumProducts.length == shoppingCart.length) {\n console.log(\"Pedidos sin gastos de envio\")\n }\n}",
"function catalogFind(){\n var catalog=returnCatalog(\"item\");\n // console.log(catalog);\n if(catalog != null){\n productArray = processArray(catalog,1);\n nowArray = productArray;\n // console.log(productArray);\n getSortMethod(nowArray);\n updateBrandAmount();\n changeDisplayAmount(displayType,1);\n }\n}",
"verProductos() {\n if (productosArray.length < 1) return false;\n return productosArray;\n }",
"function updateOccupancy(raddec, isDisappearance) {\n let isOccupant = raddec.transmitterId.startsWith(\"ac233fa\");\n if(isOccupant) {\n if(!isDisappearance) {\n if(!presenceArray.includes(raddec.transmitterId)) {\n presenceArray.push(raddec.transmitterId);\n occupancyCount.textContent = presenceArray.length;\n }\n } \n else {\n if(presenceArray.includes(raddec.transmitterId)) {\n presenceArray.splice(presenceArray.indexOf(raddec.transmitterId), 1);\n occupancyCount.textContent = presenceArray.length;\n }\n }\n }\n\n return presenceArray.length;\n}",
"function prerequisiteNotCategory()\n {\n items.each(function() {\n //get item prerequisites\n var prerequisites = $(this).data(\"prerequisites\").toString();\n\n //if item has prerequisites, check it's not a category\n if(prerequisites.length !== 0) {\n var prerequisitesArray = prerequisites.split(\",\");\n\n //check each prerequisite\n for(var i = 0; i < prerequisitesArray.length; i++) {\n var requiredItem = container.find(\"[data-name='\" + prerequisitesArray[i] + \"']\");\n\n //check prerequisite isn't a category\n if(requiredItem.hasClass(\"category\")) {\n console.error(\"Item '\" + $(this).data(\"name\") + \"' has prerequisite which is a category '\" + prerequisitesArray[i] + \"'\");\n }\n }\n }\n });\n }",
"function add(animals, animal){ //checks if the animal to be added is\n if(animal.name && animal.species){ // valid and not already in the array\n for(let i = 0; i < animals.length; i++){\n if(animals[i].name === animal.name){\n return true;\n }else if(i === animals.length - 1){ //only adds if the loop \n animals.push(animal); //makes it to the end of the array\n } \n }\n }\n}"
]
| [
"0.64424646",
"0.6329203",
"0.6263789",
"0.6247003",
"0.6152083",
"0.6087974",
"0.59763646",
"0.59583944",
"0.5938998",
"0.59161246",
"0.57905895",
"0.57601166",
"0.5672675",
"0.5606312",
"0.5566219",
"0.55474746",
"0.5512951",
"0.5480384",
"0.54802597",
"0.54764855",
"0.5463545",
"0.544233",
"0.54393715",
"0.5378624",
"0.5355622",
"0.5316584",
"0.5296011",
"0.5212425",
"0.5202397",
"0.5188257"
]
| 0.6496614 | 0 |
map our sessionActions to class props | function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators(sessionActions, dispatch)
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_registerToActions(action) { \n switch(action.actionType) {\n case ActionTypes.CLASSES_FETCHED:\n this._setClasses(action.payload);\n break;\n case ActionTypes.CLASS_CREATED:\n ClassActions.fetchClasses();\n break;\n case ActionTypes.CLASS_FETCHED:\n this._setClass(action.payload);\n break;\n case ActionTypes.CLASS_STUDENTS_FETCHED:\n this._setClassStudents(action.payload);\n break;\n case ActionTypes.CLASS_INS_FETCHED:\n this._setClassInstructors(action.payload);\n break;\n case ActionTypes.CLASS_INS_ADDED:\n case ActionTypes.CLASS_INS_REMOVED:\n case ActionTypes.CLASS_STUDENT_ADDED:\n case ActionTypes.CLASS_STUDENT_REMOVED:\n\n setTimeout(() => { // Run after dispatcher has finished\n this.emit(CLASS_CHANGED);\n }, 0);\n break;\n }\n }",
"function makeActions(store) {\n const actions = {}\n Object.keys(sessionReducers).forEach(name => {\n actions[name] = function actionDispatch(id, value ) {\n return store.dispatch({type: name, id, value})\n }\n })\n Object.keys(stateReducers).forEach(name => {\n actions[name] = function actionDispatch(value ) {\n return store.dispatch({type: name, value})\n }\n })\n return actions\n}",
"mapDispatchToProps(dispatch) {\n return {\n setStyle: (screen) => this.setStyle(screen),\n logout: () => this.logout()\n }\n }",
"mapDispatchToProps() {\n return {\n logout: () => this.logout(),\n changeField: (name,value) => this.changeField(name,value),\n changeImage: () => this.changeImage(),\n submit: () => this.submit()\n }\n }",
"constructor(props) {\n super(props);\n\n this.state = ({\n session: this.props.data,\n current_time: 0,\n });\n }",
"function mapActionToProps(dispatch) { return bindActionCreators({ SwitchSceneAction }, dispatch); }",
"constructor(props){\n super(props);\n this.state = {\n classId: this.props.location.state.classId,\n classTitle: this.props.location.state.className,\n isInstructor: this.props.location.state.user.is_instructor,\n isActive: this.props.location.state.isActive,\n activeItem: \"session\"\n }\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 }",
"bindActions() {\n\t\t// @props\n\t\t// onComplete\n\t\t// buttons\n\t\t// cancelIndex\n\t\t// title\n\t\t// &\n\t\t// this will be an abstraction\n\t\t// so we don't have to worry about\n\t\t// changing props AND showing\n\t\t// the action sheet within other\n\t\t// parts of the app\n\t\t// the action sheet will be shown\n\t\t// after required props have been mounted \n\t\t// to the component\n\t\tActions.ActionSheet = props => this.fromGlobalActionSheet(props)\n\t}",
"function mapStateToProps(state) {\n return {\n connectionStatus: state.connectionStatus,\n session: state.session,\n };\n}",
"refreshSession(state, payload)\n {\n state.session = {...state.session,...payload};\n }",
"function mapStateToProp(state) {\n return {\n login_signup_reducer : state.login_signup_reducer,\n session:state.session\n }\n}",
"_registerToActions(action) {\n\n switch(action.actionType) {\n \n case ActionTypes.ACCOUNT_SIGN_IN:\n this._setUserid(action.payload);\n break;\n case ActionTypes.ACCOUNT_CREATED:\n this._setUserid(action.payload);\n case ActionTypes.GET_USER:\n this._setUser(action.payload);\n break;\n case ActionTypes.ROLES_RECEIVED:\n this._setRoles(action.payload);\n break;\n default:\n break;\n }\n }",
"function mapDispatchToProps(dispatch: Function): Object {\n return {\n actions: bindActionCreators({ logout }, dispatch)\n };\n}",
"function mapDispatchToProps(StoreDispatch){\n console.log('mapDispatchToProps ');\n return{//we are returning object literal { onIncrementClick: value, onDecrementtClick: otherValue };\n //':' assigns a function as a property of an object literal. \n onIncrementClick: () => {\n const action = { type: Actions.INCREMENT_REQUESTED};\n StoreDispatch(action);\n },\n onDecrementtClick: () => {\n const action = { type: Actions.DECREMENT_REQUESTED};\n StoreDispatch(action);\n }\n }\n}",
"function mapStateToProps(state) {\n return {\n session: state.auth.session,\n myPages: state.activism.myPages,\n state: state.activism.state\n }\n}",
"function mapActionToProps(dispatch) { return bindActionCreators({ GetActivityAction }, dispatch); }",
"function mapStateToProps(state) {\nconst { loading, connected } = state.Auth.toJS();\n\nreturn {\nloading, connected,\n\ntoken: state.Auth.get('token'), \nuser: state.Auth.get('user'),\nuser_type: state.Auth.get('user_type'),\nchildrens:state.Auth.get('childrens'),\nclass:state.Auth.get('class')\n};\n}",
"get actionProperties() {\n return this._actionProperties;\n }",
"function mapDispatchToProps(dispatch) {\r\n return {\r\n logout:()=>{\r\n dispatch(login_signup_action.logout())\r\n }\r\n }\r\n}",
"function ActionEventRegistry(actions){\n this.registry = {};\n this.actions = actions;\n \n this.actions.forEach(act => {this.registry[act] = void 0;});\n}",
"function SessionManager() {\n\n //const properties - writable default to false.\n /**\n * @private\n * @readOnly\n * @property _childToParentMap\n * @type Map\n * This maps a child ILinkableObject to a Dictionary, which maps each of its registered parent ILinkableObjects to a value of true if the child should appear in the session state automatically or false if not.\n */\n Object.defineProperty(this, \"_childToParentMap\", {\n value: new Map()\n });\n\n /**\n * @private\n * @readOnly\n * @property _parentToChildMap\n * @type Map\n * This maps a parent ILinkableObject to a Dictionary, which maps each of its registered child ILinkableObjects to a value of true if the child should appear in the session state automatically or false if not.\n */\n Object.defineProperty(this, \"_parentToChildMap\", {\n value: new Map()\n });\n\n /**\n * @private\n * @readOnly\n * @property _ownerToChildMap\n * @type Map\n * This maps a parent ILinkableObject to a Dictionary, which maps each child ILinkableObject it owns to a value of true.\n */\n Object.defineProperty(this, \"_ownerToChildMap\", {\n value: new Map()\n });\n\n /**\n * This maps a child ILinkableObject to its registered owner.\n * @private\n * @readOnly\n * @property _childToOwnerMap\n * @type Map\n */\n Object.defineProperty(this, \"_childToOwnerMap\", {\n value: new Map()\n });\n\n this.debug = false;\n\n this.linkableObjectToCallbackCollectionMap = new Map();\n this.debugBusyTasks = false;\n\n /**\n * @private\n * @readOnly\n * @property _disposedObjectsMap\n * @type Map\n */\n Object.defineProperty(this, \"_disposedObjectsMap\", {\n value: new Map()\n });\n\n /**\n * @private\n * @readOnly\n * @property _treeCallbacks\n * @type CallbackCollection\n */\n Object.defineProperty(this, \"_treeCallbacks\", {\n value: new weavecore.CallbackCollection()\n });\n\n /**\n * @private\n * @readOnly\n * @property _classNameToSessionedPropertyNames\n * @type Object\n */\n Object.defineProperty(this, \"_classNameToSessionedPropertyNames\", {\n value: {}\n });\n\n /**\n * keeps track of which objects are currently being traversed\n * @private\n * @readOnly\n * @property _getSessionStateIgnoreList\n * @type Map\n */\n Object.defineProperty(this, \"_getSessionStateIgnoreList\", {\n value: new Map()\n });\n\n\n /**\n * @private\n * @readOnly\n * @property _dTaskStackTrace\n * @type Map\n */\n Object.defineProperty(this, \"_dTaskStackTrace\", {\n value: new Map()\n });\n\n /**\n * @private\n * @readOnly\n * @property _d2dOwnerTask\n * @type weavecore.Dictionary2D\n */\n Object.defineProperty(this, \"_d2dOwnerTask\", {\n value: new weavecore.Dictionary2D()\n });\n\n /**\n * @private\n * @readOnly\n * @property _d2dTaskOwner\n * @type weavecore.Dictionary2D\n */\n Object.defineProperty(this, \"_d2dTaskOwner\", {\n value: new weavecore.Dictionary2D()\n });\n\n /**\n * ILinkableObject -> Boolean\n * @private\n * @readOnly\n * @property _dBusyTraversal\n * @type Map\n */\n Object.defineProperty(this, \"_dBusyTraversal\", {\n value: new Map()\n });\n\n /**\n * @private\n * @readOnly\n * @property _aBusyTraversal\n * @type Array\n */\n Object.defineProperty(this, \"_aBusyTraversal\", {\n value: []\n });\n\n /**\n * ILinkableObject -> int\n * @private\n * @readOnly\n * @property _dUnbusyTriggerCounts\n * @type Map\n */\n Object.defineProperty(this, \"_dUnbusyTriggerCounts\", {\n value: new Map()\n });\n\n /**\n * ILinkableObject -> String\n * @private\n * @readOnly\n * @property _dUnbusyStackTraces\n * @type Map\n */\n Object.defineProperty(this, \"_dUnbusyStackTraces\", {\n value: new Map()\n });\n\n }",
"static setActive(session) {\n this[singleton] = session;\n }",
"validateUserSession() {\n // if (sessionStorage.getItem('isLoggedIn') === 'true') {\n // this.props.loggedInStatusChanged(true);\n // } else {\n // this.props.loggedInStatusChanged(false);\n // }\n }",
"function mapActionToProps(dispatch) { return bindActionCreators({ SwitchTabAction }, dispatch); }",
"handleAllActions(action) {\n switch(action.name) {\n case \"DO_LOGIN\": {\n this.doLogin();\n }\n case \"DO_LOGOUT\": {\n this.doLogout();\n }\n }\n }",
"get action() { return this.actionIn; }",
"function session(state = [], action) {\n switch (action.type) {\n case actions.USER.TOGGLELOCALSTATUS: {\n const toggle = state => state === 'active' ? 'connected' : 'active'\n const users = state.users.map(\n user =>\n // todo extract out this function that modifies single value in collection\n (user.id === action.payload.id\n ? {...user, localStatus: toggle(user.localStatus)}\n : user)\n )\n const newState = {...state, users }\n return newState\n }\n case 'blah':\n return state\n default:\n return state\n }\n}",
"function mapDispathToProps(dispatch) {\n return {\n actions: bindActionCreators(userActions, dispatch),\n orderActions: bindActionCreators(orderActions, dispatch),\n customerActions: bindActionCreators(customerActions, dispatch),\n };\n}",
"function detectActions() {\n Object.keys(ACTIONS).forEach(key => {\n this[key] = this.getAttr(ACTIONS[key]);\n });\n}"
]
| [
"0.5642977",
"0.55315065",
"0.55312365",
"0.5512893",
"0.55089194",
"0.5462351",
"0.54150105",
"0.5411497",
"0.5410926",
"0.54068655",
"0.53695333",
"0.5351256",
"0.53392726",
"0.53357464",
"0.5313728",
"0.53108215",
"0.53049886",
"0.5302996",
"0.5293588",
"0.5250595",
"0.52445436",
"0.52338266",
"0.52331185",
"0.52240694",
"0.52235407",
"0.52183676",
"0.52090985",
"0.5206095",
"0.5204849",
"0.5203157"
]
| 0.6616551 | 0 |
render the children of this component the children of this component is an arrow function that takes the count and inrementCount and renders the original component and passes the count and inrementCount to it | render() {
return (
<div>
{this.props.children(this.state.count, this.incrementCount)}
</div>
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"render() {\n return (\n <Child handleClick={() => this.updateCount()} count={this.state.count}>\n Count\n </Child>\n );\n }",
"render() { \n console.log(\"props\",this.props)\n return ( \n <div>\n <div className=\"title m-2\">{this.props.children}</div>\n {/* this is how you access children that are passed */}\n <div className={this.formatCountBage()} style={{fontSize:20}}>{this.formatCount()}</div>\n <button style={{fontSize:20, padding:10}} onClick={this.handleIncrement} className=\"btn btn-secondary m-2\">Increment</button>\n <button style={{fontSize:20, padding:10}} onClick={this.handleDecrement} className=\"btn btn-secondary m-2\">Decrement</button>\n <button style={{fontSize:20, padding:10}} onClick={()=>this.props.onDelete(this.props.id)} className=\"btn btn-danger m-2\">Delete</button>\n {/* although the delete button is here it needs to be deleted in counters */}\n {/* an event needs to be raised to delete the particular counter and the counters class will handle it */}\n\n </div>\n );\n }",
"render(){\n return <WrappedComponent name='Marco' \n count={this.state.count} \n increment={this.clickHandler} \n // send props from Parent to wrapped Component\n {...this.props}\n />\n }",
"renderChildren() {\n\t\t\t\tlet children = []\n\n\t\t\t\t// split children into Label and not Label arrays\n\t\t\t\tlet components = spliceChildren(this.props.children, Label);\n\n\t\t\t\t// labeled is consumed by the parent button\n\t\t\t\tlet { labeled, ...other } = this.props;\n\n\t\t\t\tother.className = classNames(this.props.className, this.getClasses());\n\n\t\t\t\tlet icon = (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t{...other}\n\t\t\t\t\t\t\t\tkey=\"icon\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{components.remaining}\n\t\t\t\t\t\t</div>\n\t\t\t\t);\n\n\t\t\t\t// if Label was spliced at index 0, put it first\n\t\t\t\tif (components.index == 0) {\n\t\t\t\t\t\tchildren.push(components.component);\n\t\t\t\t\t\tchildren.push(icon);\n\t\t\t\t// otherwise last\n\t\t\t\t} else {\n\t\t\t\t\t\tchildren.push(icon);\n\t\t\t\t\t\tchildren.push(components.component);\n\t\t\t\t}\n\n\t\t\t\treturn children;\n\t\t}",
"render() {\n return (\n <OriginalComponent\n count={this.state.counter}\n incrementCounter={this.incrementCounter}\n {...this.props}\n />\n );\n }",
"render(){\n return(\n <div>\n {this.props.render(this.state.count, this.clickHandler)} \n </div> \n )\n }",
"render() {\r\n const { items, delItem, top, bottom, shoes, accessories,\r\n incrementCounter, decrementCounter } = this.props\r\n return (\r\n <div>\r\n <h2>Here's your wardrobe:</h2>\r\n { items.length === 0 && <p>Sorry, you don't have any items.</p>}\r\n Tops:\r\n <div className='belt'>\r\n <button onClick={() => decrementCounter('top', 'counter1')}>Less</button>\r\n {\r\n top.map(item =>\r\n // <Item key={item.id} item={item} delItem={delItem}/>\r\n <Item key={item.id} item={item} delItem={delItem} needDelButton={true} />\r\n )\r\n }\r\n <button onClick={() => incrementCounter('top', 'counter1')}>More</button>\r\n </div>\r\n Bottom:\r\n <div className='belt'>\r\n <button onClick={() => decrementCounter('bottom', 'counter2')}>Less</button>\r\n {\r\n bottom.map(item =>\r\n // <Item key={item.id} item={item} delItem={delItem}/>\r\n <Item key={item.id} item={item} delItem={delItem} needDelButton={true} />\r\n )\r\n }\r\n <button onClick={() => incrementCounter('bottom', 'counter2')}>More</button>\r\n </div>\r\n Shoes:\r\n <div className='belt'>\r\n <button onClick={() => decrementCounter('shoes', 'counter3')}>Less</button>\r\n {\r\n shoes.map(item =>\r\n // <Item key={item.id} item={item} delItem={delItem}/>\r\n <Item key={item.id} item={item} delItem={delItem} needDelButton={true} />\r\n )\r\n }\r\n <button onClick={() => incrementCounter('shoes', 'counter3')}>More</button>\r\n </div>\r\n Accessories:\r\n <div className='belt'>\r\n <button onClick={() => decrementCounter('accessories', 'counter4')}>Less</button>\r\n {\r\n accessories.map(item =>\r\n // <Item key={item.id} item={item} delItem={delItem}/>\r\n <Item key={item.id} item={item} delItem={delItem} needDelButton={true} />\r\n )\r\n }\r\n <button onClick={() => incrementCounter('accessories', 'counter4')}>More</button>\r\n </div>\r\n\r\n {/* <button onClick={handleClick}>Add a new item</button> */}\r\n </div> \r\n )\r\n }",
"render() {\n return (\n // Fragments let you group a list of children without adding extra nodes to the DOM\n // Best example: Table\n <>\n <div className=\"App\">\n {/* state variables passed to the local counter components */}\n <Counter counter={this.state.counterA} /> \n <Counter counter={this.state.counterB} />\n <Counter counter={this.state.counterC} />\n </div>\n <br />\n <div>\n {/* onClick = HTML attribute\n => - no binding of *this* (Does not have its own *this*)\n The *this* keyword ALWAYS represents the object that DEFINED the => \n *this* belongs to the lexically enclosing function. */}\n <button onClick={() => this.handleAllIncrease()}>Increase all</button>\n <button onClick={() => this.handleAllDecrease()}>Decrease all</button>\n </div>\n </>\n );\n }",
"render() {\r\n return (\r\n <div>\r\n {/* <img src={this.state.imageUrl} alt=\"\" /> */}\r\n {this.props.counter.children}\r\n <span style={this.styles} className={this.getBadgeClasses()}>\r\n {this.formatCount()}\r\n </span>\r\n <button\r\n onClick={() => this.handleIncrement()}\r\n className=\"btn btn-secondary btn-sm\"\r\n >\r\n increment\r\n </button>\r\n <button\r\n onClick={() => this.props.onDelete(this.props.counter.id)}\r\n className=\"btn btn-danger btn-sm m-2\"\r\n >\r\n Delete\r\n </button>\r\n </div>\r\n );\r\n }",
"render() {\n // Destructuring this.props. When passing properties to counter no longer need this.props\n // E.g. onDelete={this.props.onDelete} is now onDelete={onDelete}\n const { onDelete, onIncrement, onClear, onRemoveOne, counter } = this.props;\n\n return (\n <div className=\"mainbox\">\n <div className=\"titles\">\n <h1 className=\"total\">Total</h1>\n\n <h1 className=\"price\">Price</h1>\n </div>\n <div className=\"counters\">\n {/* Map is used to insert the counters for each product into the page. data is passed in through object keys */}\n {/* This is used to pass a reference to the function to the child as a prop */}\n {/* The whole counter object can be passed using counter={counter} */}\n {/* This process now bubbles up the event from the child to the parent */}\n {this.props.counters.map(counter => (\n <Counter\n key={counter.id}\n onDelete={onDelete}\n onIncrement={onIncrement}\n onClear={onClear}\n onRemoveOne={onRemoveOne}\n counter={counter}\n />\n ))}\n </div>\n <button\n style={{ fontSize: 20, fontWeight: \"bold\" }}\n onClick={this.props.onReset}\n className=\"btn btn-danger btn-sm m-2\"\n >\n Resest all\n </button>\n </div>\n );\n }",
"render() {\n return (\n <React.Fragment>\n <NavBar totalCounters={this.state.counters.filter(c => c.value > 0).length}/>\n <main className=\"container\">\n <Counters \n counters={this.state.counters}\n onReset={this.handleReset}\n onDelete={this.handleDelete}\n onIncrement={this.handleIncrement}\n />\n </main>\n </React.Fragment>\n );\n }",
"render() {\n console.log(this.props);\n //Here is what I want my render method to return. As I can only return \n //one element, I wrap everything into a div. \n return (\n <div>\n {/* Inside the object props I can access children, which is the data I pass to a component inside its\n closing tags. For example in my Counters element I inserted a \"Counter number\" as data inside the closing tags.\n this data is accessible here in the children property */}\n {this.props.children}\n <span className={this.getBtnClasses()}>{this.formatCount()}</span>\n {/* Here I want the click on the button to trigger an event, incrementing the value of the counter\n so I call the function handleIncrement which does exactly the incrementation of the 'value' property of \n my counter */}\n <button \n onClick={this.handleIncrement} \n className=\"btn btn-secondary btn-sm m-2\">\n Increment\n </button>\n {/* Here I am adding a button that triggers a Delete method on click. \n The component that owns a piece of the state should be the one modifying it. In this particular case,\n the piece of the state that I want to delete is owned by the counters component, so Counters should be the component\n modifying the value (deleting it). To solve this problem and allow the state to be modified through the Counter component, it has to\n raise an event. onDelete (convention for naming events). So the Counter component raises the event, but the Counters component handles it \n (therefore the method is implemented there, but passed to the Counter component via props). */}\n <button onClick={() => this.props.onDelete(this.props.id)} className=\"btn btn-danger btn-sm m2\">Delete</button>\n </div>\n );\n }",
"render() { \n console.log(\"App-Rendered\");\n return (\n <React.Fragment>\n <NavBar totalCounters = {this.state.counters.filter( c => c.value > 0).length}/>\n <main \n className=\"container\">\n <Counters \n counters= {this.state.counters}\n onReset= {this.handleReset} \n onIncrement= {this.handleIncrement}\n onDelete= {this.handleDelete}\n />\n </main>\n </React.Fragment>\n );\n }",
"render() { \n\n console.log('Counter Component Rendered');\n return ( \n <div className=\"counter\">\n <span className={this.getbadgeClass()+' value'}>{this.formatCount()}</span>\n <button className=\"btn btn-primary btn-lg\" onClick={()=>this.props.onIncrement(this.props.counter)}>Increment</button>\n <button className=\"btn btn-danger btn-sm m-2\" onClick={()=>this.props.onDelete(this.props.counter.id)}>Delete</button> {/* Idea:function was passed as prop*/}\n </div> \n );\n }",
"function ParentComponent() {\n return (\n <div className =\"parent\">\n <CountVowels />\n <CountConsonants />\n </div>\n );\n}",
"renderChildren(children, refName) {\n\n\t\t// First we make sure that the refName parameter passed is a String\n\t\trefName = String(refName);\n\n\t\t// Iterating through the children of the repeatable component\n\t\treturn React.Children.map(children, (child, j) => {\n\n\t\t\t// First, we check if this child is NOT the defaultRef child\n\t\t\tif(typeof child.props.defaultRef === 'undefined') {\n\n\t\t\t\t// Now we check if the refName prop for this child is defined\n\t\t\t\tif(typeof child.props.refName !== 'undefined') {\n\t\t\t\t\trefName = child.props.refName+refName;\n\t\t\t\t}\n\n\t\t\t\t// Then, if the refName is not defined, we must check if\n\t\t\t\t// this is the only child element inside the Repeatable component\n\t\t\t\telse {\n\n\t\t\t\t\t// If this is not the only child, we must set its ref to null\n\t\t\t\t\t// in order to avoid ref names conflict.\n\t\t\t\t\tif(children instanceof Array) {\n\t\t\t\t\t\trefName = null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn React.cloneElement(child, { ref: refName });\n\t\t});\n\t}",
"render() {\n return (\n <div>\n <h1>Counter is {this.state.totalClicks}</h1>\n <ChildClass onClick={this.handleClick} />\n </div>\n );\n }",
"render() {\n\t\treturn(\n\t\t\t<div>\n\t\t\t\t<Button localHandleClick={this.handleClick} increment={1} />\n\t\t\t\t<Button localHandleClick={this.handleClick} increment={5} />\n\t\t\t\t<Button localHandleClick={this.handleClick} increment={10} />\n\t\t\t\t<Button localHandleClick={this.handleClick} increment={100} />\n\t\t\t\t<Result localCounter={this.state.counter} />\n\t\t\t</div>\n\t\t);\n\t}",
"wrapChildren(){\n const { children, title } = this.props;\n if (!children) return null;\n\n function wrap(child, idx = 0){\n return (\n <div className=\"indicator-item\" title={title || null} key={child.key || idx}>\n { child }\n </div>\n );\n }\n\n if (Array.isArray(children)){\n return React.Children.map(children, wrap);\n } else {\n return wrap(children);\n }\n }",
"render() {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{/* display initial state and state changes */}\n\t\t\t\t<h2>This is a counter using a class</h2>\n\t\t\t\t<h1>{this.state.count}</h1>\n\t\t\t\t{/* button that calls function to increment count */}\n\t\t\t\t<button onClick={this.setCount}>Click to Increment</button>\n\t\t\t</div>\n\t\t);\n\t}",
"render() {\n console.log('App-Rendered');\n console.log(this.state.counters);\n let x = 0;\n return (\n <React.Fragment>\n <NavBar totalCounters={\n this.state.counters.filter(c => c.value > 0).length}\n counters={\n this.state.counters.filter(c => c.value > 0)}\n />\n <main className=\"container\">\n <Counters\n counters={this.state.counters}\n onReset={this.handleReset}\n onIncreament={this.handleIncreament}\n onDelete={this.handleDelete}\n onTotalCount={this.handleTotalCount}\n >\n\n </Counters>\n </main>\n </React.Fragment>\n );\n }",
"render() {\n return (\n <div>\n \t{this.props.children}\n </div>\n );\n }",
"render() {\n return this.props.children;\n }",
"render() {\n const { children } = this.props;\n return (\n <div className=\"tabs\">\n {Children.map(children, this._addChildRefs, this)}\n </div>\n );\n }",
"render() {\n console.log('Render');\n return (\n <div>\n <h3>Count: {this.state.count}</h3>\n <button onClick={this.incrememtHandler}>INCREMENT</button>\n <button onClick={this.decrementHandler}>DECREMENT</button>\n </div>\n );\n }",
"render() {\n return (\n <div className=\"part1\">\n <div>\n {this.props.index+1})\n </div>\n </div>\n )\n }",
"function Counter(props) {\n\treturn (\n\t\t<div className=\"container\" style={bodyStyles}>\n\t\t\t<div className=\"row\">\n\t\t\t\t<div className=\"col-2\" style={cardStyles}>\n\t\t\t\t\t<i className=\"far fa-clock\" />\n\t\t\t\t</div>\n\t\t\t\t<div className=\"col\" style={cardStyles}>\n\t\t\t\t\t{props.numeroSeis % 10}\n\t\t\t\t</div>\n\t\t\t\t<div className=\"col\" style={cardStyles}>\n\t\t\t\t\t{props.numeroCinco % 10}\n\t\t\t\t</div>\n\t\t\t\t<div className=\"col\" style={cardStyles}>\n\t\t\t\t\t{props.numeroCuatro % 10}\n\t\t\t\t</div>\n\t\t\t\t<div className=\"col\" style={cardStyles}>\n\t\t\t\t\t{props.numeroTres % 10}\n\t\t\t\t</div>\n\t\t\t\t<div className=\"col\" style={cardStyles}>\n\t\t\t\t\t{props.numeroDos % 10}\n\t\t\t\t</div>\n\t\t\t\t<div className=\"col\" style={cardStyles}>\n\t\t\t\t\t{props.numeroUno % 10}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}",
"function ClassicGrid({ children }) {\n if (children.length !== 5) {\n console.log(children)\n throw 'There should be 5 child components.'\n }\n\n const children_ordering = [\n 'classic-grid-parent__header',\n 'classic-grid-parent__left-sidebar',\n 'classic-grid-parent__main-content',\n 'classic-grid-parent__right-sidebar',\n 'classic-grid-parent__footer'\n ]\n\n const newChildren = children.map((child, idx) => {\n return styleInjector(child, children_ordering[idx])\n })\n\n console.log(children, newChildren)\n\n return <div className='classic-grid-parent'>{newChildren}</div>\n}",
"render() {\n const { classes } = this.props;\n const children = [];\n\n // Build all of the events\n for (var i = 0; i < this.state.events.length; i += 1) {\n let event = this.state.events[i];\n let index = i;\n let date = this.getFormattedDate(event);\n var month = (1 + date.getMonth());\n month = month.length > 1 ? month : '0' + month;\n var day = date.getDate().toString();\n day = day.length > 1 ? day : '0' + day;\n var hours = date.getHours();\n var minutes = date.getMinutes().toString();\n minutes = minutes.length > 1 ? minutes : '0' + minutes;\n let startDate = date.getFullYear() + '-' + month + '-' + day + \" \" + this.timeString(hours, minutes);\n date.setMilliseconds(date.getMilliseconds() + (event[\"duration\"] * 60000));\n hours = date.getHours();\n minutes = date.getMinutes().toString();\n minutes = minutes.length > 1 ? minutes : '0' + minutes;\n let fullDate = startDate + \"-\" + this.timeString(hours, minutes);\n if (this.props.eventType === '/current-events') {\n if (this.state.adminSignedIn) {\n children.push(<CurrentChildComponent key={i} name={event[\"name\"]} date={fullDate} location={'Location: ' + event[\"location\"]} \n organization={'Group: ' + event[\"organization\"]} description={'Description: ' + event[\"description\"]} tags={'Tags: ' + event[\"tags\"]} image={this.state.urls[index]}\n webLink={'Web Link: ' + event[\"webLink\"]}\n editAction={() => this.editAction(event, index)} \n raffleOnclick={() => this.raffleOnclick(event,index)}\n downloadQR={() => this.downloadQR(event)}\n viewAttendees={() => this.viewAttendees(event)}\n />);\n } else {\n children.push(<CurrentChildComponent key={i} name={event[\"name\"]} date={fullDate} location={'Location: ' + event[\"location\"]} \n organization={'Group: ' + event[\"organization\"]} description={'Description: ' + event[\"description\"]} tags={'Tags: ' + event[\"tags\"]} image={this.state.urls[index]}\n webLink={'Web Link: ' + event[\"webLink\"]}\n editAction={() => this.handleBeginRequest()} \n raffleOnclick={() => this.raffleOnclick(event,index)}\n downloadQR={() => this.downloadQR(event)}\n viewAttendees={() => this.viewAttendees(event)}\n />); \n }\n \n } else {\n children.push(<PendingChildComponent key={i} name={event[\"name\"]} date={fullDate} location={'Location: ' + event[\"location\"]} \n organization={'Group: ' + event[\"organization\"]} description={'Description: ' + event[\"description\"]} tags={'Tags: ' + event[\"tags\"]} image={this.state.urls[index]}\n editAction={() => this.editAction(event, index)} email={event[\"status\"]} webLink={'Web Link: ' + event[\"webLink\"]}\n />);\n }\n \n };\n\n return (\n <div>\n <div style={{position: \"fixed\", top: \"50%\", left: \"50%\", margintop: \"-50px\", marginleft: \"-50px\", width: \"100px\", height: \"100px\"}}>\n <CircularProgress disableShrink style={{visibility: this.state.hidden}}></CircularProgress>\n </div>\n <div style={{textAlign: \"center\", marginBottom: 20}}>\n <div style={{position: 'relative', display: \"inline-block\"}}>\n <Paper style={{padding: '2px 4px', display: \"flex\", alignItems: \"center\", width: 400}} elevation={1}>\n <SearchIcon style={{padding: 10}}/>\n <InputBase\n style={{width: 300}}\n placeholder=\"Search Events\" \n value={this.state.searchText}\n onChange={this.handleSearchChange} />\n <IconButton onClick={this.handleClear}><CloseIcon/></IconButton>\n <Divider style={{width: 1, height: 28, margin: 4}} />\n <IconButton onClick={this.handleSortOpenClose}><SortIcon/></IconButton>\n </Paper>\n </div>\n </div>\n <div style={{textAlign: \"center\", marginBottom: 20, display: this.state.sortMenu}}>\n <div style={{position: 'relative', display: \"inline-block\"}}>\n <Paper style={{padding: '2px 4px', display: \"flex\", alignItems: \"center\", width: 400}} elevation={1}>\n <FormControl component=\"fieldset\" style={{paddingLeft: 10}}>\n <FormLabel component=\"legend\" style={{paddingTop: 10}}>Sort By:</FormLabel>\n <FormControlLabel\n control={\n <Switch\n checked={this.state.isAscending}\n onChange={this.handleToggle('isAscending')}\n value=\"isAscending\"\n color=\"primary\"\n />\n }\n label=\"Ascending\"\n />\n <RadioGroup\n aria-label=\"gender\"\n name=\"gender2\"\n value={this.state.sortBy}\n onChange={this.handleSort}\n >\n <FormControlLabel\n value=\"date\"\n control={<Radio color=\"primary\" />}\n label=\"Date\"\n labelPlacement=\"end\"\n />\n <FormControlLabel\n value=\"title\"\n control={<Radio color=\"primary\" />}\n label=\"Title\"\n labelPlacement=\"end\"\n />\n <FormControlLabel\n value=\"organization\"\n control={<Radio color=\"primary\" />}\n label=\"Group\"\n labelPlacement=\"end\"\n />\n </RadioGroup>\n </FormControl>\n </Paper>\n </div>\n </div>\n {this.addRafflePopUp()}\n \n <Dialog\n onClose={this.attendeesClose}\n open={this.state.attendeesOpen}>\n <DialogTitle onClose={this.attendeesClose}>Attendees</DialogTitle>\n <DialogContent>\n {this.state.attendeesList}\n </DialogContent>\n </Dialog>\n \n\n <ParentComponent>\n {children}\n </ParentComponent>\n <Dialog\n onClose={this.handleCloseEdit}\n aria-labelledby=\"customized-dialog-title\"\n open={this.state.editing}\n >\n <DialogTitle id=\"customized-dialog-title\" onClose={this.handleCloseEdit}>\n Edit Event\n </DialogTitle>\n <DialogContent>\n <MuiPickersUtilsProvider utils={MomentUtils}>\n <Grid container>\n <Grid item container direction=\"column\" spacing={0}>\n <Grid item>\n <TextField\n label=\"Event Title\"\n id=\"event-name\"\n margin=\"normal\"\n value={this.state.popUpEvent[\"name\"]}\n onChange={this.handleNameChange} /> \n </Grid>\n <Grid item>\n <DatePicker\n margin=\"normal\"\n label=\"Start Date\"\n value={this.state.date}\n onChange={this.handleDateChange} />\n </Grid>\n <Grid item>\n <TimePicker\n margin=\"normal\"\n label=\"Start Time\"\n value={this.state.date}\n onChange={this.handleDateChange} />\n </Grid>\n <Grid item>\n <TextField\n id=\"event-dur\"\n label=\"Duration (minutes)\"\n margin=\"normal\"\n value={this.state.popUpEvent[\"duration\"]}\n type=\"number\"\n onChange={this.handleDurationChange} />\n </Grid>\n <Grid item>\n <TextField\n id=\"event-org\"\n label=\"Location\"\n margin=\"normal\"\n value={this.state.popUpEvent[\"location\"]}\n onChange={this.handleLocationChange} />\n </Grid>\n <Grid item>\n <FormControl margin=\"normal\">\n <InputLabel>Group</InputLabel>\n <Select\n displayEmpty\n value={this.state.popUpEvent[\"organization\"]}\n style={{minWidth: 200, maxWidth: 200}}\n onChange={this.handleOrganizationChange}\n variant='outlined'\n >\n {this.state.groups.map(group => (\n <MenuItem key={group} value={group}>\n {group}\n </MenuItem>\n ))} \n </Select>\n </FormControl>\n </Grid>\n <Grid item> \n <FormControl margin=\"normal\">\n <InputLabel htmlFor=\"select-multiple\">Tags</InputLabel>\n <Select\n multiple\n displayEmpty\n input={<Input id=\"select-multiple\"/>}\n value={this.state.tags}\n style={{minWidth: 200, maxWidth: 200}}\n onChange={e => this.setState({ tags: e.target.value })}\n variant='outlined'\n >\n <MenuItem disabled value=\"\">\n <em>Select Tags</em>\n </MenuItem>\n {this.state.databaseTags.map(tag => (\n <MenuItem key={tag} value={tag}>\n {tag}\n </MenuItem>\n ))} \n </Select>\n </FormControl>\n </Grid>\n <Grid item>\n <TextField\n id=\"event-link\"\n label=\"Web Link (Optional)\"\n margin=\"normal\"\n value={this.state.popUpEvent[\"webLink\"]}\n onChange={this.handleWebLinkChange} />\n </Grid>\n <Grid item>\n <TextField\n id=\"event-desc\"\n label=\"Description\"\n multiline\n rows=\"5\"\n margin=\"normal\"\n variant=\"outlined\"\n value={this.state.popUpEvent[\"description\"]}\n onChange={this.handleDescriptionChange} />\n </Grid>\n <Grid item>\n <FilePicker\n extensions={['jpg', 'jpeg', 'png']}\n onChange={this.handleImageFileChanged}\n onError={errMsg => this.displayMessage(this, errMsg)} >\n <Button variant=\"contained\"\n disabled={this.state.uploading}>\n Select Image \n </Button>\n </FilePicker>\n </Grid>\n <Grid item>\n <Image\n style={{width: 192, height: 108}}\n source={{uri: this.state.image64}}\n />\n </Grid>\n </Grid>\n </Grid>\n </MuiPickersUtilsProvider>\n </DialogContent>\n <DialogActions style={{justifyContent: 'center'}}>\n <MuiThemeProvider theme={redTheme}>\n <Button variant=\"contained\" onClick={this.handleDeleteOpen} color=\"primary\">\n {this.state.cancelButton}\n <DeleteIcon/>\n </Button>\n </MuiThemeProvider>\n <Button variant=\"contained\" onClick={this.handleSaveEdit} color=\"primary\">\n {this.state.confirmButton}\n <SaveIcon/>\n </Button>\n </DialogActions>\n </Dialog>\n <Dialog onClose={this.handleCloseRequest}\n aria-labelledby=\"Request\"\n open={this.state.requesting}>\n <Card style={{minWidth: 150, minHeight: 125}}>\n <div style={{fontSize: 25, justifyContent: 'center', padding: 20}}>\n If you would like to make a change to your event, please email [email protected] with the change you would like for approval.\n </div>\n </Card>\n </Dialog>\n <Dialog\n open={this.state.openDelete}\n onClose={this.handleDeleteClose}\n aria-labelledby=\"alert-dialog-title\"\n aria-describedby=\"alert-dialog-description\"\n >\n <DialogTitle id=\"alert-dialog-title\">{\"Are you sure you want to \" + this.state.popUpText + \" the event?\"}</DialogTitle>\n <DialogActions>\n <Button onClick={this.handleDeleteClose} color=\"primary\">\n Cancel\n </Button>\n <MuiThemeProvider theme={redTheme}>\n <Button onClick={this.handleDelete} color=\"primary\" autoFocus>\n Confirm\n </Button>\n </MuiThemeProvider>\n </DialogActions>\n </Dialog>\n <Snackbar\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'left',\n }}\n open={this.state.open}\n autoHideDuration={6000}\n onClose={this.handleClose}\n ContentProps={{\n 'aria-describedby': 'message-id',\n }}\n message={this.state.message}\n action={[\n <Button\n key=\"close\"\n aria-label=\"Close\"\n color=\"inherit\"\n onClick={this.handleClose}\n > X\n </Button>,\n ]}\n />\n </div>\n );\n }",
"render() {\n \t// 3) Style part of a component (also in Counter.css)\n \tconst counter_style = {fontSize: \"50px\", padding: \"15px 30px\"}; // inline JavaScript css\n return (\n <div className=\"counter\">\n { /* Note that we are not making a function call. We are just passing a reference to function. */}\n { /* To call a class method, we have to call like 'this.increment' and not 'increment' */}\n { /* Component props are added in Component tag like attributes */ }\n { /* 5) props part of a component - data passed to a component */ }\n <CounterButton by={1} incrementMethod={this.increment} decrementMethod={this.decrement} />\n <CounterButton by={5} incrementMethod={this.increment} decrementMethod={this.decrement} />\n <CounterButton by={10} incrementMethod={this.increment} decrementMethod={this.decrement} />\n {/* Use className and not class */}\n <span className=\"count\" style={counter_style}>{this.state.counter}</span>\n <div><button className=\"reset\" onClick={this.reset}>Reset</button></div>\n </div>\n );\n }"
]
| [
"0.6643785",
"0.66287214",
"0.65983915",
"0.658134",
"0.65642995",
"0.6360201",
"0.62864524",
"0.62839437",
"0.62774336",
"0.62731767",
"0.6217829",
"0.62085485",
"0.61763597",
"0.61495376",
"0.61429685",
"0.6142749",
"0.6121322",
"0.60920495",
"0.6079362",
"0.6040119",
"0.60259783",
"0.60227054",
"0.60203457",
"0.59946305",
"0.59940463",
"0.5933263",
"0.59309226",
"0.5922567",
"0.59058386",
"0.58996063"
]
| 0.7884897 | 0 |
for some reason, the interaction between the random seed and the webgl pseduorandom function produces unpleasant looking artifacts (i.e. diagonal and occasionally horizontal lines) for certain values of the random seed the main cause seems to be when the random seed is less than 0.27 or so this fix doesn't 100% solve the problem (as there seems to be other causes as well), but it is rare enough to be acceptable for now | function generateRandomSeed(){
return Math.random() * 0.73 + 0.27;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function random () {\n\t\n\tseed = 312541332155 * (4365216455 + seed) % 7654754253243312;\n\t\n\treturn 0.0000001 * (seed % 10000000);\n\t\n}",
"function srandom() {\n randomSeed = (randomSeed * 9301 + 49297) % 233280;\n return randomSeed / 233280;\n}",
"function rnd() \n{\n\t\t\n rnd.seed = (rnd.seed*9301+49297) % 233280;\n return rnd.seed/(233280.0);\n}",
"function random() {\n\t\tseed = Math.sin(seed) * 10000;\n\t\treturn seed - Math.floor(seed);\n\t}",
"function seededRandom()\n{\n m_z = (36969 * (m_z & 65535) + (m_z >> 16)) & mask;\n m_w = (18000 * (m_w & 65535) + (m_w >> 16)) & mask;\n var result = ((m_z << 16) + m_w) & mask;\n result /= 4294967296;\n return result + 0.5;\n}",
"randomize(width, height, pxBox, probability=0.6) {\n // Helper function to set up two-way edges\n function connectVerts(v0, v1) {\n v0.edges.push(new Edge(v0, v1));\n v1.edges.push(new Edge(v1, v0));\n }\n\n let count = 0;\n\n // Build a grid of verts\n let grid = [];\n for (let y = 0; y < height; y++) {\n let row = [];\n for (let x = 0; x < width; x++) {\n let v = new Vertex();\n //v.value = 'v' + x + ',' + y;\n v.value = 'v' + count++;\n row.push(v);\n }\n grid.push(row);\n }\n\n\n // Last pass, set the x and y coordinates for drawing\n const boxBuffer = 0.8;\n const boxInner = pxBox * boxBuffer;\n const boxInnerOffset = (pxBox - boxInner) / 2 + 5;\n\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n grid[y][x].pos = {\n 'x': (x * pxBox + boxInnerOffset + Math.random() * boxInner) | 0,\n 'y': (y * pxBox + boxInnerOffset + Math.random() * boxInner) | 0\n };\n }\n }\n\n // Go through the grid randomly hooking up edges\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n // Connect down\n if (y < height - 1) {\n if (Math.random() < probability) {\n connectVerts(grid[y][x], grid[y+1][x]);\n }\n }\n\n // Connect right\n if (x < width - 1) {\n if (Math.random() < probability) {\n connectVerts(grid[y][x], grid[y][x+1]);\n }\n }\n }\n }\n\n\n // Finally, add everything in our grid to the vertexes in this Graph\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n this.vertexes.push(grid[y][x]);\n }\n }\n }",
"function randomColor(seed){\n var s = parseFloat('0.'+seed);\n const randomColor = '#'+Math.floor(s*16777215).toString(16);\n return randomColor;\n}",
"randomize(width, height, pxBox, probability=0.6) {\n // Helper function to set up two-way edges\n function connectVerts(v0, v1) {\n v0.edges.push(new Edge(v1));\n v1.edges.push(new Edge(v0));\n }\n\n let count = 0;\n this.vertexes.length = 0;\n\n // Build a grid of verts\n let grid = [];\n for (let y = 0; y < height; y++) {\n let row = [];\n for (let x = 0; x < width; x++) {\n let v = new Vertex();\n //v.value = 'v' + x + ',' + y;\n v.value = 'v' + count++;\n row.push(v);\n }\n grid.push(row);\n }\n\n // Go through the grid randomly hooking up edges\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n // Connect down\n if (y < height - 1) {\n if (Math.random() < probability) {\n connectVerts(grid[y][x], grid[y+1][x]);\n }\n }\n\n // Connect right\n if (x < width - 1) {\n if (Math.random() < probability) {\n connectVerts(grid[y][x], grid[y][x+1]);\n }\n }\n }\n }\n\n // Last pass, set the x and y coordinates for drawing\n const boxBuffer = 0.8;\n const boxInner = pxBox * boxBuffer;\n const boxInnerOffset = (pxBox - boxInner) / 2;\n\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n grid[y][x].pos = {\n 'x': (x * pxBox + boxInnerOffset + Math.random() * boxInner) | 0,\n 'y': (y * pxBox + boxInnerOffset + Math.random() * boxInner) | 0\n };\n }\n }\n\n // Finally, add everything in our grid to the vertexes in this Graph\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n this.vertexes.push(grid[y][x]);\n }\n }\n }",
"function replaceMathRandom() {\n Math.random = seededRandom(6);\n }",
"function random() {\n var x = Math.sin(seed++) * 10000;\n return x - Math.floor(x);\n}",
"function randSeed() {\n return Math.floor(65536 * Math.random());\n}",
"function randomColorGen(){\n // return `#${Math.floor(Math.random()*16777215).toString(16)}`;\n return \"#\" + Math.random().toString(16).slice(2, 8)\n}",
"onTransitionStart() {\n this.seed = Math.random() * 45000;\n }",
"randomize(width, height, pxBox, probability=0.6) {\n\t\t// Helper function to set up two-way edges\n\t\tfunction connectVerts(v0, v1) {\n\t\t\tv0.edges.push(new Edge(v1));\n\t\t\tv1.edges.push(new Edge(v0));\n\t\t}\n\n\t\tlet count = 0;\n\n\t\t// Build a grid of verts\n\t\tlet grid = [];\n\t\tfor (let y = 0; y < height; y++) {\n\t\t\tlet row = [];\n\t\t\tfor (let x = 0; x < width; x++) {\n\t\t\t\tlet v = new Vertex();\n\t\t\t\t//v.value = 'v' + x + ',' + y;\n\t\t\t\tv.value = 'v' + count++;\n\t\t\t\trow.push(v);\n\t\t\t}\n\t\t\tgrid.push(row);\n\t\t}\n\n\t\t// Go through the grid randomly hooking up edges\n\t\tfor (let y = 0; y < height; y++) {\n\t\t\tfor (let x = 0; x < width; x++) {\n\t\t\t\t// Connect down\n\t\t\t\tif (y < height - 1) {\n\t\t\t\t\tif (Math.random() < probability) {\n\t\t\t\t\t\tconnectVerts(grid[y][x], grid[y+1][x]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Connect right\n\t\t\t\tif (x < width - 1) {\n\t\t\t\t\tif (Math.random() < probability) {\n\t\t\t\t\t\tconnectVerts(grid[y][x], grid[y][x+1]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Last pass, set the x and y coordinates for drawing\n\t\tconst boxBuffer = 0.8;\n\t\tconst boxInner = pxBox * boxBuffer;\n\t\tconst boxInnerOffset = (pxBox - boxInner) / 2;\n\n\t\tfor (let y = 0; y < height; y++) {\n\t\t\tfor (let x = 0; x < width; x++) {\n\t\t\t\tgrid[y][x].pos = {\n\t\t\t\t\t'x': (x * pxBox + boxInnerOffset + Math.random() * boxInner) | 0,\n\t\t\t\t\t'y': (y * pxBox + boxInnerOffset + Math.random() * boxInner) | 0\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// Finally, add everything in our grid to the vertexes in this Graph\n\t\tfor (let y = 0; y < height; y++) {\n\t\t\tfor (let x = 0; x < width; x++) {\n\t\t\t\tthis.vertexes.push(grid[y][x]);\n\t\t\t}\n\t\t}\n\t}",
"randomColor() {\n /*\n Uncomment for random shades of blue\n\n h = 215;\n s = Math.floor(Math.random() * 100);\n l = 60 // Math.floor(Math.random() * 100);\n return 'hsl(' + h + ', ' + s + '%, ' + l + '%)';\n */\n return ('#' + (Math.random() * 0xFFFFFF << 0).toString(16) + '000000').slice(0, 7);\n }",
"function SeededRandom(){}",
"function pseudoRandom(seed) {\n seed = (seed * 9301 + 49297) % 233280;\n return seed / 233280.0;\n }",
"function RandomVividColor() {\n\n\tlet rFactor = Math.random();\n\tlet gFactor = Math.random();\n\tlet bFactor = Math.random();\n\n\tlet sumFactors = rFactor + gFactor + bFactor;\n\n\trFactor = 1.5 * rFactor / sumFactors;\n\tgFactor = 1.5 * gFactor / sumFactors;\n\tbFactor = 1.5 * bFactor / sumFactors;\n\n\tlet color = new THREE.Color(rFactor, gFactor, bFactor);\n\n\treturn color ;\n}",
"function randomColorGenerator() {\n\t\t\t\t\t\t\treturn '#'\n\t\t\t\t\t\t\t\t\t+ (Math.random().toString(16) + '0000000')\n\t\t\t\t\t\t\t\t\t\t\t.slice(2, 8);\n\t\t\t\t\t\t}",
"function random(seed) {\n if (typeof seed != \"undefined\") {\n var x = Math.sin(seed++) * 10000;\n return x - Math.floor(x);\n } else {\n return Math.random();\n }\n }",
"function randomColorCode() {\n var colorCode = [\n 'FFEBFF','FFEBF5','FFEBEB','FFF5EB','FFFFEB','F5FFEB','EBFFEB','EBFFF5','EBFFFF','EBF5FF','EBEBFF','F5EBFF',\n 'FFCDFE','FFCDE5','FFCECD','FFE7CD','FEFFCD','E5FFCD','CDFFCE','CDFFE7','CDFEFF','CDE5FF','CECDFF','E7CDFF',\n 'FFAFFE','FFAFD6','FFB0AF','FFD8AF','FEFFAF','D6FFAF','AFFFB0','AFFFD8','AFFEFF','AFD6FF','B0AFFF','D8AFFF',\n 'FF91FE','FF91C7','FF9291','FFC991','FEFF91','C7FF91','91FF92','91FFC9','91FEFF','91C7FF','9291FF','C991FF',\n 'FF73FD','FF73B7','FF7573','FFBB73','FDFF73','B7FF73','73FF75','73FFBB','73FDFF','73B7FF','7573FF','BB73FF',\n 'FF55FD','FF55A8','FF5755','FFAC55','FDFF55','A8FF55','55FF57','55FFAC','55FDFF','55A8FF','5755FF','AC55FF',\n 'FF37FD','FF3799','FF3937','FF9D37','FDFF37','99FF37','37FF39','37FF9D','37FDFF','3799FF','3937FF','9D37FF',\n 'FF19FC','FF1989','FF1C19','FF8F19','FCFF19','89FF19','19FF1C','19FF8F','19FCFF','1989FF','1C19FF','8F19FF',\n 'FA00F7','FA007A','FA0300','FA8000','F7FA00','7AFA00','00FA03','00FA80','00F7FA','007AFA','0300FA','8000FA',\n 'DC00D9','DC006B','DC0300','DC7100','D9DC00','6BDC00','00DC03','00DC71','00D9DC','006BDC','0300DC','7100DC',\n 'BE00BC','BE005D','BE0200','BE6100','BCBE00','5DBE00','00BE02','00BE61','00BCBE','005DBE','0200BE','6100BE',\n 'A0009E','A0004E','A00200','A05200','9EA000','4EA000','00A002','00A052','009EA0','004EA0','0200A0','5200A0'\n ];\n _.shuffle(colorCode)\n var length = colorCode.length;\n var index = Math.floor( Math.random() * length );\n return colorCode[index];\n }",
"getRandomColor() {\n return [Math.random()*this.particleColorMult[0]+this.particleColorMin[0],\n Math.random()*this.particleColorMult[1]+this.particleColorMin[1],\n Math.random()*this.particleColorMult[2]+this.particleColorMin[2], 1.0];\n }",
"static randomFlSeed(seed, min, max) {\r\n seedrandom(seed, { global: true });\r\n let decimalPlaces = Math.pow(10 ,2); //Sets decimal place to 2\r\n let randomNo = Math.random() * (max - min) + min;\r\n return Math.floor(randomNo * decimalPlaces) / decimalPlaces;\r\n }",
"function gen_random(){\r\n\treturn 0.3\r\n}",
"function rand(){\n return Math.random()-0.5;\n }",
"function generateRandomColorValues () {\n r = Math.round(Math.random() * (256));\n g = Math.round(Math.random() * (256));\n b = Math.round(Math.random() * (256));\n}",
"function randomNotReally() {\n var x = Math.sin(seed++);\n return x - Math.floor(x);\n}",
"function random()\n {\n m_z = (36969 * (m_z & 65535) + (m_z >> 16)) & mask;\n m_w = (18000 * (m_w & 65535) + (m_w >> 16)) & mask;\n var result = ((m_z << 16) + m_w) & mask;\n result /= 4294967296;\n return result + 0.5;\n }",
"function randomInitialize() \r\n{\r\n\tradius = ((Math.random() * (maxRadius - minRadius)) + minRadius);\r\n\tcenter_x_pos = (Math.random() * ((maxCanvasWidth - radius) - (minCanvasWidth + radius)) + (minCanvasWidth + radius)) ;\r\n\tcenter_y_pos = (Math.random() * ((maxCanvasHeight - radius) - (minCanvasHeight + radius)) + (minCanvasHeight + radius)) ;\r\n\tcolour = colourArr[Math.round(Math.random() * colourArr.length)];\r\n\tdx = Math.round((Math.random()-.5)*dx);\t\t\t//\t-.5 to change value to +ve or -ve \t&\t*(2*dx) to speed it up\r\n\tdy = Math.round((Math.random()-.5)*dy);\t\t\t//\t-.5 to change value to +ve or -ve \t&\t*(2*dx) to speed it up\r\n\tif (dx === 0) \r\n\t{\r\n\t\tdx = 10;\r\n\t}\r\n\tif (dy === 0) \r\n\t{\r\n\t\tdy = 10;\r\n\t}\r\n}",
"function pseudoRandom(seed){\n return (Math.pow(seed, 2) % 50515093);\n}"
]
| [
"0.6522048",
"0.6380164",
"0.6356211",
"0.6312801",
"0.6273608",
"0.6235491",
"0.61811876",
"0.6104483",
"0.60932875",
"0.60890627",
"0.6079582",
"0.607377",
"0.6056277",
"0.6053681",
"0.6040202",
"0.59780675",
"0.5958687",
"0.59291494",
"0.59094006",
"0.5903984",
"0.5903626",
"0.5884096",
"0.5863877",
"0.58556354",
"0.5846795",
"0.5827381",
"0.581929",
"0.5811834",
"0.5811679",
"0.579844"
]
| 0.6948111 | 0 |
Find student by name and english within (min,max) | function find()
{
var str = prompt("Tìm theo thên sinh viên: ");
var min = parseFloat(prompt("Min Điểm Anh Văn: "));
var max = parseFloat(prompt("Max Điểm Anh Văn: "));
var found = [];
for(var i=0; i<list.length; i++)
{
var logic = list[i].name.includes(str) && (min <= list[i].english) && (list[i].english <= max);
//var logic = (list[i].name == name && min<= list[i].english && list[i].english <=max);
if (logic)
{
found.push(list[i]);
}
}
if(!found.length)
{
console.log("Không tìm thấy !");
return;
}
console.log(`Các sinh viên có tên '${name}' mà điểm tiếng Anh nằm trong khoảng (${min}, ${max})`);
console.table(found);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findBestStudent(sortA,h){\n //read each object inside of Array.\n var x;\n var txt = \"\";\n var arrayBestStudent;\n for (i=0; i < sortA.length;i++){\n var alu = sortA[i];\n for (x in alu) {\n if(alu.grade >= h){\n txt += alu[x] + \", \";\n }\n }\n txt=txt+\"<br>\";\n document.getElementById(\"bestStudent\").innerHTML = txt;\n }\n }",
"getStudentByCourse(courseName) {\n let st = new Set()\n for (let s of this.stumap.values()) {\n s.courses.forEach(courses => {\n courses.forEach(name => {\n if (courseName == name) {\n st.add(s);\n }\n });\n });\n }\n return st\n }",
"function nameSearch() {\r\n searchName = myInput.value.toLowerCase();\r\n listStudent = [];\r\n\r\n // Conditional to check for \"no results\" cases\r\n\r\n if (searchName.length > 0 && listStudent.length === 0) {\r\n listStudent.length = 0;\r\n document.querySelector(\r\n \".student-list\"\r\n ).innerHTML = `<li class=\"student-item cf\"><div><h3> Sorry, no matches </h3></div></li>`;\r\n addPagination(listStudent);\r\n }\r\n\r\n // Loop to check if input corresponds to a student name from the list.\r\n // Could have been done with a for loop or other method like includes, or searching of index\r\n\r\n Array.from(list).forEach(function (student) {\r\n if (\r\n student.name.first.toLowerCase().match(searchName) ||\r\n student.name.last.toLowerCase().match(searchName)\r\n ) {\r\n listStudent.push(student);\r\n showPage(listStudent, 1);\r\n }\r\n });\r\n addPagination(listStudent);\r\n }",
"function findWorstStudent(sortA,lgra){\n //read each object inside of Array.\n var x;\n var txt = \"\";\n var arrayBestStudent;\n for (i=0; i < sortA.length;i++){\n var alu = sortA[i];\n for (x in alu) {\n if(alu.grade <= lgra){\n txt += alu[x] + \", \";\n }\n }\n txt=txt+\"<br>\";\n document.getElementById(\"worstStudent\").innerHTML = txt+\"<br>\";\n }\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 highestScore(studentObj) {\n let highScore = studentObj[0].score;\n let student;\n for (let i = 1; i < studentObj.length; i += 1) {\n if (studentObj[i].score > highScore) {\n highScore = studentObj[i].score;\n const splitName = studentObj[i].name.split(' ');\n const initials = splitName[0][0] + splitName[1][0];\n student = initials + studentObj[i].id;\n }\n }\n return student;\n}",
"examStudent(gid) {\n let s = this.getStudent(gid);\n let st = new Set()\n s.courses.forEach(course => {\n course.forEach(name => {\n for (let c of this.crseMap.values())\n if (c.name == name) st.add(c);\n });\n\n });\n\n return st\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 student(fullName, studies, city, markAv){\r\n this.fullName = fullName;\r\n this.studies= studies;\r\n this.city = city;\r\n this.markAv = markAv;\r\n}",
"function nameAndBestSubjectInequalities(arrObj){\r\n newArr = [];\r\n for(var i= 0; i< arrObj.length; i++){\r\n classPlusScores = arrObj[i].classes; //Object!!\r\n var mathScore = classPlusScores['math'];\r\n var scienceScore = classPlusScores['science'];\r\n var socialStudiesScore = classPlusScores['socialStudies'];\r\n if(mathScore >= scienceScore && mathScore>= socialStudiesScore){\r\n newArr.push([arrObj[i].name, 'math']);\r\n }\r\n if(scienceScore>= mathScore && scienceScore >= socialStudiesScore){\r\n newArr.push([arrObj[i].name, 'science']);\r\n }\r\n if(socialStudiesScore>= mathScore && socialStudiesScore>= scienceScore){\r\n newArr.push([arrObj[i].name, 'socialStudies']);\r\n } \r\n }\r\n return newArr\r\n }",
"function searchWithName() {\n\t\t//console.log('Search student...');\n\n\t\t// The request parameters\n\t\tvar url = './student';\n\t\tvar fullname = $('fullname').value;\n\t\tvar params = 'fullname=' + fullname;\n\t\tvar req = JSON.stringify({});\n\t\t//alert(params);\n\t\t// display loading message\n\t\t//showLoadingMessage('Searching for student' + fullname + '...'); \n\n\t\tajax('GET', url + '?' + params, req,\n\t\t\t\t// successful callback\n\t\t\t\tfunction (res) {\n\t\t\tvar students = JSON.parse(res);\n\t\t\t//alert(students);\n\t\t\tif (!students || students.length === 0) {\n\t\t\t\tshowWarningMessage('No student' + fullname + ' found.');\n\t\t\t} else {\n\t\t\t\tlistStudents(students);\n\t\t\t}\n\t\t},\n\t\t// failed callback\n\t\tfunction () {\n\t\t\tshowErrorMessage('Cannot load student ' + fullname + '.');\n\t\t}\n\t\t);\n\t}",
"function quesIdentifiesStudent(ques) \n { \n if (ques.indexOf('first') != -1)\n {\n return true;\n }\n else if (ques.indexOf('last') != -1)\n {\n return true;\n }\n else if (ques.indexOf('name') != -1)\n {\n return true;\n }\n \n else if (ques == 'id')\n {\n return true;\n }\n \n var id_index = ques.indexOf('id');\n if (id_index != -1)\n {\n if (id_index > 0)\n {\n if (ques[id_index-1] == ' ')\n {\n // e.g. \"student id\"\n return true;\n }\n }\n } \n else if (ques.indexOf('id:') != -1)\n {\n // e.g. student id:\n return true;\n }\n else if (ques.indexOf('identity') != -1)\n {\n return true;\n }\n else if (ques.indexOf('identifier') != -1)\n {\n return true;\n }\n else if (ques.indexOf('class') != -1)\n {\n return true;\n }\n else if (ques.indexOf('section') != -1)\n {\n return true;\n }\n else if (ques.indexOf('period') != -1)\n {\n return true;\n }\n else if (ques.indexOf('room') != -1)\n {\n return true;\n }\n else if (ques.indexOf('student') != -1)\n {\n return true;\n }\n else if (ques.indexOf('teacher') != -1)\n {\n return true;\n }\n else if (ques.indexOf('email') != -1)\n {\n return true;\n }\n else if (ques.indexOf('e-mail') != -1)\n {\n return true;\n }\n \n // spanish\n else if (ques.indexOf('correo') != -1)\n {\n return true;\n }\n \n return false;\n }",
"function nameAndBestSubjectEfficient(arrObj){\r\n newArr = [];\r\n for(var i= 0; i< arrObj.length; i++){\r\n classPlusScores = arrObj[i].classes; //Object!!\r\n miniList = [];\r\n var maximum = 0;\r\n var bestSubject;\r\n for (var prop1 in classPlusScores) {\r\n if(classPlusScores[prop1]>= maximum){\r\n maximum = classPlusScores[prop1];\r\n bestSubject = prop1;\r\n }\r\n }\r\n newArr.push([arrObj[i].name, bestSubject]);\r\n }\r\n return newArr;\r\n }",
"function nameAndBestSubjectWOClassNames(arrObj){\r\n newArr = [];\r\n for(var i= 0; i< arrObj.length; i++){\r\n classPlusScores = arrObj[i].classes; //Object!!\r\n miniList = [];\r\n for (var prop1 in classPlusScores) {\r\n miniList.push(classPlusScores[prop1]);\r\n } \r\n var maximum = 0; \r\n for(var j = 0; j< miniList.length; j++){\r\n if(miniList[j]>= maximum){\r\n maximum = miniList[j];\r\n }\r\n }\r\n for (var prop1 in classPlusScores) {\r\n if(maximum === classPlusScores[prop1]){\r\n var bestSubject= prop1;\r\n } \r\n } \r\n newArr.push([arrObj[i].name, bestSubject]);\r\n }\r\n return newArr\r\n }",
"function createFilterFor(query) {\n\n // var lowercaseQuery = angular.lowercase(query); //for english only\n return function filterFn(student) {\n return (student.name.indexOf(query) != -1) ||\n (student.schoolid.indexOf(query) != -1);\n };\n\n }",
"function search() {\n // Retrieves the value in the search text <input> tag\n // For loop to search through all students names and emails for a match to student text <input> entry\n // If a match is found it is added to the visibleStudents[] array \n let entry = studentSearchInput.value;\n for (let i = 0; i < students.length; i++) {\n let studentName = students[i].querySelector('div h3').textContent;\n let studentEmail = students[i].querySelector('.email').textContent;\n\n if (studentName.indexOf(entry) >= 0 || studentEmail.indexOf(entry) >= 0) {\n visibleStudents.push(i);\n }\n }\n}",
"function contain(value, min, max) {\n if (value < min) {\n return min;\n } else if (value > max) {\n return max;\n } else {\n return value;\n }\n }",
"function aboveAverageStudents (students) {\n var rata =(students.score)\n for( i=0 ; i>rata ; i++){\n console.log(i)\n }\n if( rata < students.score ){\n return students\n }else{\n return {}\n }\n}",
"static getStudentByProperties(propertiesName, value, getOption) {\n\t\tif (value === undefined) {\n\t\t\treturn console.log(new Error('The properties name of Student is empty!'));\n\t\t}\n\n\t\tlet indexStudentsSearch = new Array();\n\t\tfor (let i = 0; i < students.length; i++) {\n\t\t\tlet student = this.getStudentByIndex(i);\n\t\t\tif (student[propertiesName] !== undefined) {\n\t\t\t\tlet propertiesValue = student[propertiesName];\n\t\t\t\tif (typeof value == 'string' || typeof propertiesValue == 'string') {\n\t\t\t\t\tpropertiesValue = propertiesValue.toLowerCase();\n\t\t\t\t\tvalue = value.toLowerCase();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (propertiesValue == value) {\n\t\t\t\t\tindexStudentsSearch.push(i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (indexStudentsSearch.length === 0) {\n\t\t\treturn console.log('Not find Student in list!');\n\t\t}\n\t\t\n\t\tswitch(getOption) {\n\t\t\tcase option.first:\n\t\t\t\treturn indexStudentsSearch[0];\n\t\t\t\tbreak;\n\t\t\tcase option.last:\n\t\t\t\treturn indexStudentsSearch.pop();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn indexStudentsSearch;\n\t\t}\n\t}",
"function getBestStudent(grades) {\n\tfor (let grade in grades) {\n\t\tlet length = grades[grade].length;\n\t\tlet result = grades[grade].reduce((accumulator, accelerator) => {\n\t\t\treturn accumulator + accelerator\n\t\t}, 0) / length\n\t\tgrades[grade] = result\n\t}\n\tlet keysSorted = Object.keys(grades).sort((a,b) => {\n\t\treturn grades[a]-grades[b]\n\t});\n\treturn keysSorted[keysSorted.length - 1]\n}",
"function searchStudents() {\n\t\tclearClass();\n\t\t$('.no-student').hide();\n\t\t$('.student-item').hide();\n\t\tcounter = 0;\n\t\tcount = 1;\n\t\tvar input = $('input').val();\n\t\tinput = input.toLowerCase();\n\t\tif(input.length === 0){\n\t\t\tloadFirstPage();\n\t\t\t\n\t\t}else{\n\t\t\tfor(i = 1; i <=studentItemLength; i++){\n\t\t\t\t\n\t\t\t\tvar name = $('.student-item:nth-child('+ i + ') h3').html();\n\t\t\t\tname = name.toLowerCase();\n\t\t\t\tvar email = $('.student-item:nth-child('+ i + ') .email').html();\n\t\t\t\temail = email.toLowerCase();\n\t\t\t\tvar nameOutput = name.indexOf(input);\n\t\t\t\tvar emailOutput = email.indexOf(input);\n\t\t\t\tif((nameOutput !== -1) || (emailOutput !== -1)){\n\t\t\t\t\tvar item = $('.student-item:nth-child(' + i + ')');\n\t\t\t\t\tcreateClass(item);\n\t\t\t\t\tcounter ++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tif(counter === 0){\n\t\t\t\t$('.no-student').show();\n\t\t\t}\n\t\t\tnavBar(counter);\n\t\t\tshowStudents(1);\n\t\t\tclickingPageNumber();\n\t\t\t\n\t\t}\n\t\n}",
"function getStudentsFirstNameBeforeLastName(students) {\n var studentsWhoseFirstNameBeforeLastName = _.filter(students, function(student) {\n return student.firstName.toLowerCase() < student.lastName.toLowerCase();\n });\n return studentsWhoseFirstNameBeforeLastName;\n}",
"function findStudent(studentName) {\n\treturn Array.from(document.querySelectorAll('li i'))\n\t\t.map(el => el.nextSibling.textContent)\n\t\t.filter(student => student.includes(studentName));\n}",
"function searchByName(name) {\n removeAllChild(\"search_display\");\n for (var i = 0; i < lst.length; i++) {\n if (lst[i].name.includes(name))\n addOneSubject(lst[i]);\n }\n}",
"filterByName (role, text) {\n const firstName = role['person']['first_name'].toLowerCase()\n const lastName = role['person']['last_name'].toLowerCase()\n const email = role['person']['email'].toLowerCase()\n const gender = role['person']['gender']\n let searchString = firstName + ' ' + lastName + email\n role['person']['dietary_restrictions'].forEach(restriction => searchString += restriction.toLowerCase())\n if (gender !== null && gender !== '') {\n searchString += gender.toLowerCase()\n }\n role['roles'].forEach((role, index) => {\n const topLevelTag = topLevelTagFromRole(role).toLowerCase()\n searchString += dehumanize(tagFromRole(role))\n if (topLevelTag === 'participant') {\n const attributes = Object.values(role)[0]\n if (attributes['graduation_year'] != null) {\n searchString += attributes['graduation_year'].toString().toLowerCase()\n }\n if (attributes['major'] != null) {\n searchString += attributes['major'].toLowerCase()\n }\n if (attributes['school'] != null) {\n searchString += attributes['school'].toLowerCase()\n }\n attributes['skills'].forEach(skill => searchString += skill.toLowerCase())\n attributes['custom'].forEach(q => searchString += q.toLowerCase())\n }\n })\n return searchString.includes(text.toLowerCase())\n }",
"function students(d,curdate) {\n\tif (d.properties.students) {\n\t\tvar dateloc=d.properties.students.search(niceDate(curdate));\n\t\tif (dateloc > -1) {\n\t\t\treturn Number(d.properties.students.substr(dateloc+5,3));\n\t\t} else { return \"0\";}\n\t} else {return \"0\";}\n}",
"function studentMatchesSearch( student, searchFilter ) {\n str = searchFilter.toLowerCase();\n name = student.querySelector('h3').textContent.toLowerCase();\n email = student.querySelector('.email').textContent.toLowerCase();\n return ( name.indexOf(str) !== -1 || email.indexOf(str) !== -1 );\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}",
"function Search_Index_In_Add_Ary( student_name, student_className )\r\r\n{\r\r\n\tvar count = Student_Add_Ary[0].length;\r\r\n\r\r\n\tfor( i=0; i<count; i++ )\r\r\n\t{\r\r\n\t\tif( Student_Add_Ary[1][i]==student_name && Student_Add_Ary[3][i]==student_className )\r\r\n\t\t\treturn i;\r\r\n\t}\r\r\n\treturn -1;\r\r\n}",
"compareStudents (a, b) {\n let order = 0;\n\n if (a.fields.name_first < b.fields.name_first) {\n order = -1;\n }\n\n if (a.fields.name_first > b.fields.name_first) {\n order = 1;\n }\n\n return order;\n }"
]
| [
"0.53605336",
"0.5236415",
"0.52123845",
"0.52116615",
"0.51960886",
"0.51480806",
"0.5130726",
"0.51219517",
"0.5118432",
"0.5090784",
"0.5089608",
"0.5087221",
"0.4942091",
"0.49295577",
"0.49284372",
"0.4927867",
"0.4925993",
"0.4876195",
"0.48691663",
"0.48641905",
"0.48618457",
"0.4828485",
"0.48246908",
"0.48229373",
"0.4788774",
"0.47829118",
"0.47569862",
"0.4744764",
"0.4744267",
"0.47413945"
]
| 0.6514899 | 0 |
This method serves the purpose of updating any tile detail i.e changing state based on given params data : state object, ids : ids of tiles to be modified, status : status with which tiles should be updated incrementCount : to increment or not increment count | updateTiles(data, ids, status, incrementCount = false) {
//Iterating through provided ids
_.map(ids, function (id) {
//Updating status of given ids with given state
data[id]['status'] = status
//For complete this is will result in additional score point to prevent it we have this condition
if (status != 'complete' && incrementCount) {
data[id]['count']++
}
})
//Handling for complete case
if (status == 'complete' && incrementCount) {
data[ids[1]]['count']++
}
//Updating the state with updated information
this.setState({tileData: data})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"handleClick(id) {\n //taking the state object in another variable\n let data = this.state.tileData;\n //Getting the currently active tiles\n let currentActive = _.filter(data, {'status': 'active'})\n //To prevent actions during delay\n if (currentActive.length < 2) {\n //For matched tiles nothing is to be done\n if (data[id]['status'] != 'complete') {\n //Finding the active tile index/key\n let activeKey = _.findKey(data, {'status': 'active'})\n //Clicking on currently active tile again\n if (activeKey != id) {\n //If this is the second active tile check for next scenario i.e match or not\n if (activeKey != undefined) {\n //For match condition\n if (data[activeKey]['letter'] == data[id]['letter']) {\n this.updateTiles(data, [activeKey, id], 'complete', true)\n } else {\n //For not match condition\n //First show the selected tiles as active\n this.updateTiles(data, [id], 'active', true)\n //Update state after the delay\n setTimeout(() => {\n this.updateTiles(data, [activeKey, id], 'hide')\n }, 1000);\n }\n } else {\n //For first active tile update the state with active\n this.updateTiles(data, [id], 'active', true)\n }\n }\n }\n }\n }",
"changeStatus(params) {\n var index = this.list.map(i => i.id).indexOf(params.id);\n this.list[index].open = params.status;\n ls.updateItem({id : params.id}, {open : params.status});\n this.filterByStatus(this.stats);\n }",
"update(id, status){\n var data = this.state.data;\n var request = this.findReq(id, data)[0];\n request.status = status;\n request.updated_at = new Date();\n data = sorter(this.state.data);\n this.setState({\n \tdata: data\n });\n }",
"function updateTileState(tiles) {\n var collapsed,\n oldCollapsed;\n\n tiles = tiles || /*istanbul ignore next: default value */ [];\n\n oldCollapsed = scope.isCollapsed;\n\n collapsed = tileIsCollapsed(scope.tileId, tiles);\n\n if (oldCollapsed === collapsed) {\n displayModeChanging = false;\n }\n\n scope.isCollapsed = collapsed;\n\n if (collapsed && !tileInitialized) {\n //in some cases the tile-content div is left in a partially collapsed state.\n // this will ensure that the tile is styled corretly and the tile is completely collapsed\n $timeout(function () {\n var contentEl;\n contentEl = el.find('.bb-tile-content');\n contentEl.removeClass('collapsing').addClass('collapse');\n }, 1);\n }\n }",
"function updateStatusData() {\r\n\r\n var requestURL = 'comm/getStatus';\r\n var method = 'POST';\r\n var headers = {\r\n 'Accept': 'application/json',\r\n 'Content-Type': 'application/json'\r\n };\r\n var body = {\r\n all: true\r\n }\r\n\r\n jsonBody = JSON.stringify(body);\r\n\r\n fetch(requestURL, {\r\n headers: headers,\r\n method: method,\r\n body: jsonBody\r\n }).then((response) => {\r\n if (parseInt(response.clone().status) < 400) {\r\n // fetch was successful, store it in the IDB.\r\n response.clone().json().then((result) => {\r\n for(var i in result.zoneStatus){\r\n StatusIDBFuncSet.addData(StatusIDBSettings.tables[0].tableName, result.zoneStatus[i]);\r\n }\r\n }).catch((err) => {\r\n console.log(`[SW] ERROR in status json: ${err}`);\r\n console.log(response.clone().json());\r\n })\r\n } else {\r\n console.log('[SW] Server returned error for /comm/getStaus:', response.clone().status);\r\n }\r\n }).catch((err) => {\r\n console.log('[SW] Failed to get new status for loc: ', loc);\r\n })\r\n}",
"function updateTiles() {\n\t// show hide tiles based on privileges\n\tconst privileges = mainWindow.tempData.privileges;\n\n\t// clear tile list\n\t$(\"#tileList\").empty();\n\n\t// show tiles based on privileges\n\tObject.keys(privileges).forEach((module, index) => {\n\t\t// check if user has read permisison\n\t\tif (privileges[module].split(\"\")[1] != 1) {\n\t\t\treturn;\n\t\t}\n\n\t\t// get random color for tile\n\t\tconst color = colors[Math.floor(Math.random() * colors.length)];\n\n\t\ttry {\n\t\t\t// append tile\n\t\t\tconst tile = `\n\t\t<div class=\"card TILE ${module}\" style=\"background-color: ${color}; opacity: 0.8;\" onclick=\"mainWindow.loadRoute('${module.toLowerCase()}')\">\n\t\t\t\t<div class=\"card-body text-center\">\n\t\t\t\t\t\t<h1>${tileInfo[module].title}</h1>\n\t\t\t\t\t\t<i class=\"fa fa-3x ${tileInfo[module].icon}\"></i>\n\t\t\t\t</div>\n\t\t</div>\n\t\t`;\n\n\t\t\t$(\"#tileList\").append(tile);\n\t\t} catch (e) {\n\t\t\treturn;\n\t\t}\n\t});\n\n\t// update right sidebar and calenders\n\tupdateSideBar().catch((e) => {\n\t\tconsole.log(e);\n\t});\n}",
"updatePiece(tileId) {\n if(!this.hasMoved)\n this.hasMoved = true;\n this.currentTile = tileId;\n this.validSpaces(true);\n }",
"function updateStateMaps() {\n // XXX\n }",
"updateColors(data) {\n for (let i = 0; i < data.length; i++) {\n this.map.setFeatureState({\n source: 'pbdb',\n sourceLayer: 'hexgrid',\n id: data[i].hex_id\n }, {\n color: this.colorScale(parseInt(data[i].count))\n })\n }\n }",
"function updateData(data) {\n if (data && !data.error) {\n state.stops[\"id\"+data.id.substring(6)] = data; \n }\n displayData();\n}",
"handleStatusChange(taskId, e, data) {\n const task = _.find(this.state.tasks, {'task_id': taskId})\n const newStatus = data.value\n if (newStatus !== task.status) {\n let newTasks = this.state.tasks.slice()\n let newTask = _.find(newTasks, {'task_id': taskId})\n newTask.status = newStatus\n let filteredTasks = this.filterTasksByWorkspaces(newTasks,\n this.state.selectedWorkspaces);\n let displayTasks = filteredTasks.length > 0 ? filteredTasks : newTasks;\n let newCompletionPercentage = this.calculateCompletionPercentage(displayTasks);\n put(`/tasks/${task.task_id}`, {status: newStatus})\n .then(res => {\n this.setState({\n tasks: newTasks,\n completionPercentage: newCompletionPercentage,\n })\n console.log(`Successfully changed status to ${newStatus} for ${task.name}`)\n })\n .catch(err => console.log(err))\n }\n }",
"function updateState(data) {\n updateVoteFinishArea(data.state);\n}",
"static updateItemMap(type, itemMap, itemIdx, r, c, height, width) {\n const gridWidth = StorageGrid.getData(type).width;\n for (let r1 = r; r1 < r + height; r1 += 1) {\n for (let c1 = c; c1 < c + width; c1 += 1) {\n const mapObj = {};\n if (r1 === r && c1 === c) {\n mapObj.status = TOP;\n mapObj.idx = itemIdx;\n } else {\n mapObj.status = OCCUIPED;\n }\n\n itemMap.set(r1 * gridWidth + c1, mapObj);\n }\n }\n }",
"updateData(state, payload) {\n const { action, index, item } = payload;\n // eslint-disable-next-line object-curly-newline\n const { checkflag, detail, memberid, id } = item;\n if (action === 'create') {\n axios.post('http://localhost:8081/ssm-simple/checklist/create', {\n id,\n checkflag: 0,\n detail,\n memberid,\n }).then(() => {\n state.lists.push(item);\n });\n } else if (action === 'remove') {\n axios.post('http://localhost:8081/ssm-simple/checklist/delete', {\n id,\n }).then(() => {\n state.lists.splice(index, 1);\n });\n } else if (action === 'check') {\n axios.post('http://localhost:8081/ssm-simple/checklist/check', {\n id,\n checkflag,\n }).then(() => {\n state.lists[index].checkflag = checkflag;\n });\n }\n }",
"function changeItemState(itemId, state, errorCounter) {\n\n $.ajax({\n\t \ttype: 'PUT',\n\t \turl: '/api/worklist/items/' + itemId + '/state?participantId=' + participantUUID,\n\t \tdata: state,\n contentType: 'text/plain',\n\t \tsuccess: function(data) {\n\t \t console.log(\"Success is a rare word in our context! But we managed to change the state of an item.\");\n\t \t},\n\t \terror: function(jqXHR, textStatus, errorThrown) {\n errorCounter++;\n }\n\t});\n}",
"function updateTiles() {\n forEachTile(function update(row, col) {\n setTimeout(function () {\n tileColor = jQuery.Color().hsla({\n hue: (tileColor.hue() + (Math.random() * tileMaxHueShift)) % 360,\n saturation: tileMinSaturation + (Math.random() * tileSaturationSpread),\n lightness: tileMinLightness + (Math.random() * tileLightnessSpread),\n alpha: tileOpacity\n });\n\n var currentColor = jQuery.Color($(\"#\" + row + \"-\" + col), \"backgroundColor\");\n\n // when to update the Tiles\n if (currentColor.lightness() < tileLightnessDeadZoneLowerBound() ||\n currentColor.lightness() > tileLightnessDeadZoneUpperBound() ||\n currentColor.lightness() == 1) {\n $(\"#\" + row + \"-\" + col).animate({\n backgroundColor: tileColor\n }, tileFadeDuration);\n }\n }, getTileDelayTime(row, col));\n });\n }",
"setStateInternal(id, value) {\n var obj = id;\n if (! obj.startsWith(this.namespace + '.'))\n obj = this.namespace + '.' + id;\n this.log.info('update state ' + obj + ' with value:' + value);\n currentStateValues[obj] = value;\n }",
"updateClientState(uid, data) {\n this.pendingStates[uid] = data;\n }",
"function updateIssueStatusInJira(TCID, Id){\n\tgetAjaxSetupConnection('POST');\n\n\tvar jsonData = {\n\t\t\"transition\": {\n\t \"id\": Id \n\t }\n\t}\n\n $.ajax({\n\t\turl: base_url + '/rest/api/latest/issue/' + TCID + '/transitions?expand=transitions.fields',\n\t\tdata: JSON.stringify(jsonData),\n\t\tsuccess: function (data, status, xhr) { \n\t\t\tconsole.log(xhr);\n\t\t},\n\t\tasync: false,\n\t\ttype: 'POST',\n\t\terror: function (error) { console.log(error.responseText);}\n\t});\t\t\t\n}",
"update(data={}) {\n this.state = Object.assign(this.state, data);\n\n // notify all the Listeners of updated state\n this.notifyObervers(this.state);\n }",
"function update_board(id){\n\t \tvar t = $('#'+id);\n\t \tfor (var k = parseInt(t.attr('col'))-1; k < parseInt(t.attr('col'))+parseInt(t.attr('sizex'))-1; k++) {\n\t \t\tfor (var j = parseInt(t.attr('row'))-1; j < parseInt(t.attr('row'))+parseInt(t.attr('sizey'))-1; j++) {\n\t \t\t\tboard[k][j].occupied = 1;\n\t \t\t\tboard[k][j].tile = id;\n\t \t\t};\n\t \t};\n\t }",
"updateWorkLogStatus(id, status) {\n const index = dataModel.worklogs.findIndex((logs) => logs._id === id);\n try {\n dataModel.worklogs[index].status = status;\n } catch (err) {\n console.log('couldn\\'t find the object');\n }\n\n }",
"updateData(config) {\r\n this.setState(config);\r\n }",
"async function editMilestoneStatusHandler(id, status) {\n const response = await fetch(`/api/milestones/${id}`, {\n method: 'PUT',\n body: JSON.stringify({\n status\n }),\n headers: {\n 'Content-Type': 'application/json'\n }\n });\n if (response.ok) {\n location.reload();\n } else {\n alert(response.statusText);\n }\n}",
"function statusUpdate(status, custId) {\n\n STATUS = status\n updateStatusCSS();\n detailsUpdate(customerId);\n}",
"updateItemOfCurrentList(id, data) {\n\n return new TotoAPI().fetch('/supermarket/currentList/items/' + id, {\n method: 'PUT',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(data)\n });\n }",
"applyChanges() {\n for (let i = 0; i < this.statusList.length; i++) {\n this.board.updateCell(...this.statusList[i]);\n }\n\n this.statusList = [];\n }",
"function computeCurrentId(id){\n switch(id){\n case \"threeByThree_Tile1\":\n arrayData.currentTile = 0;\n break;\n case \"threeByThree_Tile2\":\n arrayData.currentTile = 1;\n break;\n case \"threeByThree_Tile3\":\n arrayData.currentTile = 2;\n break;\n\n case \"threeByThree_Tile4\":\n arrayData.currentTile = 3;\n break;\n \n case \"threeByThree_Tile5\":\n arrayData.currentTile = 4;\n break;\n \n case \"threeByThree_Tile6\":\n arrayData.currentTile = 5;\n break;\n \n case \"threeByThree_Tile7\":\n arrayData.currentTile = 6;\n break;\n \n case \"threeByThree_Tile8\":\n arrayData.currentTile = 7;\n break;\n \n case \"threeByThree_Tile9\":\n arrayData.currentTile = 8;\n break;\n\n }\n }",
"function updateData() {\n\n const currentAvatarPage = invisible.getAttribute(\"current-avatar-page\");\n const currentAvatarPageToFetch = currentAvatarPage - 1;\n const fetchURL = \"getShopDtoByUserId/\" + currentUserId + \"?page=\" + currentAvatarPageToFetch + \"&size=5\";\n\n fetch(`${fetchURL}`)\n .then(success) // successful response\n .then(handleData)\n .then(activateShopping)\n .catch(error); // error\n\n }",
"updateIndex(){\n this.props.updateIndex(this.props.currentState.index + 10);\n this.props.removeAllStoriesFromSelection(true); // This is done to ensure that there are no selected stories when we go to the next set of stories\n this.props.toggleLoader(true); // Show the loader again, since the new set of stories will be fetched from the api\n this.props.setLoaderText('Fetching stories');\n }"
]
| [
"0.6142494",
"0.57734376",
"0.5750621",
"0.57186747",
"0.5547951",
"0.5534367",
"0.55251896",
"0.5505066",
"0.5447544",
"0.5415714",
"0.5391554",
"0.5390321",
"0.53763944",
"0.5337144",
"0.5305733",
"0.53017634",
"0.5288924",
"0.52837616",
"0.5274543",
"0.5256012",
"0.5255083",
"0.52366173",
"0.52255845",
"0.521592",
"0.52099764",
"0.5208341",
"0.51814044",
"0.5178459",
"0.51762646",
"0.51729923"
]
| 0.84763926 | 0 |
This method is to handle the click of tiles. Based on the state of game, the new state will be generated here. | handleClick(id) {
//taking the state object in another variable
let data = this.state.tileData;
//Getting the currently active tiles
let currentActive = _.filter(data, {'status': 'active'})
//To prevent actions during delay
if (currentActive.length < 2) {
//For matched tiles nothing is to be done
if (data[id]['status'] != 'complete') {
//Finding the active tile index/key
let activeKey = _.findKey(data, {'status': 'active'})
//Clicking on currently active tile again
if (activeKey != id) {
//If this is the second active tile check for next scenario i.e match or not
if (activeKey != undefined) {
//For match condition
if (data[activeKey]['letter'] == data[id]['letter']) {
this.updateTiles(data, [activeKey, id], 'complete', true)
} else {
//For not match condition
//First show the selected tiles as active
this.updateTiles(data, [id], 'active', true)
//Update state after the delay
setTimeout(() => {
this.updateTiles(data, [activeKey, id], 'hide')
}, 1000);
}
} else {
//For first active tile update the state with active
this.updateTiles(data, [id], 'active', true)
}
}
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function tileClick() {\n\tvar position = parseInt(this.dataset.position);\n\tif (board.isValidMove(position)) {\n\t\tboard.placeTile(current, position);\n\t\tthis.getElementsByClassName('tile-image')[0].src = current.img;\n\t\tif (board.isWinningState(current, position)) {\n\t\t\tend(current);\n\t\t} else if (board.isTie()) {\n\t\t\tend(current, true);\n\t\t} else {\n\t\t\tswitchCurrentPlayer();\n\t\t\tif (current.constructor.name === 'ComputerPlayer') {\n\t\t\t\tcomputerMove();\n\t\t\t}\n\t\t}\n\t}\n}",
"function tileClick() {\n\tmoveOneTile(this);\n}",
"handleTileClick(position) {\n const { gameState } = this.state;\n const openTiles = this.getNumberOfOpenTiles();\n if (openTiles != 2) { // disables clicks when two tiles are open\n this.channel.push(\"tileClicked\", {position: position}).receive(\"ok\", response => {\n this.setState({\n gameState: response.game.gameState,\n clicks: response.game.clicks\n }, this.showTileBeforeHiding);\n });\n }\n }",
"function onMouseDown(e) {\n \n // Get the mouse position\n var pos = getMousePos(mycanvas, e);\n \n // Start dragging\n if (!drag) {\n \n // Get the tile under the mouse\n mt = getMouseTile(pos);\n \n if (mt.valid) {\n \n // Valid tile\n var swapped = false;\n if (level.selectedtile.selected) {\n \n if (mt.x == level.selectedtile.column && mt.y == level.selectedtile.row) {\n // Same tile selected, deselect\n \n level.selectedtile.selected = false;\n drag = true;\n return;\n } else if (canSwap(mt.x, mt.y, level.selectedtile.column, level.selectedtile.row)){\n // Tiles can be swapped, swap the tiles\n \n mouseSwap(mt.x, mt.y, level.selectedtile.column, level.selectedtile.row);\n swapped = true;\n }\n }\n \n if (!swapped) {\n \n // Set the new selected tile\n level.selectedtile.column = mt.x;\n level.selectedtile.row = mt.y;\n level.selectedtile.selected = true;\n }\n } else {\n \n // Invalid tile\n level.selectedtile.selected = false;\n }\n \n // Start dragging\n drag = true;\n }\n \n // Check if a button was clicked\n// for (var i=0; i<buttons.length; i++) {\n// if (pos.x >= buttons[i].x && pos.x < buttons[i].x+buttons[i].width &&\n// pos.y >= buttons[i].y && pos.y < buttons[i].y+buttons[i].height) {\n// \n// // Button i was clicked\n// if (i == 0) {\n// // New Game\n// newGame();\n// } else if (i == 1) {\n// // Show Moves\n// showmoves = !showmoves;\n// buttons[i].text = (showmoves?\"Hide\":\"Show\") + \" Moves\";\n// } else if (i == 2) {\n// // AI Bot\n// aibot = !aibot;\n// buttons[i].text = (aibot?\"Disable\":\"Enable\") + \" AI Bot\";\n// }\n// }\n// }\n }",
"function openTile(chosenTile){\n if ($(document.getElementById(chosenTile)).hasClass('clicked')) {\n return\n }\n else{\n if ($(document.getElementById(chosenTile)).hasClass('hidden')) {\n $(document.getElementById(chosenTile)).removeClass('hidden'); \n $(document.getElementById(chosenTile)).addClass('clicked');\n }\n }\n selectionCount++;\n storeTileContent(chosenTile);\n }",
"handleClick(i) {\n\n // set the clicky tile values and score\n let values = this.state.clickyValues;\n let score = this.state.score;\n\n // if the clicky tile that was clicked has been clicked before...\n // its game over\n if (values[i].clicked === true) {\n\n alert(\"You Lose!\");\n\n // after the losing the game, the score is reset...\n // as well as the \"clicked\" boolean on every tile\n score = 0;\n for (let j = 0; j < values.length; j++) {\n values[j].clicked = false;\n }\n\n // implement the reset values to the body's state\n this.setState({\n values: values,\n score: score\n });\n\n return;\n\n }\n\n // if the clicky tile that was clicked had not been...\n // clicked already, mark it as clicked, and up the score\n values[i].clicked = true;\n score++;\n\n // if the score is 12 or greater, that means...\n // every tile has been clicked once, and no tiles have been clicked twice.\n // this is the game's win condition\n if (score >= 12) {\n\n alert(\"You Win!\");\n\n // after the winning the game, the score is reset...\n // as well as the \"clicked\" boolean on every tile\n score = 0;\n for (let j = 0; j < values.length; j++) {\n values[j].clicked = false;\n }\n\n // implement the reset values to the body's state\n this.setState({\n values: values,\n score: score\n });\n\n return;\n\n }\n\n // If the game has not been won or lost yet...\n // we must shuffle the tiles after a tile has been clicked\n\n // Create a handful of values for a shuffe procedure \n let currentIndex = values.length, temporaryValue, randomIndex;\n\n // While there remain elements to shuffle...\n while (0 !== currentIndex) {\n\n // Pick a remaining element...\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n\n // And swap it with the current element.\n temporaryValue = values[currentIndex];\n values[currentIndex] = values[randomIndex];\n values[randomIndex] = temporaryValue;\n }\n\n // implement the shuffled values to the body's state\n this.setState({\n values: values,\n score: score\n });\n\n\n }",
"function tileClicked(e){\n // check if the tile can move to the empty spot\n // if the tile can move, move the tile to the empty spot\n\n\tvar curr_tile = e.target; // setting the curr_tile to the tile that has been clicked\n\t\n\tvar curr_row = curr_tile.row; // setting the curr_row to the row of the tile clicked\n\tvar curr_col = curr_tile.col; //setting the curr_col to the column of the tile clicked\n\t\n\t/*\n\t* check the tile in the row before the tile clicked , if the tile from the row before it is the empty one , we move the tile \n\t* to the position of the empty tile, and set the empty tile to the position where the curr_tile was\n\t*/\n\tif( ! (curr_row - 1 < 0 )) // checking if the row number is valid and didnt exceed the boundaries\n\t{\n\t\tif(tile_array[curr_row-1][curr_col] == 0) //check if the item before the tile clicked is the empty tile\n\t\t{\n\t\t\tvar temp1 = tile_array[curr_row][curr_col]; // save the div currently clicked into the temp variable\n\t\t\ttile_array[curr_row][curr_col] = 0; // set the current tile position to the empty tile\n\t\t\tcurr_tile.row = curr_row - 1; // setting the tile new row\n\t\t\tcurr_tile.col = curr_col; // setting the tile new col\n\t\t\ttile_array[curr_tile.row][curr_tile.col] = temp1; //saving the div in the new position\n\t\t\tcurr_tile.style.left = curr_tile.col * _tile_width+\"px\"; //setting the left position for the tile \n\t\t\tcurr_tile.style.top = curr_tile.row * _tile_height+\"px\"; //setting the top position for the tile\n\t\t\t\n\t\t}\n\t}\n\t\n\n\t/*\n\t* check the tile in the row after the tile clicked , if the tile from the row after it is the empty one , we move the tile \n\t* to the position of the empty tile, and set the empty tile to the position where the curr_tile was\n\t*/\n\t\n\tif(!(curr_row + 1 > _num_rows - 1)) // checking if the row number is valid and didnt exceed the boundaries\n\t{\n\t\tif(tile_array[curr_row + 1][curr_col] == 0) //check if the item after the tile clicked is the empty tile\n\t\t{\n\t\t\t\tvar temp2 = tile_array[curr_row][curr_col]; // save the div currently clicked into the temp variable\n\t\t\t\ttile_array[curr_row][curr_col] = 0; // set the current tile position to the empty tile\n\t\t\t\tcurr_tile.row = curr_row + 1; // setting the tile new row\n\t\t\t\tcurr_tile.col = curr_col; // setting the tile new col\n\t\t\t\ttile_array[curr_tile.row][curr_tile.col] = temp2; //saving the div in the new position\n\t\t\t\tcurr_tile.style.left = curr_tile.col * _tile_width+\"px\"; //setting the left position for the tile \n\t\t\t\tcurr_tile.style.top = curr_tile.row * _tile_height+\"px\"; //setting the top position for the tile\n\t\t}\n\t\n\t}\n\t\n\t\t/*\n\t\t* check the tile in the column before the tile clicked , if the tile from the row before it is the empty one \n\t\t* , we move the tile to the position of the empty tile, and set the empty tile to the position where the curr_tile was\n\t\t*/\n\n\t\tif(!(curr_col - 1 < 0))\n\t\t{\n\t\t\tif(tile_array[curr_row][curr_col-1] == 0)\n\t\t\t{\n\t\t\t\tvar temp3 = tile_array[curr_row][curr_col];\n\t\t\t\ttile_array[curr_row][curr_col] = 0;\n\t\t\t\tcurr_tile.col = curr_col - 1;\n\t\t\t\tcurr_tile.row = curr_row;\n\t\t\t\ttile_array[curr_tile.row][curr_tile.col] = temp3;\n\t\t\t\tcurr_tile.style.left = curr_tile.col * _tile_width+\"px\";\n\t\t\t\tcurr_tile.style.top = curr_tile.row * _tile_height+\"px\";\n\t\t\t}\n\t\t}\n\t\t\n\t\n\t\t\tif(!(curr_col + 1 > _num_cols))\n\t\t\t{\n\t\t\t\tif(tile_array[curr_row][curr_col+1] == 0)\n\t\t\t\t{\n\t\t\t\t\tvar temp4 = tile_array[curr_row][curr_col];\n\t\t\t\t\ttile_array[curr_row][curr_col] = 0;\n\t\t\t\t\tcurr_tile.col = curr_col+1;\n\t\t\t\t\tcurr_tile.row = curr_row;\n\t\t\t\t\ttile_array[curr_tile.row][curr_tile.col] = temp4;\n\t\t\t\t\tcurr_tile.style.left = curr_tile.col * _tile_width+\"px\";\n\t\t\t\t\tcurr_tile.style.top = curr_tile.row * _tile_height+\"px\";\n\t\t\t\t}\n\t\t\t}\n\t\n\t\n}",
"clickTile(row, col, button){\n //If left mouse button\n if (button == 0){\n if(this.grid[row][col].isBomb && !this.grid[row][col].isFlagged){\n this.grid[row][col].isTrigger = true;\n this.gameOver = true;\n this.drawSmiley(this.smileyCtx, 'dead')\n }\n this.revealTile(row, col);\n\n } else if(button == 2 && !this.grid[row][col].isRevealed){\n this.flagTile(row,col);\n\n }\n if (this.gameWon()){\n this.gameOver = true;\n this.draw();\n this.drawSmiley(this.smileyCtx, 'shades');\n return true;\n }\n this.draw();\n this.drawBombsLeft();\n return false;\n }",
"function handleClick() {\n let indexOfTheTileClicked = parseInt(this.id);\n\n console.log({ indexOfTheTileClicked, indexOfBlankTile })\n console.log({\n \"+1\": indexOfTheTileClicked + 1,\n \"-1\": indexOfTheTileClicked - 1,\n \"+4\": indexOfTheTileClicked + 4,\n \"-4\": indexOfTheTileClicked - 4\n })\n\n function swapTiles() {\n // Swap the blank tile with the selected tile\n console.log(\"before\", tiles)\n let tileClicked = tiles[indexOfTheTileClicked]\n tiles[indexOfTheTileClicked] = tiles[indexOfBlankTile];\n tiles[indexOfBlankTile] = tileClicked;\n indexOfBlankTile = indexOfTheTileClicked;\n console.log(\"after\", tiles)\n // Redraw the board based off the updated array\n drawTiles();\n }\n\n // If the tile clicked is either 1 or 4 spots away from the blank tile in the array, swap tiles\n if ((indexOfTheTileClicked % 4) == 1 ||\n (indexOfTheTileClicked % 4) == 2) {\n console.log('in first if')\n if (indexOfTheTileClicked - 1 == indexOfBlankTile ||\n indexOfTheTileClicked + 1 == indexOfBlankTile ||\n indexOfTheTileClicked - 4 == indexOfBlankTile ||\n indexOfTheTileClicked + 4 == indexOfBlankTile) {\n\n swapTiles();\n }\n }\n if (((indexOfTheTileClicked + 1) % 4) == 0) {\n console.log('in first if')\n if (indexOfTheTileClicked - 1 == indexOfBlankTile ||\n indexOfTheTileClicked - 4 == indexOfBlankTile ||\n indexOfTheTileClicked + 4 == indexOfBlankTile) {\n\n\n swapTiles();\n }\n }\n if ((indexOfTheTileClicked % 4) == 0) {\n console.log('in second if')\n if (indexOfTheTileClicked + 1 == indexOfBlankTile ||\n indexOfTheTileClicked + 4 == indexOfBlankTile ||\n indexOfTheTileClicked - 4 == indexOfBlankTile) {\n\n swapTiles();\n }\n }\n}",
"isClicked({ id, value, moves }) {\n let Tiles = this.state.Tiles\n let Clicks = this.state.Clicks\n for (let j = 0; j < moves.length; j++) { //loops through random moves \n if (Tiles[moves[j]].value === 0) { //if 0 is in random moves\n Tiles[id].value = Tiles[moves[j]].value // swap tile values\n Tiles[moves[j]].value = value\n Clicks++\n this.checkWin()\n }\n }\n this.setState({\n Tiles,\n Clicks\n })\n }",
"function onMouseDown(e) {\n // Get the mouse position\n var pos = getMousePos(canvas, e);\n \n // Start dragging\n if (!drag) {\n // Get the tile under the mouse\n mt = getMouseTile(pos);\n \n if (mt.valid) {\n // Valid tile\n var swapped = false;\n if (level.selectedtile.selected) {\n if (mt.x == level.selectedtile.column && mt.y == level.selectedtile.row) {\n // Same tile selected, deselect\n level.selectedtile.selected = false;\n drag = true;\n return;\n } else if (canSwap(mt.x, mt.y, level.selectedtile.column, level.selectedtile.row)){\n // Tiles can be swapped, swap the tiles\n mouseSwap(mt.x, mt.y, level.selectedtile.column, level.selectedtile.row);\n swapped = true;\n }\n }\n \n if (!swapped) {\n // Set the new selected tile\n level.selectedtile.column = mt.x;\n level.selectedtile.row = mt.y;\n level.selectedtile.selected = true;\n }\n } else {\n // Invalid tile\n level.selectedtile.selected = false;\n }\n\n // Start dragging\n drag = true;\n }\n \n // Check if a button was clicked\n for (var i=0; i<buttons.length; i++) {\n if (pos.x >= buttons[i].x && pos.x < buttons[i].x+buttons[i].width &&\n pos.y >= buttons[i].y && pos.y < buttons[i].y+buttons[i].height) {\n \n // Button i was clicked\n if (i == 0) {\n // New Game\n newGame();\n } else if (i == 1) {\n // Show Moves\n showmoves = !showmoves;\n buttons[i].text = (showmoves?\"Hide\":\"Show\") + \" Moves\";\n } else if (i == 2) {\n // AI Bot\n aibot = !aibot;\n buttons[i].text = (aibot?\"Disable\":\"Enable\") + \" AI Bot\";\n }\n }\n }\n }",
"function onMouseDown(e) {\n // Get the mouse position\n var pos = getMousePos(canvas, e);\n \n // Start dragging\n if (!drag) {\n // Get the tile under the mouse\n mt = getMouseTile(pos);\n \n if (mt.valid) {\n // Valid tile\n var swapped = false;\n if (level.selectedtile.selected) {\n if (mt.x == level.selectedtile.column && mt.y == level.selectedtile.row) {\n // Same tile selected, deselect\n level.selectedtile.selected = false;\n drag = true;\n return;\n } else if (canSwap(mt.x, mt.y, level.selectedtile.column, level.selectedtile.row)){\n // Tiles can be swapped, swap the tiles\n mouseSwap(mt.x, mt.y, level.selectedtile.column, level.selectedtile.row);\n swapped = true;\n }\n }\n \n if (!swapped) {\n // Set the new selected tile\n level.selectedtile.column = mt.x;\n level.selectedtile.row = mt.y;\n level.selectedtile.selected = true;\n }\n } else {\n // Invalid tile\n level.selectedtile.selected = false;\n }\n\n // Start dragging\n drag = true;\n }\n \n // Check if a button was clicked\n for (var i=0; i<buttons.length; i++) {\n if (pos.x >= buttons[i].x && pos.x < buttons[i].x+buttons[i].width &&\n pos.y >= buttons[i].y && pos.y < buttons[i].y+buttons[i].height) {\n \n // Button i was clicked\n if (i == 0) {\n // New Game\n newGame();\n } else if (i == 1) {\n // Show Moves\n showmoves = !showmoves;\n buttons[i].text = (showmoves?\"Hide\":\"Show\") + \" Moves\";\n } else if (i == 2) {\n // AI Bot\n aibot = !aibot;\n buttons[i].text = (aibot?\"Disable\":\"Enable\") + \" AI Bot\";\n }\n }\n }\n }",
"function storeState(){\n\tvar tile_1 = CLICKED_TILE_1;\n\tvar tile_2 = CLICKED_TILE_2;\n\tvar pair_tile = new pairTiles(tile_1,tile_2);\n\tstack.push(pair_tile);\n\t//window.alert(\"STORE_STATE Tile1 == \"+pair_tile.tile_1.value.toString()+\" Tile2 == \"+pair_tile.tile_2.value.toString());\n\t//window.alert(\"Coord = \"+pair_tile.tile_1.coord.x+\" , \"+pair_tile.tile_1.coord.y);\n}",
"buttonClick(event, type) {\n let self = this;\n if (self.stateService.statusRunning) { // if running disallow interaction with the board\n return false;\n } else if (type === 'go' && self.stateService.statusStart && self.stateService.statusEnd) { // if it's the go button and there are start and end tiles on the board\n self.stateService.statusRunning = true;\n self.stateService.currentSelectedTile = self.stateService.statusStart; // set the currently selected tile to the start tile\n self.stateService.statusPath.push(self.stateService.currentSelectedTile); // mark x,y as part of solution path\n self.setPathClass(self.stateService.currentSelectedTile);\n self.setClass(document.getElementById('go-button'), 'active');\n self.stateService.startTime = moment().format('HH:mm:ss.SSS');\n self.loopDir();// run calculation\n } else { // if start or end buttons\n let otherType = type === 'start' ? 'end' : 'start';\n let buttonFlag = `${type}ButtonFlag`;\n let otherButtonFlag = `${otherType}ButtonFlag`;\n let otherButton = document.getElementById(otherType + '-button');\n let button = event.srcElement;\n \n if (self.stateService[buttonFlag] === true) { // if already clicked\n self.unsetClass(button, 'active');\n } else { // if not clicked\n self.setClass(button, 'active');\n self.unsetClass(otherButton, 'active');\n self.stateService[otherButtonFlag] = false; // reset the other button\n }\n \n self.stateService.currentSelectedTile = null; // set the currently selected tile\n self.stateService[buttonFlag] = !self.stateService[buttonFlag];\n }\n \n }",
"function mouseClicked(){\n //User clicks to advance the introduction\n if (state === `title`) {\n introState += 1;\n if (introState === 5) {\n state = `simulation`;\n }\n }\n //If user wins, click to restart\n else if (state === `win`) {\n gameStarted = false;\n score = 0;\n timer = 60;\n ant.x = floor(random(0, tileBlue.columns))* tileBlue.size + tileBlue.size/2; //random x position inside the tiles\n ant.y = floor(random(0,tileBlue.rows))* tileBlue.size + tileBlue.size/2; // random y position\n state = 'simulation';\n introState = 0;\n }\n //If user loses, click to restart\n else if (state === `lose`) {\n gameStarted = false;\n score = 0;\n timer = 60;\n ant.x = floor(random(0, tileBlue.columns))* tileBlue.size + tileBlue.size/2; //random x position inside the tiles\n ant.y = floor(random(0,tileBlue.rows))* tileBlue.size + tileBlue.size/2; // random y position\n state = 'title';\n introState = 0;\n }\n}",
"handleClick(tileId) {\n\t\tif (this.state.status[parseInt(tileId)] || this.timerId != null)\n\t\t\treturn;\n\n this.channel.push(\"guess\", { \"tileId\": tileId, \"game\": this.state})\n\t\t\t.receive(\"ok\", this.onUpdate.bind(this))\n\t\t\t.receive(\"completed\", this.onUpdate.bind(this));\n\t}",
"constructor(props) {\n super(props);\n //Generating tiles data and initializing tile properties\n //{0:{letter:'D',status:'hide',count:0},1:{...},....}\n let tilesGenerated = this.getInitialTiles()\n this.state = {tileData: tilesGenerated};\n // Attribution http://ccs.neu.edu/home/ntuck/courses/2019/09/cs5610/notes/05-react/\n this.handleClick = this.handleClick.bind(this);\n }",
"function mouseClicked() {\r\n if (game.state === 0) {\r\n for (i = 0; i < length; i++) {\r\n for (j = 0; j < length; j++) {\r\n if (i === floor(map(mouseX, 0, width, 0, length))) {\r\n if (j === floor(map(mouseY, 0, height, 0, length))) {\r\n if (turn === state.X) {\r\n board[i][j] = state.X;\r\n turn = state.O;\r\n } \r\n else {\r\n if (turn === state.O) {\r\n board[i][j] = state.O;\r\n turn = state.X;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}",
"clickableAction(tile){\r\n if(this.claimTerritoryPhase === true){\r\n this.handleClaimTerritoryPhase(tile);\r\n } else if(this.initialPlacementPhase === true){\r\n this.handleInitialPlacementPhase(tile);\r\n } else if(this.placementPhase === true){\r\n // console.log(\"in placement phase\")\r\n this.handlePlacementPhase(tile);\r\n } else if(this.battlePhase === true){\r\n // console.log(\"in battle phase\")\r\n this.handleBattlePhase(tile);\r\n } else if (this.fortifyPhase === true){\r\n this.handleFortifyPhase(tile);\r\n }\r\n this.updateInfoDisplay();\r\n }",
"click(x, y) {\n\t\tvar click1 = this.state.click1;\n\t\tvar click2 = this.state.click2;\n\n\t\t// If both click states are already occupied, we are in the post-click delay, do nothing\n\t\tif (click1 != null && click2 != null) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t// If this is the first click\n\t\tif (click1 === null) {\n\t\t\t// Update the state to reflect the first click\n\t\t\tvar newState = _.extend(this.state, {turns: this.state.turns + 1, click1: [x,y], click2: null});\n\t\t\tthis.setState(newState);\n\t\t}\n\t\t// If this is the second click\n\t\telse {\n\t\t\t// Compare the values of the two clicked tiles\n\t\t\tvar first_click = this.state.click1;\n\t\t\tvar x1 = Number(first_click[0]);\n\t\t\tvar y1 = Number(first_click[1]);\n\t\t\tvar val1 = String(this.state.values[x1][y1]);\n\t\t\tvar val2 = String(this.state.values[x][y]);\n\t\t\tvar solved = this.state.solved\n\t\t\tvar match = false;\n\n\t\t\t// If match\n\t\t\tif (val1 == val2) {\n\t\t\t\t// Add value of match to solved\n\t\t\t\tsolved.push(val1);\n\n\t\t\t\t// Update the state to reflect the match\n\t\t\t\tvar newState = _.extend(this.state, {solved: solved, turns: this.state.turns + 1, click1: null, click2: null});\n\t\t\t\tthis.setState(newState);\n\t\t\t}\n\t\t\t// If not a match, give the player one second before hiding values again\n\t\t\telse {\n\t\t\t\t// Update the state to reflect the second click\n\t\t\t\tvar newState = _.extend(this.state, {turns: this.state.turns + 1, click2: [x,y]});\n\t\t\t\tthis.setState(newState);\n\n\t\t\t\t// Reset the clicks on screen after 1.5 seconds\n\t\t\t\tvar reset = this.resetClicks.bind(this);\n\t\t\t\tsetTimeout(function(){reset()}, 1500);\n\t\t\t}\n\t\t}\n\t}",
"handleClick(e) {\n console.log(this.props.tile);\n if (e.altKey) {\n this.props.updateGame(this.props.tile, true);\n } else {\n this.props.updateGame(this.props.tile, false);\n }\n }",
"function newGame(e) {\n e.preventDefault()\n const newTiles = createTileData()\n setTiles(newTiles)\n setAlive(true)\n console.log(newTiles)\n }",
"handleClick() {\n if (this.hide)\n return;\n // clicking hide on the toolbar should hide the toolbar\n let r = 0;\n if (dist(mouseX, mouseY, width - this.tileW + (this.tileW / 2), height - (this.tileH / 2)) < this.tileW / 2) {\n this.hide = true;\n this.exportMapToText();\n return;\n }\n // check which tile was clicked\n for (let i = 0; i < this.tiles.length; i++) {\n let x = i * this.tileW + i;\n let y = height - this.tileH;\n let w = this.tileW;\n let h = this.tileH;\n if ((mouseX + r > x) && (mouseX - r < x + w) && (mouseY + r > y) && (mouseY - r < y + h)) {\n // tile to paint with is the clicked tile\n this.selected = this.tiles[i].name;\n return;\n }\n }\n // toolbar element was not clicked, try to draw\n this.handleDrag();\n }",
"function clickEvent(event){\n let id = event.target.id;\n let item = document.getElementById(id);\n if(event.target.className === \"tile\"){\n console.log(`Tile ${id} was clicked`);\n //Updates the board for the 'X' player\n if(counter%2 === 0 && counter !== 9){\n let val = 'x';\n score.querySelector('h2').innerText = ('Player 2 turn.');\n if(id<=2){\n gameBoard[0][id] = val;\n updateBoard(item, val, id);\n counter++;\n }else if(id>2 && id<=5){\n gameBoard[1][id-3] = val;\n updateBoard(item, val, id);\n counter++;\n }else if(id>5 && id<=8){\n gameBoard[2][id-6] = val;\n updateBoard(item, val, id);\n counter++;\n }//Updates the board for the 'o', player\n }else if(counter%2 !== 0 && counter !== 9){\n let val = 'o';\n score.querySelector('h2').innerText = ('Player 1 turn.');\n if(id<=2){\n gameBoard[0][id] = val;\n updateBoard(item, val, id);\n counter++;\n }else if(id>2 && id<=5){\n gameBoard[1][id-3] = val;\n updateBoard(item, val, id);\n counter++;\n }else if(id>5 && id<=8){\n gameBoard[2][id-6] = val;\n updateBoard(item, val, id);\n counter++;\n }\n }//Ends the game if board gets full \n if(counter === 9){\n score.querySelector('h2').innerText = (`Game is a tie no more moves available`);\n checkScore();\n document.querySelector('.menu').style.display = \"block\";\n }\n }else { //If player picks a tile thats already chosen\n score.querySelector('h2').innerText = (`That tile is already selected! ${counter%2 === 0 ? 'Player 1' : 'Player 2'} pick another tile!`);\n }\n}",
"render() {\n\n const {clicked, name, imgUrl} = this.state; // destructuring\n return (\n // creates a 'tile' with a click event that triggers the scoreUpdate function (from App.js)\n <div className=\"tile\" onClick={() => this.props.scoreUpdate(name, clicked)} >\n\n <img src={imgUrl} alt={name} className=\"tile-img\" />\n\n </div>\n );\n }",
"function clicked(e) {\n // If the state is 1 then a score is added\n if(e.target.getAttribute('state') == 1) {\n info.score++;\n // Disable container\n e.target.setAttribute('state', 3);\n }\n // If the state is 2 reduce the lives\n else if(e.target.getAttribute('state') == 2) {\n info.lives--;\n // Disable the container\n e.target.setAttribute('state', 3);\n }\n else {\n //Not clickable\n }\n // Recalculate the level based on the aquired score\n info.level = ((info.score/50) | 0) + 1;\n // If all lives are lost the game finishes\n if(info.lives == 0) {\n updateGraphics();\n setTimeout(gameOver, 100);\n }\n // Update the graphics\n updateGraphics();\n}",
"createGameBoard() {\n function tileClickHandler() {\n let row, col;\n \n row = game.getRowFromTile(this.id);\n col = game.getColFromTile(this.id);\n\n //If is not your turn\n if (!player.getCurrentTurn() || !game) {\n alert('Its not your turn!');\n return;\n }\n\n //In gomoku first move for blacks have to be in the middle tile\n if(game.moves == 0 && !(row == 7 && col == 7)){\n alert('You have to put pawn in the middle of grid!');\n return;\n }\n //In gomoku second move for blacks have to be beyond 5x5 grid in the middle\n else if(game.moves == 2 && (row >= 5 && row <= 9 && col >= 5 && col <= 9)){\n alert('You have to put pawn beyond 5x5 grid in the middle!');\n return;\n }\n //If tile has been already played\n else{\n if ($(this).prop('disabled')) {\n alert('This tile has already been played on!');\n return;\n }\n\n //Update board after player turn.\n game.playTurn(this);\n game.updateBoard(player.getPlayerColor(), row, col, this.id);\n\n //Check if player win\n game.checkWinner();\n \n player.setCurrentTurn(false);\n }\n } \n $('#color').css(\"background-color\", `${player.getPlayerColor()}`);\n game.createTiles(tileClickHandler);\n if(player.getPlayerColor() != \"white\" && this.moves == 0){\n game.setTimer();\n }else{\n $(\".center\").prop(`disabled`, true);\n }\n }",
"function handleClick(target){\r\n\r\n busy = true;\r\n\r\n // lets use the same abbr as previously\r\n r = target.r;\r\n c = target.c;\r\n t = target._animation.name;\r\n\r\n createShards(r,c,t);\r\n\r\n // change levelarray to reflect the coming change (dont remove anything. that will destroy your array logic)\r\n a = r;\r\n while(a > 0){\r\n levelArray[a][c] = levelArray[a - 1][c];\r\n levelArray[a][c].r = levelArray[a][c].r + 1;\r\n a --;\r\n }\r\n\r\n // insert a new tile in the open position (not where user clicked, but on r=0, c=c!)\r\n createTile(0, c, true, true); // also allow special tiles to be used here\r\n gameContainer.addChild(sprite);\r\n levelArray[0][c] = sprite;\r\n\r\n // timer penalty\r\n newcountdown -= 10;\r\n\r\n redraw(); //redraw level according to updated levelarray\r\n\r\n}",
"handleClick(e){\n\t\t// console.log(e.target);\n\t\t// console.log(this.state.board);\n let playedSquare = e.target.innerHTML\n\n let newBoard = this.state.board\n\t\tlet newTurn = this.state.turn\n\n\t\tif (newBoard[playedSquare] !== 0)\n\t\t{\n console.log(\"square: \" + playedSquare + \" played already!!\")\n\t\t\treturn;\n\t\t}\n else {\n\t\t\tnewBoard[playedSquare] = this.state.turn\n\t\t\te.target.innerHTML = newTurn\n }\n\n\t\tif (this.checkForWin())\n\t\t{\n alert(\"GAME FINISHED \" + newTurn + \" WON !!!\")\n return\n\t\t}\n\n\t\tif (newTurn === \"X\")\n\t\t{\n\t\t\t newTurn = \"O\"\n\t\t}\n\t\telse\n\t\t{\n\t\t\t newTurn = \"X\"\n\t\t}\n\n\t\tthis.setState({\n\t board: newBoard,\n\t\t\tturn: newTurn\n\t }) // end of setState\n\n console.log(this.state.board)\n\n }",
"function showTile(e) {\n const target = e.currentTarget;\n \n if (\n stopSelect ||\n target === selectedTile || \n target.className.includes(\" done\")\n ) {\n return;\n }\n //Removes class tile-back when tile has been selected\n target.className = target.className.replace(\"tile-back\", \" \").trim();\n target.className += \" done\";\n \n if (!selectedTile) {\n \n selectedTile = target;\n \n } else if (selectedTile) {\n // On condition that selected tile does not match targeted tile\n if (\n selectedTile.getAttribute(\"data-icon\") !== \n target.getAttribute(\"data-icon\")\n ) {\n //select is to stop\n stopSelect = true;\n\n //Swap target tile with incorrect selected tile\n var TileA = target;\n var TileB = selectedTile;\n \n //Div swap function\n // Function received from Stack Overflow. Referenced in Credits section in ReadMe doc\n $.fn.swap = function (elem) \n {\n elem = elem.jquery ? elem : $(elem);\n return this.each(function () \n {\n $('<span></span>').insertBefore(this).before(elem.before(this)).remove();\n });\n };\n \n $(TileA).swap(TileB);\n \n \n //Increments incorrect matches and adds to scoreboard\n let tilesWrong = document.querySelector(\".incorrect-score\").innerHTML;\n tilesWrong++;\n document.querySelector(\".incorrect-score\").innerHTML = tilesWrong;\n \n // If incorrect tiles are selected, the tiles are covered\n // Class of done is removed/replaced with empty string\n setTimeout(() => {\n selectedTile.className = selectedTile.className.replace(\"done\", \" \").trim() + \" tile-back\";\n target.className = target.className.replace(\"done\", \" \").trim() + \" tile-back\";\n \n selectedTile = null;\n stopSelect = false;\n \n }, 800);\n } else {\n //increments tiles matched\n tilesMatched++;\n selectedTile = null;\n \n //To target Congrats message to user\n let congratsMessage = document.querySelector(\".congrats-score-message\");\n let overlay = document.querySelector(\"#overlay\");\n \n // Content in html for class incorrect-score taken and showing in id final-incorrect-score in congrats message\n $(document).ready(function() {\n $(\"#final-incorrect-score\").html($(\".incorrect-score\").html());\n });\n\n // Content in html for timer taken and showing in id final-time in congrats message\n $(document).ready(function() {\n $(\"#final-time\").html($(\".timer p\").html());\n });\n\n // Content in html for timer and incorrect-score taken and added together showing in id final-overall-score in congrats message\n $(document).ready(function() {\n $(\"#final-overall-score\").html(Number($(\".timer p\").html()) + Number($(\".incorrect-score\").html()));\n });\n \n \n // Game is beaten once 15 matches have been made\n if (tilesMatched === 15) {\n setTimeout(() => \n {\n // Active class then applied to congrats message and overlay to show game is over\n congratsMessage.classList.add(\"active\");\n overlay.classList.add(\"active\");\n \n // To fix bug that caused div of class score-tally to be covered with class tile-back\n $(document).ready(function() {\n $(\".timer\").siblings().children().children().removeClass(\"tile-back\");\n });\n \n }, 250);\n \n return;\n }\n }\n }\n }"
]
| [
"0.7156538",
"0.70725775",
"0.69551",
"0.6948739",
"0.69445723",
"0.689793",
"0.68488145",
"0.6846115",
"0.6833589",
"0.6792237",
"0.6714962",
"0.6714962",
"0.6707241",
"0.6697729",
"0.6674949",
"0.6587558",
"0.65588075",
"0.65304506",
"0.65228873",
"0.6517864",
"0.6499317",
"0.6488733",
"0.6465173",
"0.646376",
"0.64494383",
"0.6430441",
"0.64136344",
"0.6398324",
"0.6383952",
"0.6289198"
]
| 0.7425664 | 0 |
Utility to get the game instruction/reset/restart button based on game status | renderInstructionSection(gameStatus, STATUS) {
if (gameStatus == STATUS.BEGIN) {
return <span className="game-instruction">Click on any tile to begin the game</span>
} else {
let buttonLabel = (gameStatus == STATUS.COMPLETE) ? " Restart Game " : " Reset Game "
let button = <button className="gameplay-btn" onClick={this.reset.bind(this)}>{buttonLabel}</button>
return button
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static getButtonStatusText(challenge) {\n const [CCSTB, CCFB] = [this.Constants.STARTED.BUTTONS, this.Constants.FINISHED.BUTTONS];\n\n const uScore = this.getUser(challenge).score;\n const oScore = this.getOpponent(challenge).score;\n\n let statusTxt = null;\n\n if (ChallengeUtils.isNewChallenge(challenge)) {\n statusTxt = this.Constants.NEW.BUTTONS.TEXT.STATUS.READY;\n } else if (ChallengeUtils.isDeclinedChallenge(challenge)) {\n statusTxt = CCFB.TEXT.STATUS.DECLINED;\n } else if (ChallengeUtils.isFinishedChallenge(challenge)) {\n if (!_.isNil(challenge.winner)) {\n if (uScore !== oScore) {\n statusTxt = uScore > oScore ? CCFB.TEXT.STATUS.WON : CCFB.TEXT.STATUS.LOST;\n } else if (uScore === oScore) {\n statusTxt = CCFB.TEXT.STATUS.TIED;\n }\n }\n }\n\n if (_.isNil(statusTxt)) {\n statusTxt = _.isNil(oScore) ? CCSTB.TEXT.STATUS.THEM : CCSTB.TEXT.STATUS.YOU;\n }\n\n return statusTxt;\n }",
"get Joystick7Button18() {}",
"function buttonSaveCheck() {\n if (game.gameMessageBtn == 0) {\n gameMessageBtnDisabled();\n console.log(game.gameMessageBtn+\" gamemsg btn dis\");\n } else {\n gameMessageBtnEnabled();\n console.log(game.gameMessageBtn+\" gamemsg btn enb\");\n }\n if (game.encounterGenBtn == 0) {\n encounterGenBtnDisabled();\n console.log(game.encounterGenBtn+\" enc btn dis\");\n } else {\n encounterGenBtnEnabled();\n console.log(game.encounterGenBtn+\" enc btn enb\");\n }\n if (game.fightBattleBtn == 0) {\n fightBattleBtnDisabled();\n console.log(game.fightBattleBtn+\" fight btn dis\");\n } else {\n fightBattleBtnEnabled();\n console.log(game.fightBattleBtn+\" fight btn enb\");\n }\n if (game.runBattleBtn == 0) {\n runBattleBtnDisabled();\n console.log(game.runBattleBtn+\" run btn dis\");\n } else {\n runBattleBtnEnabled();\n console.log(game.runBattleBtn+\" run btn enb\");\n }\n}",
"get Joystick7Button19() {}",
"get Joystick7Button14() {}",
"get Joystick7Button12() {}",
"get Joystick7Button17() {}",
"get Joystick7Button11() {}",
"get Joystick7Button8() {}",
"get Joystick8Button14() {}",
"get Joystick6Button14() {}",
"get Joystick6Button19() {}",
"get Joystick6Button12() {}",
"get Joystick6Button18() {}",
"get Joystick8Button18() {}",
"get JoystickButton14() {}",
"get Joystick8Button12() {}",
"get Joystick6Button17() {}",
"chooseButton(){\n let {resetGame} = this.props\n let button = (this.props.reduxState.status.every(s=> s===gStatus.HEALTHY || s===gStatus.THIRSTY ||\n s===gStatus.HUNGRY || s===gStatus.STARVING ||s===gStatus.DEHYDRATED))?\n (<button key={'cont-btn'} data-test=\"continue-button\" onClick={()=> this.props.changePage('gameplay')}>Continue</button>): <button key={'reset-btn'} onClick={resetGame}>Start Over</button>\n return button;\n }",
"get Joystick8Button19() {}",
"get Joystick3Button14() {}",
"get Joystick1Button14() {}",
"get Joystick8Button17() {}",
"get Joystick6Button11() {}",
"get JoystickButton17() {}",
"get Joystick7Button0() {}",
"get JoystickButton18() {}",
"get Joystick7Button13() {}",
"function switchButtonState(text) {\n if (text == \"New Game\") {\n return \"Pause\";\n } else if (text == \"Pause\") {\n return \"Resume\";\n } else if (text == \"Resume\") {\n return \"Pause\";\n } else {\n return \"should never happen\";\n }\n}",
"get JoystickButton12() {}"
]
| [
"0.6413001",
"0.6261465",
"0.62492067",
"0.6249016",
"0.6231306",
"0.62172127",
"0.6195295",
"0.6194462",
"0.61833894",
"0.6174551",
"0.61691624",
"0.61605155",
"0.6137381",
"0.61365545",
"0.61361325",
"0.6135666",
"0.6132148",
"0.61310554",
"0.6119435",
"0.6119396",
"0.6119216",
"0.6114742",
"0.61105853",
"0.6098953",
"0.60953325",
"0.6092486",
"0.6087818",
"0.60871536",
"0.6081267",
"0.6080111"
]
| 0.68386793 | 0 |
Normalizes the tile URL so that tiles repeat across the x axis (horizontally) like the standard Google map tiles. | function getHorizontallyRepeatingTileUrl(coord, zoom, urlfunc) {
var y = coord.y;
var x = coord.x;
// tile range in one direction range is dependent on zoom level
// 0 = 1 tile, 1 = 2 tiles, 2 = 4 tiles, 3 = 8 tiles, etc
var tileRange = 1 << zoom;
// don't repeat across y-axis (vertically)
if (y < 0 || y >= tileRange) {
return null;
}
// repeat across x-axis
if (x < 0 || x >= tileRange) {
x = (x % tileRange + tileRange) % tileRange;
}
return urlfunc({x:x,y:y}, zoom)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getHorizontallyRepeatingTileUrl(coord, zoom, urlfunc) {\n var y = coord.y;\n var x = coord.x;\n \n // tile range in one direction range is dependent on zoom level\n // 0 = 1 tile, 1 = 2 tiles, 2 = 4 tiles, 3 = 8 tiles, etc\n var tileRange = 1 << zoom;\n \n // don't repeat across y-axis (vertically)\n if (y < 0 || y >= tileRange) {\n //return null;\n y = (y % tileRange + tileRange) % tileRange;\n }\n \n // repeat across x-axis\n if (x < 0 || x >= tileRange) {\n // return null;\n x = (x % tileRange + tileRange) % tileRange;\n }\n \n return urlfunc({x:x,y:y}, zoom)\n }",
"function getNormalizedTiles( zoom, x, y ) {\n\t// tile range in one direction range is dependent on zoom level\n\t// 0 = 1 tile, 1 = 2 tiles, 2 = 4 tiles, 3 = 8 tiles, etc\n\ttileRange = get_tile_range( zoom );\n\t// don't repeat across y-axis (vertically)\n\tif (y < 0 || y >= tileRange)\n\t\treturn null;\n\t// repeat across x-axis\n\tif (x < 0 || x >= tileRange)\n\t\tx = (x % tileRange + tileRange) % tileRange;\n\t// Return maps Point\n\treturn new google.maps.Point( x, y );\n}",
"function xyz_getTileURL(bounds) {\n\tvar res = this.map.getResolution();\n\tvar x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));\n\tvar y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));\n\tvar z = this.map.getZoom();\n\t\n\tif (this.map.baseLayer.name == 'Bing Roads' || this.map.baseLayer.name == 'Bing Aerial' || this.map.baseLayer.name == 'Bing Aerial With Labels') {\n\t z = z + 1;\n\t}\n\t\n\tvar limit = Math.pow(2, z);\n\tconsole.log(\"xyz: \"+ this.url + z + \"/\" + x + \"/\" + y + \".\" + this.type);\n\t x = ((x % limit) + limit) % limit;\n\t y = Math.pow(2,z) - y - 1;\n\t return this.url + z + \"/\" + x + \"/\" + y + \".\" + this.type;\n}",
"tileHorizontally(time) {\n const images = [...this.imageUrls];\n\n // Randomize which image is shown first by rotating the array a random\n // number of times.\n randomRotate(images);\n\n const wall = wallGeometry.extents;\n let totalWidth = 0;\n while (totalWidth < wall.w) {\n const image = this.images[images[0]];\n // fit to height\n const scale = wall.h / image.height;\n const x = wall.x + totalWidth;\n // Limit the width to the remaining width on the wall.\n const w = Math.min(\n Math.floor(image.width * scale),\n wall.w - totalWidth /* this is the remaining width */);\n\n const index = this.instances.length;\n this.instances.push({\n url: images[0],\n scale,\n x,\n y: 0,\n });\n debug(\"tile horizontal\", images[0], scale, x, w);\n\n // Make a polygon for the image.\n var poly = new Polygon([\n {x: x, y: 0},\n {x: x + w, y: 0},\n {x: x + w, y: wall.y + wall.h},\n {x: x, y: wall.y + wall.h},\n ]);\n\n this.polygons.push(this.processPolygon(initPolygon(poly, time, index, {\n counted: 1,\n r: 0,\n g: 0,\n b: 0\n })));\n\n // update totalWidth to advance the next image to the right.\n totalWidth += w;\n\n // rotate the images array to cycle through the given images.\n images.push(images.shift());\n }\n }",
"renderTile(tile) {\n const graphics = tile.graphics;\n graphics.clear();\n tile.drawnAtScale = this._xScale.copy();\n\n // we're setting the start of the tile to the current zoom level\n const {tileX, tileWidth} = this.getTilePosAndDimensions(tile.tileData.zoomLevel,\n tile.tileData.tilePos, this.tilesetInfo.tile_size);\n\n const matrix = tile.matrix;\n const trackHeight = this.dimensions[1];\n const matrixDimensions = tile.tileData.shape;\n const colorScale = this.options.colorScale || scaleOrdinal(schemeCategory10);\n const valueToPixels = scaleLinear()\n .domain([0, this.maxAndMin.max])\n .range([0, trackHeight / matrixDimensions[0]]);\n\n for (let i = 0; i < matrix[0].length; i++) {\n const intervals = trackHeight / matrixDimensions[0];\n // calculates placement for a line in each interval; we subtract 1 so we can see the last line clearly\n const linePlacement = (i === matrix[0].length - 1) ?\n (intervals * i) + ((intervals * (i + 1) - (intervals * i))) - 1 :\n (intervals * i) + ((intervals * (i + 1) - (intervals * i)));\n graphics.lineStyle(1, this.colorHexMap[colorScale[i]], 1);\n\n for (let j = 0; j < matrix.length; j++) { // 3070 or something\n const x = this._xScale(tileX + (j * tileWidth / this.tilesetInfo.tile_size));\n const y = linePlacement - valueToPixels(matrix[j][i]);\n this.addSVGInfo(tile, x, y, colorScale[i]);\n // move draw position back to the start at beginning of each line\n (j === 0) ? graphics.moveTo(x, y) : graphics.lineTo(x, y);\n }\n }\n\n }",
"function gridify(x_tiles, t_width, t_height){\n var posX = 0;\n var posY = 0;\n var i = 0;\n\n $(\".loading-logo .tile\").each(function (ind, el) {\n $(this).css(\"background-position\", posX.toString() + \"px \" + posY.toString() + \"px\");\n\n posX -= t_width;\n i++;\n\n if (i == x_tiles) {\n i = 0;\n posX = 0;\n posY -= t_height;\n }\n });\n}",
"function landCustomGetTileUrl(pos, zoom) \n{\n var sl_zoom = slConvertGMapZoomToSLZoom(zoom);\n\n var regions_per_tile_edge = Math.pow(2, sl_zoom - 1);\n \n var x = pos.x * regions_per_tile_edge;\n var y = pos.y * regions_per_tile_edge;\n\n // Adjust Y axis flip location by zoom value, in case the size of the whole\n // world is not divisible by powers-of-two.\n var offset = slGridEdgeSizeInRegions;\n offset -= offset % regions_per_tile_edge;\n y = offset - y;\n\n // Google tiles are named (numbered) based on top-left corner, but ours\n // are named by lower-left corner. Since we flipped in Y, correct the\n // name. JC\n y -= regions_per_tile_edge;\n \n // We name our tiles based on the grid_x, grid_y of the region in the\n // lower-left corner.\n x -= x % regions_per_tile_edge;\n y -= y % regions_per_tile_edge; \n\n // Pick a server\n \n if (((x / regions_per_tile_edge) % 2) == 1)\n var host_name = slTileHost1;\n else\n var host_name = slTileHost2; \n\n // Get image tiles from Amazon S3\n f = host_name + \"/map-\" + sl_zoom + \"-\" + x + \"-\" + y + \"-objects.jpg\";\n return f;\n}",
"function scaleCoords(c, url){\n\t\tvar x = c.x;\n\t\tvar y = c.y;\n\t\tvar w = c.w;\n\t\tvar h = c.h;\n\t\tvar split = url.split('/');\n\t\tvar pctStr = split[split.length-3];\n\t\tif (pctStr != \"full\"){\n\t\t\tvar pct = pctStr.split(':')[1];\n\t\t\tvar scale = 100/pct;\n\t\t\tx *= scale;\n\t\t\ty *= scale;\n\t\t\tw *= scale;\n\t\t\th *= scale;\n\t\t}\n\t\tx = Math.round(x);\n\t\ty = Math.round(y);\n\t\tw = Math.round(w);\n\t\th = Math.round(h);\n\n\t\treturn {'x':x, 'y':y, 'w':w, 'h':h}\n\t}",
"function url(x, y, z) {\n return `https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/${z}/${x}/${y}${devicePixelRatio > 1 ? \"@2x\" : \"\"}?access_token=pk.eyJ1IjoicGF3YXJvIiwiYSI6ImNramI5NDIyMDdqMGYydnBkeGVrcGNydDUifQ.k7aT1uH2iIZEAnUC38-QJw`\n }",
"function getNormalizedCoord(coord, zoom) {\n var y = coord.y;\n var x = coord.x;\n\n // tile range in one direction range is dependent on zoom level\n // 0 = 1 tile, 1 = 2 tiles, 2 = 4 tiles, 3 = 8 tiles, etc\n var tileRange = 2 << zoom;\n\n // don't repeat across y-axis (vertically)\n if (y < 0 || y >= tileRange) {\n return null;\n }\n\n // repeat across x-axis\n if (x < 0 || x >= tileRange) {\n /*x = (x % tileRange + tileRange) % tileRange;*/\n\t\t return null;\n }\n\n return {\n x: x,\n y: y\n };\n\t\t\n\t }",
"function getNormalizedCoord(coord, zoom) {\n var y = coord.y;\n var x = coord.x;\n\n // tile range in one direction range is dependent on zoom level\n // 0 = 1 tile, 1 = 2 tiles, 2 = 4 tiles, 3 = 8 tiles, etc\n var tileRange = 1 << zoom;\n\n // don't repeat across y-axis (vertically)\n if (y < 0 || y >= tileRange) {\n return null;\n }\n\n // repeat across x-axis\n if (x < 0 || x >= tileRange) {\n // x = (x % tileRange + tileRange) % tileRange;\n return null;\n }\n\n return {x: x, y: y};\n}",
"placeholderArtwork(url) {\n if(!url) return \"http://placehold.it/100x100\";\n\n // const regx = /(-large)/;\n // const str = url.replace(regx, \"-crop\");\n\n return url;\n }",
"function getNormalizedCoord(coord, zoom) {\n var y = coord.y;\n var x = coord.x;\n\n // tile range in one direction range is dependent on zoom level\n // 0 = 1 tile, 1 = 2 tiles, 2 = 4 tiles, 3 = 8 tiles, etc\n var tileRange = 1 << zoom;\n\n // don't repeat across y-axis (vertically)\n if (y < 0 || y >= tileRange) {\n return null;\n }\n\n // repeat across x-axis\n if (x < 0 || x >= tileRange) {\n x = (x % tileRange + tileRange) % tileRange;\n }\n\n return {x: x, y: y};\n}",
"resetWindowing(props) {\n const {\n tilewidth,\n numtiles: inputNumtiles,\n width: inputWidth,\n } = props;\n\n // Get sizing\n let width, pixelWidth;\n\n // Width\n if (inputWidth) {\n width = inputWidth;\n pixelWidth = getWidth(inputWidth);\n } else if (tilewidth && inputNumtiles) {\n width = _.toInteger(tilewidth) * _.toInteger(inputNumtiles);\n pixelWidth = width;\n } else {\n width = '100%';\n pixelWidth = getWidth(width);\n }\n\n // Number of horizontal tiles\n let numtiles;\n if (inputNumtiles) {\n numtiles = inputNumtiles;\n } else if (tilewidth) {\n numtiles = _.toInteger(pixelWidth / tilewidth);\n } else {\n numtiles = 50;\n }\n\n return { xStart: -0.5, xEnd: numtiles + 0.5 };\n }",
"adjustTile(sprite) {\n // set origin at the top left corner\n sprite.setOrigin(0);\n\n // set display width and height to \"tileSize\" pixels\n sprite.displayWidth = this.tileSize;\n sprite.displayHeight = this.tileSize;\n }",
"function getNormalizedCoord(coord, zoom) {\n if (!repeatOnXAxis) return coord\n\n var y = coord.y\n var x = coord.x\n\n // tile range in one direction range is dependent on zoom level\n // 0 = 1 tile, 1 = 2 tiles, 2 = 4 tiles, 3 = 8 tiles, etc\n var tileRange = 1 << zoom\n\n // don't repeat across Y-axis (vertically)\n if (y < 0 || y >= tileRange) {\n return null\n }\n\n // repeat across X-axis\n if (x < 0 || x >= tileRange) {\n x = (x % tileRange + tileRange) % tileRange\n }\n\n return {\n x: x,\n y: y\n }\n\n}",
"swapXLast(tile, lastElement, len) {\r\n tile.setAttribute(\"x\", parseInt(tile.getAttribute(\"x\")) + len);\r\n lastElement.setAttribute(\"x\", parseInt(lastElement.getAttribute(\"x\")) - len);\r\n }",
"function reloadTiles() {\n var pages = ntpApiHandle.mostVisited;\n var cmds = [];\n for (var i = 0; i < Math.min(MAX_NUM_TILES_TO_SHOW, pages.length); ++i) {\n cmds.push({cmd: 'tile', rid: pages[i].rid});\n }\n cmds.push({cmd: 'show'});\n\n $(IDS.TILES_IFRAME).contentWindow.postMessage(cmds, '*');\n}",
"static getUrlMapStatic(refW, urlStaticMap) {\n var scale = 1;\n var reqPictureWidth = refW;\n \n if (refW > 640) {\n reqPictureWidth = parseInt(refW/2);\n scale = 2;\n }\n \n const urlImgMap = urlStaticMap + \"&size=\" + reqPictureWidth + \"x120&scale=\" + scale;\n // console.log(\"url static map: \" + urlImgMap);\n return urlImgMap;\n}",
"function getRawImageTileUrl(level, x, y) {\r\n return this.src;\r\n }",
"function osm_getTileURL(bounds) {\n var res = this.map.getResolution();\n var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));\n var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));\n var z = this.map.getZoom();\n var limit = Math.pow(2, z);\n //\n if (y < 0 || y >= limit) {\n return OpenLayers.Util.getImagesLocation() + \"404.png\";\n } else {\n x = ((x % limit) + limit) % limit;\n return this.url + z + \"/\" + x + \"/\" + y + \".\" + this.type;\n }\n }",
"function remapUrl(url) {\n if (url.startsWith('http://25.media')) {\n url = url.replace('http://25.media', 'http://40.media');\n }\n //else if (url.startsWith('http://31.media')) {\n // url = url.replace('http://31.media', 'http://40.media');\n //}\n return url;\n }",
"function mapResize(newSize){\r\n\r\n // Get current position\r\n var map_x = unsafeWindow.mapX;\r\n var map_y = unsafeWindow.mapY;\r\n var map_s = unsafeWindow.mapSize;\r\n\r\n // Calculate new X and Y\r\n var delta = parseInt((map_s - newSize) / 2);\r\n\r\n // Overwrite values\r\n map_x += delta;\r\n map_y += delta;\r\n\r\n // InnerHTML\r\n var ihtml = \"\";\r\n ihtml += '<tr>';\r\n ihtml += '<td height=\"38\">' + map_y + '</td>';\r\n ihtml += '<td colspan=\"' + newSize + '\" rowspan=\"' + newSize + '\">';\r\n ihtml += '<div style=\"background-image:url(graphic/map/gras4.png); position:relative; width:' + (53 * newSize) + 'px; height:' + (38 * newSize) +'px; overflow:hidden\" id=\"map\">';\r\n ihtml += '<div id=\"mapOld\" style=\"position:absolute; left:0px; top:0px\">';\r\n ihtml += '<div style=\"color:white; margin:10px\">Lade Karte...</div>';\r\n ihtml += '</div>';\r\n ihtml += '<div id=\"mapNew\" style=\"position:absolute; left:0px; top:0px\"></div>';\r\n ihtml += '</div>';\r\n ihtml += '</td>';\r\n ihtml += '</tr>';\r\n for(jj=1; jj<newSize; jj++){\r\n ihtml += '<tr><td width=\"20\" height=\"38\">' + (map_y + jj) + '</td></tr>';\r\n }\r\n ihtml += '<tr id=\"map_x_axis\">';\r\n ihtml += '<td height=\"20\"></td>';\r\n for(jj=0; jj<newSize; jj++){\r\n ihtml += '<td align=\"center\" width=\"53\">' + (map_x + jj) + '</td>';\r\n }\r\n ihtml += '</tr>';\r\n var tmp = document.getElementById(\"mapCoords\").innerHTML = ihtml;\r\n\r\n // Update data\r\n var url = \"http://\"+(\"\"+location.href).split(\"/\")[2] + \"/\" + unsafeWindow.mapURL + '&start_x=' + map_x + '&start_y=' + map_y + '&size_x=' + newSize + '&size_y=' + newSize;\r\n GM_xmlhttpRequest({\r\n method:\"GET\",\r\n url:url,\r\n onload:function(details){\r\n document.getElementById(\"mapOld\").innerHTML = details.responseText;\r\n }\r\n });\r\n\r\n // mapMoveTopo()\r\n var scrollX = map_x;\r\n var scrollY = map_y;\r\n unsafeWindow.scrollX = scrollX;\r\n unsafeWindow.scrollY = scrollY;\r\n var topoX = parseInt(document.getElementsByName('min_x')[0].value); //minimalstes x auf Karte rechts\r\n var topoY = parseInt(document.getElementsByName('min_y')[0].value); //minimalstes y auf Karte rechts\r\n\r\n var relX = scrollX - topoX;\r\n if(unsafeWindow.globalYDir == 1){\r\n var relY = scrollY - topoY;\r\n }else{\r\n var relY = (45-mapSize) - (scrollY-topoY);\r\n }\r\n \r\n // Rechteck verschieben\r\n document.getElementById('topoRect').style.left = (5*(relX)) + 'px';\r\n document.getElementById('topoRect').style.top = (5*(relY)) + 'px';\r\n document.getElementById('topoRect').style.width = (5*(newSize)) + 'px';\r\n document.getElementById('topoRect').style.height = (5*(newSize)) + 'px';\r\n\t \r\n\t unsafeWindow.ajaxMapInit(parseInt(unsafeWindow.mapX), parseInt(unsafeWindow.mapY), parseInt(newSize) , \"game.php?\"+getUrlParam(\"village\")+\"&screen=map&xml\", 1, 1);\r\n\t \r\n }",
"function createPermalink(){\n\tvar visibleLayers = Array();\n\tvar permalink;\n\tvar permalinkParams = {};\n\tvisibleLayers = getVisibleLayers(visibleLayers, layerTree.root.firstChild);\n\tvisibleLayers = uniqueLayersInLegend(visibleLayers);\n\tvar visibleBackgroundLayer = getVisibleBackgroundLayer();\n\tvar startExtentArray = geoExtMap.map.getExtent().toArray();\n\tvar startExtent = startExtentArray[0] + \",\" + startExtentArray[1] + \",\" + startExtentArray[2] + \",\" + startExtentArray[3];\n\n\tif (!norewrite){\n\t\tvar servername = location.href.split(/\\/+/)[1];\n\t\tpermalink = \"http://\"+servername;\n\t\tif (gis_projects) {\n\t\t\tpermalink += gis_projects.path + \"/\";\n\t\t}\n\t\telse {\n\t\t\tpermalink += \"/\";\n\t\t}\n\t\tpermalink += wmsMapName+\"?\";\n\t} else {\n\t\tpermalink = urlArray[0] + \"?map=\";\n\t\tpermalink = permalink + \"/\" + wmsMapName.replace(\"/\", \"\");\n\t\t//add .qgs if it is missing\n\t\tif (!permalink.match(/\\.qgs$/)) {\n\t\t\tpermalink += \".qgs\";\n\t\t}\n\t\tpermalink += \"&\";\n\t}\n\n\t// extent\n\tpermalinkParams.startExtent = startExtent;\n\n\t// visible BackgroundLayer\n\tpermalinkParams.visibleBackgroundLayer = visibleBackgroundLayer;\n \n\t// visible layers and layer order\n\tpermalinkParams.visibleLayers = visibleLayers.toString();\n\n\t// layer opacities as hash of <layername>: <opacity>\n\tvar opacities = null;\n\tfor (layer in wmsLoader.layerProperties) {\n\t\tif (wmsLoader.layerProperties.hasOwnProperty(layer)) {\n\t\t\tvar opacity = wmsLoader.layerProperties[layer].opacity;\n\t\t\t// collect only non-default values\n\t\t\tif (opacity != 255) {\n\t\t\t\tif (opacities == null) {\n\t\t\t\t\topacities = {};\n\t\t\t\t}\n\t\t\t\topacities[layer] = opacity;\n\t\t\t}\n\t\t}\n\t}\n\tif (opacities != null) {\n\t\tpermalinkParams.opacities = Ext.util.JSON.encode(opacities);\n\t}\n\t\n\t//layer order\n\tpermalinkParams.initialLayerOrder = layerOrderPanel.orderedLayers().toString();\n\n\t// selection\n\tpermalinkParams.selection = thematicLayer.params.SELECTION;\t\n\tif (permaLinkURLShortener) {\n\t\tpermalink = encodeURIComponent(permalink + decodeURIComponent(Ext.urlEncode(permalinkParams)));\n\t}\n\telse {\n\t\tpermalink = permalink + Ext.urlEncode(permalinkParams);\t\n\t}\n\t\n\treturn permalink;\n}",
"static WorldToTile(position, x, y) {\n // Translate relative to the world center and scale based upon the\n // tile size.\n const bottomLeft = new b2.Vec2();\n Fracker.GetBottomLeft(bottomLeft);\n x[0] = Math.floor(((position.x - bottomLeft.x) /\n FrackerSettings.k_tileWidth) +\n FrackerSettings.k_tileHalfWidth);\n y[0] = Math.floor(((position.y - bottomLeft.y) /\n FrackerSettings.k_tileHeight) +\n FrackerSettings.k_tileHalfHeight);\n }",
"function Permalink(url) {\n var center = null, zoom = null, gp = null, tp = null, p = null, bl = null;\n var graphs = [];\n var layers = [];\n var scales = {};\n if ('zoom' in url.params) {\n zoom = parseInt(url.params.zoom, 10);\n }\n if ('center' in url.params) {\n center = url.params.center.split(',').map(function(s) { return parseFloat(s); });\n }\n if ('gp' in url.params) {\n var fields = url.params.gp.split(':');\n gp = {\n 'open' : parseInt(fields[0],10) !== 0\n };\n if (fields.length > 1) {\n gp.width = parseInt(fields[1],10);\n }\n }\n if ('tp' in url.params) {\n tp = url.params.tp;\n }\n if ('p' in url.params) {\n if (url.params.p === \"L\") {\n p = ceui.LAYERS_PERSPECTIVE;\n } else {\n p = ceui.GRAPHS_PERSPECTIVE;\n }\n }\n if ('graphs' in url.params) {\n url.params.graphs.split(',').forEach(function(graphString) {\n var fields = graphString.split(':');\n graphs.push({id:fields[0], type:fields[1]});\n });\n }\n if ('scales' in url.params) {\n url.params.scales.split(',').forEach(function(scale) {\n var fields = scale.split(':');\n /////////////////////////////////////////////////////////////////////////////\n // temporary patch to provide backward compatibility with permalink URLs that\n // used the old vertical axis binding names (\"tempc\", \"ytd-prcpmm\", etc):\n if (fields[0] === \"tempc\") { fields[0] = \"temp\"; }\n else if (fields[0] === \"ytd-prcpmm\") { fields[0] = \"ytd-prcp\"; }\n else if (fields[0] === \"prcpmm\") { fields[0] = \"prcp\"; }\n else if (fields[0] === \"snowmm\") { fields[0] = \"snow\"; }\n // end of temporary patch; remove this patch once all links have been changed;\n // see https://github.com/nemac/climate-explorer/issues/26\n /////////////////////////////////////////////////////////////////////////////\n scales[fields[0]] = { min : fields[1], max : fields[2] };\n });\n }\n if ('layers' in url.params) {\n url.params.layers.split(',').forEach(function(layerString) {\n var fields = layerString.split(':');\n layers.push({id:fields[0], opacity:fields[1]});\n });\n }\n if ('bl' in url.params) {\n bl = url.params.bl;\n }\n return {\n 'toString' : function() { return url.toString(); },\n 'haveCenter' : function() { return center !== null; },\n 'getCenter' : function() { return center; },\n 'setCenter' : function(c) {\n center = c;\n url.params.center = sprintf(\"%.1f\", center[0]) + \",\" + sprintf(\"%.1f\", center[1]);\n },\n 'haveZoom' : function() { return zoom !== null; },\n 'getZoom' : function() { return zoom; },\n 'setZoom' : function(z) {\n zoom = z;\n url.params.zoom = zoom.toString();\n },\n 'haveTp' : function() { return tp !== null; },\n 'getTp' : function() { return tp; },\n 'setTp' : function(t) {\n tp = t;\n url.params.tp = t;\n },\n 'havePerspective' : function() { return p !== null; },\n 'getPerspective' : function() { return p; },\n 'setPerspective' : function(q) {\n p = q;\n if (p === ceui.LAYERS_PERSPECTIVE) {\n url.params.p = \"L\";\n } else {\n url.params.p = \"G\";\n }\n },\n 'haveGp' : function() { return gp !== null; },\n 'getGp' : function() { return gp; },\n 'setGp' : function(g) {\n gp = g;\n url.params.gp = gp.open ? \"1\" : \"0\";\n if ('width' in gp) {\n url.params.gp = url.params.gp + \":\" + gp.width;\n }\n },\n 'haveGraphs' : function() { return graphs.length > 0; },\n 'getGraphs' : function() { return graphs; },\n 'addGraph' : function(graph) {\n var i;\n // don't add this graph if it's already in the list\n for (i=0; i<graphs.length; ++i) {\n if (graphs[i].id === graph.id && graphs[i].type == graph.type) {\n return;\n }\n }\n graphs.push(graph);\n url.params.graphs = graphs.map(function(g) { return g.id + \":\" + g.type; }).join(\",\");\n },\n 'removeGraph' : function(graph) {\n for ( var i = graphs.length - 1; i >= 0; i-- ) {\n if (graphs[i].type === graph.type && graphs[i].id === graph.id) {\n graphs.splice ( i, 1 );\n break;\n }\n }\n\n if (graphs.length > 0) {\n url.params.graphs = graphs.map(function(g) { return g.id + \":\" + g.type; }).join(\",\");\n } else {\n delete url.params.graphs;\n }\n },\n 'removeStation' : function(id) {\n for ( var i = graphs.length - 1; i >= 0; i-- ) {\n if (graphs[i].id === id) {\n graphs.splice ( i, 1 );\n }\n }\n\n if (graphs.length > 0) {\n url.params.graphs = graphs.map(function(g) { return g.id + \":\" + g.type; }).join(\",\");\n } else {\n delete url.params.graphs;\n }\n },\n 'setScales' : function(aR) {\n var bindingId;\n for (bindingId in aR) {\n if (!(bindingId in scales)) {\n scales[bindingId] = {};\n }\n scales[bindingId].min = aR[bindingId].min;\n scales[bindingId].max = aR[bindingId].max;\n }\n url.params.scales = Object.keys(scales).map(function(bindingId) {\n return bindingId.replace(\"-binding\", \"\") + \":\" +\n sprintf(\"%.1f\", Number(scales[bindingId].min)) + \":\" +\n sprintf(\"%.1f\", Number(scales[bindingId].max));\n }).join(\",\");\n },\n 'haveScales' : function() {\n return Object.keys(scales).length > 0;\n },\n 'getScales' : function() { return scales; },\n 'haveLayers' : function() { return layers.length > 0; },\n 'getLayers' : function() { return layers; },\n 'addLayer' : function(layerId) {\n var i;\n // don't add this layer if it's already in the list\n for (i=0; i<layers.length; ++i) {\n if (layers[i].id === layerId) {\n return;\n }\n }\n layers.push({id : layerId, opacity : 1});\n url.params.layers = layers.map(function(lyr) { return lyr.id + \":\" + lyr.opacity; }).join(\",\");\n },\n 'setLayerOpacity' : function(layerId, opacity) {\n var i;\n // don't add this layer if it's already in the list\n for (i=0; i<layers.length; ++i) {\n if (layers[i].id === layerId) {\n layers[i].opacity = opacity;\n url.params.layers = layers.map(function(g) { return g.id + \":\" + g.opacity; }).join(\",\");\n return;\n }\n }\n },\n 'clearLayers' : function() {\n layers = [];\n delete url.params.layers;\n },\n 'removeLayer' : function(layerId) {\n for ( var i = layers.length - 1; i >= 0; i-- ) {\n if (layers[i].id === layerId) {\n layers.splice ( i, 1 );\n break;\n }\n }\n if (layers.length > 0) {\n url.params.layers = layers.map(function(g) { return g.id + \":\" + g.opacity; }).join(\",\");\n } else {\n delete url.params.layers;\n }\n },\n 'setBl': function(bl) {\n\turl.params.bl = bl;\n },\n 'haveBl': function() { return bl !== null; },\n 'getBl': function() { return bl }\n };\n }",
"function tileCoordinateToTileId(tilesBetween){\r\n var activeRow = 0;\r\n var bottomTile = 0;\r\n var columnOffset = 1;\r\n var topTile = 0;\r\n \r\n //remove tile overlays, before re-generating them\r\n $('.map .tile-overlay').remove();\r\n \r\n $.each(tilesBetween,function(index,value){\r\n //apply tile overlay functionality\r\n columnOffset++;\r\n \r\n if(index%(config.columnsWide+1)==0){\r\n activeRow++;\r\n columnOffset = 1;\r\n };\r\n\r\n var tileLeftPixel = (0 - (nwPixelCoordinate.x%config.tileSize) + ((columnOffset-1)*config.tileSize));\r\n var tileTopPixel = (0 - (nwPixelCoordinate.y%config.tileSize) + ((activeRow-1)*config.tileSize));\r\n var tileId = (parseInt(tilesBetween[index].y) * (Math.pow(2,config.currentZoomLevel)) + parseInt(tilesBetween[index].x));\r\n \r\n addTileOverlay({\r\n coordinateX:tilesBetween[index].x,\r\n coordinateY:tilesBetween[index].y,\r\n left:tileLeftPixel,\r\n tileId:tileId,\r\n tilePosition:index+1,\r\n top:tileTopPixel,\r\n zoomLevel:config.currentZoomLevel\r\n });\r\n \r\n if(index == 0){topTile = tileId;}\r\n if(index == tilesBetween.length-1){bottomTile = tileId;}\r\n\r\n $.logEvent('[$.tileCoordinateToTileId]: Map columns: ' + (config.columnsWide+1) + ', tile y coordinate: ' + parseInt(tilesBetween[index].y) + ' tiles in map: ' + (Math.pow(2,config.currentZoomLevel)) + ', tile x coordinate: ' + parseInt(tilesBetween[index].x) + ', tile id(' + tilesBetween[index].x + ',' + tilesBetween[index].y + ') = ' + tileId);\r\n\r\n //if the map is rendering for the first time, load the tiles based on the tile bounds\r\n if(config.loaded){\r\n //only request tile data if has not previously been requested\r\n if($.inArray(config.currentZoomLevel + '/' + tileId,config.tilesPreviouslyLoaded) == -1){\r\n $.logEvent('[$.tileCoordinateToTile]: subsequent map load');\r\n \r\n $.ajax({\r\n dataType:'jsonp',\r\n success:function(data){\r\n $.each(data.serviceResponse.body.teams,function(index,value){\r\n //build markers for each location\r\n renderMarker({\r\n latitude:this.lat,\r\n longitude:this.lon,\r\n teamId:this.id\r\n });\r\n }); \r\n //config.markerClusterObj = new MarkerClusterer(config.map,config.markersObj);\r\n },\r\n url:config.webservices.teams + '?tile=' + tileId + '&zoom=' + config.currentZoomLevel + '&number=100&reduced=true'\r\n });\r\n \r\n //stored new tileId into array, so that this tile is never re-requested\r\n config.tilesPreviouslyLoaded.push(config.currentZoomLevel + '/' + tileId);\r\n }\r\n }\r\n else{ \r\n //stored new tileId into array, so that this tile is never re-requested\r\n config.tilesPreviouslyLoaded.push(config.currentZoomLevel + '/' + tileId);\r\n }\r\n });\r\n \r\n //set boolean to indicate that the map has had its bounds changed at least once, so that a different type of data request can be made\r\n if(!config.loaded){\r\n $.logEvent('[$.tileCoordinateToTile]: initial map load');\r\n \r\n //load map for the first time, using the bounds of the map\r\n $.ajax({\r\n dataType:'jsonp',\r\n success:function(data){\r\n $.each(data.serviceResponse.body.teams,function(index,value){\r\n //build markers for each location\r\n renderMarker({\r\n latitude:this.lat,\r\n longitude:this.lon,\r\n teamId:this.id\r\n });\r\n }); \r\n //config.markerClusterObj = new MarkerClusterer(config.map,config.markersObj);\r\n },\r\n url:config.webservices.teamsCombined + '?zoom=' + config.currentZoomLevel + '&number=250&topTile=' + topTile + '&bottomTile=' + bottomTile\r\n });\r\n \r\n config.loaded = true;\r\n }\r\n }",
"function getLayerURL() {\n if(mapCX===undefined || mapCY===undefined) {\n return layerURL = \"/wmts/{Layer}/{Style}/{TileMatrix}/{TileCol}/{TileRow}.png\";\n } else {\n return layerURL = \"/wmts/{Layer}/{Style}/{CX}/{CY}/{TileMatrix}/{TileCol}/{TileRow}.png\";\n }\n }",
"function ShortenLink (url) {\n var yourlsLink;\n\n // Get Yourls API from XNa.me\n // You can use your own API as well\n yourlsLink = siteName + '/yourls-api.php?format=simple&action=shorturl&url=' + url;\n\n\n var rqst = new XMLHttpRequest();\n rqst.onreadystatechange = function () {\n if (rqst.readyState == 4 && rqst.status == 200) {\n $xlink.val(rqst.responseText);\n }\n }\n rqst.open(\"GET\", yourlsLink, false);\n rqst.send();\n\n}",
"function resetMap() {\n\ttileScale = 24;\n\ttileSize = Math.round(2**(tileScale*.25));\n\tmapUpdate();\n\tupdateTileSize(tileSize);\n\t$(\"#mapSize\").text(\"Map tile size: \" + tileScale + \"(\"+tileSize+\")\");\n}"
]
| [
"0.6843974",
"0.61374843",
"0.58517843",
"0.56534225",
"0.55879474",
"0.556825",
"0.5466736",
"0.5306864",
"0.5253604",
"0.52235794",
"0.516368",
"0.5154958",
"0.51505864",
"0.5102653",
"0.51008755",
"0.5099507",
"0.5058561",
"0.5058543",
"0.5027266",
"0.50181586",
"0.50178444",
"0.501723",
"0.5015211",
"0.50135267",
"0.5008576",
"0.50078255",
"0.4956768",
"0.49553242",
"0.49451542",
"0.49331918"
]
| 0.6820857 | 1 |
================================================================================== Adds a crater on the map at the selected location to the calculated size. ================================================================================== | function addCrater(location_)
{
var location1 = location_;
dataProvider.setCbSelectDepthObject(parseInt(selectedBuilding));
var lat = location1.lat();
var lng = location1.lng();
dataProvider.setLatitude(parseFloat(lat));
dataProvider.setLongitude( parseFloat(lng));
dataProvider.setCbLocation(parseInt(cmbLocation));
lox = location_;
//if crater exists remove from map.
if (crater != null )
crater.setMap(null);
var zoom = map.getZoom();
var lat = lox.lat();
var lng = lox.lng();
/*
if (planet=='Earth')
{
var imageBounds = new google.maps.LatLngBounds
(
new google.maps.LatLng(lat-0.09,lng-0.15),
new google.maps.LatLng(lat+0.09,lng +0.15)
);
crater = new google.maps.GroundOverlay('imgs/craterImpact.png',imageBounds);
} else
if (planet=='Moon')
{
var imageBounds = new google.maps.LatLngBounds
(
new google.maps.LatLng(lat-0.45,lng-0.75),
new google.maps.LatLng(lat+0.45,lng +0.75)
);
crater = new google.maps.GroundOverlay('imgs/craterImpact.png',imageBounds);
} else
if (planet=='Mars')
{
var imageBounds = new google.maps.LatLngBounds
(
new google.maps.LatLng(lat-0.45,lng-0.75),
new google.maps.LatLng(lat+0.45,lng +0.75)
);
crater = new google.maps.GroundOverlay('imgs/craterImpact.png',imageBounds);
}
*/
var imageBounds = craterBounds(lat,lng, dataProvider.impactor.crDiam);
crater = new google.maps.GroundOverlay('imgs/craterImpact.png',imageBounds);
//
//Add new ground overlay for the crater.
crater.setMap(map);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function increaseSize() {\n\tif (selectedShape) {\n\t\tselectedShape.resize(5);\n\t\tdrawShapes();\n\t}\n}",
"radiusResized() {\n\t\tif( this.searchRadius.getRadius() > locsearch.map_attributes.max_radius * 1000 ) {\n\t\t\tthis.searchRadius.setRadius( locsearch.map_attributes.max_radius * 1000 );\n\t\t}\n\t\tthis.checkZoomLevel();\n\t}",
"function markerSize(earthquake_size) {\n return 200;\n}",
"updateSize() {\n this.map.invalidateSize()\n }",
"function setMapSize() {\n detail = +document.getElementById(\"detail\").value;\n ctx.canvas.width = document.getElementById(\"width_slider\").value;\n ctx.canvas.height = document.getElementById(\"height_slider\").value;\n}",
"function addLocation() {\n\tvar i = locations.length;\n\tvar location = new Object();\n\tlocation.x = newLocationX;\n\tlocation.y = newLocationY;\n\tlocation.facing = facing;\n\t$(\"#fullBodymap\").append(\"<img src='resources/images/positionMarker.png' id='marker\"+i+facing+\"' />\");\n\tvar img = $(\"#marker\"+i+facing);\n\t$(\"#fullBodymap\").append(\"<img src='resources/images/markerButtonNormal.png' id='square\"+i+facing+\"' />\");\n\tvar square = $(\"#square\"+i+facing);\n\t$(\"#fullBodymap\").append(\"<div id='line\"+i+facing+\"' class='locationConnectorLine' />\");\n\tvar line = $(\"#line\"+i+facing);\n\t$(\"#square\"+i+facing).css('position','absolute');\n\t$(\"#marker\"+i+facing).css('position','absolute');\n\tvar loc = new Location(location.x, location.y, img, square, line);\n\tlocation.element = loc;\n\tlocations.push(location);\n}",
"function resize() {\n\tmap.setSize();\n}",
"function updateRacketSize(e) {\n if (gDebugging) console.log(\"Novo tamanho da raquete:\", gRacket.w);\n\n var newW = parseFloat(e.target.value);\n generateRacket(newW);\n render();\n}",
"function mapResize(newSize){\r\n\r\n // Get current position\r\n var map_x = unsafeWindow.mapX;\r\n var map_y = unsafeWindow.mapY;\r\n var map_s = unsafeWindow.mapSize;\r\n\r\n // Calculate new X and Y\r\n var delta = parseInt((map_s - newSize) / 2);\r\n\r\n // Overwrite values\r\n map_x += delta;\r\n map_y += delta;\r\n\r\n // InnerHTML\r\n var ihtml = \"\";\r\n ihtml += '<tr>';\r\n ihtml += '<td height=\"38\">' + map_y + '</td>';\r\n ihtml += '<td colspan=\"' + newSize + '\" rowspan=\"' + newSize + '\">';\r\n ihtml += '<div style=\"background-image:url(graphic/map/gras4.png); position:relative; width:' + (53 * newSize) + 'px; height:' + (38 * newSize) +'px; overflow:hidden\" id=\"map\">';\r\n ihtml += '<div id=\"mapOld\" style=\"position:absolute; left:0px; top:0px\">';\r\n ihtml += '<div style=\"color:white; margin:10px\">Lade Karte...</div>';\r\n ihtml += '</div>';\r\n ihtml += '<div id=\"mapNew\" style=\"position:absolute; left:0px; top:0px\"></div>';\r\n ihtml += '</div>';\r\n ihtml += '</td>';\r\n ihtml += '</tr>';\r\n for(jj=1; jj<newSize; jj++){\r\n ihtml += '<tr><td width=\"20\" height=\"38\">' + (map_y + jj) + '</td></tr>';\r\n }\r\n ihtml += '<tr id=\"map_x_axis\">';\r\n ihtml += '<td height=\"20\"></td>';\r\n for(jj=0; jj<newSize; jj++){\r\n ihtml += '<td align=\"center\" width=\"53\">' + (map_x + jj) + '</td>';\r\n }\r\n ihtml += '</tr>';\r\n var tmp = document.getElementById(\"mapCoords\").innerHTML = ihtml;\r\n\r\n // Update data\r\n var url = \"http://\"+(\"\"+location.href).split(\"/\")[2] + \"/\" + unsafeWindow.mapURL + '&start_x=' + map_x + '&start_y=' + map_y + '&size_x=' + newSize + '&size_y=' + newSize;\r\n GM_xmlhttpRequest({\r\n method:\"GET\",\r\n url:url,\r\n onload:function(details){\r\n document.getElementById(\"mapOld\").innerHTML = details.responseText;\r\n }\r\n });\r\n\r\n // mapMoveTopo()\r\n var scrollX = map_x;\r\n var scrollY = map_y;\r\n unsafeWindow.scrollX = scrollX;\r\n unsafeWindow.scrollY = scrollY;\r\n var topoX = parseInt(document.getElementsByName('min_x')[0].value); //minimalstes x auf Karte rechts\r\n var topoY = parseInt(document.getElementsByName('min_y')[0].value); //minimalstes y auf Karte rechts\r\n\r\n var relX = scrollX - topoX;\r\n if(unsafeWindow.globalYDir == 1){\r\n var relY = scrollY - topoY;\r\n }else{\r\n var relY = (45-mapSize) - (scrollY-topoY);\r\n }\r\n \r\n // Rechteck verschieben\r\n document.getElementById('topoRect').style.left = (5*(relX)) + 'px';\r\n document.getElementById('topoRect').style.top = (5*(relY)) + 'px';\r\n document.getElementById('topoRect').style.width = (5*(newSize)) + 'px';\r\n document.getElementById('topoRect').style.height = (5*(newSize)) + 'px';\r\n\t \r\n\t unsafeWindow.ajaxMapInit(parseInt(unsafeWindow.mapX), parseInt(unsafeWindow.mapY), parseInt(newSize) , \"game.php?\"+getUrlParam(\"village\")+\"&screen=map&xml\", 1, 1);\r\n\t \r\n }",
"function RadiusWidget(map, center, selectedPictures) {\r\n\tvar color;\r\n\tvar raza;\r\n\tif (selectedPictures >= 100000) {\r\n\t\tcolor = '#CC0000'; // red\r\n\t}\r\n\tif ((selectedPictures >= 10000) && (selectedPictures <= 99999)) {\r\n\t\tcolor = '#CCFF00'; // yellow\r\n\t}\r\n\tif ((selectedPictures >= 1000) && (selectedPictures <= 9999)) {\r\n\t\tcolor = '#00FF00'; // green\r\n\t}\r\n\tif ((selectedPictures >= 1) && (selectedPictures <= 999)) {\r\n\t\tcolor = '#0000CC'; // blue\r\n\t}\r\n\tif (selectedPictures == 0) {\r\n\t\tcolor = '#FFFFFF'; // white\r\n\t}\r\n\tif (map.getZoom() == 1) {\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\t// $(\"#legendInfo\").append(\" here1 \");\r\n\t\traza = 320000;\r\n\t}\r\n\tif (map.getZoom() == 2) {\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 320000\r\n\t}\r\n\tif (map.getZoom() == 3) {\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 160000;\r\n\t}\r\n\tif (map.getZoom() == 4) {\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 80000;\r\n\t}\r\n\tif (map.getZoom() == 5) {//\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 40000;\r\n\t}\r\n\tif (map.getZoom() == 6) {//ok\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 20000;\r\n\t}\r\n\tif (map.getZoom() == 7) {//ok\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 10000;\r\n\t}\r\n\tif (map.getZoom() == 8) {//ok\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 5000;\r\n\t}\r\n\tif (map.getZoom() == 9) {//ok\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 2500;\r\n\t}\r\n\tif (map.getZoom() == 10) {//ok\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 1250;\r\n\t}\r\n\tif (map.getZoom() == 11) {//ok\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 625;\r\n\t}\r\n\tif (map.getZoom() == 12) {//ok\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 312.5;\r\n\t}\r\n\tif (map.getZoom() == 13) {//ok\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 156.25;\r\n\t}\r\n\tif (map.getZoom() == 14) {//ok\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 78.125;\r\n\t}\r\n\tif (map.getZoom() == 15) {\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 78.125;\r\n\t}\r\n\tif (map.getZoom() == 16) {\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 78.125;\r\n\t}\r\n\tif (map.getZoom() == 17) {\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 78.125;\r\n\t}\r\n\tif (map.getZoom() == 18) {\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 78.125;\r\n\t}\r\n\tif (map.getZoom() == 19) {\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 78.125;\r\n\t}\r\n\tif (map.getZoom() == 20) {\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 78.125;\r\n\t}\r\n\tif (map.getZoom() == 21) {\r\n\t\t$(\"#zoomMapLevel\").html(\" \" + map.getZoom());\r\n\t\traza = 78.125;\r\n\t}\r\n\t// max 21 zoom levels\r\n\r\n\tvar circle = new google.maps.Circle( {\r\n\t\tmap : map,\r\n\t\tstrokeWeight : 2,\r\n\t\tfillOpacity : 0.6,\r\n\t\tcenter : center,\r\n\t\t//inverse projectiong scale\r\n\t\tradius : raza * map.getProjection().fromLatLngToPoint(new google.maps.LatLng(Math.abs(center.lat()), center.lng())).y / 100,\r\n\t\tfillColor : color,\r\n\t\tzIndex : 1\r\n\t});\r\n\r\n\tcircles.push(circle);\r\n\r\n\tcircles[circles.length - 1].setMap(map);\r\n}",
"function UpdateRubberbandSizeData(loc) {\r\n // Height & width are the difference between were clicked\r\n // and current mouse position\r\n shapeBoundingBox.width = Math.abs(loc.x - mousedown.x)\r\n shapeBoundingBox.height = Math.abs(loc.y - mousedown.y)\r\n \r\n // If mouse is below where mouse was clicked originally\r\n if(loc.x > mousedown.x) {\r\n // Store mousedown because it is farthest left\r\n shapeBoundingBox.left = mousedown.x\r\n } else {\r\n // Store mouse location because it is most left\r\n shapeBoundingBox.left = loc.x\r\n }\r\n // If mouse location is below where clicked originally\r\n if(loc.y > mousedown.y) {\r\n // Store mousedown because it is closer to the top of the canvas\r\n shapeBoundingBox.top = mousedown.y\r\n } else {\r\n // Otherwise store mouse position\r\n shapeBoundingBox.top = loc.y\r\n }\r\n}",
"function renderSize() {\n let sLinearScale = sizeScale();\n // Render transition between circle size change\n d3.selectAll(\".countryCircle\")\n .transition()\n .duration(1000)\n .attr(\"r\", d => sLinearScale(d[chosenSize]));\n // Refresh legend: size\n // d3.select(\"#sizeLegend\").html(\"\");\n createSizeLegend();\n}",
"grow(){\n this.size.x += 5;\n this.size.y += 5;\n }",
"function markerSize(size) {\n return size*1000;\n }",
"function addNewLocation(event) {\n event.preventDefault();\n var location = event.target.location.value;\n var minCustomers = parseInt(event.target.minimumCustomers.value);\n var maxCustomers = parseInt(event.target.maximumCustomers.value);\n var averagePurchase = parseFloat(event.target.averagePurchase.value);\n\n new CookiesPerLocation(location,minCustomers,maxCustomers,averagePurchase);\n allLocationObjects[allLocationObjects.length-1].render();\n\n replaceHourlyTotals('cookieChart');\n replaceHourlyTotals('cookieStaff');\n}",
"function markerSize(population) {\n return population / 60;\n}",
"function adicionar_busca_raio()\n{\n\tremover_poligono();\n\tdistanceWidget = new DistanceWidget({\n map: map,\n distance: $(\"#default_distance\").val(), //define o raio em km da circunferencia\n maxDistance: 10,\n color: '#000000',\n activeColor: '#5599bb',\n icon: '/Content/images/maps_center_icon.png',\n sizerIcon: new google.maps.MarkerImage('http://code.google.com/intl/pt-BR/apis/maps/articles/mvcfun/resize-off.png'),\n activeSizerIcon: new google.maps.MarkerImage('http://code.google.com/intl/pt-BR/apis/maps/articles/mvcfun/resize.png')\n });\n\n\n map.fitBounds(distanceWidget.get('bounds'));\n //google.maps.event.addListener(distanceWidget, 'position_changed', updatePosition);\n}",
"function markerSize(magnitude){\n return magnitude * 2\n}",
"function pickLocation(){\n\n var cols = floor(width/sz);\n var rows = floor(height/sz);\n//create a spot on the canvas for the food to fill\n food= createVector(floor(random(cols)),floor(random(rows)));\n food.mult(sz);\n }",
"function markerSize(magnitude) {\n return magnitude * 5;\n}",
"function markerSize(magnitude) {\n return magnitude * 4;\n}",
"renderMap(){\n if(this.props.trails.length>0) this.mapRendered=true //in some cases, trail data won't be available when component mounts, and if it doesn't then the code from componentDidMount will run in componenentDidUpdate\n if(this.props.trails.length===1) return //if there is only one marker, don't adjust size of the map\n\n //this sizes the map to fit all the markers\n const bounds = new window.google.maps.LatLngBounds()\n this.props.trails.map((trail)=>{\n bounds.extend(new window.google.maps.LatLng(\n trail.latitude,\n trail.longitude\n ))\n return null\n })\n\n this.refs.resultMap.map.fitBounds(bounds)\n }",
"function range() {\n var p = document.getElementById('resize');\n var res = document.getElementById('radiusVal');\n rad = p.value;\n res.innerHTML=p.value+ \" m\";\n cityCircle.setMap(null);//deletes the origial circle to avoid redraws\n createCityCircle();\n}//range",
"function markerSize(mag){\n return mag * 5\n}",
"function markerSize(magnitude) {\n return magnitude * 5;\n}",
"function markerSize(population) {\n return population / 40;\n }",
"function craterBounds(lat_, lon_ ,craterDiameter){\n\n\tvar lat1 = lat_;\n\tvar lon1 = lon_;\n\tvar d = Math.SQRT2*craterDiameter/2.0;\n\tvar R = 6370000;\n\tvar brng1 = 45*Math.PI/180;\n\tvar brng2 = 225*Math.PI/180;\n\tlat1 = lat1*Math.PI/180;\n\tlon1 = lon1*Math.PI/180;\n\t\n\tvar lat2 = Math.asin( Math.sin(lat1)*Math.cos(d/R) + Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng1) );\n\tvar lon2 = lon1 + Math.atan2(Math.sin(brng1)*Math.sin(d/R)*Math.cos(lat1), Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2));\n \n\tvar lat3 = Math.asin( Math.sin(lat1)*Math.cos(d/R) + Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng2) );\n var lon3 = lon1 + Math.atan2(Math.sin(brng2)*Math.sin(d/R)*Math.cos(lat1), Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2));\n \n \tlat2 = lat2/(Math.PI/180);\n\tlon2 = lon2/(Math.PI/180);\n\tlat3 = lat3/(Math.PI/180);\n\tlon3 = lon3/(Math.PI/180);\n \n var bound = new google.maps.LatLngBounds( new google.maps.LatLng(lat3, lon3), new google.maps.LatLng(lat2,lon2));\t\t\n\n\treturn bound;\n}",
"function markerSize(magnitude) {\n return magnitude * 5\n }",
"function radwegHinzufuegen(clicked_id){\n if (clicked_id == \"themenradweg_1\"){\n themenradweg_1.addTo(map);\n map.fitBounds(themenradweg_1.getBounds());\n\n \n }if (clicked_id ==\"themenradweg_2\"){\n themenradweg_2.addTo(map);\n map.fitBounds(themenradweg_2.getBounds());\n\n\n }if(clicked_id ==\"themenradweg_3\"){\n themenradweg_3.addTo(map);\n map.fitBounds(themenradweg_3.getBounds());\n\n\n }if(clicked_id ==\"themenradweg_4\"){\n themenradweg_4.addTo(map);\n map.fitBounds(themenradweg_4.getBounds());\n \n\n }if(clicked_id ==\"themenradweg_5\"){\n themenradweg_5.addTo(map);\n map.fitBounds(themenradweg_5.getBounds());\n\n }if(clicked_id ==\"themenradweg_6\"){\n themenradweg_6.addTo(map);\n map.fitBounds(themenradweg_6.getBounds());\n\n }\n\n}",
"function changeMapSize() {\n console.log('changeMapSize')\n\n let zoomScrollBar = document.getElementById('zoom')\n zoomScrollBar.style.display = 'block'\n zoomScrollBar.value = '6'\n\n if (mapSetting != mapSize) {\n mapSize = mapSetting\n let areaDiv = document.getElementById('area')\n $('.grid-piece').remove();\n if (mapSize == 'large') {\n gridDown = 180\n gridUp = -180\n numberOfDivs = 180 * 110\n $('#area').css( \"grid-template-columns\", \"repeat(180, 6px)\" );\n $('#area').css( \"grid-template-rows\", \"repeat(110, 6px)\" );\n addDivs(110 * 180);\n } else if (mapSize == 'medium') {\n gridDown = 130\n gridUp = -130\n numberOfDivs = 105 * 130\n $('#area').css( \"grid-template-columns\", \"repeat(130, 6px)\" );\n $('#area').css( \"grid-template-rows\", \"repeat(105, 6px)\" );\n addDivs(105 * 130);\n } else {\n gridDown = 100\n gridUp = -100\n numberOfDivs = 100 * 100\n $('#area').css( \"grid-template-columns\", \"repeat(100, 6px)\" );\n $('#area').css( \"grid-template-rows\", \"repeat(100, 6px)\" );\n addDivs(100 * 100);\n }\n mapSize = mapSetting\n }\n}"
]
| [
"0.5915427",
"0.590992",
"0.5751164",
"0.57064664",
"0.57052106",
"0.5687674",
"0.5662098",
"0.5610895",
"0.55383986",
"0.5504745",
"0.54977345",
"0.5489173",
"0.5481716",
"0.54469305",
"0.5397067",
"0.5388447",
"0.5388419",
"0.5376396",
"0.5376353",
"0.5343446",
"0.5329552",
"0.5321554",
"0.5320687",
"0.5306709",
"0.53022265",
"0.5298543",
"0.5293638",
"0.52909744",
"0.5287377",
"0.52864635"
]
| 0.6280322 | 0 |
================================================================================= =================================================================================== Calculate the crater bounds. =================================================================================== | function craterBounds(lat_, lon_ ,craterDiameter){
var lat1 = lat_;
var lon1 = lon_;
var d = Math.SQRT2*craterDiameter/2.0;
var R = 6370000;
var brng1 = 45*Math.PI/180;
var brng2 = 225*Math.PI/180;
lat1 = lat1*Math.PI/180;
lon1 = lon1*Math.PI/180;
var lat2 = Math.asin( Math.sin(lat1)*Math.cos(d/R) + Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng1) );
var lon2 = lon1 + Math.atan2(Math.sin(brng1)*Math.sin(d/R)*Math.cos(lat1), Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2));
var lat3 = Math.asin( Math.sin(lat1)*Math.cos(d/R) + Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng2) );
var lon3 = lon1 + Math.atan2(Math.sin(brng2)*Math.sin(d/R)*Math.cos(lat1), Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2));
lat2 = lat2/(Math.PI/180);
lon2 = lon2/(Math.PI/180);
lat3 = lat3/(Math.PI/180);
lon3 = lon3/(Math.PI/180);
var bound = new google.maps.LatLngBounds( new google.maps.LatLng(lat3, lon3), new google.maps.LatLng(lat2,lon2));
return bound;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get bounds() {}",
"function bounds() {\n return {\n start: conductor.displayStart(),\n end: conductor.displayEnd(),\n domain: conductor.domain().key\n };\n }",
"get boundsValue() {}",
"get localBounds() {}",
"calcBounds() {\n\n\t\tvar horizOffset = Math.floor(window.innerWidth / 6);\n\n\t\tif (this.player.seatNumber == 0) {\n\t\t\tthis.leftBound = this.player.x + 50;\n\t\t\tthis.rightBound = window.innerWidth - 50;\n\t\t}\n\n\t\tif (this.player.seatNumber == 1) {\n\t\t\tthis.leftBound = this.player.x + 50;\n\t\t\tthis.rightBound = theTable.seats[0][0] - 50;\n\t\t}\n\n\t\tif (this.player.seatNumber == 2) {\n\t\t\tthis.leftBound = this.player.x + 50;\n\t\t\tthis.rightBound = theTable.seats[1][0] - 50;\n\t\t}\n\n\t\tif (this.player.seatNumber == 3 || this.player.seatNumber == 4 || this.player.seatNumber == 5) {\n\t\t\tthis.leftBound = this.player.x + 50;\n\t\t\tthis.rightBound = this.leftBound + horizOffset;\n\t\t}\n\n\t\tif (this.player.seatNumber == 6) {\n\t\t\tthis.leftBound = 50;\n\t\t\tthis.rightBound = this.player.x - 50;\n\t\t}\n\n\t\tif (this.player.seatNumber == 7) {\n\t\t\tthis.leftBound = theTable.seats[6][0] + 50;\n\t\t\tthis.rightBound = this.player.x - 50;\n\t\t}\n\n\t\tif (this.player.seatNumber == 8) {\n\t\t\tthis.leftBound = theTable.seats[7][0] + 50;\n\t\t\tthis.rightBound = this.player.x - 50;\n\t\t}\n\n\t\tif (this.player.seatNumber == 9 || this.player.seatNumber == 10 || this.player.seatNumber == 11) {\n\t\t\tthis.rightBound = this.player.x - 50;\n\t\t\tthis.leftBound = this.rightBound - horizOffset;\n\t\t}\n\n\t\t// position the HandMasks\n\n\t\tthis.handMaskLeft.x = this.leftBound + 20;\n\t\tthis.handMaskLeft.y = this.player.y;\n\n\t\tthis.handMaskRight.x = this.rightBound - 20;\n\t\tthis.handMaskRight.y = this.player.y;\n\t}",
"function bound() {\n ['top', 'bottom', 'tlc', 'left', 'blc', 'trc', 'right', 'brc'].forEach((piece) => {\n equilibriate(piece, 0, params.u0, 1);\n });\n}",
"_calculateBounds() {\n // FILL IN//\n }",
"getLatLngBounds() {\n let bounds = new google.maps.LatLngBounds();\n // If the flight is big just having the two end points will cut off part of the route\n for(let i = 0; i <= 1; i+= 0.1) {\n bounds.extend(this.getIntermediatePoint(i));\n }\n return bounds;\n }",
"getBounds() {}",
"function computeBounds(latlng,rad) {\n\tvar radlatlng = { lat : latlng.lat * Math.PI / 180, lng : latlng.lng * Math.PI / 180 };\n\t\n\tvar rsw = getCoordAtRad(radlatlng,rad,Math.PI * 1.5);\n\t//console.log(sw);\n\trsw = getCoordAtRad(rsw,rad,Math.PI);\n\tvar rne = getCoordAtRad(radlatlng,rad,Math.PI * 0.5);\n\t//console.log(ne);\n\trne = getCoordAtRad(rne,rad,0);\n\t\n\t//all inputs must be radians (except radius which is converted in-function)\n\tfunction getCoordAtRad(coord,radius,angle) {\n\t\tvar nlat, nlng;\n\t\tvar radDist = radius * angle;//arc length\n\t\tnlat = Math.asin(Math.sin(coord.lat) * Math.cos(radDist) \n\t\t\t\t + Math.cos(coord.lat) * Math.sin(radDist) * Math.cos(angle));\n\t\tnlng = (Math.cos(nlat) == 0) ? coord.lng : \n\t\tmod(coord.lng + Math.PI - Math.asin(Math.sin(angle) \n\t\t* Math.sin(radDist) / Math.cos(nlat)), 2 * Math.PI) - Math.PI;\n\t\treturn { lat : nlat, lng : nlng };\n\t}\n\t\n\tfunction mod(x,y) {\n\t\treturn x - y * Math.floor(x / y);\n\t}\n\t\n\tvar sw = { lat : rsw.lat * 180 / Math.PI, lng : rsw.lng * 180 / Math.PI };\n\tvar ne = { lat : rne.lat * 180 / Math.PI, lng : rne.lng * 180 / Math.PI };\n\t\n\treturn { sw : sw, ne : ne };\n}",
"calc_range() {\n let z = this.zoom / this.drug.z\n let zk = (1 / z - 1) / 2\n\n let range = this.y_range.slice()\n let delta = range[0] - range[1]\n range[0] = range[0] + delta * zk\n range[1] = range[1] - delta * zk\n\n return range\n }",
"carregaBoundaries() {\n\n //Modifica o tamanho do estagio baseado no tamanho do elemento div do bird\n this.maxBoundsWidth = this.getEstagio().clientWidth - this.getBird().getTamanhoWidth();\n this.maxBoundsHeight = this.getEstagio().clientHeight - this.getBird().getTamanhoHeight();\n\n // console.log(\"Max width da arena: \" + this.maxBoundsWidth);\n // console.log(\"Max height da arena: \" + this.maxBoundsHeight);\n\n //Verifico se o passaro esta dentro as boundaries(caso o usuario de resize)\n this.estaForaDasBounds()\n }",
"function getBounds(features) {\n var bounds = { min: [999, 999], max: [-999, -999] };\n\n _.each(features, function(element) {\n var point = map.latLngToLayerPoint(element.LatLng);\n\n bounds.min[0] = Math.min(bounds.min[0], point.x);\n bounds.min[1] = Math.min(bounds.min[1], point.y);\n bounds.max[0] = Math.max(bounds.max[0], point.x);\n bounds.max[1] = Math.max(bounds.max[1], point.y);\n });\n\n return bounds;\n }",
"function findBoundaries() {\n\tgoogle.maps.event.addListener(map, 'bounds_changed', function() {\n\t \tconst bounds = map.getBounds();\n\t \tconst NE = bounds.getNorthEast();\n\t\tconst SW = bounds.getSouthWest();\n\t\tconst coordinates = [`${SW}`, `${NE}`];\n\t\tconst fixed = coordinates.map(e => e.replace(/[{()}]/g, '')).map(e => e.split(', ')).flat();\n\t\tconst parsed = fixed.map(e => parseFloat(e));\n\t\t[parsed[0], parsed[1]] = [parsed[1], parsed[0]];\n\t\t[parsed[2], parsed[3]] = [parsed[3], parsed[2]];\n\t\tconst formattedBounds = parsed.join();\n\t\tgetWheelMapNodes(formattedBounds);\n\t});\n}",
"function getBounds(x, y, z) {\n\t\ty = Math.pow(2, z) - y - 1; // Translate Y value\n\t\t\n\t\tvar resolution = (CIRCUMFERENCE / TILE_SIZE) / Math.pow(2, z); // meters per pixel\n\t\t\n\t\tvar swPoint = getMercatorCoord(x, y, resolution);\n\t\tvar nePoint = getMercatorCoord(x + 1, y + 1, resolution);\n\t\t\n\t\tvar bounds = {\n\t\t\t\tswX : swPoint.x,\n\t\t\t\tswY : swPoint.y,\n\t\t\t\tneX : nePoint.x,\n\t\t\t\tneY : nePoint.y\n\t\t};\n\t\t\n\t\treturn bounds;\n\t}",
"get bounds() { return this._bounds; }",
"calculateBounds() {\n var minX = Infinity;\n var maxX = -Infinity;\n var minY = Infinity;\n var maxY = -Infinity;\n if (this.graphicsData.length) {\n var shape = null;\n var x = 0;\n var y = 0;\n var w = 0;\n var h = 0;\n for (var i = 0; i < this.graphicsData.length; i++) {\n var data = this.graphicsData[i];\n var type = data.type;\n var lineWidth = data.lineStyle ? data.lineStyle.width : 0;\n shape = data.shape;\n if (type === ShapeSettings_1.ShapeSettings.SHAPES.RECT || type === ShapeSettings_1.ShapeSettings.SHAPES.RREC) {\n x = shape.x - (lineWidth / 2);\n y = shape.y - (lineWidth / 2);\n w = shape.width + lineWidth;\n h = shape.height + lineWidth;\n minX = x < minX ? x : minX;\n maxX = x + w > maxX ? x + w : maxX;\n minY = y < minY ? y : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else if (type === ShapeSettings_1.ShapeSettings.SHAPES.CIRC) {\n x = shape.x;\n y = shape.y;\n w = shape.radius + (lineWidth / 2);\n h = shape.radius + (lineWidth / 2);\n minX = x - w < minX ? x - w : minX;\n maxX = x + w > maxX ? x + w : maxX;\n minY = y - h < minY ? y - h : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else if (type === ShapeSettings_1.ShapeSettings.SHAPES.ELIP) {\n x = shape.x;\n y = shape.y;\n w = shape.width + (lineWidth / 2);\n h = shape.height + (lineWidth / 2);\n minX = x - w < minX ? x - w : minX;\n maxX = x + w > maxX ? x + w : maxX;\n minY = y - h < minY ? y - h : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else {\n // POLY\n var points = shape.points;\n var x2 = 0;\n var y2 = 0;\n var dx = 0;\n var dy = 0;\n var rw = 0;\n var rh = 0;\n var cx = 0;\n var cy = 0;\n for (var j = 0; j + 2 < points.length; j += 2) {\n x = points[j];\n y = points[j + 1];\n x2 = points[j + 2];\n y2 = points[j + 3];\n dx = Math.abs(x2 - x);\n dy = Math.abs(y2 - y);\n h = lineWidth;\n w = Math.sqrt((dx * dx) + (dy * dy));\n if (w < 1e-9) {\n continue;\n }\n rw = ((h / w * dy) + dx) / 2;\n rh = ((h / w * dx) + dy) / 2;\n cx = (x2 + x) / 2;\n cy = (y2 + y) / 2;\n minX = cx - rw < minX ? cx - rw : minX;\n maxX = cx + rw > maxX ? cx + rw : maxX;\n minY = cy - rh < minY ? cy - rh : minY;\n maxY = cy + rh > maxY ? cy + rh : maxY;\n }\n }\n }\n }\n else {\n minX = 0;\n maxX = 0;\n minY = 0;\n maxY = 0;\n }\n var padding = this.boundsPadding;\n this._bounds.minX = minX - padding;\n this._bounds.maxX = maxX + padding;\n this._bounds.minY = minY - padding;\n this._bounds.maxY = maxY + padding;\n }",
"function computeBounds(x1, x2, y1, y2) {\n return [[x1, y1], [x2, y1], [x2, y2], [x1,y2]];\n }",
"function normBounds( bounds ) {\n\n\t\tfor ( var i = ticks.length; i >= 0; i-- ) {\n\t\t\tif ( bounds[0] + unit / 2 >= ticks[i] ) {\n\t\t\t\tbounds[0] = ticks[i] - 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor ( var i = 0; i <= ticks.length; i++ ) {\n\t\t\tif ( bounds[1] - unit / 2 <= ticks[i] ) {\n\t\t\t\tbounds[1] = ticks[i] + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn bounds;\n\t}",
"_calculateBounds() {\n this.calculateVertices();\n this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length);\n }",
"get bounds () {\n const xMin = Math.min.apply(null, this.pointArr.map(pt => pt.x))\n const yMin = Math.min.apply(null, this.pointArr.map(pt => pt.y))\n const xMax = Math.max.apply(null, this.pointArr.map(pt => pt.x))\n const yMax = Math.max.apply(null, this.pointArr.map(pt => pt.y))\n\n return {\n x: xMin,\n y: yMin,\n width: xMax - xMin,\n height: yMax - yMax\n }\n }",
"bounds() {\n if(this.isEmpty()) return null;\n // maximum boundaries possible\n let min = Number.POSITIVE_INFINITY\n let max = Number.NEGATIVE_INFINITY\n\n return [min, max] = this.forEachNode( (currentNode) => {\n if(currentNode.value < min) min = currentNode.value;\n if(currentNode.value > max) max = currentNode.value;\n return [min, max]\n }, min, max)\n \n }",
"getBounds() {\n return new Rectangle(new Point(this.x, this.y), new Vector(0, 0));\n }",
"function get_bounds(){\n\t\t\t\t\n\t\t\t\treturn {\n\t\t\t\t\t\n\t\t\t\t\tsw_lat : map.getBounds().getSouthWest().lat(),\n\t\t\t\t\t\n\t\t\t\t\tsw_lng : map.getBounds().getSouthWest().lng(),\n\t\t\t\t\t\n\t\t\t\t\tne_lat : map.getBounds().getNorthEast().lat(),\n\t\t\t\t\t\n\t\t\t\t\tne_lng : map.getBounds().getNorthEast().lng()\n\t\t\t\t\n\t\t\t\t};\n\t\t\t\n\t\t\t}",
"function bezier_bounds(p0, p1, p2, p3, width)\n{\n\t// This computes the coefficients of the derivative of the bezier curve.\n\t// We will use this to compute the zeroes to get the maxima.\n\tlet a = -p0 + 3 * p1 - 3 * p2 + p3;\n\tlet b = 2 * p0 - 4 * p1 + 2 * p2;\n\tlet c = p1 - p0;\n\n\t// Compute the discriminant.\n\tlet d = b*b - 4*a*c;\n\t// If there are no maxima or minima, just return the end points.\n\tif(d < 0 || a == 0)\n\t{\n\t\treturn {min: Math.min(p0, p3) - width, max: Math.max(p0, p3) + width};\n\t}\n\t// Square root the discriminant so we don't need to recompute it.\n\td = Math.sqrt(d);\n\t// Compute the \"time\" of the critical points by solving the quadrating equation.\n\tlet crit1 = (-b + d) / (2*a);\n\tlet crit2 = (-b - d) / (2*a);\n\t// Use the \"time\" of the critical points to compute the critical points themselves..\n\tif(crit1 >= 0 && crit1 <= 1)\n\t{\n\t\tcrit1 = compute_bezier(p0, p1, p2, p3, crit1, 1 - crit1);\n\t}\n\telse\n\t{\n\t\tcrit1 = undefined;\n\t}\n\tif(crit2 >= 0 && crit2 <= 1)\n\t{\n\t\tcrit2 = compute_bezier(p0, p1, p2, p3, crit2, 1 - crit2);\n\t}\n\telse\n\t{\n\t\tcrit2 = undefined;\n\t}\n\n\t// Start by just using the end points as the bounds.\n\tlet m = Math.min(p0, p3);\n\tlet M = Math.max(p0, p3);\n\t// If the critical point is valid, ensure it is included in the bounds.\n\tif(crit1)\n\t{\n\t\tm = Math.min(m, crit1);\n\t\tM = Math.max(M, crit1);\n\t}\n\t// If the critical point is valid, ensure it is included in the bounds.\n\tif(crit2)\n\t{\n\t\tm = Math.min(m, crit2);\n\t\tM = Math.max(M, crit2);\n\t}\n\t// Return the bounds.\n\treturn {min: m - width, max: M + width};\n}",
"getBounds(){\n let rect = new Rectangle()\n\t\trect.setRect(this.x, this.y, this.size, this.size)\n\t\treturn rect\n }",
"getBounds(){\n let rect = new Rectangle()\n\t\trect.setRect(this.x, this.y, this.size, this.size)\n\t\treturn rect\n }",
"function calculateBound(d) {\n\t\n\tvar bound = {width: d.width, height: d.height};\n\n\tif (bound.width>d.boundWidth || bound.height>d.boundHeight) {\n\t\t\n\t\tvar rel = bound.width/bound.height;\n\n\t\tif (d.boundWidth/rel>d.boundHeight && d.boundHeight*rel<=d.boundWidth) {\n\t\t\t\n\t\t\tbound.width = Math.round(d.boundHeight*rel);\n\t\t\tbound.height = d.boundHeight;\n\n\t\t} else {\n\t\t\t\n\t\t\tbound.width = d.boundWidth;\n\t\t\tbound.height = Math.round(d.boundWidth/rel);\n\t\t\n\t\t}\n\t}\n\t\t\n\treturn bound;\n}",
"function compute_bound(bbox) {\n var offset = 0.01;\n var southWest = new L.LatLng(bbox[0][0] - offset, bbox[0][1] - offset);\n var northEast = new L.LatLng(bbox[2][0] + offset, bbox[2][1] + offset);\n return new L.LatLngBounds(southWest, northEast);\n}",
"function getExtendedBounds(bnds){\n // get the coordinates for the sake of readability\n var swlat = bnds._southWest.lat;\n var swlng = bnds._southWest.lng;\n var nelat = bnds._northEast.lat;\n var nelng = bnds._northEast.lng;\n\n // Increase size of bounding box in each direction by 50%\n swlat = swlat - Math.abs(0.5*(swlat - nelat)) > -90 ? swlat - Math.abs(0.5*(swlat - nelat)) : -90;\n swlng = swlng - Math.abs(0.5*(swlng - nelng)) > -180 ? swlng - Math.abs(0.5*(swlng - nelng)) : -180;\n nelat = nelat + Math.abs(0.5*(swlat - nelat)) < 90 ? nelat + Math.abs(0.5*(swlat - nelat)) : 90;\n nelng = nelng + Math.abs(0.5*(swlng - nelng)) < 180 ? nelng + Math.abs(0.5*(swlng - nelng)) : 180;\n\n return L.latLngBounds(L.latLng(swlat, swlng), L.latLng(nelat, nelng));\n }"
]
| [
"0.681576",
"0.6706417",
"0.660061",
"0.63839865",
"0.63708615",
"0.6307134",
"0.62913907",
"0.6281191",
"0.61922103",
"0.6177425",
"0.6169913",
"0.6135824",
"0.6122678",
"0.6122418",
"0.6114216",
"0.60479003",
"0.6044865",
"0.59958386",
"0.59903866",
"0.5989155",
"0.5986858",
"0.59599847",
"0.59544015",
"0.59493643",
"0.59393394",
"0.5917901",
"0.5917901",
"0.5915504",
"0.58531654",
"0.58525854"
]
| 0.7160708 | 0 |
============================================== ================================================================================== Once the calc is complete put the results on the UI. ================================================================================== | function onCalcComplete()
{
////////////////////////////////
//Display Results
////////////////////////////////
//The data on the map screen.
setImpactValues(dataProvider.getDgOutputs());
//The inputValues
setInputValues(dataProvider.getDgInputs());
//The damage table
setDamage(dataProvider.getTxtDamage());
//Set Impact Energy Table
setEnergyValues(dataProvider.getDgEnergy());
//Get the what happenes to the impactor text.
setImpactorText(dataProvider.getTxtImpactor());
// get fireball dats.
setFireballSeen(dataProvider.getDgFirevall());
drawScale();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calcResults() {\n\t\trbAge.innerText = parseInt(currentAge)+parseInt(yearsToRetirement);\n\t\trbIncome.innerText = rawNestAmount*targetRetirementIncomePercentage;\n\t\trbInterest.innerText = (rawNestAmount-(rawNestAmount*targetRetirementIncomePercentage))*targetInterestRateToNest;\n\t\trbBalance.innerText = (rawNestAmount-(rawNestAmount*targetRetirementIncomePercentage))+(rawNestAmount-(rawNestAmount*targetRetirementIncomePercentage))*targetInterestRateToNest;\n\t}",
"function calculateResults() {\n document.getElementById('answer').style.display = 'block';\n\n document.getElementById('loading').style.display = 'none';\n\n document.getElementById('calc').style.display = 'none';\n\n inputProgress.style.display = 'none';\n progress.style.display = 'none';\n var showTable = document.getElementById('table');\n showTable.classList.remove('invisible');\n\n caclRiskProfile();\n}",
"function CalculateResults()\r\n {\r\n var inputsAllValid;\r\n\r\n // Fetch all input values from the on-screen form.\r\n\r\n inputsAllValid = FetchInputValues();\r\n\r\n // If the fetched input values are all valid...\r\n\r\n if (inputsAllValid)\r\n {\r\n // Do the natural gas pressure loss calculation.\r\n\r\n DoCalculation();\r\n\r\n // Display the results of the calculation.\r\n\r\n DisplayResults();\r\n }\r\n }",
"function calculateResults() {\n //UI vars\n const height = document.querySelector('#height').value;\n const weight = document.querySelector('#weight').value;\n const age = document.querySelector('#age').value;\n const sex = document.querySelector('#sex').value;\n const activity = document.querySelector('#activity').value;\n\n //Output vars\n const dailyCalorieRequirements = document.querySelector('#dailyCalorie');\n const daliyProteinIntake = document.querySelector('#dailyProtein');\n const dailyCarbsIntake = document.querySelector('#dailyCarbs');\n const dailyFatIntake = document.querySelector('#dailyFat');\n\n //calculating basal metabolic rate\n const bmr = ((10 * weight) + (6.25 * height) - (5 * age)) + parseFloat(sex);\n \n if (isFinite(bmr)) {\n let dailyCalorie = bmr * parseFloat(activity);\n dailyCalorieRequirements.value = Math.round(dailyCalorie);\n daliyProteinIntake.value = getAmountOfMacronutrient(dailyCalorieRequirements.value, 25, 'p');\n dailyCarbsIntake.value = getAmountOfMacronutrient(dailyCalorieRequirements.value, 35, 'c');\n dailyFatIntake.value = getAmountOfMacronutrient(dailyCalorieRequirements.value, 40, 'f');\n displayResults();\n hideLoading();\n displayMacrosRatioChart();\n } else {\n showError('Please check your numbers');\n }\n}",
"function calculateResults() {\n return;\n}",
"refreshResult() {\r\n if(this.validateForm()) {\r\n let bill = +(this.getInputVal(this.inputBill));\r\n let people = +(this.getInputVal(this.inputPeople));\r\n let perc = +(this.getInputVal(this.inputCustom) || \r\n this.percentageBtns.filter(btn => btn.classList.contains(\"active\"))[0].value);\r\n\r\n if(people === 0) return;\r\n\r\n this.errorStyles(\"remove\");\r\n let tip = (bill * (perc / 100));\r\n let tipPerPerson = (tip / people).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});\r\n let total = ((bill + tip) / people).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});\r\n\r\n this.displayResult(tipPerPerson, total);\r\n }\r\n else {\r\n return ;\r\n }\r\n }",
"function calculate() {\n\t\tvar servings = 0;\n\t\tvar standardDrinks = 0;\n\t\tvar calories = 0;\n\n\t\t$('.calculator-carousel .single-drink').each(function(){\n\t\t\tvar currentDrinkType = $(this).data('drinktypes').split(',')[$(this).data('currenttype')].split('|');\n\t\t\tservings += $(this).data('quantity');\n\t\t\tstandardDrinks += $(this).data('quantity') * (currentDrinkType[2] / 1000) * drinkDefinitions[currentDrinkType[1]]['abv'] * 0.789;\n\t\t\tcalories += $(this).data('quantity') * (currentDrinkType[2] / 100) * drinkDefinitions[currentDrinkType[1]]['calories'];\n\t\t\t//Only render if the values change\n\t\t\tvar renderId = String(servings) + \",\" + String(standardDrinks) + \",\" + String(calories);\n\t\t\tif (renderId != calculationId) {\t\t\t\n\t\t\t\t\n\t\t\t\trenderResults(servings, standardDrinks, calories);\n\t\t\t}\n\t\t\tcalculationId = renderId;\n\t\t});\n\t}",
"function calculate() {\n secondNumber = resultDisplay.innerText;\n let result = calculateResult(firstNumber, secondNumber, operatorSymbol);\n changeDisplay(result);\n // This allows the user to keep calculating after a result\n firstNumber = result;\n}",
"function calculate() {\n\n calculator.calculate();\n\n }",
"function calculateResults() {\n\ttry {\n\t\tvar x = getUserInput();\n //if user input results in error, the error will be presented on the html.\n //e is the event.\n\t} catch(e) {\n\t\talert(\"Error: \" + e);\n\t\treturn;\n\t}\n //This will keep from displaying the same answer over and over if the calculate\n //button is clicked; without setDefaultText() the calculate button will keep\n //appending the same answer indefinitely.\n\tsetDefaultText();\n\n\tfor (var i = 0; i < resultElements.length; i++) {\n\t\tvar element = resultElements[i];\n //functionName looks for the function attribute in the html\n var functionName = element.getAttribute('function');\n //func invokes the Math function and is defined the function tag\n //accessed by the functionName funtion above\n\t\tvar func = Math[functionName];\n //The results are rendered based on the user input\n\t\tvar result = func(x);\n //The user input is captured here and input is evaluated and the results\n //added to the respective functions in the html - sin/cons/tan/log\n\t\telement.innerText = element.innerText + \" \" + result;\n\n\t}\n\n}",
"function RunCalculation() {\n\t\n\ttry {\n\t\tvar results = calculator.calculateTax({\n\t\t\t'number_of_exemptions': $('#number_of_exemptions_value').val(),\n\t\t\t'amount_of_income_taxable_by_the_city': $('#amount_of_income_taxable_by_the_city_value').val(),\n\t\t\t'taxable_value_of_your_home': $('#taxable_value_of_your_home_value').val()\n\t\t});\n\n\t\t// Transfer results to output fields.\n\t\tfor (var prop in results) {\n\t\t\tsetOutput(prop + '_output', results[prop]);\n\t\t}\n\t\t// Clear errors.\n\t\tshowError(false);\n\t} catch (e) {\n\t\t// Show errors that were thrown.\n\t\tshowError(e);\n\t}\n}",
"function refreshResult() {\n\n //console.log(\"start refresh\");\n\tengine.initialize();\n\t//console.log(\"must start moms\");\n\tengine.interpol();\n\tengine.gearInitialize();\n\tengine.drawMomentum();\n\tengine.drawGears();\n\t\n\t$(\"#resTable1\").html(engine.findCross());\n\t$(\"#resTable2\").html(engine.findCross2());\n\t\n} // refreshResult",
"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 displayResult(result) {\n output.textContent = result;\n calculationIsDone = true;\n}",
"function getResult() {\n console.log(\"getResult ran\");\n wrong = total - correct;\n $(\"#end_total_right b\").text(correct);\n $(\"#end_total_wrong b\").text(wrong);\n var answer_percent = correct / total;\n if (answer_percent >= 0.67) {\n $(\"#end\").prepend(responses[0]);\n } else if (answer_percent >= 0.34) {\n $(\"#end\").prepend(responses[1]);\n } else {\n $(\"#end\").prepend(responses[2]);\n }\n }",
"function showResults() {\r\n // make sure the calculation is correct.\r\n step = 6;\r\n calculateCompletion();\r\n previousAction = actions.activityTaxStep;\r\n nextAction = \"\";\r\n\r\n if (parseboolean(registrations.isTFN)) {\r\n $('#resultTable tr:last').after(getResult(\"Tax File Number (TFN)\", \"tfn\", true, \"\", \"Free\", 1));\r\n }\r\n if (parseboolean(registrations.isCompany)) {\r\n $('#resultTable tr:last').after(getResult(\"Company\", \"co\", true, \"\", \"up to $463 for 1 year\", 2));\r\n }\r\n if (parseboolean(registrations.isBusinessName)) {\r\n $('#resultTable tr:last').after(getResult(\"Business name\", \"bn\", true, \"\", \"$34 for 1 year or $79 for 3 years\", 3));\r\n }\r\n if (parseboolean(registrations.isPAYG)) {\r\n $('#resultTable tr:last').after(getResult(\"Pay As You Go (PAYG) Withholding\", \"payg\", true, \"\", \"Free\", 4));\r\n }\r\n if (parseboolean(registrations.isFBT)) {\r\n $('#resultTable tr:last').after(getResult(\"Fringe Benefits Tax (FBT)\", \"fbt\", true, \"\", \"Free\", 5));\r\n }\r\n var needGST = (parseboolean(applicationType.taxi) || parseboolean(applicationType.turnOver75k) || parseboolean(applicationType.limo));\r\n if (needGST) {\r\n $('#resultTable tr:last').after(getResult(\"Goods & Services Tax (GST)\", \"gst\", true, \"\", \"Free\", 6));\r\n }\r\n if (parseboolean(registrations.isLCT) && needGST) {\r\n $('#resultTable tr:last').after(getResult(\"Luxury Car Tax (LCT)\", \"lct\", true, \"\", \"Free\", 7));\r\n }\r\n if (parseboolean(registrations.isFTC) && needGST) {\r\n $('#resultTable tr:last').after(getResult(\"Fuel Tax Credits (FTC)\", \"ftc\", true, \"\", \"Free\", 8));\r\n }\r\n if (parseboolean(registrations.isWET) && needGST) {\r\n $('#resultTable tr:last').after(getResult(\"Wine Equalisation Tax (WET)\", \"wet\", true, \"\", \"Free\", 9));\r\n }\r\n if (!needGST) {\r\n $(\"#gstRecommend\").show();\r\n $(\"#ckGstRecommend\").click(function () {\r\n if ($(this).prop('checked')) {\r\n $(\"#lctOptional\").prop('checked', true);\r\n $(\"#wetOptional\").prop('checked', true);\r\n $(\"#ftcOptional\").prop('checked', true);\r\n\r\n }\r\n else {\r\n $(\"#lctOptional\").prop('checked', false);\r\n $(\"#wetOptional\").prop('checked', false);\r\n $(\"#ftcOptional\").prop('checked', false);\r\n }\r\n });\r\n\r\n if (parseboolean(registrations.isLCT)) {\r\n $(\"#lctOptionalRow\").show();\r\n $(\"#lctOptional\").click(function () {\r\n if ($(this).prop('checked')) {\r\n $(\"#ckGstRecommend\").prop('checked', true);\r\n }\r\n });\r\n }\r\n if (parseboolean(registrations.isWET)) {\r\n $(\"#wetOptionalRow\").show();\r\n $(\"#wetOptional\").click(function () {\r\n if ($(this).prop('checked')) {\r\n $(\"#ckGstRecommend\").prop('checked', true);\r\n }\r\n });\r\n }\r\n if (parseboolean(registrations.isFTC)) {\r\n $(\"#ftcOptionalRow\").show();\r\n $(\"#ftcOptional\").click(function () {\r\n if ($(this).prop('checked')) {\r\n $(\"#ckGstRecommend\").prop('checked', true);\r\n }\r\n });\r\n }\r\n }\r\n \r\n setTimeout(showRegistrationsHelpContent, 1);\r\n\r\n}",
"function calculateResult() {\n\t//var fuel = getFuel();\n\t//var dist = getDistance();\n\t//var efficiency = 0;\n\t//var dist2 = 26.69/2.65;\n\t//efficiency = fuel / dist2;\n\tvar efficiency = getFuel() / (getDistance() / 100);\n\t//var efficiency = 3 + 5;\n\t\n\t//display the result\n\tdocument.getElementById('result').innerHTML = \"Fuel Efficiency is \" + efficiency + \" L/100km\";\n\t//var divobj - document.getElementById('result');\n\t//divobj.style.display='block';\n\t//divobj.innerHTML = \"Fuel Efficiency is \" + efficiency + \" L/100km\";\n}",
"function calculate_results() {\n let e_val = 20 + r[0] - r[5] + r[10] - r[15] + r[20] - r[25] + r[30] - r[35] + r[40] - r[45];\n let a_val = 14 - r[1] + r[6] - r[11] + r[16] - r[21] + r[26] - r[31] + r[36] + r[41] + r[46];\n let c_val = 14 + r[2] - r[7] + r[12] - r[17] + r[22] - r[27] + r[32] - r[37] + r[42] + r[47];\n let n_val = 38 - r[3] + r[8] - r[13] + r[18] - r[23] - r[28] - r[33] - r[38] - r[43] - r[48];\n let o_val = 8 + r[4] - r[9] + r[14] - r[19] + r[24] - r[29] + r[34] + r[39] + r[44] + r[49];\n\n o_val = Math.round((o_val/40)*100);\n c_val = Math.round((c_val/40)*100);\n e_val = Math.round((e_val/40)*100);\n a_val = Math.round((a_val/40)*100);\n n_val = Math.round((n_val/40)*100);\n\n console.log(e_val + \" \" + a_val + \" \" + c_val + \" \" + n_val + \" \" + o_val);\n\n save_results(e_val, a_val, c_val, n_val, o_val);\n}",
"async calculateResults() {\n var that = this;\n var reelsPositions = {\n top: [],\n middle: [],\n bottom: []\n };\n this.reels.map(reel => {\n var currentReelPositions = reel.getCurrentPositions();\n $.each(currentReelPositions, function(position, value) {\n reelsPositions[position].push(value);\n });\n })\n\n var combinations = this.checkCombinations(reelsPositions);\n return Promise.all(combinations.map(win => {\n that.blinkLines(win.line, 5);\n that.blinkPayTable(win.symbol, 5);\n that.balance += win.value;\n })).then(() => this.updateBalanceBox());\n }",
"function calculateResults(){\n// console.log('calculating.....');\n\n// UI variables\n// amount variable\nconst amount = document.getElementById('amount');\n// interest rate variable\nconst interest = document.getElementById('interest');\n// years to pay\nconst years = document.getElementById('years');\n// monthly payment\nconst monthlyPayment = document.getElementById('monthly-payment');\n// total payment\nconst totalPayment = document.getElementById('total-payment');\n// total interest\nconst totalInterest = document.getElementById('total-interest')\n\nconst principal = parseFloat(amount.value);\nconst calculatedInterest = parseFloat(interest.value)/100/12;\nconst calculatedPayments = parseFloat(years.value)*12;\n\n// compute monthly payment\nconst x = Math.pow(1 + calculatedInterest , calculatedPayments);\nconst monthly = (principal*x*calculatedInterest)/(x-1);\n\n\n// hide the loading image\ndocument.getElementById('loading').style.display = 'none'\n\n\nif (isFinite(monthly)){\n\n// show results\ndocument.getElementById('result').style.display = 'block';\n\n// show the reset all button\ndocument.querySelector('div.reset').style.display = 'block'\n\ndocument.querySelector('div.reset input#resetAll').addEventListener('dblclick', resetAll);\n\n monthlyPayment.value = monthly.toFixed(2);\n totalPayment.value = (monthly*calculatedPayments).toFixed(2);\n totalInterest.value = ((monthly*calculatedPayments)-principal).toFixed(2);\n}else {\nshowError('please check your numbers')\n}\n\n}",
"function useResult() {\n updateFormula(function() {\n return resultDisplay.text();\n }, true);\n }",
"results() {\n\n // After the round is finished:\n // Footer with big bubbles slides up.\n this.moveFooterBubbles('up');\n // Upper bar slides up.\n document.querySelector('#upper-bar').style = \"top: -100px;\";\n \n // Main menu is shown again.\n this.mainMenu.style = \"display: flex;\";\n \n // Circle counter - background color of the circles (green/red)\n // is cleared and background is set to transparent again.\n Array.from(this.upperBarCounterCircles.children).forEach((c) => {c.style = \"background-color: transparent;\"});\n \n // Saving information about score and points for subsequent showing in the result list.\n this.hitNumberResult = Math.floor(this.i * this.difficultyScore * this.coeff); //zde menim\n this.scoreResult = this.i.toString() + \"/10\";\n\n let novyObjekt = new Results(this.resolutionResult, this.hitNumberResult, this.difficultyResult, this.scoreResult); \n \n // Displaying the round results in the main menu.\n this.mainMenu.children[1].innerHTML = `Targets shot<br> ${this.i.toString()}/10`; \n this.mainMenu.children[2].innerHTML = `Total points<br> ${(Math.floor(this.i * this.difficultyScore * this.coeff)).toString()}`; //zde menim\n }",
"function calculate(){}",
"function display_results(val){\n\n var i,data,metadata,tmp;\n var n=val.component_vectors[0].length;\n if (n>10) n=10;\n \n //principal components\n data=[];\n for (i=0;i<val.component_vectors.length;i++){\n tmp=val.component_vectors[i].slice(0,n);\n tmp.unshift(val.times[i]);\n data.push({values: tmp});\n }\n eg_pc.load({data: data});\n eg_pc.renderGrid(\"tablecontent_pc\", \"table table-hover\");\n \n //loadings\n metadata=[ {name:'desc', label:'Description', datatype:'string', editable:'false'},\n {name:'expl', label:'Expl. Power', datatype:'double(%,2)', editable:'false'} ];\n \n for (i=0;i<val.headers.length;i++){\n tmp={name:val.headers[i], label:val.headers[i], datatype:'double(%,4)', editable:'true'}\n metadata.push(tmp);\n }\n data=[];\n for (i=0;i<n;i++){\n tmp=val.loadings[i].slice();\n tmp.unshift(val.rel_variances[i]*100);\n tmp.unshift(\"Comp \" + (i+1));\n data.push({values: tmp});\n } \n eg_loadings.load({data: data, metadata:metadata});\n eg_loadings.renderGrid(\"tablecontent_loadings\", \"table table-hover\");\n \n //scenarios\n //data for editable grid\n metadata=[ {name:'desc', label:'Description', datatype:'string', editable:'false'} ];\n \n //data for papa parse (export functionality)\n fields=[ \"Description\" ];\n var export_data=[];\n \n for (i=0;i<val.headers.length;i++){\n tmp={name:val.headers[i], label:val.headers[i], datatype:'double(%,4)', editable:'true'}\n metadata.push(tmp);\n fields.push(val.headers[i]);\n }\n data=[];\n\n var lab;\n for (i=0;i<val.scenarios.length;i++){\n tmp=val.scenarios[i].slice();\n lab=((i % 2) != 0) ? \"Comp \" + ((i+1)/2) + \" down\" : \"Comp \" + (i/2+1) + \" up\"\n tmp.unshift(lab);\n data.push({values: tmp});\n export_data.push(tmp);\n } \n eg_scenarios.load({data: data,metadata:metadata});\n eg_scenarios.renderGrid(\"tablecontent_scenarios\", \"table table-hover\");\n\n // make data available for export function, Papa.unparse needs object with entries \"data\" and \"fields\"\n g_scenarios= {data: export_data,fields:fields};\n\n update_chart(val);\n}",
"function calculationLoop() {\n\n function updateTime() {\n updateTimeInToolbar();\n setTimeout(updateTime, 1000);\n }\n setTimeout(updateTime, 1000);\n \t\t\n\t\tfunction calc() {\n\t\t\tcalculate(false);\n\t\t\tsetTimeout(calc, AGSETTINGS.getRefreshTimerInterval());\n\t\t}\n\t\tsetTimeout(calc, AGSETTINGS.getRefreshTimerInterval());\n\t}",
"function calculateResult() {\n return function () {\n changeDivideMultiply();\n screenResult.innerHTML = eval(screenResult.innerHTML);\n };\n }",
"function computeResult() {\n const equals = document.querySelector(\"#equals\");\n equals.classList.add(\"clicked\");\n // convert CSV list to array of numbers\n const numbers = display.dataset.numbers.split(',').splice(1).map(str => Number(str));\n // remove leading comma and convert to array\n const operators = display.dataset.operators.split(',').splice(1);\n const currentNumber = Number(display.textContent);\n\n if(operators.length === 0) {\n return; // do nothing\n }\n\n // keep operating until only 1 number is saved\n while(numbers.length > 1){\n let x = numbers.shift();\n let y = numbers[0];\n numbers[0] = operate(operators.shift(), x, y);\n }\n\n // ensure the display is rounded to 5 decimals\n const result = operate(operators.shift(), numbers.shift(), currentNumber);\n let strResult = result.toString();\n if (result === Infinity) {\n strResult = \"Divided by 0!\";\n } else if (strResult.length > 5) {\n // round to 5 decimal places\n strResult = (Math.round(result*100000)/100000).toString();\n }\n\n display.classList.add(\"clear\");\n display.dataset.numbers = \"\";\n display.dataset.operators = \"\";\n display.textContent = strResult;\n}",
"function computeValues(){\n //Removes loading\n open();\n checkReady()\n\n}",
"function result() {\r\n\r\n \tlet entry1 = '';\r\n \t\r\n\r\n \tswitch (operation) {\r\n \t\tcase 1 : \r\n \t\tentry1 = `${operande} + ${output.value} = `\r\n \t\toutput.value = parseFloat(operande) + parseFloat(output.value);\r\n \t\tentry1 += output.value\r\n \t\tbreak;\r\n\r\n \t\tcase 2 : \r\n \t\tentry1 = `${operande} - ${output.value} = `\r\n \t\toutput.value = operande - output.value;\r\n \t\tentry1 += output.value\r\n \t\tbreak;\r\n\r\n \t\tcase 3 :\r\n \t\tentry1 = `${operande} * ${output.value} = ` \r\n \t\toutput.value = operande * output.value;\r\n \t\tentry1 += output.value\r\n \t\tbreak;\r\n\r\n \t\tcase 4 : \r\n \t\tentry1 = `${operande} / ${output.value} = `\r\n \t\toutput.value = operande / output.value;\r\n \t\tentry1 += output.value\r\n \t\tbreak;\r\n\r\n \t}\r\n\t\r\n\toutput_history.innerHTML = `<li>${history}</li>`;\r\n\thistory.push(entry1);\r\n \tdisplayHistory(history);\r\n\r\n \toutput.value = 0;\r\n \toperande = 0;\r\n\r\n }",
"function refresh() {\n display.innerText = currentCalculation;\n}"
]
| [
"0.74880457",
"0.7394863",
"0.7280815",
"0.72197276",
"0.7156501",
"0.70714635",
"0.7022014",
"0.679462",
"0.67822",
"0.6777992",
"0.6716648",
"0.6692626",
"0.664951",
"0.6634787",
"0.65943533",
"0.6565198",
"0.65605116",
"0.65293264",
"0.6506112",
"0.65058047",
"0.6497893",
"0.64825153",
"0.647517",
"0.6466671",
"0.64655405",
"0.6454188",
"0.645287",
"0.643285",
"0.6429212",
"0.64137053"
]
| 0.7548231 | 0 |
================================================================================= ================================================================================== Sets the damage text which is the second table of the data view are. ================================================================================== | function setDamage(txtDamage)
{
$("#LB_Damage").text( damage1 + " " + dist +" km "+ damage2);
var impTbl = document.getElementById("DamageInfo");
$('#DamageInfo').html(txtDamage);
//impTbl.innerHTML = txtDamage;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setDeniseText() {\n var textToApplyDenise = \"\";\n if (houseUpgrades.upgrades[1].owned == 0) { textToApplyDenise = \"We Need a BED to sleep in\"; }\n else if (houseUpgrades.upgrades[2].owned == 0) { textToApplyDenise = \"I wish I had a CHEST to put stuff.\"; }\n else if (houseUpgrades.upgrades[3].owned == 0) { textToApplyDenise = \"We need a SINK to cook and clean - please buy one\"; }\n else if (houseUpgrades.upgrades[4].owned == 0) { textToApplyDenise = \"Are we Animals? We need a TABLE to eat on.\"; }\n else if (houseUpgrades.upgrades[5].owned == 0) { textToApplyDenise = \"You are gonna buy some CHAIRS right?\"; }\n else if (houseUpgrades.upgrades[6].owned == 0) { textToApplyDenise = \"All the ladies in town have a DRESSING TABLE, but I do not....\"; }\n else if (houseUpgrades.upgrades[7].owned == 0) { textToApplyDenise = \"A BEDSIDE TABLE would be very nice to have\"; }\n else if (houseUpgrades.upgrades[8].owned == 0) { textToApplyDenise = \"We need more decor. A POTTED PLANT would be nice\"; }\n else if (houseUpgrades.upgrades[9].owned == 0) { textToApplyDenise = \"A COUCH to sit on would be nice to have over there\"; }\n else if (houseUpgrades.upgrades[10].owned == 0) {\n if (houseUpgrades.upgrades[0].owned == 1) { textToApplyDenise = \"We need some CURTAINS for this new space\"; }\n else { textToApplyDenise = \"We need more room; a little one is on the way\"; }\n }\n else if (houseUpgrades.upgrades[11].owned == 0) {\n if (houseUpgrades.upgrades[0].owned == 1) { textToApplyDenise = \"We need a DOUBLE BED to fill this space\"; }\n else { textToApplyDenise = \"We need more room; a little one is on the way\"; }\n }\n else if (houseUpgrades.upgrades[12].owned == 0) {\n if (houseUpgrades.upgrades[0].owned == 1) { textToApplyDenise = \"I wish I had STOOL to sit on back there\"; }\n else { textToApplyDenise = \"We need more room; a little one is on the way\"; }\n }\n else if (houseUpgrades.upgrades[13].owned == 0) {\n if (houseUpgrades.upgrades[0].owned == 1) { textToApplyDenise = \"I wish I had WARDROBE to hang my dresses\"; }\n else { textToApplyDenise = \"We need more room; a little one is on the way\"; }\n }\n else if (houseUpgrades.upgrades[14].owned == 0) {\n if (houseUpgrades.upgrades[0].owned == 1) { textToApplyDenise = \"I sure do like that FANCY COUCH. Won't you buy it for me?\"; }\n else { textToApplyDenise = \"We need more room; a little one is on the way\"; }\n }\n else if (houseUpgrades.upgrades[15].owned == 0) {\n if (houseUpgrades.upgrades[0].owned == 1) { textToApplyDenise = \"Don't you think BOOKSHELVES would look good here?\"; }\n else { textToApplyDenise = \"We need more room; a little one is on the way\"; }\n }\n else if (houseUpgrades.upgrades[16].owned == 0) {\n if (houseUpgrades.upgrades[0].owned == 1) { textToApplyDenise = \"That FANCY TABLE is so elegant. I wish we could have it\"; }\n else { textToApplyDenise = \"We need more room; a little one is on the way\"; }\n }\n else if (houseUpgrades.upgrades[17].owned == 0) {\n if (houseUpgrades.upgrades[0].owned == 1) { textToApplyDenise = \"Now we need some FANCY CHAIRS to complete our set\"; }\n else { textToApplyDenise = \"We need more room; a little one is on the way\"; }\n }\n else if (houseUpgrades.upgrades[18].owned == 0) {\n if (houseUpgrades.upgrades[0].owned == 1) { textToApplyDenise = \"Don't you need a DESK to keep the farm in order?\"; }\n else { textToApplyDenise = \"We need more room; a little one is on the way\"; }\n }\n else if (houseUpgrades.upgrades[19].owned == 0) {\n if (houseUpgrades.upgrades[0].owned == 1) { textToApplyDenise = \"That PAINTING would look good over the mantle\"; }\n else { textToApplyDenise = \"We need more room; a little one is on the way\"; }\n }\n else if (houseUpgrades.upgrades[20].owned == 0) {\n if (houseUpgrades.upgrades[0].owned == 1) { textToApplyDenise = \"I need a DISH CABINET to keep our dishes\"; }\n else { textToApplyDenise = \"We need more room; a little one is on the way\"; }\n }\n else if (houseUpgrades.upgrades[21].owned == 0) {\n if (houseUpgrades.upgrades[0].owned == 1) { textToApplyDenise = \"We need a TRUNK to store Patricia's toys\"; }\n else { textToApplyDenise = \"We need more room; a little one is on the way\"; }\n }\n else if (houseUpgrades.upgrades[22].owned == 0) {\n if (houseUpgrades.upgrades[0].owned == 1) { textToApplyDenise = \"A different color of walls would be a nice\"; }\n else { textToApplyDenise = \"We need more room; a little one is on the way\"; }\n }\n else { textToApplyDenise = \"I am happy and don't need anything....for the moment\"; }\n //apply the deireved text\n questText1House.setText(textToApplyDenise);\n }",
"function showDeformationText(car) {\n fill(rgb(200, 0, 150));\n textSize(30);\n text(\"Damage: \" + Math.round(car.deformation), 950, car.y + 10);\n if (car.deformation === NaN) {\n car.deformation = 0;\n }\n}",
"set damage(damage){this._damage = Utils.protectionError(\"Hero\", \"damage\");}",
"function resourse(){\r\n\tvar tds = document.getElementsByTagName('td');\r\n\ttds[12].getElementsByTagName('font')[0].innerHTML = Metal;\r\n\ttds[13].getElementsByTagName('font')[0].innerHTML = Crystal;\r\n\ttds[14].getElementsByTagName('font')[0].innerHTML = Deuterium;\r\n\ttds[15].getElementsByTagName('font')[0].innerHTML = Energy;\r\n}",
"function setImpactorText(impactorText)\n\t {\n\t\tvar impTbl = document.getElementById(\"ImpactorInfo\");\n\t\t$('#ImpactorInfo').html(impactorText);\n\t\t//impTbl.innerHTML = impactorText;\n\t }",
"function fightDescription(loser, attacker){\n if (loser.colIdWarrior === attacker.colIdWarrior - 1 && (attacker.colIdWarrior - 1)\n % columNum !== 0 || loser.colIdWarrior === attacker.colIdWarrior + 1 && attacker.colIdWarrior\n % columNum !== 0 || loser.colIdWarrior === attacker.colIdWarrior - columNum ||\n loser.colIdWarrior === attacker.colIdWarrior + columNum && !attacker.guard) {\n\n swal(`Player ${attacker.name} attack ${loser.name}`);\n attacker.warriorAttack(loser, attacker.weapon);\n\n loser.guard = swal( {\n title:`Player ${loser.name}`,\n text:` Attack or Defend your self?`,\n buttons: [\"Attack\", \"Defend\"],\n\n });\n endOfFight(loser);\n\n\n }\n }",
"function changeTwoSidedNoData() {\r\n \r\n // change the title\r\n setTitleTwoSided(\"Data is not available for refugees from \" + currentConflictCountryName + \" in \" + countryTwoSided);\r\n\r\n // remove the bars\r\n removeBarsTwoSided(\"rect.left\", dataMale);\r\n removeBarsTwoSided(\"rect.right\", dataFemale);\r\n\r\n // remove all the text\r\n removeAllTextTwoSided();\r\n}",
"function updateDrawingTextOfAPeer(oldTextObj, newTextObj) {\n oldTextObj.setText(newTextObj.text);\n}",
"function showNewText(text) {\n firstText.innerHTML = `${text}`;\n gsap.to(\".m402-text-relative\", {\n duration: 0.3,\n opacity: 1\n });\n}",
"function showNewText(text) {\n firstText.innerHTML = `${text}`;\n gsap.to(\".m402-text-relative\", {\n duration: 0.3,\n opacity: 1\n });\n}",
"function SetDamageType(weapon = OPC.mainHand) {\n\tdamageTypeText = \"bludgeoning\"; // for all non-weapon class items (improvised weapons)\n\tif(weapon[0] == \"w\") { // is a weapon class item\n\t\tdamageTypeText = weapon[3];\n\t}\n\treturn damageTypeText;\n}",
"function SetTopText(newText:String) {\t\n\tvar topText : GameObject = GameObject.Find(\"TopText\");\n\ttopText.guiText.text = newText;\n\ttopText.guiText.fontSize = Mathf.Round(Screen.width / 29.95);\n}",
"function changeTable2() {\n \n }",
"function alterText2(){\ndocument.getElementById(\"college2\").style.fontSize = \"4em\";\ndocument.getElementById(\"college2\").style.fontStyle= \"Underline\";\ndocument.getElementById(\"college2\").style.backgroundColor = \"blue\";\ndocument.getElementById(\"college2\").style.fontWeight = \"Thin\";\n}",
"SetDamage(num) {\n if (num == 1) { return \"3d6\"; }\n if (num == 2) { return \"3d6+2\"; }\n if (num == 3) { return \"3d8\"; }\n if (num == 4) { return \"3d8+2\"; }\n if (num == 5) { return \"3d10\"; }\n }",
"function printFightInfo() {\n $(\"#\" + fighterObj.idCounter).css(\"display\", \"none\");\n $(\"#\" + fighterObj.idAttack).text(fighterObj.name + \"'s\" + \" attack is \" + fighterObj.attackNew);\n $(\".fighter-damage\").text(fighterObj.name + \" damaged \" + enemyObj.name + \" for \" + fighterObj.attackNew + \" points!\");\n\n\n $(\"#\" + enemyObj.idAttack).css(\"display\", \"none\");\n $(\"#\" + enemyObj.idAttack).text(enemyObj.name + \"'s\" + \" counter attack is \" + enemyObj.counterAttack);\n $(\".enemy-damage\").text(enemyObj.name + \" damaged \" + fighterObj.name + \" for \" + enemyObj.counterAttack + \" points!\");\n $(\".attack-info-all\").css(\"border\", \"1px black solid\");\n\n }",
"function secondText() {\n firstText.style.transition = \"opacity 1.5s linear 0s\"\n let opacity = firstText.style.opacity = \"0\";\n setTimeout(replacingText, 1500)\n}",
"function changeText() {\n \n }",
"_text(d) {\n if (d.indexData !== -1)\n return this._adjustLengthText(this.model.data.children.data[this._vOrder[d.indexData]].labels[1], 20);\n else\n return \"\";\n }",
"function setAllHorseText(textVal){\n $scope.horses.forEach(function(horse) {\n horse.horseText = textVal\n })\n }",
"function fallText() {\n text(\"whoopsie-Daisy\", 10, 590);\n}",
"function UpdateText(formName, text, textName)\r\n{\r\n sql = \"UPDATE `Control` SET `Control`.`Text` = '\" + text + \"' \" +\r\n \"WHERE `Control`.`Dialog_`='\" + formName + \"' AND `Control`.`Control`='\" + textName + \"'\"\r\n view = database.OpenView(sql);\r\n view.Execute();\r\n view.Close();\r\n}",
"function materialPageText(){\r\n console.count('materialPageText');\r\n\t\tif($(\"#usermsg1\").length == 0){\r\n\t\t\t $('#attribute-showDetailedView .ui-flipswitch').css('margin-right','10px').after('<span id=\"usermsg1\" style=\"color:darkred\">Please select \"Yes\" to see detailed view. Swipe the screen to see additional details.</span>');\r\n\t\t}\r\n \tif($(\"#usermsg2\").length == 0){\r\n\t\t\t$('#resultsTable_filter').after('<div id=\"usermsg2\" style=\"color:darkred;float:left;width:100%;margin-top:-10px;margin-bottom:10px;\">Please scroll down to see the selected material</div>');\r\n\t\t}\r\n }",
"function updateDefenseInfo() {\n if($(\".defender\").attr('id') === \"red\"){\n $(\"#defense-text\").text(redCharacter.Name+ \" defended for \" + defendAmount);\n }\n else if($(\".defender\").attr('id') === \"blue\"){\n $(\"#defense-text\").text(blueCharacter.Name+ \" defended for \" + defendAmount);\n }\n else if($(\".defender\").attr('id') === \"green\"){\n $(\"#defense-text\").text(greenCharacter.Name+ \" defended for \" + defendAmount);\n }\n else if($(\".defender\").attr('id') === \"yellow\"){\n $(\"#defense-text\").text(yellowCharacter.Name+ \" defended for \" + defendAmount);\n }\n }",
"function onClickFireSecondary() {\r\n\r\n vaultDweller.currentAttackMode = \"grenade\";\r\n\toutput = \"<p> Grenade ready! <span class=\\\"update\\\">Click the target you want to blow to smithereens!</span></p>\";\r\n\t\r\n\tLogInfo(output);\r\n}",
"function explanationText(varText, delay, delayStep) {\n\td3.select(\"#explanation\")\n\t\t.transition().duration(1000).delay(delay*delayStep)\n\t\t.style(\"opacity\",0)\n\t\t.call(endall, function() {\n\t\t\t\td3.select(\"#explanation\")\n\t\t\t\t\t.html(varText);\t\n\t\t})\n\t\t.transition().duration(1000)\n\t\t.style(\"opacity\",1);\t\n}",
"function renderDualType(dualAttacks, dualDefense) {\n resetHtml();\n //document.getElementById(\"effect-break\").innerHTML += \"<br>\";\n \n quadAttack = findEffect(dualAttacks, \"4\");\n supers = findEffect(dualAttacks, \"2\");\n half = findEffect(dualAttacks, \"0.5\");\n \n noEffect = findEffect(dualAttacks, \"0\");\n\n quadWeak = findEffect(dualDefense, \"4\");\n weak = findEffect(dualDefense, \"2\");\n resist = findEffect(dualDefense, \"0.5\");\n quadResist = findEffect(dualDefense, \"0.25\");\n immune = findEffect(dualDefense, \"0\");\n\n\n console.log(supers)\n \n // if(dualAttacks[j] == \"4\") {\n\n if(quadAttack.length > 0) {\n document.getElementById(\"super-content-container\").innerHTML += '<h5 style=\"color: rgb(204, 255, 204);\">Super Effective</h5>';\n for(var i in quadAttack) {\n document.getElementById(\"super-content-container\").innerHTML+=\n '<div id=\"' + quadAttack[i] + '-text\">' + '<font color=\"#ccffcc\">4x </font>' + quadAttack[i] + '</div><br>';\n }\n }\n else if(supers.length <= 0) {\n document.getElementById(\"half-content-container\").style.width = \"100%\";\n document.getElementById(\"super-content-container\").style.width = \"0%\";\n }\n if(supers.length > 0 && quadAttack <= 0) {\n document.getElementById(\"super-content-container\").innerHTML += '<h5 style=\"color: rgb(204, 255, 204);\">Super Effective</h5>';\n for(var i in supers) {\n document.getElementById(\"super-content-container\").innerHTML+=\n '<div id=\"' + supers[i] + '-text\">' + supers[i] + '</div><br>';\n }\n }\n else if(supers.length > 0 && quadAttack.length > 0) {\n for(var i in supers) {\n document.getElementById(\"super-content-container\").innerHTML+=\n '<div id=\"' + supers[i] + '-text\">' + supers[i] + '</div><br>';\n }\n }\n\n if(quadWeak.length > 0) {\n document.getElementById(\"half-content-container\").innerHTML += '<h5 style=\"color: rgb(255, 204, 204);\">Half Effective</h5>';\n for(var i in quadWeak) {\n document.getElementById(\"half-content-container\").innerHTML+=\n '<div id=\"' + quadWeak[i] + '-text\">'+ '<font color=\"#ffcccc\">1/4x </font>' + quadWeak[i] + '</div><br>';\n }\n }\n else if(half.length <= 0) {\n document.getElementById(\"half-content-container\").style.width = \"0%\";\n document.getElementById(\"super-content-container\").style.width = \"100%\";\n } \n if(half.length > 0 && quadWeak.length <= 0) {\n document.getElementById(\"half-content-container\").innerHTML += '<h5 style=\"color: rgb(255, 204, 204);\">Half Effective</h5>';\n for(var i in half) {\n document.getElementById(\"half-content-container\").innerHTML+=\n '<div id=\"' + half[i] + '-text\">' + half[i] + '</div><br>';\n }\n } else if(half.length > 0 && quadWeak.length > 0) {\n for(var i in half) {\n document.getElementById(\"half-content-container\").innerHTML+=\n '<div id=\"' + half[i] + '-text\">' + half[i] + '</div><br>';\n }\n }\n equalHeightsUpperContent();\n \n\n if(quadResist.length > 0) {\n document.getElementById(\"resist-content-container\").innerHTML += '<h5 style=\"color: rgb(204, 255, 204);\">Resists</h5>';\n for(var i in quadResist) {\n document.getElementById(\"resist-content-container\").innerHTML+=\n '<div id=\"' + quadResist[i] + '-text\">' + '<font color=\"#ccffcc\">1/4x </font>' + quadResist[i] + '</div><br>';\n }\n }\n else if(resist.length <= 0){\n document.getElementById(\"resist-content-container\").style.width = \"0%\";\n document.getElementById(\"weak-content-container\").style.width = \"100%\";\n }\n if(resist.length > 0 && quadResist.length <= 0) {\n document.getElementById(\"resist-content-container\").innerHTML += '<h5 style=\"color: rgb(204, 255, 204);\">Resists</h5>';\n for(var i in resist) {\n document.getElementById(\"resist-content-container\").innerHTML+=\n '<div id=\"' + resist[i] + '-text\">' + resist[i] + '</div><br>';\n }\n }\n else if(resist.length > 0 && quadResist.length > 0) {\n for(var i in resist) {\n document.getElementById(\"resist-content-container\").innerHTML+=\n '<div id=\"' + resist[i] + '-text\">' + resist[i] + '</div><br>';\n }\n } \n\n if(quadWeak.length > 0) {\n document.getElementById(\"weak-content-container\").innerHTML += '<h5 style=\"color: rgb(255, 204, 204);\">Weak Against</h5>';\n for(var i in quadWeak) {\n document.getElementById(\"weak-content-container\").innerHTML+=\n '<div id=\"' + quadWeak[i] + '-text\">' + '<font color=\"#ffcccc\">' + '4x ' + '</font>'+ quadWeak[i] + '</div><br>';\n }\n }\n else if (weak <= 0) {\n document.getElementById(\"resist-content-container\").style.width = \"100%\";\n document.getElementById(\"weak-content-container\").style.width = \"0%\";\n }\n if(weak.length > 0 && quadWeak.length <= 0) {\n document.getElementById(\"weak-content-container\").innerHTML += '<h5 style=\"color: rgb(255, 204, 204);\">Weak Against</h5>';\n for(var i in weak) {\n document.getElementById(\"weak-content-container\").innerHTML+=\n '<div id=\"' + weak[i] + '-text\">' + weak[i] + '</div><br>';\n }\n } \n else if(weak.length > 0) {\n for(var i in weak) {\n document.getElementById(\"weak-content-container\").innerHTML+=\n '<div id=\"' + weak[i] + '-text\">' + weak[i] + '</div><br>';\n }\n }\n adjustHeightMidContent();\n\n if(noEffect.length == 0 && immune.length ==0) {\n document.getElementById(\"no-effect-content-container\").style.height = \"0\";\n document.getElementById(\"immune-content-container\").style.height = \"0\";\n document.getElementById(\"no-effect-content-container\").style.width = \"0\";\n document.getElementById(\"immune-content-container\").style.width = \"0\";\n } \n else {\n if(noEffect.length > 0) {\n document.getElementById(\"no-effect-content-container\").innerHTML += '<h5 style=\"color: rgb(255, 204, 204);\">No Effect Against</h5>';\n for(var i in noEffect) {\n document.getElementById(\"no-effect-content-container\").innerHTML+=\n '<div id=\"' + noEffect[i] + '-text\">' + noEffect[i] + '</div><br>';\n }\n } else {\n document.getElementById(\"no-effect-content-container\").style.width = \"0%\";\n document.getElementById(\"immune-content-container\").style.width = \"100%\";\n }\n if(immune.length > 0) {\n document.getElementById(\"immune-content-container\").innerHTML += '<h5 style=\"color: rgb(204, 255, 204);\">Immune To</h5>';\n for(var i in immune) {\n document.getElementById(\"immune-content-container\").innerHTML+=\n '<div id=\"' + immune[i] + '-text\">' + immune[i] + '</div><br>';\n }\n } else {\n document.getElementById(\"no-effect-content-container\").style.width = \"100%\";\n document.getElementById(\"immune-content-container\").style.width = \"0%\";\n }\n }\n adjustHeightBottomContent();\n}",
"instructions() {\n this.canvas[1].font = \"20px Arial\";\n this.canvas[1].fillText('Goal: Avoid the monsters. Reach the princess.',10,105);\n }",
"function showTipTable(tableIndex, reportObjId)\r\n{\r\n var rows = tables[tableIndex].rows;\r\n var a = reportObjId - 1;\r\n\r\n if(rows.length != arrayMetadata[a].length)\r\n\tthrow new Error(\"rows.length=\" + rows.length+\" != arrayMetadata[array].length=\" + arrayMetadata[a].length);\r\n\r\n for(i=0; i<rows.length; i++) \r\n \trows[i].cells[1].innerHTML = arrayMetadata[a][i];\r\n}",
"function showTipTable(tableIndex, reportObjId)\r\n{\r\n var rows = tables[tableIndex].rows;\r\n var a = reportObjId - 1;\r\n\r\n if(rows.length != arrayMetadata[a].length)\r\n\tthrow new Error(\"rows.length=\" + rows.length+\" != arrayMetadata[array].length=\" + arrayMetadata[a].length);\r\n\r\n for(i=0; i<rows.length; i++) \r\n \trows[i].cells[1].innerHTML = arrayMetadata[a][i];\r\n}"
]
| [
"0.58480114",
"0.5510582",
"0.5442686",
"0.5438436",
"0.54304445",
"0.54039335",
"0.5368918",
"0.51778656",
"0.51649284",
"0.51649284",
"0.50955313",
"0.50470734",
"0.5015801",
"0.5010383",
"0.49946755",
"0.49886534",
"0.49717358",
"0.4961141",
"0.49541914",
"0.4941081",
"0.49245968",
"0.48719326",
"0.48711717",
"0.48690963",
"0.4867896",
"0.48519194",
"0.48435834",
"0.48142317",
"0.4793126",
"0.4793126"
]
| 0.67597437 | 0 |
================================================================================== =================================================================================== Sets the data for the energy table which is the third table of the data view. ==================================================================================== | function setEnergyValues(dgEnergy)
{
var impTbl = document.getElementById("InputEnergyTable");
//impTbl.innerHTML = "";
var keys = dgEnergy.keys()
var values = dgEnergy.values();
var tableData = "";
for (var i = 0; i < keys.length;i++)
{
if (i % 2 && i != 0)
tableData = tableData + "<tr><td>"+ keys[i]+ "</td><td>" + values[i] + "</td></tr>";
else
tableData = tableData + "<tr class=\"alt\"><td>"+ keys[i]+ "</td><td>" + values[i] + "</td></tr>";
}//end for
$('#InputEnergyTable').html(tableData);
//impTbl.innerHTML = tableData;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"setData(data) {\n this.dataAgents.map((d, idx) => d.setData(data[idx]));\n this.sheet.table.render();\n }",
"function setDataTbl(){\n var currentIndex = 1;\n var tablegroup = \"datagrpRestriction\";\n setTable(currentIndex, tablegroup, this.grid.getPrimaryKeysForRow(this));\t\n}",
"function set_data(){\n set_global_stats(STATS.global);\n\n set_most_least_infected_table(STATS.countries);\n\n apply_data_to_table({\n id: \"infected-list\",\n stats: STATS.countries,\n random: false\n });\n\n // Infected list pagination\n acl_set_paginate();\n\n // set_country_list();\n\n update_set_view_triggers();\n update_widget_triggers();\n\n update_countup();\n\n set_view();\n}",
"function setData() {\n\tvar rows = db.execute('SELECT * FROM igreja where igreja.id NOT IN (SELECT pregacao.igreja FROM igreja INNER JOIN pregacao ON igreja.id = pregacao.igreja WHERE pregacao.sermao =\"' + idSermao + '\") ');\n\tvar dataArray = [];\n\twhile (rows.isValidRow()) {\n\t\tvar vnome = rows.fieldByName('nome');\n\t\tvar vid = rows.fieldByName('id');\n\t\tdataArray.push({\n\t\t\ttitle : vnome,\n\t\t\thasCheck : false,\n\t\t\tid : vid,\n\t\t});\n\n\t\trows.next();\n\t\ttableview.setData(dataArray);\n\t};\n\tdb.close();\n}",
"function updateGlobalEnergyData(data) {\n globalEnergyData['values'] = [];\n for (var idx = 0; idx < data[0]['values'].length; idx ++) {\n var energyBreakup = data.map(elm => {return elm['values'][idx]});\n globalEnergyData['values'].push(energyBreakup);\n }\n globalEnergyData['keys'] = data.map(elm => elm['text']);\n }",
"function eDataDataTable(){\r\n\ttdType='3';\r\n\tvar url = 'productId.testobjectdata.attachments.list?productId='+productId+'&jtStartIndex=0&jtPageSize=10000';\r\n\tvar jsonObj = \t{\r\n\t\t\t\t\t\t\"Title\":\"EData\",\r\n\t\t\t\t\t\t\"url\":url,\r\n\t\t\t\t\t\t\"jtStartIndex\":0,\r\n\t\t\t\t\t\t\"jtPageSize\":1000,\r\n\t\t\t\t\t\t\"componentUsageTitile\":\"Test Data Plan\"\r\n\t\t\t\t\t};\r\n\tassignEDataDataTableValues(jsonObj);\r\n}",
"set data(newData){\n\t\tlet _self = this;\n\t\tif(!newData){\n\t\t\tconsole.log(\"set data with undefined\");\n\t\t\treturn;\n\t\t}\n\n\t\tif(this.dtInstance) {\n\t\t\t// this._data = this.prepareData(newData);\n\t\t\tthis._data = this.sortData(newData);\n\n\t\t\tthis.$timeout(function(){\n\t\t\t\t_self.updateTable();\n\t\t\t});\n\t\t} else {\n\t\t\tthis._data = newData;\n\t\t}\n\t}",
"function init () {\n data.forEach((tableData) => {\n let row = tbody.append(\"tr\");\n Object.values(tableData).forEach(value => {\n let cell = row.append(\"td\");\n cell.text(value);\n });\n })\n}",
"function init() {\n // Loop through each row in table\n tableData.forEach(function(UFOReport) {\n // Use d3 to append one table row \"tr\" for each UFO object\n var row = tbody.append(\"tr\");\n\n // Use \"Object.entries\" to console.log each UFO object value\n Object.entries(UFOReport).forEach(function ([key, value]) {\n\n // Use d3 to append 1 cell per UFO report value \n var cell = row.append(\"td\");\n // Use d3 to update each cell's text with UFO object value\n cell.text(value);\n });\n });\n}",
"set data(arr) {\n\t\tthis.wrapper.setData(arr);\n\t\tthis._tableData = arr;\n\t}",
"function Table1(){\n // Get a reference to the table body\n var tbody = d3.select(\"tbody\");\n // Use d3 to update each cell's text with\n tableData.forEach((UFO) => {\n var row = tbody.append(\"tr\");\n Object.entries(UFO).forEach(([key, value]) => {\n // For each row, Append a cell to the row for each value in the report object\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}",
"resetTableData() {\n this.gridData = this.defaultGridData;\n this.typesOfPlot = ['Cumulative frequency plot', 'Dot plot'];\n }",
"function setData() {\t\n\t\n\tvar db = Ti.Database.install('../products.sqlite','products');\n\n\tvar rows = db.execute('SELECT DISTINCT category FROM products');\n\n\t// create the array\n\tvar dataArray = [];\n\t\t\t\n\twhile (rows.isValidRow())\n\t{\n\t dataArray.push({title:'' + rows.fieldByName('category') + '', hasChild:true, path:'../products/products.js'});\n\t rows.next();\t\n\t};\n\t\n\t// set the array to the tableView\n\ttableview.setData(dataArray);\n}",
"function tableInit(my_data) {\n // Find the table\n // Use D3 to select the table\n var table = d3.select(\"#ufo-table\");\n //Remove the las tbody to avoid unwanted data\n var my_tbody = table.select('tbody');\n my_tbody.remove();\n //Create e new tbody entity to append the data\n var tbody = table.append(\"tbody\");\n // Build the table\n my_data.forEach((sighting) => {\n var row = tbody.append(\"tr\");\n Object.entries(sighting).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}",
"function allData() {\n tbody.html(\"\");\n tableData.forEach((report) => {\n var row = tbody.append(\"tr\");\n Object.entries(report).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n numberEvents.text(objectLength(tableData));\n}",
"function update_table(data){\n // Update the table\n tbody.selectAll('tr').remove();\n var rows = tbody.selectAll('tr')\n .data(data)\n .enter()\n .append('tr');\n // create a cell in each row for each column\n data.forEach((Report) => {\n // // // Step 2: Use d3 to append one table row `tr` for each UFO report object\n var row = tbody.append(\"tr\");\n // // // Step 3: Use `Object.entries` to console.log each UFO report value\n Object.entries(Report).forEach(([key, value]) => {\n var cell = row.append(\"td\"); // // // Step 4: Use d3 to append 1 cell per UFO report value\n cell.text(value); // // Step 5: Use d3 to update each cell's text with\n });\n });\n }",
"function init() {\n tableData.forEach((sightings) => {\n var row = tbody.append(\"tr\");\n Object.entries(sightings).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}",
"setData() {\r\n this.fireSlimGridEvent(\"onBeforeDataUpdate\", {});\r\n\r\n this.generateColumns();\r\n this.generateFilters();\r\n this.setOptions();\r\n\r\n this.dataView.beginUpdate();\r\n this.setDataViewData();\r\n this.dataView.endUpdate();\r\n\r\n this.fireSlimGridEvent(\"onDataViewUpdate\", {});\r\n this.fireSlimGridEvent(\"onAfterDataUpdate\", {});\r\n }",
"function updateEnvironmentalTable(data) {\n $('tr.env-param-row').each(function(i) {\n var tm = '<td>' + data[i]['timestamp'] + '</td>';\n var t = '<td>' + data[i]['environmental']['temperature'].value.toFixed(2) + '</td>';\n var p = '<td>' + data[i]['environmental']['pressure'].value.toFixed(2) + '</td>';\n var h = '<td>' + data[i]['environmental']['humidity'].value.toFixed(2) + '</td>';\n $(this).append(tm);\n $(this).append(t);\n $(this).append(p);\n $(this).append(h);\n\n });\n}",
"function TableDataXYZ(name, description, valueX, valueY, valueZ, unit) {\n var self = this;\n self.name = name;\n self.description = description;\n self.valueX = valueX;\n self.valueY = valueY;\n self.valueZ = valueZ;\n self.unit = unit;\n self.onOff = \"null\";\n}",
"function initTableData() {\n //get all data to local variable\n getData();\n\n if (!localDb.length) return;\n\n const fragment = document.createDocumentFragment();\n\n localDb.forEach((item) => {\n const row = createTableRow(item);\n fragment.appendChild(row);\n });\n\n tBody.appendChild(fragment);\n }",
"function RefreshTable() {\n dc.events.trigger(function () {\n alldata = tableDimension.top(Infinity);\n datatable.fnClearTable();\n datatable.fnAddData(alldata);\n datatable.fnDraw();\n });\n }",
"function displayData(){\r\n\t//define stuff to be displayed in table\r\n\tlet tableContents = [\r\n\t\t[\"Flow rate\", getFloat(1) + \" m³/h\"],\r\n\t\t[\"Energy Flow Rate\", getFloat(3) + \" GJ/h\"],\r\n\t\t[\"Velocity\", getFloat(5) + \" m/s\"],\r\n\t\t[\"Fluid sound speed\", getFloat(7) + \" m/s\"],\r\n\t\t[\"Positive accumulator\", getLong(9)],\r\n\t\t[\"Negative accumulator\", getLong(13)],\r\n\t\t[\"Positive energy accumulator\", getLong(17)],\r\n\t\t[\"Negative energy accumulator\", getLong(21)],\r\n\t\t[\"Net accumulator\", getLong(25)],\r\n\t\t[\"Net energy accumulator\", getLong(29)],\r\n\t\t[\"Temperature #1/inlet\", getFloat(33) + \" °C\"],\r\n\t\t[\"Temperature #2/inlet\", getFloat(35) + \" °C\"],\r\n\t\t[\"Analog input A13\", getFloat(37)],\r\n\t\t[\"Analog input A14\", getFloat(39)],\r\n\t\t[\"Analog input A15\", getFloat(41)],\r\n\t\t[\"Current input at A13\", getFloat(43) + \" mA\"],\r\n\t\t[\"Current input at A14\", getFloat(45) + \" mA\"],\r\n\t\t[\"Current input at A15\", getFloat(47) + \" mA\"],\r\n\t\t[\"PT100 resistance of inlet\", getFloat(77) + \" Ohm\"],\r\n\t\t[\"PT100 resistance of outlet\", getFloat(79) + \" Ohm\"],\r\n\t\t[\"Total travel time\", getFloat(81) + \" μs\"],\r\n\t\t[\"Delta travel time\", getFloat(83) + \" nano-seconds\"],\r\n\t\t[\"Upstream travel time\", getFloat(85) + \" μs\"],\r\n\t\t[\"Downstream travel time\", getFloat(87) + \" μs\"],\r\n\t\t[\"Output current\", getFloat(89) + \" mA\"],\r\n\t\t[\"Working step\", getInt8(92, 0)],\r\n\t\t[\"Signal quality\", getInt8(92, 1)],\r\n\t\t[\"Measured travel time / calculated travel time\", getFloat(97)],\r\n\t\t[\"Reynold's number\", getFloat(99)]\r\n\t];\r\n\t\r\n\t//clear table from old values\r\n\ttable.innerHTML = \"\";\r\n\t\r\n\t//for each array in tableContents\r\n\ttableContents.forEach(el => {\r\n\t\t//create a table row\r\n\t\tlet row = document.createElement(\"tr\");\r\n\t\t\r\n\t\t//add variable name to row\r\n\t\tlet varname = document.createElement(\"td\");\r\n\t\tvarname.innerHTML = el[0];\r\n\t\trow.appendChild(varname);\r\n\t\t\r\n\t\t//add variable value to row\r\n\t\tlet varvalue = document.createElement(\"td\");\r\n\t\tvarvalue.innerHTML = el[1];\r\n\t\trow.appendChild(varvalue);\r\n\t\t\r\n\t\t//add row to table\r\n\t\ttable.appendChild(row);\r\n\t});\r\n\t\r\n\t//display new dates\r\n\tlastServerUpdateSpan.innerHTML = serverLastUpdate;\r\n\tlastClientUpdateSpan.innerHTML = clientLastUpdate;\r\n}",
"function setMaterial()\n\t{\n\t\tvar rows = auxJobGrid.getSelectionModel().getSelections();\n\t\t\t\n\t\tif (rows.length > 0) \n\t\t{\n\t\t\tvar value = material.getValue();\t\t\t\n\t\t\t\n\t\t\tvar index = material.store.find('name', value);\n\t\t\tvar record = material.store.getAt(index);\n\t\t\n\t\t\tif (record != undefined) \n\t\t\t{\n\t\t\t\trows[0].set('material_cost', record.get('cost'));\n\t\t\t\trows[0].set('material', value);\n\t\t\t\trows[0].set('days', record.get('days'));\n\t\t\t\t\n\t\t\t\tsetScheduledDate(rows[0]);\n\t\t\t}\n\t\t}\t\t\n\t}",
"function populateTable(){\n // Remove previous tbody\n var tbody = d3.select(\"tbody\");\n tbody.remove();\n var table = d3.select(\"#ufo-table\");\n // Append new tbody\n table.append(\"tbody\");\n tbody = d3.select(\"tbody\");\n tableData.forEach(function(event) {\n // Append row\n var row = tbody.append(\"tr\");\n // Append columns\n Object.entries(event).forEach(function([key, value]) {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}",
"function dataLoad(){\n\n // Use d3 to get a reference to the table body\n var tbody = d3.select(\"tbody\");\n\n // Loop Through `data` and console.log each UFO Info report object\n tableData.forEach(UFOInfo => {\n console.log(UFOInfo);\n\n // Use d3 to append one table row `tr` for each UFO Info report object\n var row = tbody.append(\"tr\");\n\n // Use `Object entries to log each UFO Info value \n Object.entries(UFOInfo).forEach(([key,value]) =>{\n console.log(key,value);\n\n //Use d3 to append 1 cell per UFO Info(date, city, state, country, shape, duration, comment )\n var cell = row.append(\"td\");\n\n // Use d3 to update each cell's text with (date, city, state, country, shape, duration, comment )\n cell.text(value);\n });\n });\n}",
"set table(arg){\n\t\tthis.isTableClear = false;\n\t\tthis.goodsTable = [];\n\t\tthis.title = arg.title;\n\t\tvar index = 0;\n\t\tfor (var i= 0; i<arg.message.length; i++){\n\t\t\tlet goodsTable = arg.message[i];\n\t\t\tvar element = [];\n\t\t\t// - Loop through each goods table\n\t\t\tlet index = null;\n\t\t\tfor (index in goodsTable){\n\t\t\t\tlet item = {\n\t\t\t\t\titemName: index,\n\t\t\t\t\titemTranslate: \"\",\n\t\t\t\t\titemValues: \"\",\n\t\t\t\t\titemDimension: \"\"\n\t\t\t\t}\n\t\t\t\t// - Item translate\n\t\t\t\titem.itemTranslate = model_globalTables.translate(index);\n\t\t\t\t// - Item value\n\t\t\t\titem.itemValues = model_globalTables.value(item.itemName,goodsTable[index]);\n\t\t\t\tif (item.itemValues==\"\")\n\t\t\t\t\titem.itemValues = goodsTable[index];\n\t\t\t\t// - Item dimension\n\t\t\t\titem.itemDimension = model_globalTables.dimension(item.itemName);\n\t\t\t\t//Insert item to the array\n\t\t\t\telement.push(item);\n\t\t\t}\n\t\t\tthis.goodsTable.push(element);\n\t\t}\n\t}",
"function initializePrescriptionTable(data, updatePrescriptionCallback, success) {\n\n\n function apertureStop (cell) {\n\n // \n if (cell.getValue() == true) {\n return \"<span class=\\\"badge badge-info\\\">STOP</span>\";\n } else {\n return \"\";\n }\n }\n\n\n var updateCellProperties = function(value, data, cell, row, options, formatterParams){\n\n //value - the value of the cell\n //data - the data for the row the cell is in\n //cell - the DOM element of the cell\n //row - the DOM element of the row\n //options - the options set for this tabulator\n //formatterParams - parameters set for the column\n return \"<div></div>\"; // must return the html or jquery element of the html for the contents of the cell;\n }\n\n\n\n\n // convert to standard form \n lensTable = convertToLensTable(data); // fill in missing fields!\n\n // Tabulator \n lens.table = new Tabulator(\"#lens-table\", {\n cellEditCancelled:function(cell){ console.log(\"Edit cancelled\"); },\n cellEdited:function(cell){\n console.log(\"lens edited - update the prescription\");\n // console.log(cell);\n // cell.getRow().deselect(); \n updatedFieldCheck (cell); // check if a dependent cell was changed / updated \n updatePrescriptionCallback(cell); // other updates \n },\n data:lensTable,\n height:\"300px\",\n addRowPos:\"bottom\",\n layout:\"fitColumns\",\n selectable:true, \n movableRows:true,\n columns:[\n {rowHandle:true, formatter:\"handle\", headerSort:false, frozen:true, width:30, minWidth:30},\n //{title:\"Group\", field:\"group\", width:100, headerSort:false}, \n {title:\"Id\", field:\"id\", width:100, headerSort:false, width:50}, \n {title:\"Type\", field:\"type\", width:100, headerSort:false}, \n {title:\"Description\", field:\"description\", width:100, editor:\"input\", headerSort:false, width:200},\n {title:\"Ref. Index\", field:\"index\", width:100, mutator:Number, formatter: decimalPlaces, formatterParams:{ precision: 3, emptyVal: \"\" }, align:\"center\", editor:\"input\", headerSort:false, editable: editCheck, validator:[\"min:1.0\", \"max:5.0\"]},\n {title:\"Surf. R.\", field:\"radius\", width:100, mutator:Number, formatter: decimalPlaces, formatterParams:{ precision: 3, emptyVal: \"\" }, align:\"center\", editor:\"input\", headerSort:false, editable: editCheck},\n {title:\"Power\", field:\"power\", width:100, mutator:Number, formatter: decimalPlaces, formatterParams:{ precision: 3, emptyVal: \"\" }, align:\"center\", editor:\"input\", headerSort:false, editable: editCheck},\n {title:\"Thickness\", field:\"thickness\", width:100, mutator:Number, formatter: decimalPlaces, formatterParams:{ precision: 3, emptyVal: \"\" }, align:\"center\", editor:\"input\", headerSort:false, editable: editCheck},\n {title:\"Ap. Diameter\", field:\"aperture\", width:100, mutator:Number, formatter: decimalPlaces, formatterParams:{ precision: 3, emptyVal: \"\" }, align:\"center\", editor:\"input\", headerSort:false, editable: editCheck},\n {title:\"Stop Flag\", field:\"stop\", width:100, align:\"center\", width:100, headerSort:false, formatter:\"tickCross\", cellClick:tickToggle, formatterParams:{ allowEmpty:true, allowTruthy:true, tickElement:\"<span class=\\\"badge badge-info\\\">STOP</span>\", crossElement:\"\" }\n }],\n });\n\n\n // post loading of the table / we should check whether the prescriprion can be filled in\n\n\n\n // show it! \n // updatePrescriptionCallback ();\n\n\n /* JQuery */\n\n //Add row on \"Add Row\" button click\n $(\"#lens-table-add-row\").click(function(){\n // entry area here \n });\n\n //Delete row on \"Delete Row\" button click\n $(\"#lens-table-del-row\").click(function(){\n lens.table.deleteRow(1);\n });\n\n //Clear table on \"Empty the table\" button click\n $(\"#lens-table-clear\").click(function(){\n lens.table.clearData()\n });\n\n //Reset table contents on \"Reset the table\" button click\n $(\"#lens-table-reset\").click(function(){\n lens.table.setData(tabledata);\n });\n\n // succeesed \n success ();\n\n\n\n }",
"function InitGuiData()\n{\n // 0 fill our Data Tables...note that .fill(0) function not yet supported.\n for( var i = 0; i < NR_DATA_TABLE_LENGTH; i++ )\n {\n guiNrLabels[i] = \"\";\n guiNrUnits[i] = \"\";\n guiNrSizeof[i] = 0;\n guiNr0Values[i] = 0;\n guiNr1Values[i] = 0;\n guiNr2Values[i] = 0;\n guiNr3Values[i] = 0;\n }\n\n for( var i = 0; i < NM_DATA_TABLE_LENGTH; i++ )\n {\n guiNmLabels[i] = \"\";\n guiNmUnits[i] = \"\";\n guiNmSizeof[i] = 0;\n guiNmValues[i] = 0;\n }\n\n for( var i = 0; i < CR_DATA_TABLE_LENGTH; i++ )\n {\n guiCrLabels[i] = \"\";\n guiCrUnits[i] = \"\";\n guiCrSizeof[i] = 0;\n guiC0r0Values[i] = 0;\n guiC0r1Values[i] = 0;\n guiC0r2Values[i] = 0;\n guiC0r3Values[i] = 0;\n }\n\n for( var i = 0; i < CM_DATA_TABLE_LENGTH; i++ )\n {\n guiCmLabels[i] = \"\";\n guiCmUnits[i] = \"\";\n guiCmSizeof[i] = 0;\n guiC0mValues[i] = 0;\n }\n\n\n guiNrLabels[0] = \"Band\";\n guiNrLabels[1] = \"Technology\";\n}",
"function populateTable() {\n tableData.forEach(item => {\n tablerow = d3.select(\"tbody\").append(\"tr\")\n tablerow.append(\"td\").text(item.datetime)\n tablerow.append(\"td\").text(item.city)\n tablerow.append(\"td\").text(item.state)\n tablerow.append(\"td\").text(item.country)\n tablerow.append(\"td\").text(item.shape)\n tablerow.append(\"td\").text(item.durationMinutes)\n tablerow.append(\"td\").text(item.comments)\n });\n}"
]
| [
"0.61513656",
"0.6063266",
"0.60035765",
"0.591022",
"0.58577436",
"0.5847947",
"0.58167595",
"0.58074325",
"0.57826096",
"0.5726791",
"0.5700324",
"0.56770486",
"0.56290007",
"0.56025475",
"0.5591837",
"0.5583447",
"0.5567965",
"0.5562535",
"0.550695",
"0.5494547",
"0.54932976",
"0.5487086",
"0.5472801",
"0.54711586",
"0.5431608",
"0.5417367",
"0.5411479",
"0.53565013",
"0.53476715",
"0.5342962"
]
| 0.6096933 | 1 |
=================================================================================== ==================================================================================== Sets the impactor text which is the fours data table in the data view. ==================================================================================== | function setImpactorText(impactorText)
{
var impTbl = document.getElementById("ImpactorInfo");
$('#ImpactorInfo').html(impactorText);
//impTbl.innerHTML = impactorText;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function rowSetText(text) {\n rowClear();\n currentRow.append('div').classed('tbar-row-text', true)\n .text(text);\n }",
"function datasetText(dataset) {\r\n\treturn dataset;\r\n}",
"function _setDisplayText(oController) {\r\n\t\tvar oTextReader = oController.getView().getViewData().oTextReader;\r\n\t\tvar oSelectDialog = oController.byId(\"idGatewayCatalogListDialog\");\r\n\t\toSelectDialog.setTitle(oTextReader(\"selectService\"));\r\n\t\toSelectDialog.setNoDataText(oTextReader(\"noDataText\"));\r\n\t}",
"function impostaCausaliSpesa (list) {\n var opts = {\n aaData: list,\n oLanguage: {\n sZeroRecords: \"Nessun impegno associato\"\n },\n aoColumnDefs: [\n {aTargets: [0], mData: computeStringMovimentoGestione.bind(undefined, 'impegno', 'subImpegno', 'capitoloUscitaGestione')},\n {aTargets: [1], mData: readData(['subImpegno', 'impegno'], 'descrizione')},\n {aTargets: [2], mData: readData(['subImpegno', 'impegno'], 'importoAttuale', 0, formatMoney), fnCreatedCell: tabRight},\n {aTargets: [3], mData: readData(['subImpegno', 'impegno'], 'disponibilitaPagare', 0, formatMoney), fnCreatedCell: tabRight}\n ]\n };\n var options = $.extend(true, {}, baseOpts, opts);\n $(\"#tabellaMovimentiSpesa\").dataTable(options);\n }",
"function documentationTableLabel(value) { }",
"function showTipTable(tableIndex, reportObjId)\r\n{\r\n var rows = tables[tableIndex].rows;\r\n var a = reportObjId - 1;\r\n\r\n if(rows.length != arrayMetadata[a].length)\r\n\tthrow new Error(\"rows.length=\" + rows.length+\" != arrayMetadata[array].length=\" + arrayMetadata[a].length);\r\n\r\n for(i=0; i<rows.length; i++) \r\n \trows[i].cells[1].innerHTML = arrayMetadata[a][i];\r\n}",
"function showTipTable(tableIndex, reportObjId)\r\n{\r\n var rows = tables[tableIndex].rows;\r\n var a = reportObjId - 1;\r\n\r\n if(rows.length != arrayMetadata[a].length)\r\n\tthrow new Error(\"rows.length=\" + rows.length+\" != arrayMetadata[array].length=\" + arrayMetadata[a].length);\r\n\r\n for(i=0; i<rows.length; i++) \r\n \trows[i].cells[1].innerHTML = arrayMetadata[a][i];\r\n}",
"function changeInfoBar()\n {\n var ib = document.getElementById(\"wbInfoBar\") ;\n var tr = ib.rows[0] ;\n var tds = tr.cells ;\n for ( var i = 0 ; i < arguments.length ; i++ )\n {\n if ( i < tds.length )\n {\n tds[i].nodeValue = arguments[i] ;\n }\n }\n }",
"function imprime() {\n $('#nomina').DataTable({\n dom: 'Bfrtip',\n buttons: [{\n extend: 'copyHtml5',\n text: 'Copiar',\n title: `Carpintería Meraz | Nómina ${tipo} | ${anio}`,\n footer: true\n },\n {\n extend: 'excelHtml5',\n title: `Carpintería Meraz | Nómina ${tipo} | ${anio}`,\n filename: `Nomina-${tipo}-excel-${anio}`,\n footer: true\n },\n {\n extend: 'pdfHtml5',\n text: 'PDF',\n title: `Carpintería Meraz | Nómina ${tipo} | ${anio}`,\n filename: `Nomina-${tipo}-${anio}`,\n footer: true\n }]\n });\n}",
"function showTipTable(tableIndex, reportObjId)\n{\n var rows = tables[tableIndex].rows;\n var a = reportObjId - 1;\n\n if(rows.length != arrayMetadata[a].length)\n\tthrow new Error(\"rows.length=\" + rows.length+\" != arrayMetadata[array].length=\" + arrayMetadata[a].length);\n\n for(i=0; i<rows.length; i++) \n \trows[i].cells[1].innerHTML = arrayMetadata[a][i];\n}",
"function showTipTable(tableIndex, reportObjId)\n{\n var rows = tables[tableIndex].rows;\n var a = reportObjId - 1;\n\n if(rows.length != arrayMetadata[a].length)\n\tthrow new Error(\"rows.length=\" + rows.length+\" != arrayMetadata[array].length=\" + arrayMetadata[a].length);\n\n for(i=0; i<rows.length; i++) \n \trows[i].cells[1].innerHTML = arrayMetadata[a][i];\n}",
"_createDefaultHeaderText() {\n const name = this.name;\n if (!name && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw getTableTextColumnMissingNameError();\n }\n if (this._options && this._options.defaultHeaderTextTransform) {\n return this._options.defaultHeaderTextTransform(name);\n }\n return name[0].toUpperCase() + name.slice(1);\n }",
"function setDamage(txtDamage)\n\t{\n\t\t\n\n\t\t$(\"#LB_Damage\").text( damage1 + \" \" + dist +\" km \"+ damage2);\n\n\t\tvar impTbl = document.getElementById(\"DamageInfo\");\n\t\t\n\t\t$('#DamageInfo').html(txtDamage);\n\t\t//impTbl.innerHTML = txtDamage;\n\t}",
"setTextTable(table)\n {\n for (let i in this.registry) {\n // Skip if the textTable is empty\n if (this.registry[i] === undefined || typeof(this.registry[i]) !== \"object\") {\n continue;\n }\n this.registry[i] = table;\n }\n this.currentTable = table;\n this.refresh();\n }",
"function setHeaderForNoFilter(){\n\t//Change table header text\n\t$('tr#conceptcodes_filter_table_header').addClass(\"hidden\");\n\t$('tr#conceptcodes_table_header').removeClass(\"hidden\");\n}",
"function default_table(){\n tableData.forEach((sightings) => {\n var record = tbody.append(\"tr\");\n Object.entries(sightings).forEach(([key, value]) => {\n var data_value = record.append(\"td\");\n data_value.text(value);\n });\n });\n}",
"function setHeaderForFilter(){\n\t//Change table header text\n\t$('tr#conceptcodes_table_header').addClass(\"hidden\");\n\t$('tr#conceptcodes_filter_table_header').removeClass(\"hidden\");\n}",
"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 showNewText(text) {\n firstText.innerHTML = `${text}`;\n gsap.to(\".m402-text-relative\", {\n duration: 0.3,\n opacity: 1\n });\n}",
"function showNewText(text) {\n firstText.innerHTML = `${text}`;\n gsap.to(\".m402-text-relative\", {\n duration: 0.3,\n opacity: 1\n });\n}",
"function setText(text)\n {\n svg.selectAll(\".label\").text(text);\n }",
"setText () {\r\n const O = this;\r\n O.placeholder = \"\";\r\n if (O.is_multi) {\r\n const sels = O.E.find(':checked').not(':disabled'); //selected options.\r\n\r\n if (settings.csvDispCount && sels.length > settings.csvDispCount) {\r\n if (sels.length === O.E.find('option').length && settings.captionFormatAllSelected) {\r\n O.placeholder = settings.captionFormatAllSelected.replace(/\\{0\\}/g, sels.length);\r\n }\r\n else {\r\n O.placeholder = settings.captionFormat.replace(/\\{0\\}/g, sels.length);\r\n }\r\n }\r\n else {\r\n O.placeholder = sels.toArray().map(selected => selected.innerText).join(', ');\r\n }\r\n }\r\n else {\r\n O.placeholder = O.E.find(':checked').not(':disabled').text();\r\n }\r\n\r\n let is_placeholder = false;\r\n\r\n if (!O.placeholder) {\r\n\r\n is_placeholder = true;\r\n\r\n O.placeholder = O.E.attr('placeholder');\r\n if (!O.placeholder) //if placeholder is there then set it\r\n O.placeholder = O.E.find('option:disabled:checked').text();\r\n }\r\n\r\n O.placeholder = O.placeholder ? (`${settings.prefix} ${O.placeholder}`) : settings.placeholder;\r\n\r\n //set display text\r\n O.caption.text(O.placeholder);\r\n if (settings.showTitle) O.CaptionCont.attr('title', O.placeholder);\r\n\r\n //set the hidden field if post as csv is true.\r\n const csvField = O.select.find('input.HEMANT123');\r\n if (csvField.length) csvField.val(O.getSelStr());\r\n\r\n //add class placeholder if its a placeholder text.\r\n if (is_placeholder) O.caption.addClass('placeholder'); else O.caption.removeClass('placeholder');\r\n return O.placeholder;\r\n }",
"function displayFactText(currentFact, positionId) {\n document.getElementById(positionId).innerHTML = currentFact.text;\n}",
"set headerText(aValue) {\n this._headerText = aValue;\n this._widget.setAttribute(\"headerText\", aValue);\n }",
"function initTable() {\r\n\r\n const TaskTable = document.getElementById('task-table'); //recupero tabella da svuotare, attarverso il suo id\r\n \r\n TaskTable.innerHTML = ''; //svuoto la tabella, e poi inserisco nulla('')\r\n\r\n }",
"function init () {\n data.forEach((tableData) => {\n let row = tbody.append(\"tr\");\n Object.values(tableData).forEach(value => {\n let cell = row.append(\"td\");\n cell.text(value);\n });\n })\n}",
"function drawTable() {\n var stat = getState(cm);\n _replaceSelection(cm, stat.table, insertTexts.table);\n}",
"function renderIn_modalVerse() {\r\n\t\t$('.populated_verse_with_ajax').html(\r\n\t\t\t'<span>' + $('.populated_verse_with_ajax').text() + '</span>'\r\n\t\t);\r\n\t\t$(\".populated_verse_with_ajax\").textfill({maxFontPixels:200});\r\n\r\n\r\n\t}",
"function renderIn_modalVerse() {\r\n\t\t$('.populated_verse_with_ajax').html(\r\n\t\t\t'<span>' + $('.populated_verse_with_ajax').text() + '</span>'\r\n\t\t);\r\n\t\t$(\".populated_verse_with_ajax\").textfill({maxFontPixels:200});\r\n\r\n\r\n\t}",
"function renderIn_modalVerse() {\r\n\t\t$('.populated_verse_with_ajax').html(\r\n\t\t\t'<span>' + $('.populated_verse_with_ajax').text() + '</span>'\r\n\t\t);\r\n\t\t$(\".populated_verse_with_ajax\").textfill({maxFontPixels:200});\r\n\r\n\r\n\t}"
]
| [
"0.5730968",
"0.5560151",
"0.5478787",
"0.5443164",
"0.5415416",
"0.5345215",
"0.5345215",
"0.532174",
"0.5284046",
"0.5278402",
"0.5278402",
"0.52751315",
"0.52326137",
"0.52229834",
"0.5205857",
"0.5204834",
"0.5188104",
"0.5175853",
"0.51694655",
"0.51694655",
"0.51572",
"0.51359767",
"0.51001257",
"0.50870246",
"0.50822824",
"0.50759906",
"0.5072552",
"0.5069267",
"0.5069267",
"0.5069267"
]
| 0.74685097 | 0 |
================================================================================== =================================================================================== Sets if a fireball has been seen which is the final table of the data view. =================================================================================== | function setFireballSeen(fireArray)
{
var impTbl = document.getElementById("FireballTable");
//impTbl.innerHTML = "";
var keys = fireArray.keys()
var values = fireArray.values();
var tableData = "";
//if dist is 0 do not display the exposure, the last value in the fire array.
var display_exposure = dist == 0? 1: 0;
for (var i = 0; i < keys.length - display_exposure;i++)
{
if (i % 2 && i != 0)
tableData = tableData + "<tr><td>"+ keys[i]+ "</td><td>" + values[i] + "</td></tr>";
else
tableData = tableData + "<tr class=\"alt\"><td>"+ keys[i]+ "</td><td>" + values[i] + "</td></tr>";
}//end for
$('#FireballTable').html(tableData);
//impTbl.innerHTML = tableData;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function markFlag() {\n let $td = $(this)\n if (unclickable(this)) {\n return false;\n }\n let id = $td.attr(\"id\")\n let cell = game.getCellByID(id);\n if (!cell.hasRevealed) {\n if (cell.hasFlag) {\n cell.hasFlag = false\n flagCount--\n } else {\n cell.hasFlag = true\n flagCount++\n }\n render()\n }\n return false\n}",
"toggleViewAllEmployeeTable(){\n\n if(this.viewAllEmployeeTable == false){\n this.viewAllEmployeeTable =true;\n }else {\n this.viewAllEmployeeTable = false;\n }\n\n }",
"function WeAreCurrentlyShowingFriendsLeagueTable() {\n\n var CurrentlyShowingFriendsTable = false;\n\n if (displaymode == \"m\") { //movile view\n if (($('#panel3').is(\":visible\") == true) && ($('.FriendsLeaderboard').css('display') == \"block\")) {\n CurrentlyShowingFriendsTable = true;\n }\n }\n else {\n //web view - we are always showing the friends table!!!!!!\n CurrentlyShowingFriendsTable = true;\n }\n return CurrentlyShowingFriendsTable;\n}",
"isFlaged(row, column){\n\t\treturn this.table[row][column].flag;\n\t}",
"function allTablesHidden() {\n return $(\"table.hidden-table\").length == $(\"table.result\").length;\n}",
"allTerritoriesClaimed(){\r\n let claimedCount = 0;\r\n Object.keys(this.mapGrid.hashOfTiles).forEach( pointer => {\r\n let tile = this.mapGrid.hashOfTiles[pointer];\r\n if (tile.status === true){\r\n claimedCount += 1;\r\n }\r\n })\r\n \r\n if (claimedCount === this.mapGrid.size - 6){\r\n this.claimTerritoryPhase = false; // this will NOT be REACTIVATED\r\n this.initialPlacementPhase = true; \r\n } \r\n }",
"_hasTable () {\n return 0 < this._tables.length;\n }",
"function showTable(stateID) {\n\n let theData;\n\n if (stateID == 0) {\n theData = bigData;\n } else {\n theData = dataset[stateID];\n }\n\n // If there is no shooting we return\n if (!theData || theData.length == 0) {\n return;\n }\n\n svgTable.selectAll('table').remove();\n\n let table = svgTable\n .append(\"table\")\n .attr(\"class\", \"table table-condensed table-striped\");\n\n let thead = table.append(\"thead\");\n thead.html('<th>Date</th><th>City</th><th>Age of shooter</th><th>Number of victims</th><th>Fate of Shooter</th>');\n\n let tbody = table.append(\"tbody\")\n .on(\"wheel.zoom\", function () {\n let direction = d3.event.wheelDelta < 0 ? 'down' : 'up';\n\n if (direction === 'up') {\n tableFirstId--;\n } else {\n tableFirstId++;\n }\n\n showTable(currentId);\n });\n\n let date, age, city, fate, victims;\n\n if (tableFirstId >= theData.length) {\n tableFirstId --;\n }\n\n if (tableFirstId < 0) {\n tableFirstId = 0;\n }\n\n theData.slice(tableFirstId, tableFirstId + 9).forEach(function (d) {\n date = \"Unknown\";\n age = \"-\";\n city = \"Unknown\";\n fate = \"Unknown\";\n victims = \"-\";\n\n if (d.fields.date) {\n date = d.fields.date;\n }\n\n if (d.fields.average_shooter_age) {\n age = d.fields.average_shooter_age;\n }\n\n if (d.fields.city) {\n city = d.fields.city;\n }\n\n if (d.fields.fate_of_shooter_at_the_scene) {\n fate = d.fields.fate_of_shooter_at_the_scene;\n }\n\n if (d.fields.number_of_victims_injured) {\n victims = d.fields.number_of_victims_injured;\n }\n\n tbody.append('tr')\n .html(function () {\n return '<td>' + date + '</td>' + '<td>' + city + '</td>' + '<td>' + age + '</td>' + '<td>' + victims + '</td>' + '<td>' + fate + '</td>';\n })\n });\n\n\n // Legend plot\n table.append('g').append(\"text\")\n .attr(\"transform\", \"translate(0,\" + 60 + \")\")\n .attr('y', function (d) {\n return 0;\n })\n .style('font-style', 'italic')\n .text(function (d) {\n if (stateID === 0) {\n return \"Fig. 7 : Different mass shooting in the US\";\n }\n if (stateID < 10) {\n return \"Fig. 7 : Different mass shooting in \" + getKeyByValue(fips, \"0\" + stateID);\n }\n return \"Fig. 7 : Different mass shooting in \" + getKeyByValue(fips, \"\" + stateID);\n }).attr('x', function () {\n return 0;\n });\n}",
"function userTableShowOthers() {\n\tvar tbl = document.getElementById('user-stats-table');\n\tvar row = tbl.rows[0];\n\tvar end = row.cells.length-1;\n\tvar idlast = row.cells[end].id;\n\tif (idlast == \"show_others\") return true;\n\treturn false;\n}",
"function addRivalStatus(rival, bool) {\n return footballTeam.opponents.forEach(opponent => {\n opponent.name === rival ? opponent.isMyRival = bool : opponent.isMyRival = false\n console.log(footballTeam)\n })\n}",
"noResultsOnTable() {\n this.membersList.length ? this.noResults = false : this.noResults = true;\n }",
"displayTable() {\n const tableContainer = document.querySelector('#tableContainer');\n if (party.guests.length) {\n tableContainer.style.visibility = 'visible';\n } else {\n tableContainer.style.visibility = 'hidden';\n }\n }",
"function checkFireTopoPetsFound() {\n\tif (topoPetsCaught.totalFIRE == getTotalAmountFireTopoPets()) {\n\t\tdocument.getElementById(\"achievementAllFireTopoPets\").style.display = \"block\";\n\t}\n}",
"function tableOnClick(x, y) {\n var newLife = !grid[y][x];\n grid[y][x] = newLife;\n var $td = $(\"#\" + x + \"x\" + y);\n if (newLife)\n $td.attr('class', 'live');\n else\n $td.attr('class', 'dead');\n }",
"function ToggleAuctionsTable() {\n var img, tbl;\n if ((img = $('AnalyseImg')) && (tbl = $('AuctionsTable'))) {\n var path = 'module/analyse/layout/default/images/';\n tbl.toggle();\n if (!tbl.visible()) {\n // hide auction table\n img.src = path + 'show.gif';\n img.alt = '⇓';\n img.onmouseover = function() { Tip(AnalyseShowAuctions) };\n } else {\n // show auction table\n img.src = path + 'hide.gif';\n img.alt = '⇑';\n img.onmouseover = function() { Tip(AnalyseHideAuctions) };\n }\n }\n return false;\n}",
"function genFoughtGrid(){\n for(var i=0;i<fought.length;i++){\n for(var j=0;j<fought.length;j++){\n fought[i][j] = false;\n }\n }\n}",
"function isAllDone() {\n\t\tvar allDone = $(\".finnished\");\n\t\tif (num === allDone.length) {\n\t\t\tvar rightCell = $(\".right_cell\");\n\t\t\trightCell.append(\"<p>Yes you did it! Good work</p>\");\n\t\t}\n\t}",
"changeTasted(state, beerId) {\n state.indexedBeers[beerId].tasted = !state.indexedBeers[beerId].tasted;\n }",
"function RefreshTable() {\n dc.events.trigger(function () {\n alldata = tableDimension.top(Infinity);\n datatable.fnClearTable();\n datatable.fnAddData(alldata);\n datatable.fnDraw();\n });\n }",
"function toggleResults() {\n var tableVisibility = document.getElementById(\"dataTable\");\n if (tableVisibility.style.display === \"block\") {\n tableVisibility.style.display = \"none\";\n document.getElementById(\"btnDisplayResults\").innerText=\"View Race Results\";\n } else {\n tableVisibility.style.display = \"block\";\n document.getElementById(\"btnDisplayResults\").innerText=\"Hide Race Results\";\n }\n }",
"isSunk() {\n if(this.hits === this.length) {\n this.sunk = true\n }\n \n }",
"gameIsFinished() {\n return this.rows[0].some(\n cell => cell.filled \n );\n }",
"function updateIsSeen(bool, id){\n var idBase = id.replace(/seenButton_/g, \"\");\n var cellId = \"seenCell_\" + idBase;\n var titleId = \"titleCell_\" + idBase;\n if(bool){\n //If movie was seen\n updateSeenIcon(true, cellId);\n updateIsSeenOnParse($(\"#\" + titleId).html(), true);\n }else{\n //If movie wasnt seen\n updateSeenIcon(false, cellId);\n updateIsSeenOnParse($(\"#\" + titleId).html(), false);\n }\n}",
"function show() {\n var bad = false;\n var tbody = document.createElement(\"tbody\");\n for (i = 0; i < dim; i++) {\n var tri = document.createElement(\"tr\");\n for (k = 0; k < dim; k++) {\n var ibody = document.createElement(\"tbody\");\n for (j = 0; j < dim; j++) {\n var trj = document.createElement(\"tr\");\n for (l = 0; l < dim; l++) {\n var text = show_cell(i, j, k, l);\n if (text == '?')\n bad = true;\n var node = document.createTextNode(text);\n var tdl = document.createElement(\"td\");\n if (board[i][j][k][l].set != previous[i][j][k][l].set)\n tdl.setAttribute(\"class\", \"changed\");\n tdl.setAttribute(\"align\", \"center\");\n tdl.appendChild(node);\n trj.appendChild(tdl);\n }\n ibody.appendChild(trj);\n }\n var itbl = document.createElement(\"table\");\n itbl.setAttribute(\"border\", 1);\n itbl.setAttribute(\"width\", \"100%\");\n itbl.appendChild(ibody);\n var tdk = document.createElement(\"td\");\n tdk.setAttribute(\"align\", \"center\");\n tdk.appendChild(itbl);\n tri.appendChild(tdk);\n }\n tbody.appendChild(tri);\n }\n var tbl = document.createElement(\"table\");\n tbl.setAttribute(\"border\", 1);\n tbl.setAttribute(\"align\", \"center\");\n tbl.appendChild(tbody);\n document.body.appendChild(tbl);\n window.scrollBy(0, 1000);\n duplicate(previous, board);\n return bad;\n}",
"function lander_table( lander, isnew = true ){\n var table = {};\n if(isnew){ \n table = {' ': [ ' ', 'current', 'New', '']};\n }\n for( let key in engine.perks.lander ) if(key != 'initial_resources')\n if(landerperks[key]) {\n /* Add the new and the old value to the table for displaying */\n let title_span = $(\"<span><\\span>\").text(landerperks[key].title);\n title_span.mouseenter( function(){ display.showtooltip(this,landerperks[key].description); } );\n title_span.mouseout( function(){ display.hidetooltip(); } );\n table[key] = [title_span];\n\n if(isnew) {\n let n=1;\n if( engine.next_perks.lander[key] )\n n = Math.floor(engine.next_perks.lander[key]*100)/100;\n table[key][1] = [n.toPrecision(3)];\n n = Math.floor(lander[key]*100)/100;\n table[key][2] = [n.toPrecision(3)];\n\n if( engine.state.unlocks.geneticengineering == 'unlocked' ){\n /* Allows the player to select individual traits */\n let addbutton = $(\"<span><\\span>\").text('Isolate');\n addbutton.addClass(\"btn btn-info\");\n addbutton.click( function(){\n isolate_trait(lander, key);\n display.hidetooltip();\n display.dismissPopup();\n });\n addbutton.mouseenter( function(){\n display.showtooltip(addbutton,'Pick only this feature, but destroy the egg') ; \n } );\n addbutton.mouseout( function(){ display.hidetooltip(); } ); \n table[key][3] = [addbutton];\n } else {\n table[key][3] = [''];\n }\n } else {\n let n=Math.floor(engine.next_perks.lander[key]*100)/100;\n table[key][1] = [n.toPrecision(3)];\n }\n }\n return table;\n}",
"function tableCompleted(tableId){\n $(tableId).parent().parent().parent().collapse(\"toggle\");\n $(tableId).parent().parent().parent().prev().removeClass('card-header');\n $(tableId).parent().parent().parent().prev().addClass('colour-complete');\n $(tableId).parent().parent().parent().prev().children('.float-right').children('a').text(\"Completed\");\n}",
"function class_showTablesNow()\r\n\t{\r\n\t\tvar\t\ttbl = document.getElementById( \"browseTableDefn2\" );\r\n\t\t\t\r\n\t\tif ( tbl != null )\r\n\t\t{\t\r\n\t\t\tvar\t\tarrayPageSize;\r\n\t\t\r\n\t\t\tvar\t\ttblStyle = tbl.style;\r\n\r\n\t\t\ttblStyle.display = \"block\";\r\n\r\n\t\t\tif ( flashTableRefresh )\r\n\t\t\t{\r\n\t\t\t\tif ( totalPages !== currentPageNum )\r\n\t\t\t\t{\r\n\t\t\t\t\t// Currently the only time the window needs to be flashed is\r\n\t\t\t\t\t// when the pagesize changes of the last page of results.\r\n\t\t\t\t\t// Going to assume for the time being to scroll to the bottom of the page\r\n\t\t\t\t\t// when not on the last page.\r\n\t\t\t\t\tarrayPageSize = getPageSize();\r\n\r\n\t\t\t\t\twindow.scrollTo( 0, arrayPageSize[3] );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tflashTableRefresh = false;\r\n\t\t\t\r\n\t\t\tif ( window.Sidebar !== undefined && Sidebar !== undefined && Sidebar.initialized )\r\n\t\t\t{\r\n\t\t\t\tSidebar.setClickerHeight();\r\n\t\t\t}\r\n\t\t}\r\n\t}",
"function setTable() {\n var elemT = $(\"#in_tableh\");\n if (elemT.html() == \"true\") {\n elemT.html(\"false\");\n if ($(\"#is_ownerh\").html() == \"true\")\n sittedTable = new Table($(\"#table_idh\").html(),true);\n else\n sittedTable = new Table($(\"#table_idh\").html(),false);\n }\n}",
"function renderTable() {\n clearTable();\n showTable();\n}",
"function toggleResultTable(showTable) {\n var table = document.getElementById(\"resultArea\");\n if (showTable) {\n table.style.display = \"block\";\n checkPages();\n updateDisplayedPage()\n } else {\n table.style.display = \"none\";\n }\n}"
]
| [
"0.5634471",
"0.5581494",
"0.55257374",
"0.5500357",
"0.5315188",
"0.530258",
"0.5281695",
"0.52091527",
"0.5147832",
"0.51279825",
"0.5124307",
"0.5118517",
"0.51015556",
"0.50693595",
"0.5052583",
"0.50250953",
"0.501962",
"0.501859",
"0.5016423",
"0.5005908",
"0.5004938",
"0.5004288",
"0.50016445",
"0.49900916",
"0.49766934",
"0.49617004",
"0.49430153",
"0.4940633",
"0.49378482",
"0.49375132"
]
| 0.69569063 | 0 |
===================================================================================== ======================================================================================= draw the scale line beneath the crater. ======================================================================================= | function drawScale()
{
var c=document.getElementById("Crater_Area");
var ctx=c.getContext("2d");
ctx.font = '10pt Arial';
var diam = nbFormat(dataProvider.impactor.crDiam)+"m";
var depth = nbFormat(dataProvider.impactor.crDepth)+"m";
var dl =depth.length;
var dil = diam.length;
ctx.fillText(diam, c.width/2 -(dil*4.2), c.height - 18);
ctx.fillText(depth, c.width -165 -(dl*4.2), c.height - 70);
}//========================================================================================== | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createX(){\n line(0, 0, -vScale/2, -vScale/2);\n line(0, 0, vScale/2, -vScale/2);\n line(0, 0, vScale/2, vScale/2);\n line(0, 0, -vScale/2, vScale/2);\n}",
"function renderAxisLine() {\n ctx.save();\n ctx.setLineDash(renderAttrs.lineDash || []);\n if( renderAttrs.orientation === 'horizontal') {\n drawLine( ctx, { x: renderMin, y: originCrossAxisCoord },\n { x: renderMax, y: originCrossAxisCoord });\n }\n else {\n drawLine( ctx, { x: originCrossAxisCoord, y: renderMin },\n { x: originCrossAxisCoord, y: renderMax });\n }\n ctx.restore();\n }",
"function drawScales() {\n p.getBubbleDrawer().drawScale(guiAxes.X, scales.mins[guiAxes.X], scales.maxs[guiAxes.X], scales.steps[guiAxes.X]);\n p.getBubbleDrawer().drawScale(guiAxes.Y, scales.mins[guiAxes.Y], scales.maxs[guiAxes.Y], scales.steps[guiAxes.Y]);\n}",
"biggerLine() {\n this.ctx.lineWidth++\n }",
"function drawZoom() {\n\t\tvar text = 'x' + zoomMultiplier.toFixed(1);\n\n\t\tctx.beginPath();\n\t\tctx.textAlign = 'left';\n\t\tctx.textBaseline = 'top';\n\t\tctx.fillStyle = '#777';\n\t\tctx.font = zoomMultiplierFont();\n\t\tctx.fillText(text, 5, 5);\n\t}",
"function drawScale() {\n //Define scale dimensions\n var margin = 30, scaleHeight = 20;\n var x = margin;\n var y = mapHeight - margin - scaleHeight;\n\n //Add rectangles to display legend colors\n mapsvg.append(\"g\").attr(\"id\", \"scaleg\")\n for (var i = 0; i < 200; i += 2) {\n mapsvg.select(\"#scaleg\").append(\"rect\")\n .datum(i)\n .attr(\"class\", \"scalerect\")\n .attr(\"x\", x + i)\n .attr(\"y\", y)\n .attr(\"width\", 2)\n .attr(\"height\", scaleHeight)\n }\n\n //Add outline to scale\n mapsvg.append(\"rect\")\n .attr(\"x\", x)\n .attr(\"y\", y)\n .attr(\"width\", 200)\n .attr(\"height\", scaleHeight)\n .attr(\"fill\", \"none\")\n .attr(\"stroke\", \"#000\")\n .attr(\"stroke-width\", 1)\n\n //Add label to scale\n mapsvg.append(\"text\")\n .attr(\"id\", \"scalelabel\")\n .attr(\"x\", x)\n .attr(\"y\", y - 25)\n\n //Add label to show the units of the scale\n mapsvg.append(\"text\")\n .attr(\"id\", \"scaleunits\")\n .attr(\"x\", x)\n .attr(\"y\", y - 10)\n .attr(\"font-size\", 12)\n\n //Add group to store axis on bottom of scale.\n mapsvg.append(\"g\")\n .attr(\"id\", \"scaleaxis\")\n .attr(\"transform\", \"translate(\" + x + \", \" + (y + scaleHeight) + \")\")\n\n updateScale()\n}",
"scale() {\n this.p.scale(this._scaleFactor);\n }",
"scale() {\n this.p.scale(this._scaleFactor);\n }",
"scale() {\n this.p.scale(this._scaleFactor);\n }",
"function drawline(data, Xscale, Yscale){\n\n var lsCoef = LeastSquares(data);\n\n var lineFunction = d3.line()\n .x(function(d) { return d.x; })\n .y(function(d) { return d.y; })\n .curve(d3.curveLinear);\n \n //Append line\n svg.append('path')\n .attr(\"stroke-width\", 2)\n .attr(\"class\", \"svgobject\")\n .attr(\"stroke\", \"black\")\n .attr('d', lineFunction([{\"x\": Xscale(canvas.min.x) , \"y\": Yscale(lsCoef.a + lsCoef.b*canvas.min.x)},\n {\"x\": Xscale(0) , \"y\": Yscale(lsCoef.a)},\n {\"x\": Xscale(-lsCoef.a/lsCoef.b) , \"y\": Yscale(0)},\n {\"x\": Xscale(canvas.max.x), \"y\": Yscale(lsCoef.a + lsCoef.b*canvas.max.x) }]));\n\n //Plot residuals on data from regression\n var figureresidualsvsfitted = svgres.selectAll(\"dot\")\n .data(data)\n .enter().append(\"circle\"); \n\n //Add attributes to plotted points\n figureresidualsvsfitted.attr(\"cx\", function(d) { return Yscale(d.y); })\n .attr(\"cy\", function(d) { \n var residuals = d.y - (lsCoef.a + lsCoef.b*d.x);\n return Yscale(residuals); })\n .attr(\"class\", \"mydot svgobject\")\n .style(\"fill\", canvas.colorres)\n .attr(\"r\", canvas.radius); \n\n}",
"function drawSplines() {\n}",
"function makeLine (count) {\n let scale = bel`<div class=${css.scale}></div>`\n for (let i = 0; i < count; i++) {\n let line = bel`<span class='${css.line}'></span>`\n scale.append(line)\n }\n return scale\n }",
"function drawToScale(input) {\n return height - ( (input-minX)*height) / (maxX-minX); \n }",
"draw(){\n\t\t\n\t\tlet height = this.height; //100\n\t\tlet width = this.width; //100\n\t\t\n\t\tlet ctx = this.ctx;\n\t\t//save last frame\n\t\tlet lastFrame = ctx.getImageData(0, 0, width, height);\n\t\t//clear canvas\n\t\tctx.clearRect(0, 0, width, height);\n\t\t//now, move frame 1 pixel to the left\n\t\tctx.putImageData(lastFrame, -1, 0);\n\t\t\n\t\t//then, draw the lines\n\t\tfor(var line of this.lines){\n\t\t\t\n\t\t\t\n\t\t\tlet range = line.maxValue - line.minValue;\n\t\t\tlet value = line.value;\n\t\t\t\n\t\t\t//Multiply line's value by the ratio between height and range, to get effective range the same but zero at the top\n\t\t\tvalue *= 1 * height / range;\n\t\t\t\n\t\t\t//Now, zero the value by adding the difference between minValue and 0\n\t\t\tvalue -= line.minValue * height / range;\n\t\t\t\n\t\t\t//Now, invert by subtracting from height\n\t\t\tvalue = height - value;\n\t\t\t\n\t\t\tctx.beginPath();\n\t\t\tctx.strokeStyle = line.color;\n\t\t\tctx.moveTo(width - 2, value);\n\t\t\tctx.lineTo(width, value);\n\t\t\tctx.stroke();\n\t\t}\n\t}",
"render(g) {\n let xStart = g.axesPadding+g.axesLineWidth;\n let xEnd = g.width - g.axesPadding;//*2 - g.dataMargin;\n let yStart = g.height-g.axesPadding-g.axesLineWidth/2+1;\n let yDist = g.yMax-g.yMin;\n\n let minYPerc = (this.minimum-g.yMin) / yDist;\n let avgYPerc = (this.average-g.yMin) / yDist;\n let maxYPerc = (this.maximum-g.yMin) / yDist;\n\n let minYPos = g.height * minYPerc - (g.axesPadding*2)-g.axesLineWidth/2;\n let avgYPos = g.height * avgYPerc - (g.axesPadding*2)-g.axesLineWidth/2;\n let maxYPos = g.height * maxYPerc - (g.axesPadding*2)-g.axesLineWidth/2;\n\n // max:\n g.drawLine(xStart, yStart-maxYPos-g.axesLineWidth+this.minLineWidth/2, \n xEnd, yStart-maxYPos-g.axesLineWidth+this.minLineWidth/2, this.maxLineColor, this.maxLineWidth);\n g.drawText(this.maximum, xEnd, yStart-maxYPos-g.textOffset, null, g.graphFont, this.maxLineColor);\n // avg:\n g.drawLine(xStart, yStart-avgYPos-g.axesLineWidth+this.avgLineWidth/2, \n xEnd, yStart-avgYPos-g.axesLineWidth+this.avgLineWidth/2, this.avgLineColor, this.avgLineWidth);\n g.drawText(this.average, xEnd, yStart-avgYPos-g.textOffset, null, g.graphFont, this.avgLineColor);\n // min:\n g.drawLine(xStart, yStart-minYPos-g.axesLineWidth+this.maxLineWidth/2, \n xEnd, yStart-minYPos-g.axesLineWidth+this.maxLineWidth/2, this.minLineColor, this.minLineWidth);\n g.drawText(this.minimum, xEnd, yStart-minYPos-g.textOffset, null, g.graphFont, this.minLineColor);\n }",
"function scaleDrawing() {\n 'use strict';\n var viewport = $('#model1').find('#viewport')[0];\n if (!viewport)\n return;\n var bbox = viewport.getBBox();\n // truncate to 2 decimal places\n var scale = ((($('.jumbotron').width()/bbox.width)*100)|0)/100;\n drawing.transform(scale, 0, 0);\n $('#model1').attr('height', ((bbox.height*scale)|0)+50);\n}",
"function setLineWidth() {\r\n\t\tlineWidth = $(this).attr('data-size');\t//choix d'une épaisseur prédéfinie\r\n\t\t$range.val(lineWidth);\t//mise à jour de l'affichage sur la réglette\r\n\t}",
"function drawScaleBar(layer, current) {\n layer[\"scaleCanvas\"].width = 60*window.devicePixelRatio;\n layer[\"scaleCanvas\"].height = 200*window.devicePixelRatio;\n\n let context = layer[\"scaleCanvasContext\"];\n\n context.setTransform(window.devicePixelRatio, 0, 0, window.devicePixelRatio, 0, 0);\n\n context.clearRect(0,0,60,200);\n context.fillStyle = \"rgba(255,255,255,0.6)\";\n context.fillRect(0, 0, 60, 200);\n if (layer[\"reverseBar\"]) {\n for (let i = 0; i < 185; i++) {\n context.fillStyle = getColorPoint(layer[\"colorRange\"], 1-(i/185));\n if (i === 184)\n context.fillRect(0, i, 20, 1);\n else\n context.fillRect(0, i, 20, 2);\n }\n }\n else {\n for (let i = 0; i < 185; i++) {\n context.fillStyle = getColorPoint(layer[\"colorRange\"], i/185);\n if (i === 184)\n context.fillRect(0, i, 20, 1);\n else\n context.fillRect(0, i, 20, 2);\n }\n }\n let currentAdjusted;\n if (typeof current !== 'undefined') {\n currentAdjusted = (current-layer[\"colorBounds\"][0])/(layer[\"colorBounds\"][1]-layer[\"colorBounds\"][0]);\n if (layer[\"reverseBar\"])\n currentAdjusted = 1-currentAdjusted;\n context.fillStyle = \"rgba(0,0,0,0.8)\";\n context.fillRect(0, Math.floor(currentAdjusted*185), 20, 1);\n }\n context.fillStyle = \"#000000\";\n context.font = \"12px Mukta\";\n context.textAlign = \"left\";\n if (layer[\"reverseBar\"]) {\n if (typeof current === 'undefined' || currentAdjusted > 0.08)\n context.fillText(layer[\"colorBounds\"][1].toString(), 22, 10);\n if (typeof current === 'undefined' || currentAdjusted < 0.92)\n context.fillText(layer[\"colorBounds\"][0].toString(), 22, 183);\n }\n else {\n if (typeof current === 'undefined' || currentAdjusted > 0.08)\n context.fillText(layer[\"colorBounds\"][0].toString(), 22, 10);\n if (typeof current === 'undefined' || currentAdjusted < 0.92)\n context.fillText(layer[\"colorBounds\"][1].toString(), 22, 183);\n }\n if (typeof current !== 'undefined') {\n context.font = \"bold 12px Mukta\";\n context.fillText(current.toString(), 22, Math.floor(Math.min(Math.max(currentAdjusted, 0.03), 0.96) * 185)+5);\n }\n\n context.fillStyle = \"rgba(255,255,255,0.6)\";\n context.fillRect(0, 185, 60, 15);\n context.fillStyle = \"#000000\";\n context.font = \"14px Mukta\";\n context.textAlign = \"center\";\n context.fillText(layer[\"unit\"].toString(),30,196);\n}",
"function horizontalScale() {\n if (svg.element.select('.horizontalScale')) svg.element.select('.horizontalScale').remove()\n if (ruler.container) ruler.container.remove()\n ruler.container = svg.element\n .append('g')\n .attr('transform', 'translate(' + [ruler.y, ruler.x] + ')')\n .attr('class', 'horizontalScale')\n\n ruler.container.append('path')\n .attr('d', d => 'M' + ruler.padding + ',10L' + (ruler.width + ruler.padding) + ',10')\n .attr('stroke-width', 1)\n .attr('stroke', '#000')\n\n ruler.element = ruler.container\n .append('text')\n .attr('class', 'ruler-text')\n .attr('x', ruler.width / 2 + ruler.padding)\n .attr('y', 36)\n .attr('font-family', 'sans-serif')\n .text('')\n .attr('font-size', '14px')\n .attr('fill', '#000')\n .attr('text-anchor', 'middle')\n }",
"function drawHorizontalScale(ifDirty = false) {\n if (ifDirty && !worldSizeDirty)\n return;\n function drawTicks(/** @type {CanvasRenderingContext2D} */ ctx, pixelsPer, heightPer) {\n let total = heightPer.clone();\n total.value = math.unit(-config.x, \"meters\").toNumber(config.unit);\n\n // further adjust it to put the current position in the center\n\n total.value -= heightPer.toNumber(\"meters\") / pixelsPer * (canvasWidth + 50) / 2;\n let x = ctx.canvas.clientWidth - 50;\n\n\n let offset = total.toNumber(\"meters\") % heightPer.toNumber(\"meters\");\n\n x += offset / heightPer.toNumber(\"meters\") * pixelsPer;\n total = math.subtract(total, math.unit(offset, \"meters\"));\n\n for (; x >= 50 - pixelsPer; x -= pixelsPer) {\n // negate it so that the left side is negative\n drawTick(ctx, x, 50, math.multiply(-1, total));\n total = math.add(total, heightPer);\n }\n }\n\n function drawTick(/** @type {CanvasRenderingContext2D} */ ctx, x, y, value) {\n const oldStroke = ctx.strokeStyle;\n const oldFill = ctx.fillStyle;\n\n ctx.beginPath();\n ctx.moveTo(x, y);\n ctx.lineTo(x, y + 20);\n ctx.strokeStyle = \"#000000\";\n ctx.stroke();\n\n ctx.beginPath();\n ctx.moveTo(x, y + 20);\n ctx.lineTo(x, ctx.canvas.clientHeight - 70);\n ctx.strokeStyle = \"#aaaaaa\";\n ctx.stroke();\n\n ctx.beginPath();\n ctx.moveTo(x, ctx.canvas.clientHeight - 70);\n ctx.lineTo(x, ctx.canvas.clientHeight - 50);\n ctx.strokeStyle = \"#000000\";\n ctx.stroke();\n\n const oldFont = ctx.font;\n ctx.font = 'normal 24pt coda';\n ctx.fillStyle = \"#dddddd\";\n\n ctx.beginPath();\n ctx.fillText(value.format({ precision: 3 }), x + 35, y + 20);\n\n ctx.font = oldFont;\n ctx.strokeStyle = oldStroke;\n ctx.fillStyle = oldFill;\n }\n const canvas = document.querySelector(\"#display\");\n\n /** @type {CanvasRenderingContext2D} */\n\n const ctx = canvas.getContext(\"2d\");\n\n let pixelsPer = (ctx.canvas.clientHeight - 100) / config.height.toNumber();\n\n heightPer = 1;\n\n if (pixelsPer < config.minLineSize * 2) {\n const factor = math.ceil(config.minLineSize * 2/ pixelsPer);\n heightPer *= factor;\n pixelsPer *= factor;\n }\n\n if (pixelsPer > config.maxLineSize * 2) {\n const factor = math.ceil(pixelsPer / 2/ config.maxLineSize);\n heightPer /= factor;\n pixelsPer /= factor;\n }\n\n if (heightPer == 0) {\n console.error(\"The world size is invalid! Refusing to draw the scale...\");\n return;\n }\n heightPer = math.unit(heightPer, document.querySelector(\"#options-height-unit\").value);\n \n\n ctx.beginPath();\n ctx.moveTo(0, 50);\n ctx.lineTo(ctx.canvas.clientWidth, 50);\n ctx.stroke();\n ctx.beginPath();\n ctx.moveTo(0, ctx.canvas.clientHeight - 50);\n ctx.lineTo(ctx.canvas.clientWidth , ctx.canvas.clientHeight - 50);\n ctx.stroke();\n\n drawTicks(ctx, pixelsPer, heightPer);\n}",
"function drawFixation() {\n let ctx = document.getElementById('canvas').getContext('2d');\n ctx.lineWidth = prms.fixWidth;\n ctx.moveTo(-prms.fixSize, 0);\n ctx.lineTo( prms.fixSize, 0);\n ctx.stroke(); \n ctx.moveTo(0, -prms.fixSize);\n ctx.lineTo(0, prms.fixSize);\n ctx.stroke(); \n}",
"function zoomed() {\n canvas.style(\"stroke-width\", 1.5 / d3.event.scale + \"px\");\n canvas.attr(\"transform\", \"translate(\" + d3.event.translate + \")scale(\" + d3.event.scale + \")\");\n }",
"setLineSize(size) {\n this.context.lineWidth = size;\n }",
"function scaleCanvas() {\r\n\t\tvar ctx = $['mapsettings'].ctx;\r\n\t\tvar scalevalue = new Point(1,1);\r\n\t\tvar scale = getRelativeScale($['mapsettings'].zoom);\t\r\n\t\tscale.x = scale.x * scalevalue.x;\r\n\t\tscale.y = scale.y * scalevalue.y;\r\n\t\t$['mapsettings'].scale = scale;\r\n\t}",
"function drawScale() {\n /* walls */\n for (var i = 0; i < fie.length; i++) {\n if (fie[i].intact) {\n if (fie[i].type != \"GHOST1\" && fie[i].type != \"GHOST2\" && fie[i].type != \"GHOST3\" && fie[i].type != \"CHERRY\" && fie[i].type != \"PACMAN\")\n fie[i].draw();\n }\n }\n /* score */\n noStroke();\n fill(\"#fffdfc\");\n textSize(20);\n textAlign(LEFT);\n text(score, 580,156 );\n var s = 'Score:';\n text(s, 500, 140, 70, 80);\n\n /* timer */\n //timer.style('color', '#fffdfc');\n var t = 'Time:';\n text(t, 500, 10, 70, 80);\n\n var l = 'Lives:';\n text(l, 500, 60, 70, 80);\n}",
"function draw() {\n background(0); // Set the background to black\n y = y - 1;\n if (y < 0) {\n y = height;\n }\n line(0, y, width, y);\n}",
"render() {\n this.ctx.save();\n this.ctx.strokeStyle = this.penColor;\n this.ctx.lineWidth = this.size;\n this.ctx.lineCap = \"round\";\n const [first, ...rest] = this.points;\n this.ctx.beginPath();\n this.ctx.moveTo(first.x, first.y);\n rest.forEach((point) => this.ctx.lineTo(point.x, point.y));\n this.ctx.stroke();\n this.ctx.restore();\n }",
"function tracer_grille(svg,width,yScale,data){\r\n\t\tsvg.selectAll(\"y_axis\").data(yScale.ticks(5)).enter()\r\n .append(\"line\")\r\n .attr(\"class\", \"horizontalGrid\")\r\n .attr(\"x2\", width)\r\n .attr(\"y1\", function(d){ return yScale(d);})\r\n .attr(\"y2\", function(d){ return yScale(d);});\r\n}",
"function drawLine(x1, y1, x2, y2, clr) {\n \"use strict\";\n var scaledX1, scaledY1, scaledX2, scaledY2;\n scaledX1 = scaleX(Number(x1));\n scaledY1 = scaleY(Number(y1));\n scaledX2 = scaleX(Number(x2));\n scaledY2 = scaleY(Number(y2));\n //origin\n ctx.beginPath();\n ctx.moveTo(scaledX1, scaledY1);\n ctx.lineTo(scaledX2, scaledY2);\n ctx.strokeStyle = clr;\n ctx.lineWidth = 1.0;\n ctx.stroke();\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}"
]
| [
"0.666861",
"0.6438871",
"0.6383193",
"0.6371038",
"0.63630515",
"0.6312043",
"0.6255201",
"0.6255201",
"0.6255201",
"0.62264526",
"0.6173866",
"0.61598027",
"0.6139451",
"0.6091123",
"0.60581917",
"0.60348976",
"0.60309803",
"0.6029382",
"0.60277915",
"0.60252756",
"0.60005456",
"0.59788233",
"0.597833",
"0.5969824",
"0.5954011",
"0.59279835",
"0.59078085",
"0.5889641",
"0.5889274",
"0.5886337"
]
| 0.6467912 | 1 |
File: linkify.js Version: 20101010_1000 Copyright: (c) 2010 Jeff Roberson MIT License: Summary: This script linkifys http URLs on a page. Usage: See demonstration page: linkify.html | function linkify(text) {
/* Here is a commented version of the regex (in PHP string format):
$url_pattern = '/# Rev:20100913_0900 github.com\/jmrware\/LinkifyURL
# Match http & ftp URL that is not already linkified.
# Alternative 1: URL delimited by (parentheses).
(\() # $1 "(" start delimiter.
((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+) # $2: URL.
(\)) # $3: ")" end delimiter.
| # Alternative 2: URL delimited by [square brackets].
(\[) # $4: "[" start delimiter.
((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+) # $5: URL.
(\]) # $6: "]" end delimiter.
| # Alternative 3: URL delimited by {curly braces}.
(\{) # $7: "{" start delimiter.
((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+) # $8: URL.
(\}) # $9: "}" end delimiter.
| # Alternative 4: URL delimited by <angle brackets>.
(<|&(?:lt|\#60|\#x3c);) # $10: "<" start delimiter (or HTML entity).
((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+) # $11: URL.
(>|&(?:gt|\#62|\#x3e);) # $12: ">" end delimiter (or HTML entity).
| # Alternative 5: URL not delimited by (), [], {} or <>.
( # $13: Prefix proving URL not already linked.
(?: ^ # Can be a beginning of line or string, or
| [^=\s\'"\]] # a non-"=", non-quote, non-"]", followed by
) \s*[\'"]? # optional whitespace and optional quote;
| [^=\s]\s+ # or... a non-equals sign followed by whitespace.
) # End $13. Non-prelinkified-proof prefix.
( \b # $14: Other non-delimited URL.
(?:ht|f)tps?:\/\/ # Required literal http, https, ftp or ftps prefix.
[a-z0-9\-._~!$\'()*+,;=:\/?#[\]@%]+ # All URI chars except "&" (normal*).
(?: # Either on a "&" or at the end of URI.
(?! # Allow a "&" char only if not start of an...
&(?:gt|\#0*62|\#x0*3e); # HTML ">" entity, or
| &(?:amp|apos|quot|\#0*3[49]|\#x0*2[27]); # a [&\'"] entity if
[.!&\',:?;]? # followed by optional punctuation then
(?:[^a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]|$) # a non-URI char or EOS.
) & # If neg-assertion true, match "&" (special).
[a-z0-9\-._~!$\'()*+,;=:\/?#[\]@%]* # More non-& URI chars (normal*).
)* # Unroll-the-loop (special normal*)*.
[a-z0-9\-_~$()*+=\/#[\]@%] # Last char can\'t be [.!&\',;:?]
) # End $14. Other non-delimited URL.
/imx';
*/
var url_pattern = /(\()((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&'()*+,;=:\/?#[\]@%]+)(\))|(\[)((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&'()*+,;=:\/?#[\]@%]+)(\])|(\{)((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&'()*+,;=:\/?#[\]@%]+)(\})|(<|&(?:lt|#60|#x3c);)((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&'()*+,;=:\/?#[\]@%]+)(>|&(?:gt|#62|#x3e);)|((?:^|[^=\s'"\]])\s*['"]?|[^=\s]\s+)(\b(?:ht|f)tps?:\/\/[a-z0-9\-._~!$'()*+,;=:\/?#[\]@%]+(?:(?!&(?:gt|#0*62|#x0*3e);|&(?:amp|apos|quot|#0*3[49]|#x0*2[27]);[.!&',:?;]?(?:[^a-z0-9\-._~!$&'()*+,;=:\/?#[\]@%]|$))&[a-z0-9\-._~!$'()*+,;=:\/?#[\]@%]*)*[a-z0-9\-_~$()*+=\/#[\]@%])/img;
var url_replace = '$1$4$7$10$13<a href="$2$5$8$11$14">$2$5$8$11$14</a>$3$6$9$12';
return text.replace(url_pattern, url_replace);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function linkify(text) {\r\n var replaceText, replacePattern1, replacePattern2, replacePattern3;\r\n\r\n //URLs starting with http://, https://, or ftp://\r\n replacePattern1 = /(\\b(https?|ftp):\\/\\/[\\-A-Z0-9+&@#\\/%?=~_|!:,.;]*[\\-A-Z0-9+&@#\\/%=~_|])/gim;\r\n replacedText = text.replace(replacePattern1, '<a href=\"$1\">$1</a>');\r\n\r\n //URLs starting with \"www.\" (without // before it, or it'd re-link the ones done above).\r\n replacePattern2 = /(^|[^\\/])(www\\.[\\S]+(\\b|$))/gim;\r\n replacedText = replacedText.replace(replacePattern2, '$1<a href=\"http://$2\">$2</a>');\r\n\r\n //Change email addresses to mailto:: links.\r\n replacePattern3 = /(\\w+@[a-zA-Z_]+?\\.[a-zA-Z]{2,6})/gim;\r\n replacedText = replacedText.replace(replacePattern3, '<a href=\"mailto:$1\">$1</a>');\r\n\r\n return replacedText;\r\n}",
"function linkify(inputText)\n{\n var replacedText, replacePattern1, replacePattern2, replacePattern3;\n\n //URLs starting with http://, https://, or ftp://\n replacePattern1 = /(\\b(https?|ftp):\\/\\/[-A-Z0-9+&@#\\/%?=~_|!:,.;]*[-A-Z0-9+&@#\\/%=~_|])/gim;\n replacedText = inputText.replace(replacePattern1, '<a href=\"$1\" target=\"_blank\">$1</a>');\n\n //URLs starting with \"www.\" (without // before it, or it'd re-link the ones done above).\n replacePattern2 = /(^|[^\\/])(www\\.[\\S]+(\\b|$))/gim;\n replacedText = replacedText.replace(replacePattern2, '$1<a href=\"http://$2\" target=\"_blank\">$2</a>');\n\n //Change email addresses to mailto:: links.\n replacePattern3 = /(([a-zA-Z0-9\\-\\_\\.])+@[a-zA-Z\\_]+?(\\.[a-zA-Z]{2,6})+)/gim;\n replacedText = replacedText.replace(replacePattern3, '<a href=\"mailto:$1\">$1</a>');\n\n return replacedText;\n}",
"function linkify(text) {\n var urlRegex = /(\\b(https?|ftp|file):\\/\\/[-A-Z0-9+&@#\\/%?=~_|!:,.;]*[-A-Z0-9+&@#\\/%=~_|])/ig;\n return text.replace(urlRegex, function (url) {\n return '<a href=\"' + url + '\">' + url + '</a>';\n });\n}",
"function lc_Linkify(){\r\n var urlRegex = /_?((h\\S\\Sp)?(:\\/\\/|rapidshare\\.)[^\\s+\\\"\\<\\>]+)/ig;\r\n var snapTextElements = document.evaluate(\"//text()[\"+\r\n \"not(ancestor::a) and not(ancestor::script) and (\"+\r\n \"contains(translate(., 'RAPIDSHE', 'rapidshe'), 'rapidshare.')\"+\r\n \" or contains(translate(., 'RAPIDSFENT', 'rapidsfent'), 'rapidsafe.net/')\"+\r\n \" or contains(translate(., 'LIXN', 'lixn'), '://lix.in/')\"+\r\n \")]\", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\r\n for (var i=0; i < snapTextElements.snapshotLength; i++) {\r\n var elmText = snapTextElements.snapshotItem(i);\r\n if (urlRegex.test(elmText.nodeValue)) {\r\n var sURLText = elmText.nodeValue;\r\n var elmSpan = document.createElement(\"span\");\r\n // add class name\r\n elmSpan.className = \"rs_linkcheck_linked\";\r\n elmText.parentNode.replaceChild(elmSpan, elmText);\r\n urlRegex.lastIndex = 0;\r\n for(var match = null, lastLastIndex = 0; (match = urlRegex.exec(sURLText)); ) {\r\n // skip truncated links\r\n if(match[0].indexOf(\"...\") != -1) continue;\r\n // skip bare domains\r\n if(match[0].indexOf(\"/\") == -1) continue;\r\n elmSpan.appendChild(document.createTextNode(sURLText.substring(lastLastIndex, match.index)));\r\n lastLastIndex = urlRegex.lastIndex;\r\n var elmLink = document.createElement(\"a\");\r\n // make sure there's an http:\r\n elmLink.href = match[1].replace(/^((h\\S\\Sp)?:\\/\\/)?rapidshare\\./, \"http://rapidshare.\");\r\n var nextPart = \"\";\r\n // Check if there was a space\r\n if(/\\brapidshare\\.(com|de)\\/files\\/.*[^\\.]{5}$/i .test(match[0]) &&\r\n /^\\s.*\\.\\w/.test(sURLText.substring(urlRegex.lastIndex))){\r\n nextPart = sURLText.substring(urlRegex.lastIndex);\r\n nextPart = nextPart.match(/^\\s[^\\s+\\\"\\<\\>]*\\.\\w+(\\.html)?/i)[0];\r\n lastLastIndex += nextPart.length;\r\n elmLink.href += nextPart.replace(/\\s/, \"\");\r\n }\r\n // open in new window or tab\r\n elmLink.target = \"_blank\";\r\n // tool-tip to indicate Linkified\r\n elmLink.title = \"[linked]\";\r\n elmLink.appendChild(document.createTextNode(match[0] + nextPart));\r\n elmSpan.appendChild(elmLink);\r\n }\r\n elmSpan.appendChild(document.createTextNode(\r\n sURLText.substring(lastLastIndex)));\r\n elmSpan.normalize();\r\n // stop events on new links, like pop-ups and cookies\r\n elmSpan.addEventListener(\"click\", function(e){ e.stopPropagation(); }, true);\r\n }\r\n }\r\n}",
"function linkify(inputText) {\n var replacedText, replacePattern1, replacePattern2, replacePattern3;\n\n //URLs starting with http://, https://, or ftp://\n replacePattern1 = /(\\b(https?|ftp):\\/\\/[-A-Z0-9+&@#\\/%?=~_|!:,.;]*[-A-Z0-9+&@#\\/%=~_|])/gim;\n replacedText = inputText.replace(replacePattern1, '<a href=\"$1\" target=\"_blank\">$1</a>');\n\n //URLs starting with \"www.\" (without // before it, or it'd re-link the ones done above).\n replacePattern2 = /(^|[^\\/])(www\\.[\\S]+(\\b|$))/gim;\n replacedText = replacedText.replace(replacePattern2, '$1<a href=\"http://$2\" target=\"_blank\">$2</a>');\n\n //Change email addresses to mailto:: links.\n replacePattern3 = /(([a-zA-Z0-9\\-\\_\\.])+@[a-zA-Z\\_]+?(\\.[a-zA-Z]{2,6})+)/gim;\n replacedText = replacedText.replace(replacePattern3, '<a href=\"mailto:$1\">$1</a>');\n\n return replacedText;\n}",
"function linkify(str) {\r\n \tvar response = '';\r\n\t\tfor (var i=0;i<str.length;i++) {\r\n\t\t\tif (str.substring(i,i+7) == \"http://\" || str.substring(i,i+8) == \"https://\") {\r\n\t\t\t\tvar prefix = str.charAt(i-1);\r\n\t\t\t\tif (prefix === ';' && str.substring(i-4,i) === '<') { prefix = '<' } // special case for < \r\n\t\t\t\tvar ei = findURLendIndex(str, i+7, prefix);\r\n\t\t\t\tif (ei !== -1) {\r\n\t\t\t\t\tvar link = str.substring(i,ei);\r\n\t\t\t\t\tif (link.length > 10 &&\r\n\t\t\t\t\t\tlink.indexOf('\\n')===-1 && \r\n\t\t\t\t\t\tlink.indexOf(' ')===-1) {\r\n\t\t\t\t\t\tresponse+='<a href=\"'+link+'\">'+link+'</a>';\r\n\t\t\t\t\t\ti = ei-1; \r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} \r\n\t\t\tresponse+=str.charAt(i);\r\n\t\t}\r\n\t\treturn response; \r\n\t}",
"function c0_ReplUrl(str)\t\t// Replaces urls to links...\r\n{\r\nvar str2=str;\r\nfor(;;)\r\n{\r\n var urls='';\r\n var at=str2.indexOf(\"http://\");\r\n if(at>=0) var urls=\"HTTP://\" + str2.substr(at+7);\r\n else\r\n {\r\n at=str2.indexOf(\"https://\");\r\n if(at>=0) urls=\"HTTPS://\" + str2.substr(at+8);\r\n }\r\n if(urls.length>0)\r\n {\r\n at2=urls.indexOf(\" \");\r\n if(at2>=0) urls=urls.substr(0,at2);\r\n\r\n str2=str2.substr(0,at) + '<a href=\"' +urls + '\" target=\"blank\" >link»</a>' + str2.substr(at +urls.length);\r\n }\r\n else break;\r\n}\r\n\r\nstr2= c0_ReplaceAll( str2, 'HTTP://', 'http://' );\r\nstr2= c0_ReplaceAll( str2, 'HTTPS://', 'https://' );\r\n\r\nreturn(str2);\r\n}",
"function urlify(text) {\n var urlRegex = /(https?:\\/\\/[^\\s]+)/g;\n return text.replace(urlRegex, function(url) {\n return '<a target=\"_blank\" href=\"' + url + '\">' + url + '</a>';\n })\n}",
"function anchorize(text) {\n\treturn text.replace(/((http|https|ftp|ftps|file|smb):\\/{2}[a-zA-Z\\d:\\/.]+)\\b/gim, '<a href=\"$1\">$1</a>');\n}",
"function replace_plain_links(input) {\n return input.replace(/([^\"'>]|p>)(https?:\\/\\/[^\\s\"'<]+)/gim, '$1<a href=\"$2\"></a>');\n}",
"function urlify(text, method) {\n var urlRegex = /(http|ftp|https):\\/\\/[\\w-]+(\\.[\\w-]+)+([\\w.,@?^=%&:\\/~+#-]*[\\w@?^=%&\\/~+#-])?/;\n \t return text.replace(urlRegex, function(url) {\n\t\t if (method == \"detect\")\n\t\t\treturn '<a href=\"' + url + '\" target=\"_blank\">' + url + '</a>'; //return url\n\t\telse \n\t\t\treturn ''; //return blank\n });\n} //end urlify",
"function checkForLinks(text){\n text = replaceUrlWithImage(text);\n text = replaceUrlWithHtml(text);\n return text;\n}",
"function autoEdLinks(str) { //MAIN FUNCTION describes list of fixes\n \n str = str.replace(/\\]\\[/g, \"] [\");\n \n //repair bad external links\n str = str.replace(/\\[?\\[http:\\/\\/([^\\]\\n]*?)\\]\\]?/gi, \"[http://$1]\");\n //str = str.replace(/\\[http:\\/\\/([^\\]]*?)\\|([^\\]]*?)\\]/gi, \"[http://$1 $2]\");\n \n return str;\n}",
"function cleanLinks (x, url)\r\n {\r\n if (typeof(x) != \"xml\")\r\n {\r\n x = new XML();\r\n return (x);\r\n }\r\n function fixAttrib (y, attrib)\r\n {\r\n if (y.@[attrib] && !((\"\" + y.@[attrib]).match(/\\:\\/\\//)))\r\n {\r\n if ((\"\" + y.@[attrib]).match(/^\\//))\r\n y.@[attrib] = url + y.@[attrib];\r\n else\r\n y.@[attrib] = url + \"/\" + y.@[attrib];\r\n }\r\n return (y);\r\n }\r\n function fixList (list)\r\n {\r\n for each (y in list)\r\n {\r\n y = fixAttrib(y, \"href\");\r\n y = fixAttrib(y, \"src\");\r\n }\r\n }\r\n var r = new Namespace(\"http://www.w3.org/1999/xhtml\");\r\n fixList(x..r::a)\r\n fixList(x..a)\r\n fixList(x..r::img)\r\n fixList(x..img)\r\n return (x);\r\n }",
"function findLink(text) {\n var urlRegex =/(\\b(https?|ftp|file):\\/\\/[-A-Z0-9+&@#\\/%?=~_|!:,.;]*[-A-Z0-9+&@#\\/%=~_|])/ig;\n return text.replace(urlRegex, function(url) {\n return '<a href=\"' + url + '\">' + url + '</a>';\n });\n}",
"function convertLinks() {\r\n $('a[href]').each(function() {\r\n var link = $(this);\r\n var href = link.attr('href');\r\n if (isSupported(href)) {\r\n link.attr('href', \"http://quietube.com/v.php/\" + href);\r\n }\r\n }); \r\n }",
"function ablinks() {\n // Auto Build links list items from bare a-tag source code 20171128\n var k = 0;\n var libs = document.getElementsByClassName('linkpool');\n for (var i = 0; i < libs.length; i++) {\n var lib = libs[i];\n var links = lib.childNodes;\n for (var j = 0; j < links.length; j++) {\n var a = links[j];\n if (a.innerHTML === '') {\n if (a.className !== '') {\n a.className = a.className + ' ali';\n } else {\n a.className = 'ali';\n }\n if (a.title !== '') {\n a.innerHTML = '• ' + a.title;\n } else {\n a.innerHTML = a.href;\n }\n a.target = '_blank';\n k = k + 1;\n }\n }\n }\n return k;\n}",
"function _convertUrlsToLinks(str) {\n return str.replace(URL_REG_EXP, function(match, url) {\n var punctuation = (url.match(TRAILING_CHAR_REG_EXP) || [])[1] || \"\",\n opening = BRACKETS[punctuation];\n url = url.replace(TRAILING_CHAR_REG_EXP, \"\");\n\n if (url.split(opening).length > url.split(punctuation).length) {\n url = url + punctuation;\n punctuation = \"\";\n }\n var realUrl = url,\n displayUrl = url;\n if (url.length > MAX_DISPLAY_LENGTH) {\n displayUrl = displayUrl.substr(0, MAX_DISPLAY_LENGTH) + \"...\";\n }\n // Add http prefix if necessary\n if (realUrl.substr(0, 4) === \"www.\") {\n realUrl = \"http://\" + realUrl;\n }\n \n return '<a href=\"' + realUrl + '\">' + displayUrl + '</a>' + punctuation;\n });\n }",
"function _convertUrlsToLinks(str) {\n return str.replace(URL_REG_EXP, function(match, url) {\n var punctuation = (url.match(TRAILING_CHAR_REG_EXP) || [])[1] || \"\",\n opening = BRACKETS[punctuation];\n url = url.replace(TRAILING_CHAR_REG_EXP, \"\");\n\n if (url.split(opening).length > url.split(punctuation).length) {\n url = url + punctuation;\n punctuation = \"\";\n }\n var realUrl = url,\n displayUrl = url;\n if (url.length > MAX_DISPLAY_LENGTH) {\n displayUrl = displayUrl.substr(0, MAX_DISPLAY_LENGTH) + \"...\";\n }\n // Add http prefix if necessary\n if (realUrl.substr(0, 4) === \"www.\") {\n realUrl = \"http://\" + realUrl;\n }\n\n return '<a href=\"' + realUrl + '\">' + displayUrl + '</a>' + punctuation;\n });\n }",
"function _convertUrlsToLinks(str) {\n return str.replace(URL_REG_EXP, function(match, url) {\n var punctuation = (url.match(TRAILING_CHAR_REG_EXP) || [])[1] || \"\",\n opening = BRACKETS[punctuation];\n url = url.replace(TRAILING_CHAR_REG_EXP, \"\");\n\n if (url.split(opening).length > url.split(punctuation).length) {\n url = url + punctuation;\n punctuation = \"\";\n }\n var realUrl = url,\n displayUrl = url;\n if (url.length > MAX_DISPLAY_LENGTH) {\n displayUrl = displayUrl.substr(0, MAX_DISPLAY_LENGTH) + \"...\";\n }\n // Add http prefix if necessary\n if (realUrl.substr(0, 4) === \"www.\") {\n realUrl = \"http://\" + realUrl;\n }\n\n return '<a href=\"' + realUrl + '\">' + displayUrl + '</a>' + punctuation;\n });\n }",
"function _convertUrlsToLinks(str) {\n return str.replace(URL_REG_EXP, function(match, url) {\n var punctuation = (url.match(TRAILING_CHAR_REG_EXP) || [])[1] || \"\",\n opening = BRACKETS[punctuation];\n url = url.replace(TRAILING_CHAR_REG_EXP, \"\");\n\n if (url.split(opening).length > url.split(punctuation).length) {\n url = url + punctuation;\n punctuation = \"\";\n }\n var realUrl = url,\n displayUrl = url;\n if (url.length > MAX_DISPLAY_LENGTH) {\n displayUrl = displayUrl.substr(0, MAX_DISPLAY_LENGTH) + \"...\";\n }\n // Add http prefix if necessary\n if (realUrl.substr(0, 4) === \"www.\") {\n realUrl = \"http://\" + realUrl;\n }\n\n return '<a href=\"' + realUrl + '\">' + displayUrl + '</a>' + punctuation;\n });\n }",
"function _convertUrlsToLinks(str) {\n return str.replace(URL_REG_EXP, function (match, url) {\n var punctuation = (url.match(TRAILING_CHAR_REG_EXP) || [])[1] || \"\",\n opening = BRACKETS[punctuation];\n url = url.replace(TRAILING_CHAR_REG_EXP, \"\");\n\n if (url.split(opening).length > url.split(punctuation).length) {\n url = url + punctuation;\n punctuation = \"\";\n }\n var realUrl = url,\n displayUrl = url;\n if (url.length > MAX_DISPLAY_LENGTH) {\n displayUrl = displayUrl.substr(0, MAX_DISPLAY_LENGTH) + \"...\";\n }\n // Add http prefix if necessary\n if (realUrl.substr(0, 4) === \"www.\") {\n realUrl = \"http://\" + realUrl;\n }\n\n return '<a href=\"' + realUrl + '\">' + displayUrl + '</a>' + punctuation;\n });\n }",
"autolink() {\n const linkRegex = new RegExp(`(https?://\\\\S+\\\\.\\\\S+)\\\\s`, 'ig');\n const editor = this.getEditor();\n const content = editor.getDocument().toString();\n let match;\n while ((match = linkRegex.exec(content))) {\n const url = match[1];\n if (isURL(url)) {\n const position = match.index;\n const range = [position, position + url.length];\n const hrefAtRange = editor.getDocument().getCommonAttributesAtRange(range).href;\n if (hrefAtRange !== url) {\n this.updateInRange(editor, range, 0, () => {\n if (editor.canActivateAttribute('href')) {\n editor.activateAttribute('href', url);\n }\n });\n }\n }\n }\n }",
"function linkifyJquery($) {\n\t\t\tvar doc = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];\n\n\n\t\t\t$.fn = $.fn || {};\n\n\t\t\ttry {\n\t\t\t\tdoc = doc || window && window.document || global && global.document;\n\t\t\t} catch (e) {/* do nothing for now */}\n\n\t\t\tif (!doc) {\n\t\t\t\tthrow new Error('Cannot find document implementation. ' + 'If you are in a non-browser environment like Node.js, ' + 'pass the document implementation as the second argument to linkify/jquery');\n\t\t\t}\n\n\t\t\tif (typeof $.fn.linkify === 'function') {\n\t\t\t\t// Already applied\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfunction jqLinkify(opts) {\n\t\t\t\topts = linkifyElement.normalize(opts);\n\t\t\t\treturn this.each(function () {\n\t\t\t\t\tlinkifyElement.helper(this, opts, doc);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t$.fn.linkify = jqLinkify;\n\n\t\t\t$(doc).ready(function () {\n\t\t\t\t$('[data-linkify]').each(function () {\n\n\t\t\t\t\tvar $this = $(this),\n\t\t\t\t\t data = $this.data(),\n\t\t\t\t\t target = data.linkify,\n\t\t\t\t\t nl2br = data.linkifyNlbr,\n\t\t\t\t\t options = {\n\t\t\t\t\t\tlinkAttributes: data.linkifyAttributes,\n\t\t\t\t\t\tdefaultProtocol: data.linkifyDefaultProtocol,\n\t\t\t\t\t\tevents: data.linkifyEvents,\n\t\t\t\t\t\tformat: data.linkifyFormat,\n\t\t\t\t\t\tformatHref: data.linkifyFormatHref,\n\t\t\t\t\t\tnewLine: data.linkifyNewline, // deprecated\n\t\t\t\t\t\tnl2br: !!nl2br && nl2br !== 0 && nl2br !== 'false',\n\t\t\t\t\t\ttagName: data.linkifyTagname,\n\t\t\t\t\t\ttarget: data.linkifyTarget,\n\t\t\t\t\t\tlinkClass: data.linkifyLinkclass,\n\t\t\t\t\t\tvalidate: data.linkifyValidate,\n\t\t\t\t\t\tignoreTags: data.linkifyIgnoreTags\n\t\t\t\t\t};\n\t\t\t\t\tvar $target = target === 'this' ? $this : $this.find(target);\n\t\t\t\t\t$target.linkify(options);\n\t\t\t\t});\n\t\t\t});\n\t\t}",
"function link(node) {\n var self = this\n var content = self.encode(node.url || '', node)\n var exit = self.enterLink()\n var escaped = self.encode(self.escape(node.url || '', node))\n var value = self.all(node).join('')\n\n exit()\n\n if (node.title == null && protocol.test(content) && escaped === value) {\n // Backslash escapes do not work in autolinks, so we do not escape.\n return uri(self.encode(node.url), true)\n }\n\n content = uri(content)\n\n if (node.title) {\n content += space + title(self.encode(self.escape(node.title, node), node))\n }\n\n return (\n leftSquareBracket +\n value +\n rightSquareBracket +\n leftParenthesis +\n content +\n rightParenthesis\n )\n}",
"function decurl(link, reallinkreg, reallinkcorrection)\r\n\t{\r\n\r\n\t\tGM_xmlhttpRequest(\r\n\t\t{\r\n\t\t\tmethod: 'GET',\r\n\t\t\turl: link.href,\r\n\t\t\theaders: {\r\n\t\t\t\t'User-agent': 'Mozilla/4.0 [en] (Windows NT 6.0; U)',\r\n\t\t\t\t'Accept': 'text/xml',\r\n\t\t\t\t'Referer': \"\"\r\n\t\t\t},\r\n\t\t\tonload: function (result)\r\n\t\t\t{\r\n\t\t\t\t// cLinksProcessed++;\r\n\r\n\t\t\t\tvar reallink = result.responseText.match(reallinkreg)[0];\r\n\t\t\t\treallink = reallink.replace(new RegExp(reallinkcorrection, \"g\"), \"\");\r\n\r\n\t\t\t\tlink.href = reallink;\r\n\r\n\t\t\t\tvar i = http_file_hosts.length - 1;\r\n\t\t\t\tdo\r\n\t\t\t\t{\r\n\t\t\t\t\tif ((reallink.match(http_file_hosts[i][0])))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tlink.href = link.href.replace(/http:\\/\\/.*?\\?http:\\/\\//, 'http://');\r\n\t\t\t\t\t\tvar isAliveRegex = http_file_hosts[i][1];\r\n\t\t\t\t\t\tvar isDeadRegex = http_file_hosts[i][2];\r\n\t\t\t\t\t\tvar isUnavaRegex = http_file_hosts[i][3];\r\n\r\n\t\t\t\t\t\tgeturl(link, isAliveRegex, isDeadRegex, isUnavaRegex, 50);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\twhile (i--);\r\n\t\t\t\t}\r\n\t\t});\r\n\t}",
"function e(t){return t.replace(s,function(s,e){var d=(e.match(l)||[])[1]||\"\",m=i[d];e=e.replace(l,\"\"),e.split(m).length>e.split(d).length&&(e+=d,d=\"\");var o=e,p=e;return 100<e.length&&(p=p.substr(0,100)+\"...\"),\"www.\"===o.substr(0,4)&&(o=\"http://\"+o),\"<a href=\\\"\"+o+\"\\\">\"+p+\"</a>\"+d})}",
"can_be_linkify(dest) {\n let match = dest.match(/^(https?:|\\/\\/)/i);\n\n if (!match) return false;\n\n let proto = match[0];\n let len = linkify.testSchemaAt(dest, proto, proto.length);\n\n return len && (len === dest.length - proto.length);\n }",
"function urlDetect(text) {\n return text.replace(pattern, function(url) {\n return '<a href=\"' + url + '\" class=\"autolink\">' + url + '</a>';\n });\n }",
"function mustachifyUrl(href) {\n var url = \"http://mustachify.me/4?src=\" + escape(toAbsoluteURL(href));\n return url;\n}"
]
| [
"0.73212177",
"0.7284751",
"0.7234442",
"0.7212285",
"0.7210462",
"0.7128047",
"0.69046366",
"0.6873047",
"0.6612578",
"0.6440961",
"0.642403",
"0.6311282",
"0.630552",
"0.6294974",
"0.6288601",
"0.6206067",
"0.61951596",
"0.6171151",
"0.6165195",
"0.6165195",
"0.6165195",
"0.61513335",
"0.61377376",
"0.60381967",
"0.6002641",
"0.6001701",
"0.5988714",
"0.5978925",
"0.5927476",
"0.5924442"
]
| 0.76830006 | 0 |
Boot the component. This method is triggered after the user's webpack.mix.js file has executed. | boot() {
console.log("WebpackConfig:");
console.log("-------------- \n");
console.dir(Config, {depth: 1});
console.log("----------------------------------------------- \n");
console.log("Mix Object:");
console.log("------------- \n");
console.dir(Mix, {depth: this.dumpDepth});
console.log("----------------------------------------------- \n");
if (this.die) {
process.exit(0);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"boot() {\n let workboxPlugin = require('workbox-webpack-plugin');\n\n this.plugin = new workboxPlugin[this.pluginName](Object.assign({\n swDest: 'service-worker.js'\n }, this.config));\n }",
"boot() {\n //\n }",
"onBoot() {}",
"boot() {\n\n }",
"async afterBootstrap () {}",
"boot() {\n const Events = this.app.getInstance('Events')\n this.app\n .make('AutoLoader')\n .context(require.context('@listeners', true, /\\.js$/))\n .each((alias, abstract)=>{\n this.app.bind(alias, abstract,false)\n Events.$on((abstract.event || alias), (payload)=>{\n try{\n this.app.make(alias).handle(payload)\n }catch (e) {\n this.app.handleError(e)\n }\n })\n })\n }",
"function boot() {\n config();\n\n require([\"app\", \"modules/common/histogram\",\n \"modules/common/listTab\",\n \"modules/common/list\",\n \"modules/common/modal\",\n \"modules/common/region\",\n \"modules/common/iconbutton\",\n \"modules/common/togglebutton\",\n \"modules/common/toggleiconbutton\",\n \"modules/common/nativehtml\",\n \"modules/common/textArea\",\n \"modules/common/codeArea\",\n \"modules/common/gradient\",\n \"modules/common/color\"\n ], function (app) {\n app.start();\n })\n }",
"constructor() {\n this.bootstrap();\n }",
"boot() {\n\t}",
"bootstrapLoaded() {\n this.client_.sendMessage('bootstrap-loaded');\n }",
"boot() {\n const eventEmitter = this.systems.events;\n eventEmitter.on(Phaser.Scenes.Events.UPDATE, this.update, this);\n eventEmitter.on(Phaser.Core.Events.DESTROY, this.destroy, this);\n }",
"addMixScripts() {\n\t\tconsole.log(`3. Add mix scripts into package.json`);\n\t\tconst packageJson = JSON.parse(fs.readFileSync(this.workingDir + 'package.json'))\n\t\tpackageJson.scripts.dev = \"npm run development\";\n\t\tpackageJson.scripts.development = \"cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js\";\n\t\tpackageJson.scripts.watch = \"npm run development -- --watch\";\n\t\tpackageJson.scripts.hot = \"cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js\";\n\t\tpackageJson.scripts.prod = \"npm run production\";\n\t\tpackageJson.scripts.production = \"cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js\";\n\n\t\t// Write package.json.\n\t\tfs.writeFile(this.workingDir + 'package.json', JSON.stringify(packageJson, null, 4), 'utf8', (err) => {\n\t\t\tif (err) {\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t});\n\t}",
"function Bootstrapper() {\n\tBootstrapperBase.call(this, Catberry);\n}",
"bootstrap() { }",
"function Boot() {\n // empty, maybe inherit config file or something\n}",
"bootstrap( opts ) {\n let key = APP_STATES.get( 'BOOTSTRAP' )\n\n return <Bootstrap key={ key } state={ key } />\n }",
"async boot() {\n try {\n this.shutdownManager = new shutDownManager_1.ShutdownManager({ finUUID: this.finUUID, manifest: this.manifest });\n this.serviceLauncher = new serviceLauncher_1.ServiceLauncher({ finUUID: this.finUUID, manifest: this.manifest, shutdownManager: this.shutdownManager });\n window.bootEngine = this.bootEngine = new bootEngine_1.BootEngine(this.manifest, this.serviceLauncher, this.shutdownManager);\n this.registerBootTasks(this.bootEngine, this.manifest, this.serviceLauncher);\n this.bootEngine.run();\n }\n catch (err) {\n systemLog_1.default.error({ leadingBlankLine: true }, err);\n }\n }",
"boot() {\n\t\tthis.createPolicies();\n\t\tthis.bootDefaultControllers();\n\t\tthis.loadCommands([\n\t\t\tMakeControllerCommand,\n\t\t\tServeCommand\n\t\t]);\n\t}",
"apply(compiler) {\n //webpack刚开始运行时\n compiler.hooks.run.tap(pluginName, compilation => {\n console.log('🍊🍊🍊The webpack build process is starting!!!');\n });\n }",
"componentDidMount() {\n\t\tthis.startup();\n\t}",
"static boot ({ schema }) {\n\n }",
"function boot() {\n\tPhaser.State.call(this);\n}",
"boot() {\n this.createPolicies();\n this.bootDefaultControllers();\n this.loadCommands([_MakeControllerCommand.default, _ServeCommand.default]);\n }",
"componentDidMount() {\n $('head').append('<link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tour/0.10.3/css/bootstrap-tour-standalone.css\">');\n $(\".button-collapse\").sideNav({\n closeOnClick: true //closes when we click things\n });\n\n $('head').append('<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\">');\n $('head').append('<link rel=\"shortcut icon\" type=\"image/png\" href=\"favicon.png\">');\n $.getScript(\"https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tour/0.10.3/js/bootstrap-tour-standalone.js\", function(){\n\n });\n }",
"function bootstrap(RootComponent) {\n const zone = initializeZones();\n const root = compileComponent(RootComponent);\n \n const tag = getTagName(RootComponent);\n const rootEl = document.querySelector(tag);\n if(!rootEl) {\n throw Error(`couldn't find ${tag} element for app bootstrap`);\n }\n\n attachComponent(rootEl, root, zone);\n}",
"componentDidMount() {\n setTimeout(() => {\n this._bootstrapAsync()\n }, 3000)\n }",
"function Bundler () {\n}",
"getBootstrap() {\n return {};\n }",
"_setBoot() {\n this.config.scene = [Boot];\n }",
"boot() {\n\t\tthis.createPolicies();\n\t\tthis.loadAppModelFactories();\n\t\tthis.loadCommands([\n\t\t\tMakeFactoryCommand,\n\t\t\tMakeMigrationCommand,\n\t\t\tMakeModelCommand,\n\t\t\tMakeSeederCommand,\n\t\t\tMigrateCommand,\n\t\t\tMigrateFreshCommand,\n\t\t\tMigrateRefreshCommand,\n\t\t\tMigrateRollbackCommand,\n\t\t\tMigrateStatusCommand,\n\t\t\tSeedCommand\n\t\t]);\n\t}"
]
| [
"0.6334365",
"0.59990925",
"0.5923069",
"0.58922476",
"0.58356553",
"0.58034647",
"0.5646825",
"0.5618756",
"0.5604551",
"0.54944116",
"0.54641694",
"0.54373395",
"0.5397692",
"0.5389931",
"0.53733677",
"0.53467876",
"0.53372073",
"0.53238165",
"0.5284397",
"0.5238695",
"0.52229416",
"0.5201879",
"0.5158688",
"0.5154509",
"0.51407427",
"0.510495",
"0.5097075",
"0.50864077",
"0.5078643",
"0.5059949"
]
| 0.6398949 | 0 |
Find the largest palindrome made from the product of two 3digit numbers. | function abc(num) {
loop1: for (i = num; i.toString().length >= num.toString().length; i--) {
pal = parseInt(i.toString() + i.toString().split('').reverse().join(''))
for (x = num; x.toString().length >= num.toString().length; x--) {
if (pal % x === 0 && (pal / x).toString().length === num.toString().length)
return `Largest palindrome: ${pal}, Components ${x} * ${pal/x} `
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function largestPalendrome() {\n\n // start by assuming the largest found is 0\n let largest = 0;\n\n // for each 3 digit number\n for (let i = 999; i > 99; i--) {\n\n /*\n * for every other 3 digit number that produces\n * a product with the first 3 digit number that's\n * larger than the largest palendrome found\n */\n for (let j = 999; j > 99 && i * j > largest; j--) {\n\n /*\n * check if the product is a palendrome,\n * if so it's the new largest palendrome found\n */\n if (isPalendrome(i * j)) {\n largest = i * j;\n }\n }\n }\n\n return largest;\n}",
"function largestPalindromeProduct(n) {\n var i, j, product;\n var min = 1\n , max = 9;\n var maxP = 0;\n for (i = 1; i < n; i++) {\n min *= 10;\n max = max * 10 + 9;\n }\n for (i = min; i <= max; i++) {\n for (j = i; j <= max; j++) {\n product = i * j;\n if (product > maxP && isPalindromeNumber(product)) {\n maxP = product;\n }\n }\n }\n return maxP;\n}",
"function largestPalindromeProduct(n) {\n\t// n digits (e.g. 999 to 99)\n\tconst start = (10 ** n) - 1;\n\tconst end = 10 ** (n - 1) - 1;\n\tfor (let i = start - 2; i > end; i--) {\n\t\t// Create a palindrome from current n-digit number (descending)\n\t\tconst palindrome = Number(String(i) + String(i).split('').reverse().join(''));\n\t\tconst squareRoot = Number.parseInt(palindrome ** 0.5);\n\t\t// First palindrome divisible by a n-digit number greater than its square root is the result. \n\t\tfor (let j = start; j > squareRoot; j--)\n\t\t\tif (palindrome % j === 0) return [palindrome, j, palindrome / j];\n\t}\n}",
"function largestPalindrome(number) {\n \"use strict\";\n //variables to store number as a string and its reverse\n var n, r;\n //variables to store product of two 3 digit numbers and current largest palindrome\n var product = 0;\n var palindrome = 0;\n for( var i=0; i <=1000; i++)\n {\n for (var j=0; j <=1000; j++)\n {\n product = i*j;\n n = product.toString();\n r = stringReverse(n);\n if((n === r) && (product > palindrome))\n {\n palindrome = product;\n }\n }\n }\n console.log(\"largest palindrome is \" + palindrome);\n\n //create a div and attach solution to the webpage\n var solution = document.createElement(\"DIV\");\n var text = document.createTextNode(palindrome);\n solution.appendChild(text);\n document.getElementById(\"solution\").appendChild(solution);\n}",
"function largest_palindrome(value) {\n var stop_value = (value/10>>0); // Like floor, but faster (+ works better for negative values)\n var current_value = value;\n var i;\n while (true) {\n var n = current_value.toString();\n var test_value = parseInt(n + n.split(\"\").reverse().join(\"\"));\n for (i = value; i > stop_value; i--) {\n if (test_value % i == 0 && (test_value/i).toString().length == 3) {\n return test_value;\n }\n }\n current_value -= 1;\n }\n}",
"function largestPair(num) {\n let output = 0;\n let str = num.toString();\n for (let i = 0; i < str.length - 1; i += 1) {\n let test = str.slice(i, i + 2);\n if (test > output) {output = test}\n }\n return output;\n}",
"function checkPal(){\n // plan\n // determine how to find the palindromes\n // brute:\n // go from the bottom up until your at or past number\n \n // non brute: \n // find a way to get it from above down\n // use a math equsation to find this\n \n\n}",
"function longestPalindrome (string) {\n if (string.length === 1) return string;\n var largestPal = \"\";\n\n for(var i=0; i<string.length; i++) {\n var offset = 1;\n\n // Handle even increments\n while(string.charAt(i-offset) && string.charAt(i+offset-1) &&\n string.charAt(i-offset) === string.charAt(i+offset-1)){\n comparePals(string.slice(i-offset, i+offset));\n offset++;\n }\n\n // Handle odd increments\n while(string.charAt(i-offset) && string.charAt(i+offset) &&\n string.charAt(i-offset) === string.charAt(i+offset)){\n comparePals(string.slice(i-offset, i+offset+1));\n offset++;\n }\n }\n\n return largestPal.length ? largestPal : 'No Pals for you!';\n\n // Helper function; hoisting makes function available to code above\n function comparePals (newPal){\n if(newPal.length >= largestPal.length)\n largestPal = newPal;\n }\n}",
"function longestPalindrome(str) {\n\tstr = str.toLowerCase().replace(/[\\W_]/g, '');\n\tlet longest = '',\n\t\ti = 0;\n\n\twhile (i < str.length - 1) {\n\t\tlet lp = Math.floor(i - .5),\n\t\t\trp = Math.ceil(i + .5);\n\n\t\tif (!longest) longest = str[i];\n\n\t\twhile (str[lp] === str[rp] && lp >= 0 && rp < str.length) {\n\t\t\tlet pl = str.slice(lp, rp + 1);\n\t\t\tif (longest.length < pl.length) longest = pl;\n\t\t\t--lp;\n\t\t\t++rp;\n\t\t}\n\t\ti += 0.5;\n\n\t}\n\treturn longest;\n}",
"function solution(S) {\n if (isPrime(longestPalindrome(S).length)) { return \"YES\"; }\n return \"NO\";\n}",
"function lrgProduct(digit) {\r\n var num = \"7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450\";\r\n // var num = 731671765313306;\r\n var num_arr = num.split(\"\");\r\n var maxProduct = 0;\r\n for (var i = 0; i < num_arr.length - digit; i += 1) {\r\n var product = 1;\r\n for (var j = 0; j < digit; j += 1) {\r\n product = product * num_arr[i + j];\r\n }\r\n if (product > maxProduct) {\r\n maxProduct = product;\r\n }\r\n }\r\n return maxProduct;\r\n}",
"function LargestPalindrome(){\n this.findGreatest();\n this.greatestProduct = 0\n this.currentProduct = 0\n}",
"function pandigitalProducts(){\n var arrofNums = [1];\n var highest = 0;\n for(var i = 2; i<6 ;i++){\n arrofNums.push(i);\n var max = Math.pow(10, 6-i);\n for(var j = max/10; j < max; j++){\n var num = \"\";\n for(var k = 0; k < i; k++){\n num += j*arrofNums[k];\n }\n if(num.length === 9 && num.indexOf(\"0\") === -1){\n if(chkPalin(num)){\n if(highest < Number(num)) highest = Number(num); \n }\n }\n }\n }\n\n return highest;\n}",
"function longPelidrom(str) {\n let n = str.length;\n\n // make dp table\n let table = new Array(n);\n for (let i = 0; i < n; i++) table[i] = new Array(n);\n\n //all substring with size one is alwasys pelindrom\n let max_length = 1;\n for (let i = 0; i < n; i++) table[i][i] = true;\n\n // chske substring with size 2\n let start = 0;\n for (let i = 0; i < n - 1; i++) {\n if (str[i] == str[i + 1]) {\n table[i][i + 1] = true;\n start = i;\n max_length = 2;\n }\n }\n\n //chek for size more then 3\n //k is length of substring\n for (let k = 3; k <= n; ++k) {\n // i is denoted the starting index of=substring\n for (let i = 0; i < n - k + 1; ++i) {\n // value of j is show the last index of substring\n\n let j = i + k - 1;\n\n if (table[i + 1][j - 1] && str[i] == str[j]) {\n table[i][j] = true;\n if (k > max_length) {\n start = i;\n console.log(\"i = \" + i);\n max_length = k;\n console.log(k);\n }\n }\n }\n }\n return str.substring(start, start + max_length);\n}",
"function longestPalindromicSubstring(string) {\n //edge case\n if (string.length === 1 || string.length === 2) return string[0]\n let maxPalindrome = ''\n // Write your code here.\n for ( let i = 0; i < string.length; i++){\n let potentialPalindrome = palindromeicSpreadChecker(string, i);\n if (potentialPalindrome.length > maxPalindrome.length) { maxPalindrome = potentialPalindrome };\n }\n console.log(maxPalindrome);\n return maxPalindrome\n }",
"function longestPalindrome(s) {\n var max_length = 0;\n maxLen = '';\n for (var i = 0; i < s.length; i++) {\n // we identify the substring and assign to a variable \n var subs = s.substr(i, s.length)\n for (var j = subs.length; j >= 0; j--) {\n var subStr = subs.substr(0, j);\n if (subStr.length <= 1)\n continue;\n if (isPalindrome(subStr)) {\n if (subStr.length > max_length) {\n max_length == subStr\n maxLen = subStr\n }\n }\n\n }\n }\n return maxLen;\n}",
"function palindrom(x) {\n return (\n x ===\n Number(\n x\n .toString()\n .split('')\n .reverse()\n .join('')\n )\n );\n}",
"function longestPalindrome(str) {\n\n let arr = [...Array(128)].map(x => 0);\n\n for (const s of str.split(\"\")) {\n arr[s.charCodeAt(0)]++;\n }\n let length = 0;\n\n for (const chr of arr) {\n length += chr % 2 == 0 ? chr : chr - 1;\n }\n\n if (length < str.length) length++;\n \n return length;\n }",
"function longestPalindrome(str){\n\tif(typeof str !== \"string\"){\n\t\treturn TypeError(\"Enter the argument as a string\")\n\t} else if (str === \" \"){\n\t\treturn Error(\"String cannot be empty\")\n\t}else {\n\t\tlet arrayOfWords = str.toLowerCase().split(\" \")\n\t\tlet listOfPalindromes = []\n\n\t\tarrayOfWords.forEach(word => {\n\n\t\t\tlet reverseWord = word.split(\"\").reverse().join(\"\")\n\t\t\tif (word === reverseWord){\n\t\t\t\tlistOfPalindromes.push(word)\n\t\t\t}\n\t\t})\n\n\t\tlet initial = listOfPalindromes[0]\n\t\tlet highest = initial.length\n\t\tlet longestWord = initial\n\n\t\tfor (let i = 1; i < listOfPalindromes.length; i++){\n\t\t\tlet word = listOfPalindromes[i]\n\t\t\tif(word.length > highest){\n\t\t\t\thighest = word.length\n\t\t\t\tlongestWord = word\n\t\t\t}\n\t\t}\n\n\t\treturn longestWord;\n\t}\n}",
"function shortPalindrome(s) {\n let m = 1000000007;\n let first = [];\n let second = [];\n let third = [];\n for (let i = 0; i < 26; i++) {\n first[i] = 0;\n second[i] = [];\n third[i] = 0;\n for (let j = 0; j < 26; j++) {\n second[i][j] = 0;\n }\n }\n\n let count = 0;\n for (let i = 0; i < s.length; i++) {\n let current = s.charCodeAt(i) - 97;\n count = (count + third[current]) % m;\n for (let j = 0; j < 26; j++) {\n third[j] = (third[j] + second[j][current]) % m;\n }\n for (let j = 0; j < 26; j++) {\n second[j][current] = (second[j][current] + first[j]) % m;\n }\n first[current] = (first[current] + 1) % m;\n }\n return count;\n}",
"function numPali2 (num) {\n return parseInt(num.toString().split('').reverse().join('')) === num;\n}",
"function LargestPair(num) {\n let strNum = String(num);\n let pairs = [];\n\n for (let i = 0; i < strNum.length - 1; i++) {\n pairs.push(Number(strNum[i] + strNum[i + 1]));\n }\n\n return pairs.reduce((p, c) => Math.max(p, c));\n}",
"function palidrome(firstNumber , secondNumber){ \n let reverse = 0;\n let remainder = 0;\n while(secondNumber > 0){\n remainder = Math.floor(secondNumber % 10) ;\n reverse = reverse * 10 + remainder;\n secondNumber = Math.floor(secondNumber / 10 );\n }\n if(firstNumber == reverse){\n console.log(\"Number is Palidrome\");\n }\n else{\n console.log(\"Number is not palidrome\");\n }\n}",
"function longestPalindrome(str) {\n\n //it's only a palindrome if the first and last letter are the same and the pattern repeats to the \"center\"\n //check first and last character, if they are different, check first and second-to-last character\n //when you find a match, repeat the process\n\n let leftIndex = 0;\n let longest = \"\";\n\n while (leftIndex < str.length) {\n\n let rightIndex = str.length - 1;\n\n while (rightIndex >= leftIndex) {\n let offset = 0;\n\n while (str[leftIndex + offset] === str[rightIndex - offset] && leftIndex + offset < str.length) {\n offset++;\n }\n\n if (leftIndex + (2 * offset) >= rightIndex) {\n let palindrome = str.substring(leftIndex, rightIndex + 1);\n\n if (palindrome.length === str.length) {\n return str;\n }\n\n if (palindrome.length > longest.length) {\n longest = palindrome;\n }\n\n }\n rightIndex--;\n }\n leftIndex++;\n }\n\n return longest;\n\n // let longest = \"\";\n //\n // let rightIndex = str.length - 1;\n //\n // while (rightIndex >= 0) {\n //\n // let leftIndex = 0;\n //\n // while (leftIndex < rightIndex) {\n //\n // let count = 0;\n //\n // while (str[leftIndex] === str[rightIndex] && rightIndex > leftIndex) {\n // leftIndex++;\n // rightIndex--;\n // count++;\n // }\n //\n // if (rightIndex <= leftIndex) {\n // let palindrome = str.substring(leftIndex - count, rightIndex + count + 1);\n // if (palindrome.length > longest.length) {\n // longest = palindrome;\n // }\n // }\n // leftIndex++;\n // }\n // rightIndex--;\n // }\n //\n // return longest;\n\n //length <= 1 returns self\n //\n // let longestPalindrome = \"\";\n // let leftIndex = 0;\n //\n //\n // //example: badbob popop abacbacba\n //\n //\n // while (leftIndex < str.length) {\n //\n // let rightIndex = str.length - 1;\n //\n // while (rightIndex > leftIndex) {\n //\n // while (str[leftIndex] !== str[rightIndex] && rightIndex > leftIndex) {\n // rightIndex--;\n // }\n //\n // let iterations = (rightIndex - leftIndex) / 2;\n // let count = 0;\n //\n // while (count < iterations) {\n // leftIndex++;\n // rightIndex--;\n //\n // if (str[leftIndex] !== str[rightIndex]) {\n // break;\n // }\n // count++;\n // }\n //\n // if (count === iterations) {\n // let palindrome = str.substring(leftIndex - iterations, rightIndex + iterations + 1);\n // if (palindrome.length > longestPalindrome.length) {\n // longestPalindrome = palindrome;\n // }\n // }\n // rightIndex--;\n // }\n // leftIndex++;\n // }\n //\n // return longestPalindrome;\n}",
"function longestPalindrome(s) { // O(n^3)\n let size = s.length;\n while(size > 1) {\n for(let i = 0; i + size - 1 < s.length; i++) {\n if(_isPalindrome(s, i, i + size - 1)) {\n return s.slice(i, i + size);\n }\n }\n size--;\n }\n return s.charAt(0);\n}",
"function checkPalindrome(num) {\r\n var n = num.toString();\r\n return Number(n.split('').reverse().join(''));\r\n}",
"function longestPallindrome(str) {\n for (x=0;x<str.length/2;x++){\n for (j=0;x<str.legnth/2;j++){\n if (str[x] !=str[str.length-x-1]){\n return true\n }\n }return false\n }\n}",
"function palindrome(word) {\n let first, second;\n \n if (word.length % 2 === 0) {\n first = word.length / 2 - 1\n second = word.length / 2\n \n } else {\n first = Math.floor(word.length / 2) - 1\n second = Math.floor(word.length / 2) + 1\n console.log(first, second)\n }\n \n for (let i = 0; i < Math.floor(word.length / 2); i++) {\n if (word[first] !== word[second]) {\n return 'N'\n }\n first--;\n second++;\n }\n return 'Y'\n }",
"function longestPalindromicSubstring(string) {\n if (string.length === 1 || !string.length) return string;\n let count = 0;\n let palindrome = '';\n \n for (let i = 0; i < string.length; i++) {\n\n // First while loop, with current letter as the middle\n let left = i - 1;\n let right = i + 1;\n let temp = 1;\n let curPal = string[i]\n while (left >= 0 && right < string.length) {\n if (string[left] === string[right]) {\n curPal = string[left] + curPal + string[right];\n temp += 2;\n ++right;\n --left;\n } else break;\n }\n if (temp > count) {\n palindrome = curPal;\n count = temp;\n }\n \n // Second while loop scenario, with between i and i+1 as the middle\n left = i;\n right = i + 1;\n temp = 0;\n curPal = '';\n\n while (left >= 0 && right < string.length) {\n if (string[left] === string[right]) {\n curPal = string[left] + curPal + string[right];\n temp += 2;\n ++right;\n --left;\n } else break;\n }\n if (temp > count) {\n palindrome = curPal;\n count = temp;\n }\n }\n return palindrome\n }",
"function buildPalindrome(a, b) {\n // compare the first string char by char to the second string char by char\n\n // iterate through each char of first string\n // compare current char to each char of second string starting from the end\n // if there's a match attempt palindrome assembly\n // compare char right of cur char in first string to char left of cur char in second string\n // if matches are successful and we run out of char to compare log as palindrome\n\n\n // iterate through each char of first string\n // compare current char to each char of second string starting from the end\n // if there's a match attempt palindrome assembly\n // combine both strings from using matches as start/end points ex: ('dfebhbe' + 'xfd') ('ac' + 'ba' ) ('dfh' + 'fd')\n // compare characters starting from the center (if odd length skip middle) (dfebhbexfd)\n \n let short, long\n\n if (a.length > b.length ) {\n long = a;\n short = b;\n } else {\n long = b;\n short = a;\n }\n\n findFragment(short.reverse(), long, short.length);\n\n}"
]
| [
"0.8244534",
"0.79137754",
"0.77638936",
"0.7744406",
"0.7543545",
"0.68317336",
"0.6761058",
"0.6756271",
"0.6684387",
"0.66421425",
"0.66368604",
"0.66197836",
"0.6540573",
"0.6489629",
"0.64078575",
"0.636488",
"0.6334653",
"0.6264511",
"0.6263654",
"0.62555104",
"0.6255457",
"0.62084216",
"0.61393905",
"0.6131655",
"0.6120181",
"0.6086627",
"0.6079622",
"0.6036715",
"0.60342413",
"0.60331553"
]
| 0.79189456 | 1 |
Generates the surface procedure | function compileSurfaceProcedure(vertexFunc, faceFunc, phaseFunc, scalarArgs, order, typesig) {
var key = [typesig, order].join(',')
var proc = allFns[key]
return proc(
vertexFunc,
faceFunc,
phaseFunc,
pool.mallocUint32,
pool.freeUint32)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"createSurface() {\n let controlPoints = [];\n for (var i = 0, k = 0; i < this.nPointsU; i++) {\n let uPoint = [];\n for (var j = 0; j < this.nPointsV; j++, k++) {\n this.controlPoints[k].push(1);\n uPoint.push(this.controlPoints[k]);\n }\n controlPoints.push(uPoint);\n }\n\n\t\t\t\tlet nurbsSurface = new CGFnurbsSurface(this.nPointsU-1, this.nPointsV-1, controlPoints);\n\n\t\t\t\tthis.nurbsPlane = new CGFnurbsObject(this.scene, this.nPartsU, this.nPartsV, nurbsSurface);\n\t\t}",
"function compileSurfaceProcedure(vertexFunc, faceFunc, phaseFunc, scalarArgs, order, typesig) {\n var arrayArgs = typesig.length\n var dimension = order.length\n\n if(dimension < 2) {\n throw new Error(\"ndarray-extract-contour: Dimension must be at least 2\")\n }\n\n var funcName = \"extractContour\" + order.join(\"_\")\n var code = []\n var vars = []\n var args = []\n\n //Assemble arguments\n for(var i=0; i<arrayArgs; ++i) {\n args.push(array(i)) \n }\n for(var i=0; i<scalarArgs; ++i) {\n args.push(scalar(i))\n }\n\n //Shape\n for(var i=0; i<dimension; ++i) {\n vars.push(shape(i) + \"=\" + array(0) + \".shape[\" + i + \"]|0\")\n }\n //Data, stride, offset pointers\n for(var i=0; i<arrayArgs; ++i) {\n vars.push(data(i) + \"=\" + array(i) + \".data\",\n offset(i) + \"=\" + array(i) + \".offset|0\")\n for(var j=0; j<dimension; ++j) {\n vars.push(stride(i,j) + \"=\" + array(i) + \".stride[\" + j + \"]|0\")\n }\n }\n //Pointer, delta and cube variables\n for(var i=0; i<arrayArgs; ++i) {\n vars.push(pointer(i) + \"=\" + offset(i))\n vars.push(cube(i,0))\n for(var j=1; j<(1<<dimension); ++j) {\n var ptrStr = []\n for(var k=0; k<dimension; ++k) {\n if(j & (1<<k)) {\n ptrStr.push(\"-\" + stride(i,k))\n }\n }\n vars.push(delta(i,j) + \"=(\" + ptrStr.join(\"\") + \")|0\")\n vars.push(cube(i,j) + \"=0\")\n }\n }\n //Create step variables\n for(var i=0; i<arrayArgs; ++i) {\n for(var j=0; j<dimension; ++j) {\n var stepVal = [ stride(i,order[j]) ]\n if(j > 0) {\n stepVal.push(stride(i, order[j-1]) + \"*\" + shape(order[j-1]) )\n }\n vars.push(step(i,order[j]) + \"=(\" + stepVal.join(\"-\") + \")|0\")\n }\n }\n //Create index variables\n for(var i=0; i<dimension; ++i) {\n vars.push(index(i) + \"=0\")\n }\n //Vertex count\n vars.push(VERTEX_COUNT + \"=0\")\n //Compute pool size, initialize pool step\n var sizeVariable = [\"2\"]\n for(var i=dimension-2; i>=0; --i) {\n sizeVariable.push(shape(order[i]))\n }\n //Previous phases and vertex_ids\n vars.push(POOL_SIZE + \"=(\" + sizeVariable.join(\"*\") + \")|0\",\n PHASES + \"=mallocUint32(\" + POOL_SIZE + \")\",\n VERTEX_IDS + \"=mallocUint32(\" + POOL_SIZE + \")\",\n POINTER + \"=0\")\n //Create cube variables for phases\n vars.push(pcube(0) + \"=0\")\n for(var j=1; j<(1<<dimension); ++j) {\n var cubeDelta = []\n var cubeStep = [ ]\n for(var k=0; k<dimension; ++k) {\n if(j & (1<<k)) {\n if(cubeStep.length === 0) {\n cubeDelta.push(\"1\")\n } else {\n cubeDelta.unshift(cubeStep.join(\"*\"))\n }\n }\n cubeStep.push(shape(order[k]))\n }\n var signFlag = \"\"\n if(cubeDelta[0].indexOf(shape(order[dimension-2])) < 0) {\n signFlag = \"-\"\n }\n var jperm = permBitmask(dimension, j, order)\n vars.push(pdelta(jperm) + \"=(-\" + cubeDelta.join(\"-\") + \")|0\",\n qcube(jperm) + \"=(\" + signFlag + cubeDelta.join(\"-\") + \")|0\",\n pcube(jperm) + \"=0\")\n }\n vars.push(vert(0) + \"=0\", TEMPORARY + \"=0\")\n\n function forLoopBegin(i, start) {\n code.push(\"for(\", index(order[i]), \"=\", start, \";\",\n index(order[i]), \"<\", shape(order[i]), \";\",\n \"++\", index(order[i]), \"){\")\n }\n\n function forLoopEnd(i) {\n for(var j=0; j<arrayArgs; ++j) {\n code.push(pointer(j), \"+=\", step(j,order[i]), \";\")\n }\n code.push(\"}\")\n }\n\n function fillEmptySlice(k) {\n for(var i=k-1; i>=0; --i) {\n forLoopBegin(i, 0) \n }\n var phaseFuncArgs = []\n for(var i=0; i<arrayArgs; ++i) {\n if(typesig[i]) {\n phaseFuncArgs.push(data(i) + \".get(\" + pointer(i) + \")\")\n } else {\n phaseFuncArgs.push(data(i) + \"[\" + pointer(i) + \"]\")\n }\n }\n for(var i=0; i<scalarArgs; ++i) {\n phaseFuncArgs.push(scalar(i))\n }\n code.push(PHASES, \"[\", POINTER, \"++]=phase(\", phaseFuncArgs.join(), \");\")\n for(var i=0; i<k; ++i) {\n forLoopEnd(i)\n }\n for(var j=0; j<arrayArgs; ++j) {\n code.push(pointer(j), \"+=\", step(j,order[k]), \";\")\n }\n }\n\n function processGridCell(mask) {\n //Read in local data\n for(var i=0; i<arrayArgs; ++i) {\n if(typesig[i]) {\n code.push(cube(i,0), \"=\", data(i), \".get(\", pointer(i), \");\")\n } else {\n code.push(cube(i,0), \"=\", data(i), \"[\", pointer(i), \"];\")\n }\n }\n\n //Read in phase\n var phaseFuncArgs = []\n for(var i=0; i<arrayArgs; ++i) {\n phaseFuncArgs.push(cube(i,0))\n }\n for(var i=0; i<scalarArgs; ++i) {\n phaseFuncArgs.push(scalar(i))\n }\n \n code.push(pcube(0), \"=\", PHASES, \"[\", POINTER, \"]=phase(\", phaseFuncArgs.join(), \");\")\n \n //Read in other cube data\n for(var j=1; j<(1<<dimension); ++j) {\n code.push(pcube(j), \"=\", PHASES, \"[\", POINTER, \"+\", pdelta(j), \"];\")\n }\n\n //Check for boundary crossing\n var vertexPredicate = []\n for(var j=1; j<(1<<dimension); ++j) {\n vertexPredicate.push(\"(\" + pcube(0) + \"!==\" + pcube(j) + \")\")\n }\n code.push(\"if(\", vertexPredicate.join(\"||\"), \"){\")\n\n //Read in boundary data\n var vertexArgs = []\n for(var i=0; i<dimension; ++i) {\n vertexArgs.push(index(i))\n }\n for(var i=0; i<arrayArgs; ++i) {\n vertexArgs.push(cube(i,0))\n for(var j=1; j<(1<<dimension); ++j) {\n if(typesig[i]) {\n code.push(cube(i,j), \"=\", data(i), \".get(\", pointer(i), \"+\", delta(i,j), \");\")\n } else {\n code.push(cube(i,j), \"=\", data(i), \"[\", pointer(i), \"+\", delta(i,j), \"];\")\n }\n vertexArgs.push(cube(i,j))\n }\n }\n for(var i=0; i<(1<<dimension); ++i) {\n vertexArgs.push(pcube(i))\n }\n for(var i=0; i<scalarArgs; ++i) {\n vertexArgs.push(scalar(i))\n }\n\n //Generate vertex\n code.push(\"vertex(\", vertexArgs.join(), \");\",\n vert(0), \"=\", VERTEX_IDS, \"[\", POINTER, \"]=\", VERTEX_COUNT, \"++;\")\n\n //Check for face crossings\n var base = (1<<dimension)-1\n var corner = pcube(base)\n for(var j=0; j<dimension; ++j) {\n if((mask & ~(1<<j))===0) {\n //Check face\n var subset = base^(1<<j)\n var edge = pcube(subset)\n var faceArgs = [ ]\n for(var k=subset; k>0; k=(k-1)&subset) {\n faceArgs.push(VERTEX_IDS + \"[\" + POINTER + \"+\" + pdelta(k) + \"]\")\n }\n faceArgs.push(vert(0))\n for(var k=0; k<arrayArgs; ++k) {\n if(j&1) {\n faceArgs.push(cube(k,base), cube(k,subset))\n } else {\n faceArgs.push(cube(k,subset), cube(k,base))\n }\n }\n if(j&1) {\n faceArgs.push(corner, edge)\n } else {\n faceArgs.push(edge, corner)\n }\n for(var k=0; k<scalarArgs; ++k) {\n faceArgs.push(scalar(k))\n }\n code.push(\"if(\", corner, \"!==\", edge, \"){\",\n \"face(\", faceArgs.join(), \")}\")\n }\n }\n \n //Increment pointer, close off if statement\n code.push(\"}\",\n POINTER, \"+=1;\")\n }\n\n function flip() {\n for(var j=1; j<(1<<dimension); ++j) {\n code.push(TEMPORARY, \"=\", pdelta(j), \";\",\n pdelta(j), \"=\", qcube(j), \";\",\n qcube(j), \"=\", TEMPORARY, \";\")\n }\n }\n\n function createLoop(i, mask) {\n if(i < 0) {\n processGridCell(mask)\n return\n }\n fillEmptySlice(i)\n code.push(\"if(\", shape(order[i]), \">0){\",\n index(order[i]), \"=1;\")\n createLoop(i-1, mask|(1<<order[i]))\n\n for(var j=0; j<arrayArgs; ++j) {\n code.push(pointer(j), \"+=\", step(j,order[i]), \";\")\n }\n if(i === dimension-1) {\n code.push(POINTER, \"=0;\")\n flip()\n }\n forLoopBegin(i, 2)\n createLoop(i-1, mask)\n if(i === dimension-1) {\n code.push(\"if(\", index(order[dimension-1]), \"&1){\",\n POINTER, \"=0;}\")\n flip()\n }\n forLoopEnd(i)\n code.push(\"}\")\n }\n\n createLoop(dimension-1, 0)\n\n //Release scratch memory\n code.push(\"freeUint32(\", VERTEX_IDS, \");freeUint32(\", PHASES, \");\")\n\n //Compile and link procedure\n var procedureCode = [\n \"'use strict';\",\n \"function \", funcName, \"(\", args.join(), \"){\",\n \"var \", vars.join(), \";\",\n code.join(\"\"),\n \"}\",\n \"return \", funcName ].join(\"\")\n\n var proc = new Function(\n \"vertex\", \n \"face\", \n \"phase\", \n \"mallocUint32\", \n \"freeUint32\",\n procedureCode)\n return proc(\n vertexFunc, \n faceFunc, \n phaseFunc, \n pool.mallocUint32, \n pool.freeUint32)\n}",
"function compileSurfaceProcedure(vertexFunc, faceFunc, phaseFunc, scalarArgs, order, typesig) {\n\t var arrayArgs = typesig.length\n\t var dimension = order.length\n\t\n\t if(dimension < 2) {\n\t throw new Error(\"ndarray-extract-contour: Dimension must be at least 2\")\n\t }\n\t\n\t var funcName = \"extractContour\" + order.join(\"_\")\n\t var code = []\n\t var vars = []\n\t var args = []\n\t\n\t //Assemble arguments\n\t for(var i=0; i<arrayArgs; ++i) {\n\t args.push(array(i)) \n\t }\n\t for(var i=0; i<scalarArgs; ++i) {\n\t args.push(scalar(i))\n\t }\n\t\n\t //Shape\n\t for(var i=0; i<dimension; ++i) {\n\t vars.push(shape(i) + \"=\" + array(0) + \".shape[\" + i + \"]|0\")\n\t }\n\t //Data, stride, offset pointers\n\t for(var i=0; i<arrayArgs; ++i) {\n\t vars.push(data(i) + \"=\" + array(i) + \".data\",\n\t offset(i) + \"=\" + array(i) + \".offset|0\")\n\t for(var j=0; j<dimension; ++j) {\n\t vars.push(stride(i,j) + \"=\" + array(i) + \".stride[\" + j + \"]|0\")\n\t }\n\t }\n\t //Pointer, delta and cube variables\n\t for(var i=0; i<arrayArgs; ++i) {\n\t vars.push(pointer(i) + \"=\" + offset(i))\n\t vars.push(cube(i,0))\n\t for(var j=1; j<(1<<dimension); ++j) {\n\t var ptrStr = []\n\t for(var k=0; k<dimension; ++k) {\n\t if(j & (1<<k)) {\n\t ptrStr.push(\"-\" + stride(i,k))\n\t }\n\t }\n\t vars.push(delta(i,j) + \"=(\" + ptrStr.join(\"\") + \")|0\")\n\t vars.push(cube(i,j) + \"=0\")\n\t }\n\t }\n\t //Create step variables\n\t for(var i=0; i<arrayArgs; ++i) {\n\t for(var j=0; j<dimension; ++j) {\n\t var stepVal = [ stride(i,order[j]) ]\n\t if(j > 0) {\n\t stepVal.push(stride(i, order[j-1]) + \"*\" + shape(order[j-1]) )\n\t }\n\t vars.push(step(i,order[j]) + \"=(\" + stepVal.join(\"-\") + \")|0\")\n\t }\n\t }\n\t //Create index variables\n\t for(var i=0; i<dimension; ++i) {\n\t vars.push(index(i) + \"=0\")\n\t }\n\t //Vertex count\n\t vars.push(VERTEX_COUNT + \"=0\")\n\t //Compute pool size, initialize pool step\n\t var sizeVariable = [\"2\"]\n\t for(var i=dimension-2; i>=0; --i) {\n\t sizeVariable.push(shape(order[i]))\n\t }\n\t //Previous phases and vertex_ids\n\t vars.push(POOL_SIZE + \"=(\" + sizeVariable.join(\"*\") + \")|0\",\n\t PHASES + \"=mallocUint32(\" + POOL_SIZE + \")\",\n\t VERTEX_IDS + \"=mallocUint32(\" + POOL_SIZE + \")\",\n\t POINTER + \"=0\")\n\t //Create cube variables for phases\n\t vars.push(pcube(0) + \"=0\")\n\t for(var j=1; j<(1<<dimension); ++j) {\n\t var cubeDelta = []\n\t var cubeStep = [ ]\n\t for(var k=0; k<dimension; ++k) {\n\t if(j & (1<<k)) {\n\t if(cubeStep.length === 0) {\n\t cubeDelta.push(\"1\")\n\t } else {\n\t cubeDelta.unshift(cubeStep.join(\"*\"))\n\t }\n\t }\n\t cubeStep.push(shape(order[k]))\n\t }\n\t var signFlag = \"\"\n\t if(cubeDelta[0].indexOf(shape(order[dimension-2])) < 0) {\n\t signFlag = \"-\"\n\t }\n\t var jperm = permBitmask(dimension, j, order)\n\t vars.push(pdelta(jperm) + \"=(-\" + cubeDelta.join(\"-\") + \")|0\",\n\t qcube(jperm) + \"=(\" + signFlag + cubeDelta.join(\"-\") + \")|0\",\n\t pcube(jperm) + \"=0\")\n\t }\n\t vars.push(vert(0) + \"=0\", TEMPORARY + \"=0\")\n\t\n\t function forLoopBegin(i, start) {\n\t code.push(\"for(\", index(order[i]), \"=\", start, \";\",\n\t index(order[i]), \"<\", shape(order[i]), \";\",\n\t \"++\", index(order[i]), \"){\")\n\t }\n\t\n\t function forLoopEnd(i) {\n\t for(var j=0; j<arrayArgs; ++j) {\n\t code.push(pointer(j), \"+=\", step(j,order[i]), \";\")\n\t }\n\t code.push(\"}\")\n\t }\n\t\n\t function fillEmptySlice(k) {\n\t for(var i=k-1; i>=0; --i) {\n\t forLoopBegin(i, 0) \n\t }\n\t var phaseFuncArgs = []\n\t for(var i=0; i<arrayArgs; ++i) {\n\t if(typesig[i]) {\n\t phaseFuncArgs.push(data(i) + \".get(\" + pointer(i) + \")\")\n\t } else {\n\t phaseFuncArgs.push(data(i) + \"[\" + pointer(i) + \"]\")\n\t }\n\t }\n\t for(var i=0; i<scalarArgs; ++i) {\n\t phaseFuncArgs.push(scalar(i))\n\t }\n\t code.push(PHASES, \"[\", POINTER, \"++]=phase(\", phaseFuncArgs.join(), \");\")\n\t for(var i=0; i<k; ++i) {\n\t forLoopEnd(i)\n\t }\n\t for(var j=0; j<arrayArgs; ++j) {\n\t code.push(pointer(j), \"+=\", step(j,order[k]), \";\")\n\t }\n\t }\n\t\n\t function processGridCell(mask) {\n\t //Read in local data\n\t for(var i=0; i<arrayArgs; ++i) {\n\t if(typesig[i]) {\n\t code.push(cube(i,0), \"=\", data(i), \".get(\", pointer(i), \");\")\n\t } else {\n\t code.push(cube(i,0), \"=\", data(i), \"[\", pointer(i), \"];\")\n\t }\n\t }\n\t\n\t //Read in phase\n\t var phaseFuncArgs = []\n\t for(var i=0; i<arrayArgs; ++i) {\n\t phaseFuncArgs.push(cube(i,0))\n\t }\n\t for(var i=0; i<scalarArgs; ++i) {\n\t phaseFuncArgs.push(scalar(i))\n\t }\n\t \n\t code.push(pcube(0), \"=\", PHASES, \"[\", POINTER, \"]=phase(\", phaseFuncArgs.join(), \");\")\n\t \n\t //Read in other cube data\n\t for(var j=1; j<(1<<dimension); ++j) {\n\t code.push(pcube(j), \"=\", PHASES, \"[\", POINTER, \"+\", pdelta(j), \"];\")\n\t }\n\t\n\t //Check for boundary crossing\n\t var vertexPredicate = []\n\t for(var j=1; j<(1<<dimension); ++j) {\n\t vertexPredicate.push(\"(\" + pcube(0) + \"!==\" + pcube(j) + \")\")\n\t }\n\t code.push(\"if(\", vertexPredicate.join(\"||\"), \"){\")\n\t\n\t //Read in boundary data\n\t var vertexArgs = []\n\t for(var i=0; i<dimension; ++i) {\n\t vertexArgs.push(index(i))\n\t }\n\t for(var i=0; i<arrayArgs; ++i) {\n\t vertexArgs.push(cube(i,0))\n\t for(var j=1; j<(1<<dimension); ++j) {\n\t if(typesig[i]) {\n\t code.push(cube(i,j), \"=\", data(i), \".get(\", pointer(i), \"+\", delta(i,j), \");\")\n\t } else {\n\t code.push(cube(i,j), \"=\", data(i), \"[\", pointer(i), \"+\", delta(i,j), \"];\")\n\t }\n\t vertexArgs.push(cube(i,j))\n\t }\n\t }\n\t for(var i=0; i<(1<<dimension); ++i) {\n\t vertexArgs.push(pcube(i))\n\t }\n\t for(var i=0; i<scalarArgs; ++i) {\n\t vertexArgs.push(scalar(i))\n\t }\n\t\n\t //Generate vertex\n\t code.push(\"vertex(\", vertexArgs.join(), \");\",\n\t vert(0), \"=\", VERTEX_IDS, \"[\", POINTER, \"]=\", VERTEX_COUNT, \"++;\")\n\t\n\t //Check for face crossings\n\t var base = (1<<dimension)-1\n\t var corner = pcube(base)\n\t for(var j=0; j<dimension; ++j) {\n\t if((mask & ~(1<<j))===0) {\n\t //Check face\n\t var subset = base^(1<<j)\n\t var edge = pcube(subset)\n\t var faceArgs = [ ]\n\t for(var k=subset; k>0; k=(k-1)&subset) {\n\t faceArgs.push(VERTEX_IDS + \"[\" + POINTER + \"+\" + pdelta(k) + \"]\")\n\t }\n\t faceArgs.push(vert(0))\n\t for(var k=0; k<arrayArgs; ++k) {\n\t if(j&1) {\n\t faceArgs.push(cube(k,base), cube(k,subset))\n\t } else {\n\t faceArgs.push(cube(k,subset), cube(k,base))\n\t }\n\t }\n\t if(j&1) {\n\t faceArgs.push(corner, edge)\n\t } else {\n\t faceArgs.push(edge, corner)\n\t }\n\t for(var k=0; k<scalarArgs; ++k) {\n\t faceArgs.push(scalar(k))\n\t }\n\t code.push(\"if(\", corner, \"!==\", edge, \"){\",\n\t \"face(\", faceArgs.join(), \")}\")\n\t }\n\t }\n\t \n\t //Increment pointer, close off if statement\n\t code.push(\"}\",\n\t POINTER, \"+=1;\")\n\t }\n\t\n\t function flip() {\n\t for(var j=1; j<(1<<dimension); ++j) {\n\t code.push(TEMPORARY, \"=\", pdelta(j), \";\",\n\t pdelta(j), \"=\", qcube(j), \";\",\n\t qcube(j), \"=\", TEMPORARY, \";\")\n\t }\n\t }\n\t\n\t function createLoop(i, mask) {\n\t if(i < 0) {\n\t processGridCell(mask)\n\t return\n\t }\n\t fillEmptySlice(i)\n\t code.push(\"if(\", shape(order[i]), \">0){\",\n\t index(order[i]), \"=1;\")\n\t createLoop(i-1, mask|(1<<order[i]))\n\t\n\t for(var j=0; j<arrayArgs; ++j) {\n\t code.push(pointer(j), \"+=\", step(j,order[i]), \";\")\n\t }\n\t if(i === dimension-1) {\n\t code.push(POINTER, \"=0;\")\n\t flip()\n\t }\n\t forLoopBegin(i, 2)\n\t createLoop(i-1, mask)\n\t if(i === dimension-1) {\n\t code.push(\"if(\", index(order[dimension-1]), \"&1){\",\n\t POINTER, \"=0;}\")\n\t flip()\n\t }\n\t forLoopEnd(i)\n\t code.push(\"}\")\n\t }\n\t\n\t createLoop(dimension-1, 0)\n\t\n\t //Release scratch memory\n\t code.push(\"freeUint32(\", VERTEX_IDS, \");freeUint32(\", PHASES, \");\")\n\t\n\t //Compile and link procedure\n\t var procedureCode = [\n\t \"'use strict';\",\n\t \"function \", funcName, \"(\", args.join(), \"){\",\n\t \"var \", vars.join(), \";\",\n\t code.join(\"\"),\n\t \"}\",\n\t \"return \", funcName ].join(\"\")\n\t\n\t var proc = new Function(\n\t \"vertex\", \n\t \"face\", \n\t \"phase\", \n\t \"mallocUint32\", \n\t \"freeUint32\",\n\t procedureCode)\n\t return proc(\n\t vertexFunc, \n\t faceFunc, \n\t phaseFunc, \n\t pool.mallocUint32, \n\t pool.freeUint32)\n\t}",
"function compileSurfaceProcedure(vertexFunc, faceFunc, phaseFunc, scalarArgs, order, typesig) {\n\t var arrayArgs = typesig.length\n\t var dimension = order.length\n\t\n\t if(dimension < 2) {\n\t throw new Error(\"ndarray-extract-contour: Dimension must be at least 2\")\n\t }\n\t\n\t var funcName = \"extractContour\" + order.join(\"_\")\n\t var code = []\n\t var vars = []\n\t var args = []\n\t\n\t //Assemble arguments\n\t for(var i=0; i<arrayArgs; ++i) {\n\t args.push(array(i)) \n\t }\n\t for(var i=0; i<scalarArgs; ++i) {\n\t args.push(scalar(i))\n\t }\n\t\n\t //Shape\n\t for(var i=0; i<dimension; ++i) {\n\t vars.push(shape(i) + \"=\" + array(0) + \".shape[\" + i + \"]|0\")\n\t }\n\t //Data, stride, offset pointers\n\t for(var i=0; i<arrayArgs; ++i) {\n\t vars.push(data(i) + \"=\" + array(i) + \".data\",\n\t offset(i) + \"=\" + array(i) + \".offset|0\")\n\t for(var j=0; j<dimension; ++j) {\n\t vars.push(stride(i,j) + \"=\" + array(i) + \".stride[\" + j + \"]|0\")\n\t }\n\t }\n\t //Pointer, delta and cube variables\n\t for(var i=0; i<arrayArgs; ++i) {\n\t vars.push(pointer(i) + \"=\" + offset(i))\n\t vars.push(cube(i,0))\n\t for(var j=1; j<(1<<dimension); ++j) {\n\t var ptrStr = []\n\t for(var k=0; k<dimension; ++k) {\n\t if(j & (1<<k)) {\n\t ptrStr.push(\"-\" + stride(i,k))\n\t }\n\t }\n\t vars.push(delta(i,j) + \"=(\" + ptrStr.join(\"\") + \")|0\")\n\t vars.push(cube(i,j) + \"=0\")\n\t }\n\t }\n\t //Create step variables\n\t for(var i=0; i<arrayArgs; ++i) {\n\t for(var j=0; j<dimension; ++j) {\n\t var stepVal = [ stride(i,order[j]) ]\n\t if(j > 0) {\n\t stepVal.push(stride(i, order[j-1]) + \"*\" + shape(order[j-1]) )\n\t }\n\t vars.push(step(i,order[j]) + \"=(\" + stepVal.join(\"-\") + \")|0\")\n\t }\n\t }\n\t //Create index variables\n\t for(var i=0; i<dimension; ++i) {\n\t vars.push(index(i) + \"=0\")\n\t }\n\t //Vertex count\n\t vars.push(VERTEX_COUNT + \"=0\")\n\t //Compute pool size, initialize pool step\n\t var sizeVariable = [\"2\"]\n\t for(var i=dimension-2; i>=0; --i) {\n\t sizeVariable.push(shape(order[i]))\n\t }\n\t //Previous phases and vertex_ids\n\t vars.push(POOL_SIZE + \"=(\" + sizeVariable.join(\"*\") + \")|0\",\n\t PHASES + \"=mallocUint32(\" + POOL_SIZE + \")\",\n\t VERTEX_IDS + \"=mallocUint32(\" + POOL_SIZE + \")\",\n\t POINTER + \"=0\")\n\t //Create cube variables for phases\n\t vars.push(pcube(0) + \"=0\")\n\t for(var j=1; j<(1<<dimension); ++j) {\n\t var cubeDelta = []\n\t var cubeStep = [ ]\n\t for(var k=0; k<dimension; ++k) {\n\t if(j & (1<<k)) {\n\t if(cubeStep.length === 0) {\n\t cubeDelta.push(\"1\")\n\t } else {\n\t cubeDelta.unshift(cubeStep.join(\"*\"))\n\t }\n\t }\n\t cubeStep.push(shape(order[k]))\n\t }\n\t var signFlag = \"\"\n\t if(cubeDelta[0].indexOf(shape(order[dimension-2])) < 0) {\n\t signFlag = \"-\"\n\t }\n\t var jperm = permBitmask(dimension, j, order)\n\t vars.push(pdelta(jperm) + \"=(-\" + cubeDelta.join(\"-\") + \")|0\",\n\t qcube(jperm) + \"=(\" + signFlag + cubeDelta.join(\"-\") + \")|0\",\n\t pcube(jperm) + \"=0\")\n\t }\n\t vars.push(vert(0) + \"=0\", TEMPORARY + \"=0\")\n\t\n\t function forLoopBegin(i, start) {\n\t code.push(\"for(\", index(order[i]), \"=\", start, \";\",\n\t index(order[i]), \"<\", shape(order[i]), \";\",\n\t \"++\", index(order[i]), \"){\")\n\t }\n\t\n\t function forLoopEnd(i) {\n\t for(var j=0; j<arrayArgs; ++j) {\n\t code.push(pointer(j), \"+=\", step(j,order[i]), \";\")\n\t }\n\t code.push(\"}\")\n\t }\n\t\n\t function fillEmptySlice(k) {\n\t for(var i=k-1; i>=0; --i) {\n\t forLoopBegin(i, 0) \n\t }\n\t var phaseFuncArgs = []\n\t for(var i=0; i<arrayArgs; ++i) {\n\t if(typesig[i]) {\n\t phaseFuncArgs.push(data(i) + \".get(\" + pointer(i) + \")\")\n\t } else {\n\t phaseFuncArgs.push(data(i) + \"[\" + pointer(i) + \"]\")\n\t }\n\t }\n\t for(var i=0; i<scalarArgs; ++i) {\n\t phaseFuncArgs.push(scalar(i))\n\t }\n\t code.push(PHASES, \"[\", POINTER, \"++]=phase(\", phaseFuncArgs.join(), \");\")\n\t for(var i=0; i<k; ++i) {\n\t forLoopEnd(i)\n\t }\n\t for(var j=0; j<arrayArgs; ++j) {\n\t code.push(pointer(j), \"+=\", step(j,order[k]), \";\")\n\t }\n\t }\n\t\n\t function processGridCell(mask) {\n\t //Read in local data\n\t for(var i=0; i<arrayArgs; ++i) {\n\t if(typesig[i]) {\n\t code.push(cube(i,0), \"=\", data(i), \".get(\", pointer(i), \");\")\n\t } else {\n\t code.push(cube(i,0), \"=\", data(i), \"[\", pointer(i), \"];\")\n\t }\n\t }\n\t\n\t //Read in phase\n\t var phaseFuncArgs = []\n\t for(var i=0; i<arrayArgs; ++i) {\n\t phaseFuncArgs.push(cube(i,0))\n\t }\n\t for(var i=0; i<scalarArgs; ++i) {\n\t phaseFuncArgs.push(scalar(i))\n\t }\n\t \n\t code.push(pcube(0), \"=\", PHASES, \"[\", POINTER, \"]=phase(\", phaseFuncArgs.join(), \");\")\n\t \n\t //Read in other cube data\n\t for(var j=1; j<(1<<dimension); ++j) {\n\t code.push(pcube(j), \"=\", PHASES, \"[\", POINTER, \"+\", pdelta(j), \"];\")\n\t }\n\t\n\t //Check for boundary crossing\n\t var vertexPredicate = []\n\t for(var j=1; j<(1<<dimension); ++j) {\n\t vertexPredicate.push(\"(\" + pcube(0) + \"!==\" + pcube(j) + \")\")\n\t }\n\t code.push(\"if(\", vertexPredicate.join(\"||\"), \"){\")\n\t\n\t //Read in boundary data\n\t var vertexArgs = []\n\t for(var i=0; i<dimension; ++i) {\n\t vertexArgs.push(index(i))\n\t }\n\t for(var i=0; i<arrayArgs; ++i) {\n\t vertexArgs.push(cube(i,0))\n\t for(var j=1; j<(1<<dimension); ++j) {\n\t if(typesig[i]) {\n\t code.push(cube(i,j), \"=\", data(i), \".get(\", pointer(i), \"+\", delta(i,j), \");\")\n\t } else {\n\t code.push(cube(i,j), \"=\", data(i), \"[\", pointer(i), \"+\", delta(i,j), \"];\")\n\t }\n\t vertexArgs.push(cube(i,j))\n\t }\n\t }\n\t for(var i=0; i<(1<<dimension); ++i) {\n\t vertexArgs.push(pcube(i))\n\t }\n\t for(var i=0; i<scalarArgs; ++i) {\n\t vertexArgs.push(scalar(i))\n\t }\n\t\n\t //Generate vertex\n\t code.push(\"vertex(\", vertexArgs.join(), \");\",\n\t vert(0), \"=\", VERTEX_IDS, \"[\", POINTER, \"]=\", VERTEX_COUNT, \"++;\")\n\t\n\t //Check for face crossings\n\t var base = (1<<dimension)-1\n\t var corner = pcube(base)\n\t for(var j=0; j<dimension; ++j) {\n\t if((mask & ~(1<<j))===0) {\n\t //Check face\n\t var subset = base^(1<<j)\n\t var edge = pcube(subset)\n\t var faceArgs = [ ]\n\t for(var k=subset; k>0; k=(k-1)&subset) {\n\t faceArgs.push(VERTEX_IDS + \"[\" + POINTER + \"+\" + pdelta(k) + \"]\")\n\t }\n\t faceArgs.push(vert(0))\n\t for(var k=0; k<arrayArgs; ++k) {\n\t if(j&1) {\n\t faceArgs.push(cube(k,base), cube(k,subset))\n\t } else {\n\t faceArgs.push(cube(k,subset), cube(k,base))\n\t }\n\t }\n\t if(j&1) {\n\t faceArgs.push(corner, edge)\n\t } else {\n\t faceArgs.push(edge, corner)\n\t }\n\t for(var k=0; k<scalarArgs; ++k) {\n\t faceArgs.push(scalar(k))\n\t }\n\t code.push(\"if(\", corner, \"!==\", edge, \"){\",\n\t \"face(\", faceArgs.join(), \")}\")\n\t }\n\t }\n\t \n\t //Increment pointer, close off if statement\n\t code.push(\"}\",\n\t POINTER, \"+=1;\")\n\t }\n\t\n\t function flip() {\n\t for(var j=1; j<(1<<dimension); ++j) {\n\t code.push(TEMPORARY, \"=\", pdelta(j), \";\",\n\t pdelta(j), \"=\", qcube(j), \";\",\n\t qcube(j), \"=\", TEMPORARY, \";\")\n\t }\n\t }\n\t\n\t function createLoop(i, mask) {\n\t if(i < 0) {\n\t processGridCell(mask)\n\t return\n\t }\n\t fillEmptySlice(i)\n\t code.push(\"if(\", shape(order[i]), \">0){\",\n\t index(order[i]), \"=1;\")\n\t createLoop(i-1, mask|(1<<order[i]))\n\t\n\t for(var j=0; j<arrayArgs; ++j) {\n\t code.push(pointer(j), \"+=\", step(j,order[i]), \";\")\n\t }\n\t if(i === dimension-1) {\n\t code.push(POINTER, \"=0;\")\n\t flip()\n\t }\n\t forLoopBegin(i, 2)\n\t createLoop(i-1, mask)\n\t if(i === dimension-1) {\n\t code.push(\"if(\", index(order[dimension-1]), \"&1){\",\n\t POINTER, \"=0;}\")\n\t flip()\n\t }\n\t forLoopEnd(i)\n\t code.push(\"}\")\n\t }\n\t\n\t createLoop(dimension-1, 0)\n\t\n\t //Release scratch memory\n\t code.push(\"freeUint32(\", VERTEX_IDS, \");freeUint32(\", PHASES, \");\")\n\t\n\t //Compile and link procedure\n\t var procedureCode = [\n\t \"'use strict';\",\n\t \"function \", funcName, \"(\", args.join(), \"){\",\n\t \"var \", vars.join(), \";\",\n\t code.join(\"\"),\n\t \"}\",\n\t \"return \", funcName ].join(\"\")\n\t\n\t var proc = new Function(\n\t \"vertex\", \n\t \"face\", \n\t \"phase\", \n\t \"mallocUint32\", \n\t \"freeUint32\",\n\t procedureCode)\n\t return proc(\n\t vertexFunc, \n\t faceFunc, \n\t phaseFunc, \n\t pool.mallocUint32, \n\t pool.freeUint32)\n\t}",
"function Surface(){}",
"display() {\n strokeWeight(1);\n stroke(200);\n fill(200);\n beginShape();\n for (let i = 0; i < this.surface.length; i++) {\n let v = scaleToPixels(this.surface[i]);\n vertex(v.x, v.y);\n }\n vertex(width, height);\n vertex(0, height);\n endShape(CLOSE);\n }",
"function GeneratePrimitives()\r\n{\r\n GenerateCube();\r\n tetrahedron(va, vb, vc, vd, numTimesToSubdivide);\r\n GenerateCone();\r\n GenerateCylinder();\r\n GenerateRestaurant(); \r\n\tflower();\r\n}",
"function buildSurfaceOfRevolution(controlPoints)\n{\n console.log(\"build surface\");\n var dt = 1.0 / steps;\n var da = 360.0 / (angles);\n \n vertices = [];\n \n var p = 0;\n for (var i = 0; i < numCurves; i++)\n {\n var bp1 = controlPoints[i * 3 + 0];\n var bp2 = controlPoints[i * 3 + 1];\n var bp3 = controlPoints[i * 3 + 2];\n var bp4 = controlPoints[i * 3 + 3];\n \n for (var t = 0; t < steps; t++) {\n var p1 = dotProduct(bp1, bp2, bp3, bp4, getTVector(t * dt));\n var p2 = dotProduct(bp1, bp2, bp3, bp4, getTVector((t + 1) * dt));\n \n var savedP = p;\n for (var a = 0; a < angles; a++) {\n vertices[p++] = vec3(Math.cos(a * da * Math.PI / 180.0) * p1[0], p1[1],\n Math.sin(a * da * Math.PI / 180.0) * p1[0]);\n \n vertices[p++] = vec3(Math.cos(a * da * Math.PI / 180.0) * p2[0], p2[1],\n Math.sin(a * da * Math.PI / 180.0) * p2[0]);\n }\n vertices[p++] = vertices[savedP];\n vertices[p++] = vertices[savedP + 1];\n }\n }\n generateNormals(vertices);\n generateTextureCoord(vertices);\n}",
"function surface(a,b){\n\treturn a * b\n}",
"makeSurfaces(){\n var nurbsSurface1 = new CGFnurbsSurface(1,3,this.controlPoints);\n\n this.surface1 = new CGFnurbsObject(this.scene,this.slices,this.stacks,nurbsSurface1);\n \n\n var nurbsSurface2 = new CGFnurbsSurface(1,3,this.controlPoints);\n\n this.surface2 = new CGFnurbsObject(this.scene,this.slices,this.stacks,nurbsSurface2);\n\n }",
"function createSurface(number) {\n return new Surface({\n size: [undefined, 100],\n content: \"Surface \" + number,\n classes: [\"test-surface\", (i % 2 ? \"odd\" : \"even\")]\n });\n }",
"function ProceduralRenderer3(){}",
"function ProceduralRenderer3() {}",
"function ProceduralRenderer3() {}",
"function ProceduralRenderer3() {}",
"function surface(height){\n\t\t// making the basic surface ( triangle ) . \n\t\tvar geometry = new THREE.BufferGeometry();\n\t\t\n\t\tgeometry.addAttribute('position',new Float32Array(72),3); \n\t\tgeometry.addAttribute('uv', new Float32Array(48),2);\n\t\tpositions = geometry.getAttribute('position').array;\n\t\tuvs = geometry.getAttribute('uv').array;\n\t\t\n\t\t//positions , defining vertices \n\t\t// here is a manually written 3X3 \" surface \" . Just to find the patterns and to understand how it works . \n\t\t//\n\t\t// each lines below is a vertex coordinate (x,y,z ) .\n\t\t// Y -Z\n\t\t// ! /\t\n\t\t// !/\n\t\t// ---> X ( note on 3D coordinates in three.js ) .\n\t\t\n\t\t// so basically if we work on a \" terrain \" Y would be height .\n\t\t// the height array (3X3) in this example contains randomized values between 0 and 2 \n\t\t// To render i thought with square . a square is 2 triangles . \n\t\t// if we project the 3D coordinates in a 2D plan , we have :\n\t\t// y=f(x,z) HERE y=height[z][x]\n\t\t//\n\t\t// (0,-1) *********** (1,-1)\n\t\t// * *\n\t\t// * *\n\t\t// (0,0) *********** (1,0) \n\t\t//\n\t\t// to read next 6 line projected on the square above:\n\t\t// triangle 1 :\n\t\t// line 1 : (0,0) *\n\t\t// line 2 : (0,-1) ==> * *\n\t\t// line 3 : (1,0) ****\n\t\t//triangle 2 :\n\t\t// line 4 : (1,0) ****\n\t\t// line 5 : (0,-1) ==> * *\n\t\t// line 6 : (1,-1) *\n\t\t\n\t\t\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// this is notes for the next test_10_buffering_2K_primitives_factorized\n\t\tpositions[0]=0;positions[1]=height[0][0];positions[2]=0; \t// positions[i ]=x ;positions[i+ 1]=height[z ][x ];positions[i+ 2]=-(z );\n\t\tpositions[3]=0;positions[4]=height[1][0];positions[5]=-1;\t\t// positions[i+ 3]=x ;positions[i+ 4]=height[z+1][x ];positions[i+ 5]=-(z+1);\n\t\tpositions[6]=1;positions[7]=height[0][1];positions[8]=0;\t\t// positions[i+ 6]=x ;positions[i+ 7]=height[z ][x+1];positions[i+ 8]=-(z );\n\t\t\n\t\tpositions[9]=1;positions[10]=height[0][1];positions[11]=0;\t\t// positions[i+ 9]=x+1;positions[i+10]=height[z ][x+1];positions[i+11]=-(z );\n\t\tpositions[12]=0;positions[13]=height[1][0];positions[14]=-1;\t// positions[i+12]=x ;positions[i+13]=height[z+1][x ];positions[i+14]=-(z+1);\n\t\tpositions[15]=1;positions[16]=height[1][1];positions[17]=-1;\t// positions[i+15]=x+1;positions[i+16]=height[z+1][x+1];positions[i+17]=-(z+1);\n\n\t\tpositions[18]=1;positions[19]=height[0][1];positions[20]=0;\t\t// which would give :\n\t\tpositions[21]=1;positions[22]=height[1][1];positions[23]=-1;\t// positions[i]=positions[i+3]=positions[i+6]=positions[i+12]=x;\n\t\tpositions[24]=2;positions[25]=height[0][2];positions[26]=0;\t\t// positions[i+9]=positions[i+15]=x+1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// \n\t\tpositions[27]=2;positions[28]=height[0][2];positions[29]=0;\t\t// positions[i+2]=positions[i+8]=positions[i+11]=-z;\n\t\tpositions[30]=1;positions[31]=height[1][1];positions[32]=-1;\t// positions[i+5]=positions[i+14]=positions[i+17]=-(z+1);\n\t\tpositions[33]=2;positions[34]=height[1][2];positions[35]=-1;\t//\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// positions[i+1]=height[z][x];\n\t\tpositions[36]=0;positions[37]=height[1][0];positions[38]=-1;\t// positions[i+16]=height[z+1][x+1];\n\t\tpositions[39]=0;positions[40]=height[2][0];positions[41]=-2;\t// positions[i+4]=positions[i+13]=height[z+1][x];\n\t\tpositions[42]=1;positions[43]=height[1][1];positions[44]=-1;\t// positions[i+7]=positions[i+10]=height[z][x+1];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//\t\n\t\tpositions[45]=1;positions[46]=height[1][1];positions[47]=-1;\t// i = number of spatial coordinates = 3 per vertexes\n\t\tpositions[48]=0;positions[49]=height[2][0];positions[50]=-2;\t// vertexes = 3 per triangles\n\t\tpositions[51]=1;positions[52]=height[2][1];positions[53]=-2;\t// triangles =2 per square \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// square = (surface.width-1)*(surface.height-1) // surface.width = x, surface.height = z\n\t\tpositions[54]=1;positions[55]=height[1][1];positions[56]=-1;\t// square = (x-1)*(z-1) \n\t\tpositions[57]=1;positions[58]=height[2][1];positions[59]=-2;\t// i=3*3*2*(x-1)*(z-1) \n\t\tpositions[60]=2;positions[61]=height[1][2];positions[62]=-1;\t// i=18*(x-1)(z-1) \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// test here : x=3, z=3 so i=72 which is correct in this example .\t\t\t\t\n\t\tpositions[63]=2;positions[64]=height[1][2];positions[65]=-1;\n\t\tpositions[66]=1;positions[67]=height[2][1];positions[68]=-2;\n\t\tpositions[69]=2;positions[70]=height[2][2];positions[71]=-2;\n\t\t\n\t\t\n\t\t//=> uvs\n\t\t// same pattern for one square .\n\t\t// uvs[i+0]=uvs[i+1]=uvs[i+2]=uvs[i+5]=uvs[i+6]=uvs[i+9]=uvs[i+10]=uvs[i+11]=0;\n\t\t// uvs[i+3]=uvs[i+4]=uvs[i+7]=uvs[i+8]=1;\n\t\t// 1 vertex = 2 uvs ( 2D coord ) .\n\t\t// 1 triangle = 3 vertices \n\t\t// 1 square = 2 triangles\n\t\t// 1 surface = (x-1)*(z-1) squares\n\t\t// 1 surface = 2*3*2*(x-1)*(z-1) = 12*(x-1)*(z-1) uvs\n\t\t// test here = x=3, z=3 so uvs=48 .\n\t\t\n\t\tuvs[0]=0;\t\t\tuvs[2]=0;\t\t\tuvs[4]=1;\n\t\tuvs[1]=0;\t\t\tuvs[3]=1;\t\t\tuvs[5]=0;\n\t\t\n\t\tuvs[6]=0;\t\t\tuvs[8]=1;\t\t\tuvs[10]=0;\n\t\tuvs[7]=1;\t\t\tuvs[9]=0;\t\t\tuvs[11]=0;\n\t\t\n\t\tuvs[12]=0;\t\t\tuvs[14]=0;\t\t\tuvs[16]=1;\n\t\tuvs[13]=0;\t\t\tuvs[15]=1;\t\t\tuvs[17]=0;\n\t\t\n\t\tuvs[18]=0;\t\t\tuvs[20]=1;\t\t\tuvs[22]=0;\n\t\tuvs[19]=1;\t\t\tuvs[21]=0;\t\t\tuvs[23]=0;\n\t\t\n\t\tuvs[24]=0;\t\t\tuvs[26]=0;\t\t\tuvs[28]=1;\n\t\tuvs[25]=0;\t\t\tuvs[27]=1;\t\t\tuvs[29]=0;\n\t\t\n\t\tuvs[30]=0;\t\t\tuvs[32]=1;\t\t\tuvs[34]=0;\n\t\tuvs[31]=1;\t\t\tuvs[33]=0;\t\t\tuvs[35]=0;\n\t\t\n\t\tuvs[36]=0;\t\t\tuvs[38]=0;\t\t\tuvs[40]=1;\n\t\tuvs[37]=0;\t\t\tuvs[39]=1;\t\t\tuvs[41]=0;\n\t\t\n\t\tuvs[42]=0;\t\t\tuvs[44]=1;\t\t\tuvs[46]=0;\n\t\tuvs[43]=1;\t\t\tuvs[45]=0;\t\t\tuvs[47]=0;\n\t\t\n\t\t// optimisation \n\t\tgeometry.computeVertexNormals();\t\n\t\t\n\t\t//=> final mesh\n\t\treturn new THREE.Mesh( geometry, grass );\n\t}",
"function ProceduralRenderer3() { }",
"function ProceduralRenderer3() { }",
"function generateShapes(gl){\n\tcube = createCube(gl); // Plain cube\n sphere = createSphere(gl); // Plain sphere\n grass = createTexturedCube(gl,grassPath,50,50); // Grass\n wall = createTexturedCube(gl,brickPath,5,3/2); // Wall section\n wallbottom = createTexturedCube(gl,brickPath,5,1/2); // Wall section\n walldoor = createTexturedCube(gl,brickPath,2,1); // Wall section\n paintdoor = createTexturedCube(gl,paintPath,2,1); // Inner wall section\n paintwindow = createTexturedCube(gl,paintPath,1/2,1/2); // Inner wall section\n wallwindow = createTexturedCube(gl,brickPath,1/2,1/2); // Wall section\n paint = createTexturedCube(gl,paintPath,5,3/2); // Inner wall section\n paintroof = createTexturedCube(gl,roofPath,5,5); // Roof\n paintbottom = createTexturedCube(gl,paintPath,5,1/2); // Inner wall section\n floor = createTexturedCube(gl,floorPath,5,5); // Carpet\n blackboard = createTexturedCube(gl,blackboardPath,1,1); // Blackboard\n wind = createTexturedCube(gl,windowPath,4,1/2); // Windows\n door = createTexturedCube(gl,doorPath,1,1,initialiseTextureMapping(1,1,1)); // Door\n disco = createTexturedCube(gl,discoPath,50,50); // Disco floor\n\n leg=createTexturedCube(gl,woodPath,1,1,initialiseTextureMapping(1,5,1)); // Chair leg\n tableleg=createTexturedCube(gl,tablePath,1,1,initialiseTextureMapping(1,7.5,1)); // Table leg\n tablesurface=createTexturedCube(gl,tablePath,1,1,initialiseTextureMapping(8,1,8)); // Table surface\n back=createTexturedCube(gl,woodPath,1,1,initialiseTextureMapping(1,7,5)); // Chair back\n seat=createTexturedCube(gl,woodPath,1,1,initialiseTextureMapping(5,1,5)); // Chair seat\n}",
"function drawSurface() {\n wgl.takeBufferData(positionLocation, positionBuffer, 3, gl.FLOAT, false, 0, 0);\n wgl.takeBufferData(normalLocation, normalBuffer, 3, gl.FLOAT, false, 0, 0);\n gl.drawArrays(gl.TRIANGLES, 0, 6 * (map.points.length - 1) * (map.points.length - 1));\n }",
"function Surface3d(a1,b1,c1,a2,b2,c2,a3,b3,c3,a4,b4,c4){\r\n\r\n var edge1 = new Line([[a1,b1,c1],[a2,b2,c2]])\r\n var edge2 = new Line([[a2,b2,c2],[a3,b3,c3]])\r\n var edge3 = new Line([[a3,b3,c3],[a4,b4,c4]])\r\n var edge4 = new Line([[a4,b4,c4],[a1,b1,c1]])\r\n var square = [\r\n edge1.gObject(red,5),\r\n edge2.gObject(red,5),\r\n edge3.gObject(red,5),\r\n edge4.gObject(red,5),\r\n {\r\n type: \"mesh3d\",\r\n x: [a1,a2,a3,a4],\r\n y: [b1,b2,b3,b4],\r\n z: [c1,c2,c3,c4],\r\n i : [0, 0],\r\n j : [2, 3],\r\n k : [1, 2],\r\n opacity: 0.8,\r\n colorscale: [['0', impBlue], ['1', impBlue]],\r\n intensity: [0.8,0.8],\r\n showscale: false\r\n }\r\n ]\r\n return square;\r\n}",
"function generate(){\n\n\t\t\t\tconsole.log( 'GENERATE' );\n\t\t\t\t\n\t\t\t\tif( structMesh ){\n\t\t\t\t\tscene.remove( structMesh );\n\t\t\t\t\tscene.remove( contentObj3d );\n\t\t\t\t\tstructMesh.geometry.dispose();\n\t\t\t\t}\n\n\t\t\t\tconsole.log( api.horizontal_thickness, api.vertical_thickness );\n\t\t\t\tvar strut = structure( api.frequency, api.complexity, seed, api.threshold, api.horizontal_thickness, api.vertical_thickness );\n\n\n\t\t\t\tstructMesh = new THREE.Mesh( strut.geometry, faceMaterial );\n\t\t\t\tscene.add( structMesh );\n\n\n\t\t\t\tcontentObj3d = new THREE.Object3D();\n\n\t\t\t\tvar contentMaterial = new THREE.MeshPhongMaterial({\n\t\t\t\t\tcolor:new THREE.Color( 0xff2200 ),\n\t\t\t\t\tambient:new THREE.Color( 0xff2200 ),\n\t\t\t\t\ttransparent: true,\n\t\t\t\t\topacity: 0.8,\n\t\t\t\t});\n\n\t\t\t\tvar n = 60,\n\t\t\t\t\tindex, item, mesh;\n\n\t\t\t\twhile( n-- > 0 ){\n\t\t\t\t\tmesh = new THREE.Mesh( new THREE.CubeGeometry( 100, 100, 100 ), contentMaterial );\n\t\t\t\t\tindex = ~~( Math.random() * strut.volume.length )\n\t\t\t\t\titem = strut.volume[index];\n\t\t\t\t\tmesh.position.set( item[0], item[1], item[2] );\n\t\t\t\t\tmesh.position.x -= 15;\n\t\t\t\t\tmesh.position.y -= 15;\n\t\t\t\t\tmesh.position.z -= 15;\n\t\t\t\t\tmesh.position.multiplyScalar( 100 );\n\t\t\t\t\t\n\n\t\t\t\t\tcontentObj3d.add( mesh );\n\t\t\t\t}\n\n\t\t\t\tscene.add( contentObj3d );\n\t\t\t\t\n\t\t\t}",
"function geometry(surfaceGenerator, tesselationFnDir, tesselationRotDir) {\n let vertices = [];\n let normals = [];\n let normalDrawVerts = [];\n let indices = [];\n let wireIndices = [];\n let numTris = 0;\n let maxZ = 0;\n for (let t = 1; t >= -1.01; t -= 2 / (tesselationFnDir)) {\n let gen = surfaceGenerator.curve(t);\n maxZ = Math.max(maxZ, gen);\n const baseVec = vec4(gen, t, 0, 1);\n for (let theta = 0; theta < 360; theta += 360 / tesselationRotDir) {\n const rot = rotateY(theta)\n let vert = multMatVec(rot, baseVec);\n let slope = surfaceGenerator.derivative(t);\n const norm = normalize(vec4(Math.cos(radians(theta)), -slope, Math.sin(radians(theta)), 0), true);\n vertices.push(vert);\n normals.push(norm);\n normalDrawVerts.push(vert);\n normalDrawVerts.push(add(vert, scale(0.1, norm)));\n }\n }\n // 0 = top left,\n // 1 = top right,\n // 2 = bottom left,\n // 3 = botom right\n const subIndices = [1,0,2,2,1,3];\n const wireSubIndices = [1,0,0,2,2,1,1,3,3,2];\n for (let i = 0; i < tesselationFnDir; i++) {\n for (let j = 0; j < tesselationRotDir; j++) {\n let quadIndices = [\n (tesselationRotDir) * (i) + j, (tesselationRotDir) * (i) + (j + 1) % tesselationRotDir,\n (tesselationRotDir) * (i + 1) + j, (tesselationRotDir) * (i+1) + (j + 1) % tesselationRotDir\n ];\n for (let k = 0; k < wireSubIndices.length; k++) {\n wireIndices.push(quadIndices[wireSubIndices[k]])\n }\n for (let k = 0; k < subIndices.length; k++) {\n indices.push(quadIndices[subIndices[k]])\n }\n numTris += 2;\n }\n }\n return {\n vertices,\n normals,\n normalDrawVerts,\n indices,\n wireIndices,\n numTris,\n maxZ\n }\n}",
"function runGrid() {\n surfaceVertexPos = [];\n surfaceTextPos = [];\n surfaceIndex = [];\n surfaceNormal = [];\n surfaceWireframeIndex = [];\n\n for (let i = 0; i <= noStep; i++) {\n for (let j = 0; j <= noStep; j++) {\n let u = i * stepSize, v = j * stepSize;\n surfaceVertexPos.push(parametric(u, v));\n surfaceTextPos.push(vec2(u, v));\n surfaceNormal.push(normal(u, v));\n }\n }\n\n for (let i = 0; i < noStep; i++) {\n for (let j = 0; j < noStep; j++) {\n surfaceIndex.push(i * (noStep + 1) + j);\n surfaceIndex.push(i * (noStep + 1) + j + 1);\n surfaceIndex.push((i + 1) * (noStep + 1) + j);\n\n surfaceIndex.push(i * (noStep + 1) + j + 1);\n surfaceIndex.push((i + 1) * (noStep + 1) + j);\n surfaceIndex.push((i + 1) * (noStep + 1) + j + 1);\n\n surfaceWireframeIndex.push(i * (noStep + 1) + j);\n surfaceWireframeIndex.push(i * (noStep + 1) + j + 1);\n surfaceWireframeIndex.push(i * (noStep + 1) + j + 1);\n surfaceWireframeIndex.push((i + 1) * (noStep + 1) + j + 1);\n surfaceWireframeIndex.push((i + 1) * (noStep + 1) + j + 1);\n surfaceWireframeIndex.push((i + 1) * (noStep + 1) + j);\n surfaceWireframeIndex.push((i + 1) * (noStep + 1) + j);\n surfaceWireframeIndex.push(i * (noStep + 1) + j);\n }\n }\n}",
"function generateMesh(atoms)\n{\n\tvar atomlist = []; //which atoms of atoms are selected for surface generation (all for us)\n\t$.each(atoms, function(i, a) { a.serial=i; atomlist[i]=i;}); //yeah, this is messed up \n\tvar time = new Date();\n\t\n\tvar extent = $3Dmol.getExtent(atoms);\n\tvar w = extent[1][0] - extent[0][0];\n\tvar h = extent[1][1] - extent[0][1];\n\tvar d = extent[1][2] - extent[0][2];\n\tvar vol = w * h * d;\n\n\tvar ps = new ProteinSurface();\n\tps.initparm(extent, true, vol);\n\tps.fillvoxels(atoms, atomlist);\n\tps.buildboundary();\n\t//compute solvent excluded\n\tps.fastdistancemap();\n\tps.boundingatom(false);\n\tps.fillvoxelswaals(atoms, atomlist);\t\n\tps.marchingcube($3Dmol.SurfaceType.SES);\n\n\tvar VandF = ps.getFacesAndVertices(atomlist);\t\n\t\n\t//create geometry from vertices and faces\n\tvar geo = new $3Dmol.Geometry(true);\n\n\tvar geoGroup = geo.updateGeoGroup(0);\n\n\tvar vertexArray = geoGroup.vertexArray;\n\t// reconstruct vertices and faces\n\tvar v = VandF['vertices'];\n\tvar offset;\n\tvar i, il;\n\tfor (i = 0, il = v.length; i < il; i++) {\n\t\toffset = geoGroup.vertices * 3;\n\t\tvertexArray[offset] = v[i].x;\n\t\tvertexArray[offset + 1] = v[i].y;\n\t\tvertexArray[offset + 2] = v[i].z;\n\t\tgeoGroup.vertices++;\n\t}\n\n\tvar faces = VandF['faces'];\n\tgeoGroup.faceidx = faces.length;\n\tgeo.initTypedArrays();\n\n\t// set colors for vertices\n\tvar colors = [];\n\tfor (i = 0, il = atoms.length; i < il; i++) {\n\t\tvar atom = atoms[i];\n\t\tif (atom) {\n\t\t\tif (typeof (atom.surfaceColor) != \"undefined\") {\n\t\t\t\tcolors[i] = atom.surfaceColor;\n\t\t\t} else if (atom.color) // map from atom\n\t\t\t\tcolors[i] = $3Dmol.CC.color(atom.color);\n\t\t}\n\t}\n\n\tvar verts = geoGroup.vertexArray;\n\tvar colorArray = geoGroup.colorArray;\n\tvar normalArray = geoGroup.normalArray;\n\tvar vA, vB, vC, norm;\n\n\t// Setup colors, faces, and normals\n\tfor (i = 0, il = faces.length; i < il; i += 3) {\n\n\t\t// var a = faces[i].a, b = faces[i].b, c = faces[i].c;\n\t\tvar a = faces[i], b = faces[i + 1], c = faces[i + 2];\n\t\tvar A = v[a]['atomid'];\n\t\tvar B = v[b]['atomid'];\n\t\tvar C = v[c]['atomid'];\n\n\t\tvar offsetA = a * 3, offsetB = b * 3, offsetC = c * 3;\n\n\t\tcolorArray[offsetA] = colors[A].r;\n\t\tcolorArray[offsetA + 1] = colors[A].g;\n\t\tcolorArray[offsetA + 2] = colors[A].b;\n\t\tcolorArray[offsetB] = colors[B].r;\n\t\tcolorArray[offsetB + 1] = colors[B].g;\n\t\tcolorArray[offsetB + 2] = colors[B].b;\n\t\tcolorArray[offsetC] = colors[C].r;\n\t\tcolorArray[offsetC + 1] = colors[C].g;\n\t\tcolorArray[offsetC + 2] = colors[C].b;\n\n\t\t// setup Normals\n\n\t\tvA = new $3Dmol.Vector3(verts[offsetA], verts[offsetA + 1],\n\t\t\t\tverts[offsetA + 2]);\n\t\tvB = new $3Dmol.Vector3(verts[offsetB], verts[offsetB + 1],\n\t\t\t\tverts[offsetB + 2]);\n\t\tvC = new $3Dmol.Vector3(verts[offsetC], verts[offsetC + 1],\n\t\t\t\tverts[offsetC + 2]);\n\n\t\tvC.subVectors(vC, vB);\n\t\tvA.subVectors(vA, vB);\n\t\tvC.cross(vA);\n\n\t\t// face normal\n\t\tnorm = vC;\n\t\tnorm.normalize();\n\n\t\tnormalArray[offsetA] += norm.x;\n\t\tnormalArray[offsetB] += norm.x;\n\t\tnormalArray[offsetC] += norm.x;\n\t\tnormalArray[offsetA + 1] += norm.y;\n\t\tnormalArray[offsetB + 1] += norm.y;\n\t\tnormalArray[offsetC + 1] += norm.y;\n\t\tnormalArray[offsetA + 2] += norm.z;\n\t\tnormalArray[offsetB + 2] += norm.z;\n\t\tnormalArray[offsetC + 2] += norm.z;\n\n\t}\n\tgeoGroup.faceArray = new Uint16Array(faces);\n\tvar mat = new $3Dmol.MeshLambertMaterial();\n\tmat.vertexColors = true;\n\t\n\tvar mesh = new $3Dmol.Mesh(geo, mat);\n\tmesh.doubleSided = true;\n\t\n\tvar time2 = new Date();\n\tvar t = time2-time;\n\tconsole.log(\"Surface mesh generation: \"+t+\"ms\");\n\t$('#timeresult').html(t+\"ms\");\n\treturn mesh;\n\n}",
"function Surface() {\n this.surface = [];\n // Here we keep track of the screen coordinates of the chain\n this.surface.push(new box2d.b2Vec2(0, height/2));\n this.surface.push(new box2d.b2Vec2(width/2, height-10));\n this.surface.push(new box2d.b2Vec2(3*width/4, height-100));\n this.surface.push(new box2d.b2Vec2(width, height-1));\n // for (var x = 0; x < width; x += 2) {\n // var amp = height / 8;\n // var y = amp * cos(TWO_PI * x / width * 4 + 0);\n // y = y + amp + (height / 2);\n //\n // this.surface.push(new box2d.b2Vec2(x, y));\n // }\n\n for (var i = 0; i < this.surface.length; i++) {\n this.surface[i] = scaleToWorld(this.surface[i]);\n }\n\n // This is what box2d uses to put the surface in its world\n var chain = new box2d.b2ChainShape();\n chain.CreateChain(this.surface, this.surface.length);\n\n // Need a body to attach shape!\n var bd = new box2d.b2BodyDef();\n this.body = world.CreateBody(bd);\n\n // Define a fixture\n var fd = new box2d.b2FixtureDef();\n // Fixture holds shape\n fd.shape = chain;\n\n // Some physics\n fd.density = 1.0;\n fd.friction = 0.1;\n fd.restitution = 0.3;\n\n // Attach the fixture\n this.body.CreateFixture(fd);\n\n // A simple function to just draw the edge chain as a series of vertex points\n this.display = function() {\n strokeWeight(1);\n stroke(200);\n fill(200);\n beginShape();\n for (var i = 0; i < this.surface.length; i++) {\n var v = scaleToPixels(this.surface[i]);\n vertex(v.x, v.y);\n }\n vertex(width, height);\n vertex(0, height);\n endShape(CLOSE);\n };\n}",
"shapeTerrain() {\r\n // MP2: Implement this function!\r\n\r\n // set up some variables\r\n let iter = 200\r\n let delta = 0.015\r\n let H = 0.008\r\n\r\n for(let i = 0; i < iter; i++) {\r\n // construct a random fault plane\r\n let p = this.generateRandomPoint();\r\n let n = this.generateRandomNormalVec();\r\n\r\n // raise and lower vertices\r\n for(let j = 0; j < this.numVertices; j++) {\r\n // step1: get vertex b, test which side (b - p) * n >= 0\r\n let b = glMatrix.vec3.create();\r\n this.getVertex(b, j);\r\n\r\n let sub = glMatrix.vec3.create();\r\n glMatrix.vec3.subtract(sub, b, p);\r\n\r\n let dist = glMatrix.vec3.distance(b, p);\r\n\r\n let funcValue = this.calculateCoefficientFunction(dist);\r\n\r\n if (glMatrix.vec3.dot(sub, n) > 0)\r\n b[2] += delta * funcValue\r\n else\r\n b[2] -= delta * funcValue\r\n\r\n this.setVertex(b, j);\r\n }\r\n delta = delta / (Math.pow(2, H));\r\n }\r\n }",
"function main() {\r\n\r\n \r\n setupWebGL(); // set up the webGL environment\r\n loadTriangles(); // load in the triangles from tri file\r\n //loadTriangles_oneArray();\r\n loadEllipsoids(); //load in the ellipsoids from ellip file\r\n initCurrentModel();\r\n setupShaders(); // setup the webGL shaders\r\n// renderTriangles(); // draw the triangles using webGL\r\n// renderEllipsoids();\r\n //renderAll();\r\n renderAllWithKey();\r\n //keyEvent();\r\n \r\n} // end main",
"draw(){\n push();\n\n beginShape();\n texture(this.texture);\n textureWrap(MIRROR);\n //draw as a rectangle, divide by 2 for width and height\n vertex(this.getX() - (this.w/2.0), this.getY() - (this.h/2.0),CENTER,TOP_EDGE); //bottom right, CCW, Need UV coordinates for texture mapping\n vertex(this.getX() + (this.w/2.0), this.getY() - (this.h/2.0),RIGHT_EDGE,TOP_EDGE); //for some reason this starts on bottom right?\n vertex(this.getX() + (this.w/2.0), this.getY() + (this.h/2.0),RIGHT_EDGE,CENTER);\n vertex(this.getX() - (this.w/2.0), this.getY() + (this.h/2.0),CENTER,CENTER);\n\n endShape(CLOSE);\n\n pop();\n }",
"function square(nx, ny, nz, u, bounds) {\n if (!exists(px + nx, py + ny, pz + nz, bounds)) {\n\n // horizontal extent vector of the plane\n var ax = ny;\n var ay = nz;\n var az = nx;\n\n // vertical extent vector of the plane\n var bx = ay * nz - ay * nx;\n var by = az * nx - ax * nz;\n var bz = ax * ny - ay * nx;\n\n // half-sized normal vector\n var dx = nx * 0.5;\n var dy = ny * 0.5;\n var dz = nz * 0.5;\n\n // half-sized horizontal vector\n var sx = ax * 0.5;\n var sy = ay * 0.5;\n var sz = az * 0.5;\n\n // half-sized vertical vector\n var tx = bx * 0.5;\n var ty = by * 0.5;\n var tz = bz * 0.5;\n\n // center of the plane\n var vx = px + 0.5 + dx;\n var vy = py + 0.5 + dy;\n var vz = pz + 0.5 + dz;\n\n // vertex index offset\n var offset = store.offset;\n\n store.indices.push(offset + 0);\n store.indices.push(offset + 1);\n store.indices.push(offset + 2);\n store.indices.push(offset + 0);\n store.indices.push(offset + 2);\n store.indices.push(offset + 3);\n\n store.positions.push(vx - sx - tx);\n store.positions.push(vy - sy - ty);\n store.positions.push(vz - sz - tz);\n store.positions.push(vx + sx - tx);\n store.positions.push(vy + sy - ty);\n store.positions.push(vz + sz - tz);\n store.positions.push(vx + sx + tx);\n store.positions.push(vy + sy + ty);\n store.positions.push(vz + sz + tz);\n store.positions.push(vx - sx + tx);\n store.positions.push(vy - sy + ty);\n store.positions.push(vz - sz + tz);\n\n store.normals.push(nx);\n store.normals.push(ny);\n store.normals.push(nz);\n store.normals.push(nx);\n store.normals.push(ny);\n store.normals.push(nz);\n store.normals.push(nx);\n store.normals.push(ny);\n store.normals.push(nz);\n store.normals.push(nx);\n store.normals.push(ny);\n store.normals.push(nz);\n\n\n var add = 0.2;\n var base = 0.4;\n\n var brightness =\n (exists(px + nx - ax, py + ny - ay, pz + nz - az, bounds) ? 0 : add) +\n (exists(px + nx - bx, py + ny - by, pz + nz - bz, bounds) ? 0 : add) +\n (exists(px + nx - ax - bx, py + ny - ay - by, pz + nz - az - bz, bounds) ? 0 : add) + base;\n\n store.colors.push(brightness);\n store.colors.push(brightness);\n store.colors.push(brightness);\n store.colors.push(1.0);\n\n\n var brightness =\n (exists(px + nx + ax, py + ny + ay, pz + nz + az, bounds) ? 0 : add) +\n (exists(px + nx - bx, py + ny - by, pz + nz - bz, bounds) ? 0 : add) +\n (exists(px + nx + ax - bx, py + ny + ay - by, pz + nz + az - bz, bounds) ? 0 : add) + base;\n store.colors.push(brightness);\n store.colors.push(brightness);\n store.colors.push(brightness);\n store.colors.push(1.0);\n\n var brightness =\n (exists(px + nx + ax, py + ny + ay, pz + nz + az, bounds) ? 0 : add) +\n (exists(px + nx + bx, py + ny + by, pz + nz + bz, bounds) ? 0 : add) +\n (exists(px + nx + ax + bx, py + ny + ay + by, pz + nz + az + bz, bounds) ? 0 : add) + base;\n store.colors.push(brightness);\n store.colors.push(brightness);\n store.colors.push(brightness);\n store.colors.push(1.0);\n\n var brightness =\n (exists(px + nx - ax, py + ny - ay, pz + nz - az, bounds) ? 0 : add) +\n (exists(px + nx + bx, py + ny + by, pz + nz + bz, bounds) ? 0 : add) +\n (exists(px + nx - ax + bx, py + ny - ay + by, pz + nz - az + bz, bounds) ? 0 : add) + base;\n store.colors.push(brightness);\n store.colors.push(brightness);\n store.colors.push(brightness);\n store.colors.push(1.0);\n\n //u(store.uvs, CHIP_RATIO_1 * block);\n u(store.uvs, CHIP_RATIO_1 * block);\n\n store.offset += 4;\n }\n }"
]
| [
"0.69514656",
"0.6635534",
"0.65917426",
"0.65917426",
"0.6431906",
"0.6343412",
"0.6314351",
"0.6134876",
"0.6055668",
"0.60374963",
"0.59640545",
"0.5880201",
"0.58474845",
"0.58474845",
"0.58474845",
"0.5828926",
"0.5808765",
"0.5808765",
"0.57948244",
"0.57175183",
"0.56939435",
"0.5665206",
"0.5653089",
"0.56364554",
"0.5568792",
"0.55612403",
"0.5509762",
"0.54358363",
"0.5424436",
"0.5379399"
]
| 0.6677741 | 1 |
Add menu script update link | function update_link() {
$('#side_navi').append('<p><a href="#" id="farmer_update" onclick="update_script()">Update '+SCRIPT.name+'</a></p>');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function install_menu() {\n let config = {\n name: script_id,\n submenu: 'Settings',\n title: script_title,\n on_click: open_settings\n };\n wkof.Menu.insert_script_link(config);\n }",
"function installMenu() {\n wkof.Menu.insert_script_link({\n name: script_name,\n submenu: \"Settings\",\n title: script_name,\n on_click: openSettings,\n });\n }",
"function install_menu() {\n var config = {\n name: 'lesson_lock',\n submenu: 'Settings',\n title: 'Lesson Lock',\n on_click: open_settings\n };\n wkof.Menu.insert_script_link(config);\n }",
"function install_menu() {\n var config = {\n name: 'dashboard_level',\n submenu: 'Settings',\n title: 'Dashboard Level',\n on_click: open_settings\n };\n wkof.Menu.insert_script_link(config);\n }",
"function onOpen() {\n var ss = SpreadsheetApp.getActiveSpreadsheet();\n var menuEntries = [ {name: \"Update\", functionName: \"UpdateArmory\"} ];\n ss.addMenu(\"Commands\", menuEntries);\n}",
"function create_menu()\n{\n location.href='./Create-Item';\n}",
"function UpdateBookmarkMenu() { console.log(\"sellwood_px: UpdateBookmarkMenu called; this function is not defined in px.\"); }",
"function updateMenuItem(menuItem, url) {\n var request = new XMLHttpRequest();\n request.open(\"GET\", url, false); //false=sync, true = async ( although sync is not recommended, we need to wait till we get document)\n request.send();\n \n var document = request.responseXML;\n document.addEventListener(\"select\", handleSelectEvent);\n var menuItemDocument = menuItem.parentNode.getFeature(\"MenuBarDocument\");\n menuItemDocument.setDocument(document, menuItem);\n if(url==\"http://192.168.43.140:9001/backend/templates/featured.xml\"||url==\"http://192.168.43.140:9001/backend/templates/onDemand.xml\")\n parseJsonFeatured();\n if(url==\"http://192.168.43.140:9001/backend/templates/search.xml\")\n search(getActiveDocument());\n}",
"function showUpdateMyMenuPage(){\n showPagesHelper(\"#updateMenuScreen\");\n}",
"function insert_script_link(config) {\n\t\t// Abort if the script already exists\n\t\tvar link_id = config.name+'_script_link'; \n\t\tif ($('#'+link_id).length !== 0) return;\n\t\tinstall_scripts_header();\n\t\tif (config.submenu) {\n\t\t\tinstall_scripts_submenu(config.submenu);\n\n\t\t\t// Append the script, and sort the menu.\n\t\t\tvar menu = $('.scripts-submenu[name=\"'+config.submenu+'\"] .dropdown-menu');\n\t\t\tvar class_html = (config.class ? ' class=\"'+config.class+'\"': '');\n\t\t\tmenu.append('<li id=\"'+link_id+'\" name=\"'+config.name+'\"'+class_html+'><a href=\"#\">'+config.title+'</a></li>');\n\t\t\tmenu.append(menu.children().sort(sort_name));\n\t\t} else {\n\t\t\tvar class_html = (config.class ? ' '+classes:'');\n\t\t\t$('.scripts-header').after('<li id=\"'+link_id+'\" name=\"'+config.name+'\" class=\"script-link '+class_html+'\"><a href=\"#\">'+config.title+'</a></li>');\n\t\t\tvar items = $('.scripts-header').siblings('.scripts-submenu,.script-link').sort(sort_name);\n\t\t\t$('.scripts-header').after(items);\n\t\t}\n\n\t\t// Add a callback for when the link is clicked.\n\t\t$('#'+link_id).on('click', function(e){\n\t\t\t$('body').off('click.scripts-link');\n\t\t\t$('.dropdown.account').removeClass('open');\n\t\t\t$('.scripts-submenu').removeClass('open');\n\t\t\tconfig.on_click(e);\n\t\t\treturn false;\n\t\t});\n\t}",
"function onOpen() { CUSTOM_MENU.add(); }",
"function updateGameMenu(){\n document.querySelector('#menu-site object').data = 'https://' + window.location.hostname + '/home';\n}",
"function UpdateMenuHelpPanel(elem, ddlArray, menuIndex) {\r\n $(\"#MenuTitle\").text(ddlArray[menuIndex][0]); //titlle\r\n $(\"#MenuDesc\").html(ddlArray[menuIndex][1]); //description \t\r\n\r\n //check and set url\r\n //var url = $(elem).attr('href').trim(); //target url\r\n //if (url == \"\" || url == \"#\") {\r\n // $(elem).attr('href', ddlArray[menuIndex][2]); //set target url\r\n //}\r\n\r\n\r\n //PrintMessage(\"url: \" + ddlArray[menuIndex][2]);\r\n //$(elem).attr('href', ddlArray[menuIndex][2]); //set target url\r\n}",
"function onOpen(e) {\n SpreadsheetApp.getUi()\n .createMenu('My Menu')\n .addItem('Update crypto price', 'main')\n .addToUi();\n}",
"function update(){\r\n //needs to update server with link/navigation information\r\n //ajax\r\n}",
"function updateMenu(data){\n console.log(\"## updateMenu ##\");\n\n // Update \"last update\" on menu\n var timer = new Date();\n mainView.section(0, { title: \"last update : \" + timer.toLocaleTimeString()});\n\n var USDDiff = moneyDiff(data.USD.last, lastSnapshot.USD.last);\n var EURDiff = moneyDiff(data.EUR.last, lastSnapshot.EUR.last);\n var GBPDiff = moneyDiff(data.GBP.last, lastSnapshot.GBP.last);\n\n // Update values on menu - Variation displaying\n mainView.item(0, 0, { subtitle: '$ ' + formatMoney(data.USD.last) + \" \" + USDDiff });\n mainView.item(0, 1, { subtitle: '€ ' + formatMoney(data.EUR.last) + \" \" + EURDiff });\n mainView.item(0, 2, { subtitle: '£ ' + formatMoney(data.GBP.last) + \" \" + GBPDiff });\n\n // Hide variation after 3 seconds\n if (USDDiff != \"\") setTimeout(function(){ mainView.item(0, 0, { subtitle: '$ ' + formatMoney(data.USD.last) });}, 3000);\n if (EURDiff != \"\") setTimeout(function(){ mainView.item(0, 1, { subtitle: '$ ' + formatMoney(data.EUR.last) });}, 3000);\n if (GBPDiff != \"\") setTimeout(function(){ mainView.item(0, 2, { subtitle: '$ ' + formatMoney(data.GBP.last) });}, 3000);\n\n}",
"function updateRoles(){\n console.log('update role')\n mainMenu();\n}",
"function addMenu(){\n var appMenu = new gui.Menu({ type: 'menubar' });\n if(os.platform() != 'darwin') {\n // Main Menu Item 1.\n item = new gui.MenuItem({ label: \"Options\" });\n var submenu = new gui.Menu();\n // Submenu Items.\n submenu.append(new gui.MenuItem({ label: 'Preferences', click :\n function(){\n // Add preferences options.\n // Edit Userdata and Miscellaneous (Blocking to be included).\n\n var mainWin = gui.Window.get();\n\n\n var preferWin = gui.Window.open('./preferences.html',{\n position: 'center',\n width:901,\n height:400,\n focus:true\n });\n mainWin.blur();\n }\n }));\n\n submenu.append(new gui.MenuItem({ label: 'User Log Data', click :\n function(){\n var mainWin = gui.Window.get();\n\n var logWin = gui.Window.open('./userlogdata.html',{\n position: 'center',\n width:901,\n height:400,\n toolbar: false,\n focus:true\n });\n }\n }));\n\n submenu.append(new gui.MenuItem({ label: 'Exit', click :\n function(){\n gui.App.quit();\n }\n }));\n\n item.submenu = submenu;\n appMenu.append(item);\n\n // Main Menu Item 2.\n item = new gui.MenuItem({ label: \"Transfers\"});\n var submenu = new gui.Menu();\n // Submenu 1.\n submenu.append(new gui.MenuItem({ label: 'File Transfer', click :\n function(){\n var mainWin = gui.Window.get();\n var aboutWin = gui.Window.open('./filetransfer.html',{\n position: 'center',\n width:901,\n height:400,\n toolbar: false,\n focus: true\n });\n mainWin.blur();\n }\n }));\n item.submenu = submenu;\n appMenu.append(item);\n\n // Main Menu Item 3.\n item = new gui.MenuItem({ label: \"Help\" });\n var submenu = new gui.Menu();\n // Submenu 1.\n submenu.append(new gui.MenuItem({ label: 'About', click :\n function(){\n var mainWin = gui.Window.get();\n var aboutWin = gui.Window.open('./about.html', {\n position: 'center',\n width:901,\n height:400,\n toolbar: false,\n focus: true\n });\n mainWin.blur();\n }\n }));\n item.submenu = submenu;\n appMenu.append(item);\n gui.Window.get().menu = appMenu;\n }\n else {\n // menu for mac.\n }\n\n}",
"function onOpen() {\n var ui = DocumentApp.getUi();\n ui.createMenu('Script menu')\n .addItem('Setup', 'setup')\n .addItem('Create Events First Time', 'createDocForEvents')\n .addToUi();\n}",
"updateSoho() {\n this.applicationmenu.updated();\n }",
"function UpdateAnchorsHandler() { }",
"function mainMenu(){\n window.location.replace(\"https://stavflix.herokuapp.com/client/\");\n }",
"function onOpen() {\n var sheet = SpreadsheetApp.getActiveSpreadsheet();\n var entries = [{\n name: \"Generate\",\n functionName: \"convert\"\n }, {\n name: \"Settings\",\n functionName: \"showInfoPopup\"\n }];\n sheet.addMenu(appName, entries);\n}",
"function HistoryDropdownMenuItem() {\n\t$('ul.wikia-menu-button li:first-child ul li:first-child').after('<li><a href=\"/index.php?title='+ encodeURIComponent (wgPageName) +'&action=history\">History</a></li>');\n}",
"function HistoryDropdownMenuItem() {\n\t$('ul.wikia-menu-button li:first-child ul li:first-child').after('<li><a href=\"/index.php?title='+ encodeURIComponent (wgPageName) +'&action=history\">History</a></li>');\n}",
"function updateURL(url){\n<<<<<<< Updated upstream\n\t\n\t$(\"li.EXLContainer-recentarticlesTab\").click(function(){\n\t\t\n=======\n\n\t$(\"li.EXLContainer-recentarticlesTab\").click(function(){\n\n>>>>>>> Stashed changes\n\t\trecordid=$(this).parent(\"ul\").parent(\"div\").attr(\"id\");\n\t\tissn= EXLTA_issn(recordid);\n\t\tnewUrl=url+issn;\n\t\tif (EXLTA_isFullDisplay()){\n\t\t\tconsole.log(\"it's full display!!\");\n\t\t\t$(\"div#\"+recordid).parent(\"div\").parent(\"div\").parent(\"div\").find(\".EXLTabHeaderButtonPopout\").children(\"a\").attr(\"href\", newUrl);\n<<<<<<< Updated upstream\n\t\t}\n\t\telse{\n\t\t\t$(\"div#\"+recordid).parent(\"div\").parent(\"td\").find(\".EXLTabHeaderButtonPopout\").children(\"a\").attr(\"href\", newUrl);\n\t\t}\n\t});\n\n=======\n\n\t\t\tif (displayActions==true){\n\t\t\t\tvar actions=$(\"div#\"+recordid).parent(\"div\").parent(\"div\").parent(\"div\").find(\".EXLTabHeaderButtons\").html();\n\t\t\t\t$(\".EXLTabHeaderButtons\").last().html(actions);\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\t$(\"div#\"+recordid).parent(\"div\").parent(\"td\").find(\".EXLTabHeaderButtonPopout\").children(\"a\").attr(\"href\", newUrl);\n\n\t\t\tif (displayActions==true){\n\t\t\t\tvar actions=$(\"div#\"+recordid).parent(\"div\").parent(\"td\").find(\".EXLTabHeaderButtons\").html();\n\t\t\t\t$(\".EXLTabHeaderButtons\").last().html(actions);\n\t\t\t}\n\t\t}",
"function setUpdateBtnClickListener() {\n let menuArray = new Array(CONSTANTS.MENU.COUNT);\n $(\"#btn-update-menu\").click(function () {\n for (let i = 0; i < CONSTANTS.MENU.COUNT; i++) {\n menuArray[i] = new Array(CONSTANTS.MENU.SUB_COUNT);\n for (let j = 0; j < CONSTANTS.MENU.SUB_COUNT; j++) {\n let foodId = \"#\" + \"food\" + \"-\" + (i + 1) + \"-\" + (j + 1);\n menuArray[i][j] = $(foodId).val();\n }\n }\n updateMenu(menuArray, dateSelected).done(function (response) {\n if (response) {\n jqueryInfo(\"修改成功\", (menuStatus == CONSTANTS.MENU.STATUS.EXIST ? \"成功修改菜单!\" : \"成功创建菜单!\"), false, false, function () {\n menuArray = null;\n refresh();\n });\n }\n });\n });\n }",
"function openUpdateLink(){\n extension.tabs.create({\n \"url\": \"https://addons.mozilla.org/en-US/firefox/addon/stack-counter/?src=search\"\n });\n}",
"function ips_menu_events()\n{\n}",
"function menuHandler() {\n console.log('menuHandler');\n\n agent.add('Questi sono alcuni dei modi in cui posso aiutarti nella tua visita al nostro store online')\n agent.add(new Suggestion(`Esplorazione delle categorie`));\n agent.add(new Suggestion(`Ricerca prodotto specifico`));\n agent.add(new Suggestion(`Suggerimento prodotto`));\n}"
]
| [
"0.7260296",
"0.71842474",
"0.7151768",
"0.68889284",
"0.66425437",
"0.646941",
"0.6463191",
"0.6381814",
"0.63699275",
"0.6367864",
"0.6360849",
"0.6348565",
"0.6292368",
"0.6149883",
"0.60756356",
"0.60742766",
"0.60204",
"0.5928667",
"0.592414",
"0.5909938",
"0.59097916",
"0.59031564",
"0.5894103",
"0.58580244",
"0.58580244",
"0.5850848",
"0.58457893",
"0.5840679",
"0.5840366",
"0.5836389"
]
| 0.7613079 | 0 |
updates state=enabled|disabled for scheduled functions | updateScheduledState(callback) {
if (isScheduled) {
series([staging, production].map(FunctionName=> {
return function update(callback) {
if (state === 'disabled') {
setTimeout(function rateLimit() {
cloudwatch.disableRule({
Name: FunctionName,
}, callback)
}, 200)
}
else {
setTimeout(function rateLimit() {
cloudwatch.enableRule({
Name: FunctionName,
}, callback)
}, 200)
}
}
}), callback)
}
else {
callback()
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _(){this.state.eventsEnabled||(this.state=W(this.reference,this.options,this.state,this.scheduleUpdate))}",
"toggleEnabled() {\n let { enabled, scheduledRestart } = this.state;\n enabled = !enabled;\n //If the select boxes are no longer enabled, reset the scheduled restart time and call a method on the Actions object.\n //That function will set scheduledRestart to null via the preferences API. But we want our display to look nice, hence the bit where we reset it to the default value.\n if (!enabled) {\n scheduledRestart = DEFAULT_RESTART;\n this.setState({ enabled, scheduledRestart })\n Actions.disableScheduledRestart();\n } else {\n this.setState({ enabled })\n Actions.setScheduledRestart(scheduledRestart);\n }\n }",
"function setEnabled(enabled){_enabled=!!enabled;}",
"function setEnabled(enabled){_enabled=!!enabled;}",
"function enableRunState() {\n\t\t\tif ($scope.actualState == 'RDY' && neumaticaRB.checked) {\n\t\t\t\t$scope.isTestOrReadyDisabled = false;\n\t\t\t} else {\n\t\t\t\t$scope.isTestOrReadyDisabled = true;\n\t\t\t}\n\t\t}",
"set enabled(value) {}",
"set enabled(value) {}",
"set enabled(value) {}",
"set enabled(value) {}",
"function disabled() {}",
"function disabled() {}",
"function A(){Q.state.isEnabled=!1}",
"setScheduleStatus(id) {\n\n let statusToSet = this.state.scheduleIsOn ? 'enabled' : 'disabled';\n\n /**\n * REST call to change the status of a schedule to enabled/disabled.\n */\n fetch('http://192.168.0.21/api/CeyiFspaKI7cxGvtu9uOLJmQgOmAZuoUyMaxwETp/schedules/' + id, {\n method: 'PUT',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n 'status': statusToSet\n })\n });\n }",
"function disabled(){}",
"function disabled(){}",
"function disabled(){}",
"function disabled(){}",
"function event_day_status() {\n\tif( $(\"#event_all_day\").is(\":checked\")){\n\t\tblock_hours_event();\n\t} else {\n\t\tunblock_hours_event();\n\t}\n\n\tfunction unblock_hours_event(){\n\t\t$('#event_starts_at_4i').attr('disabled', false);\n\t\t$('#event_starts_at_5i').attr('disabled', false);\n\t\t$('#event_ends_at_4i').attr('disabled', false);\t\t\n\t\t$('#event_ends_at_5i').attr('disabled', false);\n\t}\n\tfunction block_hours_event(){\n\t\t$('#event_starts_at_4i').attr('disabled', true);\n\t\t$('#event_starts_at_5i').attr('disabled', true);\n\t\t$('#event_ends_at_4i').attr('disabled', true);\t\t\n\t\t$('#event_ends_at_5i').attr('disabled', true);\n\t}\n}",
"function sl_in_query(state) {\n $(\"#start_query\").prop(\"disabled\", state);\n $(\"#cancel_query\").prop(\"disabled\", !state);\n}",
"function updateEnabled(cb){\n\t//Log\n\tlog(\"Checking/Changing enable status\");\n\t//Get the pref value\n\texec('plutil -key \"enabled\" /var/mobile/Library/Preferences/com.chronic-dev.CDevReporter.plist', function (err, enabledvalue, stderr) {\n\t\t//Log\n\t\tlog(\"Read enabled value of: \"+(enabledvalue.trim() == \"1\"));\n\t\t//If enabled\n\t\tenabled = (enabledvalue.trim() == \"1\") ? true : false;\n\t\t//Get the pref value\n\t\texec('plutil -key \"wifi\" /var/mobile/Library/Preferences/com.chronic-dev.CDevReporter.plist', function (err, wifivalue, stderr) {\n\t\t\t//Log\n\t\t\tlog(\"Read wifi value of: \"+(wifivalue.trim() == \"1\"));\n\t\t\t//If wifi toggle is on\n\t\t\tif(wifivalue.trim() == \"1\"){\n\t\t\t\t//Get the pref value\n\t\t\t\texec('sbnetwork battleground-fw2ckdbmqg.elasticbeanstalk.com', function (err, net, stderr) {\n \t\t\t\t//Log\n \t\t\t\tlog(\"Read net status value of: \"+(net.trim() == \"WIFI\"));\n \t\t\t\t//Chance upload status\n \t\t\t\tupload = (net.trim() == \"WIFI\");\n \t\t\t\t//run the cb\n\t\t\t\t\tcb();\n\t\t\t\t});\n\t\t\t}else{\n\t\t\t\t//Allow upload.\n\t\t\t\tupload = true;\n\t\t\t\t//run the cb\n\t\t\t\tcb();\n\t\t\t}\n\t\t});\n\t});\n}",
"set isActiveAndEnabled(value) {}",
"set isActiveAndEnabled(value) {}",
"set isActiveAndEnabled(value) {}",
"setDisabledState(isDisabled) {\n this.setProperty('disabled', isDisabled);\n }",
"setDisabledState(isDisabled) {\n this.disabled = isDisabled;\n this.stateChanges.next();\n }",
"get isEnabled() { return !this.state.disabled }",
"set_enabled(newval) {\n this.liveFunc.set_enabled(newval);\n return this._yapi.SUCCESS;\n }",
"onEnable() {}",
"function setEnabled(enabled) {\n _enabled = !!enabled;\n }",
"function setEnabled(enabled) {\n _enabled = !!enabled;\n }"
]
| [
"0.68644005",
"0.68377197",
"0.6545934",
"0.6545934",
"0.64584535",
"0.6416128",
"0.6416128",
"0.6416128",
"0.6416128",
"0.6414262",
"0.6414262",
"0.62776065",
"0.62683696",
"0.6240283",
"0.6240283",
"0.6240283",
"0.6240283",
"0.62242657",
"0.62186015",
"0.6198962",
"0.61784524",
"0.61784524",
"0.61784524",
"0.61618996",
"0.61460364",
"0.61263144",
"0.6117855",
"0.60943764",
"0.60866076",
"0.60866076"
]
| 0.7258236 | 0 |
Create graphdata as count of all albumids in watchlist object array | function createGraphData() {
for (var item in $scope.myWatchlistData) {
if (findIndexFromId($scope.graphData, 'albumId', $scope.myWatchlistData[item]['albumId']) > -1) {
$scope.graphData[findIndexFromId($scope.graphData, 'albumId', $scope.myWatchlistData[item]['albumId'])]['count'] += 1;
} else {
$scope.graphData.push({ 'albumId': $scope.myWatchlistData[item]['albumId'], 'count': 1 });
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"dump(albumId, updateCounts = true) {\n return new Promise((resolve, reject) => {\n const tagged = {};\n const opts = { count: 1000 }; // batch size for hscan\n if (albumId && albumId !== ALBUM_ALL) {\n // pattern match\n opts.match = `${albumId}${ALBUM_DELIM}*`;\n }\n const hscan = this.client.hscanStream(this.TAGGED, opts);\n const taggedCounts = {}; // taggedPhotos counts by album\n // process the data\n hscan.on(\"data\", data => {\n for (let i = 0; i < data.length; i += 2) {\n const key = data[i];\n const val = data[i + 1];\n tagged[key] = val ? val.split(this.TAG_SEP) : [];\n if (updateCounts) {\n const albId = key.split(ALBUM_DELIM)[0];\n // don't count empty list of tags\n if (tagged[key].length > 0) {\n taggedCounts[albId] = (taggedCounts[albId] || 0) + 1;\n }\n }\n }\n });\n hscan.on(\"end\", () => {\n if (updateCounts) {\n this.client.hmset(this.COUNTS, taggedCounts).then(status => {\n ptStoreLog(\"Updated tagged photo counts, status: %s\", status);\n resolve(tagged);\n });\n } else {\n resolve(tagged);\n }\n });\n hscan.on(\"error\", reject);\n });\n }",
"static get data() {\n return { numcount:[] }\n }",
"pushToCounts(obj) {\n this.counts.push(obj);\n }",
"function convertToGraphEdible(models) {\n for (var i = 0; i < models.length; i++) {\n crime_count_by_date.push([models[i][0][0].getTime(), models[i].length]);\n };\n // console.log(crime_count_by_date);\n}",
"function countTrackers(trackers) {\n var ret = {};\n trackers.forEach(function (t) {\n if (!ret[t.id]) {\n ret[t.id] = {\n name: t.name,\n count: 0\n }\n }\n ret[t.id].count++;\n });\n return ret;\n}",
"function count() {\n var n=0; \n for (var key in this.dataStore) {\n ++n;\n }\n return n;\n}",
"countItemsInBrand(getBrandArr, getItemsArr) {\r\n\t\tfor (let i = 0; i < getBrandArr.length; i++) {\r\n\t\t\tvar tmp = getItemsArr.filter((item) => item.subcategoryArr.id === getBrandArr[i].id).length;\r\n\t\t\tgetBrandArr[i].itemCount = tmp;\r\n\t\t}\r\n\t\treturn getBrandArr;\r\n\t}",
"static addSongs() {\n fetch(\"https://itunes.apple.com/us/rss/topalbums/limit=100/json\")\n .then(resp => resp.json())\n .then(data => {\n let i = 1;\n data.feed.entry.forEach(album => {\n let newCard = new Album(i, album[\"im:image\"][0].label, album[\"im:name\"].label, album[\"im:artist\"].label, album[\"id\"].label, album[\"im:price\"].label, album[\"im:releaseDate\"].label)\n i++;\n Album.all.push(newCard);\n });\n })\n }",
"function getAllAlarmCount() {\n getAllAlarmByState($scope.allControlPlanes.join('|'), $scope.allClusters.join('|')).then(function(data) {\n var count = [0, 0, 0, 0];\n data.forEach(function(d) {\n switch(d[1]) {\n case \"UNDETERMINED\":\n count[0] += d[0];\n break;\n case \"OK\":\n count[1] += d[0];\n break;\n case \"ALARM\":\n if (d[2] === 'CRITICAL' || d[2] === 'HIGH') {\n count[3] += d[0];\n } else {\n count[2] += d[0];\n }\n break;\n }\n });\n $scope.inventory_cards[$scope.inventory_cards.length - 1].data.unknown.count = count[0];\n $scope.inventory_cards[$scope.inventory_cards.length - 1].data.ok.count = count[1];\n $scope.inventory_cards[$scope.inventory_cards.length - 1].data.warning.count = count[2];\n $scope.inventory_cards[$scope.inventory_cards.length - 1].data.critical.count = count[3];\n });\n }",
"function count() {\r\n return data.length;\r\n}",
"getItemCount() {\n let count = 0;\n for (const data of this.facetBatches.values()) {\n count += data.length;\n }\n return count;\n }",
"countItems() {\n this.elementsCounted = {};\n \t for(let name of this.items) {\n \t\tthis.elementsCounted[name] = this.elementsCounted[name] ? this.elementsCounted[name] + 1 : 1;\n }\n }",
"function countEvents() {\n\tvar xmlhttp = new XMLHttpRequest();\n\txmlhttp.onreadystatechange = function() {\n\t if (this.readyState == 4 && this.status == 200) {\n\t myObj = JSON.parse(this.responseText);\n\t counter = Object.keys(myObj.events).length;\n\t }\n\t};\n\txmlhttp.open(\"GET\", \"https://api.myjson.com/bins/9om0m\", true);\n\txmlhttp.send();\n}",
"function connCount(){\n var connCount = []\n for(var pixelid=0;pixelid<15;pixelid++){\n connCount.push(null)\n var room = mobilesock.adapter.rooms[pixelid]\n if(room){\n connCount[pixelid] = room.length\n }else{\n connCount[pixelid] = 0\n }\n }\n panelsock.emit('connCount',connCount)\n console.log(connCount)\n}",
"async getCount() {\n return axios\n .get(UrlBuilder[this.storeType].paths.count, createHeaders())\n .then(response => response.data)\n .catch(error => handleError(error.response))\n }",
"function countAllData(dataset, arrayPath) {\n for (var item in dataset) {\n // if the item is a node - recursive call\n if (typeof(dataset[item]) === 'object') {\n //Add a node to save the node path\t\n arrayPath.push(item);\n\t\tcountAllData(dataset[item], arrayPath);\n } \n else {\n\t\t// Check if the node it is an Include, meaning there are duplicated CDIs in the CDS.\n\t\tif (isIncludeNode(arrayPath)){\n \t\tnbOfIncludedCDIs = nbOfIncludedCDIs + 1;\n \t}\n \t// BTW, count all CDIs in the CDS\n \tnbOfCDIs = nbOfCDIs + 1;\n }\n }\n // Remove last node name of the path\n arrayPath.pop();\n}",
"function addGymCounts (data) {\n var team_count = new gymCounter();\n var instinct_container = $('.instinct-gym-filter[data-value=\"3\"]')\n var valor_container = $('.valor-gym-filter[data-value=\"2\"]')\n var mystic_container = $('.mystic-gym-filter[data-value=\"1\"]')\n var empty_container = $('.empty-gym-filter[data-value=\"0\"]')\n var total_container = $('.all-gyms-filter[data-value=\"4\"]')\n \n team_count.add(data);\n \n mystic_container.html(team_count.mystic);\n valor_container.html(team_count.valor);\n instinct_container.html(team_count.instinct);\n empty_container.html(team_count.empty);\n total_container.html(team_count.total);\n}",
"function getPlaylistStatsAPI(userid, playlistid, offset, playlist_data) {\n $.ajax({\n type: 'GET',\n url:'https://api.spotify.com/v1/users/' + userid + '/playlists/' + playlistid + '/tracks?offset=' + offset,\n headers: {'Authorization': \"Bearer \" + access_token},\n success: function(data) {\n // get the next 100 items\n\t for (var track in data.items) {\n\t playlist_data.push(JSON.parse(JSON.stringify(data.items[track])));\n\t } \n offset += 100;\n \n // loop another GET request for next 100 tracks\n if (data.total - offset > 0) {\n getPlaylistStatsAPI(userid, playlistid, offset, playlist_data);\n // analyse playlist\n } else {\n\t\t// check for empty playlist\n\t\tif (data.total == 0) {\n\t\t document.getElementById(\"frequent-artists\").append(\"No songs to analyze in playlist.\");\n return;\n }\n\n\t var key, year, song_name, song_popularity;\n\t var totaltracks = data.total;\n var popularity = 0;\n var duration = 0;\n\t\t// artist/album : count\n var artist_list = {};\n\t\tvar album_list = {};\n\t\tvar album_artists = {};\n\t var album_year = {};\n var year_list = {};\n var song_artist = {};\n\t\tvar artist_to_id = {};\n\t\tvar album_to_id = {};\n\n var popularity_list = {};\n\n for (var track in playlist_data) {\n\t song_name = playlist_data[track].track.name;\n\t\t song_popularity = playlist_data[track].track.popularity;\n\n // append the artist names and count for each track\n for (var artist in playlist_data[track].track.artists) {\n key = playlist_data[track].track.artists[artist].name;\n artist_list[key] = (artist_list[key] || 0) + 1;\n\t\t\tartist_to_id[key] = playlist_data[track].track.artists[artist].id;\n }\n\n // append the album for each track\n key = playlist_data[track].track.album.name;\n year = playlist_data[track].track.album.release_date;\n album_list[key] = (album_list[key] || 0) + 1;\n\t\t album_to_id[key] = playlist_data[track].track.album.id;\n\n // append the year for each track\n\t\t if (year != null) {\n year_list[year.substring(0, 4)] = (year_list[year.substring(0, 4)] || 0) + 1;\n\t\t album_year[key] = year.substring(0, 4);\n }\n\n\t\t // append the artist names for each album\n for (var i = 0; i < playlist_data[track].track.album.artists.length; i++) {\n if (i == 0) {\n\t\t album_artists[key] = playlist_data[track].track.album.artists[i].name;\n } else {\n album_artists[key] += \", \" + playlist_data[track].track.album.artists[i].name;\n }\n }\n\t\t // append the artist names for each song\n for (var i = 0; i < playlist_data[track].track.artists.length; i++) {\n // append the artist names for each album\n if (i == 0) {\n\t\t song_artist[song_name] = playlist_data[track].track.artists[i].name;\n } else {\n song_artist[song_name] += \", \" + playlist_data[track].track.artists[i].name;\n }\n }\n\n \t // append name of track\n\t\t popularity_list[song_name] = song_popularity; \n\n\t popularity += song_popularity;\n\t duration += playlist_data[track].track.duration_ms;\n }\n\n popularity = (popularity / totaltracks).toFixed(2);\n\t var total_duration = msToTime(duration);\n\t duration = msToTimeAvg((duration / totaltracks).toFixed(0));\n\n // Display artist, album table, popularity list\n\t\tdisplayFrequentArtists(artist_list, artist_to_id);\n displayFrequentAlbums(album_list, album_artists, album_to_id);\n displayPopularity(popularity_list, song_artist);\n\t\tvar avg_year = getAverageYear(album_list, album_year);\t\n\n\t\t// generate list of years and song count\n\t\tvar years = [];\n\t\tvar year_count = [];\n\t\tvar current_date = new Date();\n\t\tfor (var i = parseInt(Object.keys(year_list)[0]); i < current_date.getFullYear() + 1; i++) {\n years.push(String(i));\n\t\t if (year_list[String(i)]) {\n\t\t year_count.push(year_list[String(i)]);\n } else {\n\t\t\tyear_count.push(0);\n }\n }\t\n\t\tgenerateYearGraph(years, year_count);\n\n\t // Update the page with the stats\n\t\tdocument.getElementById(\"general-stats\").innerHTML = \"<h1><b>General Stats</b></h1>\";\n playlistStatsPlaceholder.innerHTML = playlistStatsTemplate({\n unique_artists: Object.keys(artist_list).length,\n unique_albums: Object.keys(album_list).length,\n\t total: totaltracks,\n\t\t total_duration: total_duration\n\t\t});\n\t\tplaylistStats2Placeholder.innerHTML = playlistStats2Template({\n\t avg_duration: duration,\n\t popularity_avg: popularity,\n avg_year: avg_year\n\t\t});\n }\n }\n });\n}",
"function calc_count_per_meta(data) {\n var count_per_meta = {};\n for(var i = 0; i < data.length; i+=1)\n {\n var row = data[i];\n if(row.meta in count_per_meta)\n {\n count_per_meta[row.meta] += 1;\n }\n else\n {\n count_per_meta[row.meta] = 1;\n }\n }\n \n //convert to array form\n var count_per_meta_array = Object.keys(count_per_meta).map(function (meta) {\n return {\n \"meta\": meta, \n \"total_count\": count_per_meta[meta]\n };\n });\n \n return count_per_meta_array;\n}",
"function set_track_id() {\n track_library.count = track_library.count + 1;\n return track_library.count;\n}",
"function countCombinations() {\n var sets = [];\n for (var i in filteredInfo) {\n var genres = filteredInfo[i].Genre.split(\",\");\n for (var j in genres) {\n var genre = genres[j].trim();\n if (genres_count[genre] != undefined)\n genres_count[genre] += 1;\n else\n genres_count[genre] = 1;\n }\n }\n for (var i in genres_count)\n sets.push({\"Genre\": i, Size: genres_count[i], label: i});\n createDonutChart(sets);\n}",
"function getCounts() {\n kwordArr.sort();\n let currentWord = null;\n let cnt = 0;\n for (var i = 0; i < kwordArr.length; i++) {\n if (kwordArr[i] !== currentWord) {\n if (cnt > 0) {\n let word = {\n \"value\": currentWord,\n \"count\": cnt,\n }\n dataArray.push(word);\n }\n currentWord = kwordArr[i];\n cnt = 1;\n } else {\n cnt++;\n }\n }\n if (cnt > 0) {\n let word = {\n \"value\": currentWord,\n \"count\": cnt,\n }\n dataArray.push(word);\n }\n }",
"getCount(category) {\n let count = [];\n let types = this.getAllPossible(category);\n let slot = this.getCategoryNumber(category);\n\n types.forEach(() => {\n count.push(0);\n });\n\n mushroom.data.forEach((mushroom) => {\n types.forEach((type, index) => {\n if (mushroom[slot] === type.key) {\n count[index]++;\n }\n });\n });\n\n return count;\n }",
"refreshCounts() {\n let counts = {}\n\n for(let id in this.props.tasks) {\n let task = this.props.tasks[id],\n group = task.group,\n one = (+task.done||0)\n\n if(!counts[group])\n counts[group] = {done: 0, total: 0}\n\n counts[group].done += one\n ++counts[group].total\n }\n\n this.setState({\n counts\n })\n }",
"function count(){\r\n\r\n\tvar n=0;\r\n\tObject.keys(this.datastore).forEach((key)=>\r\n\t{\r\n\t\t++n;\r\n\t});\r\n\treturn n;\r\n}",
"function CountTrack(gsvg,data,trackClass,density){\n\tvar that= Track(gsvg,data,trackClass,\"Generic Counts\");\n\tthat.loadedDataMin=that.xScale.domain()[0];\n\tthat.loadedDataMax=that.xScale.domain()[1];\n\tthat.dataFileName=that.trackClass;\n\tthat.scaleMin=1;\n\tthat.scaleMax=5000;\n\tthat.graphColorText=\"steelblue\";\n\tthat.colorScale=d3.scaleLinear().domain([that.scaleMin,that.scaleMax]).range([\"#EEEEEE\",\"#000000\"]);\n\tthat.ttSVG=1;\n\tthat.data=data;\n\tthat.density=density;\n\tthat.prevDensity=density;\n\tthat.displayBreakDown=null;\n\tvar tmpMin=that.gsvg.xScale.domain()[0];\n\tvar tmpMax=that.gsvg.xScale.domain()[1];\n\tvar len=tmpMax-tmpMin;\n\t\n\tthat.fullDataTimeOutHandle=0;\n\n\tthat.ttTrackList=[];\n\tif(trackClass.indexOf(\"illuminaSmall\")>-1){\n\t\tthat.ttTrackList.push(\"ensemblsmallnc\");\n\t\tthat.ttTrackList.push(\"brainsmallnc\");\n\t\tthat.ttTrackList.push(\"liversmallnc\");\n\t\tthat.ttTrackList.push(\"heartsmallnc\");\n\t\tthat.ttTrackList.push(\"repeatMask\");\n\t}else{\n\t\tthat.ttTrackList.push(\"ensemblcoding\");\n\t\tthat.ttTrackList.push(\"braincoding\");\n\t\tthat.ttTrackList.push(\"liverTotal\");\n\t\tthat.ttTrackList.push(\"heartTotal\");\n\t\tthat.ttTrackList.push(\"mergedTotal\");\n\t\tthat.ttTrackList.push(\"refSeq\");\n\t\tthat.ttTrackList.push(\"ensemblnoncoding\");\n\t\tthat.ttTrackList.push(\"brainnoncoding\");\n\t\tthat.ttTrackList.push(\"probe\");\n\t\tthat.ttTrackList.push(\"polyASite\");\n\t\tthat.ttTrackList.push(\"spliceJnct\");\n\t\tthat.ttTrackList.push(\"liverspliceJnct\");\n\t\tthat.ttTrackList.push(\"heartspliceJnct\");\n\t\tthat.ttTrackList.push(\"repeatMask\");\n\t}\n\n\n\n\tthat.calculateBin= function(len){\n\t\tvar w=that.gsvg.width;\n\t\tvar bpPerPixel=len/w;\n\t\tbpPerPixel=Math.floor(bpPerPixel);\n\t\tvar bpPerPixelStr=new String(bpPerPixel);\n\t\tvar firstDigit=bpPerPixelStr.substr(0,1);\n\t\tvar firstNum=firstDigit*Math.pow(10,(bpPerPixelStr.length-1));\n\t\tvar bin=firstNum/2;\n\t\tbin=Math.floor(bin);\n\t\tif(bin<5){\n\t\t\tbin=0;\n\t\t}\n\t\treturn bin;\n\t};\n\tthat.bin=that.calculateBin(len);\n\n\n\tthat.color= function (d){\n\t\tvar color=\"#FFFFFF\";\n\t\tif(d.getAttribute(\"count\")>=that.scaleMin){\n\t\t\tcolor=d3.rgb(that.colorScale(d.getAttribute(\"count\")));\n\t\t\t//color=d3.rgb(that.colorScale(d.getAttribute(\"count\")));\n\t\t}\n\t\treturn color;\n\t};\n\n\tthat.redraw= function (){\n\n\t\tvar tmpMin=that.gsvg.xScale.domain()[0];\n\t\tvar tmpMax=that.gsvg.xScale.domain()[1];\n\t\t//var len=tmpMax-tmpMin;\n\t\tvar tmpBin=that.bin;\n\t\tvar tmpW=that.xScale(tmpMin+tmpBin)-that.xScale(tmpMin);\n\t\t/*if(that.gsvg.levelNumber<10 && (tmpW>2||tmpW<0.5)) {\n\t\t\tthat.updateFullData(0,1);\n\t\t}*//*else if(tmpMin<that.prevMinCoord||tmpMax>that.prevMaxCoord){\n\t\t\tthat.updateFullData(0,1);\n\t\t}*/\n\t\t//else{\n\n\t\t\tthat.prevMinCoord=tmpMin;\n\t\t\tthat.prevMaxCoord=tmpMax;\n\n\t\t\tvar tmpMin=that.xScale.domain()[0];\n\t\t\t\tvar tmpMax=that.xScale.domain()[1];\n\t\t\t\tvar newData=[];\n\t\t\t\tvar newCount=0;\n\t\t\t\tvar tmpYMax=0;\n\t\t\t\tfor(var l=0;l<that.data.length;l++){\n\t\t\t\t\tif(typeof that.data[l]!=='undefined' ){\n\t\t\t\t\t\tvar start=parseInt(that.data[l].getAttribute(\"start\"),10);\n\t\t\t\t\t\tvar stop=parseInt(that.data[l].getAttribute(\"stop\"),10);\n\t\t\t\t\t\tvar count=parseInt(that.data[l].getAttribute(\"count\"),10);\n\t\t\t\t\t\tif(that.density!=1 ||(that.density==1 && start!=stop)){\n\t\t\t\t\t\t\tif((l+1)<that.data.length){\n\t\t\t\t\t\t\t\tvar startNext=parseInt(that.data[l+1].getAttribute(\"start\"),10);\n\t\t\t\t\t\t\t\tif(\t(start>=tmpMin&&start<=tmpMax) || (startNext>=tmpMin&&startNext<=tmpMax)\n\t\t\t\t\t\t\t\t\t){\n\t\t\t\t\t\t\t\t\tnewData[newCount]=that.data[l];\n\t\t\t\t\t\t\t\t\tif(count>tmpYMax){\n\t\t\t\t\t\t\t\t\t\ttmpYMax=count;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tnewCount++;\n\t\t\t\t\t\t\t\t}else{\n\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tif(start>=tmpMin&&start<=tmpMax){\n\t\t\t\t\t\t\t\t\tnewData[newCount]=that.data[l];\n\t\t\t\t\t\t\t\t\tif(count>tmpYMax){\n\t\t\t\t\t\t\t\t\t\ttmpYMax=count;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tnewCount++;\n\t\t\t\t\t\t\t\t}else{\n\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\tif(that.density==1){\n\t\t\t\tif(that.density!=that.prevDensity){\n\t\t\t\t\tthat.redrawLegend();\n\t\t\t\t\tvar tmpMax=that.gsvg.xScale.domain()[1];\n\t\t\t\t\tthat.prevDensity=that.density;\n\t\t\t\t\tthat.svg.selectAll(\".area\").remove();\n\t\t\t\t\tthat.svg.selectAll(\"g.y\").remove();\n\t\t\t\t\tthat.svg.selectAll(\".grid\").remove();\n\t\t\t\t\tthat.svg.selectAll(\".leftLbl\").remove();\n\t\t\t\t\tvar points=that.svg.selectAll(\".\"+that.trackClass).data(newData,keyStart)\n\t\t\t \tpoints.enter()\n\t\t\t\t\t\t\t.append(\"rect\")\n\t\t\t\t\t\t\t.attr(\"x\",function(d){return that.xScale(d.getAttribute(\"start\"));})\n\t\t\t\t\t\t\t.attr(\"y\",15)\n\t\t\t\t\t\t\t.attr(\"class\", that.trackClass)\n\t\t\t\t \t\t.attr(\"height\",10)\n\t\t\t\t\t\t\t.attr(\"width\",function(d,i) {\n\t\t\t\t\t\t\t\t\t\t\t var wX=1;\n\t\t\t\t\t\t\t\t\t\t\t wX=that.xScale((d.getAttribute(\"stop\")))-that.xScale(d.getAttribute(\"start\"));\n\n\t\t\t\t\t\t\t\t\t\t\t return wX;\n\t\t\t\t\t\t\t\t\t\t\t })\n\t\t\t\t\t\t\t.attr(\"fill\",that.color)\n\t\t\t\t\t\t\t.on(\"mouseover\", function(d) {\n\t\t\t\t\t\t\t\tif(that.gsvg.isToolTip==0){\n\t\t\t\t\t\t\t\t\td3.select(this).style(\"fill\",\"green\");\n\t\t\t \t\t\ttt.transition()\n\t\t\t\t\t\t\t\t\t\t.duration(200)\n\t\t\t\t\t\t\t\t\t\t.style(\"opacity\", 1);\n\t\t\t\t\t\t\t\t\ttt.html(that.createToolTip(d))\n\t\t\t\t\t\t\t\t\t\t.style(\"left\", function(){return that.positionTTLeft(d3.event.pageX);})\n\t\t\t\t\t\t\t\t\t\t.style(\"top\", function(){return that.positionTTTop(d3.event.pageY);});\n\t\t\t\t\t\t\t\t}\n\t\t \t\t\t})\n\t\t\t\t\t\t\t.on(\"mouseout\", function(d) {\n\t\t\t\t\t\t\t\td3.select(this).style(\"fill\",that.color);\n\t\t\t\t\t tt.transition()\n\t\t\t\t\t\t\t\t\t .delay(500)\n\t\t\t\t\t .duration(200)\n\t\t\t\t\t .style(\"opacity\", 0);\n\t\t\t\t\t });\n\t\t\t\t\tpoints.exit().remove();\n\t\t\t\t}else{\n\t\t\t\t\tthat.svg.selectAll(\".\"+that.trackClass)\n\t\t\t\t\t\t.attr(\"x\",function(d){return that.xScale(d.getAttribute(\"start\"));})\n\t\t\t\t\t\t.attr(\"width\",function(d,i) {\n\t\t\t\t\t\t\t\t\t\t\t var wX=1;\n\t\t\t\t\t\t\t\t\t\t\t wX=that.xScale((d.getAttribute(\"stop\")))-that.xScale(d.getAttribute(\"start\"));\n\t\t\t\t\t\t\t\t\t\t\t /*if((i+1)<that.data.length){\n\t\t\t\t\t\t\t\t\t\t\t \t\tif(that.xScale((that.data[i+1].getAttribute(\"start\")))-that.xScale(d.getAttribute(\"start\"))>1){\n\t\t\t\t\t\t\t\t\t\t\t\t \t\twX=that.xScale((that.data[i+1].getAttribute(\"start\")))-that.xScale(d.getAttribute(\"start\"));\n\t\t\t\t\t\t\t\t\t\t\t \t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}/*else{\n\t\t\t\t\t\t\t\t\t\t\t\t\tif(d3.select(this).attr(\"width\")>0){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\twX=d3.select(this).attr(\"width\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif(that.xScale(tmpMax)-that.xScale(d.getAttribute(\"start\"))>1){\n\t\t\t\t\t\t\t\t\t\t\t\t \t\t\twX=that.xScale(tmpMax)-that.xScale(d.getAttribute(\"start\"));\n\t\t\t\t\t\t\t\t\t\t\t \t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t \t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}*/\n\t\t\t\t\t\t\t\t\t\t\t return wX;\n\t\t\t\t\t\t\t\t\t\t\t })\n\t\t\t\t\t\t.attr(\"fill\",that.color);\n\t\t\t\t}\n\t\t\t\tthat.svg.attr(\"height\", 30);\n\t\t\t}else if(that.density==2){\n\n\n\t\t\t\tthat.svg.selectAll(\".\"+that.trackClass).remove();\n\t\t\t\tthat.svg.select(\".y.axis\").remove();\n\t\t\t\tthat.svg.select(\"g.grid\").remove();\n\t\t\t\tthat.svg.selectAll(\".leftLbl\").remove();\n\t\t\t\tthat.yScale.domain([0, tmpYMax]);\n\t\t\t\tthat.svg.select(\".area\").remove();\n\t\t\t\tthat.area = d3.area()\n\t \t\t\t\t.x(function(d) { return that.xScale(d.getAttribute(\"start\")); })\n\t\t\t\t\t .y0(140)\n\t\t\t\t\t .y1(function(d) { return that.yScale(d.getAttribute(\"count\")); });\n\t\t\t\tthat.redrawLegend();\n\t\t\t\tthat.prevDensity=that.density;\n\t\t\t\tthat.svg.append(\"g\")\n\t\t\t\t\t .attr(\"class\", \"y axis\")\n\t\t\t\t\t .call(that.yAxis);\n\t\t\t\tthat.svg.append(\"g\")\n\t\t\t \t.attr(\"class\", \"grid\")\n\t\t\t \t.call(that.yAxis\n\t\t\t \t\t.tickSize((-that.gsvg.width+10), 0, 0)\n\t\t\t \t\t.tickFormat(\"\")\n\t\t\t \t\t);\n\t\t\t\tthat.svg.select(\"g.y\").selectAll(\"text\").each(function(d){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar str=new String(d);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\td3.select(this).attr(\"x\",function(){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\t\treturn str.length*7.7+5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t.attr(\"dy\",\"0.05em\");\n\n\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\tthat.svg.append(\"svg:text\").attr(\"class\",\"leftLbl\")\n\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"x\",that.gsvg.width-(str.length*7.8+5))\n\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"y\",function(){return that.yScale(d)})\n\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"dy\",\"0.01em\")\n\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t.style(\"font-weight\",\"bold\")\n\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t.text(numberWithCommas(d));\n\n\n\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t that.svg.append(\"path\")\n\t\t\t\t \t.datum(newData)\n\t\t\t\t \t.attr(\"class\", \"area\")\n\t\t\t\t \t.attr(\"stroke\",that.graphColorText)\n\t\t\t\t \t.attr(\"fill\",that.graphColorText)\n\t\t\t\t \t.attr(\"d\", that.area);\n\n\t\t\t\tthat.svg.attr(\"height\", 140);\n\t\t\t}\n\t\t\tthat.redrawSelectedArea();\n\t\t//}\n\t};\n\n\tthat.createToolTip=function (d){\n\t\tvar tooltip=\"\";\n\t\ttooltip=\"<BR><div id=\\\"ttSVG\\\" style=\\\"background:#FFFFFF;\\\"></div><BR>Read Count=\"+ numberWithCommas(d.getAttribute(\"count\"));\n\t\tif(that.bin>0){\n\t\t\tvar tmpEnd=parseInt(d.getAttribute(\"start\"),10)+parseInt(that.bin,10);\n\t\t\ttooltip=tooltip+\"*<BR><BR>*Data compressed for display. Using 90th percentile of<BR>region:\"+numberWithCommas(d.getAttribute(\"start\"))+\"-\"+numberWithCommas(tmpEnd)+\"<BR><BR>Zoom in further to see raw data(roughly a region <1000bp). The bin size will decrease as you zoom in thus the resolution of the count data will improve as you zoom in.\";\n\t\t}/*else{\n\t\t\ttooltip=tooltip+\"<BR>Read Count:\"+d.getAttribute(\"count\");\n\t\t}*/\n\t\treturn tooltip;\n\t};\n\n\tthat.update=function (d){\n\t\tvar tmpMin=that.xScale.domain()[0];\n\t\tvar tmpMax=that.xScale.domain()[1];\n\t\tif(that.loadedDataMin<=tmpMin &&tmpMax<=that.loadedDataMax){\n\t\t\tthat.redraw();\n\t\t}else{\n\t\t\tthat.updateFullData(0,1);\n\t\t}\n\t};\n\n\tthat.updateFullData = function(retry,force){\n\t\tvar tmpMin=that.xScale.domain()[0];\n\t\tvar tmpMax=that.xScale.domain()[1];\n\n\t\tvar len=tmpMax-tmpMin;\n\n\t\tthat.showLoading();\n\t\tthat.bin=that.calculateBin(len);\n\t\t//console.log(\"update \"+that.trackClass);\n\t\tvar tag=\"Count\";\n\t\tvar file=dataPrefix+\"tmpData/browserCache/\"+genomeVer+\"/regionData/\"+that.gsvg.folderName+\"/tmp/\"+tmpMin+\"_\"+tmpMax+\".count.\"+that.trackClass+\".xml\";\n\t\tif(that.bin>0){\n\t\t\ttmpMin=tmpMin-(that.bin*2);\n\t\t\ttmpMin=tmpMin-(tmpMin%(that.bin*2));\n\t\t\ttmpMax=tmpMax+(that.bin*2);\n\t\t\ttmpMax=tmpMax+(that.bin*2-(tmpMax%(that.bin*2)));\n\t\t\tfile=dataPrefix+\"tmpData/browserCache/\"+genomeVer+\"/regionData/\"+that.gsvg.folderName+\"/tmp/\"+tmpMin+\"_\"+tmpMax+\".bincount.\"+that.bin+\".\"+that.trackClass+\".xml\";\n\t\t}\n\t\t//console.log(\"file=\"+file);\n\t\t//console.log(\"folder=\"+that.gsvg.folderName);\n\t\td3.xml(file,function (error,d){\n\t\t\t\t\tif(error){\n\t\t\t\t\t\tif(retry==0||force==1){\n\t\t\t\t\t\t\tvar tmpContext=contextPath +\"/\"+ pathPrefix;\n\t\t\t\t\t\t\tif(!pathPrefix){\n\t\t\t\t\t\t\t\ttmpContext=\"\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttmpPanel=panel;\n\t\t\t\t\t\t\tif(that.trackClass.indexOf(\"-\")>-1){\n\t\t\t\t\t\t\t\ttmpPanel=that.trackClass.substr(that.trackClass.indexOf(\"-\")+1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\t\t\t\t\t\t\turl: tmpContext +\"generateTrackXML.jsp\",\n\t\t\t\t\t\t\t\t \t\t\t\ttype: 'GET',\n\t\t\t\t\t\t\t\t \t\t\t\tcache: false,\n\t\t\t\t\t\t\t\t\t\t\t\tdata: {chromosome: chr,minCoord:tmpMin,maxCoord:tmpMax,panel:tmpPanel,rnaDatasetID:rnaDatasetID,arrayTypeID: arrayTypeID, myOrganism: organism,genomeVer:genomeVer, track: that.trackClass, folder: that.gsvg.folderName,binSize:that.bin},\n\t\t\t\t\t\t\t\t\t\t\t\t//data: {chromosome: chr,minCoord:minCoord,maxCoord:maxCoord,panel:panel,rnaDatasetID:rnaDatasetID,arrayTypeID: arrayTypeID, myOrganism: organism, track: that.trackClass, folder: folderName,binSize:that.bin},\n\t\t\t\t\t\t\t\t\t\t\t\tdataType: 'json',\n\t\t\t\t\t\t\t\t \t\t\tsuccess: function(data2){\n\t\t\t\t\t\t\t\t \t\t\t\t//console.log(\"generateTrack:DONE\");\n\t\t\t\t\t\t\t\t \t\t\t\tif(ga){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tga('send','event','browser','generateTrackCount');\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t\t\t \t\t\t},\n\t\t\t\t\t\t\t\t \t\t\terror: function(xhr, status, error) {\n\n\t\t\t\t\t\t\t\t \t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//console.log(error);\n\t\t\t\t\t\tif(retry<8){//wait before trying again\n\t\t\t\t\t\t\tvar time=500;\n\t\t\t\t\t\t\t/*if(retry==0){\n\t\t\t\t\t\t\t\ttime=10000;\n\t\t\t\t\t\t\t}*/\n\t\t\t\t\t\t\tthat.fullDataTimeOutHandle=setTimeout(function (){\n\t\t\t\t\t\t\t\tthat.updateFullData(retry+1,0);\n\t\t\t\t\t\t\t},time);\n\t\t\t\t\t\t}else if(retry<30){\n\t\t\t\t\t\t\tvar time=1000;\n\t\t\t\t\t\t\tthat.fullDataTimeOutHandle=setTimeout(function (){\n\t\t\t\t\t\t\t\tthat.updateFullData(retry+1,0);\n\t\t\t\t\t\t\t},time);\n\t\t\t\t\t\t}else if(retry<32){\n\t\t\t\t\t\t\tvar time=10000;\n\t\t\t\t\t\t\tthat.fullDataTimeOutHandle=setTimeout(function (){\n\t\t\t\t\t\t\t\tthat.updateFullData(retry+1,0);\n\t\t\t\t\t\t\t},time);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\td3.select(\"#Level\"+that.levelNumber+that.trackClass).select(\"#trkLbl\").text(\"An errror occurred loading Track:\"+that.trackClass);\n\t\t\t\t\t\t\td3.select(\"#Level\"+that.levelNumber+that.trackClass).attr(\"height\", 15);\n\t\t\t\t\t\t\tthat.gsvg.addTrackErrorRemove(that.svg,\"#Level\"+that.gsvg.levelNumber+that.trackClass);\n\t\t\t\t\t\t\tthat.hideLoading();\n\t\t\t\t\t\t\tthat.fullDataTimeOutHandle=setTimeout(function (){\n\t\t\t\t\t\t\t\t\tthat.updateFullData(retry+1,1);\n\t\t\t\t\t\t\t\t},15000);\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\t//console.log(\"update data\");\n\t\t\t\t\t\t//console.log(d);\n\t\t\t\t\t\tif(d==null){\n\t\t\t\t\t\t\t//console.log(\"is null\");\n\t\t\t\t\t\t\tif(retry>=32){\n\t\t\t\t\t\t\t\tdata=new Array();\n\t\t\t\t\t\t\t\tthat.draw(data);\n\t\t\t\t\t\t\t\t//that.hideLoading();\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tthat.fullDataTimeOutHandle=setTimeout(function (){\n\t\t\t\t\t\t\t\t\tthat.updateFullData(retry+1,0);\n\t\t\t\t\t\t\t\t},5000);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t//console.log(\"not null is drawing\");\n\t\t\t\t\t\t\tthat.fullDataTimeOutHandle=0;\n\t\t\t\t\t\t\tthat.loadedDataMin=tmpMin;\n\t\t\t\t \t\tthat.loadedDataMax=tmpMax;\n\t\t\t\t\t\t\tvar data=d.documentElement.getElementsByTagName(\"Count\");\n\t\t\t\t\t\t\tthat.draw(data);\n\t\t\t\t\t\t\t//that.hideLoading();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t//that.hideLoading();\n\t\t\t\t});\n\t};\n\n\tthat.updateCountScale= function(minVal,maxVal){\n\t\tthat.scaleMin=minVal;\n\t\tthat.scaleMax=maxVal;\n\t\tthat.colorScale=d3.scaleLinear().domain([that.scaleMin,that.scaleMax]).range([\"#EEEEEE\",\"#000000\"]);\n\t\tif(that.density==1){\n\t\t\tthat.redrawLegend();\n\t\t\tthat.redraw();\n\t\t}\n\t};\n\n\tthat.setupToolTipSVG=function(d,perc){\n\t\t//Setup Tooltip SVG\n\t\tvar tmpMin=that.xScale.domain()[0];\n\t\tvar tmpMax=that.xScale.domain()[1];\n\t\tvar start=parseInt(d.getAttribute(\"start\"),10);\n\t\tvar stop=parseInt(d.getAttribute(\"stop\"),10);\n\t\tvar len=stop-start;\n\t\tvar margin=Math.floor((tmpMax-tmpMin)*perc);\n\t\tif(margin<20){\n\t\t\tmargin=20;\n\t\t}\n\t\tvar tmpStart=start-margin;\n\t\tvar tmpStop=stop+margin;\n\t\tif(tmpStart<1){\n\t\t\ttmpStart=1;\n\t\t}\n\t\tif(typeof that.ttSVGMinWidth!=='undefined'){\n\t\t\tif(tmpStop-tmpStart<that.ttSVGMinWidth){\n\t\t\t\ttmpStart=start-(that.ttSVGMinWidth/2);\n\t\t\t\ttmpStop=stop+(that.ttSVGMinWidth/2);\n\t\t\t}\n\t\t}\n\n\t\tvar newSvg=toolTipSVG(\"div#ttSVG\",450,tmpStart,tmpStop,99,d.getAttribute(\"ID\"),\"transcript\");\n\t\t//Setup Track for current feature\n\t\t//var dataArr=new Array();\n\t\t//dataArr[0]=d;\n\t\tnewSvg.addTrack(that.trackClass,3,\"\",that.data);\n\t\t//Setup Other tracks included in the track type(listed in that.ttTrackList)\n\t\tfor(var r=0;r<that.ttTrackList.length;r++){\n\t\t\tvar tData=that.gsvg.getTrackData(that.ttTrackList[r]);\n\t\t\tvar fData=new Array();\n\t\t\tif(typeof tData!=='undefined' && tData.length>0){\n\t\t\t\tvar fCount=0;\n\t\t\t\tfor(var s=0;s<tData.length;s++){\n\t\t\t\t\tif((tmpStart<=parseInt(tData[s].getAttribute(\"start\"),10)&&parseInt(tData[s].getAttribute(\"start\"),10)<=tmpStop)\n\t\t\t\t\t\t|| (parseInt(tData[s].getAttribute(\"start\"),10)<=tmpStart&&parseInt(tData[s].getAttribute(\"stop\"),10)>=tmpStart)\n\t\t\t\t\t\t){\n\t\t\t\t\t\tfData[fCount]=tData[s];\n\t\t\t\t\t\tfCount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(fData.length>0){\n\t\t\t\t\tnewSvg.addTrack(that.ttTrackList[r],3,\"DrawTrx\",fData);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tthat.draw=function(data){\n\t\tthat.hideLoading();\n\n\t\t//d3.selectAll(\".\"+that.trackClass).remove();\n\t\t//data.sort(function(a, b){return a.getAttribute(\"start\")-b.getAttribute(\"start\")});\n\t\tthat.data=data;\n\t\t/*if($(\"#\"+that.trackClass+\"Dense\"+that.gsvg.levelNumber+\"Select\").length>0){\n\t\t\tthat.density=$(\"#\"+that.trackClass+\"Dense\"+that.gsvg.levelNumber+\"Select\").val();\n\t\t}*/\n\t\tvar tmpMin=that.gsvg.xScale.domain()[0];\n\t\tvar tmpMax=that.gsvg.xScale.domain()[1];\n\t\t//var len=tmpMax-tmpMin;\n\t\tvar tmpBin=that.bin;\n\t\tvar tmpW=that.xScale(tmpMin+tmpBin)-that.xScale(tmpMin);\n\t\t/*if(that.gsvg.levelNumber<10 && (tmpW>2||tmpW<0.5)) {\n\t\t\tthat.updateFullData(0,1);\n\t\t}else{\n\t\t*/\n\t\tthat.redrawLegend();\n\t\t//var tmpMin=that.xScale.domain()[0];\n\t\t//var tmpMax=that.xScale.domain()[1];\n\t\tvar newData=[];\n\t\tvar newCount=0;\n\t\tvar tmpYMax=0;\n\t\tfor(var l=0;l<data.length;l++){\n\t\t\tif(typeof data[l]!=='undefined' ){\n\t\t\t\tvar start=parseInt(data[l].getAttribute(\"start\"),10);\n\t\t\t\tvar stop=parseInt(data[l].getAttribute(\"stop\"),10);\n\t\t\t\tvar count=parseInt(data[l].getAttribute(\"count\"),10);\n\t\t\t\tif(that.density!=1 ||(that.density==1 && start!=stop)){\n\t\t\t\t\tif((l+1)<data.length){\n\t\t\t\t\t\tvar startNext=parseInt(data[l+1].getAttribute(\"start\"),10);\n\t\t\t\t\t\tif(\t(start>=tmpMin&&start<=tmpMax) || (startNext>=tmpMin&&startNext<=tmpMax)){\n\t\t\t\t\t\t\tnewData[newCount]=data[l];\n\t\t\t\t\t\t\tif(count>tmpYMax){\n\t\t\t\t\t\t\t\ttmpYMax=count;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tnewCount++;\n\t\t\t\t\t\t}else{\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\tif((start>=tmpMin&&start<=tmpMax)){\n\t\t\t\t\t\t\tnewData[newCount]=data[l];\n\t\t\t\t\t\t\tif(count>tmpYMax){\n\t\t\t\t\t\t\t\ttmpYMax=count;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tnewCount++;\n\t\t\t\t\t\t}else{\n\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\tdata=newData;\n\t\tthat.svg.selectAll(\".\"+that.trackClass).remove();\n\t\tthat.svg.select(\".y.axis\").remove();\n\t\tthat.svg.select(\"g.grid\").remove();\n\t\tthat.svg.selectAll(\".leftLbl\").remove();\n\t\tthat.svg.select(\".area\").remove();\n\t\tthat.svg.selectAll(\".area\").remove();\n\t\tif(that.density==1){\n\t\t\tvar tmpMax=that.gsvg.xScale.domain()[1];\n\t \tvar points=that.svg.selectAll(\".\"+that.trackClass)\n\t \t\t\t.data(data,keyStart);\n\t \tpoints.enter()\n\t\t\t\t\t.append(\"rect\")\n\t\t\t\t\t.attr(\"x\",function(d){return that.xScale(d.getAttribute(\"start\"));})\n\t\t\t\t\t.attr(\"y\",15)\n\t\t\t\t\t.attr(\"class\", that.trackClass)\n\t\t \t\t.attr(\"height\",10)\n\t\t\t\t\t.attr(\"width\",function(d,i) {\n\t\t\t\t\t\t\t\t\t var wX=1;\n\t\t\t\t\t\t\t\t\t wX=that.xScale((d.getAttribute(\"stop\")))-that.xScale(d.getAttribute(\"start\"));\n\t\t\t\t\t\t\t\t\t /*if((i+1)<that.data.length){\n\t\t\t\t\t\t\t\t\t\t if(that.xScale((that.data[i+1].getAttribute(\"start\")))-that.xScale(d.getAttribute(\"start\"))>1){\n\t\t\t\t\t\t\t\t\t\t\t wX=that.xScale((that.data[i+1].getAttribute(\"start\")))-that.xScale(d.getAttribute(\"start\"));\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\tif(that.xScale(tmpMax)-that.xScale(d.getAttribute(\"start\"))>1){\n\t\t\t\t\t\t\t\t\t\t\t \twX=that.xScale(tmpMax)-that.xScale(d.getAttribute(\"start\"));\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 return wX;\n\t\t\t\t\t\t\t\t\t })\n\t\t\t\t\t.attr(\"fill\",that.color)\n\t\t\t\t\t.on(\"mouseover\", function(d) {\n\t\t\t\t\t\t\t//console.log(\"mouseover count track\");\n\t\t\t\t\t\t\tif(that.gsvg.isToolTip==0){\n\t\t\t\t\t\t\t\t//console.log(\"setup tooltip:countTrack\");\n\t\t\t\t\t\t\t\td3.select(this).style(\"fill\",\"green\");\n\t\t \t\t\ttt.transition()\n\t\t\t\t\t\t\t\t\t.duration(200)\n\t\t\t\t\t\t\t\t\t.style(\"opacity\", 1);\n\t\t\t\t\t\t\t\ttt.html(that.createToolTip(d))\n\t\t\t\t\t\t\t\t\t.style(\"left\", function(){return that.positionTTLeft(d3.event.pageX);})\n\t\t\t\t\t\t\t\t\t.style(\"top\", function(){return that.positionTTTop(d3.event.pageY);});\n\t\t\t\t\t\t\t\tif(that.ttSVG==1){\n\t\t\t\t\t\t\t\t\t//Setup Tooltip SVG\n\t\t\t\t\t\t\t\t\tthat.setupToolTipSVG(d,0.005);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n \t\t\t})\n\t\t\t\t\t.on(\"mouseout\", function(d) {\n\t\t\t\t\t\td3.select(this).style(\"fill\",that.color);\n\t\t\t tt.transition()\n\t\t\t\t\t\t\t .delay(500)\n\t\t\t .duration(200)\n\t\t\t .style(\"opacity\", 0);\n\t\t\t });\n\t\t\tthat.svg.attr(\"height\", 30);\n\t }else if(that.density==2){\n\t \tthat.yScale.domain([0, tmpYMax]);\n\t \tthat.yAxis = d3.axisLeft(that.yScale)\n \t\t\t\t.ticks(5);\n \t\tthat.svg.select(\"g.grid\").remove();\n \t\tthat.svg.select(\".y.axis\").remove();\n \t\tthat.svg.selectAll(\".leftLbl\").remove();\n\t \tthat.svg.append(\"g\")\n\t\t .attr(\"class\", \"y axis\")\n\t\t .call(that.yAxis);\n\n\t\t that.svg.select(\"g.y\").selectAll(\"text\").each(function(d){\n\t\t \t\t\t\t\t\t\t\t\t\t\t\tvar str=new String(d);\n\t\t \t\t\t\t\t\t\t\t\t\t\t\tthat.svg.append(\"svg:text\").attr(\"class\",\"leftLbl\")\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"x\",that.gsvg.width-(str.length*7.8+5))\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"y\",function(){return that.yScale(d)})\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\"dy\",\"0.01em\")\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t.style(\"font-weight\",\"bold\")\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t.text(numberWithCommas(d));\n\n\t\t\t\t\t\t\t\t \t\t\t\t\t\td3.select(this).attr(\"x\",function(){\n\t\t\t\t\t\t\t\t \t\t\t\t\t\t\treturn str.length*7.7+5;\n\t\t\t\t\t\t\t\t \t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t \t\t\t\t\t\t.attr(\"dy\",\"0.05em\");\n\t\t\t\t\t\t \t\t\t\t\t\t});\n\n\t \tthat.svg.append(\"g\")\n\t\t .attr(\"class\", \"grid\")\n\t\t .call(that.yAxis\n\t\t \t\t.tickSize((-that.gsvg.width+10), 0, 0)\n\t\t \t\t.tickFormat(\"\")\n\t\t \t\t);\n\t\t that.svg.select(\".area\").remove();\n\t\t that.area = d3.area()\n \t\t\t\t.x(function(d) { return that.xScale(d.getAttribute(\"start\")); })\n\t\t\t\t .y0(140)\n\t\t\t\t .y1(function(d,i) { return that.yScale(d.getAttribute(\"count\"));; });\n\t\t that.svg.append(\"path\")\n\t\t \t.datum(data)\n\t\t \t.attr(\"class\", \"area\")\n\t\t \t.attr(\"stroke\",that.graphColorText)\n\t\t \t.attr(\"fill\",that.graphColorText)\n\t\t \t.attr(\"d\", that.area);\n\t\t\tthat.svg.attr(\"height\", 140);\n\t\t}\n\t\tthat.redrawSelectedArea();\n\t\t//}\n\t};\n\n\tthat.redrawLegend=function (){\n\n\t\tif(that.density==2){\n\t\t\td3.select(\"#Level\"+that.gsvg.levelNumber+that.trackClass).selectAll(\".legend\").remove();\n\t\t}else if(that.density==1){\n\t\t\tvar lblStr=new String(that.label);\n\t\t\tvar x=that.gsvg.width/2+(lblStr.length/2)*7.5-10;\n\t\t\tvar ltLbl=new String(\"<\"+that.scaleMin);\n\t\t\tthat.drawScaleLegend(that.scaleMin,numberWithCommas(that.scaleMax)+\"+\",\"Read Counts\",\"#EEEEEE\",\"#00000\",15+(ltLbl.length*7.6));\n\t\t\tthat.svg.append(\"text\").text(\"<\"+that.scaleMin).attr(\"class\",\"legend\").attr(\"x\",x).attr(\"y\",12);\n\t\t\tthat.svg.append(\"rect\")\n\t\t\t\t\t.attr(\"class\",\"legend\")\n\t\t\t\t\t.attr(\"x\",x+ltLbl.length*7.6+5)\n\t\t\t\t\t.attr(\"y\",0)\n\t\t\t\t\t.attr(\"rx\",2)\n\t\t\t\t\t.attr(\"ry\",2)\n\t\t\t \t.attr(\"height\",12)\n\t\t\t\t\t.attr(\"width\",15)\n\t\t\t\t\t.attr(\"fill\",\"#FFFFFF\")\n\t\t\t\t\t.attr(\"stroke\",\"#CECECE\");\n\t\t}\n\n\t};\n\n\tthat.redrawSelectedArea=function(){\n\t\tif(that.density>1){\n\t\t\tvar rectH=that.svg.attr(\"height\");\n\t\t\t\n\t\t\td3.select(\"#Level\"+that.gsvg.levelNumber+that.trackClass).selectAll(\".selectedArea\").remove();\n\t\t\tif(that.selectionStart>-1&&that.selectionEnd>-1){\n\t\t\t\tvar tmpStart=that.xScale(that.selectionStart);\n\t\t\t\tvar tmpW=that.xScale(that.selectionEnd)-tmpStart;\n\t\t\t\tif(tmpW<1){\n\t\t\t\t\ttmpW=1;\n\t\t\t\t}\n\t\t\t\td3.select(\"#Level\"+that.gsvg.levelNumber+that.trackClass).append(\"rect\")\n\t\t\t\t\t\t\t\t.attr(\"class\",\"selectedArea\")\n\t\t\t\t\t\t\t\t.attr(\"x\",tmpStart)\n\t\t\t\t\t\t\t\t.attr(\"y\",0)\n\t\t\t\t \t\t\t.attr(\"height\",rectH)\n\t\t\t\t\t\t\t\t.attr(\"width\",tmpW)\n\t\t\t\t\t\t\t\t.attr(\"fill\",\"#CECECE\")\n\t\t\t\t\t\t\t\t.attr(\"opacity\",0.3)\n\t\t\t\t\t\t\t\t.attr(\"pointer-events\",\"none\");\n\t\t\t}\n\t\t}else{\n\t\t\td3.select(\"#Level\"+that.gsvg.levelNumber+that.trackClass).selectAll(\".selectedArea\").remove();\n\t\t}\n\t};\n\n\n\tthat.savePrevious=function(){\n\t\tthat.prevSetting={};\n\t\tthat.prevSetting.density=that.density;\n\t\tthat.prevSetting.scaleMin=that.scaleMin;\n\t\tthat.prevSetting.scaleMax=that.scaleMax;\n\t};\n\n\tthat.revertPrevious=function(){\n\t\tthat.density=that.prevSetting.density;\n\t\tthat.scaleMin=that.prevSetting.scaleMin;\n\t\tthat.scaleMax=that.prevSetting.scaleMax;\n\t};\n\n\tthat.generateTrackSettingString=function(){\n\t\treturn that.trackClass+\",\"+that.density+\",\"+that.include+\";\";\n\t};\n\n\tthat.generateSettingsDiv=function(topLevelSelector){\n\t\tvar d=trackInfo[that.trackClass];\n\t\tthat.savePrevious();\n\t\t//console.log(trackInfo);\n\t\t//console.log(d);\n\t\td3.select(topLevelSelector).select(\"table\").select(\"tbody\").html(\"\");\n\t\tif(d && d.Controls && d.Controls.length>0 ){\n\t\t\tvar controls=new String(d.Controls).split(\",\");\n\t\t\tvar table=d3.select(topLevelSelector).select(\"table\").select(\"tbody\");\n\t\t\ttable.append(\"tr\").append(\"td\").style(\"font-weight\",\"bold\").html(\"Track Settings: \"+d.Name);\n\t\t\tfor(var c=0;c<controls.length;c++){\n\t\t\t\tif(typeof controls[c]!=='undefined' && controls[c]!=\"\"){\n\t\t\t\t\tvar params=controls[c].split(\";\");\n\n\t\t\t\t\tvar div=table.append(\"tr\").append(\"td\");\n\t\t\t\t\tvar lbl=params[0].substr(5);\n\n\t\t\t\t\tvar def=\"\";\n\t\t\t\t\tif(params.length>3 && params[3].indexOf(\"Default=\")==0){\n\t\t\t\t\t\tdef=params[3].substr(8);\n\t\t\t\t\t}\n\t\t\t\t\tif(params[1].toLowerCase().indexOf(\"select\")==0){\n\t\t\t\t\t\tdiv.append(\"text\").text(lbl+\": \");\n\t\t\t\t\t\tvar selClass=params[1].split(\":\");\n\t\t\t\t\t\tvar opts=params[2].split(\"}\");\n\t\t\t\t\t\tvar id=that.trackClass+\"Dense\"+that.level+\"Select\";\n\t\t\t\t\t\tif(selClass[1]==\"colorSelect\"){\n\t\t\t\t\t\t\tid=that.trackClass+that.level+\"colorSelect\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar sel=div.append(\"select\").attr(\"id\",id)\n\t\t\t\t\t\t\t.attr(\"name\",selClass[1]);\n\t\t\t\t\t\tfor(var o=0;o<opts.length;o++){\n\t\t\t\t\t\t\tvar option=opts[o].substr(1).split(\":\");\n\t\t\t\t\t\t\tif(option.length==2){\n\t\t\t\t\t\t\t\tvar tmpOpt=sel.append(\"option\").attr(\"value\",option[1]).text(option[0]);\n\t\t\t\t\t\t\t\tif(id.indexOf(\"Dense\")>-1){\n\t\t\t\t\t\t\t\t\tif(option[1]==that.density){\n\t\t\t\t\t\t\t\t\t\ttmpOpt.attr(\"selected\",\"selected\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}else if(option[1]==def){\n\t\t\t\t\t\t\t\t\ttmpOpt.attr(\"selected\",\"selected\");\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\td3.select(\"select#\"+id).on(\"change\", function(){\n\t\t\t\t\t\t\tif($(this).attr(\"id\")==that.trackClass+\"Dense\"+that.level+\"Select\" && $(this).val()==1){\n\t\t\t\t\t\t\t\t$(\"#scaleControl\"+that.level).show();\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$(\"#scaleControl\"+that.level).hide();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthat.updateSettingsFromUI();\n\t\t\t\t\t\t\tthat.redraw();\n\t\t\t\t\t\t});\n\t\t\t\t\t}else if(params[1].toLowerCase().indexOf(\"slider\")==0){\n\t\t\t\t\t\tvar disp=\"none\";\n\t\t\t\t\t\tif(that.density==1){\n\t\t\t\t\t\t\tdisp=\"inline-block\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdiv=div.append(\"div\").attr(\"id\",\"scaleControl\"+that.level).style(\"display\",disp);\n\t\t\t\t\t\tdiv.append(\"text\").text(lbl+\": \");\n\t\t\t\t\t\tdiv.append(\"input\").attr(\"type\",\"text\").attr(\"id\",\"amount\").attr(\"value\",that.scaleMin+\"-\"+that.scaleMax).style(\"border\",0).style(\"color\",\"#f6931f\").style(\"font-weight\",\"bold\").style(\"background-color\",\"#EEEEEE\");\n\t\t\t\t\t\tvar selClass=params[1].split(\":\");\n\t\t\t\t\t\tvar opts=params[2].split(\"}\");\n\n\t\t\t\t\t\tdiv=div.append(\"div\");\n\t\t\t\t\t\tdiv.append(\"text\").text(\"Min:\");\n\t\t\t\t\t\tdiv.append(\"div\").attr(\"id\",\"min-\"+selClass[1])\n\t\t\t\t\t\t\t.style(\"width\",\"60%\")\n\t\t\t\t\t\t\t.style(\"display\",\"inline-block\")\n\t\t\t\t\t\t\t.style(\"float\",\"right\");\n\t\t\t\t\t\tdiv.append(\"br\");\n\t\t\t\t\t\tdiv.append(\"text\").text(\"Max:\");\n\t\t\t\t\t\tdiv.append(\"div\").attr(\"id\",\"max-\"+selClass[1])\n\t\t\t\t\t\t\t.style(\"width\",\"60%\")\n\t\t\t\t\t\t\t.style(\"display\",\"inline-block\")\n\t\t\t\t\t\t\t.style(\"float\",\"right\");\n\n\t\t\t\t\t\t$( \"#min-\"+selClass[1] ).slider({\n\t\t\t\t\t\t\t min: 1,\n\t\t\t\t\t\t\t max: 1000,\n\t\t\t\t\t\t\t step:1,\n\t\t\t\t\t\t\t value: that.scaleMin\t ,\n\t\t\t\t\t\t\t slide: that.processSlider\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t$( \"#max-\"+selClass[1] ).slider({\n\t\t\t\t\t\t\t min: 1000,\n\t\t\t\t\t\t\t max: 20000,\n\t\t\t\t\t\t\t step:100,\n\t\t\t\t\t\t\t value: that.scaleMax ,\n\t\t\t\t\t\t\t slide: that.processSlider\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\tthat.updateSettingsFromUI();\n\t\t\t\t\t\tthat.redraw();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar buttonDiv=table.append(\"tr\").append(\"td\");\n\t\t\tbuttonDiv.append(\"input\").attr(\"type\",\"button\").attr(\"value\",\"Remove Track\").style(\"float\",\"left\").style(\"margin-left\",\"5px\").on(\"click\",function(){\n\t\t\t\t$('#trackSettingDialog').fadeOut(\"fast\");\n\t\t\t\tthat.gsvg.setCurrentViewModified();\n\t\t\t\tthat.gsvg.removeTrack(that.trackClass);\n\t\t\t\tvar viewID=svgList[that.gsvg.levelNumber].currentView.ViewID;\n\t\t\t\tvar track=viewMenu[that.gsvg.levelNumber].findTrackByClass(that.trackClass,viewID);\n\t\t\t\tvar indx=viewMenu[that.gsvg.levelNumber].findTrackIndexWithViewID(track.TrackID,viewID);\n\t\t\t\tviewMenu[that.gsvg.levelNumber].removeTrackWithIDIdx(indx,viewID);\n\t\t\t});\n\t\t\tbuttonDiv.append(\"input\").attr(\"type\",\"button\").attr(\"value\",\"Apply\").style(\"float\",\"right\").style(\"margin-left\",\"5px\").on(\"click\",function(){\n\t\t\t\t$('#trackSettingDialog').fadeOut(\"fast\");\n\t\t\t\tif(that.density!=that.prevSetting.density || that.scaleMin!=that.prevSetting.scaleMin || that.scaleMax!= that.prevSetting.scaleMax){\n\t\t\t\t\tthat.gsvg.setCurrentViewModified();\n\t\t\t\t}\n\t\t\t});\n\t\t\tbuttonDiv.append(\"input\").attr(\"type\",\"button\").attr(\"value\",\"Cancel\").style(\"float\",\"right\").style(\"margin-left\",\"5px\").on(\"click\",function(){\n\t\t\t\tthat.revertPrevious();\n\t\t\t\tthat.updateCountScale(that.scaleMin,that.scaleMax);\n\t\t\t\tthat.draw(that.data);\n\t\t\t\t$('#trackSettingDialog').fadeOut(\"fast\");\n\t\t\t});\n\t\t}else{\n\t\t\tvar table=d3.select(topLevelSelector).select(\"table\").select(\"tbody\");\n\t\t\ttable.append(\"tr\").append(\"td\").style(\"font-weight\",\"bold\").html(\"Track Settings: \"+d.Name);\n\t\t\ttable.append(\"tr\").append(\"td\").html(\"Sorry no settings for this track.\");\n\t\t\tvar buttonDiv=table.append(\"tr\").append(\"td\");\n\t\t\tbuttonDiv.append(\"input\").attr(\"type\",\"button\").attr(\"value\",\"Remove Track\").style(\"float\",\"left\").style(\"margin-left\",\"5px\").on(\"click\",function(){\n\t\t\t\tthat.gsvg.setCurrentViewModified();\n\t\t\t\t$('#trackSettingDialog').fadeOut(\"fast\");\n\t\t\t});\n\t\t\tbuttonDiv.append(\"input\").attr(\"type\",\"button\").attr(\"value\",\"Cancel\").style(\"float\",\"right\").style(\"margin-left\",\"5px\").on(\"click\",function(){\n\t\t\t\t$('#trackSettingDialog').fadeOut(\"fast\");\n\t\t\t});\n\t\t}\n\t};\n\n\tthat.processSlider=function(event,ui){\n\t\tvar min=$( \"#min-rangeslider\" ).slider( \"value\");\n\t\tvar max=$( \"#max-rangeslider\" ).slider( \"value\");\n\t\t$( \"#amount\" ).val( min+ \" - \" + max );\n\t\tthat.updateCountScale(min,max);\n\t};\n\n\tthat.yScale = d3.scaleLinear()\n\t\t\t\t.range([140, 20])\n\t\t\t\t.domain([0, d3.max(data, function(d) { return d.getAttribute(\"count\"); })]);\n\n that.area = d3.area()\n \t\t\t\t.x(function(d) { return that.xScale(d.getAttribute(\"start\")); })\n\t\t\t\t .y0(140)\n\t\t\t\t .y1(function(d) { return d.getAttribute(\"count\"); });\n\n that.yAxis = d3.axisLeft(that.yScale)\n \t\t\t\t.ticks(5);\n\n \tthat.redrawLegend();\n that.draw(data);\n\n\treturn that;\n}",
"createGameObjectFreqArray() {\n\t\tthis.objectFreqArray = [];\n\t\tfor (let key in this.objectFreq) {\n\t\t\tif (this.objectFreq.hasOwnProperty(key)) {\n\t\t\t\tlet count = this.objectFreq[key][0];\n\t\t\t\tfor (let n = 0; n < count; n++) {\n\t\t\t\t\tthis.objectFreqArray.push(this.objectFreq[key][1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"function getCount() {\n return count;\n}",
"function connCount() {\n var connCount = []\n for (var pixelid = 0; pixelid < 50; pixelid++) {\n connCount.push(null)\n var room = mobilesock.adapter.rooms[pixelid]\n if (room) {\n phones = pixelid\n connCount[pixelid] = room.length\n } else {\n connCount[pixelid] = 0\n }\n }\n panelsock.emit('connCount', connCount)\n\n}",
"function reformatHashtagData(jsonData){\n var temp= jsonData.Count;\n console.log(\"temp: \" + JSON.stringify(temp));\n var result = [];\n var i;\n var row;\n for (i=0; i < temp.length; ++i){\n row= temp[i]\n dataElement = [];\n dataElement.push(row.hashtag);\n dataElement.push(row.count);\n result.push(dataElement);\n }\n console.log(\"Data: \" + JSON.stringify(result));\n return result;\n}"
]
| [
"0.6124445",
"0.5977314",
"0.5788596",
"0.5679312",
"0.5676466",
"0.55802757",
"0.5572946",
"0.5571088",
"0.5505164",
"0.5503802",
"0.5494125",
"0.5488272",
"0.5486973",
"0.5483269",
"0.54712486",
"0.5431309",
"0.54191947",
"0.5418644",
"0.5418281",
"0.5403805",
"0.53901243",
"0.53901196",
"0.53748715",
"0.5346096",
"0.534196",
"0.5341436",
"0.5312315",
"0.5303541",
"0.5300582",
"0.5287889"
]
| 0.863871 | 0 |
Renders the 'Translations' tab. | function renderTranslationsTab() {
log('Updating translations:', config.translations);
updateTranslationsTab();
const $tbody = $('div.translator-em tbody.translations-body');
// Remove all rows
$tbody.children().remove();
const langs = Object.keys(config.translations).sort();
if (langs.length) {
// Create rows
for (const key of langs) {
/** @type TranslationData */
const language = config.translations[key];
const $row = getTemplate('translations-row');
$row.attr('data-name', language.name);
$row.find('[data-key]').each(function() {
const $this = $(this);
const name = $this.attr('data-key') ?? '';
if (['name','localized-name','iso','coverage','updated'].includes(name)) {
$this.text(language[name]);
}
});
$row.find('[data-action]').attr('data-name', language.name);
$tbody.append($row)
}
}
else {
$tbody.append(getTemplate('translations-empty'));
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"onTranslation() {\n }",
"function renderTranslation(jsonLanguage) {\n let index = 0;\n $.each(jsonLanguage, function(key, value) {\n $(elementsToTranslate[index]).text(value);\n index++;\n });\n }",
"function getTranslations() {\r\n return translations;\r\n }",
"function setup() {\n document.getElementById(\"translated\").style.color = \"black\";\n\n // Get Current translator, and change first letter to Capital for the title, and update title\n var lttr = select.split(\"\");\n var charlttr = lttr[0].toUpperCase(lttr[0]);\n lttr[0] = \"\";\n lttr = charlttr + lttr.toString();\n\n for (var i = 0; i < lttr.length; i++) {\n lttr = lttr.replace(\",\", \"\");\n } // for\n\n document.getElementById(\"lang\").innerHTML = lttr;\n BASE_URL2 =\n \"https://api.funtranslations.com/translate/\" + select + \".json?text=\";\n} // setup",
"function gunGan() {\n <div class=\"ftembed\">\n <script src = \"http://funtranslations.com/extensions/embed/v1/funtranslations.embed.js\" >< /script>\n <script>FunTranslations.Embed.render({translator: 'gungan'});</script>\n </div>\n}",
"function translatePage() {\n\t\tif (translationData != undefined) {\n\t\t\tvar root = translationData.getElementsByTagName(settings.language).item(settings.language);\n\t\t\tif (root != null) {\n\t\t\t\t// Translate HTML attributes\n\t\t\t\ttranslateEntries(root, $(\"p, span, th, td, strong, dt, button, li.dropdown-header\"), \"textContent\");\n\t\t\t\ttranslateEntries(root, $(\"h1, h4, label, a, #main_content ol > li:first-child, ol.breadcrumb-directory > li:last-child\"), \"textContent\");\n\t\t\t\ttranslateEntries(root, $(\"input[type='text']\"), \"placeholder\");\n\t\t\t\ttranslateEntries(root, $(\"a, abbr, button, label, li, #chart_temp, input, td\"), \"title\");\n\t\t\t\ttranslateEntries(root, $(\"img\"), \"alt\");\n\n\t\t\t\t// This doesn't work with data attributes though\n\t\t\t\t$(\"button[data-content]\").each(function() {\n\t\t\t\t\t$(this).attr(\"data-content\", T($(this).attr(\"data-content\")));\n\t\t\t\t});\n\n\t\t\t\t// Update SD Card button caption\n\t\t\t\t$(\"#btn_volume > span.content\").text(T(\"SD Card {0}\", currentGCodeVolume));\n\n\t\t\t\t// Set new language on Settings page\n\t\t\t\t$(\"#btn_language\").data(\"language\", settings.language).children(\"span:first-child\").text(root.attributes[\"name\"].value);\n\t\t\t\t$(\"html\").attr(\"lang\", settings.language);\n\t\t\t}\n\t\t}\n\t}",
"function translate(text, tab) {\n\tchrome.storage.sync.get({\n \ttargetLanguage: 'en'\n \t}, function(items) {\n \tconst url = `http://translate.google.com/#auto/${items.targetLanguage}/${encodeURIComponent(text)}`;\n \t\tchrome.tabs.create({url: url, index: tab.index + 1});\n \t});\n}",
"function translatePageToFrench() {\n $(\"#title\").html(\"Les petits motifs d'inspiration\");\n $(\"#subtitle\").html(\"Remplis-toi avec l'inspiration du jour avec ce petit projet pour pratiquer les langues.\")\n $(\"#get-quote\").html(\"Dis-moi un autre\");\n $(\"#translate-english\").show();\n $(\"#translate-spanish\").show();\n $(\"#translate-french\").hide();\n quoteArray = quoteArrayFr;\n twitterHashtags = twitterHashtagsFr;\n displayRandomQuote();\n}",
"function LexiconEntryTranslations() {\n _classCallCheck(this, LexiconEntryTranslations);\n\n LexiconEntryTranslations.initialize(this);\n }",
"function TI18n() { }",
"function TI18n() { }",
"viewTranslation() {\n switch(this.state.CurrentViewIndex) {\n case 0 :\n return \"By Student\";\n case 1 :\n return \"By Poem\";\n default:\n return \"\";\n }\n }",
"constructor(translations) {\n this.translations = translations;\n }",
"function TI18n(){}",
"function setupTranslations(applang = \"en\") {\n logger.debug(\"setupTranslations (about)\");\n logger.info(\"Loading translations into UI (about)\");\n // Set window texts here\n $(\"#about-version\").text(i18n.__('about-window-version') + \": \" +remote.app.getVersion());\n $(\"#titlebar-appname\").text(i18n.__('about-window-title'));\n $(\"#app-name-1\").text(i18n.__('app-name-1'));\n $(\"#app-name-2\").text(i18n.__('app-name-2'));\n $(\"#wiki-button\").text(i18n.__('about-window-wiki-btn'));\n $(\"#logs-button\").text(i18n.__('about-window-collect-logs-btn'));\n}",
"function TI18n() {}",
"function TI18n() {}",
"function TI18n() {}",
"_setTranslation () {\n\n\t\t// Find the parts of the translation\n\t\tconst atoms = this.value.split(/:(.*)/);\n\t\tconst key = atoms.length > 0 ? atoms[0] : null;\n\t\tconst obj = atoms.length > 1 ? JSON.parse(atoms[1]) : null;\n\n\t\tconst translation = this.translate.get(key, obj);\n\t\tthis.ownerElement.innerHTML = translation || `${this.value}`;\n\n\t\t// Keep a reference to the old value for optimizations\n\t\tthis.oldValue = this.value;\n\t}",
"function initTranslations() {\n\ti18n.init( {\n\t\tresGetPath: '/TrixLoc/resources/locales/__lng__/__ns__.json',\n\t\tresPostPath: '/TrixLoc/resources/locales/add/__lng__/__ns__'\n\t}, function(t) {\n\t\t_t = t;\n\t\ttranslateAll(t);\n\t});\n}",
"function ajaxTranslateCallback(response) {\t\n\tif (response.length > 0) {\t\t\t\n\t\ttraduccionSugerida = response;\n\t\t//navigator.notification.confirm(\"La traduccion se ha recibido con exito: \"+traduccionSugerida);\n\t\t$('#lblTraduccionObtenida').html(response.toString());\n\t\t$('#pnlResultadoTraduccion').addClass(\"in\").css('zIndex', 300);\n\t\t$('.tooltip-inner').textfill({maxFontPixels: 200, minFontPixels:4}); \n\t\tif (liteVersion){\n\t\t\tnumTraducciones++;\n\t\t} \n\t}\t\n}",
"function translateView() {\n \"use strict\";\n $(\".totranslate\").each(function () {\n var key = $(this).attr(\"data-totranslate\");\n\n $(this).text(translate(key));\n });\n}",
"function translateAllButtonClicked() {\n var translateAllId = ((currentPage - 1) * elementsPerPage) + 1;\n var languages = document.getElementById(\"LanguageSelection\");\n var languageCode = languages.options[languages.selectedIndex].value;\n translateAPI = new TextTranslator(token_config['Yandex']);\n if (languageCode === \"\") {\n window.alert(\"First select language to translate.\");\n\n } else {\n for (translateAllId; translateAllId < rowCounter + 1; translateAllId++) {\n var description = document.getElementById(translateAllId).getElementsByTagName(\"td\")[2].innerHTML;\n if (description == null) {\n description = \"-\";\n }\n translateAPI.translateText(description, languageCode, translateAllId, translatedText);\n\n }\n }\n}",
"function translations() {\n $(\".countryLbl\").html(country),\n $(\".cityLbl\").html(city),\n $(\".locationLbl\").html(loc),\n $(\".pickUpTitle\").html(pickup),\n $(\".pickDateLbl\").html(pickupDate),\n $(\".pickTimLbl\").html(pickUpTime),\n $(\".dropDateLbl\").html(dropoffDate),\n $(\".droptimeLbl\").html(dropOffTime),\n $(\".driversAge\").html(driverAge),\n $(\".searchBtn\").text(search),\n $(\"#locationSpan\").html(loc);\n}",
"async function getTranslations () {\n\treturn {\n\t\t'en-US': {\n\t\t\t'HOME.HELLO': 'Welcome home!',\n\t\t\t'PAGE1.HELLO': 'Hello from Page1',\n\t\t\t'PAGE2.HELLO': 'Hello from Page2',\n\t\t\t'NOT-FOUND': 'couldnt find it!',\n\t\t\t'BANNER': 'Hello world',\n\t\t\t'LINK.HOME': 'Home',\n\t\t\t'LINK.PAGE-1': 'Page 1',\n\t\t\t'LINK.PAGE-2': 'Page 2'\n\t\t}\n\t}\n}",
"function requestTranslation() {\n var messageTexts = document.getElementsByClassName(\"message-text\");\n var messageContainers = document.getElementsByClassName(\"message-translated\");\n const languageCode = document.getElementById('language').value;\n if(languageCode == \"orig\"){\n for (var i = 0; i < messageTexts.length; i++) {\n messageTexts[i].classList.remove('hidden');\n messageContainers[i].classList.add('hidden');\n }\n } else {\n for (var i = 0; i < messageTexts.length; i++) {\n translateElement(messageTexts[i], messageContainers[i], languageCode);\n }\n }\n }",
"function ScreenTranslate(lang) {\r\n\t\r\n var file_path = language_path.replace (\"$\", lang);\r\n\r\n \r\n $.ajax({\r\n type : \"GET\",\r\n url: file_path,\r\n dataType: \"xml\",\t \r\n success: function(xml) {\r\n \t \r\n \t \r\n\t $(xml).find(\"FormMain\").each(function(){\r\n\t\t $(\"#TabNotificationDetail\").text($(xml).find(\"TabNotificationDetail\").text());\r\n\t\t $(\"#TabTimelime\").text($(xml).find(\"TabTimelime\").text());\r\n\t\t $(\"#TabDamageCause\").text($(xml).find(\"TabDamageCause\").text());\r\n\t\t $(\"#TabParts\").text($(xml).find(\"TabParts\").text());\r\n\t\t $(\"#TabChecklist\").text($(xml).find(\"TabChecklist\").text());\r\n\t\t $(\"#TabQuotation\").text($(xml).find(\"TabQuotation\").text());\r\n\t\t $(\"#TabSummary\").text($(xml).find(\"TabSummary\").text());\r\n\t\t $(\"#TabFinal\").text($(xml).find(\"TabFinal\").text());\r\n\t\t $(\"#TabSignOff\").text($(xml).find(\"TabSignOff\").text());\r\n\t\t \r\n\t\t $(\"#Tab_Detail_Tab_Detail_AccountType_Label\").text($(xml).find(\"ActType\").text());\r\n\t\t $(\"#Tab_Detail_SoldTo_Label\").text($(xml).find(\"SoldTo\").text());\r\n\t\t $(\"#Tab_Detail_ServiceOrder_Label\").text($(xml).find(\"ServiceOrder\").text());\r\n\t\t $(\"#Tab_Detail_Priority_Label\").text($(xml).find(\"Priority\").text());\r\n\t\t $(\"#Tab_Detail_Equipment_Label\").text($(xml).find(\"Equipment\").text());\r\n\t\t $(\"#Tab_Detail_EquipmentLocation_Label\").text($(xml).find(\"EquipmentLocation\").text());\r\n\t\t $(\"#Tab_Detail_EquipmentSNR_Label\").text($(xml).find(\"EquipmentSnr\").text());\r\n\t\t $(\"#Tab_Detail_Label_RelatedNotification\").text($(xml).find(\"RelatedNotification\").text());\r\n\t\t $(\"#Tab_Detail_Table_Column_NotificationID\").text($(xml).find(\"NotificationID\").text());\r\n\t\t $(\"#Tab_Detail_Table_Column_Subject\").text($(xml).find(\"SubjectColumnOnDatagrid\").text());\r\n\t\t \r\n\t\t $(\"#Tab_Timeline_Title_Label\").text($(xml).find(\"TabTimelime\").text());\r\n\t\t $(\"#Tab_Timeline_Hitory_Title_Label\").text($(xml).find(\"TimelineHistory\").text());\r\n\t\t $(\"#Tab_Timeline_Hitory_Table_Column_Date\").text($(xml).find(\"DateOnDataGrid\").text());\r\n\t\t $(\"#Tab_Timeline_Hitory_Table_Column_Description\").text($(xml).find(\"DescriptOnDataGrid\").text());\r\n\r\n\t\t \r\n\t\t \r\n\t });\r\n\t \r\n\t \r\n\t $(xml).find(\"FormAddEditDamage\").each(function(){\r\n\t\t \r\n\t\t $(\"#AddDamage\").text($(this).find(\"AddDamage\").text());\r\n\t\t $(\"#DamageGroup\").text($(this).find(\"Group\").text());\r\n\t\t $(\"#DamageCode\").text($(this).find(\"Code\").text());\r\n\t\t $(\"#DamageDescription\").text($(this).find('Description').text());\r\n\t\t \r\n\t });\r\n\r\n\t $(xml).find(\"FormAddEditCause\").each(function(){\r\n\t\t \r\n\t\t $(\"#AddCause\").text($(this).find(\"AddCause\").text());\r\n\t\t $(\"#CauseGroup\").text($(this).find(\"Group\").text());\r\n\t\t $(\"#CauseCode\").text($(this).find(\"Code\").text());\r\n\t\t $(\"#DamageDescription\").text($(this).find('Description').text());\r\n\t\t \r\n\t });\r\n\t \r\n\t \r\n }\r\n });\r\n \r\n \r\n \r\n}",
"recompileTranslations() {\n // Remove installed translations\n let cmd = `cinnamon-xlet-makepot -r ${this.metadata.path}`;\n let resp = QUtils.spawn_command_line_sync_string_response(cmd);\n let success = true;\n if (resp.success && resp.stdout) {\n if (resp.stdout.match(/polib/)) {\n success = false;\n QUtils.show_error_notification(resp.stdout);\n }\n }\n \n if (success) {\n // Reinistall translations\n cmd = `cinnamon-xlet-makepot -i ${this.metadata.path}`;\n resp = QUtils.spawn_command_line_sync_string_response(cmd);\n if (resp.success && resp.stdout) {\n QUtils.show_info_notification(resp.stdout);\n }\n }\n }",
"function translationLabels(){\n /** This help array shows the hints for this experiment */\n\t\t\t\thelpArray=[_(\"help1\"),_(\"help2\"),_(\"help3\"),_(\"help4\"),_(\"help5\"),_(\"help6\"),_(\"help7\"),_(\"Next\"),_(\"Close\"),_(\"help8\"),_(\"help9\")];\n scope.heading=_(\"Emission spectra\");\n\t\t\t\tscope.variables=_(\"Variables\"); \n\t\t\t\tscope.result=_(\"Result\"); \n\t\t\t\tscope.copyright=_(\"copyright\"); \n\t\t\t\tscope.calibrate_txt = _(\"Reset\");\n scope.calibrate_slider_txt = _(\"Calibrate Telescope :\");\n scope.select_lamp_txt = _(\"Select Lamp :\");\n light_on_txt = _(\"Switch On Light\");\n light_off_txt = _(\"Switch Off Light\");\n place_grating_txt = _(\"Place grating\");\n remove_grating_txt = _(\"Remove grating\");\n scope.telescope_angle_txt = _(\"Angle of Telescope :\");\n scope.vernier_table_angle_txt = _(\"Angle of Vernier Table :\");\n scope.fine_angle_txt = _(\"Fine Angle of Telescope :\");\n scope.start_txt = _(\"Start\");\n\t\t\t\tscope.reset_txt = _(\"Reset\");\n scope.lamp_array = [{\n lamp:_(\"Mercury\"),\n index:0\n },{\n lamp:_(\"Hydrogen\"),\n index:1\n },{\n lamp:_(\"Neon\"),\n index:2\n }];\n scope.$apply();\t\t\t\t\n\t\t\t}",
"function translatePageToEnglish() {\n $(\"#title\").html(\"Bite-Size Inspiration\");\n $(\"#subtitle\").html(\"Fill up on your daily inspiration with this mini-project for practicing languages.\")\n $(\"#get-quote\").html(\"Tell me another\");\n $(\"#translate-english\").hide();\n $(\"#translate-spanish\").show();\n $(\"#translate-french\").show();\n quoteArray = quoteArrayEn;\n twitterHashtags = twitterHashtagsEn;\n displayRandomQuote();\n}"
]
| [
"0.59520274",
"0.5877778",
"0.57859194",
"0.57017756",
"0.561128",
"0.548846",
"0.5477214",
"0.54496366",
"0.5421672",
"0.53985286",
"0.53985286",
"0.5394087",
"0.5393753",
"0.53291297",
"0.53180015",
"0.53131676",
"0.53131676",
"0.53131676",
"0.5262238",
"0.52555954",
"0.51742256",
"0.5165991",
"0.51411915",
"0.5139975",
"0.51302356",
"0.5111406",
"0.50898266",
"0.5074715",
"0.5073475",
"0.5063263"
]
| 0.75680906 | 0 |
endregion region Packages Renders the table on the 'Packages' tab. | function renderPackagesTab() {
log('Updating packages:', config.packages);
const $tbody = $('div.translator-em tbody.packages-body');
// Remove all rows
$tbody.children().remove();
const keys = sortByVersion(config.packages);
if (keys.length) {
// Create rows
for (const key of keys) {
/** @type PackageData */
const package = config.packages[key];
const $row = getTemplate('packages-row');
$row.attr('data-version', package.version);
$row.find('[data-key]').each(function() {
const $this = $(this);
const name = $this.attr('data-key');
if (name == undefined) return;
if (name == 'version') {
$this.text(package.version);
}
else if (name == 'type') {
$this.text(package.upgrade ? 'Upgrade' : 'Full Install');
}
else if (name == 'size') {
$this.html((package.size / 1024 / 1024).toFixed(1) + 'M');
}
});
$row.find('[data-action]').attr('data-version', package.version);
$tbody.append($row)
}
}
else {
$tbody.append(getTemplate('packages-empty'));
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Packages()\n {\n\tRenderHeader(\"Packages\");\n \tRenderPresentPackageBox();\n \tRenderUpgradeOptionsBox();\n \tRenderSeeDowngradeOptionsBox();\n \treturn;\t\t\t\n }",
"function getPackages() {\n\tvar lImage;\n\tinitializeDB();\n\t\n\tdb.transaction( function( tx ) {\n\t\ttx.executeSql( \"SELECT * FROM \" + tablePackages, [], function( tx, result ) {\n\t\t\tvar htmlContent = '';\n\t\t\tvar len = result.rows.length;\n\t\t\t$(\"#packages\").html( \"\" );\n\t\t\t\n\t\t\tfor( var i = 0; i < len; i++ ) {\n\t\t\t\tfor( var j = 0; j < imagesPack.length; j++ ) {\n\t\t\t\t\tif( imagesPack[j][0] == result.rows.item(i).id )\n\t\t\t\t\t\tlImage = imagesPack[j][1]; \n\t\t\t\t}\n\t\t\t\t//--console.log( \"title: \" + result.rows.item(i).title );\n\t\t\t\t//--htmlContent += '<li><a href=\"#\" onclick=\"getModules( \\'' + result.rows.item(i).fixed_modules + '\\', \\'' + result.rows.item(i).modules + '\\', \\'' + result.rows.item(i).optional_modules + '\\' )\">' + result.rows.item(i).title + '</a></li>';\n\t\t\t\thtmlContent += '<li>';\n\t\t\t\thtmlContent += '<a href=\"#\" onclick=\"';\n\t\t\t\thtmlContent += 'setLocalValue( \\'modules\\' , \\'' + result.rows.item(i).id_mod + '\\');';\n\t\t\t\thtmlContent += 'setLocalValue( \\'name\\' , \\'' + result.rows.item(i).name + '\\' );';\n\t\t\t\thtmlContent += 'setLocalValue( \\'title\\' , \\'' + result.rows.item(i).name + '\\' );';\n\t\t\t\thtmlContent += 'setLocalValue( \\'description\\', \\'' + result.rows.item(i).description + '\\' )';\n\t\t\t\thtmlContent += '\">';\n\t\t\t\thtmlContent += '<img src=\"images/' + result.rows.item(i).image + '\" width=\"80\" />';\n\t\t\t\thtmlContent += '<h2>' + result.rows.item(i).name + '</h2>';\n\t\t\t\thtmlContent += '<p>' + result.rows.item(i).description + '</p><br />';\n\t\t\t\thtmlContent += '</a>';\n\t\t\t\thtmlContent += '</li>';\n\t\t\t}\n\t\t\t\n\t\t\t$(\"#packages\").html( $(\"#packages\").html() + htmlContent );\n\t\t\t$(\"#packages\").listview(\"refresh\");\n\t\t\t\n\t\t}, errorCB );\n\t}, errorCB, successCB );\n}",
"function tableLibraryItems()\n\t\t{\n\t\t\tvar table = new Table(dom.library.items);\n\t\t\ttrace(table.render());\n\t\t}",
"function showPackages(request, url, packages, options, div, cb) {\n // Create a result set\n var res2 = generateView(url, packages, options);\n // Insert into container on page\n div.html(res2 ? res2 : options.noresult);\n // Continue with callback\n cb(null, {client: CKANclient, request: request, packages: packages});\n}",
"function package_view(dir) {\n\n $('#loadingview').show();\n $('#installed-packages').empty();\n $('#to-install').empty();\n\n api.get_info(dir, function (info) {\n var data = info.packages;\n\n var output = views.installed(data);\n $('#installed-packages').append(output);\n\n output = views.to_install(data);\n $('#to-install').append(output);\n if ($(output).children().length === 0) {\n $('#to-install-main').css(\"display\", \"none\");\n }\n\n var selectedPackages = [];\n views.select_installed(selectedPackages);\n\n var toInstall = [];\n views.select_to_install(toInstall);\n\n $('#packageview').show();\n $('#loadingview').hide();\n }, function () {\n common.display_msg(\"Server Error\", \"The project configuration could not be retrived. Please try again.\");\n $('#loadingtext').text(\"Server Error\");\n });\n}",
"async function tab0_browser_setup() {\n const pkgBrowserElement = document.getElementById('tab0-package-browser')\n pkgBrowserElement.innerHTML = ''\n await loadPackageList()\n for (let pkgRAW in packages) {\n let pkg = (packages[pkgRAW])\n pkgBrowserElement.innerHTML += `<li data-pkgid=\"${pkg.id}\" onclick=\"tab0_set_active_package(this)\">${pkg.title}<span class=\"tab0-filename\">${pkg.filename}</span></li>`\n }\n}",
"function initPackageGroupPartialView() {\n InitDateRange();\n\n //Get list of factory\n GetFactories(\"drpFactory\", null);\n\n //Get list of Buyer\n GetMasterCodes(\"drpBuyer\", BuyerMasterCode, StatusOkMasterCode);\n\n //Init grid execution package\n //bindDataToJqGridGroupPackage(\"P2A1\", \"20181120\", \"20181126\", null, null);\n bindDataToJqGridGroupPackage(null, null, null, null, null, null);\n\n //Event click button search package group\n eventClickBtnSearchPkgGroup();\n}",
"function generatePackageLine(pkg) {\n var percent = ((package_covered_[pkg] * 100) / package_lines_[pkg]).\n toFixed(1);\n return \"<tr class='package'><td colspan='2' class='package'>\" +\n pkg +\n \"<td class='file-percent'>\" + percent + \"%</td>\" +\n \"<td class='file-percent'>\" + generatePercentBar(percent) +\n \"</td> </tr>\";\n}",
"function loadPackages() {\n document.getElementById(\"package1\").innerHTML = 'Cost: ' + packages[0];\n document.getElementById(\"package2\").innerHTML = 'Cost: ' + packages[1];\n document.getElementById(\"package3\").innerHTML = 'Cost: ' + packages[2];\n document.getElementById(\"package4\").innerHTML = 'Cost: ' + packages[3];\n}",
"function packageDisplay(packages) {\n \n \n /* FETCH JSON */\n var allPackages = JSON.parse(packages);\n var i; var packageItems = \"\";\n for (i = 0; i < allPackages.length; i++) {\n \n \n /* FECTH DATA FOR NESTED ARRAYS */\n var venueRef = allPackages[i][\"venue_ref\"];\n var venueName = allPackages[i][\"venue_name\"];\n var venuePackage = allPackages[i][\"venue_package\"];\n var venuePackageSubtitleLine1 = allPackages[i][\"venue_package_subtitle_line_1\"];\n var venuePackageSubtitleLine2 = allPackages[i][\"venue_package_subtitle_line_2\"];\n var venuePackagePrice = allPackages[i][\"venue_package_price\"];\n var availableFrom = allPackages[i][\"available_from\"];\n var availableTo = allPackages[i][\"available_to\"];\n var packageId = allPackages[i][\"package_id\"];\n var imagePath = allPackages[i][\"image_path\"];\n \n \n /* CONSTRUCT IMAGE PATH URL */\n if (imagePath !== \"\") {var imagePathUrl = '/images/venues/small/' + imagePath;} else {var imagePathUrl = '/images/venues/small/placeholder.jpg';}\n \n \n /* CONSTRUCT VENUE DISPLAY */\n packageItems += '<div class=\"row\"><div class=\"col\"><div class=\"row bck-white rounded p-3 mb-4 shadow-sm\"><div class=\"col-md-3 px-0\"><img src=\"' + imagePathUrl + '\" width=\"100%\" height=\"100%\" class=\"d-block\" alt=\"' + venueName + '\"></div><div class=\"col-md-6 py-3 px-0 py-md-0 px-md-3\"><div class=\"row\"><div class=\"col\"><p class=\"font-30 mb-2\">' + venueName + '</p><p class=\"font-20 txt-purple mb-2\"><b>' + venuePackage + '</b></p><p class=\"font-18 txt-purple mb-2\"><b>From:</b> ' + formatDate(availableFrom) + ' <b>To:</b> ' + formatDate(availableTo) + '</p><p class=\"font-18 txt-purple mb-2\">' + venuePackageSubtitleLine1 + '</p><p class=\"font-18 txt-purple mb-2\">' + venuePackageSubtitleLine2 + '</p></div></div></div><div class=\"col-md-3 py-3 bck-purple text-center\"><div class=\"row\"><div class=\"col txt-white\"><p class=\"font-30\"><b>Prices From £' + formatNumber(venuePackagePrice) + '</b></p></div></div><div class=\"row\"><div class=\"col\"><a href=\"https://www.simplywed.co.uk/wedding-venues/view-package.php?v=' + venueRef + '&p=' + packageId + '\" style=\"text-decoration:none;\"><div class=\"button btn-orange\">Get Your Price <i class=\"fas fa-angle-right\" style=\"float:right;\"></i></div></a></div></div></div></div></div></div>';\n \n \n /* DISPLAY VENUES */\n document.getElementById('packages').innerHTML = packageItems;\n \n \n }\n \n \n}",
"function RenderHeaderPresentPackageScreen()\n{\n\tvar fUnitX\t:\tfloat\t=\tScreen.width/24.4;\n \tvar fUnitY\t:\tfloat \t=\tScreen.height/12.8;\n\tm_fHeightHeader\t\t \t=\t1.3*fUnitY;\n\tGUI.skin\t=\tm_skinPackagesScreen;\n\t//*************************\tHeader\t***********************//\n\tGUI.BeginGroup(Rect(0,0,Screen.width,m_fHeightHeader));\n\t\t\n\t\tm_skinPackagesScreen.box.alignment\t\t\t=\tTextAnchor.MiddleCenter;\n\t\tm_skinPackagesScreen.box.normal.background\t=\tm_tex2DPurple;\n\t\tm_skinPackagesScreen.box.normal.textColor \t=\tColor(255/255.0F,255/255.0F,255/255.0F,255/255.0F);\n\t\tm_skinPackagesScreen.box.fontSize \t\t\t=\tMathf.Min(Screen.width,m_fHeightHeader)/1.5;\n\t\tm_skinPackagesScreen.box.font\t\t\t\t=\tm_fontRegular;\n\t\tm_skinPackagesScreen.box.contentOffset.x\t=\t0;\n\t\tGUI.Box(Rect(0,0,Screen.width,m_fHeightHeader),m_strPresentPackName);\n\t\t\n\t\tm_skinPackagesScreen.label.normal.textColor\t=\tColor(255/255.0F,255/255.0F,255/255.0F,255/255.0F);\n\t\tm_skinPackagesScreen.label.fontSize \t\t=\tMathf.Min(Screen.width,m_fHeightHeader)/3.5;\n\t\tGUI.Label(Rect(0.75*Screen.width,0,0.25*Screen.width,m_fHeightHeader),\"INR \" + GetPresentPackagePrice() + \" PM\");\n\tGUI.EndGroup();\n\tGUI.skin\t=\tnull;\n}",
"getLibraryCell(){\n\t\t\treturn <td>{this.getLibrariesInCombinations()['libraries']}</td>;\n\t\t}",
"function showPackage(row, shelf) {\n tableMap = document.getElementById('warehouseTableMap').innerHTML;\n var foundPackage = false;\n\trefWarehouse.orderByChild(\"row\").equalTo(row).on(\"child_added\", function(snapshot) {\n\t\tif (snapshot.val().shelf == shelf) {\n\t\t\tconsole.log(\"Found package\");\n\t\t\tpackageName = snapshot.val().packageName;\n\t\t\tkey = snapshot.key;\n\t\t\tshelfCode = snapshot.val().shelfCode;\n\t\t\ttemperature = snapshot.val().temperature;\n\t\t\tstored = snapshot.val().stored;\n\t\t\trow = snapshot.val().row;\n\t\t\tshelf = snapshot.val().shelf;\n\t\t\tpackage = {\n\t\t packageName: packageName,\n\t\t key: key,\n\t\t shelfCode: shelfCode,\n\t\t temperature: temperature,\n\t\t stored: stored,\n\t\t shelf: shelf,\n\t\t row: row\n\t\t };\n\t\t newTableHeader = tableHeader;\n\t\t newTableHeader += generateTableEntry(package);\n\t\t document.getElementById('warehouseTableMap').innerHTML = newTableHeader;\n\t\t foundPackage = true;\n\t\t}\n\t\t\n });\n\tif (!foundPackage) {\n\t\tconsole.log(\"Did not find package\");\n\t\tnewTableHeader = tableHeader + \n\t\t\"<td>Sorry, no package here.</td><td></td><td></td><td></td><td>\"+row+\"</td><td>\"+shelf+\"</td><td></td>\";\n\t document.getElementById('warehouseTableMap').innerHTML = newTableHeader;\t\n\t}\n}",
"function createPackageTable( tx ) {\n\tvar query = \"CREATE TABLE IF NOT EXISTS \" + tablePackages + \" (\" +\n\t\t\t\"id INTEGER PRIMARY KEY AUTOINCREMENT, \" +\n\t\t\t\"id_mod INT NOT NULL, \" +\n\t\t\t\"name TEXT NOT NULL, \" +\n\t\t\t\"description TEXT NULL, \" +\n\t\t\t\"image TEXT NULL)\";\n\t\n\ttx.executeSql( query, [], function ( tx, result ) {\n\t\tconsole.log( \"Table \" + tablePackages + \" created successfully\" );\n\t}, errorCB );\n\t\n\tquery = \"CREATE INDEX IF NOT EXISTS id_mod ON \" + tablePackages + \" (id_mod)\";\n\t\n\ttx.executeSql( query, [], function ( tx, result ) {\n\t\tconsole.log( \"Index in \" + tablePackages + \" created successfully\" );\n\t}, errorCB );\n}",
"function TcPackage() {\n\tthis.FCount = 0;\n\tthis.debug = false;\n}",
"function tableView() {\n\tconnection.query(\"SELECT item_id, product_name, department_name, price, stock_quantity FROM products\", function(err, results) {\n if (err) throw err;\n\n// table \n\tvar table = new Table({\n \thead: ['ID#', 'Item Name', 'Department', 'Price($)', 'Quantity Available'],\n \t colWidths: [10, 20, 20, 20, 20],\n \t style: {\n\t\t\t head: ['cyan'],\n\t\t\t compact: false,\n\t\t\t colAligns: ['center'],\n\t\t }\n\t});\n//Loop through the data\n\tfor(var i = 0; i < results.length; i++){\n\t\ttable.push(\n\t\t\t[results[i].item_id, results[i].product_name, results[i].department_name, results[i].price, results[i].stock_quantity]\n\t\t);\n\t}\n\tconsole.log(table.toString());\n\n });\n}",
"async getPackages() {\n return [];\n }",
"function render(files, code, summary) {\n files.sort()\n files_ = files;\n code_ = code;\n summary_ = summary;\n var buffer = \"\";\n var last_pkg = null;\n\n // compute percent for files and packages. Tally information per package, by\n // tracking total lines covered on any file in the package\n\n for (var i = 0; i < files.length; i++) {\n var file = files[i];\n var coverage = summary[file];\n var covered = 0;\n var totalcode = 0;\n for (var j = 0; j < coverage.length; j++) {\n if (coverage[j] == 1 || coverage[j] == 0) {\n totalcode += 1;\n }\n if (coverage[j] == 1) {\n covered += 1;\n }\n }\n file_percent_[file] = (covered * 100) / totalcode;\n var pkg = getDirName(file);\n\n // summary for this package alone\n recordPackageLines(pkg, totalcode, covered);\n\n // summary for each package including subpackages\n while (pkg != null) {\n recordPackageLinesRec(pkg, totalcode, covered);\n pkg = getDirName(pkg)\n }\n recordPackageLinesRec(\"** everything **\", totalcode, covered);\n }\n\n // create UI for the results...\n buffer += generatePackageLineRec(\"** everything **\");\n for (var i = 0; i < files.length; i++) {\n var file = files[i];\n\n var pkg = getDirName(file)\n if (pkg != last_pkg) {\n var prefix = getRootDir(last_pkg);\n var rec_summary = \"\";\n if (pkg.indexOf(prefix) != 0) {\n var current = getDirName(pkg);\n while (current != null) {\n rec_summary = EMPTY_ROW + generatePackageLineRec(current) +\n rec_summary;\n current = getDirName(current);\n }\n }\n buffer += rec_summary + EMPTY_ROW + generatePackageLineRec(pkg);\n last_pkg = pkg;\n }\n buffer += generateFileLine(file);\n }\n\n var menu = \"<div class='menu'><table class='menu-table'><tbody>\" +\n buffer + \"</tbody></table></div>\"\n\n // single file details\n var details = \"<div class='details hidden'><div class='close'>X Close</div>\" +\n \"<div id='details-body' class='details-body'></div></div>\";\n\n var div = document.createElement(\"div\");\n div.innerHTML = \"<div class='all'>\" +\n \"<div>Select a file to display its details:</div> \"\n + menu + details + \"</div>\";\n document.body.appendChild(div);\n document.body.addEventListener(\"click\", clickListener, true);\n}",
"function display() {\n // var table = new Table({style:{border:[],header:[]}});\n\n \n var query = \"SELECT item_id 'Item ID', product_name 'Product Name', price 'Price' from products GROUP BY item_id\";\n connection.query(query, function(err, res) {\n console.log(\"\\n\");\n console.table(res);\n });\n}",
"function getTableFromGroup(group) {\n\tvar table = document.createElement(\"table\");\n\ttable.appendChild(document.createElement(\"caption\"));\n\tvar thead = document.createElement(\"thead\");\n\tvar th = document.createElement(\"th\");\n\tthead.appendChild(th);\n\tth = document.createElement(\"th\");\n\tth.innerHTML = \"Name\";\n\tthead.appendChild(th);\n\tth = document.createElement(\"th\");\n\tth.innerHTML = \"Type\";\n\tthead.appendChild(th);\n\tth = document.createElement(\"th\");\n\tth.innerHTML = \"Price\";\n\tthead.appendChild(th);\n\tth = document.createElement(\"th\");\n\tth.innerHTML = \"Turnaround time<br />in days\";\n\tthead.appendChild(th);\n\tth = document.createElement(\"th\");\n\tth.innerHTML = \"Reorder time<br />in days\";\n\tthead.appendChild(th);\n\tth = document.createElement(\"th\");\n\tth.innerHTML = \"Stock\";\n\tthead.appendChild(th);\n\tth = document.createElement(\"th\");\n\tthead.appendChild(th);\n\ttable.appendChild(thead);\n\tvar tbody = document.createElement(\"tbody\");\n\tfor (var i = 0; i < group.count; i++) {\n\t\tvar typeArray = group[group.types[i]];\n\t\tfor (var j = 0; j < typeArray.length; j++) {\n\t\t\tvar row = getRowFromItem(typeArray[j], j);\n\t\t\ttbody.appendChild(row);\n\t\t}\n\t}\n\ttable.appendChild(tbody);\n\treturn table;\n}",
"function generatePackageLineRec(pkg) {\n var percent = ((package_rec_covered_[pkg] * 100) /\n package_rec_lines_[pkg]).toFixed(1);\n return \"<tr class='package'><td colspan='2' class='package'>\" +\n pkg + \" (with subpackages)\" +\n \"<td class='file-percent'>\" + percent + \"%</td>\" +\n \"<td class='file-percent'>\" + generatePercentBar(percent) +\n \"</td> </tr>\";\n}",
"renderFoldersTable() {\n const foldersToDisplay = this.state.folders\n .filter(f => !f.deleted)\n .sort((p1, p2) => p1.name < p2.name ? -1 : 1);\n if (foldersToDisplay.length > 0) {\n const table = foldersToDisplay.map(folder => this.getFolderRow(folder));\n let header = (\n <tr>\n <th>Folder Name</th>\n <th>Owner</th>\n <th>Submission Date</th>\n <th>Content</th>\n </tr>\n );\n return (\n <Table striped hover responsive>\n <thead>{header}</thead>\n <tbody>{table}</tbody>\n </Table>\n );\n } else {\n return <div className='not-found'><h3>There are no deposited folders on this Network</h3></div>\n }\n }",
"function dispAll() {\n\n // create a new formatted cli-table\n var table = new Table({\n head: [\"ID\", \"Name\", \"Department\", \"Price\", \"Qty Available\"],\n colWidths: [8, 40, 22, 12, 12]\n });\n\n // get the data to load the product table, load it and show it\n connection.query(\"SELECT item_id, product_name, department_name, price, stock_quantity FROM products LEFT JOIN departments on products.department_id = departments.department_id ORDER BY department_name, product_name;\", function (err, rows, fields) {\n\n if (err) throw err;\n\n console.log(\"\\n--- Bamazon Product Catalog ---\");\n\n for (var i = 0; i < rows.length; i++) {\n table.push([rows[i].item_id, rows[i].product_name, rows[i].department_name, rows[i].price, rows[i].stock_quantity]);\n }\n\n console.log(table.toString());\n\n // go to the actual purchasing part of the app\n buyProduct();\n\n });\n\n}",
"function getPackages() {\n\n $.ajaxSetup({\n beforeSend: function (xhr, settings) {\n if (!csrfSafeMethod(settings.type) && sameOrigin(settings.url)) {\n // Send the token to same-origin, relative URLs only.\n // Send the token only if the method warrants CSRF protection\n // Using the CSRFToken value acquired earlier\n xhr.setRequestHeader(\"X-CSRFToken\", csrftoken);\n }\n }\n });\n\n $.ajax({\n url: 'getPackages',\n type: 'GET',\n dataType: \"json\",\n success: function (data) {\n $('#dropdownMenuLinkselect').empty(); // empty the div before fetching and adding new data\n\n data.user_packages.forEach((item, index) => {\n $(\"#dropdownMenuLinkselect\").append(\n `\n <a class=\"dropdown-item\" href=\"#\">${item}</a>\n\n `\n );\n }\n\n );\n packageOnClickListener();\n\n }\n\n });\n }",
"function tableDisplay() {\n connection.query(\n \"SELECT * FROM products\", function(err,res) {\n if (err) throw err;\n //Use cli-table\n let table = new Table ({\n //Create Headers\n head: ['ID','PRODUCT','DEPARTMENT','PRICE','STOCK'],\n colWidths: [7, 50, 25, 15, 10]\n });\n for (let i = 0; i < res.length; i++) {\n table.push([res[i].item_id,res[i].product_name,res[i].department_name,\"$ \" + res[i].price,res[i].stock_quantity]);\n }\n console.log(table.toString() + \"\\n\");\n managerChoices();\n }\n )\n}",
"getTables() {\n return this.content.tables;\n }",
"function dispAll() {\n\n // create a new formatted cli-table\n var table = new Table({\n head: [\"ID\", \"Name\", \"Department\", \"Price\", \"Qty Available\"],\n colWidths: [8, 40, 22, 12, 12]\n });\n\n // get the data to load the product table, load it and show it; note that since the database is normalized, we JOIN with the departments table\n // to get the actual department name\n connection.query(\"SELECT item_id, product_name, department_name, price, stock_quantity FROM products LEFT JOIN departments on products.department_id = departments.department_id ORDER BY department_name, product_name;\", function (err, rows, fields) {\n\n if (err) throw err;\n\n console.log(\"\\n--- View All Products for Sale ---\");\n\n for (var i = 0; i < rows.length; i++) {\n table.push([rows[i].item_id, rows[i].product_name, rows[i].department_name, rows[i].price, rows[i].stock_quantity]);\n }\n\n console.log(table.toString());\n\n // ask the user if they want to continue\n doAnother();\n\n });\n\n}",
"function SelectPackage()\n{\n InitializationEnviornment.initiliaze();\n AppLoginLogout.login();\n Listbox.SelectListboxItems(\"Daily Admission\");\n selectQuantity(31);\n selectPackage(\"Open Dated\",\"Under 3\");\n selectPackage(\"Open Dated\",\"Adult\");\n selectPackage(\"Open Dated\",\"Children (Ages 3-12)\");\n AppLoginLogout.logout();\n}",
"function listAll() {\n setPackageList(completeList);\n _setCurPackage(null);\n }",
"function itemTable() { }"
]
| [
"0.7688612",
"0.6095892",
"0.5980909",
"0.58574325",
"0.5855525",
"0.58353907",
"0.57516766",
"0.5669934",
"0.56421596",
"0.5564887",
"0.5543537",
"0.5458237",
"0.54402024",
"0.5410779",
"0.5331439",
"0.53298044",
"0.5315721",
"0.5308434",
"0.53001904",
"0.5283787",
"0.5253895",
"0.52413684",
"0.52386063",
"0.51841694",
"0.51825714",
"0.5142317",
"0.51317275",
"0.5120597",
"0.51204515",
"0.51176244"
]
| 0.7913512 | 0 |
Logger constructor path log directory node nodeId app application name writeInterval flush log to disk interval writeBuffer buffer size 64kb keepDays delete files after N days, 0 to disable toFile write log types to file toStdout write log types to stdout | function Logger(options) {
const { path, node } = options;
const { writeInterval, writeBuffer, keepDays } = options;
const { toFile, toStdout } = options;
this.active = false;
this.path = path;
this.node = node;
this.writeInterval = writeInterval || 3000;
this.writeBuffer = writeBuffer || 64 * 1024;
this.keepDays = keepDays || 0;
this.options = { flags: 'a', highWaterMark: this.writeBuffer };
this.stream = null;
this.reopenTimer = null;
this.flushTimer = null;
this.lock = false;
this.buffer = [];
this.file = '';
this.toFile = logTypes(toFile);
this.toStdout = logTypes(toStdout);
this.open();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function loggerConstructor () { // 'private' properties\n let folderName = 'logs';\n let rootPath = __basedir;\n let maxFileSize = 1 * 1024 * 1024; // 1Mb\n let nFolderPath = path.join(rootPath, folderName);\n let oFolderPath = path.join(nFolderPath, 'past_logs');\n // eslint-disable-next-line no-unused-vars\n let modifiers = [];\n\n let logTypes = {\n debug : chalk.blue,\n log : chalk.green,\n warning : chalk.yellowBright,\n error : chalk.redBright,\n terminal: chalk.magenta\n };\n\n let blueprint = [\n {\n fileName: 'logs.txt',\n logTypes: ['debug', 'log', 'warning', 'error', 'terminal']\n },\n {\n fileName: 'dump.txt',\n logTypes: ['warning', 'error']\n }\n ];\n\n let initFile = function (fileBlueprint) {\n fs.writeFileSync(\n path.join(nFolderPath, fileBlueprint.fileName),\n `[LOG '${fileBlueprint.fileName}' FILE CREATED (${Date.now()})]\\n`\n );\n };\n\n let applyModifiers = function (text) {\n for (let modifier of modifiers) {\n text = chalk[modifier](text);\n }\n\n return text;\n };\n\n let blueprintsFromLogType = function (logType) {\n let blueprints = [];\n\n for (let fileBlueprint of blueprint) {\n if (fileBlueprint.logTypes.includes(logType)) {\n blueprints.push(fileBlueprint);\n }\n }\n\n return blueprints;\n };\n\n let shouldLog = function () {\n return true; // currently not used (but could be in future!)\n };\n\n let store = function (logType, str) {\n if (!logTypes[logType]) {\n throw new Error(`Log type '${logType}' not valid for 'write' function!`);\n }\n\n const blueprints = blueprintsFromLogType(logType);\n\n for (let fileBlueprint of blueprints) {\n let logFilePath = path.join(nFolderPath, fileBlueprint.fileName);\n let stats = fs.statSync(logFilePath);\n\n // File too big! Copy file to old logs and then overwrite it!\n if (stats.size >= maxFileSize) {\n let fstr = (new Date().toJSON().slice(0, 10)) + '_' + fileBlueprint.fileName;\n let numberOfRepeats = 0;\n\n let files = fs.readdirSync(oFolderPath);\n\n for (let file of files) {\n if (file.includes(fstr)) {\n numberOfRepeats++;\n }\n }\n\n // Hack was added here for the old log file name extension - TODO: FIX!\n let oldLogFileName = fstr.substring(0, fstr.length - 4) + (numberOfRepeats + 1) + '.txt';\n let oldLogFilePath = path.join(oFolderPath, oldLogFileName);\n\n fs.copyFileSync(logFilePath, oldLogFilePath);\n initFile(fileBlueprint);\n }\n\n fs.appendFileSync(logFilePath, str + '\\n');\n }\n };\n\n let write = function (logType, ...args) {\n let colorFunc = logTypes[logType];\n\n if (!colorFunc) {\n throw new Error(`Log type '${logType}' not valid for 'write' function!`);\n }\n\n // Convert all arguments to proper strings\n let buffer = [];\n\n for (let arg of args) {\n buffer.push((typeof arg === 'object') ? JSON.stringify(arg) : arg.toString());\n }\n\n let text = applyModifiers(\n colorFunc(\n `(${new Date().toLocaleString()})`\n + `[${logType}] => `\n + buffer.join(' ')\n )\n );\n\n console.log(text);\n store(logType, text);\n };\n\n if (!fs.existsSync(nFolderPath)) {\n fs.mkdirSync(nFolderPath);\n }\n\n if (!fs.existsSync(oFolderPath)) {\n fs.mkdirSync(oFolderPath);\n }\n\n for (let fileBlueprint of blueprint) {\n let filePath = path.join(nFolderPath, fileBlueprint.fileName);\n\n if (!fs.existsSync(filePath)) {\n initFile(fileBlueprint);\n }\n }\n\n return { // 'public' properties\n removeModifier (modID) {\n let index = modifiers.indexOf(modID);\n\n if (index < -1) {\n throw new Error(`Modifier '${modID}' not found in exisiting modifiers!`);\n }\n\n modifiers.splice(index, 1);\n },\n addModifier (modID) {\n modifiers.push(modID);\n this.log(`Modifier added to logger: ${modID}`);\n },\n setModifiers (mods) {\n if (!Array.isArray(mods)) {\n throw new Error('Expected log modifiers in array format!');\n }\n\n modifiers = mods;\n },\n clearModifiers () {\n modifiers = [];\n },\n write: function () { /* eslint-disable-line object-shorthand */ // if not like this it errors because of strict mode??\n if (shouldLog(...arguments)) {\n write(this.write.caller.name, ...arguments);\n }\n },\n plain (text, color = 'white') {\n let colorFunc = chalk[color];\n\n if (!colorFunc) {\n throw new Error(`Invalid color '${color}' for 'logger.plain'!`);\n }\n\n console.log(\n applyModifiers(\n colorFunc(\n text\n )\n )\n );\n },\n // Helper\n debug () { this.write(...arguments); },\n log () { this.write(...arguments); },\n warning () { this.write(...arguments); },\n error () { this.write(...arguments); },\n terminal () { this.write(...arguments); },\n // Alias of helper\n warn () { this.warning(...arguments); },\n err () { this.error(...arguments); }\n };\n }",
"initLogger(name = '') {\n let path = this.logPath;\n name = name.length > 0 ? name : this.logFileName;\n this.logFileName = name;\n\n // Create the directory if not exists.\n if (!fs.existsSync(path)) fs.mkdirSync(path);\n\n // Add the file name to the path.\n path += `/${name}.log`;\n\n // Remove the old log file if exists.\n if (fs.existsSync(path)) fs.unlinkSync(path);\n\n // Open the write stream.\n this.logger = fs.createWriteStream(path, {flags: 'a'});\n this.write(`Started at: ${new Date()}`, true, 'success');\n }",
"constructor(module) {\n\n this.module = module\n\n //create write stream so that we'll be able to write the log messages into the log file \n let logStream = fs.createWriteStream('./logs', { flags: 'a' })\n\n //create function that logs info level messages\n let info = function (msg) {\n //Define the log level\n var level = 'info'.toUpperCase()\n\n //Format the message into the desired format\n let message = `${new Date()} | ${level} | ${module} | ${msg} \\n`\n\n //Write the formated message logged into the log file\n logStream.write(message)\n }\n //initialize the info function.\n this.info = info\n\n //Create a function that logs error level messages\n let error = function (msg) {\n //Define the log level\n var level = 'error'.toUpperCase()\n\n //format the message into the desired format\n let message = `${new Date()} | ${level} | ${module} | ${msg} \\n`\n\n //Write the formated message logged into the log file\n logStream.write(message)\n }\n\n //initialize the error function\n this.error = error\n }",
"function writeLogs() {\n cslogging.loadConfig('./testConfig.json');\n\n // the configFile set the maxSize to be 1K and maxFiles to be 10\n // So we need to write out a bit more then 10*1K of bytes of logs\n var testLogger = cslogging.getLogger('test');\n\n console.log('writing logs!');\n for(var i=0; i < 20; i++) {\n var chr = String.fromCharCode(97 + i);\n var logwriting = createLogWritingFunction(testLogger, chr, 1000);\n\n setTimeout(logwriting, i*100);\n }\n\n}",
"function NodeLogger(){}",
"function Logger() {\n this.buffer = [];\n this.plugins = {};\n\n this.url = _DEFAULTS.url;\n this.flushInterval = _DEFAULTS.flushInterval;\n this.collectMetrics = _DEFAULTS.collectMetrics;\n this.logLevels = _DEFAULTS.logLevels;\n this.maxAttempts = _DEFAULTS.maxAttempts;\n}",
"function Logger(config) {\n if (config == void 0)\n config = {};\n _.defaultsDeep(config, defaultConfig);\n config.isEnabled = config.namespace != void 0 && process.env.DEBUG != \"*\" && (process.env.DEBUG || \"\").match(config.namespace) == void 0 ? false : true;\n config.lastLogged = moment.utc();\n this.config = config;\n this.buffer = [];\n this.bufferMode = false;\n this.children = [];\n this.parent = null;\n}",
"constructor(logfile, logLevel) {\n if (logfile === \"console\") {\n this.logToFile = false\n } else {\n this.logToFile = true\n this.logfile = logfile\n fs.writeFileSync(this.logfile, \"\\n\")\n }\n this.logLevel = logLevel\n }",
"function log(option,user,action,data,to){\n let log ='';\n if(option==1)\n log = user+\"|\"+action+\"|\"+data+\"|\"+to+\"|\"+new Date().toLocaleString()+\"\\n\";\n else{ // user is the string sent \n log = user+\"|\"+Date.now()+\"\\n\";\n }\n fs.appendFile('daily.log',log,function(){\n //do nothing \n });\n}",
"function createLog(){\n var a = \"log_\" + moment().format('YYMMDD-HHmm') + \".txt\";\n logName = a;\n fs.writeFile(a,\"Starting Log:\\n\",(err)=>{\n if(err) throw(err); \n });\n}",
"function NodeLogger() {}",
"function NodeLogger() {}",
"function NodeLogger() {}",
"function NodeLogger() { }",
"function NodeLogger() { }",
"async function initFileLogger(options = {}) {\n const { level, logOutputDir } = options;\n if (!options.disableFileLogs) {\n await makeLogDir(logOutputDir);\n }\n const fileLogger = bunyan.createLogger(options);\n const ringbuffer = new bunyan.RingBuffer({ limit: 10000000 });\n fileLogger.addStream({\n type: \"raw\",\n stream: ringbuffer,\n level: level,\n });\n const returnRingbuffer = (reducerCb) => {\n const rec = ringbuffer.records;\n if (typeof reducerCb === \"function\") {\n return rec.reduce(reducerCb, []);\n } else {\n return rec;\n }\n };\n return {\n _returnLogs: returnRingbuffer,\n //pass reducer function to extract data; if not returns raw data\n it: itFile(fileLogger),\n };\n}",
"function writeLog(mesg, type, success, cardID, cardType, clientID)\n{\n if (!fs.existsSync(__dirname + '/logs'))\n {\n fs.mkdirSync(__dirname + '/logs', 0o744);\n }\n\n var logEntry =\n {\n \"logType\" : type,\n \"cardID\" : cardID,\n \"cardType\" : cardType,\n \"clientID\" : clientID,\n \"description\" : mesg,\n \"success\" : success,\n \"timestamp\" : (new Date()).valueOf()\n };\n\n fs.appendFile('logs/log.txt', JSON.stringify(logEntry) + '\\n', function (err)\n {\n if (err) throw err;\n });\n\n fs.stat('logs/log.txt', function (err, stats)\n {\n if(stats != undefined)\n {\n if(stats.size > 10000) //Log greater than 10 KB\n {\n //Rename file to enable logging to continue\n fs.rename('logs/log.txt', 'logs/log.json', function(err)\n {\n if ( err ) console.log('ERROR: ' + err);\n });\n\n //Read in file and send to the reporting team\n logInfo(\"Log size limit reached, sending log to reporting subsystem\", -1, \"N/A\", -1);\n\n var lineReader = require('readline').createInterface({\n input: require('fs').createReadStream('logs/log.json')\n });\n\n let postdata = '{ \"logs\": [';\n lineReader.on('line', function (line) {\n postdata += line + ',';\n });\n postdata += ']}';\n\n let options = {\n host: 'https://still-oasis-34724.herokuapp.com',\n port: 80,\n path: '/uploadLog',\n method: 'POST',\n dataToSend : postdata,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Content-Length': Buffer.byteLength(postdata)\n }\n };\n\n sendAuthenticationRequest(options, function(){});\n }\n }\n });\n}",
"createLoggerFile() {\n return new Promise(function (resolve, reject) {\n if (fs.existsSync(fileName)) {\n fs.appendFile(fileName, 'Server Started at ' + new Date()+\"\\r\\n\", function (err) {\n if (err) reject(err);\n resolve();\n });\n }\n else{\n fs.writeFile(fileName, 'Server Started at ' + new Date()+\"\\r\\n\", function (err) {\n if (err) reject(err);\n resolve();\n });\n }\n });\n }",
"writeLog(log) {\n\t\tlet date = new Date()\n\t\tconst month = (date.getMonth() < 10) ? \"0\" + date.getMonth() : date.getMonth()\n\t\tconst day = (date.getDate() < 10) ? \"0\" + date.getDate() : date.getDate()\n\t\tconst hours = (date.getHours() < 10) ? \"0\" + date.getHours() : date.getHours()\n\t\tconst minutes = (date.getMinutes() < 10) ? \"0\" + date.getMinutes() : date.getMinutes()\n\t\tconst secondes = (date.getSeconds() < 10) ? \"0\" + date.getSeconds() : date.getSeconds()\n\t\t\n\t\tconst currentDay = [date.getFullYear(), month, day].join(\"-\")\n\t\tconst currentHour = [hours, minutes, secondes].join(\":\")\n\n\t\tconst file = \"./src/log/log-\" + currentDay + \".json\"\n\t\tconst fileExists = fs.existsSync(file)\n\n\t\t//Check if file exists and create it with empty json\n\t\tlet json = {}\n\t\tif (!fileExists) {\n\t\t\ttry {\n\t\t\t\tfs.writeFileSync(file, JSON.stringify(json))\n\t\t\t} catch (err) {\n\t\t\t\tconsole.error(err)\n\t\t\t}\n\t\t}\n\n\t\t//read file\n\t\tjson = fs.readFileSync(file)\n\t\tjson = JSON.parse(json)\n\n\t\t//check if key is already set \n\t\tif (json[currentHour] === undefined) {\n\t\t\tjson[currentHour] = []\n\t\t}\n\t\tjson[currentHour].push(log)\n\n\t\t//append log\n\t\ttry {\n\t\t\tfs.writeFileSync(file, JSON.stringify(json))\n\t\t} catch (err) {\n\t\t\tconsole.error(err)\n\t\t}\n\t}",
"async run() {\n this.watcher = fs.watch(this.logsPath);\n console.log(\"Starting Logger...\");\n // I know this function gets a bit callback helly but its an alpha\n // after a an hour or two of refactoring im sure it can be cleaner (ex. promisify everything)\n this.watcher\n .on('change', (eventType, filename) => {\n\n // checks if its a change event and if the file is included in watchfiles\n if (eventType === 'change' && this.watchFiles.includes(filename)) {\n \n // creates a read steam from last byte read onwards\n let tmpStream = fs.createReadStream(`${this.logsPath}/${filename}`, { start: this.bytesRead[filename] });\n \n // once data is recived we process it\n tmpStream\n .on('data', (chunk) => {\n // turn buffer chunks into string\n let chunk2Str = chunk.toString();\n \n // changed this up, now it runs through line parser and then gets\n // reattached as a string to be dumped in the buffer.\n let jsonParsedLines = this.parsedLinesToJSON(this.lineParser(filename, chunk2Str));\n \n // append to buffer file\n fs.appendFile(this.tmpBuff, jsonParsedLines, (err) => {\n // errors are handled not to crash program but they dont log themselves...yet\n if (err)\n console.log(err);\n else\n // this line ensures that once the content has been read, every byte goes in the counter\n // so that next pass around it start right where it left off\n this.bytesRead[filename] += Buffer.byteLength(chunk2Str);\n\n // after getting the size of the current buffer file and based on the set interval\n // we decide if we want to send the buffer to the server or wait for more logs\n // this can be changed via interval to the developers choosing, to not make 1000 http\n // requests a second every time there is a new log line\n if (this.getFilesizeInBytes(this.tmpBuff) >= this.buffInterval)\n this.theTransporter(this.tmpBuff, this.bbToArr(this.tmpBuff));\n });\n // closing the stream\n tmpStream.close();\n });\n \n }\n else if (eventType === 'rename' && /\\d{8}-\\d{6}.log$/.test(filename) && fs.existsSync(`${this.logsPath}/${filename}`)) {\n try {\n let filePath = `${this.logsPath}/${filename}`;\n let data = fs.readFileSync(filePath);\n this.theTransporter(filePath, this.lineParser(filename, data.toString()));\n }\n catch(err) {\n console.log(err);\n }\n }\n else {\n console.log(\"Unknown eventType or buff/backlog file\");\n }\n })\n .on('error', (err) => {\n // send to server error log\n console.log(err);\n console.log(\"Logger Offline...\");\n })\n .on('close', () => {\n if (this.getFilesizeInBytes(this.tmpBuff) > 1)\n this.theTransporter(this.tmpBuff, this.bbToArr(this.tmpBuff));\n if (this.getFilesizeInBytes(this.backlog) > 1)\n this.theTransporter(this.backlog, this.bbToArr(this.backlog));\n });\n }",
"function Logger() {\n\tthis._currentLogLevel = Logger.ALL;\n\tthis._timestamps = true;\n}",
"function logger(object,event){\n\n var ti = new Date();\n // for main logs\n if(event == 'main'){\n\tfs.writeFile('/var/log/raswall/main.log',ti.toUTCString() + ' SQ ' + object.type + ' : ' + object.data + '\\n', options,function(err){\n });\n }\n // for user specfic logs \n else if(event == 'user'){\n fs.writeFile('/var/log/raswall/users/'+object.username ,ti.toUTCString() + ' SQ ' + object.type + ' : ' + object.data + '\\n', options,function(err){\n });\n }\n\n else if(event == 'debug'){\n fs.writeFile('/var/log/raswall/debug.log' ,ti.toUTCString() + ' SQ ' + object.type + ' : ' + object.data + '\\n', options,function(err){\n });\n }\n}",
"function globalLog(action, info) {\n let timeStamp = logger.getDate();\n let filePath = path.join(__dirname, '../', 'global.log');\n let data = timeStamp + ' : ' + action + ' - ' + info + '\\n';\n fs.open(filePath, 'a', (err, fd) => {\n if (err) recordErr('GLOBAL_LOG_ERROR ', err);\n fs.appendFile(fd, data, (err) => {\n if (err) recordErr('GLOBAL_LOG_ERROR ', err);\n fs.close(fd, (err) => {\n if (err) recordErr('GLOBAL_LOG_ERROR ', err);\n });\n });\n });\n return;\n}",
"function LogFile(id) {\n this.id = id;\n this.knownLoggers = {};\n this._dateBucketsByName = {};\n this._dateBuckets = [];\n this._newBuckets = [];\n}",
"function lemurlog_DoWriteLogFile(fileName, text) {\n lemurlog_WriteLogFile(fileName, text);\n lemurlog_checkAutoUpload();\n}",
"static get(lgr = \"anon\", maxLog = \"default\", force = \"default\") {\nvar i, len, lg, ref, ref1, ref2, ref3, stat, theLogger;\ntheLogger = null;\nref = Logger._loggers;\nfor (i = 0, len = ref.length; i < len; i++) {\nlg = ref[i];\nif (lg.modName === lgr) {\nif (theLogger == null) {\ntheLogger = lg;\n}\n}\n}\nstat = theLogger != null ? \"Updated\" : \"Created\";\nif (theLogger != null) {\nif (maxLog === \"default\") {\nmaxLog = theLogger.maxLog;\n}\nif (force === \"default\") {\nforce = theLogger.force;\n}\nif ((ref1 = Logger._modLogger) != null) {\nif (typeof ref1.trace === \"function\") {\nref1.trace(`get: Updating ${theLogger.modName} Logger. MaxLog ${theLogger.maxLog} -> ${maxLog}`);\n}\n}\ntheLogger._setLoggers(maxLog, force);\n} else {\nif (maxLog === \"default\") {\nmaxLog = Logger._defaultMaxLog;\n}\nif (force === \"default\") {\nforce = \"noforce\";\n}\nif ((ref2 = Logger._modLogger) != null) {\nif (typeof ref2.trace === \"function\") {\nref2.trace(`get: Create ${lgr} logger`);\n}\n}\ntheLogger = new Logger(lgr, maxLog, force);\n}\nif ((ref3 = Logger._modLogger) != null) {\nif (typeof ref3.debug === \"function\") {\nref3.debug(`${theLogger.modName} ${stat}: ${theLogger.maxLog} (${theLogger.maxLogLev}) ${theLogger.force}`);\n}\n}\nreturn theLogger;\n}",
"function LogToFile(args)\n{\n var d = new Date();\n if (arguments.length) {\n msg = d.getFullYear() + '-' + Pad2(d.getMonth()+1) + '-' + Pad2(d.getDate()) + ' ' +\n Pad2(d.getHours()) + ':' + Pad2(d.getMinutes()) + ':' +\n Pad2(d.getSeconds()) + ' ' + Array.from(arguments).join(' ');\n } else {\n msg = '';\n }\n fs.appendFile('cute_server_'+d.getFullYear()+Pad2(d.getMonth()+1)+'.log', msg+'\\n', \n function(error) {\n if (error) console.log(error, 'writing log file');\n }\n );\n return msg;\n}",
"function logging(type, margin, exchangeRate, usd, price){\n fs.readFile('logs/params.json', function (err, data) {\n if (err){\n console.log(err)\n }\n else{\n var json = JSON.parse(data)\n json[String(counter)] = {\"type\": type, \"margin\":margin,\"exchangeRate\":exchangeRate,\"USD_price\":usd,\"NGN_price\":price,\"Timestamp\":Date()}\n counter = counter + 1\n fs.writeFileSync(\"logs/params.json\", JSON.stringify(json))\n }\n \n })\n}",
"writeLog(label, data) {\n if (this.processes.hasOwnProperty(label)) {\n let filePath = this.processes[label].logPath;\n let date = new Date().toLocaleString(\"es-ES\", {timeZone: \"America/Santiago\"}).replace(/T/, ' ').replace(/\\..+/, '');\n let lines = data.split(\"\\n\");\n for (let i in lines) {\n let line = lines[i];\n let result = \"[\"+date+\"] \"+line+\"\\n\";\n fs.appendFile(filePath,result,function(err) {\n if (err) throw err;\n });\n }\n }\n }",
"function Logger() {\n this._logHandler = new NullLogHandler();\n }"
]
| [
"0.66316384",
"0.6213382",
"0.59326875",
"0.5902909",
"0.58307755",
"0.58197993",
"0.5802454",
"0.57567525",
"0.5694818",
"0.5627106",
"0.55963695",
"0.55963695",
"0.55963695",
"0.55477667",
"0.55477667",
"0.5485831",
"0.54696065",
"0.5381219",
"0.5357346",
"0.53321844",
"0.52678293",
"0.52663106",
"0.5259294",
"0.52418154",
"0.52364236",
"0.5214726",
"0.5211292",
"0.5204441",
"0.51807284",
"0.5169529"
]
| 0.6809766 | 0 |
set a vector as the elementwise product of two others | function setmulvec(dest, a, b){
for(var i = a.length; i--;) dest[i] = a[i] * b[i];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function vector_product(a, b) {\n return a.x * b.y - a.y * b.x;\n}",
"function multiple(){\n results.value = Number(a.value) * Number(b.value);\n }",
"function addmulvec(dest, a, b){\n for(var i = a.length; i--;) dest[i] += a[i] * b[i];\n}",
"function product(a, b) {\n a = (0 in arguments) ? a : 1;\n b = (1 in arguments) ? b : 1;\n return b;\n }",
"function product(a, b) {\n a = a !== undefined ? a : 1;\n b = b !== undefined ? b : 1;\n return a*b;\n }",
"multiply(multiplier) {\n return new Vector(this.x * multiplier, this.y * multiplier);\n }",
"static scalarProduct(v1,v2){\n\t\tif(v1.constructor === Vector && v2.constructor === Vector){\n\t\t\treturn (v1.x*v2.x + v1.y*v2.y);\n\t\t}else{\n\t\t\tthrow {error:-1,message: \"v1 or v2 is not a Vector.\"};\n\t\t}\n\t}",
"static mult(v1, v2, target)\r\n {\r\n if (!target)\r\n target = v1.copy();\r\n else \r\n target.set(v1);\r\n \r\n target.mult(v2);\r\n \r\n return target;\r\n }",
"function dotProduct(a, b) {\n return a.reduce(function (sum, v, i) {\n return sum + (v * b[i]);\n }, 0);\n}",
"prod_esc(vec){ return (vec.x*this.x + vec.y*this.y + vec.z*this.z);}",
"function addMultipleVector(a, multiple, b) {\r\n return [a[0] + multiple * b[0], \r\n a[1] + multiple * b[1]];\r\n}",
"function product(a, b) {\n a = a || 1;\n b = b || 1;\n return a*b;\n }",
"function scalar(u,v){\r\n\t\tvar i =0;\r\n\t\tvar res =0;\r\n\t\tfor(i=0;i<u.length;i++)\r\n\t\t\tres += u[i]*v[i];\r\n\t\treturn res;\r\n\t}",
"Multiply(values) {\n let vec = new VecX(values);\n while (vec.size < this.size) {\n vec.values.push(vec.values[0]);\n }\n ;\n this.values = this.values.map((val, index) => val * vec.values[index]);\n return this;\n }",
"function multVector (vec1, multiplier) {\n return [vec1[X] * multiplier, vec1[Y] * multiplier];\n}",
"mul(other) {\n return this.__mul__(other);\n }",
"function scalarProduct([a, b], [c, d]) {return a*c + b*d;}",
"function product(a, b) {\n return a * b;\n}",
"function multiplyVect(vector, scalar) {\n return [ scalar * vector[0],\n scalar * vector[1],\n scalar * vector[2]\n ];\n}",
"function innerProduct(v1, v2) {\n return v1.x * v2.x + v1.y * v2.y;\n }",
"multiply(number) {\r\n return new Vector(...new Array(this.getDimensions()).fill(undefined).map((e, i) => this.values[i] * number));\r\n }",
"function mul( p0, p1 ) {\n return {x: p0.x * p1.x, y: p0.y * p1.y};\n}",
"function product(numbers) {\n var result = 1;\n numbers.forEach(function (number) {\n result *= number;\n });\n return result;\n}",
"function product(a,b){\n return a * b;\n}",
"function dotProduct(a, b) {\n\t\t \treturn (a.x * b.x) + (a.y * b.y) + (a.z + b.z);\n\t\t }",
"function obtenerProductoEscalar(v1, v2, cantidad) {\n let acum=0;\n let indice;\n for (indice=0; indice<cantidad; indice++) {\n acum = acum + (v1[indice] * v2[indice]);\n }\n return acum;\n}",
"mul(val) {\r\n let a = this.a * val.a;\r\n let b = this.b * val.b;\r\n return new Rational(a,b).reduce();\r\n }",
"mul(a, b) {\n\t\tthis.registers[a] *= this.get(b);\n\t}",
"function multiply(a, b) {\n return [a[0] * b[0] + a[1] * b[3], a[0] * b[1] + a[1] * b[4], a[0] * b[2] + a[1] * b[5] + a[2], a[3] * b[0] + a[4] * b[3], a[3] * b[1] + a[4] * b[4], a[3] * b[2] + a[4] * b[5] + a[5]];\n}",
"static Multiply(vec1, vec2) {\n vec1 = new Vec2(vec1);\n vec2 = new Vec2(vec2);\n return new Vec2(vec1.x * vec2.x, vec1.y * vec2.y);\n }"
]
| [
"0.74677026",
"0.7085743",
"0.7004867",
"0.69605833",
"0.69461644",
"0.6898884",
"0.68982893",
"0.6879464",
"0.6866489",
"0.6790204",
"0.677751",
"0.6737516",
"0.6719198",
"0.67145056",
"0.66751516",
"0.6660845",
"0.6595616",
"0.65816575",
"0.6572185",
"0.6543904",
"0.6529034",
"0.65110713",
"0.6509532",
"0.6501204",
"0.6498436",
"0.6497902",
"0.64774096",
"0.64742833",
"0.64518917",
"0.64446795"
]
| 0.7573702 | 0 |
add the elementwise product of two vectors to another | function addmulvec(dest, a, b){
for(var i = a.length; i--;) dest[i] += a[i] * b[i];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function vector_product(a, b) {\n return a.x * b.y - a.y * b.x;\n}",
"function dotProduct(a, b) {\n return a.reduce(function (sum, v, i) {\n return sum + (v * b[i]);\n }, 0);\n}",
"function vectorAdd(a, b) {\n\treturn [ a[0] + b[0], a[1] + b[1] ];\n}",
"function vecAddInPlace(a, b) {\n for (var i = 0; i < a.length; i++) {\n a[i] += b[i];\n };\n}",
"function crossProduct(vec1, vec2) {\n let sum = 0;\n for (let i = 0; i < vec1.length; i++) {\n sum += vec1[i] * vec2[i];\n }\n return sum;\n}",
"function vectSum(a,b) {\n return a.map(function(val,i) { return a[i]+b[i] })\n}",
"function dotProduct(vector1, vector2) { \n\treturn vector1[0]*vector2[0] + vector1[1]*vector2[1];\n}",
"static scalarProduct(v1,v2){\n\t\tif(v1.constructor === Vector && v2.constructor === Vector){\n\t\t\treturn (v1.x*v2.x + v1.y*v2.y);\n\t\t}else{\n\t\t\tthrow {error:-1,message: \"v1 or v2 is not a Vector.\"};\n\t\t}\n\t}",
"function addMultipleVector(a, multiple, b) {\r\n return [a[0] + multiple * b[0], \r\n a[1] + multiple * b[1]];\r\n}",
"function dotProduct(...vectors) {\n if (!vectors.length) {\n return null;\n }\n\n const acc = new Array(vectors[0].length).fill(1);\n\n for (let i = 0; i < vectors.length; i++) {\n for (let k = 0; k < vectors[i].length; k++) {\n acc[k] *= vectors[i][k];\n }\n }\n\n const sum = acc.reduce((prev, curr) => prev + curr, 0);\n if (isNaN(sum)) {\n return null;\n }\n return sum;\n}",
"function inner_product(first_vector , second_vector){\n // Returns the inner product of two vectors\n let sum = 0;\n for (let i=0; i<2; i++) {\n sum += first_vector[i] * second_vector[i];\n }\n return sum;\n}",
"function addVectors(a, b){\n var x = a.x + b.x;\n var y = a.y + b.y;\n return new Vector(x, y);\n}",
"function dotProduct(a, b) {\n\t\t \treturn (a.x * b.x) + (a.y * b.y) + (a.z + b.z);\n\t\t }",
"function setmulvec(dest, a, b){\n for(var i = a.length; i--;) dest[i] = a[i] * b[i];\n}",
"function innerProduct(v1, v2) {\n return v1.x * v2.x + v1.y * v2.y;\n }",
"function dotVect(a, b) {\n return [ a[0] * b[0]+\n a[1] * b[1]+\n a[2] * b[2] \n ]; \n}",
"function dot_product(A,B){\n product = 0;\n product += A[0]*B[0] + A[0]*B[1];\n product += A[1]*B[0] + A[1]*B[1];\n return product;\n}",
"function addVectors(vec1, vec2) {\n var result = [];\n var i;\n for (i = 0; i < vec1.length;i++) {\n result[i] = vec1[i] + vec2[i];\n }\n return result;\n}",
"function dotProduct(ary1, ary2) {\n const product = ary1.reduce((prev, curr, ind) => {\n return prev + curr * ary2[ind];\n }, 0);\n\n return product;\n}",
"function vadd(a,b) { return [a[0]+b[0], a[1]+b[1]] }",
"function dotProduct(u, v) {\n var u1 = u[0];\n var u2 = u[1];\n var v1 = v[0];\n var v2 = v[1];\n var result = u1*v1 + u2*v2;\n return result;\n}",
"function addVect(a, b) {\n return [ a[0] + b[0],\n a[1] + b[1],\n a[2] + b[2]\n ];\n}",
"function dot(vector1, vector2) {\n var result = 0;\n for (var i = 0; i < 3; i++) {\n result += vector1[i] * vector2[i];\n }\n return result;\n}",
"function dot(a, b){\n var i, sum = 0; \n for (i = 0; i < a.length; i ++){ sum += (a[i] * b[i]);}\n return sum;\n}",
"static dot(vectorA, vectorB){\n\n \tif(!vectorA.z) vectorA.z = 0;\n \tif(!vectorB.z) vectorB.z = 0;\n \n let sum = 0;\n \n sum += vectorA.x * vectorB.x;\n sum += vectorA.y * vectorB.y;\n sum += vectorA.z * vectorB.z;\n \t\n \treturn sum;\n \n }",
"static mult(a, b) {\n let x = [];\n for (let row = 0; row < a.length; row++) {\n let y = [];\n for (let col = 0; col < b[0].length; col++) {\n let sum = 0;\n for (let k = 0; k < b.length; k++) {\n sum += a[row][k] * b[k][col];\n }\n y.push(sum);\n }\n x.push(y);\n }\n return x;\n }",
"static sum(vectors)\n\t{\n\t\t//TODO: done\n\t\tvar result = vectors[0];\n\t\tfor (var i=1; i<vectors.length; ++i)\n\t\t\tresult.add(vectors[i]);\n\t\treturn result;\n\t}",
"function dot(v0, v1) {\n for (var i = 0, sum = 0; v0.length > i; ++i) sum += v0[i] * v1[i];\n return sum;\n}",
"function productOfSums(array1, array2) {\n var result;\n result = total(array1) * total(array2);\n return result;\n}",
"addVectors(vec1, vec2) {\n return [vec1[0] + vec2[0], vec1[1] + vec2[1]];\n }"
]
| [
"0.7678153",
"0.7377385",
"0.7313809",
"0.7152705",
"0.7035703",
"0.6997022",
"0.69657123",
"0.69481725",
"0.6922437",
"0.68786275",
"0.68783504",
"0.68415916",
"0.6811938",
"0.6758713",
"0.6722696",
"0.6712463",
"0.67064494",
"0.6699543",
"0.6693455",
"0.6685542",
"0.66748935",
"0.6631385",
"0.6608808",
"0.65664285",
"0.65559465",
"0.6535237",
"0.65004086",
"0.6451318",
"0.64341533",
"0.64108336"
]
| 0.77976996 | 0 |
returns the index of the maximal element | function max_index(n){
var m = n[0], b = 0;
for(var i = 1; i < n.length; i++)
if(n[i] > m) m = n[b = i];
return b;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findMaxItem(arr) {\n let len = arr.length\n let max = -Infinity\n let index = -1\n\n while (len--) {\n if (arr[len] > max) {\n max = arr[len]\n index = len\n }\n }\n return { index, max }\n }",
"get maxIndex() {\n return Number(this.getAttribute(\"max\"));\n }",
"function getIndexOfMaximumValue(tableau) {\n var max = tableau[0].text;\n var index = 0;\n for(var i=1; i < tableau.length; i++) {\n if( max < tableau[i].text) { \n max = tableau[i].text;\n index = i; \n }\n } \n return index;\n }",
"function maxValue (arr) {\r\n// liefert die indexnummer des elmentes im array 'arr' mit dem groessten wert\r\n var maxV;\r\n if (arr.length > 0) { // wenn das array ueberhaupt elemente enthaelt\r\n maxV = 0;\r\n for (i = 1; i < arr.length; i++) {\r\n if (arr[i]>arr[maxV]) { maxV = i; }\r\n }\r\n } else {\r\n maxV = null\r\n }\r\n return maxV; \r\n}",
"function indexOfMax(arr) {\n if (arr.length === 0) {\n return -1\n }\n let max = arr[0]\n let maxIndex = 0\n for (var i = 1; i < arr.length; i++) {\n if (arr[i] > max) {\n maxIndex = i\n max = arr[i]\n }\n }\n return maxIndex\n}",
"function indexOfMax(arr) {\r\n if (arr.length === 0) {\r\n return -1;\r\n }\r\n\r\n var max = arr[0];\r\n var maxIndex = 0;\r\n\r\n for (var i = 1; i < arr.length; i++) {\r\n if (arr[i] > max) {\r\n maxIndex = i;\r\n max = arr[i];\r\n }\r\n }\r\n\r\n return maxIndex;\r\n}",
"function indexOfMax(arr) {\n if (arr.length === 0) {\n return -1;\n }\n\n var max = arr[0];\n var maxIndex = 0;\n\n for (var i = 1; i < arr.length; i++) {\n if (arr[i] > max) {\n maxIndex = i;\n max = arr[i];\n }\n }\n\n return maxIndex;\n}",
"function indexHighestNumber(arr) {\n var big = -Infinity\n arr.forEach(function(ele){\n if(ele > big) {\n big = ele\n }\n })\n return a.lastIndexOf(\"big\")\n}",
"function getMaxIndex(xarray) {\n\tvar N = xarray.length;\n\tvar ix = 0;\n\tvar peak = xarray[0];\n\tfor(var i = 1; i < N; i++) {\n\t\tif(xarray[i]>peak) {\n\t\t\tpeak = xarray[i];\n\t\t\tix = i;\n\t\t}\n\t}\n\t\n\treturn ix;\n}",
"function maxIndex(array) {\n let maxIndex = 0;\n for (let i = 1; i < array.length; i++) {\n if (array[i] > array[maxIndex]) {\n maxIndex = i;\n }\n }\n return maxIndex;\n}",
"function maxKivalasztasValue(arr) {\n let maxValue = 0;\n let maxIndex = 0;\n for (let i = 1; i < arr.length; i++) {\n if (arr[i] > maxValue) {\n maxValue = arr[i];\n maxIndex = i;\n }\n }\n return maxValue;\n}",
"getLastIndex() {\n return (this.maxIndex - Math.floor(this.index) - 1) % this.maxIndex;\n }",
"findMax() {\r\n\t\treturn this.heap[0];\r\n\t}",
"function getLargestValueInIndex(arr) {\n\tvar largestIndex = -1;\n\tvar largestValue = -Infinity;\n\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tif (arr[i] > largestValue) {\n\t\t\tlargestValue = arr[i];\n\t\t\tlargestIndex = i;\n\t\t}\n\t}\n\treturn largestIndex;\n}",
"function findMaxIdx(arr, lastIdx) {\n let maxIdx = 0;\n for (let i = 1; i <= lastIdx; i++) {\n if (arr[i] > arr[maxIdx]) maxIdx = i\n }\n return maxIdx;\n }",
"function getMaxPosition()\n{\n\tvar position = 1;\n\tjQuery('.jquery-toolkit ul li').each(function(){\n\t\tposition = Math.max(position, parseInt(jQuery(this).data('index')));\n\t});\n\treturn position;\n}",
"function max(index) {\n var max = index[0];\n for (var i = 0; i < index.length; i++) {\n if (index[i] > max) {\n max = index[i];\n }\n }\n return max;\n}",
"function findMax (list) {\n let index = 0;\n let max = 0;\n for (let i = 0; i < list.length; i++) {\n if (list[i] > max) {\n max = list[i];\n index = i;\n }\n }\n return index;\n}",
"function findMax(ar)\r\n{\r\n\tvar maxnum = ar.reduce((cur,item) =>{\r\n\t\tif(item > cur)\r\n\t\t\treturn item;\r\n\t\treturn cur;\r\n\t},0)\r\n\treturn maxnum;\r\n}",
"function max (ary, test, wantIndex) {\n var max = null, _max = -1\n if(!ary.length) return\n\n for (var i = 0; i < ary.length; i++)\n if(test(max, ary[i])) max = ary[_max = i]\n return wantIndex ? _max : max\n}",
"function indexOfLargest(a) {\n\t\t\tvar largest = 0;\n\t\t\tfor (var i = 1; i < a.length; i++) {\n\t\t\t\tif (a[i] > a[largest]) largest = i;\n\t\t\t}\n\t\t\treturn largest;\n\t\t}",
"function max(arr){\n return sortNumbers(arr)[arr.length - 1];\n }",
"maximum() {\n // Write your code here\n\tvar max = this.arr[0];\n\tfor(var i=0;i<this.arr.length;i++){\n\t\tif(max>this.arr[i]){\n\t\t max = max;\n\t\t}else{\n\t\t\tmax = this.arr[i];\n\t\t}\n\t}\n\treturn max;\n }",
"findIndexOfGreatest(array) {\n let greatest;\n let indexOfGreatest;\n for (let i = 0; i < array.length; i++) {\n if (greatest === null || greatest === undefined || array[i] > greatest) {\n greatest = array[i];\n indexOfGreatest = i;\n }\n }\n return indexOfGreatest;\n }",
"function largest_e(array){\n // Create a function that returns the largest element in a given array.\n // For example largestElement( [1,30,5,7] ) should return 30.\n var max = array[0];\n for(var i=1; i< array.length; i++){\n if (array[i]> max){\n max = array[i];\n }\n }\n return max\n\n}",
"function get_index_of_largest_value(arr) {\n let indices_of_largest = [];\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] == max(arr)) {\n indices_of_largest.push(i);\n }\n }\n return indices_of_largest[Math.floor(Math.random() * indices_of_largest.length)];\n}",
"function findMax(ar)\r\n {\r\n \t\tlet i;\r\n \t let ma = ar[0];\r\n\tfor (i = 1; i < ar.length; i++) {\r\n if (ar[i] > ma)\r\n ma = ar[i];\r\n }\r\n\r\n \t\treturn ma;\r\n }",
"function max(arr){\n\tvar max = arr[0];\n\tfor (var i =0 ; i < arr.length-1 ; i++){\n\t\tif (maxNum < arr[i]){\n\t\t\treturn arr[i];\n\t\t}\n\t}\n\treturn maxNum;\n}",
"function indexOfMaxValue(arr, key) {\n var maxWeight = -Infinity;\n var idx = -1;\n arr.forEach(function(o, i) {\n if (o.weight > maxWeight) {\n idx = i;\n maxWeight = o.weight;\n }\n });\n return idx;\n }",
"function findMax(ar)\n{\n max = 0\n for(x of arr){\n if(max<x)\n max=x\n }\n return max\n}"
]
| [
"0.7659736",
"0.75277543",
"0.75142074",
"0.74478006",
"0.74185216",
"0.7382815",
"0.7375305",
"0.7373277",
"0.736681",
"0.7282791",
"0.7269045",
"0.71506506",
"0.7141066",
"0.71338856",
"0.7114232",
"0.71062475",
"0.70754445",
"0.70227444",
"0.7011901",
"0.6970003",
"0.69545424",
"0.6912283",
"0.69099885",
"0.68958086",
"0.6890213",
"0.6836403",
"0.67934376",
"0.6780333",
"0.67574537",
"0.6745326"
]
| 0.7871901 | 0 |
returns the maximal element according to a metric | function max_element(n, metric){
var m = metric(n[0]), b = n[0];
for(var i = 1; i < n.length; i++){
var v = metric(n[i]);
if(v > m){
m = v;
b = n[i];
}
}
return b;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function msMax() {\n\t\tlet max1 = msSingle.reduce((a, b) => {\n\t\t\treturn a[1] > b[1] ? a : b;\n\t\t});\n\n\t\treturn parseInt(max1[0]); //function being reduced has 2 key/value pairs in each object. reducing to max in value index 1 then returning value index 0;\n\t}",
"finalMax(measure) {\n var subscription = this.extract(measure)\n .max()\n .subscribe(x => console.log(x));\n return subscription;\n }",
"max() {}",
"function calcMetaDataField_max(data,params,field)\n{\n var target = field.target[0]; // these are always arrays coming in\n\n var dataTarget = normalizeDataItem(data,target);\n var max = null;\n\n for(var i=0; i < dataTarget.length; i++) {\n\tvar thisNumber = parseFloat(dataTarget[i]);\n\tif(max===null || thisNumber > max){\n\t max = thisNumber;\n\t} \n }\n\n return(max);\n}",
"extractMax(S) {}",
"maximum() {\n // Write your code here\n\tvar max = this.arr[0];\n\tfor(var i=0;i<this.arr.length;i++){\n\t\tif(max>this.arr[i]){\n\t\t max = max;\n\t\t}else{\n\t\t\tmax = this.arr[i];\n\t\t}\n\t}\n\treturn max;\n }",
"function maximumBy(f, xs) {\n return xs.reduce(function (a, x) {\n return a === undefined ? x : (\n f(x, a) > 0 ? x : a\n );\n }, undefined);\n }",
"function max(x) {\n var i;\n var mmax = x[0];\n\n for (i = 0; i < x.length; i++) {\n if (x[i] > mmax) {\n mmax =x[i];\n }\n }\n return mmax;\n}",
"getMax() {\n let values = [];\n let current = this.head;\n\n // collect all values in the list\n while (current) {\n values.push(current.value);\n\n current = current.next;\n }\n\n return values.length === 0 ? null : Math.max(...values);\n }",
"findMax() {\r\n\t\treturn this.heap[0];\r\n\t}",
"function result_max() {\n result_a = flotr_data[0].data.filter(isBigEnough(area.x1)).filter(isSmallEnough(area.x2)).reduce(\n function(max, arr) {\n return max >= arr[1] ? max : arr[1];\n }, -Infinity);\n\n if (typeof flotr_data[1] !== \"undefined\") {\n if ( typeof flotr_data[1].yaxis === \"undefined\") {\n result_b = flotr_data[1].data.filter(isBigEnough(area.x1)).filter(isSmallEnough(area.x2)).reduce(function(max, arr) {\n return max >= arr[1] ? max : arr[1];\n }, -Infinity);\n if (result_b > result_a ){\n return result_b;\n }\n }\n }\n return result_a;\n }",
"function maxOf(array){\n if(array.length === 1){\n return array[0]\n } else{\n return Math.max(array.pop(), maxOf(array))\n }\n}",
"function maxOf(arr) {\n // return Math.max(...arr)\n if (arr.length === 1) {\n return arr[0];\n } else {\n return Math.max(arr.pop(), maxOf(arr));\n }\n}",
"function getInputMax(idx) {\r\n\tvar result = $(inputmetadata[idx]).find(\"maxes>data\");\r\n\tif (result == null || result.text() == null) {return -100;}\r\n\telse return parseFloat(extract(result.text()));\r\n}",
"function calculateMax(array) {\n return array.reduce(function(max, elem) {\n return (elem > max) ? elem : max;\n }, array[0]);\n}",
"maximum() {\n if (this.isEmpty()) {\n return null;\n }\n\n return this.doMaximum(this.root).key;\n }",
"findJobMax(getterFn) {\n const jobsSorted = this.sampleJobs\n .slice()\n .sort((job1, job2) => getterFn(job2) - getterFn(job1));\n return getterFn(jobsSorted[0]);\n }",
"function getHighest($array){\n var biggest = Math.max.apply( null, $array );\n return biggest;\n}",
"function max(x) {\n var value = x[0];\n for (var i = 1; i < x.length; i++) {\n if (x[i] > value) {\n value = x[i];\n }\n }\n return value;\n}",
"function maxValue(quakeArray, attr){\n // searches through all the quakes in an array to find the largest value for a particular attribute\n return _.max(_.map(quakeArray, attr))\n\n}",
"function findMax(arr){\n //sort the array\n //Math.max\n //array.reduce\n //use for loops and if statements\n //return Math.max(...arr);\n return arr.reduce(function(val, current){\n return Math.max(val, current);\n })\n\n}",
"max() {\r\n return this.maxHelper(this.root);\r\n }",
"function max(arr, fn){\n\tif (fn){\n\t\tarr.forEach(fn());\n\t\treturn Math.max(arr)\n\t}\n\treturn Math.max(arr)\n}",
"extractMax() {\n const max = this.values[0];\n const end = this.values.pop();\n this.values[0] = end;\n this.sinkDown();\n return max;\n }",
"function largest_e(array){\n // Create a function that returns the largest element in a given array.\n // For example largestElement( [1,30,5,7] ) should return 30.\n var max = array[0];\n for(var i=1; i< array.length; i++){\n if (array[i]> max){\n max = array[i];\n }\n }\n return max\n\n}",
"function getMaxValue(series) {\n var data = [],\n item;\n\n for (item in series) {\n if (series.hasOwnProperty(item)) {\n data = data.concat(series[item]);\n }\n }\n\n return Math.max.apply(Math, data);\n }",
"function getMaxWeightValue(d) {\n var maxWeight = Math.max.apply(null, d.weights);\n var i = d.weights.indexOf(maxWeight);\n return d.values[i]; // return highest weighted value\n }",
"function getMaxValue(data){\n let max = 0\n let t_max\n data.forEach(function(e) { \n t_max = d3.max(Object.values(e));\n if(t_max > max) {\n max = t_max;\n } \n });\n return max;\n}",
"function Max( array ){\n\t\treturn Math.max.apply( Math, array );\n\t}",
"getMaxFitness() {\n var record = 0;\n for (var i = 0; i < this.population.length; i++) {\n if (this.population[i].getFitness() > record) {\n record = this.population[i].getFitness();\n }\n }\n return record;\n }"
]
| [
"0.6608896",
"0.64870214",
"0.6480787",
"0.646891",
"0.64675325",
"0.63979",
"0.6376412",
"0.6286211",
"0.62834084",
"0.626417",
"0.6255048",
"0.6236694",
"0.62311286",
"0.62240356",
"0.6222924",
"0.61820006",
"0.6175195",
"0.61678094",
"0.6156411",
"0.6154091",
"0.61538976",
"0.61212933",
"0.6119813",
"0.6118513",
"0.61093795",
"0.60660875",
"0.6047083",
"0.6027291",
"0.60262144",
"0.6025927"
]
| 0.8359975 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.